diff --git a/.vscode/cspell.json b/.vscode/cspell.json index b011113169e6..7912e2bb84f5 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -396,6 +396,13 @@ "Phong" ] }, + { + "filename": "sdk/core/azure-core/tests/test_serialization.py", + "words": [ + "Rlcw", + "Jwcmlud" + ] + }, { "filename": "sdk/tables/azure-data-tables/tests/**/*.py", "words": [ diff --git a/eng/black-pyproject.toml b/eng/black-pyproject.toml new file mode 100644 index 000000000000..30e6cdc1416e --- /dev/null +++ b/eng/black-pyproject.toml @@ -0,0 +1,8 @@ +[tool.black] +line-length = 120 +extend-exclude = ''' +# Exclude some directories from formatting (note the slashes surrounding the pattern) +/( + azure/ai/ml/_restclient +)/ +''' \ No newline at end of file diff --git a/eng/common/pipelines/templates/jobs/perf.yml b/eng/common/pipelines/templates/jobs/perf.yml index ff2d53162558..073e5de641cb 100644 --- a/eng/common/pipelines/templates/jobs/perf.yml +++ b/eng/common/pipelines/templates/jobs/perf.yml @@ -2,18 +2,15 @@ parameters: - name: JobName type: string default: 'Perf' +- name: TimeoutInMinutes + type: number + default: '360' - name: LinuxPool type: string - default: 'azsdk-pool-mms-ubuntu-2004-perf' -- name: LinuxVmImage - type: string - default: 'MMSUbuntu20.04' + default: 'azsdk-pool-mms-ubuntu-2204-perf' - name: WindowsPool type: string - default: 'azsdk-pool-mms-win-2019-perf' -- name: WindowsVmImage - type: string - default: 'MMS2019' + default: 'azsdk-pool-mms-win-2022-perf' - name: Language type: string default: '' @@ -65,18 +62,16 @@ parameters: jobs: - job: ${{ parameters.JobName }} - timeoutInMinutes: 360 + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} strategy: matrix: ${{ if contains(parameters.OperatingSystems, 'Linux') }}: Linux: Pool: ${{ parameters.LinuxPool }} - OsVmImage: ${{ parameters.LinuxVmImage }} MatrixName: 'Linux' ${{ if contains(parameters.OperatingSystems, 'Windows') }}: Windows: Pool: ${{ parameters.WindowsPool }} - OsVmImage: ${{ parameters.WindowsVmImage }} MatrixName: 'Windows' variables: - ${{ parameters.Variables }} @@ -87,7 +82,6 @@ jobs: value: '' pool: name: $(Pool) - vmImage: $(OSVmImage) steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -106,10 +100,6 @@ jobs: Commitish: ${{ parameters.ToolsRepoCommitish }} WorkingDirectory: $(System.DefaultWorkingDirectory)/azure-sdk-tools - - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml - parameters: - AgentImage: $(OSVmImage) - - ${{ parameters.InstallLanguageSteps }} - template: /eng/common/TestResources/deploy-test-resources.yml diff --git a/eng/common/scripts/get-codeowners.ps1 b/eng/common/scripts/get-codeowners.ps1 index 87271a6230d8..5c2bb9b50ab2 100644 --- a/eng/common/scripts/get-codeowners.ps1 +++ b/eng/common/scripts/get-codeowners.ps1 @@ -1,25 +1,86 @@ +<# +.SYNOPSIS +A script that given as input $TargetPath param, returns the owners +of that path, as determined by CODEOWNERS file passed in $CodeOwnersFileLocation +param. + +.PARAMETER TargetPath +Required*. Path to file or directory whose owners are to be determined from a +CODEOWNERS file. e.g. sdk/core/azure-amqp/ or sdk/core/foo.txt. + +*for backward compatibility, you might provide $TargetDirectory instead. + +.PARAMETER TargetDirectory +Obsolete. Replaced by $TargetPath. Kept for backward-compatibility. +If both $TargetPath and $TargetDirectory are provided, $TargetDirectory is +ignored. + +.PARAMETER CodeOwnerFileLocation +Optional. An absolute path to the CODEOWNERS file against which the $TargetPath param +will be checked to determine its owners. + +.PARAMETER ToolVersion +Optional. The NuGet package version of the package containing the "retrieve-codeowners" +tool, around which this script is a wrapper. + +.PARAMETER ToolPath +Optional. The place to check the "retrieve-codeowners" tool existence. + +.PARAMETER DevOpsFeed +Optional. The NuGet package feed from which the "retrieve-codeowners" tool is to be installed. + +NuGet feed: +https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-net/NuGet/Azure.Sdk.Tools.RetrieveCodeOwners + +Pipeline publishing the NuGet package to the feed, "tools - code-owners-parser": +https://dev.azure.com/azure-sdk/internal/_build?definitionId=3188 + +.PARAMETER VsoVariable +Optional. If provided, the determined owners, based on $TargetPath matched against CODEOWNERS file at $CodeOwnerFileLocation, +will be output to Azure DevOps pipeline log as variable named $VsoVariable. + +Reference: +https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch +https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#logging-command-format + +.PARAMETER IncludeNonUserAliases +Optional. Whether to include in the returned owners list aliases that are team aliases, e.g. Azure/azure-sdk-team + +.PARAMETER Test +Optional. Whether to run the script against hard-coded tests. + +#> param ( - [string]$TargetDirectory = "", # Code path to code owners. e.g sdk/core/azure-amqp - [string]$CodeOwnerFileLocation = (Resolve-Path $PSScriptRoot/../../../.github/CODEOWNERS), # The absolute path of CODEOWNERS file. - [string]$ToolVersion = "1.0.0-dev.20230108.6", - [string]$ToolPath = (Join-Path ([System.IO.Path]::GetTempPath()) "codeowners-tool-path"), # The place to check the tool existence. Put temp path as default - [string]$DevOpsFeed = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json", # DevOp tool feeds. - [string]$VsoVariable = "", # Option of write code owners into devop variable - [switch]$IncludeNonUserAliases, # Option to filter out the team alias in code owner list. e.g. Azure/azure-sdk-team - [switch]$Test #Run test functions against the script logic + [string]$TargetPath = "", + [string]$TargetDirectory = "", + # The path used assumes the script is located in azure-sdk-tools/eng/common/scripts/get-codeowners.ps1 + [string]$CodeOwnerFileLocation = (Resolve-Path $PSScriptRoot/../../../.github/CODEOWNERS), + # The $ToolVersion 1.0.0-dev.20230214.3 includes following PR: + # Use CodeownersFile.UseRegexMatcherDefault everywhere where applicable + remove obsolete tests + # https://github.com/Azure/azure-sdk-tools/pull/5437 + # + # but not this one: + # Remove the obsolete, prefix-based CODEOWNERS matcher & related tests + # https://github.com/Azure/azure-sdk-tools/pull/5431 + [string]$ToolVersion = "1.0.0-dev.20230214.3", + [string]$ToolPath = (Join-Path ([System.IO.Path]::GetTempPath()) "codeowners-tool-path"), + [string]$DevOpsFeed = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json", + [string]$VsoVariable = "", + [switch]$IncludeNonUserAliases, + [switch]$Test ) -function Get-CodeOwnersTool() +function Get-CodeownersTool() { - $command = Join-Path $ToolPath "retrieve-codeowners" - # Check if the retrieve-codeowners tool exsits or not. - if (Get-Command $command -errorAction SilentlyContinue) { - return $command + $codeownersToolCommand = Join-Path $ToolPath "retrieve-codeowners" + # Check if the retrieve-codeowners tool exists or not. + if (Get-Command $codeownersToolCommand -errorAction SilentlyContinue) { + return $codeownersToolCommand } if (!(Test-Path $ToolPath)) { New-Item -ItemType Directory -Path $ToolPath | Out-Null } - Write-Host "Installing the retrieve-codeowners tool under $ToolPath... " + Write-Host "Installing the retrieve-codeowners tool under tool path: $ToolPath ..." # Run command under tool path to avoid dotnet tool install command checking .csproj files. # This is a bug for dotnet tool command. Issue: https://github.com/dotnet/sdk/issues/9623 @@ -27,46 +88,64 @@ function Get-CodeOwnersTool() dotnet tool install --tool-path $ToolPath --add-source $DevOpsFeed --version $ToolVersion "Azure.Sdk.Tools.RetrieveCodeOwners" | Out-Null Pop-Location # Test to see if the tool properly installed. - if (!(Get-Command $command -errorAction SilentlyContinue)) { - Write-Error "The retrieve-codeowners tool is not properly installed. Please check your tool path. $ToolPath" + if (!(Get-Command $codeownersToolCommand -errorAction SilentlyContinue)) { + Write-Error "The retrieve-codeowners tool is not properly installed. Please check your tool path: $ToolPath" return } - return $command + return $codeownersToolCommand } -function Get-CodeOwners ([string]$targetDirectory, [string]$codeOwnerFileLocation, [bool]$includeNonUserAliases = $false) +function Get-Codeowners( + [string]$targetPath, + [string]$targetDirectory, + [string]$codeownersFileLocation, + [bool]$includeNonUserAliases = $false) { - $command = Get-CodeOwnersTool - # Filter out the non user alias from code owner list. - if($includeNonUserAliases) { - $codeOwnersString = & $command --target-directory $targetDirectory --code-owner-file-path $codeOwnerFileLocation 2>&1 - } - else { - $codeOwnersString = & $command --target-directory $targetDirectory --code-owner-file-path $codeOwnerFileLocation --filter-out-non-user-aliases 2>&1 + # Backward compaitiblity: if $targetPath is not provided, fall-back to the legacy $targetDirectory + if ([string]::IsNullOrWhiteSpace($targetPath)) { + $targetPath = $targetDirectory } - # Failed at the command of fetching code owners. - if ($LASTEXITCODE -ne 0) { - Write-Host $codeOwnersString + if ([string]::IsNullOrWhiteSpace($targetPath)) { + Write-Error "TargetPath (or TargetDirectory) parameter must be neither null nor whitespace." return ,@() } - - $codeOwnersJson = $codeOwnersString | ConvertFrom-Json - if (!$codeOwnersJson) { - Write-Host "No code owners returned from the path: $targetDirectory" + + $codeownersToolCommand = Get-CodeownersTool + Write-Host "Executing: & $codeownersToolCommand --target-path $targetPath --codeowners-file-path-or-url $codeownersFileLocation --exclude-non-user-aliases:$(!$includeNonUserAliases)" + $commandOutput = & $codeownersToolCommand ` + --target-path $targetPath ` + --codeowners-file-path-or-url $codeownersFileLocation ` + --exclude-non-user-aliases:$(!$includeNonUserAliases) ` + 2>&1 + + if ($LASTEXITCODE -ne 0) { + Write-Host "Command $codeownersToolCommand execution failed (exit code = $LASTEXITCODE). Output string: $commandOutput" return ,@() + } else + { + Write-Host "Command $codeownersToolCommand executed successfully (exit code = 0). Output string length: $($commandOutput.length)" } + +# Assert: $commandOutput is a valid JSON representing: +# - a single CodeownersEntry, if the $targetPath was a single path +# - or a dictionary of CodeownerEntries, keyes by each path resolved from a $targetPath glob path. +# +# For implementation details, see Azure.Sdk.Tools.RetrieveCodeOwners.Program.Main + +$codeownersJson = $commandOutput | ConvertFrom-Json if ($VsoVariable) { - $codeOwners = $codeOwnersJson.Owners -join "," - Write-Host "##vso[task.setvariable variable=$VsoVariable;]$codeOwners" + $codeowners = $codeownersJson.Owners -join "," + Write-Host "##vso[task.setvariable variable=$VsoVariable;]$codeowners" } - return ,@($codeOwnersJson.Owners) + return ,@($codeownersJson.Owners) } -function TestGetCodeOwner([string]$targetDirectory, [string]$codeOwnerFileLocation, [bool]$includeNonUserAliases = $false, [string[]]$expectReturn) { - Write-Host "Testing on $targetDirectory..." - $actualReturn = Get-CodeOwners -targetDirectory $targetDirectory -codeOwnerFileLocation $codeOwnerFileLocation -includeNonUserAliases $IncludeNonUserAliases +function TestGetCodeowners([string]$targetPath, [string]$codeownersFileLocation, [bool]$includeNonUserAliases = $false, [string[]]$expectReturn) { + Write-Host "Test: find owners matching '$targetPath' ..." + + $actualReturn = Get-Codeowners -targetPath $targetPath -codeownersFileLocation $codeownersFileLocation -includeNonUserAliases $IncludeNonUserAliases if ($actualReturn.Count -ne $expectReturn.Count) { Write-Error "The length of actual result is not as expected. Expected length: $($expectReturn.Count), Actual length: $($actualReturn.Count)." @@ -80,16 +159,19 @@ function TestGetCodeOwner([string]$targetDirectory, [string]$codeOwnerFileLocati } } -if($Test) { - $testFile = (Resolve-Path $PSScriptRoot/../../../tools/code-owners-parser/Azure.Sdk.Tools.RetrieveCodeOwners.Tests/TestData/simple_path_CODEOWNERS) - TestGetCodeOwner -targetDirectory "sdk" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person1", "person2") - TestGetCodeOwner -targetDirectory "sdk/noPath" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person1", "person2") - TestGetCodeOwner -targetDirectory "/sdk/azconfig" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person3", "person4") - TestGetCodeOwner -targetDirectory "/sdk/azconfig/package" -codeOwnerFileLocation $testFile -includeNonUserAliases $true $testFile -expectReturn @("person3", "person4") - TestGetCodeOwner -targetDirectory "/sd" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @() - TestGetCodeOwner -targetDirectory "/sdk/testUser/" -codeOwnerFileLocation $testFile -expectReturn @("azure-sdk") +if ($Test) { + # Most of tests here have been removed; now instead we should run tests from RetrieveCodeOwnersProgramTests, and in a way as explained in: + # https://github.com/Azure/azure-sdk-tools/issues/5434 + # https://github.com/Azure/azure-sdk-tools/pull/5103#discussion_r1068680818 + Write-Host "Running reduced test suite at `$PSScriptRoot of $PSSCriptRoot. Please see https://github.com/Azure/azure-sdk-tools/issues/5434 for more." + + $azSdkToolsCodeowners = (Resolve-Path "$PSScriptRoot/../../../.github/CODEOWNERS") + TestGetCodeowners -targetPath "eng/common/scripts/get-codeowners.ps1" -codeownersFileLocation $azSdkToolsCodeowners -includeNonUserAliases $true -expectReturn @("konrad-jamrozik", "weshaggard", "benbp") + + $testCodeowners = (Resolve-Path "$PSScriptRoot/../../../tools/code-owners-parser/Azure.Sdk.Tools.RetrieveCodeOwners.Tests/TestData/glob_path_CODEOWNERS") + TestGetCodeowners -targetPath "tools/code-owners-parser/Azure.Sdk.Tools.RetrieveCodeOwners.Tests/TestData/InputDir/a.txt" -codeownersFileLocation $testCodeowners -includeNonUserAliases $true -expectReturn @("2star") exit 0 } else { - return Get-CodeOwners -targetDirectory $TargetDirectory -codeOwnerFileLocation $CodeOwnerFileLocation -includeNonUserAliases $IncludeNonUserAliases + return Get-Codeowners -targetPath $TargetPath -targetDirectory $TargetDirectory -codeownersFileLocation $CodeOwnerFileLocation -includeNonUserAliases $IncludeNonUserAliases } diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 10ccfa3d8ffa..0030ecbbfdad 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -66,7 +66,9 @@ jobs: - job: 'Build' timeoutInMinutes: 90 variables: - - template: ../variables/globals.yml + Codeql.Enabled: true + Codeql.BuildIdentifier: ${{ parameters.ServiceDirectory }} + Codeql.SkipTaskAutoInjection: false pool: name: azsdk-pool-mms-ubuntu-2004-general @@ -96,9 +98,6 @@ jobs: timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} - variables: - - template: ../variables/globals.yml - dependsOn: - 'Build' diff --git a/eng/pipelines/templates/jobs/perf.yml b/eng/pipelines/templates/jobs/perf.yml index 662930ea3d05..83227ec2c37f 100644 --- a/eng/pipelines/templates/jobs/perf.yml +++ b/eng/pipelines/templates/jobs/perf.yml @@ -1,4 +1,7 @@ parameters: +- name: TimeoutInMinutes + type: number + default: '360' - name: LanguageVersion type: string default: '3.11' @@ -27,12 +30,13 @@ parameters: extends: template: /eng/common/pipelines/templates/jobs/perf.yml parameters: + TimeoutInMinutes: ${{ parameters.TimeoutInMinutes }} + Language: Python + LanguageVersion: ${{ parameters.LanguageVersion }} Variables: - template: /eng/pipelines/templates/variables/globals.yml - name: PythonVersion value: ${{ parameters.LanguageVersion }} - Language: Python - LanguageVersion: ${{ parameters.LanguageVersion }} InstallLanguageSteps: - task: UsePythonVersion@0 displayName: "Use Python $(PythonVersion)" diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 9a199eb9388a..3b3e37f12231 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -73,6 +73,9 @@ parameters: type: boolean default: false +variables: + - template: /eng/pipelines/templates/variables/globals.yml + stages: - stage: Build jobs: diff --git a/eng/pipelines/templates/stages/archetype-sdk-tests.yml b/eng/pipelines/templates/stages/archetype-sdk-tests.yml index 4476115ec6ca..dbb6492de0d3 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-tests.yml @@ -143,13 +143,13 @@ stages: Cloud: ${{ cloud.key }} - ${{ if contains(variables['Build.DefinitionName'], 'tests-weekly') }}: - - stage: Analysis + - stage: + displayName: 'Analyze_${{ parameters.JobName }}' dependsOn: [] jobs: - job: 'Analyze' timeoutInMinutes: 90 - variables: PythonVersion: '3.9' diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml index dd98e28475e7..7e284438a3a4 100644 --- a/eng/pipelines/templates/stages/cosmos-sdk-client.yml +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -18,14 +18,14 @@ parameters: type: boolean default: false -stages: - - template: /eng/pipelines/templates/stages/archetype-sdk-client.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - # Skip emulator tests in the CI run - TestMarkArgument: not cosmosEmulator - InjectedPackages: ${{parameters.InjectedPackages}} - Artifacts: ${{parameters.Artifacts}} +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + # Skip emulator tests in the CI run + TestMarkArgument: not cosmosEmulator + InjectedPackages: ${{parameters.InjectedPackages}} + Artifacts: ${{parameters.Artifacts}} # - stage: Test_Emulator # dependsOn: [] diff --git a/eng/pipelines/templates/steps/run_black.yml b/eng/pipelines/templates/steps/run_black.yml index 03ed7e8e9880..85f2c9a68790 100644 --- a/eng/pipelines/templates/steps/run_black.yml +++ b/eng/pipelines/templates/steps/run_black.yml @@ -11,7 +11,7 @@ steps: condition: succeededOrFailed() - script: | - pip install black==21.6b0 tools/azure-sdk-tools["build"] + pip install black==22.3.0 tools/azure-sdk-tools["build"] displayName: 'Prep Environment' condition: succeededOrFailed() diff --git a/eng/pipelines/templates/variables/globals.yml b/eng/pipelines/templates/variables/globals.yml index 1bfb7d7d6077..c2492b875123 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -5,3 +5,5 @@ variables: Package.EnableSBOMSigning: true # this will be disabled until issue#24299 is addressed. DisableDockerDetector: true + # Disable CodeQL injections except for where we specifically enable it + Codeql.SkipTaskAutoInjection: true diff --git a/scripts/devops_tasks/validate_formatting.py b/scripts/devops_tasks/validate_formatting.py index aca9f3475b83..b1020b95fb16 100644 --- a/scripts/devops_tasks/validate_formatting.py +++ b/scripts/devops_tasks/validate_formatting.py @@ -28,7 +28,7 @@ def run_black(service_dir): package_name = os.path.basename(package) if is_check_enabled(package, "black", True): - out = subprocess.Popen([sys.executable, "-m", "black", "-l", "120", "sdk/{}/{}".format(service_dir, package_name)], + out = subprocess.Popen([sys.executable, "-m", "black", "--config", os.path.join(root_dir, "eng", "black-pyproject.toml"), os.path.join("sdk", service_dir, package_name)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd = root_dir @@ -38,10 +38,15 @@ def run_black(service_dir): if stderr: results.append((package_name, stderr)) - - if stdout: - if "reformatted" in stdout.decode('utf-8'): - results.append((package_name, False)) + + if out.returncode > 0: + print(f"black ran into an unexpected failure while analyzing the code for {package_name}") + if stdout: + print(stdout.decode('utf-8')) + exit(out.returncode) + + if stdout and "reformatted" in stdout.decode('utf-8'): + results.append((package_name, False)) else: print(f"black succeeded against {package_name}") diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py index 2ad6949661e4..61d8ea1f5ba2 100644 --- a/scripts/release_helper/python.py +++ b/scripts/release_helper/python.py @@ -30,7 +30,6 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep assignee_candidates: Set[str], language_owner: Set[str]): IssueProcess.__init__(self, issue_package, request_repo_dict, assignee_candidates, language_owner) self.output_folder = '' - self.pattern_resource_manager = re.compile(r'/specification/([\w-]+/)+resource-manager') self.delay_time = self.get_delay_time() self.python_tag = '' self.rest_repo_hash = '' @@ -59,6 +58,17 @@ def get_edit_content(self) -> None: def is_multiapi(self): return _MultiAPI in self.issue_package.labels_name + def get_content(self, file_name: str) -> str: + patterns = [r'/specification/([\w-]+/)+resource-manager', r'/specification/([\w-]+/)+resource-manager/.*'] + for item in patterns: + try: + readme_path = re.compile(item).search(self.readme_link).group() + file_name + contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content) + return contents + except: + pass + raise Exception(f"can not get content with {self.readme_link}") + @property def readme_comparison(self) -> bool: # to see whether need change readme @@ -66,8 +76,7 @@ def readme_comparison(self) -> bool: return False if 'package-' not in self.target_readme_tag: return True - readme_path = self.pattern_resource_manager.search(self.readme_link).group() + '/readme.md' - contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content) + contents = self.get_content('/readme.md') pattern_tag = re.compile(r'tag: package-[\w+-.]+') package_tags = pattern_tag.findall(contents) whether_same_tag = self.target_readme_tag in package_tags[0] @@ -150,7 +159,7 @@ def auto_close(self) -> None: def auto_parse(self): super().auto_parse() issue_body_list = self.get_issue_body() - self.readme_link = issue_body_list[0] + self.readme_link = issue_body_list[0].strip("\r\n ") if not re.findall(".+/Azure/azure-rest-api-specs/.+/resource-manager", self.readme_link): return @@ -159,8 +168,7 @@ def auto_parse(self): self.python_tag = self.get_specefied_param("->Readme Tag:", issue_body_list[:5]) try: - readme_python_path = self.pattern_resource_manager.search(self.readme_link).group() + '/readme.python.md' - contents = str(self.issue_package.rest_repo.get_contents(readme_python_path).decoded_content) + contents = self.get_content('/readme.python.md') except Exception as e: raise Exception(f"fail to read readme.python.md: {e}") pattern_package = re.compile(r'package-name: [\w+-.]+') diff --git a/sdk/agrifood/azure-agrifood-farming/pyproject.toml b/sdk/agrifood/azure-agrifood-farming/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/agrifood/azure-agrifood-farming/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/pyproject.toml b/sdk/anomalydetector/azure-ai-anomalydetector/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/anomalydetector/azure-ai-anomalydetector/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/CHANGELOG.md b/sdk/appconfiguration/azure-appconfiguration-provider/CHANGELOG.md index 3007731bf9e6..950e8b47b062 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/CHANGELOG.md +++ b/sdk/appconfiguration/azure-appconfiguration-provider/CHANGELOG.md @@ -1,17 +1,33 @@ # Release History -## 1.0.0b2 (Unreleased) +## 1.0.0b3 (Unreleased) ### Features Added +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 1.0.0b2 (2023-02-15) + +### Features Added +* Added Async Support +* Added missing methods for Mapping API * Made load method properties unordered. ### Breaking Changes +* Changes how load works. Moves if from AzureAppConfigurationProvider.load to load_provider. +* Removed custom Key Vault Error +* Removed unneeded __repr__ and copy methods. +* All Feature Flags are added to there own key and have there prefix removed ### Bugs Fixed +* Fixed Issue where Key Vault Clients couldn't be set in some situations ### Other Changes - +* Updated method docs * Fixed load doc that used `selector` instead of `selects`. * Fixed CLI link in Readme. diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/README.md b/sdk/appconfiguration/azure-appconfiguration-provider/README.md index 6bbcc22171e3..8c5b08fa250f 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/README.md +++ b/sdk/appconfiguration/azure-appconfiguration-provider/README.md @@ -21,13 +21,13 @@ Alternatively, get the connection string from the Azure Portal. You can create a client with a connection string: ```python -config = AzureAppConfigurationProvider.load(connection_string="your-connection-string") +config = load_provider(connection_string="your-connection-string") ``` or with AAD: ```python -config = AzureAppConfigurationProvider.load(endpoint="your-endpoint", credential=DefaultAzureCredential()) +config = load_provider(endpoint="your-endpoint", credential=DefaultAzureCredential()) ``` these providers will by default load all configurations with `(No Label)` from your configuration store. @@ -60,8 +60,7 @@ You can refine or expand the configurations loaded from your store by using `Set ```python selects = {SettingSelector(key_filter="*", label_filter="\0"), SettingSelector(key_filter="*", label_filter="dev")} -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=default_credential, selects=selects) +config = load_provider(endpoint=endpoint, credential=DefaultAzureCredential(), selects=selects) ``` In this example all configuration with empty label and the dev label are loaded. Because the dev selector is listed last, any configurations from dev take priority over those with `(No Label)` when duplicates are found. @@ -71,8 +70,7 @@ You can trim the prefix off of keys by providing a list of trimmed key prefixes ```python trimmed_key_prefixes={"/application/"} -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=default_credential, trimmed_key_prefixes=trimmed_key_prefixes) +config = load_provider(endpoint=endpoint, credential=DefaultAzureCredential(), trimmed_key_prefixes=trimmed_key_prefixes) print(config["message"]) ``` @@ -85,8 +83,8 @@ Key Vault References can be resolved by providing credentials to your key vault You can provide `AzureAppConfigurationKeyVaultOptions` with a credential and all key vault references will be resolved with it. The provider will attempt to connect to any key vault referenced with the credential provided. ```python -key_vault_options = AzureAppConfigurationKeyVaultOptions(credential=default_credential) -config = AzureAppConfigurationProvider.load(endpoint=endpoint, credential=default_credential, key_vault_options=key_vault_options) +key_vault_options = AzureAppConfigurationKeyVaultOptions(credential=DefaultAzureCredential()) +config = load_provider(endpoint=endpoint, credential=DefaultAzureCredential(), key_vault_options=key_vault_options) ``` ### With Clients @@ -95,8 +93,8 @@ You can provide `AzureAppConfigurationKeyVaultOptions` with a list of `SecretCli ```python key_vault_options = AzureAppConfigurationKeyVaultOptions( secret_clients={SecretClient( - vault_url=key_vault_uri, credential=default_credential)}) -config = AzureAppConfigurationProvider.load(endpoint=endpoint, credential=default_credential, key_vault_options=key_vault_options) + vault_url=key_vault_uri, credential=DefaultAzureCredential())}) +config = load_provider(endpoint=endpoint, credential=DefaultAzureCredential(), key_vault_options=key_vault_options) ``` ### Secret Resolver @@ -109,8 +107,7 @@ def secret_resolver(uri): key_vault_options = AzureAppConfigurationKeyVaultOptions( secret_resolver=secret_resolver) -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=default_credential, key_vault_options=key_vault_options) +config = load_provider(endpoint=endpoint, credential=DefaultAzureCredential(), key_vault_options=key_vault_options) ``` ## Key concepts diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/__init__.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/__init__.py index a29ac854e457..a6044d7c6a86 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/__init__.py @@ -4,11 +4,15 @@ # license information. # ------------------------------------------------------------------------- -from ._azureappconfigurationprovider import AzureAppConfigurationProvider -from ._azureappconfigurationkeyvaultoptions import AzureAppConfigurationKeyVaultOptions -from ._settingselector import SettingSelector +from ._azureappconfigurationprovider import load_provider, AzureAppConfigurationProvider +from ._models import AzureAppConfigurationKeyVaultOptions, SettingSelector from ._version import VERSION __version__ = VERSION -__all__ = ["AzureAppConfigurationProvider", "AzureAppConfigurationKeyVaultOptions", "SettingSelector"] +__all__ = [ + "load_provider", + "AzureAppConfigurationProvider", + "AzureAppConfigurationKeyVaultOptions", + "SettingSelector" +] diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationkeyvaultoptions.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationkeyvaultoptions.py deleted file mode 100644 index 7a6519e1b9be..000000000000 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationkeyvaultoptions.py +++ /dev/null @@ -1,29 +0,0 @@ -# ------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# ------------------------------------------------------------------------- - - -class AzureAppConfigurationKeyVaultOptions: - """ - Options for connecting to Key Vault. - - :param credential: A credential for authenticating with the key vault. This is optional if secret_clients is - provided. - :type credential: ~azure.core.credentials.TokenCredential - :param secret_clients: A list of SecretClient from azure-keyvault-secrets. This is optional if credential is - provided. - :type secret_clients: list[~azure.keyvault.secrets.SecretClient] - :param secret_resolver: A function that takes a URI and returns a value. - :type secret_resolver: callable - """ - - def __init__(self, credential=None, secret_clients=None, secret_resolver=None): - # type: (TokenCredential, List[SecretClient], Callable) -> None - self.credential = credential - self.secret_clients = secret_clients - self.secret_resolver = secret_resolver - - if self.secret_clients is None: - self.secret_clients = {} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py index 85ca819d5a01..7b68c4609216 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py @@ -3,209 +3,338 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # ------------------------------------------------------------------------- - +import os import json -from azure.appconfiguration import AzureAppConfigurationClient +from typing import Any, Dict, Iterable, Mapping, Optional, overload, List, Tuple, TYPE_CHECKING +from azure.appconfiguration import ( + AzureAppConfigurationClient, + FeatureFlagConfigurationSetting, + SecretReferenceConfigurationSetting +) from azure.keyvault.secrets import SecretClient, KeyVaultSecretIdentifier -from azure.core.exceptions import ResourceNotFoundError -from ._settingselector import SettingSelector -from ._azure_appconfiguration_provider_error import KeyVaultReferenceError -from ._constants import KEY_VAULT_REFERENCE_CONTENT_TYPE +from ._models import AzureAppConfigurationKeyVaultOptions, SettingSelector +from ._constants import ( + FEATURE_MANAGEMENT_KEY, + FEATURE_FLAG_PREFIX, + ServiceFabricEnvironmentVariable, + AzureFunctionEnvironmentVariable, + AzureWebAppEnvironmentVariable, + ContainerAppEnvironmentVariable, + KubernetesEnvironmentVariable +) from ._user_agent import USER_AGENT +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + -class AzureAppConfigurationProvider: +@overload +def load_provider( + endpoint: str, + credential: "TokenCredential", + *, + selects: Optional[List[SettingSelector]] = None, + trimmed_key_prefixes: Optional[List[str]] = None, + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions] = None, + **kwargs + ) -> "AzureAppConfigurationProvider": """ - Provides a dictionary-like interface to Azure App Configuration settings. Enables loading of sets of configuration - settings from Azure App Configuration into a Python application. Enables trimming of prefixes from configuration - keys. Enables resolution of Key Vault references in configuration settings. + Loads configuration settings from Azure App Configuration into a Python application. + + :param str endpoint: Endpoint for App Configuration resource. + :param credential: Credential for App Configuration resource. + :type credential: ~azure.core.credentials.TokenCredential + :keyword selects: List of setting selectors to filter configuration settings + :paramtype selects: Optional[List[~azure.appconfiguration.provider.SettingSelector]] + :keyword trimmed_key_prefixes: List of prefixes to trim from configuration keys + :paramtype trimmed_key_prefixes: Optional[List[str]] + :keyword key_vault_options: Options for resolving Key Vault references + :paramtype key_vault_options: ~azure.appconfiguration.provider.AzureAppConfigurationKeyVaultOptions """ + ... + +@overload +def load_provider( + *, + connection_string: str, + selects: Optional[List[SettingSelector]] = None, + trimmed_key_prefixes: Optional[List[str]] = None, + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions] = None, + **kwargs + ) -> "AzureAppConfigurationProvider": + """ + Loads configuration settings from Azure App Configuration into a Python application. + + :keyword str connection_string: Connection string for App Configuration resource. + :keyword selects: List of setting selectors to filter configuration settings + :paramtype selects: Optional[List[~azure.appconfiguration.provider.SettingSelector]] + :keyword trimmed_key_prefixes: List of prefixes to trim from configuration keys + :paramtype trimmed_key_prefixes: Optional[List[str]] + :keyword key_vault_options: Options for resolving Key Vault references + :paramtype key_vault_options: ~azure.appconfiguration.provider.AzureAppConfigurationKeyVaultOptions + """ + ... + +def load_provider(*args, **kwargs) -> "AzureAppConfigurationProvider": + #pylint:disable=protected-access + + # Start by parsing kwargs + endpoint: Optional[str] = kwargs.pop("endpoint", None) + credential: Optional["TokenCredential"] = kwargs.pop("credential", None) + connection_string: Optional[str] = kwargs.pop("connection_string", None) + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions] = kwargs.pop("key_vault_options", None) + selects: List[SettingSelector] = kwargs.pop("selects", [SettingSelector("*", "\0")]) + trim_prefixes : List[str] = kwargs.pop("trimmed_key_prefixes", []) + + # Update endpoint and credential if specified positionally. + if len(args) > 2: + raise TypeError( + "Unexpected positional parameters. Please pass either endpoint and credential, or a connection string." + ) + if len(args) == 1: + if endpoint is not None: + raise TypeError("Received multiple values for parameter 'endpoint'.") + endpoint = args[0] + elif len(args) == 2: + if credential is not None: + raise TypeError("Received multiple values for parameter 'credential'.") + endpoint, credential = args - def __init__(self): - # type: () -> None - self._dict = {} - self._trim_prefixes = [] - self._client = None - - @classmethod - def load(cls, *, connection_string=None, endpoint=None, credential=None, **kwargs): - """ - Loads configuration settings from Azure App Configuration into a Python application. - - :keyword connection_string: Connection string (one of connection_string or endpoint and credential must be set) - :type connection_string: str - :keyword endpoint: Endpoint (one of connection_string or endpoint and credential must be set) - :type endpoint: str - :keyword credential: Credential (one of connection_string or endpoint and credential must be set) - :type credential: Union[AppConfigConnectionStringCredential, TokenCredential] - :keyword selects: List of setting selectors to filter configuration settings - :type selects: list[~azure.appconfigurationprovider.SettingSelector] - :keyword trim_prefixes: List of prefixes to trim from configuration keys - :type trim_prefixes: list[str] - :keyword key_vault_options: Options for resolving Key Vault references - :type key_vault_options: ~azure.appconfigurationprovider.KeyVaultOptions - """ - provider = AzureAppConfigurationProvider() - - key_vault_options = kwargs.pop("key_vault_options", None) - - provider.__buildprovider(connection_string, endpoint, credential, key_vault_options) - - selects = kwargs.pop("selects", {SettingSelector("*", "\0")}) - - provider._trim_prefixes = sorted(kwargs.pop("trimmed_key_prefixes", []), key=len, reverse=True) - - provider._dict = {} + if (endpoint or credential) and connection_string: + raise ValueError("Please pass either endpoint and credential, or a connection string.") - secret_clients = key_vault_options.secret_clients if key_vault_options else {} - for select in selects: - configurations = provider._client.list_configuration_settings( - key_filter=select.key_filter, label_filter=select.label_filter - ) - for config in configurations: + provider = _buildprovider(connection_string, endpoint, credential, key_vault_options, **kwargs) + provider._trim_prefixes = sorted(trim_prefixes, key=len, reverse=True) - trimmed_key = config.key - # Trim the key if it starts with one of the prefixes provided - for trim in provider._trim_prefixes: - if config.key.startswith(trim): - trimmed_key = config.key[len(trim) :] - break + if key_vault_options is not None and len(key_vault_options.secret_clients) > 0: + for secret_client in key_vault_options.secret_clients: + provider._secret_clients[secret_client.vault_url] = secret_client - if config.content_type == KEY_VAULT_REFERENCE_CONTENT_TYPE: - secret = provider.__resolve_keyvault_reference(config, key_vault_options, secret_clients) - provider._dict[trimmed_key] = secret - elif provider.__is_json_content_type(config.content_type): - try: - j_object = json.loads(config.value) - provider._dict[trimmed_key] = j_object - except json.JSONDecodeError: - # If the value is not a valid JSON, treat it like regular string value - provider._dict[trimmed_key] = config.value + for select in selects: + configurations = provider._client.list_configuration_settings( + key_filter=select.key_filter, label_filter=select.label_filter + ) + for config in configurations: + + trimmed_key = config.key + # Trim the key if it starts with one of the prefixes provided + for trim in provider._trim_prefixes: + if config.key.startswith(trim): + trimmed_key = config.key[len(trim) :] + break + + if isinstance(config, SecretReferenceConfigurationSetting): + secret = _resolve_keyvault_reference(config, key_vault_options, provider) + provider._dict[trimmed_key] = secret + elif isinstance(config, FeatureFlagConfigurationSetting): + feature_management = provider._dict.get(FEATURE_MANAGEMENT_KEY, {}) + if trimmed_key.startswith(FEATURE_FLAG_PREFIX): + feature_management[trimmed_key[len(FEATURE_FLAG_PREFIX) :]] = config.value else: + feature_management[trimmed_key] = config.value + if FEATURE_MANAGEMENT_KEY not in provider.keys(): + provider._dict[FEATURE_MANAGEMENT_KEY] = feature_management + elif _is_json_content_type(config.content_type): + try: + j_object = json.loads(config.value) + provider._dict[trimmed_key] = j_object + except json.JSONDecodeError: + # If the value is not a valid JSON, treat it like regular string value provider._dict[trimmed_key] = config.value + else: + provider._dict[trimmed_key] = config.value + return provider + + +def _get_correlation_context(key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions]) -> str: + correlation_context = "RequestType=Startup" + if key_vault_options and ( + key_vault_options.credential or key_vault_options.secret_clients or key_vault_options.secret_resolver + ): + correlation_context += ",UsesKeyVault" + host_type = "" + if os.environ.get(AzureFunctionEnvironmentVariable) is not None: + host_type = "AzureFunctions" + elif os.environ.get(AzureWebAppEnvironmentVariable) is not None: + host_type = "AzureWebApps" + elif os.environ.get(ContainerAppEnvironmentVariable) is not None: + host_type = "ContainerApps" + elif os.environ.get(KubernetesEnvironmentVariable) is not None: + host_type = "Kubernetes" + elif os.environ.get(ServiceFabricEnvironmentVariable) is not None: + host_type = "ServiceFabric" + if host_type: + correlation_context += ",Host=" + host_type + return correlation_context + + +def _buildprovider( + connection_string: Optional[str], + endpoint: Optional[str], + credential: Optional["TokenCredential"], + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions], + **kwargs + ) -> "AzureAppConfigurationProvider": + #pylint:disable=protected-access + provider = AzureAppConfigurationProvider() + headers = kwargs.pop("headers", {}) + headers["Correlation-Context"] = _get_correlation_context(key_vault_options) + useragent = USER_AGENT + + if connection_string: + provider._client = AzureAppConfigurationClient.from_connection_string( + connection_string, user_agent=useragent, headers=headers, **kwargs + ) return provider + provider._client = AzureAppConfigurationClient( + endpoint, credential, user_agent=useragent, headers=headers, **kwargs + ) + return provider - def __buildprovider(self, connection_string, endpoint, credential, key_vault_options): - headers = {} - correlation_context = "RequestType=Startup" - if key_vault_options and ( - key_vault_options.credential or key_vault_options.secret_clients or key_vault_options.secret_resolver - ): - correlation_context += ",UsesKeyVault" +def _resolve_keyvault_reference( + config, + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions], + provider: "AzureAppConfigurationProvider" + ) -> str: + if key_vault_options is None: + raise ValueError("Key Vault options must be set to resolve Key Vault references.") - headers["Correlation-Context"] = correlation_context - useragent = USER_AGENT + if config.secret_id is None: + raise ValueError("Key Vault reference must have a uri value.") - if connection_string and endpoint: - raise AttributeError("Both connection_string and endpoint are set. Only one of these should be set.") + key_vault_identifier = KeyVaultSecretIdentifier(config.secret_id) - if connection_string: - self._client = AzureAppConfigurationClient.from_connection_string( - connection_string, user_agent=useragent, headers=headers - ) - return - self._client = AzureAppConfigurationClient(endpoint, credential, user_agent=useragent, headers=headers) + #pylint:disable=protected-access + referenced_client = provider._secret_clients.get(key_vault_identifier.vault_url, None) - @staticmethod - def __resolve_keyvault_reference(config, key_vault_options, secret_clients): - if key_vault_options is None: - raise AttributeError("Key Vault options must be set to resolve Key Vault references.") + if referenced_client is None and key_vault_options.credential is not None: + referenced_client = SecretClient( + vault_url=key_vault_identifier.vault_url, credential=key_vault_options.credential + ) + provider._secret_clients[key_vault_identifier.vault_url] = referenced_client - if config.secret_id is None: - raise AttributeError("Key Vault reference must have a uri value.") + if referenced_client: + return referenced_client.get_secret(key_vault_identifier.name, version=key_vault_identifier.version).value - key_vault_identifier = KeyVaultSecretIdentifier(config.secret_id) + if key_vault_options.secret_resolver is not None: + return key_vault_options.secret_resolver(config.secret_id) - referenced_client = next( - (client for client in secret_clients if client.vault_url == key_vault_identifier.vault_url), None - ) + raise ValueError( + "No Secret Client found for Key Vault reference %s" % (key_vault_identifier.vault_url) + ) - if referenced_client is None and key_vault_options.credential is not None: - referenced_client = SecretClient( - vault_url=key_vault_identifier.vault_url, credential=key_vault_options.credential - ) - secret_clients[key_vault_identifier.vault_url] = referenced_client - - if referenced_client: - try: - return referenced_client.get_secret( - key_vault_identifier.name, version=key_vault_identifier.version - ).value - except ResourceNotFoundError: - raise KeyVaultReferenceError( - "Key Vault %s does not contain secret %s" - % (key_vault_identifier.vault_url, key_vault_identifier.name) - ) - - if key_vault_options.secret_resolver is not None: - return key_vault_options.secret_resolver(config.secret_id) - raise KeyVaultReferenceError( - "No Secret Client found for Key Vault reference %s" % (key_vault_identifier.vault_url) - ) - @staticmethod - def __is_json_content_type(content_type): - if not content_type: - return False +def _is_json_content_type(content_type: str) -> bool: + if not content_type: + return False - content_type = content_type.strip().lower() - mime_type = content_type.split(";")[0].strip() + content_type = content_type.strip().lower() + mime_type = content_type.split(";")[0].strip() - type_parts = mime_type.split("/") - if len(type_parts) != 2: - return False + type_parts = mime_type.split("/") + if len(type_parts) != 2: + return False - (main_type, sub_type) = type_parts - if main_type != "application": - return False + (main_type, sub_type) = type_parts + if main_type != "application": + return False - sub_types = sub_type.split("+") - if "json" in sub_types: - return True + sub_types = sub_type.split("+") + if "json" in sub_types: + return True - return False + return False - def __getitem__(self, key): - return self._dict[key] - def __repr__(self): - return repr(self._dict) +class AzureAppConfigurationProvider(Mapping[str, str]): + """ + Provides a dictionary-like interface to Azure App Configuration settings. Enables loading of sets of configuration + settings from Azure App Configuration into a Python application. Enables trimming of prefixes from configuration + keys. Enables resolution of Key Vault references in configuration settings. + """ - def __len__(self): - return len(self._dict) + def __init__(self) -> None: + self._dict: Dict[str, str] = {} + self._trim_prefixes: List[str] = [] + self._client: Optional[AzureAppConfigurationClient] = None + self._secret_clients: Dict[str, SecretClient] = {} - def copy(self): + def __getitem__(self, key: str) -> str: """ - Returns a copy of the configuration settings - - type: () -> dict + Returns the value of the specified key. """ - return self._dict.copy() + return self._dict[key] - def __contains__(self, __x: object): - """ - Returns True if the configuration settings contains the specified key + def __iter__(self) -> Iterable[str]: + return self._dict.__iter__() + + def __len__(self) -> int: + return len(self._dict) - type: (object) -> bool + def __contains__(self, __x: object) -> bool: + """ + Returns True if the configuration settings contains the specified key. """ return self._dict.__contains__(__x) - def keys(self): + def keys(self) -> Iterable[str]: """ Returns a list of keys loaded from Azure App Configuration. - - type: () -> list """ return self._dict.keys() - def values(self): + def items(self) -> Iterable[Tuple[str, str]]: + """ + Returns a list of key-value pairs loaded from Azure App Configuration. Any values that are Key Vault references + will be resolved. + """ + return self._dict.items() + + def values(self) -> Iterable[str]: """ Returns a list of values loaded from Azure App Configuration. Any values that are Key Vault references will be resolved. - - type: () -> list """ return self._dict.values() + + def get(self, key: str, default: Optional[str] = None) -> str: + """ + Returns the value of the specified key. If the key does not exist, returns the default value. + """ + return self._dict.get(key, default) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, AzureAppConfigurationProvider): + return False + if self._dict != other._dict: + return False + if self._trim_prefixes != other._trim_prefixes: + return False + if self._client != other._client: + return False + return True + + def __ne__(self, other: Any) -> bool: + return not self == other + + def close(self) -> None: + """ + Closes the connection to Azure App Configuration. + """ + for client in self._secret_clients.values(): + client.close() + self._client.close() + + def __enter__(self) -> "AzureAppConfigurationProvider": + self._client.__enter__() + for client in self._secret_clients.values(): + client.__enter__() + return self + + def __exit__(self, *args) -> None: + self._client.__exit__(*args) + for client in self._secret_clients.values(): + client.__exit__() diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_constants.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_constants.py index eb9425333a1d..9e2552086a5e 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_constants.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_constants.py @@ -4,4 +4,12 @@ # license information. # ------------------------------------------------------------------------- -KEY_VAULT_REFERENCE_CONTENT_TYPE = "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8" +FEATURE_MANAGEMENT_KEY = "FeatureManagementFeatureFlags" +FEATURE_FLAG_PREFIX = ".appconfig.featureflag/" + +RequestTracingDisabledEnvironmentVariable = "AZURE_APP_CONFIGURATION_TRACING_DISABLED" +AzureFunctionEnvironmentVariable = "FUNCTIONS_EXTENSION_VERSION" +AzureWebAppEnvironmentVariable = "WEBSITE_SITE_NAME" +ContainerAppEnvironmentVariable = "CONTAINER_APP_NAME" +KubernetesEnvironmentVariable = "KUBERNETES_PORT" +ServiceFabricEnvironmentVariable = "Fabric_NvodeName" # cspell:disable-line diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_models.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_models.py new file mode 100644 index 000000000000..5f8a60369590 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_models.py @@ -0,0 +1,54 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +from typing import List, Optional, Callable, TYPE_CHECKING, Union, Awaitable + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + from azure.core.credentials_async import AsyncTokenCredential + from azure.keyvault.secrets import SecretClient + from azure.keyvault.secrets.aio import SecretClient as AsyncSecretClient + + +class AzureAppConfigurationKeyVaultOptions: + def __init__( + self, + *, + credential: Optional[Union["TokenCredential", "AsyncTokenCredential"]] = None, + secret_clients: Optional[Union[List["SecretClient"], List["AsyncSecretClient"]]] = None, + secret_resolver: Optional[Union[Callable[[str], str], Callable[[str], Awaitable[str]]]] = None + ): + """ + Options for connecting to Key Vault. + + :keyword credential: A credential for authenticating with the key vault. This is optional if secret_clients is + provided. + :paramtype credential: ~azure.core.credentials.TokenCredential + :keyword secret_clients: A list of SecretClient from azure-keyvault-secrets. This is optional if credential is + provided. + :paramtype secret_clients: list[~azure.keyvault.secrets.SecretClient] + :keyword secret_resolver: A function that takes a URI and returns a value. + :paramtype secret_resolver: Callable[[str], str] + """ + self.credential = credential + self.secret_clients = secret_clients or [] + self.secret_resolver = secret_resolver + if self.credential is not None and self.secret_resolver is not None: + raise ValueError("credential and secret_resolver can't both be configured.") + + +class SettingSelector: + """ + Selects a set of configuration settings from Azure App Configuration. + + :param key_filter: A filter to select configuration settings based on their keys. + :type key_filter: str + :param label_filter: A filter to select configuration settings based on their labels. Default is value is '\0' + :type label_filter: str + """ + + def __init__(self, key_filter: str, label_filter: str = "\0"): + self.key_filter = key_filter + self.label_filter = label_filter diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_settingselector.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_settingselector.py deleted file mode 100644 index bef1b4668a6b..000000000000 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_settingselector.py +++ /dev/null @@ -1,21 +0,0 @@ -# ------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# ------------------------------------------------------------------------- - - -class SettingSelector: - """ - Selects a set of configuration settings from Azure App Configuration. - - :param key_filter: A filter to select configuration settings based on their keys. - :type key_filter: str - :param label_filter: A filter to select configuration settings based on their labels. Default is value is '\0' - :type label_filter: str - """ - - def __init__(self, key_filter, label_filter="\0"): - # type: (str, str) -> None - self.key_filter = key_filter - self.label_filter = label_filter diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_version.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_version.py index 4af7abd0b559..b8d043b247c1 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_version.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_version.py @@ -4,4 +4,4 @@ # license information. # ------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b3" diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/__init__.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/__init__.py new file mode 100644 index 000000000000..5a6311f8407e --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/__init__.py @@ -0,0 +1,12 @@ +# ------------------------------------------------------------------------ + # Copyright (c) Microsoft Corporation. All rights reserved. + # Licensed under the MIT License. See License.txt in the project root for + # license information. + # ------------------------------------------------------------------------- + +from ._azureappconfigurationproviderasync import load_provider, AzureAppConfigurationProvider + +__all__ = [ + "load_provider", + "AzureAppConfigurationProvider", +] diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/_azureappconfigurationproviderasync.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/_azureappconfigurationproviderasync.py new file mode 100644 index 000000000000..a9bd83aeb5c2 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/_azureappconfigurationproviderasync.py @@ -0,0 +1,296 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +import json +from typing import Any, Dict, Iterable, Mapping, Optional, overload, List, Tuple, TYPE_CHECKING + +from azure.appconfiguration import FeatureFlagConfigurationSetting, SecretReferenceConfigurationSetting +from azure.appconfiguration.aio import AzureAppConfigurationClient +from azure.keyvault.secrets.aio import SecretClient +from azure.keyvault.secrets import KeyVaultSecretIdentifier + +from .._models import AzureAppConfigurationKeyVaultOptions, SettingSelector +from .._constants import FEATURE_MANAGEMENT_KEY, FEATURE_FLAG_PREFIX +from .._azureappconfigurationprovider import _is_json_content_type, _get_correlation_context +from .._user_agent import USER_AGENT + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +@overload +async def load_provider( + endpoint: str, + credential: "AsyncTokenCredential", + *, + selects: Optional[List[SettingSelector]] = None, + trimmed_key_prefixes: Optional[List[str]] = None, + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions] = None, + **kwargs + ) -> "AzureAppConfigurationProvider": + """ + Loads configuration settings from Azure App Configuration into a Python application. + + :param str endpoint: Endpoint for App Configuration resource. + :param credential: Credential for App Configuration resource. + :type credential: ~azure.core.credentials.TokenCredential + :keyword selects: List of setting selectors to filter configuration settings + :paramtype selects: Optional[List[~azure.appconfiguration.provider.SettingSelector]] + :keyword trimmed_key_prefixes: List of prefixes to trim from configuration keys + :paramtype trimmed_key_prefixes: Optional[List[str]] + :keyword key_vault_options: Options for resolving Key Vault references + :paramtype key_vault_options: ~azure.appconfiguration.provider.AzureAppConfigurationKeyVaultOptions + """ + ... + +@overload +async def load_provider( + *, + connection_string: str, + selects: Optional[List[SettingSelector]] = None, + trimmed_key_prefixes: Optional[List[str]] = None, + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions] = None, + **kwargs + ) -> "AzureAppConfigurationProvider": + """ + Loads configuration settings from Azure App Configuration into a Python application. + + :keyword str connection_string: Connection string for App Configuration resource. + :keyword selects: List of setting selectors to filter configuration settings + :paramtype selects: Optional[List[~azure.appconfiguration.provider.SettingSelector]] + :keyword trimmed_key_prefixes: List of prefixes to trim from configuration keys + :paramtype trimmed_key_prefixes: Optional[List[str]] + :keyword key_vault_options: Options for resolving Key Vault references + :paramtype key_vault_options: ~azure.appconfiguration.provider.AzureAppConfigurationKeyVaultOptions + """ + ... + + +async def load_provider(*args, **kwargs) -> "AzureAppConfigurationProvider": + #pylint:disable=protected-access + + # Start by parsing kwargs + endpoint: Optional[str] = kwargs.pop("endpoint", None) + credential: Optional["AsyncTokenCredential"] = kwargs.pop("credential", None) + connection_string: Optional[str] = kwargs.pop("connection_string", None) + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions] = kwargs.pop("key_vault_options", None) + selects: List[SettingSelector] = kwargs.pop("selects", [SettingSelector("*", "\0")]) + trim_prefixes : List[str] = kwargs.pop("trimmed_key_prefixes", []) + + # Update endpoint and credential if specified positionally. + if len(args) > 2: + raise TypeError( + "Unexpected positional parameters. Please pass either endpoint and credential, or a connection string." + ) + if len(args) == 1: + if endpoint is not None: + raise TypeError("Received multiple values for parameter 'endpoint'.") + endpoint = args[0] + elif len(args) == 2: + if credential is not None: + raise TypeError("Received multiple values for parameter 'credential'.") + endpoint, credential = args + + if (endpoint or credential) and connection_string: + raise ValueError("Please pass either endpoint and credential, or a connection string.") + + + provider = _buildprovider(connection_string, endpoint, credential, key_vault_options) + + provider._trim_prefixes = sorted(trim_prefixes, key=len, reverse=True) + + if key_vault_options is not None and len(key_vault_options.secret_clients) > 0: + for secret_client in key_vault_options.secret_clients: + provider._secret_clients[secret_client.vault_url] = secret_client + + for select in selects: + configurations = provider._client.list_configuration_settings( + key_filter=select.key_filter, label_filter=select.label_filter + ) + async for config in configurations: + + trimmed_key = config.key + # Trim the key if it starts with one of the prefixes provided + for trim in provider._trim_prefixes: + if config.key.startswith(trim): + trimmed_key = config.key[len(trim) :] + break + + if isinstance(config, SecretReferenceConfigurationSetting): + secret = await _resolve_keyvault_reference(config, key_vault_options, provider) + provider._dict[trimmed_key] = secret + elif isinstance(config, FeatureFlagConfigurationSetting): + feature_management = provider._dict.get(FEATURE_MANAGEMENT_KEY, {}) + if trimmed_key.startswith(FEATURE_FLAG_PREFIX): + feature_management[trimmed_key[len(FEATURE_FLAG_PREFIX) :]] = config.value + else: + feature_management[trimmed_key] = config.value + if FEATURE_MANAGEMENT_KEY not in provider.keys(): + provider._dict[FEATURE_MANAGEMENT_KEY] = feature_management + elif _is_json_content_type(config.content_type): + try: + j_object = json.loads(config.value) + provider._dict[trimmed_key] = j_object + except json.JSONDecodeError: + # If the value is not a valid JSON, treat it like regular string value + provider._dict[trimmed_key] = config.value + else: + provider._dict[trimmed_key] = config.value + return provider + + +def _buildprovider( + connection_string: Optional[str], + endpoint: Optional[str], + credential: Optional["AsyncTokenCredential"], + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions], + **kwargs + ) -> "AzureAppConfigurationProvider": + #pylint:disable=protected-access + provider = AzureAppConfigurationProvider() + headers = kwargs.pop("headers", {}) + headers["Correlation-Context"] = _get_correlation_context(key_vault_options) + useragent = USER_AGENT + + if connection_string: + provider._client = AzureAppConfigurationClient.from_connection_string( + connection_string, user_agent=useragent, headers=headers, **kwargs + ) + return provider + provider._client = AzureAppConfigurationClient( + endpoint, credential, user_agent=useragent, headers=headers, **kwargs + ) + return provider + + +async def _resolve_keyvault_reference( + config, + key_vault_options: Optional[AzureAppConfigurationKeyVaultOptions], + provider: "AzureAppConfigurationProvider" + ) -> str: + if key_vault_options is None: + raise ValueError("Key Vault options must be set to resolve Key Vault references.") + + if config.secret_id is None: + raise ValueError("Key Vault reference must have a uri value.") + + key_vault_identifier = KeyVaultSecretIdentifier(config.secret_id) + + #pylint:disable=protected-access + referenced_client = provider._secret_clients.get(key_vault_identifier.vault_url, None) + + if referenced_client is None and key_vault_options.credential is not None: + referenced_client = SecretClient( + vault_url=key_vault_identifier.vault_url, credential=key_vault_options.credential + ) + provider._secret_clients[key_vault_identifier.vault_url] = referenced_client + + if referenced_client: + return ( + await referenced_client.get_secret(key_vault_identifier.name, version=key_vault_identifier.version) + ).value + + if key_vault_options.secret_resolver is not None: + resolved = key_vault_options.secret_resolver(config.secret_id) + try: + # Secret resolver was async + return await resolved + except TypeError: + # Secret resolver was sync + return resolved + + raise ValueError( + "No Secret Client found for Key Vault reference %s" % (key_vault_identifier.vault_url) + ) + + +class AzureAppConfigurationProvider(Mapping[str, str]): + """ + Provides a dictionary-like interface to Azure App Configuration settings. Enables loading of sets of configuration + settings from Azure App Configuration into a Python application. Enables trimming of prefixes from configuration + keys. Enables resolution of Key Vault references in configuration settings. + """ + def __init__(self) -> None: + self._dict: Dict[str, str] = {} + self._trim_prefixes: List[str] = [] + self._client: Optional[AzureAppConfigurationClient] = None + self._secret_clients: Dict[str, SecretClient] = {} + + def __getitem__(self, key: str) -> str: + """ + Returns the value of the specified key. + """ + return self._dict[key] + + def __iter__(self) -> Iterable[str]: + return self._dict.__iter__() + + def __len__(self) -> int: + return len(self._dict) + + def __contains__(self, __x: object) -> bool: + """ + Returns True if the configuration settings contains the specified key. + """ + return self._dict.__contains__(__x) + + def keys(self) -> Iterable[str]: + """ + Returns a list of keys loaded from Azure App Configuration. + """ + return self._dict.keys() + + def items(self) -> Iterable[Tuple[str, str]]: + """ + Returns a list of key-value pairs loaded from Azure App Configuration. Any values that are Key Vault references + will be resolved. + """ + return self._dict.items() + + def values(self) -> Iterable[str]: + """ + Returns a list of values loaded from Azure App Configuration. Any values that are Key Vault references will be + resolved. + """ + return self._dict.values() + + def get(self, key: str, default: Optional[str] = None) -> str: + """ + Returns the value of the specified key. If the key does not exist, returns the default value. + """ + return self._dict.get(key, default) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, AzureAppConfigurationProvider): + return False + if self._dict != other._dict: + return False + if self._trim_prefixes != other._trim_prefixes: + return False + if self._client != other._client: + return False + return True + + def __ne__(self, other: Any) -> bool: + return not self == other + + async def close(self) -> None: + """ + Closes the connection to Azure App Configuration. + """ + for client in self._secret_clients.values(): + await client.close() + await self._client.close() + + async def __aenter__(self) -> "AzureAppConfigurationProvider": + await self._client.__aenter__() + for client in self._secret_clients.values(): + await client.__aenter__() + return self + + async def __aexit__(self, *args) -> None: + await self._client.__aexit__(*args) + for client in self._secret_clients.values(): + await client.__aexit__() diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt b/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt index 8ca0b23f04e5..9ef4f496b7e8 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt +++ b/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt @@ -1,6 +1,6 @@ -e ../../../tools/azure-devtools -azure-core -azure-appconfiguration +azure-core>=1.24.0 +azure-appconfiguration==1.4.0 azure-identity azure-keyvault-secrets aiohttp>=3.0 diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/pyproject.toml b/sdk/appconfiguration/azure-appconfiguration-provider/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/aad_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/aad_sample.py index 4c875ad53b86..c616c7ad2af0 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/samples/aad_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/aad_sample.py @@ -5,32 +5,31 @@ # ------------------------------------------------------------------------- from azure.appconfiguration.provider import ( - AzureAppConfigurationProvider, + load_provider, SettingSelector ) -from azure.identity import DefaultAzureCredential import os +from sample_utilities import get_authority, get_audience, get_credential endpoint = os.environ.get("AZURE_APPCONFIG_ENDPOINT") -credential = DefaultAzureCredential() +authority = get_authority(endpoint) +audience = get_audience(authority) +credential = get_credential(authority) # Connecting to Azure App Configuration using AAD -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=credential) +config = load_provider(endpoint=endpoint, credential=credential) print(config["message"]) # Connecting to Azure App Configuration using AAD and trimmed key prefixes trimmed = {"test."} -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=credential, trimmed_key_prefixes=trimmed) +config = load_provider(endpoint=endpoint, credential=credential, trimmed_key_prefixes=trimmed) print(config["message"]) # Connection to Azure App Configuration using SettingSelector selects = {SettingSelector("message*", "\0")} -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=credential, selects=selects) +config = load_provider(endpoint=endpoint, credential=credential, selects=selects) print("message found: " + str("message" in config)) print("test.message found: " + str("test.message" in config)) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_aad_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_aad_sample.py new file mode 100644 index 000000000000..8892275017a3 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_aad_sample.py @@ -0,0 +1,41 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- + +import asyncio +from azure.appconfiguration.provider.aio import load_provider +from azure.appconfiguration.provider import SettingSelector +import os +from sample_utilities import get_authority, get_audience, get_credential + +async def main(): + endpoint = os.environ.get("AZURE_APPCONFIG_ENDPOINT") + authority = get_authority(endpoint) + credential = get_credential(authority, is_async=True) + + # Connecting to Azure App Configuration using AAD + config = await load_provider(endpoint=endpoint, credential=credential) + print(config["message"]) + + # Connecting to Azure App Configuration using AAD and trimmed key prefixes + trimmed = {"test."} + config = await load_provider(endpoint=endpoint, credential=credential, trimmed_key_prefixes=trimmed) + + print(config["message"]) + + # Connection to Azure App Configuration using SettingSelector + selects = {SettingSelector("message*", "\0")} + config = await load_provider(endpoint=endpoint, credential=credential, selects=selects) + + print("message found: " + str("message" in config)) + print("test.message found: " + str("test.message" in config)) + + + await credential.close() + await config.close() + +if __name__ == "__main__": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + asyncio.run(main()) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_connection_string_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_connection_string_sample.py new file mode 100644 index 000000000000..8ac139cadf2a --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_connection_string_sample.py @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +import asyncio +from azure.appconfiguration.provider.aio import load_provider +from azure.appconfiguration.provider import SettingSelector +import os + +async def main(): + connection_string = os.environ.get("AZURE_APPCONFIG_CONNECTION_STRING") + + # Connecting to Azure App Configuration using connection string + config = await load_provider(connection_string=connection_string) + + print(config["message"]) + print(config["my_json"]["key"]) + + # Connecting to Azure App Configuration using connection string and trimmed key prefixes + trimmed = {"test."} + config = await load_provider(connection_string=connection_string, trimmed_key_prefixes=trimmed) + + print(config["message"]) + + # Connection to Azure App Configuration using SettingSelector + selects = {SettingSelector("message*", "\0")} + config = await load_provider(connection_string=connection_string, selects=selects) + + print("message found: " + str("message" in config)) + print("test.message found: " + str("test.message" in config)) + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_key_vault_reference_provided_clients_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_key_vault_reference_provided_clients_sample.py new file mode 100644 index 000000000000..3f46ecd0daf4 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_key_vault_reference_provided_clients_sample.py @@ -0,0 +1,35 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- + +import asyncio +from azure.appconfiguration.provider.aio import load_provider +from azure.appconfiguration.provider import SettingSelector, AzureAppConfigurationKeyVaultOptions +from azure.keyvault.secrets.aio import SecretClient +import os +from sample_utilities import get_authority, get_audience, get_credential + +async def main(): + endpoint = os.environ.get("AZURE_APPCONFIG_ENDPOINT") + key_vault_uri = os.environ.get("AZURE_KEYVAULT_URI") + authority = get_authority(endpoint) + audience = get_audience(authority) + credential = get_credential(authority, is_async=True) + + # Connection to Azure App Configuration using AAD with Provided Client + secret_client = SecretClient(vault_url=key_vault_uri, credential=credential) + selects = {SettingSelector("*", "prod")} + key_vault_options = AzureAppConfigurationKeyVaultOptions(secret_clients=[secret_client]) + config = await load_provider(endpoint=endpoint, credential=credential, key_vault_options=key_vault_options, selects=selects) + + print(config["secret"]) + + await credential.close() + await secret_client.close() + await config.close() + +if __name__ == "__main__": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + asyncio.run(main()) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_key_vault_reference_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_key_vault_reference_sample.py new file mode 100644 index 000000000000..50e30cdf4ce9 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/async_key_vault_reference_sample.py @@ -0,0 +1,32 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- + +import asyncio +from azure.appconfiguration.provider.aio import load_provider +from azure.appconfiguration.provider import SettingSelector, AzureAppConfigurationKeyVaultOptions +import os +from sample_utilities import get_authority, get_audience, get_credential + +async def main(): + endpoint = os.environ.get("AZURE_APPCONFIG_ENDPOINT") + authority = get_authority(endpoint) + audience = get_audience(authority) + credential = get_credential(authority, is_async=True) + + # Connection to Azure App Configuration using AAD and Resolving Key Vault References + key_vault_options = AzureAppConfigurationKeyVaultOptions(credential=credential) + selects = {SettingSelector("*", "prod")} + + config = await load_provider(endpoint=endpoint, credential=credential, key_vault_options=key_vault_options, selects=selects) + + print(config["secret"]) + + await credential.close() + await config.close() + +if __name__ == "__main__": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + asyncio.run(main()) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/connection_string_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/connection_string_sample.py index c18a5f989fbb..ac7dcd59b4cc 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/samples/connection_string_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/connection_string_sample.py @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- from azure.appconfiguration.provider import ( - AzureAppConfigurationProvider, + load_provider, SettingSelector ) import os @@ -13,23 +13,20 @@ connection_string = os.environ.get("AZURE_APPCONFIG_CONNECTION_STRING") # Connecting to Azure App Configuration using connection string -config = AzureAppConfigurationProvider.load( - connection_string=connection_string) +config = load_provider(connection_string=connection_string) print(config["message"]) print(config["my_json"]["key"]) # Connecting to Azure App Configuration using connection string and trimmed key prefixes trimmed = {"test."} -config = AzureAppConfigurationProvider.load( - connection_string=connection_string, trimmed_key_prefixes=trimmed) +config = load_provider(connection_string=connection_string, trimmed_key_prefixes=trimmed) print(config["message"]) # Connection to Azure App Configuration using SettingSelector selects = {SettingSelector("message*", "\0")} -config = AzureAppConfigurationProvider.load( - connection_string=connection_string, selects=selects) +config = load_provider(connection_string=connection_string, selects=selects) print("message found: " + str("message" in config)) print("test.message found: " + str("test.message" in config)) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_provided_clients_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_provided_clients_sample.py index 8d67f617c34c..2373222fe8b1 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_provided_clients_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_provided_clients_sample.py @@ -5,24 +5,24 @@ # ------------------------------------------------------------------------- from azure.appconfiguration.provider import ( - AzureAppConfigurationProvider, + load_provider, AzureAppConfigurationKeyVaultOptions, SettingSelector ) from azure.keyvault.secrets import SecretClient -from azure.identity import DefaultAzureCredential import os +from sample_utilities import get_authority, get_audience, get_credential endpoint = os.environ.get("AZURE_APPCONFIG_ENDPOINT") key_vault_uri = os.environ.get("AZURE_KEYVAULT_URI") -credential = DefaultAzureCredential() +authority = get_authority(endpoint) +audience = get_audience(authority) +credential = get_credential(authority) # Connection to Azure App Configuration using AAD with Provided Client secret_client = SecretClient(vault_url=key_vault_uri, credential=credential) selects = {SettingSelector("*", "prod")} -key_vault_options = AzureAppConfigurationKeyVaultOptions(secret_clients=[ - secret_client]) -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=credential, key_vault_options=key_vault_options, selects=selects) +key_vault_options = AzureAppConfigurationKeyVaultOptions(secret_clients=[secret_client]) +config = load_provider(endpoint=endpoint, credential=credential, key_vault_options=key_vault_options, selects=selects) print(config["secret"]) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_sample.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_sample.py index 4e02cb434197..2a44fa87900a 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/key_vault_reference_sample.py @@ -5,21 +5,22 @@ # ------------------------------------------------------------------------- from azure.appconfiguration.provider import ( - AzureAppConfigurationProvider, + load_provider, AzureAppConfigurationKeyVaultOptions, SettingSelector ) -from azure.identity import DefaultAzureCredential import os +from sample_utilities import get_authority, get_audience, get_credential endpoint = os.environ.get("AZURE_APPCONFIG_ENDPOINT") -credential = DefaultAzureCredential() +authority = get_authority(endpoint) +audience = get_audience(authority) +credential = get_credential(authority) # Connection to Azure App Configuration using AAD and Resolving Key Vault References key_vault_options = AzureAppConfigurationKeyVaultOptions(credential=credential) selects = {SettingSelector("*", "prod")} -config = AzureAppConfigurationProvider.load( - endpoint=endpoint, credential=credential, key_vault_options=key_vault_options, selects=selects) +config = load_provider(endpoint=endpoint, credential=credential, key_vault_options=key_vault_options, selects=selects) print(config["secret"]) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/samples/sample_utilities.py b/sdk/appconfiguration/azure-appconfiguration-provider/samples/sample_utilities.py new file mode 100644 index 000000000000..82959bfeb487 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/samples/sample_utilities.py @@ -0,0 +1,50 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- + +""" +FILE: sample_utilities.py +DESCRIPTION: + This file include some utility functions for samples to use: + - get_authority(): get authority of the ConfigurationClient + - get_audience(): get audience of the ConfigurationClient + - get_credential(): get credential of the ConfigurationClient + It is not a file expected to run independently. +""" + +import os +from azure.identity import AzureAuthorityHosts, ClientSecretCredential, DefaultAzureCredential +from azure.identity.aio import DefaultAzureCredential as AsyncDefaultAzureCredential + +def get_authority(endpoint): + # cSpell:ignore azconfig + if ".azconfig.io" in endpoint: + return AzureAuthorityHosts.AZURE_PUBLIC_CLOUD + if ".azconfig.azure.cn" in endpoint: + return AzureAuthorityHosts.AZURE_CHINA + if ".azconfig.azure.us" in endpoint: + return AzureAuthorityHosts.AZURE_GOVERNMENT + raise ValueError(f"Endpoint ({endpoint}) could not be understood") + +def get_audience(authority): + if authority == AzureAuthorityHosts.AZURE_PUBLIC_CLOUD: + return "https://management.azure.com" + if authority == AzureAuthorityHosts.AZURE_CHINA: + return "https://management.chinacloudapi.cn" + if authority == AzureAuthorityHosts.AZURE_GOVERNMENT: + return "https://management.usgovcloudapi.net" + +def get_credential(authority, **kwargs): + if authority != AzureAuthorityHosts.AZURE_PUBLIC_CLOUD: + return ClientSecretCredential( + tenant_id=os.environ.get("AZURE_TENANT_ID"), + client_id=os.environ.get("AZURE_CLIENT_ID"), + client_secret=os.environ.get("AZURE_CLIENT_SECRET"), + authority=authority + ) + is_async = kwargs.pop("is_async", False) + if is_async: + return AsyncDefaultAzureCredential(**kwargs) + return DefaultAzureCredential(**kwargs) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/setup.py b/sdk/appconfiguration/azure-appconfiguration-provider/setup.py index 6e2821a58357..da8f066ccc45 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/setup.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/setup.py @@ -66,6 +66,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -73,8 +74,8 @@ python_requires=">=3.6", install_requires=[ "msrest>=0.6.21", - "azure-core<2.0.0,>=1.2.2", - "azure-appconfiguration<2.0.0,>=1.3.0", + "azure-core<2.0.0,>=1.24.0", + "azure-appconfiguration<2.0.0,>=1.4.0", "azure-keyvault-secrets<5.0.0,>=4.3.0", ], ) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/async_preparers.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/async_preparers.py new file mode 100644 index 000000000000..d2bf0661b1ca --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/async_preparers.py @@ -0,0 +1,31 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from preparers import AppConfigProviderPreparer, trim_kwargs_from_test_function + +def app_config_decorator_async(func, **kwargs): + @AppConfigProviderPreparer() + async def wrapper(*args, **kwargs): + appconfiguration_connection_string = kwargs.pop("appconfiguration_connection_string") + kwargs['appconfiguration_connection_string'] = appconfiguration_connection_string + + trimmed_kwargs = {k:v for k, v in kwargs.items()} + trim_kwargs_from_test_function(func, trimmed_kwargs) + + await func(*args, **trimmed_kwargs) + + return wrapper + +def app_config_aad_decorator_async(func, **kwargs): + @AppConfigProviderPreparer() + async def wrapper(*args, **kwargs): + appconfiguration_endpoint_string = kwargs.pop("appconfiguration_endpoint_string") + kwargs['appconfiguration_endpoint_string'] = appconfiguration_endpoint_string + + trimmed_kwargs = {k:v for k, v in kwargs.items()} + trim_kwargs_from_test_function(func, trimmed_kwargs) + + await func(*args, **trimmed_kwargs) + return wrapper diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_creation.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_creation.json new file mode 100644 index 000000000000..4af995263902 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_creation.json @@ -0,0 +1,87 @@ +{ + "Entries": [ + { + "RequestUri": "https://fake-endpoint.azconfig.io/kv?key=*\u0026label=%00\u0026api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/vnd.microsoft.appconfig.kvset\u002Bjson, application/json, application/problem\u002Bjson", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "0", + "Correlation-Context": "RequestType=Startup", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Feb, 08 2023 22:33:28.192807 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "*", + "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", + "Connection": "keep-alive", + "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", + "Date": "Wed, 08 Feb 2023 22:33:28 GMT", + "Server": "openresty/1.21.4.1", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "f50e2fac-bd9f-4020-b912-f5def2115ba5" + }, + "ResponseBody": { + "items": [ + { + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", + "key": "message", + "label": null, + "content_type": "", + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" + }, + { + "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", + "key": "my_json", + "label": null, + "content_type": "application/json", + "value": "{\u0022key\u0022:\u0022value\u0022}", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T20:35:17\u002B00:00" + }, + { + "etag": "7vw5ma2Cc0-eE1cnRaaCv2_VtAS8BQ5jbHP9eNS_MFA", + "key": "test.trimmed", + "label": null, + "content_type": "key", + "value": "key", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T19:58:41\u002B00:00" + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_selectors.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_selectors.json new file mode 100644 index 000000000000..91955a012eed --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_selectors.json @@ -0,0 +1,47 @@ +{ + "Entries": [ + { + "RequestUri": "https://fake-endpoint.azconfig.io/kv?key=message*\u0026label=dev\u0026api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/vnd.microsoft.appconfig.kvset\u002Bjson, application/json, application/problem\u002Bjson", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "0", + "Correlation-Context": "RequestType=Startup", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Feb, 08 2023 22:33:30.257649 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "*", + "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", + "Connection": "keep-alive", + "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", + "Date": "Wed, 08 Feb 2023 22:33:30 GMT", + "Server": "openresty/1.21.4.1", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "43de82df-be64-4d29-b35f-4ac69b0ab300" + }, + "ResponseBody": { + "items": [ + { + "etag": "yEiVkIl-IHlB26quPXo_Z2GbB5yQm_ENTWI2c1k1J4E", + "key": "message", + "label": "dev", + "content_type": "", + "value": "test", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T20:06:21\u002B00:00" + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json new file mode 100644 index 000000000000..810328f11fb1 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json @@ -0,0 +1,87 @@ +{ + "Entries": [ + { + "RequestUri": "https://fake-endpoint.azconfig.io/kv?key=*\u0026label=%00\u0026api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/vnd.microsoft.appconfig.kvset\u002Bjson, application/json, application/problem\u002Bjson", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "0", + "Correlation-Context": "RequestType=Startup", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Feb, 08 2023 22:33:29.984709 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "*", + "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", + "Connection": "keep-alive", + "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", + "Date": "Wed, 08 Feb 2023 22:33:30 GMT", + "Server": "openresty/1.21.4.1", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "53b48bf3-e658-4e8e-85f5-ec5a0d1dbb30" + }, + "ResponseBody": { + "items": [ + { + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", + "key": "message", + "label": null, + "content_type": "", + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" + }, + { + "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", + "key": "my_json", + "label": null, + "content_type": "application/json", + "value": "{\u0022key\u0022:\u0022value\u0022}", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T20:35:17\u002B00:00" + }, + { + "etag": "7vw5ma2Cc0-eE1cnRaaCv2_VtAS8BQ5jbHP9eNS_MFA", + "key": "test.trimmed", + "label": null, + "content_type": "key", + "value": "key", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T19:58:41\u002B00:00" + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_creation_aad.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_creation_aad.json new file mode 100644 index 000000000000..49971afc8275 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_creation_aad.json @@ -0,0 +1,84 @@ +{ + "Entries": [ + { + "RequestUri": "https://fake-endpoint.azconfig.io/kv?key=*\u0026label=%00\u0026api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/vnd.microsoft.appconfig.kvset\u002Bjson, application/json, application/problem\u002Bjson", + "Accept-Encoding": "gzip, deflate", + "Correlation-Context": "RequestType=Startup", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "*", + "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", + "Connection": "keep-alive", + "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", + "Date": "Wed, 08 Feb 2023 22:33:31 GMT", + "Server": "openresty/1.21.4.1", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "0eae3d98-480b-4384-87f4-3a56f8c1446e" + }, + "ResponseBody": { + "items": [ + { + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", + "key": "message", + "label": null, + "content_type": "", + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" + }, + { + "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", + "key": "my_json", + "label": null, + "content_type": "application/json", + "value": "{\u0022key\u0022:\u0022value\u0022}", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T20:35:17\u002B00:00" + }, + { + "etag": "7vw5ma2Cc0-eE1cnRaaCv2_VtAS8BQ5jbHP9eNS_MFA", + "key": "test.trimmed", + "label": null, + "content_type": "key", + "value": "key", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T19:58:41\u002B00:00" + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_selectors.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_selectors.json new file mode 100644 index 000000000000..5e3559a6e349 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_selectors.json @@ -0,0 +1,44 @@ +{ + "Entries": [ + { + "RequestUri": "https://fake-endpoint.azconfig.io/kv?key=message*\u0026label=dev\u0026api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/vnd.microsoft.appconfig.kvset\u002Bjson, application/json, application/problem\u002Bjson", + "Accept-Encoding": "gzip, deflate", + "Correlation-Context": "RequestType=Startup", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "*", + "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", + "Connection": "keep-alive", + "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", + "Date": "Wed, 08 Feb 2023 22:33:32 GMT", + "Server": "openresty/1.21.4.1", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "9614bf72-1c45-4971-b839-8aebf6acaf91" + }, + "ResponseBody": { + "items": [ + { + "etag": "yEiVkIl-IHlB26quPXo_Z2GbB5yQm_ENTWI2c1k1J4E", + "key": "message", + "label": "dev", + "content_type": "", + "value": "test", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T20:06:21\u002B00:00" + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json new file mode 100644 index 000000000000..0718b46f8ebd --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_async_provider_aad.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json @@ -0,0 +1,84 @@ +{ + "Entries": [ + { + "RequestUri": "https://fake-endpoint.azconfig.io/kv?key=*\u0026label=%00\u0026api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/vnd.microsoft.appconfig.kvset\u002Bjson, application/json, application/problem\u002Bjson", + "Accept-Encoding": "gzip, deflate", + "Correlation-Context": "RequestType=Startup", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Credentials": "true", + "Access-Control-Allow-Origin": "*", + "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", + "Connection": "keep-alive", + "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", + "Date": "Wed, 08 Feb 2023 22:33:32 GMT", + "Server": "openresty/1.21.4.1", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", + "Transfer-Encoding": "chunked", + "x-ms-correlation-request-id": "f35c4800-039f-42bc-8564-687cb2326aea" + }, + "ResponseBody": { + "items": [ + { + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", + "key": "message", + "label": null, + "content_type": "", + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" + }, + { + "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", + "key": "my_json", + "label": null, + "content_type": "application/json", + "value": "{\u0022key\u0022:\u0022value\u0022}", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T20:35:17\u002B00:00" + }, + { + "etag": "7vw5ma2Cc0-eE1cnRaaCv2_VtAS8BQ5jbHP9eNS_MFA", + "key": "test.trimmed", + "label": null, + "content_type": "key", + "value": "key", + "tags": {}, + "locked": false, + "last_modified": "2022-09-27T19:58:41\u002B00:00" + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_creation.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_creation.json index fd5b1bf899c6..84a67d49b317 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_creation.json +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_creation.json @@ -8,9 +8,9 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Correlation-Context": "RequestType=Startup", - "User-Agent": "python-appconfiguration-provider/1.0.0b1 azsdk-python-appconfiguration/1.4.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)", "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", - "x-ms-date": "Sep, 27 2022 22:42:40.104313 GMT" + "x-ms-date": "Feb, 08 2023 22:33:33.113853 GMT" }, "RequestBody": null, "StatusCode": 200, @@ -20,24 +20,44 @@ "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", "Connection": "keep-alive", "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:40 GMT", - "Server": "openresty/1.17.8.2", + "Date": "Wed, 08 Feb 2023 22:33:33 GMT", + "Server": "openresty/1.21.4.1", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", - "Sync-Token": "zAJw6V16=NzoxNyMxOTgyNzIxMg==;sn=19827212", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", "Transfer-Encoding": "chunked", - "x-ms-correlation-request-id": "c7ce670d-847a-4232-93fc-a4efa00562d4" + "x-ms-correlation-request-id": "0a7bb334-fd3c-4b39-b424-669c4cfa73bb" }, "ResponseBody": { "items": [ { - "etag": "RX6Uzn3YdpSnDk7SX9kzxXwDFdYhR8dGGLEXBZ6i_nM", + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", "key": "message", "label": null, "content_type": "", "value": "hi", "tags": {}, "locked": false, - "last_modified": "2022-09-27T19:41:40\u002B00:00" + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" }, { "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", @@ -64,4 +84,4 @@ } ], "Variables": {} -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_selectors.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_selectors.json index 525dccf8aaab..abe032f40608 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_selectors.json +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_selectors.json @@ -8,9 +8,9 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Correlation-Context": "RequestType=Startup", - "User-Agent": "python-appconfiguration-provider/1.0.0b1 azsdk-python-appconfiguration/1.4.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)", "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", - "x-ms-date": "Sep, 27 2022 22:42:40.650526 GMT" + "x-ms-date": "Feb, 08 2023 22:33:33.590834 GMT" }, "RequestBody": null, "StatusCode": 200, @@ -20,12 +20,12 @@ "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", "Connection": "keep-alive", "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:40 GMT", - "Server": "openresty/1.17.8.2", + "Date": "Wed, 08 Feb 2023 22:33:33 GMT", + "Server": "openresty/1.21.4.1", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", - "Sync-Token": "zAJw6V16=NzoxNyMxOTgyNzIxMg==;sn=19827212", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", "Transfer-Encoding": "chunked", - "x-ms-correlation-request-id": "06221105-78da-4e5e-8239-20d1d53ea669" + "x-ms-correlation-request-id": "ed6b796e-2b57-45e4-aad0-f9551b7daaa1" }, "ResponseBody": { "items": [ @@ -44,4 +44,4 @@ } ], "Variables": {} -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json index 6faf86a93e30..8527138fc1ff 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json @@ -8,9 +8,9 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Correlation-Context": "RequestType=Startup", - "User-Agent": "python-appconfiguration-provider/1.0.0b1 azsdk-python-appconfiguration/1.4.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)", + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)", "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", - "x-ms-date": "Sep, 27 2022 22:42:40.490235 GMT" + "x-ms-date": "Feb, 08 2023 22:33:33.352066 GMT" }, "RequestBody": null, "StatusCode": 200, @@ -20,24 +20,44 @@ "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", "Connection": "keep-alive", "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:40 GMT", - "Server": "openresty/1.17.8.2", + "Date": "Wed, 08 Feb 2023 22:33:33 GMT", + "Server": "openresty/1.21.4.1", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", - "Sync-Token": "zAJw6V16=NzoxNyMxOTgyNzIxMg==;sn=19827212", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", "Transfer-Encoding": "chunked", - "x-ms-correlation-request-id": "55e5698f-c69d-4645-81aa-3f25371d56a4" + "x-ms-correlation-request-id": "b44828ad-3e88-4199-901b-1163c4d6f6af" }, "ResponseBody": { "items": [ { - "etag": "RX6Uzn3YdpSnDk7SX9kzxXwDFdYhR8dGGLEXBZ6i_nM", + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", "key": "message", "label": null, "content_type": "", "value": "hi", "tags": {}, "locked": false, - "last_modified": "2022-09-27T19:41:40\u002B00:00" + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" }, { "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", @@ -64,4 +84,4 @@ } ], "Variables": {} -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_creation_aad.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_creation_aad.json index 2d4e0036340f..0ecb9e28f899 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_creation_aad.json +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_creation_aad.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0b2 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17,17 +17,16 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1599", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:40 GMT", + "Date": "Wed, 08 Feb 2023 22:33:33 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=Aih2w7HdW0RLsLtcNXW6NJo; expires=Thu, 27-Oct-2022 22:42:41 GMT; path=/; secure; HttpOnly; SameSite=None", - "esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrkYxHw6mf13fuPRCu6v488gBdmaagfm2C8Q8ZiC9pB0nYYkXjS9U5w5mUTT51HcOESfBkGL6zDFmEHCECrlz_k72p8NUOMuj8OHKqWYGUIMnrKLpjfjH0i6lBviGMxCSFlnfEbzZfWev4InHJwQ2u2shZYtE7Y5Hb_K_3kYBp1RkgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None", - "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", - "stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" + "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; expires=Fri, 10-Mar-2023 22:33:33 GMT; path=/; secure; HttpOnly; SameSite=None", + "esctx=PAQABAAEAAAD--DLA3VO7QrddgJg7WevrODUWuiJWONlznSbyGnO4nZYG_EQFgG8tJD0_yqJ9NEgz_804pc92nBTvQWPf6_PhviGwUaGpoUBjd4B7d6DWTau3pifZgUTKqvCklV0AOQAF94XcVbQVvT15TWgKAHIJvsdHtFjn92Aix7dDr6gKoayP-vwgkvfqbDQz8Hepe0wgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly" ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13672.11 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -105,8 +104,8 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Cookie": "fpc=Aih2w7HdW0RLsLtcNXW6NJo; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd", - "User-Agent": "azsdk-python-identity/1.12.0b2 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "Cookie": "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; x-ms-gateway-slice=estsfd", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -116,16 +115,15 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:40 GMT", + "Date": "Wed, 08 Feb 2023 22:33:33 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=Aih2w7HdW0RLsLtcNXW6NJo; expires=Thu, 27-Oct-2022 22:42:41 GMT; path=/; secure; HttpOnly; SameSite=None", - "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", - "stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" + "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; expires=Fri, 10-Mar-2023 22:33:34 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly" ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13672.11 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -183,7 +181,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Correlation-Context": "RequestType=Startup", - "User-Agent": "python-appconfiguration-provider/1.0.0b1 azsdk-python-appconfiguration/1.4.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -193,24 +191,44 @@ "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", "Connection": "keep-alive", "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:41 GMT", - "Server": "openresty/1.17.8.2", + "Date": "Wed, 08 Feb 2023 22:33:34 GMT", + "Server": "openresty/1.21.4.1", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", - "Sync-Token": "zAJw6V16=NzoxNyMxOTgyNzIxMg==;sn=19827212", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", "Transfer-Encoding": "chunked", - "x-ms-correlation-request-id": "30054af8-b684-4033-b1b5-9c071f491287" + "x-ms-correlation-request-id": "ebb37104-0aea-4849-b478-b2261c34e096" }, "ResponseBody": { "items": [ { - "etag": "RX6Uzn3YdpSnDk7SX9kzxXwDFdYhR8dGGLEXBZ6i_nM", + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", "key": "message", "label": null, "content_type": "", "value": "hi", "tags": {}, "locked": false, - "last_modified": "2022-09-27T19:41:40\u002B00:00" + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" }, { "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", @@ -237,4 +255,4 @@ } ], "Variables": {} -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_selectors.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_selectors.json index 692dc3e00582..84302dc1dfbf 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_selectors.json +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_selectors.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0b2 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17,16 +17,15 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1599", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:41 GMT", + "Date": "Wed, 08 Feb 2023 22:33:34 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=Aih2w7HdW0RLsLtcNXW6NJri05sNAgAAAGBzxdoOAAAA; expires=Thu, 27-Oct-2022 22:42:41 GMT; path=/; secure; HttpOnly; SameSite=None", - "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", - "stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" + "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; expires=Fri, 10-Mar-2023 22:33:35 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly" ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13672.11 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -104,8 +103,8 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Cookie": "fpc=Aih2w7HdW0RLsLtcNXW6NJri05sNAgAAAGBzxdoOAAAA; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd", - "User-Agent": "azsdk-python-identity/1.12.0b2 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "Cookie": "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; x-ms-gateway-slice=estsfd", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -115,16 +114,15 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:41 GMT", + "Date": "Wed, 08 Feb 2023 22:33:35 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=Aih2w7HdW0RLsLtcNXW6NJri05sNAgAAAGBzxdoOAAAA; expires=Thu, 27-Oct-2022 22:42:41 GMT; path=/; secure; HttpOnly; SameSite=None", - "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", - "stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" + "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; expires=Fri, 10-Mar-2023 22:33:35 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly" ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13672.11 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14526.6 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -182,7 +180,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Correlation-Context": "RequestType=Startup", - "User-Agent": "python-appconfiguration-provider/1.0.0b1 azsdk-python-appconfiguration/1.4.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -192,12 +190,12 @@ "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", "Connection": "keep-alive", "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:42 GMT", - "Server": "openresty/1.17.8.2", + "Date": "Wed, 08 Feb 2023 22:33:35 GMT", + "Server": "openresty/1.21.4.1", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", - "Sync-Token": "zAJw6V16=NzoxNyMxOTgyNzIxMg==;sn=19827212", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", "Transfer-Encoding": "chunked", - "x-ms-correlation-request-id": "98fc8948-d720-480a-a4f8-837e65f57cd0" + "x-ms-correlation-request-id": "f4c104ee-e863-44d7-9d1a-b4855456506f" }, "ResponseBody": { "items": [ @@ -216,4 +214,4 @@ } ], "Variables": {} -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json index ae777e18c7df..6d28f8d8c56f 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/recordings/test_provider_aad.pyTestAppConfigurationProvidertest_provider_trimmed_key_prefixes.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0b2 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17,16 +17,15 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1599", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:41 GMT", + "Date": "Wed, 08 Feb 2023 22:33:34 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=Aih2w7HdW0RLsLtcNXW6NJri05sNAQAAAGBzxdoOAAAA; expires=Thu, 27-Oct-2022 22:42:41 GMT; path=/; secure; HttpOnly; SameSite=None", - "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", - "stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" + "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; expires=Fri, 10-Mar-2023 22:33:34 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly" ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13672.11 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -104,8 +103,8 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Cookie": "fpc=Aih2w7HdW0RLsLtcNXW6NJri05sNAQAAAGBzxdoOAAAA; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd", - "User-Agent": "azsdk-python-identity/1.12.0b2 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "Cookie": "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; x-ms-gateway-slice=estsfd", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -115,16 +114,15 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:41 GMT", + "Date": "Wed, 08 Feb 2023 22:33:34 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=Aih2w7HdW0RLsLtcNXW6NJri05sNAQAAAGBzxdoOAAAA; expires=Thu, 27-Oct-2022 22:42:41 GMT; path=/; secure; HttpOnly; SameSite=None", - "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", - "stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" + "fpc=AqTPPhjdgKFNp1GfJ3D4mN_i05sNAgAAADoadtsOAAAA; expires=Fri, 10-Mar-2023 22:33:34 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly" ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13672.11 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -182,7 +180,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Correlation-Context": "RequestType=Startup", - "User-Agent": "python-appconfiguration-provider/1.0.0b1 azsdk-python-appconfiguration/1.4.0 Python/3.9.13 (Windows-10-10.0.19044-SP0)" + "User-Agent": "python-appconfiguration-provider/1.0.0b2 azsdk-python-appconfiguration/1.4.0b1 Python/3.9.13 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -192,24 +190,44 @@ "Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate, traceparent, tracestate", "Connection": "keep-alive", "Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8", - "Date": "Tue, 27 Sep 2022 22:42:41 GMT", - "Server": "openresty/1.17.8.2", + "Date": "Wed, 08 Feb 2023 22:33:34 GMT", + "Server": "openresty/1.21.4.1", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", - "Sync-Token": "zAJw6V16=NzoxNyMxOTgyNzIxMg==;sn=19827212", + "Sync-Token": "zAJw6V16=NzoxNyMyMTg1MjA2NQ==;sn=21852065", "Transfer-Encoding": "chunked", - "x-ms-correlation-request-id": "902e6b7c-5cfa-45b1-a567-c8ca2469af77" + "x-ms-correlation-request-id": "b55b6f70-f8d4-4275-bf6d-5330cf1a14db" }, "ResponseBody": { "items": [ { - "etag": "RX6Uzn3YdpSnDk7SX9kzxXwDFdYhR8dGGLEXBZ6i_nM", + "etag": "5l-CzldxczbRRnDjgiWcnuL__i--zHCffz7xO8ngGos", + "key": ".appconfig.featureflag/Alpha", + "label": null, + "content_type": "application/vnd.microsoft.appconfig.ff\u002Bjson;charset=utf-8", + "value": "{\u0022id\u0022:\u0022Alpha\u0022,\u0022description\u0022:\u0022\u0022,\u0022enabled\u0022:false,\u0022conditions\u0022:{\u0022client_filters\u0022:[]}}", + "tags": {}, + "locked": false, + "last_modified": "2023-01-30T20:25:07\u002B00:00" + }, + { + "etag": "Wfq_mEPSSfl9m4evo5sZDiZMkpn_6kH5xtJVH_D7OQY", "key": "message", "label": null, "content_type": "", "value": "hi", "tags": {}, "locked": false, - "last_modified": "2022-09-27T19:41:40\u002B00:00" + "last_modified": "2023-01-25T00:21:41\u002B00:00" + }, + { + "etag": "lO0_bzj8OQZOAMw2U2Ydzd4NJtYpXyQ5CbXktXLRhMs", + "key": "messageVal", + "label": null, + "content_type": null, + "value": "hi", + "tags": {}, + "locked": false, + "last_modified": "2023-01-23T19:14:32\u002B00:00" }, { "etag": "dYgyN_oxYWzXEQN8K8d2q-4rKQJwftuzR75Jagqq_pw", @@ -236,4 +254,4 @@ } ], "Variables": {} -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider.py new file mode 100644 index 000000000000..0ec459960931 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider.py @@ -0,0 +1,46 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from azure.appconfiguration.provider.aio import load_provider +from azure.appconfiguration.provider import SettingSelector +from devtools_testutils import AzureRecordedTestCase +from devtools_testutils.aio import recorded_by_proxy_async +from async_preparers import app_config_decorator_async + +class TestAppConfigurationProvider(AzureRecordedTestCase): + + async def build_provider(self, connection_string, trimmed_key_prefixes=[], selects={SettingSelector("*", "\0")}): + return await load_provider(connection_string=connection_string, trimmed_key_prefixes=trimmed_key_prefixes, selects=selects) + + # method: provider_creation + @app_config_decorator_async + @recorded_by_proxy_async + async def test_provider_creation(self, appconfiguration_connection_string): + async with await self.build_provider(appconfiguration_connection_string) as client: + assert client["message"] == "hi" + assert client["my_json"]["key"] == "value" + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' + + # method: provider_trimmed_key_prefixes + @app_config_decorator_async + @recorded_by_proxy_async + async def test_provider_trimmed_key_prefixes(self, appconfiguration_connection_string): + trimmed = {"test."} + async with await self.build_provider(appconfiguration_connection_string, trimmed_key_prefixes=trimmed) as client: + assert client["message"] == "hi" + assert client["my_json"]["key"] == "value" + assert client["trimmed"] == "key" + assert "test.trimmed" not in client + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' + + # method: provider_selectors + @app_config_decorator_async + @recorded_by_proxy_async + async def test_provider_selectors(self, appconfiguration_connection_string): + selects = {SettingSelector("message*", "dev")} + async with await self.build_provider(appconfiguration_connection_string, selects=selects) as client: + assert client["message"] == "test" + assert "test.trimmed" not in client + assert "FeatureManagementFeatureFlags" not in client diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider_aad.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider_aad.py new file mode 100644 index 000000000000..e4e30f2aa536 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider_aad.py @@ -0,0 +1,48 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from azure.appconfiguration.provider.aio import load_provider +from azure.appconfiguration.provider import SettingSelector +from devtools_testutils import AzureRecordedTestCase +from devtools_testutils.aio import recorded_by_proxy_async +from azure.appconfiguration.aio import AzureAppConfigurationClient +from async_preparers import app_config_decorator_async + +class TestAppConfigurationProvider(AzureRecordedTestCase): + + async def build_provider_aad(self, endpoint, trimmed_key_prefixes=[], selects={SettingSelector("*", "\0")}): + cred = self.get_credential(AzureAppConfigurationClient, is_async=True) + return await load_provider(credential=cred, endpoint=endpoint, trimmed_key_prefixes=trimmed_key_prefixes, selects=selects) + + # method: provider_creation_aad + @app_config_decorator_async + @recorded_by_proxy_async + async def test_provider_creation_aad(self, appconfiguration_endpoint_string): + async with await self.build_provider_aad(appconfiguration_endpoint_string) as client: + assert client["message"] == "hi" + assert client["my_json"]["key"] == "value" + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' + + # method: provider_trimmed_key_prefixes + @app_config_decorator_async + @recorded_by_proxy_async + async def test_provider_trimmed_key_prefixes(self, appconfiguration_endpoint_string): + trimmed = {"test."} + async with await self.build_provider_aad(appconfiguration_endpoint_string, trimmed_key_prefixes=trimmed) as client: + assert client["message"] == "hi" + assert client["my_json"]["key"] == "value" + assert client["trimmed"] == "key" + assert "test.trimmed" not in client + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' + + # method: provider_selectors + @app_config_decorator_async + @recorded_by_proxy_async + async def test_provider_selectors(self, appconfiguration_endpoint_string): + selects = {SettingSelector("message*", "dev")} + async with await self.build_provider_aad(appconfiguration_endpoint_string, selects=selects) as client: + assert client["message"] == "test" + assert "test.trimmed" not in client + assert "FeatureManagementFeatureFlags" not in client diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider.py index ec14c4a5bad8..9839afb4542e 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- from azure.appconfiguration.provider import ( - AzureAppConfigurationProvider, + load_provider, SettingSelector ) from devtools_testutils import ( @@ -17,7 +17,7 @@ class TestAppConfigurationProvider(AzureRecordedTestCase): def build_provider(self, connection_string, trimmed_key_prefixes=[], selects={SettingSelector("*", "\0")}): - return AzureAppConfigurationProvider.load(connection_string=connection_string, trimmed_key_prefixes=trimmed_key_prefixes, selects=selects) + return load_provider(connection_string=connection_string, trimmed_key_prefixes=trimmed_key_prefixes, selects=selects) # method: provider_creation @recorded_by_proxy @@ -26,6 +26,7 @@ def test_provider_creation(self, appconfiguration_connection_string): client = self.build_provider(appconfiguration_connection_string) assert client["message"] == "hi" assert client["my_json"]["key"] == "value" + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' # method: provider_trimmed_key_prefixes @recorded_by_proxy @@ -37,6 +38,7 @@ def test_provider_trimmed_key_prefixes(self, appconfiguration_connection_string) assert client["my_json"]["key"] == "value" assert client["trimmed"] == "key" assert "test.trimmed" not in client + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' # method: provider_selectors @recorded_by_proxy @@ -46,3 +48,4 @@ def test_provider_selectors(self, appconfiguration_connection_string): client = self.build_provider(appconfiguration_connection_string, selects=selects) assert client["message"] == "test" assert "test.trimmed" not in client + assert "FeatureManagementFeatureFlags" not in client diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_aad.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_aad.py index f68bee1436e1..80c22d01ca58 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_aad.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_aad.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- from azure.appconfiguration.provider import ( - AzureAppConfigurationProvider, + load_provider, SettingSelector ) from devtools_testutils import ( @@ -18,7 +18,7 @@ class TestAppConfigurationProvider(AzureRecordedTestCase): def build_provider_aad(self, endpoint, trimmed_key_prefixes=[], selects={SettingSelector("*", "\0")}): cred = self.get_credential(AzureAppConfigurationClient) - return AzureAppConfigurationProvider.load(credential=cred, endpoint=endpoint, trimmed_key_prefixes=trimmed_key_prefixes, selects=selects) + return load_provider(credential=cred, endpoint=endpoint, trimmed_key_prefixes=trimmed_key_prefixes, selects=selects) # method: provider_creation_aad @recorded_by_proxy @@ -27,6 +27,7 @@ def test_provider_creation_aad(self, appconfiguration_endpoint_string): client = self.build_provider_aad(appconfiguration_endpoint_string) assert client["message"] == "hi" assert client["my_json"]["key"] == "value" + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' # method: provider_trimmed_key_prefixes @recorded_by_proxy @@ -38,6 +39,7 @@ def test_provider_trimmed_key_prefixes(self, appconfiguration_endpoint_string): assert client["my_json"]["key"] == "value" assert client["trimmed"] == "key" assert "test.trimmed" not in client + assert client["FeatureManagementFeatureFlags"]["Alpha"] == '{\"enabled\": false, \"conditions\": {\"client_filters\": []}}' # method: provider_selectors @recorded_by_proxy @@ -47,3 +49,4 @@ def test_provider_selectors(self, appconfiguration_endpoint_string): client = self.build_provider_aad(appconfiguration_endpoint_string, selects=selects) assert client["message"] == "test" assert "test.trimmed" not in client + assert "FeatureManagementFeatureFlags" not in client diff --git a/sdk/appconfiguration/azure-appconfiguration/pyproject.toml b/sdk/appconfiguration/azure-appconfiguration/pyproject.toml new file mode 100644 index 000000000000..381c0d9346e5 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration/pyproject.toml @@ -0,0 +1,3 @@ +[tool.azure-sdk-build] +pyright = false +verifytypes = false diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md index c5185b9d3324..9e675fba53e5 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 3.0.0b1 (2023-02-15) + +### Breaking Changes + + - Removed operation KeyValuesOperations.list_by_configuration_store + ## 2.2.0 (2022-08-29) ### Features Added diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in b/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in index ec99a3e1f4f6..4171303a9421 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in @@ -1,5 +1,6 @@ include _meta.json recursive-include tests *.py *.json +recursive-include samples *.py *.md include *.md include azure/__init__.py include azure/mgmt/__init__.py diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md b/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md index 4f1fac69c071..23240139f582 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/?view=azure-python-preview) -Code samples for this package can be found at [App Configuration Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/appconfiguration) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-appconfiguration +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = AppConfigurationManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [App Configuration Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json index 095903ae64c5..a15535791367 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.7.2", + "commit": "d37b3db5ec88a9fc2afcae36bf8d2004b1c5b537", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@5.16.0", - "@autorest/modelerfour@4.19.3" + "@autorest/python@6.4.0", + "@autorest/modelerfour@4.24.3" ], - "commit": "429ced7c550f9f14a43ff3bb7f6a465927abd33c", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/appconfiguration/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/appconfiguration/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/appconfiguration/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py index d1689c02cd0a..9b210796291b 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py @@ -14,3 +14,7 @@ patch_sdk() except ImportError: pass + +from ._version import VERSION + +__version__ = VERSION diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py index b87b31313748..33245453a801 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py @@ -9,20 +9,17 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import AppConfigurationManagementClientConfiguration +from ._serialization import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -43,9 +40,9 @@ class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient): The api-version parameter sets the default API version if the operation group is not described in the profile. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -68,12 +65,12 @@ class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - api_version=None, # type: Optional[str] - base_url="https://management.azure.com", # type: str - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + credential: "TokenCredential", + subscription_id: str, + api_version: Optional[str]=None, + base_url: str = "https://management.azure.com", + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = AppConfigurationManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -115,6 +112,7 @@ def configuration_stores(self): from .v2022_05_01.operations import ConfigurationStoresOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_stores'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -131,6 +129,7 @@ def key_values(self): from .v2022_05_01.operations import KeyValuesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'key_values'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -147,6 +146,7 @@ def operations(self): from .v2022_05_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -163,6 +163,7 @@ def private_endpoint_connections(self): from .v2022_05_01.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -179,6 +180,7 @@ def private_link_resources(self): from .v2022_05_01.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -192,6 +194,7 @@ def replicas(self): from .v2022_03_01_preview.operations import ReplicasOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'replicas'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) def close(self): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py index befea2cdda33..c2a94040ed11 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -18,8 +18,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class AppConfigurationManagementClientConfiguration(Configuration): @@ -28,19 +26,18 @@ class AppConfigurationManagementClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -55,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_serialization.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_serialization.py new file mode 100644 index 000000000000..25467dfc00bb --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_serialization.py @@ -0,0 +1,1998 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to azure from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py index f30401ec2040..5819b888fe6e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0" +VERSION = "3.0.0b1" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py index b916899925c8..3170668ea5d3 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py @@ -11,17 +11,15 @@ from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from .._serialization import Deserializer, Serializer from ._configuration import AppConfigurationManagementClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -42,9 +40,9 @@ class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient): The api-version parameter sets the default API version if the operation group is not described in the profile. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -72,7 +70,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = AppConfigurationManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -114,6 +112,7 @@ def configuration_stores(self): from ..v2022_05_01.aio.operations import ConfigurationStoresOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_stores'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -130,6 +129,7 @@ def key_values(self): from ..v2022_05_01.aio.operations import KeyValuesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'key_values'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -146,6 +146,7 @@ def operations(self): from ..v2022_05_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -162,6 +163,7 @@ def private_endpoint_connections(self): from ..v2022_05_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -178,6 +180,7 @@ def private_link_resources(self): from ..v2022_05_01.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -191,6 +194,7 @@ def replicas(self): from ..v2022_03_01_preview.aio.operations import ReplicasOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'replicas'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) async def close(self): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py index cfb13b098fd8..55febc95a16f 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py @@ -26,9 +26,9 @@ class AppConfigurationManagementClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str """ @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/__init__.py index 5396ddec76cf..f2ea8d6fa6dd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['AppConfigurationManagementClient'] + +__all__ = [ + "AppConfigurationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_client.py index f853f6399805..ef93aeac5786 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_client.py @@ -9,20 +9,27 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import AppConfigurationManagementClientConfiguration -from .operations import ConfigurationStoresOperations, KeyValuesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ReplicasOperations +from .operations import ( + ConfigurationStoresOperations, + KeyValuesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ReplicasOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class AppConfigurationManagementClient: + +class AppConfigurationManagementClient: # pylint: disable=client-accepts-api-version-keyword """AppConfigurationManagementClient. :ivar configuration_stores: ConfigurationStoresOperations operations @@ -42,9 +49,9 @@ class AppConfigurationManagementClient: :ivar replicas: ReplicasOperations operations :vartype replicas: azure.mgmt.appconfiguration.v2022_03_01_preview.operations.ReplicasOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -62,38 +69,29 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = AppConfigurationManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = AppConfigurationManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.configuration_stores = ConfigurationStoresOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.key_values = KeyValuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.replicas = ReplicasOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -102,7 +100,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -115,15 +113,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AppConfigurationManagementClient + def __enter__(self) -> "AppConfigurationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py index 2fe67f3f9180..d16a062141c3 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,23 +31,18 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + api_version: Literal["2022-03-01-preview"] = kwargs.pop("api_version", "2022-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +52,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appconfiguration/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json index 64c6d702a064..b5214a5c0893 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The Microsoft Azure subscription ID.", + "signature": "subscription_id: str,", + "description": "The Microsoft Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The Microsoft Azure subscription ID.", + "description": "The Microsoft Azure subscription ID. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -104,4 +112,4 @@ "key_values": "KeyValuesOperations", "replicas": "ReplicasOperations" } -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_vendor.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_vendor.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py index f30401ec2040..5819b888fe6e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0" +VERSION = "3.0.0b1" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/__init__.py index de0897959ad2..185a5e3680ea 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['AppConfigurationManagementClient'] + +__all__ = [ + "AppConfigurationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_client.py index c63efeb7d3f2..be14386d7ffc 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_client.py @@ -9,20 +9,27 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import AppConfigurationManagementClientConfiguration -from .operations import ConfigurationStoresOperations, KeyValuesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ReplicasOperations +from .operations import ( + ConfigurationStoresOperations, + KeyValuesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ReplicasOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppConfigurationManagementClient: + +class AppConfigurationManagementClient: # pylint: disable=client-accepts-api-version-keyword """AppConfigurationManagementClient. :ivar configuration_stores: ConfigurationStoresOperations operations @@ -42,9 +49,9 @@ class AppConfigurationManagementClient: :ivar replicas: ReplicasOperations operations :vartype replicas: azure.mgmt.appconfiguration.v2022_03_01_preview.aio.operations.ReplicasOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -62,38 +69,29 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = AppConfigurationManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = AppConfigurationManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.configuration_stores = ConfigurationStoresOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.key_values = KeyValuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.replicas = ReplicasOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -102,7 +100,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -122,5 +120,5 @@ async def __aenter__(self) -> "AppConfigurationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py index c2181b0006f4..2474c7d8abd6 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,23 +31,18 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + api_version: Literal["2022-03-01-preview"] = kwargs.pop("api_version", "2022-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +52,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appconfiguration/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/__init__.py index 32756eab8ac7..ba0c4f83f634 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/__init__.py @@ -14,15 +14,16 @@ from ._replicas_operations import ReplicasOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ConfigurationStoresOperations', - 'Operations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'KeyValuesOperations', - 'ReplicasOperations', + "ConfigurationStoresOperations", + "Operations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "KeyValuesOperations", + "ReplicasOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py index fdeb0d2ba871..63cd055539c6 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,28 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._configuration_stores_operations import build_create_request_initial, build_delete_request_initial, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_deleted_request, build_list_keys_request, build_list_request, build_purge_deleted_request_initial, build_regenerate_key_request, build_update_request_initial -T = TypeVar('T') +from ...operations._configuration_stores_operations import ( + build_create_request, + build_delete_request, + build_get_deleted_request, + build_get_request, + build_list_by_resource_group_request, + build_list_deleted_request, + build_list_keys_request, + build_list_request, + build_purge_deleted_request, + build_regenerate_key_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ConfigurationStoresOperations: """ .. warning:: @@ -45,13 +72,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.ConfigurationStoreListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given subscription. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -60,48 +82,56 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -109,16 +139,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -129,23 +157,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.ConfigurationStoreListResult]: + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given resource group. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -153,50 +176,57 @@ def list_by_resource_group( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_resource_group.metadata['url'], + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -204,16 +234,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -224,60 +252,58 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> _models.ConfigurationStore: + async def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: """Gets the properties of the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationStore, or the result of cls(response) + :return: ConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -285,94 +311,189 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } async def _create_initial( self, resource_group_name: str, config_store_name: str, - config_store_creation_parameters: _models.ConfigurationStore, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - - _json = self._serialize.body(config_store_creation_parameters, 'ConfigurationStore') - - request = build_create_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_creation_parameters, (IO, bytes)): + _content = config_store_creation_parameters + else: + _json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore") + + request = build_create_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace_async + @overload async def begin_create( self, resource_group_name: str, config_store_name: str, config_store_creation_parameters: _models.ConfigurationStore, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ConfigurationStore]: """Creates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. Is + either a ConfigurationStore type or a IO type. Required. + :type config_store_creation_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -385,121 +506,117 @@ async def begin_create( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_creation_parameters=config_store_creation_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, config_store_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -511,134 +628,150 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } async def _update_initial( self, resource_group_name: str, config_store_name: str, - config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - - _json = self._serialize.body(config_store_update_parameters, 'ConfigurationStoreUpdateParameters') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_update_parameters, (IO, bytes)): + _content = config_store_update_parameters + else: + _json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters") + + request = build_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace_async + @overload async def begin_update( self, resource_group_name: str, config_store_name: str, config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ConfigurationStore]: """Updates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_update_parameters: The parameters for updating a configuration store. + Required. :type config_store_update_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -651,75 +784,144 @@ async def begin_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. Is + either a ConfigurationStoreUpdateParameters type or a IO type. Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreUpdateParameters or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_update_parameters=config_store_update_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.ApiKeyListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ApiKey"]: """Lists the access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -727,51 +929,58 @@ def list_keys( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiKeyListResult or the result of cls(response) + :return: An iterator like instance of either ApiKey or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKeyListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_keys_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_keys.metadata['url'], + api_version=api_version, + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -779,16 +988,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiKeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -799,68 +1006,140 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_key( self, resource_group_name: str, config_store_name: str, regenerate_key_parameters: _models.RegenerateKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ApiKey: """Regenerates an access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKey, or the result of cls(response) + :return: ApiKey or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO], + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Is either a + RegenerateKeyParameters type or a IO type. Required. + :type regenerate_key_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKey] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) - _json = self._serialize.body(regenerate_key_parameters, 'RegenerateKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_key_parameters, (IO, bytes)): + _content = regenerate_key_parameters + else: + _json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters") request = build_regenerate_key_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_key.metadata['url'], + content=_content, + template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -868,64 +1147,72 @@ async def regenerate_key( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ApiKey', pipeline_response) + deserialized = self._deserialize("ApiKey", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"} # type: ignore - + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey" + } @distributed_trace - def list_deleted( - self, - **kwargs: Any - ) -> AsyncIterable[_models.DeletedConfigurationStoreListResult]: + def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigurationStore"]: """Gets information about the deleted configuration stores in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedConfigurationStoreListResult or the result - of cls(response) + :return: An iterator like instance of either DeletedConfigurationStore or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStoreListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_deleted_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_deleted.metadata['url'], + template_url=self.list_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -933,16 +1220,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -953,59 +1238,59 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"} # type: ignore + list_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores" + } @distributed_trace_async async def get_deleted( - self, - location: str, - config_store_name: str, - **kwargs: Any + self, location: str, config_store_name: str, **kwargs: Any ) -> _models.DeletedConfigurationStore: """Gets a deleted Azure app configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedConfigurationStore, or the result of cls(response) + :return: DeletedConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStore] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) - request = build_get_deleted_request( - subscription_id=self._config.subscription_id, location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_deleted.metadata['url'], + template_url=self.get_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1013,75 +1298,73 @@ async def get_deleted( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedConfigurationStore', pipeline_response) + deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"} # type: ignore - + get_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}" + } async def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any + self, location: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_purge_deleted_request_initial( - subscription_id=self._config.subscription_id, + request = build_purge_deleted_request( location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._purge_deleted_initial.metadata['url'], + template_url=self._purge_deleted_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore - + _purge_deleted_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } @distributed_trace_async - async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Permanently deletes the specified configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1093,52 +1376,49 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._purge_deleted_initial( # type: ignore location=location, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore + begin_purge_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py index cc0eb4b9609a..905c6d057acd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_values_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_by_configuration_store_request -T = TypeVar('T') +from ...operations._key_values_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_configuration_store_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class KeyValuesOperations: """ .. warning:: @@ -45,21 +65,16 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.KeyValueListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyValue"]: """Lists the key-values for a given configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -67,51 +82,58 @@ def list_by_configuration_store( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either KeyValueListResult or the result of cls(response) + :return: An iterator like instance of either KeyValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValueListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_configuration_store.metadata['url'], + api_version=api_version, + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,16 +141,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("KeyValueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -139,65 +159,64 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> _models.KeyValue: """Gets the properties of the specified key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -205,79 +224,160 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, config_store_name: str, key_value_name: str, key_value_parameters: Optional[_models.KeyValue] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.KeyValue: """Creates a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :param key_value_parameters: The parameters for creating a key-value. Default value is None. :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Default value is None. + :type key_value_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None, + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type + or a IO type. Default value is None. + :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] - - if key_value_parameters is not None: - _json = self._serialize.body(key_value_parameters, 'KeyValue') + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(key_value_parameters, (IO, bytes)): + _content = key_value_parameters else: - _json = None + if key_value_parameters is not None: + _json = self._serialize.body(key_value_parameters, "KeyValue") + else: + _json = None request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -285,82 +385,80 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -372,53 +470,50 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py index d183576a45db..8acdf64ae3ee 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._operations import build_check_name_availability_request, build_list_request, build_regional_check_name_availability_request -T = TypeVar('T') +from ...operations._operations import ( + build_check_name_availability_request, + build_list_request, + build_regional_check_name_availability_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -43,55 +62,107 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def check_name_availability( self, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,22 +170,19 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" + } @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.OperationDefinitionListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.OperationDefinition"]: """Lists the operations available from this provider. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -123,46 +191,55 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationDefinitionListResult or the result of - cls(response) + :return: An iterator like instance of either OperationDefinition or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.OperationDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.OperationDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationDefinitionListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -170,16 +247,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -190,64 +265,127 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppConfiguration/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"} - @distributed_trace_async + @overload async def regional_check_name_availability( self, location: str, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_regional_check_name_availability_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regional_check_name_availability.metadata['url'], + content=_content, + template_url=self.regional_check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -255,12 +393,13 @@ async def regional_check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regional_check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"} # type: ignore - + regional_check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py index 22f6f9d0e07e..c0880ed0bfb2 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_configuration_store_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_configuration_store_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -45,66 +65,70 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Lists all private endpoint connections for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,16 +136,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,64 +154,63 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -197,100 +218,201 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _create_or_update_initial( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection, (IO, bytes)): + _content = private_endpoint_connection + else: + _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") + + request = build_create_or_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Update the state of the specified private endpoint connection associated with the configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. + :param private_endpoint_connection: The private endpoint connection properties. Required. :type private_endpoint_connection: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO type. Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -303,127 +425,121 @@ async def begin_create_or_update( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,53 +551,50 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py index 20b1a2662c1e..419bd48573ff 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_by_configuration_store_request -T = TypeVar('T') +from ...operations._private_link_resources_operations import ( + build_get_request, + build_list_by_configuration_store_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -43,66 +61,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateLinkResourceListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: """Gets the private link resources that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of - cls(response) + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResourceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -110,16 +131,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,64 +149,63 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - config_store_name: str, - group_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any ) -> _models.PrivateLinkResource: """Gets a private link resource that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param group_name: The name of the private link resource group. + :param group_name: The name of the private link resource group. Required. :type group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, group_name=group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,12 +213,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py index 42e42c242a3e..c2305209634c 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._replicas_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_configuration_store_request -T = TypeVar('T') +from ...operations._replicas_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_configuration_store_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ReplicasOperations: """ .. warning:: @@ -45,21 +65,16 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.ReplicaListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Replica"]: """Lists the replicas for a given configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -67,51 +82,58 @@ def list_by_configuration_store( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicaListResult or the result of cls(response) + :return: An iterator like instance of either Replica or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ReplicaListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicaListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ReplicaListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_configuration_store.metadata['url'], + api_version=api_version, + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,16 +141,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReplicaListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -139,64 +159,63 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any ) -> _models.Replica: """Gets the properties of the specified replica. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param replica_name: The name of the replica. + :param replica_name: The name of the replica. Required. :type replica_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Replica, or the result of cls(response) + :return: Replica or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -204,99 +223,158 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } async def _create_initial( self, resource_group_name: str, config_store_name: str, replica_name: str, - replica_creation_parameters: _models.Replica, + replica_creation_parameters: Union[_models.Replica, IO], **kwargs: Any ) -> _models.Replica: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] - - _json = self._serialize.body(replica_creation_parameters, 'Replica') - - request = build_create_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(replica_creation_parameters, (IO, bytes)): + _content = replica_creation_parameters + else: + _json = self._serialize.body(replica_creation_parameters, "Replica") + + request = build_create_request( resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore + return deserialized # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } - @distributed_trace_async + @overload async def begin_create( self, resource_group_name: str, config_store_name: str, replica_name: str, replica_creation_parameters: _models.Replica, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Replica]: """Creates a replica with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param replica_name: The name of the replica. + :param replica_name: The name of the replica. Required. :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. + :param replica_creation_parameters: The parameters for creating a replica. Required. :type replica_creation_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replica or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -309,127 +387,161 @@ async def begin_create( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Is either a Replica + type or a IO type. Required. + :type replica_creation_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replica or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, replica_creation_parameters=replica_creation_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a replica. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param replica_name: The name of the replica. + :param replica_name: The name of the replica. Required. :type replica_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -441,53 +553,52 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - lro_options={'final-state-via': 'location'}, - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/__init__.py index 2f18ea871728..5dafc1a6a3cc 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/__init__.py @@ -47,71 +47,69 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserIdentity - -from ._app_configuration_management_client_enums import ( - ActionsRequired, - ConfigurationResourceType, - ConnectionStatus, - CreateMode, - CreatedByType, - IdentityType, - ProvisioningState, - PublicNetworkAccess, - ReplicaProvisioningState, -) +from ._app_configuration_management_client_enums import ActionsRequired +from ._app_configuration_management_client_enums import ConfigurationResourceType +from ._app_configuration_management_client_enums import ConnectionStatus +from ._app_configuration_management_client_enums import CreateMode +from ._app_configuration_management_client_enums import CreatedByType +from ._app_configuration_management_client_enums import IdentityType +from ._app_configuration_management_client_enums import ProvisioningState +from ._app_configuration_management_client_enums import PublicNetworkAccess +from ._app_configuration_management_client_enums import ReplicaProvisioningState from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ApiKey', - 'ApiKeyListResult', - 'CheckNameAvailabilityParameters', - 'ConfigurationStore', - 'ConfigurationStoreListResult', - 'ConfigurationStoreUpdateParameters', - 'DeletedConfigurationStore', - 'DeletedConfigurationStoreListResult', - 'EncryptionProperties', - 'ErrorAdditionalInfo', - 'ErrorDetails', - 'ErrorResponse', - 'KeyValue', - 'KeyValueListResult', - 'KeyVaultProperties', - 'LogSpecification', - 'MetricDimension', - 'MetricSpecification', - 'NameAvailabilityStatus', - 'OperationDefinition', - 'OperationDefinitionDisplay', - 'OperationDefinitionListResult', - 'OperationProperties', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateEndpointConnectionReference', - 'PrivateLinkResource', - 'PrivateLinkResourceListResult', - 'PrivateLinkServiceConnectionState', - 'RegenerateKeyParameters', - 'Replica', - 'ReplicaListResult', - 'Resource', - 'ResourceIdentity', - 'ServiceSpecification', - 'Sku', - 'SystemData', - 'TrackedResource', - 'UserIdentity', - 'ActionsRequired', - 'ConfigurationResourceType', - 'ConnectionStatus', - 'CreateMode', - 'CreatedByType', - 'IdentityType', - 'ProvisioningState', - 'PublicNetworkAccess', - 'ReplicaProvisioningState', + "ApiKey", + "ApiKeyListResult", + "CheckNameAvailabilityParameters", + "ConfigurationStore", + "ConfigurationStoreListResult", + "ConfigurationStoreUpdateParameters", + "DeletedConfigurationStore", + "DeletedConfigurationStoreListResult", + "EncryptionProperties", + "ErrorAdditionalInfo", + "ErrorDetails", + "ErrorResponse", + "KeyValue", + "KeyValueListResult", + "KeyVaultProperties", + "LogSpecification", + "MetricDimension", + "MetricSpecification", + "NameAvailabilityStatus", + "OperationDefinition", + "OperationDefinitionDisplay", + "OperationDefinitionListResult", + "OperationProperties", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionReference", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkServiceConnectionState", + "RegenerateKeyParameters", + "Replica", + "ReplicaListResult", + "Resource", + "ResourceIdentity", + "ServiceSpecification", + "Sku", + "SystemData", + "TrackedResource", + "UserIdentity", + "ActionsRequired", + "ConfigurationResourceType", + "ConnectionStatus", + "CreateMode", + "CreatedByType", + "IdentityType", + "ProvisioningState", + "PublicNetworkAccess", + "ReplicaProvisioningState", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_app_configuration_management_client_enums.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_app_configuration_management_client_enums.py index c95289ac648e..a64d4e4023bb 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_app_configuration_management_client_enums.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_app_configuration_management_client_enums.py @@ -11,43 +11,43 @@ class ActionsRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Any action that is required beyond basic workflow (approve/ reject/ disconnect) - """ + """Any action that is required beyond basic workflow (approve/ reject/ disconnect).""" NONE = "None" RECREATE = "Recreate" + class ConfigurationResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The resource type to check for name availability. - """ + """The resource type to check for name availability.""" MICROSOFT_APP_CONFIGURATION_CONFIGURATION_STORES = "Microsoft.AppConfiguration/configurationStores" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the configuration store need to be recovered. - """ + """Indicates whether the configuration store need to be recovered.""" RECOVER = "Recover" DEFAULT = "Default" + class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove @@ -59,9 +59,9 @@ class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the configuration store. - """ + """The provisioning state of the configuration store.""" CREATING = "Creating" UPDATING = "Updating" @@ -70,6 +70,7 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" CANCELED = "Canceled" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. @@ -78,9 +79,9 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENABLED = "Enabled" DISABLED = "Disabled" + class ReplicaProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the replica. - """ + """The provisioning state of the replica.""" CREATING = "Creating" SUCCEEDED = "Succeeded" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py index acd9b9b69a4e..baf2b907fdb3 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class ApiKey(msrest.serialization.Model): +class ApiKey(_serialization.Model): """An API key used for authenticating with a configuration store endpoint. Variables are only populated by the server, and will be ignored when sending a request. @@ -38,30 +38,26 @@ class ApiKey(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'value': {'readonly': True}, - 'connection_string': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'read_only': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "value": {"readonly": True}, + "connection_string": {"readonly": True}, + "last_modified": {"readonly": True}, + "read_only": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, - 'read_only': {'key': 'readOnly', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "connection_string": {"key": "connectionString", "type": "str"}, + "last_modified": {"key": "lastModified", "type": "iso-8601"}, + "read_only": {"key": "readOnly", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ApiKey, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.value = None @@ -70,7 +66,7 @@ def __init__( self.read_only = None -class ApiKeyListResult(msrest.serialization.Model): +class ApiKeyListResult(_serialization.Model): """The result of a request to list API keys. :ivar value: The collection value. @@ -80,72 +76,62 @@ class ApiKeyListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ApiKey]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ApiKey]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.ApiKey"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.ApiKey"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(ApiKeyListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class CheckNameAvailabilityParameters(msrest.serialization.Model): +class CheckNameAvailabilityParameters(_serialization.Model): """Parameters used for checking whether a resource name is available. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name to check for availability. + :ivar name: The name to check for availability. Required. :vartype name: str - :ivar type: Required. The resource type to check for name availability. Known values are: - "Microsoft.AppConfiguration/configurationStores". + :ivar type: The resource type to check for name availability. Required. + "Microsoft.AppConfiguration/configurationStores" :vartype type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationResourceType """ _validation = { - 'name': {'required': True}, - 'type': {'required': True}, + "name": {"required": True}, + "type": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - name: str, - type: Union[str, "_models.ConfigurationResourceType"], - **kwargs - ): + def __init__(self, *, name: str, type: Union[str, "_models.ConfigurationResourceType"], **kwargs: Any) -> None: """ - :keyword name: Required. The name to check for availability. + :keyword name: The name to check for availability. Required. :paramtype name: str - :keyword type: Required. The resource type to check for name availability. Known values are: - "Microsoft.AppConfiguration/configurationStores". + :keyword type: The resource type to check for name availability. Required. + "Microsoft.AppConfiguration/configurationStores" :paramtype type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationResourceType """ - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. @@ -161,31 +147,28 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -199,47 +182,42 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ConfigurationStore(TrackedResource): - """The configuration store along with all resource properties. The Configuration Store will have all information to begin utilizing it. +class ConfigurationStore(TrackedResource): # pylint: disable=too-many-instance-attributes + """The configuration store along with all resource properties. The Configuration Store will have + all information to begin utilizing it. Variables are only populated by the server, and will be ignored when sending a request. @@ -253,18 +231,18 @@ class ConfigurationStore(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar identity: The managed identity information, if configured. :vartype identity: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ResourceIdentity - :ivar sku: Required. The sku of the configuration store. + :ivar sku: The sku of the configuration store. Required. :vartype sku: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Sku :ivar system_data: Resource system metadata. :vartype system_data: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.SystemData :ivar provisioning_state: The provisioning state of the configuration store. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ProvisioningState :ivar creation_date: The creation date of configuration store. @@ -279,7 +257,7 @@ class ConfigurationStore(TrackedResource): :vartype private_endpoint_connections: list[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnectionReference] :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PublicNetworkAccess :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. @@ -291,42 +269,45 @@ class ConfigurationStore(TrackedResource): for this configuration store. :vartype enable_purge_protection: bool :ivar create_mode: Indicates whether the configuration store need to be recovered. Known values - are: "Recover", "Default". + are: "Recover" and "Default". :vartype create_mode: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CreateMode """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "sku": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "creation_date": {"readonly": True}, + "endpoint": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnectionReference]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'}, - 'enable_purge_protection': {'key': 'properties.enablePurgeProtection', 'type': 'bool'}, - 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, + "endpoint": {"key": "properties.endpoint", "type": "str"}, + "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnectionReference]", + }, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "soft_delete_retention_in_days": {"key": "properties.softDeleteRetentionInDays", "type": "int"}, + "enable_purge_protection": {"key": "properties.enablePurgeProtection", "type": "bool"}, + "create_mode": {"key": "properties.createMode", "type": "str"}, } def __init__( @@ -338,26 +319,26 @@ def __init__( identity: Optional["_models.ResourceIdentity"] = None, encryption: Optional["_models.EncryptionProperties"] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - disable_local_auth: Optional[bool] = False, - soft_delete_retention_in_days: Optional[int] = 7, - enable_purge_protection: Optional[bool] = False, + disable_local_auth: bool = False, + soft_delete_retention_in_days: int = 7, + enable_purge_protection: bool = False, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword identity: The managed identity information, if configured. :paramtype identity: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ResourceIdentity - :keyword sku: Required. The sku of the configuration store. + :keyword sku: The sku of the configuration store. Required. :paramtype sku: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Sku :keyword encryption: The encryption settings of the configuration store. :paramtype encryption: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.EncryptionProperties :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PublicNetworkAccess :keyword disable_local_auth: Disables all authentication methods other than AAD authentication. @@ -369,11 +350,11 @@ def __init__( enabled for this configuration store. :paramtype enable_purge_protection: bool :keyword create_mode: Indicates whether the configuration store need to be recovered. Known - values are: "Recover", "Default". + values are: "Recover" and "Default". :paramtype create_mode: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CreateMode """ - super(ConfigurationStore, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.identity = identity self.sku = sku self.system_data = None @@ -389,7 +370,7 @@ def __init__( self.create_mode = create_mode -class ConfigurationStoreListResult(msrest.serialization.Model): +class ConfigurationStoreListResult(_serialization.Model): """The result of a request to list configuration stores. :ivar value: The collection value. @@ -400,8 +381,8 @@ class ConfigurationStoreListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ConfigurationStore]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ConfigurationStore]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -409,8 +390,8 @@ def __init__( *, value: Optional[List["_models.ConfigurationStore"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: @@ -418,19 +399,19 @@ def __init__( :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(ConfigurationStoreListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ConfigurationStoreUpdateParameters(msrest.serialization.Model): +class ConfigurationStoreUpdateParameters(_serialization.Model): """The parameters for updating a configuration store. :ivar identity: The managed identity information for the configuration store. :vartype identity: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ResourceIdentity :ivar sku: The SKU of the configuration store. :vartype sku: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Sku - :ivar tags: A set of tags. The ARM resource tags. + :ivar tags: The ARM resource tags. :vartype tags: dict[str, str] :ivar encryption: The encryption settings of the configuration store. :vartype encryption: @@ -438,18 +419,18 @@ class ConfigurationStoreUpdateParameters(msrest.serialization.Model): :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. :vartype disable_local_auth: bool :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PublicNetworkAccess """ _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "tags": {"key": "tags", "type": "{str}"}, + "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, } def __init__( @@ -461,14 +442,14 @@ def __init__( encryption: Optional["_models.EncryptionProperties"] = None, disable_local_auth: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: The managed identity information for the configuration store. :paramtype identity: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ResourceIdentity :keyword sku: The SKU of the configuration store. :paramtype sku: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Sku - :keyword tags: A set of tags. The ARM resource tags. + :keyword tags: The ARM resource tags. :paramtype tags: dict[str, str] :keyword encryption: The encryption settings of the configuration store. :paramtype encryption: @@ -476,11 +457,11 @@ def __init__( :keyword disable_local_auth: Disables all authentication methods other than AAD authentication. :paramtype disable_local_auth: bool :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PublicNetworkAccess """ - super(ConfigurationStoreUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.sku = sku self.tags = tags @@ -489,7 +470,7 @@ def __init__( self.public_network_access = public_network_access -class DeletedConfigurationStore(msrest.serialization.Model): +class DeletedConfigurationStore(_serialization.Model): """Deleted configuration store information with extended details. Variables are only populated by the server, and will be ignored when sending a request. @@ -508,43 +489,39 @@ class DeletedConfigurationStore(msrest.serialization.Model): :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. :vartype scheduled_purge_date: ~datetime.datetime - :ivar tags: A set of tags. Tags of the original configuration store. + :ivar tags: Tags of the original configuration store. :vartype tags: dict[str, str] :ivar purge_protection_enabled: Purge protection status of the original configuration store. :vartype purge_protection_enabled: bool """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'configuration_store_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'tags': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "configuration_store_id": {"readonly": True}, + "location": {"readonly": True}, + "deletion_date": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "tags": {"readonly": True}, + "purge_protection_enabled": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'configuration_store_id': {'key': 'properties.configurationStoreId', 'type': 'str'}, - 'location': {'key': 'properties.location', 'type': 'str'}, - 'deletion_date': {'key': 'properties.deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'properties.scheduledPurgeDate', 'type': 'iso-8601'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'purge_protection_enabled': {'key': 'properties.purgeProtectionEnabled', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "configuration_store_id": {"key": "properties.configurationStoreId", "type": "str"}, + "location": {"key": "properties.location", "type": "str"}, + "deletion_date": {"key": "properties.deletionDate", "type": "iso-8601"}, + "scheduled_purge_date": {"key": "properties.scheduledPurgeDate", "type": "iso-8601"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "purge_protection_enabled": {"key": "properties.purgeProtectionEnabled", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedConfigurationStore, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -556,7 +533,7 @@ def __init__( self.purge_protection_enabled = None -class DeletedConfigurationStoreListResult(msrest.serialization.Model): +class DeletedConfigurationStoreListResult(_serialization.Model): """List of deleted configuration stores. :ivar value: The list of deleted configuration store. @@ -567,8 +544,8 @@ class DeletedConfigurationStoreListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedConfigurationStore]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedConfigurationStore]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -576,8 +553,8 @@ def __init__( *, value: Optional[List["_models.DeletedConfigurationStore"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The list of deleted configuration store. :paramtype value: @@ -585,12 +562,12 @@ def __init__( :keyword next_link: The URL to get the next set of deleted configuration stores. :paramtype next_link: str """ - super(DeletedConfigurationStoreListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class EncryptionProperties(msrest.serialization.Model): +class EncryptionProperties(_serialization.Model): """The encryption settings for a configuration store. :ivar key_vault_properties: Key vault properties. @@ -599,25 +576,20 @@ class EncryptionProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, } - def __init__( - self, - *, - key_vault_properties: Optional["_models.KeyVaultProperties"] = None, - **kwargs - ): + def __init__(self, *, key_vault_properties: Optional["_models.KeyVaultProperties"] = None, **kwargs: Any) -> None: """ :keyword key_vault_properties: Key vault properties. :paramtype key_vault_properties: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyVaultProperties """ - super(EncryptionProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_vault_properties = key_vault_properties -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -625,31 +597,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorDetails(msrest.serialization.Model): +class ErrorDetails(_serialization.Model): """The details of the error. Variables are only populated by the server, and will be ignored when sending a request. @@ -664,55 +632,47 @@ class ErrorDetails(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.additional_info = None -class ErrorResponse(msrest.serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. +class ErrorResponse(_serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. :ivar error: The details of the error. :vartype error: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ErrorDetails """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetails'}, + "error": {"key": "error", "type": "ErrorDetails"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorDetails"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ErrorDetails """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class KeyValue(msrest.serialization.Model): +class KeyValue(_serialization.Model): # pylint: disable=too-many-instance-attributes """The key-value resource along with all resource properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -742,34 +702,33 @@ class KeyValue(msrest.serialization.Model): :ivar locked: A value indicating whether the key-value is locked. A locked key-value may not be modified until it is unlocked. :vartype locked: bool - :ivar tags: A set of tags. A dictionary of tags that can help identify what a key-value may be - applicable for. + :ivar tags: A dictionary of tags that can help identify what a key-value may be applicable for. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'key': {'readonly': True}, - 'label': {'readonly': True}, - 'e_tag': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'locked': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "key": {"readonly": True}, + "label": {"readonly": True}, + "e_tag": {"readonly": True}, + "last_modified": {"readonly": True}, + "locked": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'key': {'key': 'properties.key', 'type': 'str'}, - 'label': {'key': 'properties.label', 'type': 'str'}, - 'value': {'key': 'properties.value', 'type': 'str'}, - 'content_type': {'key': 'properties.contentType', 'type': 'str'}, - 'e_tag': {'key': 'properties.eTag', 'type': 'str'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'locked': {'key': 'properties.locked', 'type': 'bool'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "key": {"key": "properties.key", "type": "str"}, + "label": {"key": "properties.label", "type": "str"}, + "value": {"key": "properties.value", "type": "str"}, + "content_type": {"key": "properties.contentType", "type": "str"}, + "e_tag": {"key": "properties.eTag", "type": "str"}, + "last_modified": {"key": "properties.lastModified", "type": "iso-8601"}, + "locked": {"key": "properties.locked", "type": "bool"}, + "tags": {"key": "properties.tags", "type": "{str}"}, } def __init__( @@ -778,8 +737,8 @@ def __init__( value: Optional[str] = None, content_type: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The value of the key-value. :paramtype value: str @@ -787,11 +746,11 @@ def __init__( Providing a proper content-type can enable transformations of values when they are retrieved by applications. :paramtype content_type: str - :keyword tags: A set of tags. A dictionary of tags that can help identify what a key-value may - be applicable for. + :keyword tags: A dictionary of tags that can help identify what a key-value may be applicable + for. :paramtype tags: dict[str, str] """ - super(KeyValue, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -805,7 +764,7 @@ def __init__( self.tags = tags -class KeyValueListResult(msrest.serialization.Model): +class KeyValueListResult(_serialization.Model): """The result of a request to list key-values. :ivar value: The collection value. @@ -815,29 +774,25 @@ class KeyValueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyValue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyValue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.KeyValue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.KeyValue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(KeyValueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class KeyVaultProperties(msrest.serialization.Model): +class KeyVaultProperties(_serialization.Model): """Settings concerning key vault encryption for a configuration store. :ivar key_identifier: The URI of the key vault key used to encrypt data. @@ -847,17 +802,13 @@ class KeyVaultProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + "identity_client_id": {"key": "identityClientId", "type": "str"}, } def __init__( - self, - *, - key_identifier: Optional[str] = None, - identity_client_id: Optional[str] = None, - **kwargs - ): + self, *, key_identifier: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword key_identifier: The URI of the key vault key used to encrypt data. :paramtype key_identifier: str @@ -865,12 +816,12 @@ def __init__( vault. :paramtype identity_client_id: str """ - super(KeyVaultProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_identifier = key_identifier self.identity_client_id = identity_client_id -class LogSpecification(msrest.serialization.Model): +class LogSpecification(_serialization.Model): """Specifications of the Log for Azure Monitoring. :ivar name: Name of the log. @@ -882,9 +833,9 @@ class LogSpecification(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "blob_duration": {"key": "blobDuration", "type": "str"}, } def __init__( @@ -893,8 +844,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, blob_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the log. :paramtype name: str @@ -903,13 +854,13 @@ def __init__( :keyword blob_duration: Blob duration of the log. :paramtype blob_duration: str """ - super(LogSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class MetricDimension(msrest.serialization.Model): +class MetricDimension(_serialization.Model): """Specifications of the Dimension of metrics. :ivar name: Name of the dimension. @@ -921,9 +872,9 @@ class MetricDimension(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "internal_name": {"key": "internalName", "type": "str"}, } def __init__( @@ -932,8 +883,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, internal_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the dimension. :paramtype name: str @@ -942,13 +893,13 @@ def __init__( :keyword internal_name: Internal name of the dimension. :paramtype internal_name: str """ - super(MetricDimension, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.internal_name = internal_name -class MetricSpecification(msrest.serialization.Model): +class MetricSpecification(_serialization.Model): """Specifications of the Metrics for Azure Monitoring. :ivar name: Name of the metric. @@ -973,14 +924,14 @@ class MetricSpecification(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "display_description": {"key": "displayDescription", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "aggregation_type": {"key": "aggregationType", "type": "str"}, + "internal_metric_name": {"key": "internalMetricName", "type": "str"}, + "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, + "fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"}, } def __init__( @@ -994,8 +945,8 @@ def __init__( internal_metric_name: Optional[str] = None, dimensions: Optional[List["_models.MetricDimension"]] = None, fill_gap_with_zero: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the metric. :paramtype name: str @@ -1017,7 +968,7 @@ def __init__( duration where no metric is emitted/published. :paramtype fill_gap_with_zero: bool """ - super(MetricSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.display_description = display_description @@ -1028,7 +979,7 @@ def __init__( self.fill_gap_with_zero = fill_gap_with_zero -class NameAvailabilityStatus(msrest.serialization.Model): +class NameAvailabilityStatus(_serialization.Model): """The result of a request to check the availability of a resource name. Variables are only populated by the server, and will be ignored when sending a request. @@ -1043,30 +994,26 @@ class NameAvailabilityStatus(msrest.serialization.Model): """ _validation = { - 'name_available': {'readonly': True}, - 'message': {'readonly': True}, - 'reason': {'readonly': True}, + "name_available": {"readonly": True}, + "message": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "message": {"key": "message", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(NameAvailabilityStatus, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.name_available = None self.message = None self.reason = None -class OperationDefinition(msrest.serialization.Model): +class OperationDefinition(_serialization.Model): """The definition of a configuration store operation. :ivar name: Operation name: {provider}/{resource}/{operation}. @@ -1084,11 +1031,11 @@ class OperationDefinition(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDefinitionDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDefinitionDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "OperationProperties"}, } def __init__( @@ -1099,8 +1046,8 @@ def __init__( display: Optional["_models.OperationDefinitionDisplay"] = None, origin: Optional[str] = None, properties: Optional["_models.OperationProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1115,7 +1062,7 @@ def __init__( :paramtype properties: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.OperationProperties """ - super(OperationDefinition, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display @@ -1123,7 +1070,7 @@ def __init__( self.properties = properties -class OperationDefinitionDisplay(msrest.serialization.Model): +class OperationDefinitionDisplay(_serialization.Model): """The display information for a configuration store operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1139,14 +1086,14 @@ class OperationDefinitionDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, + "provider": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1155,8 +1102,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource: The resource on which the operation is performed. :paramtype resource: str @@ -1165,14 +1112,14 @@ def __init__( :keyword description: The description for the operation. :paramtype description: str """ - super(OperationDefinitionDisplay, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = None self.resource = resource self.operation = operation self.description = description -class OperationDefinitionListResult(msrest.serialization.Model): +class OperationDefinitionListResult(_serialization.Model): """The result of a request to list configuration store operations. :ivar value: The collection value. @@ -1183,8 +1130,8 @@ class OperationDefinitionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OperationDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1192,8 +1139,8 @@ def __init__( *, value: Optional[List["_models.OperationDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: @@ -1201,12 +1148,12 @@ def __init__( :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(OperationDefinitionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class OperationProperties(msrest.serialization.Model): +class OperationProperties(_serialization.Model): """Extra Operation properties. :ivar service_specification: Service specifications of the operation. @@ -1215,25 +1162,22 @@ class OperationProperties(msrest.serialization.Model): """ _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, } def __init__( - self, - *, - service_specification: Optional["_models.ServiceSpecification"] = None, - **kwargs - ): + self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any + ) -> None: """ :keyword service_specification: Service specifications of the operation. :paramtype service_specification: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ServiceSpecification """ - super(OperationProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.service_specification = service_specification -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -1241,24 +1185,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -1270,7 +1209,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The type of the resource. :vartype type: str :ivar provisioning_state: The provisioning status of the private endpoint connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -1283,19 +1222,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -1303,8 +1245,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The resource of private endpoint. :paramtype private_endpoint: @@ -1314,7 +1256,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1323,7 +1265,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -1334,8 +1276,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1343,8 +1285,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: @@ -1352,12 +1294,12 @@ def __init__( :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateEndpointConnectionReference(msrest.serialization.Model): +class PrivateEndpointConnectionReference(_serialization.Model): """A reference to a related private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -1369,7 +1311,7 @@ class PrivateEndpointConnectionReference(msrest.serialization.Model): :ivar type: The type of the resource. :vartype type: str :ivar provisioning_state: The provisioning status of the private endpoint connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -1382,19 +1324,22 @@ class PrivateEndpointConnectionReference(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -1402,8 +1347,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The resource of private endpoint. :paramtype private_endpoint: @@ -1413,7 +1358,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnectionReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1422,7 +1367,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A resource that supports private link capabilities. Variables are only populated by the server, and will be ignored when sending a request. @@ -1442,30 +1387,26 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, + "required_zone_names": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PrivateLinkResource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1474,7 +1415,7 @@ def __init__( self.required_zone_names = None -class PrivateLinkResourceListResult(msrest.serialization.Model): +class PrivateLinkResourceListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -1485,8 +1426,8 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1494,8 +1435,8 @@ def __init__( *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: @@ -1503,36 +1444,36 @@ def __init__( :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(PrivateLinkResourceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. Variables are only populated by the server, and will be ignored when sending a request. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). Known values are: "None", "Recreate". + disconnect). Known values are: "None" and "Recreate". :vartype actions_required: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ActionsRequired """ _validation = { - 'actions_required': {'readonly': True}, + "actions_required": {"readonly": True}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, } def __init__( @@ -1540,23 +1481,23 @@ def __init__( *, status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description self.actions_required = None -class RegenerateKeyParameters(msrest.serialization.Model): +class RegenerateKeyParameters(_serialization.Model): """The parameters used to regenerate an API key. :ivar id: The id of the key to regenerate. @@ -1564,24 +1505,19 @@ class RegenerateKeyParameters(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The id of the key to regenerate. :paramtype id: str """ - super(RegenerateKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class Replica(msrest.serialization.Model): +class Replica(_serialization.Model): """The replica resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1599,41 +1535,36 @@ class Replica(msrest.serialization.Model): :ivar endpoint: The URI of the replica where the replica API will be available. :vartype endpoint: str :ivar provisioning_state: The provisioning state of the replica. Known values are: "Creating", - "Succeeded", "Deleting", "Failed", "Canceled". + "Succeeded", "Deleting", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ReplicaProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "endpoint": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "endpoint": {"key": "properties.endpoint", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__( - self, - *, - location: Optional[str] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: The location of the replica. :paramtype location: str """ - super(Replica, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1643,7 +1574,7 @@ def __init__( self.provisioning_state = None -class ReplicaListResult(msrest.serialization.Model): +class ReplicaListResult(_serialization.Model): """The result of a request to list replicas. :ivar value: The collection value. @@ -1653,36 +1584,32 @@ class ReplicaListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Replica]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Replica]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.Replica"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Replica"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(ReplicaListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ResourceIdentity(msrest.serialization.Model): +class ResourceIdentity(_serialization.Model): """An identity that can be associated with a resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will - remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", + remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". :vartype type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.IdentityType :ivar user_assigned_identities: The list of user-assigned identities associated with the @@ -1699,15 +1626,15 @@ class ResourceIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentity}'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserIdentity}"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } def __init__( @@ -1715,13 +1642,13 @@ def __init__( *, type: Optional[Union[str, "_models.IdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned". + and "SystemAssigned, UserAssigned". :paramtype type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.IdentityType :keyword user_assigned_identities: The list of user-assigned identities associated with the resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: @@ -1729,14 +1656,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.UserIdentity] """ - super(ResourceIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.user_assigned_identities = user_assigned_identities self.principal_id = None self.tenant_id = None -class ServiceSpecification(msrest.serialization.Model): +class ServiceSpecification(_serialization.Model): """Service specification payload. :ivar log_specifications: Specifications of the Log for Azure Monitoring. @@ -1748,8 +1675,8 @@ class ServiceSpecification(msrest.serialization.Model): """ _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, + "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, } def __init__( @@ -1757,8 +1684,8 @@ def __init__( *, log_specifications: Optional[List["_models.LogSpecification"]] = None, metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword log_specifications: Specifications of the Log for Azure Monitoring. :paramtype log_specifications: @@ -1767,49 +1694,44 @@ def __init__( :paramtype metric_specifications: list[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.MetricSpecification] """ - super(ServiceSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications -class Sku(msrest.serialization.Model): +class Sku(_serialization.Model): """Describes a configuration store SKU. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The SKU name of the configuration store. + :ivar name: The SKU name of the configuration store. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The SKU name of the configuration store. + :keyword name: The SKU name of the configuration store. Required. :paramtype name: str """ - super(Sku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -1817,7 +1739,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -1825,12 +1747,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -1842,13 +1764,13 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -1856,13 +1778,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -1871,7 +1793,7 @@ def __init__( self.last_modified_at = last_modified_at -class UserIdentity(msrest.serialization.Model): +class UserIdentity(_serialization.Model): """A resource identity that is managed by the user of the service. Variables are only populated by the server, and will be ignored when sending a request. @@ -1883,21 +1805,17 @@ class UserIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(UserIdentity, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/__init__.py index 32756eab8ac7..ba0c4f83f634 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/__init__.py @@ -14,15 +14,16 @@ from ._replicas_operations import ReplicasOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ConfigurationStoresOperations', - 'Operations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'KeyValuesOperations', - 'ReplicasOperations', + "ConfigurationStoresOperations", + "Operations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "KeyValuesOperations", + "ReplicasOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py index c36ff74f1860..3a5d8b0e4a6c 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,257 +29,234 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any + resource_group_name: str, subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - *, - json: Optional[_models.ConfigurationStore] = None, - content: Any = None, - **kwargs: Any + +def build_create_request( + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - *, - json: Optional[_models.ConfigurationStoreUpdateParameters] = None, - content: Any = None, - **kwargs: Any + +def build_update_request( + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - subscription_id: str, resource_group_name: str, config_store_name: str, + subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any @@ -280,186 +264,173 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_key_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - *, - json: Optional[_models.RegenerateKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_deleted_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_request( - subscription_id: str, - location: str, - config_store_name: str, - **kwargs: Any + location: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_purge_deleted_request_initial( - subscription_id: str, - location: str, - config_store_name: str, - **kwargs: Any + +def build_purge_deleted_request( + location: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ConfigurationStoresOperations: """ @@ -480,13 +451,8 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.ConfigurationStoreListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given subscription. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -495,48 +461,56 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -544,16 +518,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -564,23 +536,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.ConfigurationStoreListResult]: + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given resource group. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -588,50 +555,57 @@ def list_by_resource_group( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_resource_group.metadata['url'], + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -639,16 +613,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -659,60 +631,58 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores" + } @distributed_trace - def get( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> _models.ConfigurationStore: + def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: """Gets the properties of the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationStore, or the result of cls(response) + :return: ConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -720,94 +690,114 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } def _create_initial( self, resource_group_name: str, config_store_name: str, - config_store_creation_parameters: _models.ConfigurationStore, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - - _json = self._serialize.body(config_store_creation_parameters, 'ConfigurationStore') - - request = build_create_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_creation_parameters, (IO, bytes)): + _content = config_store_creation_parameters + else: + _json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore") + + request = build_create_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace + @overload def begin_create( self, resource_group_name: str, config_store_name: str, config_store_creation_parameters: _models.ConfigurationStore, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ConfigurationStore]: """Creates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -820,121 +810,190 @@ def begin_create( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. Is + either a ConfigurationStore type or a IO type. Required. + :type config_store_creation_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_creation_parameters=config_store_creation_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -946,134 +1005,150 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } def _update_initial( self, resource_group_name: str, config_store_name: str, - config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - - _json = self._serialize.body(config_store_update_parameters, 'ConfigurationStoreUpdateParameters') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_update_parameters, (IO, bytes)): + _content = config_store_update_parameters + else: + _json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters") + + request = build_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace + @overload def begin_update( self, resource_group_name: str, config_store_name: str, config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ConfigurationStore]: """Updates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_update_parameters: The parameters for updating a configuration store. + Required. :type config_store_update_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1086,75 +1161,144 @@ def begin_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. Is + either a ConfigurationStoreUpdateParameters type or a IO type. Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreUpdateParameters or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_update_parameters=config_store_update_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.ApiKeyListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ApiKey"]: """Lists the access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -1162,51 +1306,58 @@ def list_keys( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiKeyListResult or the result of cls(response) + :return: An iterator like instance of either ApiKey or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKeyListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_keys_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_keys.metadata['url'], + api_version=api_version, + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1214,16 +1365,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiKeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1234,68 +1383,140 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys" + } - @distributed_trace + @overload def regenerate_key( self, resource_group_name: str, config_store_name: str, regenerate_key_parameters: _models.RegenerateKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ApiKey: """Regenerates an access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKey, or the result of cls(response) + :return: ApiKey or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO], + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Is either a + RegenerateKeyParameters type or a IO type. Required. + :type regenerate_key_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKey] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) - _json = self._serialize.body(regenerate_key_parameters, 'RegenerateKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_key_parameters, (IO, bytes)): + _content = regenerate_key_parameters + else: + _json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters") request = build_regenerate_key_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_key.metadata['url'], + content=_content, + template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1303,64 +1524,72 @@ def regenerate_key( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ApiKey', pipeline_response) + deserialized = self._deserialize("ApiKey", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"} # type: ignore - + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey" + } @distributed_trace - def list_deleted( - self, - **kwargs: Any - ) -> Iterable[_models.DeletedConfigurationStoreListResult]: + def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationStore"]: """Gets information about the deleted configuration stores in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedConfigurationStoreListResult or the result - of cls(response) + :return: An iterator like instance of either DeletedConfigurationStore or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStoreListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_deleted_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_deleted.metadata['url'], + template_url=self.list_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1368,16 +1597,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1388,59 +1615,57 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"} # type: ignore + list_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores" + } @distributed_trace - def get_deleted( - self, - location: str, - config_store_name: str, - **kwargs: Any - ) -> _models.DeletedConfigurationStore: + def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _models.DeletedConfigurationStore: """Gets a deleted Azure app configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedConfigurationStore, or the result of cls(response) + :return: DeletedConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStore] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) - request = build_get_deleted_request( - subscription_id=self._config.subscription_id, location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_deleted.metadata['url'], + template_url=self.get_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1448,75 +1673,73 @@ def get_deleted( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedConfigurationStore', pipeline_response) + deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"} # type: ignore - + get_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}" + } def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any + self, location: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_purge_deleted_request_initial( - subscription_id=self._config.subscription_id, + request = build_purge_deleted_request( location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._purge_deleted_initial.metadata['url'], + template_url=self._purge_deleted_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore - + _purge_deleted_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } @distributed_trace - def begin_purge_deleted( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: """Permanently deletes the specified configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1528,52 +1751,49 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._purge_deleted_initial( # type: ignore location=location, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore + begin_purge_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py index 22852bd3d313..ffac3ebded6e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,17 +29,24 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_configuration_store_request( - subscription_id: str, resource_group_name: str, config_store_name: str, + subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any @@ -40,159 +54,147 @@ def build_list_by_configuration_store_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - *, - json: Optional[_models.KeyValue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + class KeyValuesOperations: """ @@ -213,21 +215,16 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.KeyValueListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.KeyValue"]: """Lists the key-values for a given configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -235,51 +232,58 @@ def list_by_configuration_store( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either KeyValueListResult or the result of cls(response) + :return: An iterator like instance of either KeyValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValueListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_configuration_store.metadata['url'], + api_version=api_version, + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,16 +291,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("KeyValueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -307,65 +309,64 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues" + } @distributed_trace def get( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> _models.KeyValue: """Gets the properties of the specified key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,79 +374,160 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, config_store_name: str, key_value_name: str, key_value_parameters: Optional[_models.KeyValue] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.KeyValue: """Creates a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :param key_value_parameters: The parameters for creating a key-value. Default value is None. :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Default value is None. + :type key_value_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None, + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type + or a IO type. Default value is None. + :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] - - if key_value_parameters is not None: - _json = self._serialize.body(key_value_parameters, 'KeyValue') + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(key_value_parameters, (IO, bytes)): + _content = key_value_parameters else: - _json = None + if key_value_parameters is not None: + _json = self._serialize.body(key_value_parameters, "KeyValue") + else: + _json = None request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -453,82 +535,80 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -540,53 +620,50 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py index 0156697102fb..49f82bb50950 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,126 +27,106 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailabilityParameters] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.AppConfiguration/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_regional_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: Optional[_models.CheckNameAvailabilityParameters] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_regional_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class Operations: """ @@ -160,55 +147,107 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace + @overload def check_name_availability( self, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -216,22 +255,19 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" + } @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.OperationDefinitionListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.OperationDefinition"]: """Lists the operations available from this provider. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -240,46 +276,55 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationDefinitionListResult or the result of - cls(response) + :return: An iterator like instance of either OperationDefinition or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.OperationDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.OperationDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationDefinitionListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,16 +332,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -307,64 +350,127 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppConfiguration/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"} - @distributed_trace + @overload def regional_check_name_availability( self, location: str, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_regional_check_name_availability_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regional_check_name_availability.metadata['url'], + content=_content, + template_url=self.regional_check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -372,12 +478,13 @@ def regional_check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regional_check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"} # type: ignore - + regional_check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py index 08df44f4aa28..7240d030c308 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,173 +29,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_configuration_store_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, + +def build_create_or_update_request( resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, + +def build_delete_request( resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateEndpointConnectionsOperations: """ @@ -209,66 +226,70 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: """Lists all private endpoint connections for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -276,16 +297,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -296,64 +315,63 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections" + } @distributed_trace def get( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -361,100 +379,119 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _create_or_update_initial( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] - - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection, (IO, bytes)): + _content = private_endpoint_connection + else: + _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") + + request = build_create_or_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Update the state of the specified private endpoint connection associated with the configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. + :param private_endpoint_connection: The private endpoint connection properties. Required. :type private_endpoint_connection: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -467,127 +504,203 @@ def begin_create_or_update( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO type. Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -599,53 +712,50 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py index d36f531e3ce9..1997aecc164f 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,87 +27,90 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_configuration_store_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - group_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "groupName": _SERIALIZER.url("group_name", group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateLinkResourcesOperations: """ @@ -121,66 +131,69 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateLinkResourceListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: """Gets the private link resources that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of - cls(response) + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResourceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -188,16 +201,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -208,64 +219,63 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources" + } @distributed_trace def get( - self, - resource_group_name: str, - config_store_name: str, - group_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any ) -> _models.PrivateLinkResource: """Gets a private link resource that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param group_name: The name of the private link resource group. + :param group_name: The name of the private link resource group. Required. :type group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, group_name=group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,12 +283,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py index 8e92fb71925e..d562f48195f8 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,17 +29,24 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_configuration_store_request( - subscription_id: str, resource_group_name: str, config_store_name: str, + subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any @@ -40,159 +54,147 @@ def build_list_by_configuration_store_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "replicaName": _SERIALIZER.url("replica_name", replica_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "replicaName": _SERIALIZER.url("replica_name", replica_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - replica_name: str, - *, - json: Optional[_models.Replica] = None, - content: Any = None, - **kwargs: Any + +def build_create_request( + resource_group_name: str, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "replicaName": _SERIALIZER.url("replica_name", replica_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "replicaName": _SERIALIZER.url("replica_name", replica_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "replicaName": _SERIALIZER.url("replica_name", replica_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "replicaName": _SERIALIZER.url("replica_name", replica_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + class ReplicasOperations: """ @@ -213,21 +215,16 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.ReplicaListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.Replica"]: """Lists the replicas for a given configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -235,51 +232,58 @@ def list_by_configuration_store( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicaListResult or the result of cls(response) + :return: An iterator like instance of either Replica or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ReplicaListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicaListResult] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.ReplicaListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_configuration_store.metadata['url'], + api_version=api_version, + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,16 +291,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReplicaListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -307,64 +309,63 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas" + } @distributed_trace def get( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any ) -> _models.Replica: """Gets the properties of the specified replica. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param replica_name: The name of the replica. + :param replica_name: The name of the replica. Required. :type replica_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Replica, or the result of cls(response) + :return: Replica or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -372,99 +373,118 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } def _create_initial( self, resource_group_name: str, config_store_name: str, replica_name: str, - replica_creation_parameters: _models.Replica, + replica_creation_parameters: Union[_models.Replica, IO], **kwargs: Any ) -> _models.Replica: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] - - _json = self._serialize.body(replica_creation_parameters, 'Replica') - - request = build_create_request_initial( - subscription_id=self._config.subscription_id, + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(replica_creation_parameters, (IO, bytes)): + _content = replica_creation_parameters + else: + _json = self._serialize.body(replica_creation_parameters, "Replica") + + request = build_create_request( resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore + return deserialized # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } - @distributed_trace + @overload def begin_create( self, resource_group_name: str, config_store_name: str, replica_name: str, replica_creation_parameters: _models.Replica, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Replica]: """Creates a replica with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param replica_name: The name of the replica. + :param replica_name: The name of the replica. Required. :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. + :param replica_creation_parameters: The parameters for creating a replica. Required. :type replica_creation_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -476,127 +496,199 @@ def begin_create( :return: An instance of LROPoller that returns either Replica or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replica or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Is either a Replica + type or a IO type. Required. + :type replica_creation_parameters: + ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replica or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, replica_creation_parameters=replica_creation_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Replica', pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a replica. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param replica_name: The name of the replica. + :param replica_name: The name of the replica. Required. :type replica_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -608,53 +700,52 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-03-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, replica_name=replica_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - lro_options={'final-state-via': 'location'}, - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/__init__.py index 5396ddec76cf..f2ea8d6fa6dd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['AppConfigurationManagementClient'] + +__all__ = [ + "AppConfigurationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_client.py index 1b6ae08db742..285f755231b0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_client.py @@ -9,20 +9,26 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import AppConfigurationManagementClientConfiguration -from .operations import ConfigurationStoresOperations, KeyValuesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations +from .operations import ( + ConfigurationStoresOperations, + KeyValuesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class AppConfigurationManagementClient: + +class AppConfigurationManagementClient: # pylint: disable=client-accepts-api-version-keyword """AppConfigurationManagementClient. :ivar configuration_stores: ConfigurationStoresOperations operations @@ -38,9 +44,9 @@ class AppConfigurationManagementClient: azure.mgmt.appconfiguration.v2022_05_01.operations.PrivateLinkResourcesOperations :ivar key_values: KeyValuesOperations operations :vartype key_values: azure.mgmt.appconfiguration.v2022_05_01.operations.KeyValuesOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -58,35 +64,28 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = AppConfigurationManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = AppConfigurationManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.configuration_stores = ConfigurationStoresOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.key_values = KeyValuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -95,7 +94,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -108,15 +107,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AppConfigurationManagementClient + def __enter__(self) -> "AppConfigurationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py index a475fa81de9d..4a7d1e075081 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,23 +31,18 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-05-01") # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +52,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appconfiguration/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json index 36ff413f4f84..f1e192bfd449 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The Microsoft Azure subscription ID.", + "signature": "subscription_id: str,", + "description": "The Microsoft Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The Microsoft Azure subscription ID.", + "description": "The Microsoft Azure subscription ID. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -103,4 +111,4 @@ "private_link_resources": "PrivateLinkResourcesOperations", "key_values": "KeyValuesOperations" } -} \ No newline at end of file +} diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_vendor.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_vendor.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py index f30401ec2040..5819b888fe6e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0" +VERSION = "3.0.0b1" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/__init__.py index de0897959ad2..185a5e3680ea 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['AppConfigurationManagementClient'] + +__all__ = [ + "AppConfigurationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_client.py index 29a28e11ac12..61e705265bc6 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_client.py @@ -9,20 +9,26 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import AppConfigurationManagementClientConfiguration -from .operations import ConfigurationStoresOperations, KeyValuesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations +from .operations import ( + ConfigurationStoresOperations, + KeyValuesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppConfigurationManagementClient: + +class AppConfigurationManagementClient: # pylint: disable=client-accepts-api-version-keyword """AppConfigurationManagementClient. :ivar configuration_stores: ConfigurationStoresOperations operations @@ -38,9 +44,9 @@ class AppConfigurationManagementClient: azure.mgmt.appconfiguration.v2022_05_01.aio.operations.PrivateLinkResourcesOperations :ivar key_values: KeyValuesOperations operations :vartype key_values: azure.mgmt.appconfiguration.v2022_05_01.aio.operations.KeyValuesOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -58,35 +64,28 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = AppConfigurationManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = AppConfigurationManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.configuration_stores = ConfigurationStoresOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.key_values = KeyValuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -95,7 +94,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -115,5 +114,5 @@ async def __aenter__(self) -> "AppConfigurationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py index b9958e5baf01..9fc6fefdeee5 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,23 +31,18 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-05-01") # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +52,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appconfiguration/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/__init__.py index 36f96183612a..919efccff5aa 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/__init__.py @@ -13,14 +13,15 @@ from ._key_values_operations import KeyValuesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ConfigurationStoresOperations', - 'Operations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'KeyValuesOperations', + "ConfigurationStoresOperations", + "Operations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "KeyValuesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py index e20192f8ee7b..448b30ea080c 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,28 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._configuration_stores_operations import build_create_request_initial, build_delete_request_initial, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_deleted_request, build_list_keys_request, build_list_request, build_purge_deleted_request_initial, build_regenerate_key_request, build_update_request_initial -T = TypeVar('T') +from ...operations._configuration_stores_operations import ( + build_create_request, + build_delete_request, + build_get_deleted_request, + build_get_request, + build_list_by_resource_group_request, + build_list_deleted_request, + build_list_keys_request, + build_list_request, + build_purge_deleted_request, + build_regenerate_key_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ConfigurationStoresOperations: """ .. warning:: @@ -45,13 +72,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.ConfigurationStoreListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given subscription. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -60,48 +82,54 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -109,16 +137,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -129,23 +155,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.ConfigurationStoreListResult]: + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given resource group. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -153,50 +174,55 @@ def list_by_resource_group( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_resource_group.metadata['url'], + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -204,16 +230,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -224,60 +248,56 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> _models.ConfigurationStore: + async def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: """Gets the properties of the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationStore, or the result of cls(response) + :return: ConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -285,94 +305,187 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } async def _create_initial( self, resource_group_name: str, config_store_name: str, - config_store_creation_parameters: _models.ConfigurationStore, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - _json = self._serialize.body(config_store_creation_parameters, 'ConfigurationStore') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_creation_parameters, (IO, bytes)): + _content = config_store_creation_parameters + else: + _json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore") - request = build_create_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace_async + @overload async def begin_create( self, resource_group_name: str, config_store_name: str, config_store_creation_parameters: _models.ConfigurationStore, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ConfigurationStore]: """Creates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. Is + either a ConfigurationStore type or a IO type. Required. + :type config_store_creation_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -385,121 +498,113 @@ async def begin_create( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_creation_parameters=config_store_creation_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, config_store_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -511,134 +616,184 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } async def _update_initial( self, resource_group_name: str, config_store_name: str, - config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - _json = self._serialize.body(config_store_update_parameters, 'ConfigurationStoreUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_update_parameters, (IO, bytes)): + _content = config_store_update_parameters + else: + _json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters") - request = build_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace_async + @overload async def begin_update( self, resource_group_name: str, config_store_name: str, config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ConfigurationStore]: """Updates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_update_parameters: The parameters for updating a configuration store. + Required. :type config_store_update_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -651,75 +806,103 @@ async def begin_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. Is + either a ConfigurationStoreUpdateParameters type or a IO type. Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_update_parameters=config_store_update_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.ApiKeyListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ApiKey"]: """Lists the access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -727,51 +910,56 @@ def list_keys( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiKeyListResult or the result of cls(response) + :return: An iterator like instance of either ApiKey or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKeyListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_keys_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_keys.metadata['url'], + api_version=api_version, + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -779,16 +967,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApiKeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -799,68 +985,138 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_key( self, resource_group_name: str, config_store_name: str, regenerate_key_parameters: _models.RegenerateKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ApiKey: """Regenerates an access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKey, or the result of cls(response) + :return: ApiKey or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO], + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Is either a + RegenerateKeyParameters type or a IO type. Required. + :type regenerate_key_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKey] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) - _json = self._serialize.body(regenerate_key_parameters, 'RegenerateKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_key_parameters, (IO, bytes)): + _content = regenerate_key_parameters + else: + _json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters") request = build_regenerate_key_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_key.metadata['url'], + content=_content, + template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -868,64 +1124,70 @@ async def regenerate_key( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ApiKey', pipeline_response) + deserialized = self._deserialize("ApiKey", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"} # type: ignore - + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey" + } @distributed_trace - def list_deleted( - self, - **kwargs: Any - ) -> AsyncIterable[_models.DeletedConfigurationStoreListResult]: + def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigurationStore"]: """Gets information about the deleted configuration stores in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedConfigurationStoreListResult or the result - of cls(response) + :return: An iterator like instance of either DeletedConfigurationStore or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStoreListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_deleted_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_deleted.metadata['url'], + template_url=self.list_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -933,16 +1195,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -953,59 +1213,57 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"} # type: ignore + list_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores" + } @distributed_trace_async async def get_deleted( - self, - location: str, - config_store_name: str, - **kwargs: Any + self, location: str, config_store_name: str, **kwargs: Any ) -> _models.DeletedConfigurationStore: """Gets a deleted Azure app configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedConfigurationStore, or the result of cls(response) + :return: DeletedConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) - request = build_get_deleted_request( - subscription_id=self._config.subscription_id, location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_deleted.metadata['url'], + template_url=self.get_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1013,75 +1271,71 @@ async def get_deleted( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedConfigurationStore', pipeline_response) + deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"} # type: ignore - + get_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}" + } async def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any + self, location: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_purge_deleted_request_initial( - subscription_id=self._config.subscription_id, + request = build_purge_deleted_request( location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._purge_deleted_initial.metadata['url'], + template_url=self._purge_deleted_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore - + _purge_deleted_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } @distributed_trace_async - async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Permanently deletes the specified configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1093,52 +1347,47 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._purge_deleted_initial( # type: ignore location=location, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore + begin_purge_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py index dc0a29b44217..82a319829a3d 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py @@ -6,15 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -22,10 +28,16 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_values_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_by_configuration_store_request -T = TypeVar('T') +from ...operations._key_values_operations import build_create_or_update_request, build_delete_request, build_get_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class KeyValuesOperations: """ .. warning:: @@ -45,159 +57,56 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.KeyValueListResult]: - """Lists the key-values for a given configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. - :type config_store_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either KeyValueListResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValueListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValueListResult] - - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=self.list_by_configuration_store.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("KeyValueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues"} # type: ignore - @distributed_trace_async async def get( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> _models.KeyValue: """Gets the properties of the specified key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -205,79 +114,157 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, config_store_name: str, key_value_name: str, key_value_parameters: Optional[_models.KeyValue] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.KeyValue: """Creates a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :param key_value_parameters: The parameters for creating a key-value. Default value is None. :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Default value is None. + :type key_value_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None, + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type + or a IO type. Default value is None. + :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - if key_value_parameters is not None: - _json = self._serialize.body(key_value_parameters, 'KeyValue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(key_value_parameters, (IO, bytes)): + _content = key_value_parameters else: - _json = None + if key_value_parameters is not None: + _json = self._serialize.body(key_value_parameters, "KeyValue") + else: + _json = None request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -285,82 +272,78 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -372,53 +355,48 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py index 03f1d4dae00e..072360ae5cbf 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._operations import build_check_name_availability_request, build_list_request, build_regional_check_name_availability_request -T = TypeVar('T') +from ...operations._operations import ( + build_check_name_availability_request, + build_list_request, + build_regional_check_name_availability_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -43,55 +62,105 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def check_name_availability( self, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,22 +168,19 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" + } @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable[_models.OperationDefinitionListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.OperationDefinition"]: """Lists the operations available from this provider. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -123,46 +189,53 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationDefinitionListResult or the result of - cls(response) + :return: An iterator like instance of either OperationDefinition or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.OperationDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.OperationDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationDefinitionListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -170,16 +243,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -190,64 +261,125 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppConfiguration/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"} - @distributed_trace_async + @overload async def regional_check_name_availability( self, location: str, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_regional_check_name_availability_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regional_check_name_availability.metadata['url'], + content=_content, + template_url=self.regional_check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -255,12 +387,13 @@ async def regional_check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regional_check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"} # type: ignore - + regional_check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py index eabc42c515f7..ba71599097cf 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_configuration_store_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_configuration_store_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -45,66 +65,68 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Lists all private endpoint connections for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,16 +134,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,64 +152,61 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -197,100 +214,160 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _create_or_update_initial( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection, (IO, bytes)): + _content = private_endpoint_connection + else: + _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Update the state of the specified private endpoint connection associated with the configuration - store. + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. + :param private_endpoint_connection: The private endpoint connection properties. Required. :type private_endpoint_connection: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -303,127 +380,159 @@ async def begin_create_or_update( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO type. Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,53 +544,48 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py index 5446f1fc741b..993c94b89079 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_by_configuration_store_request -T = TypeVar('T') +from ...operations._private_link_resources_operations import ( + build_get_request, + build_list_by_configuration_store_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -43,66 +61,67 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateLinkResourceListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: """Gets the private link resources that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of - cls(response) + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResourceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -110,16 +129,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,64 +147,61 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - config_store_name: str, - group_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any ) -> _models.PrivateLinkResource: """Gets a private link resource that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param group_name: The name of the private link resource group. + :param group_name: The name of the private link resource group. Required. :type group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, group_name=group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,12 +209,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/__init__.py index 95fdfb0529b8..619eda3b065e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/__init__.py @@ -45,67 +45,65 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserIdentity - -from ._app_configuration_management_client_enums import ( - ActionsRequired, - ConfigurationResourceType, - ConnectionStatus, - CreateMode, - CreatedByType, - IdentityType, - ProvisioningState, - PublicNetworkAccess, -) +from ._app_configuration_management_client_enums import ActionsRequired +from ._app_configuration_management_client_enums import ConfigurationResourceType +from ._app_configuration_management_client_enums import ConnectionStatus +from ._app_configuration_management_client_enums import CreateMode +from ._app_configuration_management_client_enums import CreatedByType +from ._app_configuration_management_client_enums import IdentityType +from ._app_configuration_management_client_enums import ProvisioningState +from ._app_configuration_management_client_enums import PublicNetworkAccess from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ApiKey', - 'ApiKeyListResult', - 'CheckNameAvailabilityParameters', - 'ConfigurationStore', - 'ConfigurationStoreListResult', - 'ConfigurationStoreUpdateParameters', - 'DeletedConfigurationStore', - 'DeletedConfigurationStoreListResult', - 'EncryptionProperties', - 'ErrorAdditionalInfo', - 'ErrorDetails', - 'ErrorResponse', - 'KeyValue', - 'KeyValueListResult', - 'KeyVaultProperties', - 'LogSpecification', - 'MetricDimension', - 'MetricSpecification', - 'NameAvailabilityStatus', - 'OperationDefinition', - 'OperationDefinitionDisplay', - 'OperationDefinitionListResult', - 'OperationProperties', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateEndpointConnectionReference', - 'PrivateLinkResource', - 'PrivateLinkResourceListResult', - 'PrivateLinkServiceConnectionState', - 'RegenerateKeyParameters', - 'Resource', - 'ResourceIdentity', - 'ServiceSpecification', - 'Sku', - 'SystemData', - 'TrackedResource', - 'UserIdentity', - 'ActionsRequired', - 'ConfigurationResourceType', - 'ConnectionStatus', - 'CreateMode', - 'CreatedByType', - 'IdentityType', - 'ProvisioningState', - 'PublicNetworkAccess', + "ApiKey", + "ApiKeyListResult", + "CheckNameAvailabilityParameters", + "ConfigurationStore", + "ConfigurationStoreListResult", + "ConfigurationStoreUpdateParameters", + "DeletedConfigurationStore", + "DeletedConfigurationStoreListResult", + "EncryptionProperties", + "ErrorAdditionalInfo", + "ErrorDetails", + "ErrorResponse", + "KeyValue", + "KeyValueListResult", + "KeyVaultProperties", + "LogSpecification", + "MetricDimension", + "MetricSpecification", + "NameAvailabilityStatus", + "OperationDefinition", + "OperationDefinitionDisplay", + "OperationDefinitionListResult", + "OperationProperties", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionReference", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkServiceConnectionState", + "RegenerateKeyParameters", + "Resource", + "ResourceIdentity", + "ServiceSpecification", + "Sku", + "SystemData", + "TrackedResource", + "UserIdentity", + "ActionsRequired", + "ConfigurationResourceType", + "ConnectionStatus", + "CreateMode", + "CreatedByType", + "IdentityType", + "ProvisioningState", + "PublicNetworkAccess", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_app_configuration_management_client_enums.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_app_configuration_management_client_enums.py index 26019a7a0887..2c8a12d19822 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_app_configuration_management_client_enums.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_app_configuration_management_client_enums.py @@ -11,43 +11,43 @@ class ActionsRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Any action that is required beyond basic workflow (approve/ reject/ disconnect) - """ + """Any action that is required beyond basic workflow (approve/ reject/ disconnect).""" NONE = "None" RECREATE = "Recreate" + class ConfigurationResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The resource type to check for name availability. - """ + """The resource type to check for name availability.""" MICROSOFT_APP_CONFIGURATION_CONFIGURATION_STORES = "Microsoft.AppConfiguration/configurationStores" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the configuration store need to be recovered. - """ + """Indicates whether the configuration store need to be recovered.""" RECOVER = "Recover" DEFAULT = "Default" + class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove @@ -59,9 +59,9 @@ class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the configuration store. - """ + """The provisioning state of the configuration store.""" CREATING = "Creating" UPDATING = "Updating" @@ -70,6 +70,7 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" CANCELED = "Canceled" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py index 504eaa2bf4d3..ac72d1ff21a4 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class ApiKey(msrest.serialization.Model): +class ApiKey(_serialization.Model): """An API key used for authenticating with a configuration store endpoint. Variables are only populated by the server, and will be ignored when sending a request. @@ -38,30 +38,26 @@ class ApiKey(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'value': {'readonly': True}, - 'connection_string': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'read_only': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "value": {"readonly": True}, + "connection_string": {"readonly": True}, + "last_modified": {"readonly": True}, + "read_only": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, - 'read_only': {'key': 'readOnly', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "connection_string": {"key": "connectionString", "type": "str"}, + "last_modified": {"key": "lastModified", "type": "iso-8601"}, + "read_only": {"key": "readOnly", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ApiKey, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.value = None @@ -70,7 +66,7 @@ def __init__( self.read_only = None -class ApiKeyListResult(msrest.serialization.Model): +class ApiKeyListResult(_serialization.Model): """The result of a request to list API keys. :ivar value: The collection value. @@ -80,71 +76,61 @@ class ApiKeyListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ApiKey]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ApiKey]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.ApiKey"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.ApiKey"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(ApiKeyListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class CheckNameAvailabilityParameters(msrest.serialization.Model): +class CheckNameAvailabilityParameters(_serialization.Model): """Parameters used for checking whether a resource name is available. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name to check for availability. + :ivar name: The name to check for availability. Required. :vartype name: str - :ivar type: Required. The resource type to check for name availability. Known values are: - "Microsoft.AppConfiguration/configurationStores". + :ivar type: The resource type to check for name availability. Required. + "Microsoft.AppConfiguration/configurationStores" :vartype type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationResourceType """ _validation = { - 'name': {'required': True}, - 'type': {'required': True}, + "name": {"required": True}, + "type": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - name: str, - type: Union[str, "_models.ConfigurationResourceType"], - **kwargs - ): + def __init__(self, *, name: str, type: Union[str, "_models.ConfigurationResourceType"], **kwargs: Any) -> None: """ - :keyword name: Required. The name to check for availability. + :keyword name: The name to check for availability. Required. :paramtype name: str - :keyword type: Required. The resource type to check for name availability. Known values are: - "Microsoft.AppConfiguration/configurationStores". + :keyword type: The resource type to check for name availability. Required. + "Microsoft.AppConfiguration/configurationStores" :paramtype type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationResourceType """ - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. @@ -160,31 +146,28 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -198,47 +181,42 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ConfigurationStore(TrackedResource): - """The configuration store along with all resource properties. The Configuration Store will have all information to begin utilizing it. +class ConfigurationStore(TrackedResource): # pylint: disable=too-many-instance-attributes + """The configuration store along with all resource properties. The Configuration Store will have + all information to begin utilizing it. Variables are only populated by the server, and will be ignored when sending a request. @@ -252,18 +230,18 @@ class ConfigurationStore(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar identity: The managed identity information, if configured. :vartype identity: ~azure.mgmt.appconfiguration.v2022_05_01.models.ResourceIdentity - :ivar sku: Required. The sku of the configuration store. + :ivar sku: The sku of the configuration store. Required. :vartype sku: ~azure.mgmt.appconfiguration.v2022_05_01.models.Sku :ivar system_data: Resource system metadata. :vartype system_data: ~azure.mgmt.appconfiguration.v2022_05_01.models.SystemData :ivar provisioning_state: The provisioning state of the configuration store. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ProvisioningState :ivar creation_date: The creation date of configuration store. @@ -277,7 +255,7 @@ class ConfigurationStore(TrackedResource): :vartype private_endpoint_connections: list[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnectionReference] :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.PublicNetworkAccess :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. @@ -289,42 +267,45 @@ class ConfigurationStore(TrackedResource): for this configuration store. :vartype enable_purge_protection: bool :ivar create_mode: Indicates whether the configuration store need to be recovered. Known values - are: "Recover", "Default". + are: "Recover" and "Default". :vartype create_mode: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.CreateMode """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "sku": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "creation_date": {"readonly": True}, + "endpoint": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnectionReference]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'}, - 'enable_purge_protection': {'key': 'properties.enablePurgeProtection', 'type': 'bool'}, - 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, + "endpoint": {"key": "properties.endpoint", "type": "str"}, + "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnectionReference]", + }, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "soft_delete_retention_in_days": {"key": "properties.softDeleteRetentionInDays", "type": "int"}, + "enable_purge_protection": {"key": "properties.enablePurgeProtection", "type": "bool"}, + "create_mode": {"key": "properties.createMode", "type": "str"}, } def __init__( @@ -336,25 +317,25 @@ def __init__( identity: Optional["_models.ResourceIdentity"] = None, encryption: Optional["_models.EncryptionProperties"] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - disable_local_auth: Optional[bool] = False, - soft_delete_retention_in_days: Optional[int] = 7, - enable_purge_protection: Optional[bool] = False, + disable_local_auth: bool = False, + soft_delete_retention_in_days: int = 7, + enable_purge_protection: bool = False, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword identity: The managed identity information, if configured. :paramtype identity: ~azure.mgmt.appconfiguration.v2022_05_01.models.ResourceIdentity - :keyword sku: Required. The sku of the configuration store. + :keyword sku: The sku of the configuration store. Required. :paramtype sku: ~azure.mgmt.appconfiguration.v2022_05_01.models.Sku :keyword encryption: The encryption settings of the configuration store. :paramtype encryption: ~azure.mgmt.appconfiguration.v2022_05_01.models.EncryptionProperties :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.PublicNetworkAccess :keyword disable_local_auth: Disables all authentication methods other than AAD authentication. @@ -366,10 +347,10 @@ def __init__( enabled for this configuration store. :paramtype enable_purge_protection: bool :keyword create_mode: Indicates whether the configuration store need to be recovered. Known - values are: "Recover", "Default". + values are: "Recover" and "Default". :paramtype create_mode: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.CreateMode """ - super(ConfigurationStore, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.identity = identity self.sku = sku self.system_data = None @@ -385,7 +366,7 @@ def __init__( self.create_mode = create_mode -class ConfigurationStoreListResult(msrest.serialization.Model): +class ConfigurationStoreListResult(_serialization.Model): """The result of a request to list configuration stores. :ivar value: The collection value. @@ -395,8 +376,8 @@ class ConfigurationStoreListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ConfigurationStore]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ConfigurationStore]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -404,34 +385,34 @@ def __init__( *, value: Optional[List["_models.ConfigurationStore"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(ConfigurationStoreListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ConfigurationStoreUpdateParameters(msrest.serialization.Model): +class ConfigurationStoreUpdateParameters(_serialization.Model): """The parameters for updating a configuration store. :ivar identity: The managed identity information for the configuration store. :vartype identity: ~azure.mgmt.appconfiguration.v2022_05_01.models.ResourceIdentity :ivar sku: The SKU of the configuration store. :vartype sku: ~azure.mgmt.appconfiguration.v2022_05_01.models.Sku - :ivar tags: A set of tags. The ARM resource tags. + :ivar tags: The ARM resource tags. :vartype tags: dict[str, str] :ivar encryption: The encryption settings of the configuration store. :vartype encryption: ~azure.mgmt.appconfiguration.v2022_05_01.models.EncryptionProperties :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. :vartype disable_local_auth: bool :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.PublicNetworkAccess :ivar enable_purge_protection: Property specifying whether protection against purge is enabled @@ -440,13 +421,13 @@ class ConfigurationStoreUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'enable_purge_protection': {'key': 'properties.enablePurgeProtection', 'type': 'bool'}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "tags": {"key": "tags", "type": "{str}"}, + "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "enable_purge_protection": {"key": "properties.enablePurgeProtection", "type": "bool"}, } def __init__( @@ -459,28 +440,28 @@ def __init__( disable_local_auth: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, enable_purge_protection: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: The managed identity information for the configuration store. :paramtype identity: ~azure.mgmt.appconfiguration.v2022_05_01.models.ResourceIdentity :keyword sku: The SKU of the configuration store. :paramtype sku: ~azure.mgmt.appconfiguration.v2022_05_01.models.Sku - :keyword tags: A set of tags. The ARM resource tags. + :keyword tags: The ARM resource tags. :paramtype tags: dict[str, str] :keyword encryption: The encryption settings of the configuration store. :paramtype encryption: ~azure.mgmt.appconfiguration.v2022_05_01.models.EncryptionProperties :keyword disable_local_auth: Disables all authentication methods other than AAD authentication. :paramtype disable_local_auth: bool :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.PublicNetworkAccess :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this configuration store. :paramtype enable_purge_protection: bool """ - super(ConfigurationStoreUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.sku = sku self.tags = tags @@ -490,7 +471,7 @@ def __init__( self.enable_purge_protection = enable_purge_protection -class DeletedConfigurationStore(msrest.serialization.Model): +class DeletedConfigurationStore(_serialization.Model): """Deleted configuration store information with extended details. Variables are only populated by the server, and will be ignored when sending a request. @@ -509,43 +490,39 @@ class DeletedConfigurationStore(msrest.serialization.Model): :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. :vartype scheduled_purge_date: ~datetime.datetime - :ivar tags: A set of tags. Tags of the original configuration store. + :ivar tags: Tags of the original configuration store. :vartype tags: dict[str, str] :ivar purge_protection_enabled: Purge protection status of the original configuration store. :vartype purge_protection_enabled: bool """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'configuration_store_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'tags': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "configuration_store_id": {"readonly": True}, + "location": {"readonly": True}, + "deletion_date": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "tags": {"readonly": True}, + "purge_protection_enabled": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'configuration_store_id': {'key': 'properties.configurationStoreId', 'type': 'str'}, - 'location': {'key': 'properties.location', 'type': 'str'}, - 'deletion_date': {'key': 'properties.deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'properties.scheduledPurgeDate', 'type': 'iso-8601'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'purge_protection_enabled': {'key': 'properties.purgeProtectionEnabled', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "configuration_store_id": {"key": "properties.configurationStoreId", "type": "str"}, + "location": {"key": "properties.location", "type": "str"}, + "deletion_date": {"key": "properties.deletionDate", "type": "iso-8601"}, + "scheduled_purge_date": {"key": "properties.scheduledPurgeDate", "type": "iso-8601"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "purge_protection_enabled": {"key": "properties.purgeProtectionEnabled", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedConfigurationStore, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -557,7 +534,7 @@ def __init__( self.purge_protection_enabled = None -class DeletedConfigurationStoreListResult(msrest.serialization.Model): +class DeletedConfigurationStoreListResult(_serialization.Model): """List of deleted configuration stores. :ivar value: The list of deleted configuration store. @@ -567,8 +544,8 @@ class DeletedConfigurationStoreListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedConfigurationStore]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedConfigurationStore]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -576,8 +553,8 @@ def __init__( *, value: Optional[List["_models.DeletedConfigurationStore"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The list of deleted configuration store. :paramtype value: @@ -585,12 +562,12 @@ def __init__( :keyword next_link: The URL to get the next set of deleted configuration stores. :paramtype next_link: str """ - super(DeletedConfigurationStoreListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class EncryptionProperties(msrest.serialization.Model): +class EncryptionProperties(_serialization.Model): """The encryption settings for a configuration store. :ivar key_vault_properties: Key vault properties. @@ -599,25 +576,20 @@ class EncryptionProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, } - def __init__( - self, - *, - key_vault_properties: Optional["_models.KeyVaultProperties"] = None, - **kwargs - ): + def __init__(self, *, key_vault_properties: Optional["_models.KeyVaultProperties"] = None, **kwargs: Any) -> None: """ :keyword key_vault_properties: Key vault properties. :paramtype key_vault_properties: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyVaultProperties """ - super(EncryptionProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_vault_properties = key_vault_properties -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -625,31 +597,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorDetails(msrest.serialization.Model): +class ErrorDetails(_serialization.Model): """The details of the error. Variables are only populated by the server, and will be ignored when sending a request. @@ -664,55 +632,47 @@ class ErrorDetails(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.additional_info = None -class ErrorResponse(msrest.serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. +class ErrorResponse(_serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. :ivar error: The details of the error. :vartype error: ~azure.mgmt.appconfiguration.v2022_05_01.models.ErrorDetails """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetails'}, + "error": {"key": "error", "type": "ErrorDetails"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorDetails"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.appconfiguration.v2022_05_01.models.ErrorDetails """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class KeyValue(msrest.serialization.Model): +class KeyValue(_serialization.Model): # pylint: disable=too-many-instance-attributes """The key-value resource along with all resource properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -742,34 +702,33 @@ class KeyValue(msrest.serialization.Model): :ivar locked: A value indicating whether the key-value is locked. A locked key-value may not be modified until it is unlocked. :vartype locked: bool - :ivar tags: A set of tags. A dictionary of tags that can help identify what a key-value may be - applicable for. + :ivar tags: A dictionary of tags that can help identify what a key-value may be applicable for. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'key': {'readonly': True}, - 'label': {'readonly': True}, - 'e_tag': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'locked': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "key": {"readonly": True}, + "label": {"readonly": True}, + "e_tag": {"readonly": True}, + "last_modified": {"readonly": True}, + "locked": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'key': {'key': 'properties.key', 'type': 'str'}, - 'label': {'key': 'properties.label', 'type': 'str'}, - 'value': {'key': 'properties.value', 'type': 'str'}, - 'content_type': {'key': 'properties.contentType', 'type': 'str'}, - 'e_tag': {'key': 'properties.eTag', 'type': 'str'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'locked': {'key': 'properties.locked', 'type': 'bool'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "key": {"key": "properties.key", "type": "str"}, + "label": {"key": "properties.label", "type": "str"}, + "value": {"key": "properties.value", "type": "str"}, + "content_type": {"key": "properties.contentType", "type": "str"}, + "e_tag": {"key": "properties.eTag", "type": "str"}, + "last_modified": {"key": "properties.lastModified", "type": "iso-8601"}, + "locked": {"key": "properties.locked", "type": "bool"}, + "tags": {"key": "properties.tags", "type": "{str}"}, } def __init__( @@ -778,8 +737,8 @@ def __init__( value: Optional[str] = None, content_type: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The value of the key-value. :paramtype value: str @@ -787,11 +746,11 @@ def __init__( Providing a proper content-type can enable transformations of values when they are retrieved by applications. :paramtype content_type: str - :keyword tags: A set of tags. A dictionary of tags that can help identify what a key-value may - be applicable for. + :keyword tags: A dictionary of tags that can help identify what a key-value may be applicable + for. :paramtype tags: dict[str, str] """ - super(KeyValue, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -805,7 +764,7 @@ def __init__( self.tags = tags -class KeyValueListResult(msrest.serialization.Model): +class KeyValueListResult(_serialization.Model): """The result of a request to list key-values. :ivar value: The collection value. @@ -815,29 +774,25 @@ class KeyValueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyValue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyValue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.KeyValue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.KeyValue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(KeyValueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class KeyVaultProperties(msrest.serialization.Model): +class KeyVaultProperties(_serialization.Model): """Settings concerning key vault encryption for a configuration store. :ivar key_identifier: The URI of the key vault key used to encrypt data. @@ -847,17 +802,13 @@ class KeyVaultProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + "identity_client_id": {"key": "identityClientId", "type": "str"}, } def __init__( - self, - *, - key_identifier: Optional[str] = None, - identity_client_id: Optional[str] = None, - **kwargs - ): + self, *, key_identifier: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword key_identifier: The URI of the key vault key used to encrypt data. :paramtype key_identifier: str @@ -865,12 +816,12 @@ def __init__( vault. :paramtype identity_client_id: str """ - super(KeyVaultProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_identifier = key_identifier self.identity_client_id = identity_client_id -class LogSpecification(msrest.serialization.Model): +class LogSpecification(_serialization.Model): """Specifications of the Log for Azure Monitoring. :ivar name: Name of the log. @@ -882,9 +833,9 @@ class LogSpecification(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "blob_duration": {"key": "blobDuration", "type": "str"}, } def __init__( @@ -893,8 +844,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, blob_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the log. :paramtype name: str @@ -903,13 +854,13 @@ def __init__( :keyword blob_duration: Blob duration of the log. :paramtype blob_duration: str """ - super(LogSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class MetricDimension(msrest.serialization.Model): +class MetricDimension(_serialization.Model): """Specifications of the Dimension of metrics. :ivar name: Name of the dimension. @@ -921,9 +872,9 @@ class MetricDimension(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "internal_name": {"key": "internalName", "type": "str"}, } def __init__( @@ -932,8 +883,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, internal_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the dimension. :paramtype name: str @@ -942,13 +893,13 @@ def __init__( :keyword internal_name: Internal name of the dimension. :paramtype internal_name: str """ - super(MetricDimension, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.internal_name = internal_name -class MetricSpecification(msrest.serialization.Model): +class MetricSpecification(_serialization.Model): """Specifications of the Metrics for Azure Monitoring. :ivar name: Name of the metric. @@ -972,14 +923,14 @@ class MetricSpecification(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "display_description": {"key": "displayDescription", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "aggregation_type": {"key": "aggregationType", "type": "str"}, + "internal_metric_name": {"key": "internalMetricName", "type": "str"}, + "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, + "fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"}, } def __init__( @@ -993,8 +944,8 @@ def __init__( internal_metric_name: Optional[str] = None, dimensions: Optional[List["_models.MetricDimension"]] = None, fill_gap_with_zero: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the metric. :paramtype name: str @@ -1015,7 +966,7 @@ def __init__( duration where no metric is emitted/published. :paramtype fill_gap_with_zero: bool """ - super(MetricSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.display_description = display_description @@ -1026,7 +977,7 @@ def __init__( self.fill_gap_with_zero = fill_gap_with_zero -class NameAvailabilityStatus(msrest.serialization.Model): +class NameAvailabilityStatus(_serialization.Model): """The result of a request to check the availability of a resource name. Variables are only populated by the server, and will be ignored when sending a request. @@ -1041,30 +992,26 @@ class NameAvailabilityStatus(msrest.serialization.Model): """ _validation = { - 'name_available': {'readonly': True}, - 'message': {'readonly': True}, - 'reason': {'readonly': True}, + "name_available": {"readonly": True}, + "message": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "message": {"key": "message", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(NameAvailabilityStatus, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.name_available = None self.message = None self.reason = None -class OperationDefinition(msrest.serialization.Model): +class OperationDefinition(_serialization.Model): """The definition of a configuration store operation. :ivar name: Operation name: {provider}/{resource}/{operation}. @@ -1080,11 +1027,11 @@ class OperationDefinition(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDefinitionDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDefinitionDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "OperationProperties"}, } def __init__( @@ -1095,8 +1042,8 @@ def __init__( display: Optional["_models.OperationDefinitionDisplay"] = None, origin: Optional[str] = None, properties: Optional["_models.OperationProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1109,7 +1056,7 @@ def __init__( :keyword properties: Properties of the operation. :paramtype properties: ~azure.mgmt.appconfiguration.v2022_05_01.models.OperationProperties """ - super(OperationDefinition, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display @@ -1117,7 +1064,7 @@ def __init__( self.properties = properties -class OperationDefinitionDisplay(msrest.serialization.Model): +class OperationDefinitionDisplay(_serialization.Model): """The display information for a configuration store operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1133,14 +1080,14 @@ class OperationDefinitionDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, + "provider": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1149,8 +1096,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource: The resource on which the operation is performed. :paramtype resource: str @@ -1159,14 +1106,14 @@ def __init__( :keyword description: The description for the operation. :paramtype description: str """ - super(OperationDefinitionDisplay, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = None self.resource = resource self.operation = operation self.description = description -class OperationDefinitionListResult(msrest.serialization.Model): +class OperationDefinitionListResult(_serialization.Model): """The result of a request to list configuration store operations. :ivar value: The collection value. @@ -1176,8 +1123,8 @@ class OperationDefinitionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OperationDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1185,20 +1132,20 @@ def __init__( *, value: Optional[List["_models.OperationDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_05_01.models.OperationDefinition] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(OperationDefinitionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class OperationProperties(msrest.serialization.Model): +class OperationProperties(_serialization.Model): """Extra Operation properties. :ivar service_specification: Service specifications of the operation. @@ -1207,25 +1154,22 @@ class OperationProperties(msrest.serialization.Model): """ _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, } def __init__( - self, - *, - service_specification: Optional["_models.ServiceSpecification"] = None, - **kwargs - ): + self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any + ) -> None: """ :keyword service_specification: Service specifications of the operation. :paramtype service_specification: ~azure.mgmt.appconfiguration.v2022_05_01.models.ServiceSpecification """ - super(OperationProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.service_specification = service_specification -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -1233,24 +1177,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -1262,7 +1201,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The type of the resource. :vartype type: str :ivar provisioning_state: The provisioning status of the private endpoint connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -1274,19 +1213,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -1294,8 +1236,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The resource of private endpoint. :paramtype private_endpoint: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpoint @@ -1304,7 +1246,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1313,7 +1255,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -1323,8 +1265,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1332,8 +1274,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: @@ -1341,12 +1283,12 @@ def __init__( :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateEndpointConnectionReference(msrest.serialization.Model): +class PrivateEndpointConnectionReference(_serialization.Model): """A reference to a related private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -1358,7 +1300,7 @@ class PrivateEndpointConnectionReference(msrest.serialization.Model): :ivar type: The type of the resource. :vartype type: str :ivar provisioning_state: The provisioning status of the private endpoint connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -1370,19 +1312,22 @@ class PrivateEndpointConnectionReference(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -1390,8 +1335,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The resource of private endpoint. :paramtype private_endpoint: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpoint @@ -1400,7 +1345,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnectionReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1409,7 +1354,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A resource that supports private link capabilities. Variables are only populated by the server, and will be ignored when sending a request. @@ -1429,30 +1374,26 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, + "required_zone_names": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PrivateLinkResource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1461,7 +1402,7 @@ def __init__( self.required_zone_names = None -class PrivateLinkResourceListResult(msrest.serialization.Model): +class PrivateLinkResourceListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -1471,8 +1412,8 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1480,43 +1421,43 @@ def __init__( *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource] :keyword next_link: The URI that can be used to request the next set of paged results. :paramtype next_link: str """ - super(PrivateLinkResourceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. Variables are only populated by the server, and will be ignored when sending a request. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). Known values are: "None", "Recreate". + disconnect). Known values are: "None" and "Recreate". :vartype actions_required: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ActionsRequired """ _validation = { - 'actions_required': {'readonly': True}, + "actions_required": {"readonly": True}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, } def __init__( @@ -1524,22 +1465,22 @@ def __init__( *, status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description self.actions_required = None -class RegenerateKeyParameters(msrest.serialization.Model): +class RegenerateKeyParameters(_serialization.Model): """The parameters used to regenerate an API key. :ivar id: The id of the key to regenerate. @@ -1547,31 +1488,26 @@ class RegenerateKeyParameters(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The id of the key to regenerate. :paramtype id: str """ - super(RegenerateKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class ResourceIdentity(msrest.serialization.Model): +class ResourceIdentity(_serialization.Model): """An identity that can be associated with a resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will - remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", + remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". :vartype type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.IdentityType :ivar user_assigned_identities: The list of user-assigned identities associated with the @@ -1588,15 +1524,15 @@ class ResourceIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentity}'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserIdentity}"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } def __init__( @@ -1604,13 +1540,13 @@ def __init__( *, type: Optional[Union[str, "_models.IdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned". + and "SystemAssigned, UserAssigned". :paramtype type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.IdentityType :keyword user_assigned_identities: The list of user-assigned identities associated with the resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: @@ -1618,14 +1554,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.appconfiguration.v2022_05_01.models.UserIdentity] """ - super(ResourceIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.user_assigned_identities = user_assigned_identities self.principal_id = None self.tenant_id = None -class ServiceSpecification(msrest.serialization.Model): +class ServiceSpecification(_serialization.Model): """Service specification payload. :ivar log_specifications: Specifications of the Log for Azure Monitoring. @@ -1637,8 +1573,8 @@ class ServiceSpecification(msrest.serialization.Model): """ _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, + "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, } def __init__( @@ -1646,8 +1582,8 @@ def __init__( *, log_specifications: Optional[List["_models.LogSpecification"]] = None, metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword log_specifications: Specifications of the Log for Azure Monitoring. :paramtype log_specifications: @@ -1656,56 +1592,51 @@ def __init__( :paramtype metric_specifications: list[~azure.mgmt.appconfiguration.v2022_05_01.models.MetricSpecification] """ - super(ServiceSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications -class Sku(msrest.serialization.Model): +class Sku(_serialization.Model): """Describes a configuration store SKU. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The SKU name of the configuration store. + :ivar name: The SKU name of the configuration store. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The SKU name of the configuration store. + :keyword name: The SKU name of the configuration store. Required. :paramtype name: str """ - super(Sku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -1713,12 +1644,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -1730,13 +1661,13 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -1744,13 +1675,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -1759,7 +1690,7 @@ def __init__( self.last_modified_at = last_modified_at -class UserIdentity(msrest.serialization.Model): +class UserIdentity(_serialization.Model): """A resource identity that is managed by the user of the service. Variables are only populated by the server, and will be ignored when sending a request. @@ -1771,21 +1702,17 @@ class UserIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(UserIdentity, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/__init__.py index 36f96183612a..919efccff5aa 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/__init__.py @@ -13,14 +13,15 @@ from ._key_values_operations import KeyValuesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ConfigurationStoresOperations', - 'Operations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'KeyValuesOperations', + "ConfigurationStoresOperations", + "Operations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "KeyValuesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py index 4cf4c4533d99..27745425ad8d 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,257 +29,222 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any + resource_group_name: str, subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - *, - json: Optional[_models.ConfigurationStore] = None, - content: Any = None, - **kwargs: Any +def build_create_request( + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - *, - json: Optional[_models.ConfigurationStoreUpdateParameters] = None, - content: Any = None, - **kwargs: Any +def build_update_request( + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - subscription_id: str, resource_group_name: str, config_store_name: str, + subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any @@ -280,186 +252,163 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_key_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - *, - json: Optional[_models.RegenerateKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_deleted_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_request( - subscription_id: str, - location: str, - config_store_name: str, - **kwargs: Any + location: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_purge_deleted_request_initial( - subscription_id: str, - location: str, - config_store_name: str, - **kwargs: Any +def build_purge_deleted_request( + location: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ConfigurationStoresOperations: """ @@ -480,13 +429,8 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.ConfigurationStoreListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given subscription. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -495,48 +439,54 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -544,16 +494,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -564,23 +512,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"} @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.ConfigurationStoreListResult]: + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ConfigurationStore"]: """Lists the configuration stores for a given resource group. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -588,50 +531,55 @@ def list_by_resource_group( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationStoreListResult or the result of - cls(response) + :return: An iterator like instance of either ConfigurationStore or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStoreListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_by_resource_group.metadata['url'], + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -639,16 +587,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -659,60 +605,56 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores" + } @distributed_trace - def get( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> _models.ConfigurationStore: + def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: """Gets the properties of the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationStore, or the result of cls(response) + :return: ConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -720,94 +662,187 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } def _create_initial( self, resource_group_name: str, config_store_name: str, - config_store_creation_parameters: _models.ConfigurationStore, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - _json = self._serialize.body(config_store_creation_parameters, 'ConfigurationStore') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_creation_parameters, (IO, bytes)): + _content = config_store_creation_parameters + else: + _json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore") - request = build_create_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace + @overload def begin_create( self, resource_group_name: str, config_store_name: str, config_store_creation_parameters: _models.ConfigurationStore, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ConfigurationStore]: """Creates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. Is + either a ConfigurationStore type or a IO type. Required. + :type config_store_creation_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -820,121 +855,111 @@ def begin_create( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_creation_parameters=config_store_creation_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -946,134 +971,184 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } def _update_initial( self, resource_group_name: str, config_store_name: str, - config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], **kwargs: Any ) -> _models.ConfigurationStore: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - _json = self._serialize.body(config_store_update_parameters, 'ConfigurationStoreUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_store_update_parameters, (IO, bytes)): + _content = config_store_update_parameters + else: + _json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters") - request = build_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + return deserialized # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } - @distributed_trace + @overload def begin_update( self, resource_group_name: str, config_store_name: str, config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ConfigurationStore]: """Updates a configuration store with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param config_store_update_parameters: The parameters for updating a configuration store. + Required. :type config_store_update_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1086,75 +1161,103 @@ def begin_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. Is + either a ConfigurationStoreUpdateParameters type or a IO type. Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationStore or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConfigurationStore] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, config_store_update_parameters=config_store_update_parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ConfigurationStore', pipeline_response) + deserialized = self._deserialize("ConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.ApiKeyListResult]: + self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ApiKey"]: """Lists the access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param skip_token: A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink @@ -1162,51 +1265,55 @@ def list_keys( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiKeyListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ApiKey or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKeyListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_keys_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, - api_version=api_version, + subscription_id=self._config.subscription_id, skip_token=skip_token, - template_url=self.list_keys.metadata['url'], + api_version=api_version, + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1214,16 +1321,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApiKeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1234,68 +1339,138 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys" + } - @distributed_trace + @overload def regenerate_key( self, resource_group_name: str, config_store_name: str, regenerate_key_parameters: _models.RegenerateKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ApiKey: """Regenerates an access key for the specified configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiKey or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO], + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Is either a + RegenerateKeyParameters type or a IO type. Required. + :type regenerate_key_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKey, or the result of cls(response) + :return: ApiKey or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ApiKey] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) - _json = self._serialize.body(regenerate_key_parameters, 'RegenerateKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_key_parameters, (IO, bytes)): + _content = regenerate_key_parameters + else: + _json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters") request = build_regenerate_key_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_key.metadata['url'], + content=_content, + template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1303,64 +1478,70 @@ def regenerate_key( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ApiKey', pipeline_response) + deserialized = self._deserialize("ApiKey", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"} # type: ignore - + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey" + } @distributed_trace - def list_deleted( - self, - **kwargs: Any - ) -> Iterable[_models.DeletedConfigurationStoreListResult]: + def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationStore"]: """Gets information about the deleted configuration stores in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedConfigurationStoreListResult or the result - of cls(response) + :return: An iterator like instance of either DeletedConfigurationStore or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStoreListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStoreListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_deleted_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_deleted.metadata['url'], + template_url=self.list_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1368,16 +1549,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1388,59 +1567,55 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"} # type: ignore + list_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores" + } @distributed_trace - def get_deleted( - self, - location: str, - config_store_name: str, - **kwargs: Any - ) -> _models.DeletedConfigurationStore: + def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _models.DeletedConfigurationStore: """Gets a deleted Azure app configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedConfigurationStore, or the result of cls(response) + :return: DeletedConfigurationStore or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStore - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedConfigurationStore] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) - request = build_get_deleted_request( - subscription_id=self._config.subscription_id, location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_deleted.metadata['url'], + template_url=self.get_deleted.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1448,75 +1623,71 @@ def get_deleted( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedConfigurationStore', pipeline_response) + deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"} # type: ignore - + get_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}" + } def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any + self, location: str, config_store_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_purge_deleted_request_initial( - subscription_id=self._config.subscription_id, + request = build_purge_deleted_request( location=location, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._purge_deleted_initial.metadata['url'], + template_url=self._purge_deleted_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore - + _purge_deleted_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } @distributed_trace - def begin_purge_deleted( # pylint: disable=inconsistent-return-statements - self, - location: str, - config_store_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: """Permanently deletes the specified configuration store. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1528,52 +1699,47 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._purge_deleted_initial( # type: ignore location=location, config_store_name=config_store_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"} # type: ignore + begin_purge_deleted.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py index 7b0faabc9176..e1a442deb2da 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py @@ -6,12 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -22,177 +27,124 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_by_configuration_store_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - def build_get_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - *, - json: Optional[_models.KeyValue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class KeyValuesOperations: """ @@ -213,159 +165,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.KeyValueListResult]: - """Lists the key-values for a given configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. - :type config_store_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either KeyValueListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValueListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValueListResult] - - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=self.list_by_configuration_store.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("KeyValueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues"} # type: ignore - @distributed_trace def get( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> _models.KeyValue: """Gets the properties of the specified key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,79 +222,157 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, config_store_name: str, key_value_name: str, key_value_parameters: Optional[_models.KeyValue] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.KeyValue: """Creates a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :param key_value_parameters: The parameters for creating a key-value. Default value is None. :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Default value is None. + :type key_value_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyValue, or the result of cls(response) + :return: KeyValue or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None, + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type + or a IO type. Default value is None. + :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyValue or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyValue] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - if key_value_parameters is not None: - _json = self._serialize.body(key_value_parameters, 'KeyValue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(key_value_parameters, (IO, bytes)): + _content = key_value_parameters else: - _json = None + if key_value_parameters is not None: + _json = self._serialize.body(key_value_parameters, "KeyValue") + else: + _json = None request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -453,82 +380,78 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyValue', pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a key-value. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. + character. Label is optional. Required. :type key_value_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -540,53 +463,48 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, key_value_name=key_value_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py index c9b353ca4c9c..5ce9b83ee482 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,126 +27,100 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailabilityParameters] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.AppConfiguration/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_regional_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: Optional[_models.CheckNameAvailabilityParameters] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regional_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class Operations: """ @@ -160,55 +141,105 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace + @overload def check_name_availability( self, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -216,22 +247,19 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" + } @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable[_models.OperationDefinitionListResult]: + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.OperationDefinition"]: """Lists the operations available from this provider. :param skip_token: A skip token is used to continue retrieving items after an operation returns @@ -240,46 +268,53 @@ def list( subsequent calls. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationDefinitionListResult or the result of - cls(response) + :return: An iterator like instance of either OperationDefinition or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.OperationDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.OperationDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationDefinitionListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - api_version=api_version, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - skip_token=skip_token, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,16 +322,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -307,64 +340,125 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppConfiguration/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"} - @distributed_trace + @overload def regional_check_name_availability( self, location: str, check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. + :param location: The location in which uniqueness will be verified. Required. :type location: str :param check_name_availability_parameters: The object containing information for the - availability request. + availability request. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Required. + :type check_name_availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityStatus, or the result of cls(response) + :return: NameAvailabilityStatus or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location in which uniqueness will be verified. Required. + :type location: str + :param check_name_availability_parameters: The object containing information for the + availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityStatus] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) - _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_parameters, (IO, bytes)): + _content = check_name_availability_parameters + else: + _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") request = build_regional_check_name_availability_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regional_check_name_availability.metadata['url'], + content=_content, + template_url=self.regional_check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -372,12 +466,13 @@ def regional_check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityStatus', pipeline_response) + deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regional_check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"} # type: ignore - + regional_check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py index 0cdb30743d7d..f51fa8a6295e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,173 +29,175 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_configuration_store_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, +def build_create_or_update_request( resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -209,66 +218,68 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: """Lists all private endpoint connections for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -276,16 +287,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -296,64 +305,61 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections" + } @distributed_trace def get( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -361,100 +367,118 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _create_or_update_initial( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection, (IO, bytes)): + _content = private_endpoint_connection + else: + _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Update the state of the specified private endpoint connection associated with the configuration - store. + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. + :param private_endpoint_connection: The private endpoint connection properties. Required. :type private_endpoint_connection: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -467,127 +491,201 @@ def begin_create_or_update( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO type. Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. + :param private_endpoint_connection_name: Private endpoint connection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -599,53 +697,48 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, config_store_name=config_store_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py index 9a8cbdfdceda..956dc6639937 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,87 +27,86 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_configuration_store_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - config_store_name: str, - group_name: str, - **kwargs: Any + resource_group_name: str, config_store_name: str, group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$'), - "groupName": _SERIALIZER.url("group_name", group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url( + "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" + ), + "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -121,66 +127,67 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_configuration_store( - self, - resource_group_name: str, - config_store_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateLinkResourceListResult]: + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: """Gets the private link resources that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of - cls(response) + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResourceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_configuration_store.metadata['url'], + template_url=self.list_by_configuration_store.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_configuration_store_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -188,16 +195,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -208,64 +213,61 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_configuration_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"} # type: ignore + list_by_configuration_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources" + } @distributed_trace def get( - self, - resource_group_name: str, - config_store_name: str, - group_name: str, - **kwargs: Any + self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any ) -> _models.PrivateLinkResource: """Gets a private link resource that need to be created for a configuration store. :param resource_group_name: The name of the resource group to which the container registry - belongs. + belongs. Required. :type resource_group_name: str - :param config_store_name: The name of the configuration store. + :param config_store_name: The name of the configuration store. Required. :type config_store_name: str - :param group_name: The name of the private link resource group. + :param group_name: The name of the private link resource group. Required. :type group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, config_store_name=config_store_name, group_name=group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,12 +275,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}" + } diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py new file mode 100644 index 000000000000..aa037f7465cd --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python check_name_available.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.operations.check_name_availability( + check_name_availability_parameters={ + "name": "contoso", + "type": "Microsoft.AppConfiguration/configurationStores", + }, + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/CheckNameAvailable.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py new file mode 100644 index 000000000000..5ac60cfb54ed --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python check_name_not_available.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.operations.check_name_availability( + check_name_availability_parameters={ + "name": "contoso", + "type": "Microsoft.AppConfiguration/configurationStores", + }, + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/CheckNameNotAvailable.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py new file mode 100644 index 000000000000..42c5bbf30f69 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.begin_create( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_creation_parameters={ + "location": "westus", + "sku": {"name": "Standard"}, + "tags": {"myTag": "myTagValue"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py new file mode 100644 index 000000000000..00da4cb6d13c --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_create_key_value.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.key_values.create_or_update( + resource_group_name="myResourceGroup", + config_store_name="contoso", + key_value_name="myKey$myLabel", + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresCreateKeyValue.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py similarity index 50% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py rename to sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py index 33c1ca70322a..1b1a7b1343b0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.appconfiguration import AppConfigurationManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-appconfiguration # USAGE - python cosmos_db_sql_database_restore.py + python configuration_stores_create_with_identity.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,34 +24,29 @@ def main(): - client = CosmosDBManagementClient( + client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", ) - response = client.sql_resources.begin_create_update_sql_database( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - create_update_sql_database_parameters={ - "location": "West US", - "properties": { - "options": {}, - "resource": { - "createMode": "Restore", - "id": "databaseName", - "restoreParameters": { - "restoreSource": "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", - "restoreTimestampInUtc": "2022-07-20T18:28:00Z", - }, + response = client.configuration_stores.begin_create( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_creation_parameters={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {} }, }, - "tags": {}, + "location": "westus", + "sku": {"name": "Standard"}, + "tags": {"myTag": "myTagValue"}, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseRestore.json +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresCreateWithIdentity.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py new file mode 100644 index 000000000000..88d7f0b1c8c1 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_create_with_local_auth_disabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.begin_create( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_creation_parameters={ + "location": "westus", + "properties": {"disableLocalAuth": True}, + "sku": {"name": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresCreateWithLocalAuthDisabled.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py new file mode 100644 index 000000000000..67d4f12ad129 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.begin_delete( + resource_group_name="myResourceGroup", + config_store_name="contoso", + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py new file mode 100644 index 000000000000..da6f2d40f214 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_delete_key_value.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.key_values.begin_delete( + resource_group_name="myResourceGroup", + config_store_name="contoso", + key_value_name="myKey$myLabel", + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresDeleteKeyValue.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py new file mode 100644 index 000000000000..1172df99172e --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_delete_private_endpoint_connection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.private_endpoint_connections.begin_delete( + resource_group_name="myResourceGroup", + config_store_name="contoso", + private_endpoint_connection_name="myConnection", + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresDeletePrivateEndpointConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py new file mode 100644 index 000000000000..cd653b512da8 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.get( + resource_group_name="myResourceGroup", + config_store_name="contoso", + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresGet.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py new file mode 100644 index 000000000000..764858a87043 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_get_key_value.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.key_values.get( + resource_group_name="myResourceGroup", + config_store_name="contoso", + key_value_name="myKey$myLabel", + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresGetKeyValue.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py new file mode 100644 index 000000000000..11fd7ecc43e2 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_get_private_endpoint_connection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="myResourceGroup", + config_store_name="contoso", + private_endpoint_connection_name="myConnection", + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresGetPrivateEndpointConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py new file mode 100644 index 000000000000..747ab1219e1f --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresList.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py new file mode 100644 index 000000000000..74f0dc291e1d --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py new file mode 100644 index 000000000000..bed6598b660d --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_list_keys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.list_keys( + resource_group_name="myResourceGroup", + config_store_name="contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresListKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py new file mode 100644 index 000000000000..0949918dcd75 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_list_private_endpoint_connections.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.private_endpoint_connections.list_by_configuration_store( + resource_group_name="myResourceGroup", + config_store_name="contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresListPrivateEndpointConnections.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py new file mode 100644 index 000000000000..626de44965ac --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_regenerate_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.regenerate_key( + resource_group_name="myResourceGroup", + config_store_name="contoso", + regenerate_key_parameters={"id": "439AD01B4BE67DB1"}, + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresRegenerateKey.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py new file mode 100644 index 000000000000..8563f5c997a7 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.begin_update( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_update_parameters={"sku": {"name": "Standard"}, "tags": {"Category": "Marketing"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_update.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py similarity index 60% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_update.py rename to sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py index fcb964c2ab75..098a6bccfccf 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_update.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.appconfiguration import AppConfigurationManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-appconfiguration # USAGE - python cosmos_db_cassandra_view_throughput_update.py + python configuration_stores_update_disable_local_auth.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,21 +24,19 @@ def main(): - client = CosmosDBManagementClient( + client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", ) - response = client.cassandra_resources.begin_update_cassandra_view_throughput( - resource_group_name="rg1", - account_name="ddb1", - keyspace_name="keyspacename", - view_name="viewname", - update_throughput_parameters={"properties": {"resource": {"throughput": 400}}, "tags": {}}, + response = client.configuration_stores.begin_update( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_update_parameters={"properties": {"disableLocalAuth": True}, "sku": {"name": "Standard"}}, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewThroughputUpdate.json +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresUpdateDisableLocalAuth.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py new file mode 100644 index 000000000000..1b303a99cb9a --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_update_private_endpoint_connection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.private_endpoint_connections.begin_create_or_update( + resource_group_name="myResourceGroup", + config_store_name="contoso", + private_endpoint_connection_name="myConnection", + private_endpoint_connection={ + "properties": {"privateLinkServiceConnectionState": {"description": "Auto-Approved", "status": "Approved"}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresUpdatePrivateEndpointConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py new file mode 100644 index 000000000000..60e056b8ebe0 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_update_with_identity.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.begin_update( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_update_parameters={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {} + }, + }, + "sku": {"name": "Standard"}, + "tags": {"Category": "Marketing"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresUpdateWithIdentity.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py new file mode 100644 index 000000000000..93f451164a1e --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python deleted_configuration_stores_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.get_deleted( + location="westus", + config_store_name="contoso", + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/DeletedConfigurationStoresGet.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py new file mode 100644 index 000000000000..d5e25b74af3a --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python deleted_configuration_stores_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.list_deleted() + for item in response: + print(item) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/DeletedConfigurationStoresList.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py new file mode 100644 index 000000000000..00963bd55abf --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python deleted_configuration_stores_purge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.configuration_stores.begin_purge_deleted( + location="westus", + config_store_name="contoso", + ).result() + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/DeletedConfigurationStoresPurge.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_list_by_subscription.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py similarity index 70% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_list_by_subscription.py rename to sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py index b53e7bc20872..ae7e27ceb50c 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_list_by_subscription.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.workloads import WorkloadsClient +from azure.mgmt.appconfiguration import AppConfigurationManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-workloads + pip install azure-mgmt-appconfiguration # USAGE - python php_workloads_list_by_subscription.py + python operations_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,16 +24,16 @@ def main(): - client = WorkloadsClient( + client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.php_workloads.list_by_subscription() + response = client.operations.list() for item in response: print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/PhpWorkloads_ListBySubscription.json +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py new file mode 100644 index 000000000000..f6ab3ea2bc53 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python private_link_resource_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.private_link_resources.get( + resource_group_name="myResourceGroup", + config_store_name="contoso", + group_name="configurationStores", + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/PrivateLinkResourceGet.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py new file mode 100644 index 000000000000..83471303b7b4 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python private_link_resources_list_by_configuration_store.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.private_link_resources.list_by_configuration_store( + resource_group_name="myResourceGroup", + config_store_name="contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/PrivateLinkResourcesListByConfigurationStore.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py new file mode 100644 index 000000000000..48c375699a93 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python regional_check_name_available.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.operations.regional_check_name_availability( + location="westus", + check_name_availability_parameters={ + "name": "contoso", + "type": "Microsoft.AppConfiguration/configurationStores", + }, + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/RegionalCheckNameAvailable.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py new file mode 100644 index 000000000000..d30d4f40c154 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python regional_check_name_not_available.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + ) + + response = client.operations.regional_check_name_availability( + location="westus", + check_name_availability_parameters={ + "name": "contoso", + "type": "Microsoft.AppConfiguration/configurationStores", + }, + ) + print(response) + + +# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/RegionalCheckNameNotAvailable.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py index 8a21cdca4e0d..5a8da162411e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -69,9 +70,10 @@ 'pytyped': ['py.typed'], }, install_requires=[ - 'msrest>=0.7.1', - 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.2,<2.0.0', + "msrest>=0.7.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", ], python_requires=">=3.7" ) diff --git a/sdk/attestation/azure-security-attestation/pyproject.toml b/sdk/attestation/azure-security-attestation/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/attestation/azure-security-attestation/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md b/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md index c2475b793346..af78991ef238 100644 --- a/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md +++ b/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md @@ -1,5 +1,26 @@ # Release History +## 3.1.0b1 (2023-02-15) + +### Features Added + + - Model AlertConfiguration has a new parameter alert_definition + - Model AlertConfigurationProperties has a new parameter alert_definition + - Model AzureRolesAssignedOutsidePimAlertConfigurationProperties has a new parameter alert_definition + - Model DenyAssignment has a new parameter condition + - Model DenyAssignment has a new parameter condition_version + - Model DenyAssignment has a new parameter created_by + - Model DenyAssignment has a new parameter created_on + - Model DenyAssignment has a new parameter updated_by + - Model DenyAssignment has a new parameter updated_on + - Model DuplicateRoleCreatedAlertConfigurationProperties has a new parameter alert_definition + - Model RoleDefinition has a new parameter created_by + - Model RoleDefinition has a new parameter created_on + - Model RoleDefinition has a new parameter updated_by + - Model RoleDefinition has a new parameter updated_on + - Model TooManyOwnersAssignedToResourceAlertConfigurationProperties has a new parameter alert_definition + - Model TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties has a new parameter alert_definition + ## 3.0.0 (2022-10-11) ### Features Added diff --git a/sdk/authorization/azure-mgmt-authorization/README.md b/sdk/authorization/azure-mgmt-authorization/README.md index 5d8b2e4c70bd..ae97eb971c6a 100644 --- a/sdk/authorization/azure-mgmt-authorization/README.md +++ b/sdk/authorization/azure-mgmt-authorization/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/authorization) -Code samples for this package can be found at [Authorization Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/authorization) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-authorization +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = AuthorizationManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Authorization Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/authorization/azure-mgmt-authorization/_meta.json b/sdk/authorization/azure-mgmt-authorization/_meta.json index 9c7eec68d8ab..978cb26ce5a9 100644 --- a/sdk/authorization/azure-mgmt-authorization/_meta.json +++ b/sdk/authorization/azure-mgmt-authorization/_meta.json @@ -1,11 +1,11 @@ { + "commit": "d37b3db5ec88a9fc2afcae36bf8d2004b1c5b537", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.9", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "commit": "89e402f0f66ddc54494411dab813d973016ef9e1", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/authorization/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.9 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/authorization/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/authorization/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py index 7c304d130eb1..1e8f0d029aa6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py @@ -114,10 +114,10 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version=None, # type: Optional[str] + api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = AuthorizationManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_configuration.py index 2456ec0c1411..f52b9ee54234 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_configuration.py @@ -36,9 +36,8 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -53,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py index 240df16c57f3..25467dfc00bb 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,34 +38,50 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull -_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") # Name used in context CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -75,12 +92,12 @@ def deserialize_from_text(cls, data, content_type=None): :type data: str or bytes or IO :param str content_type: The content type. """ - if hasattr(data, 'read'): + if hasattr(data, "read"): # Assume a stream data = cast(IO, data).read() if isinstance(data, bytes): - data_as_str = data.decode(encoding='utf-8-sig') + data_as_str = data.decode(encoding="utf-8-sig") else: # Explain to mypy the correct type. data_as_str = cast(str, data) @@ -116,7 +133,8 @@ def _json_attemp(data): try: return True, json.loads(data) except ValueError: - return False, None # Don't care about this one + return False, None # Don't care about this one + success, json_result = _json_attemp(data) if success: return json_result @@ -129,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -139,8 +156,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): """ # Try to use content-type from headers if available content_type = None - if 'content-type' in headers: - content_type = headers['content-type'].split(";")[0].strip().lower() + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() # Ouch, this server did not declare what it sent... # Let's guess it's JSON... # Also, since Autorest was considering that an empty body was a valid JSON, @@ -152,20 +169,22 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return cls.deserialize_from_text(body_bytes, content_type) return None + try: basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) try: - _long_type = long # type: ignore + _long_type = long # type: ignore except NameError: _long_type = int + class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" @@ -181,9 +200,11 @@ def dst(self, dt): """No daylight saving for UTC.""" return datetime.timedelta(hours=1) + try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore """Fixed offset in minutes east from UTC. Copy/pasted from Python doc @@ -197,7 +218,7 @@ def utcoffset(self, dt): return self.__offset def tzname(self, dt): - return str(self.__offset.total_seconds()/3600) + return str(self.__offset.total_seconds() / 3600) def __repr__(self): return "".format(self.tzname(None)) @@ -208,14 +229,17 @@ def dst(self, dt): def __getinitargs__(self): return (self.__offset,) + try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore _FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -276,47 +304,42 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): - cls._attribute_map['additional_properties'] = {'key': '', 'type': '{object}'} + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @classmethod def _create_xml_node(cls): - """Create XML node. - """ + """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} - return _create_xml_node( - xml_map.get('name', cls.__name__), - xml_map.get("prefix", None), - xml_map.get("ns", None) - ) + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -330,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -367,7 +397,7 @@ def my_key_transformer(key, attr_desc, value): @classmethod def _infer_class_models(cls): try: - str_models = cls.__module__.rsplit('.', 1)[0] + str_models = cls.__module__.rsplit(".", 1)[0] models = sys.modules[str_models] client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: @@ -378,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -390,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -403,16 +438,20 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = [ - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor - ] if key_extractors is None else key_extractors + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) return deserializer(cls.__name__, data, content_type=content_type) @classmethod def _flatten_subtype(cls, key, objects): - if '_subtype_map' not in cls.__dict__: + if "_subtype_map" not in cls.__dict__: return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): @@ -425,18 +464,14 @@ def _classify(cls, response, objects): We want to ignore any inherited _subtype_maps. Remove the polymorphic key from the initial data. """ - for subtype_key in cls.__dict__.get('_subtype_map', {}).keys(): + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) else: - subtype_value = xml_key_extractor( - subtype_key, - cls._attribute_map[subtype_key], - response - ) + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: # Try to match base class. Can be class name only # (bug to fix in Autorest to support x-ms-discriminator-name) @@ -444,7 +479,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -453,11 +488,7 @@ def _classify(cls, response, objects): ) break else: - _LOGGER.warning( - "Discriminator %s is absent or null, use base class %s.", - subtype_key, - cls.__name__ - ) + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) break return cls @@ -468,29 +499,40 @@ def _get_rest_key_parts(cls, attr_key): :returns: A list of RestAPI part :rtype: list """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]['key']) + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] def _decode_attribute_map_key(key): """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. + inside the received data. - :param str key: A key string from the generated code + :param str key: A key string from the generated code """ - return key.replace('\\.', '.') + return key.replace("\\.", ".") class Serializer(object): """Request object model serializer.""" - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} - - _xml_basic_types_serializers = {'bool': lambda x:str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", - 4: "Fri", 5: "Sat", 6: "Sun"} - months = {1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", - 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec"} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } validation = { "min_length": lambda x, y: len(x) < y, "max_length": lambda x, y: len(x) > y, @@ -502,26 +544,26 @@ class Serializer(object): "max_items": lambda x, y: len(x) > y, "pattern": lambda x, y: not re.match(y, x, re.UNICODE), "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0 - } + "multiple": lambda x, y: x % y != 0, + } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { - 'iso-8601': Serializer.serialize_iso, - 'rfc-1123': Serializer.serialize_rfc, - 'unix-time': Serializer.serialize_unix, - 'duration': Serializer.serialize_duration, - 'date': Serializer.serialize_date, - 'time': Serializer.serialize_time, - 'decimal': Serializer.serialize_decimal, - 'long': Serializer.serialize_long, - 'bytearray': Serializer.serialize_bytearray, - 'base64': Serializer.serialize_base64, - 'object': self.serialize_object, - '[]': self.serialize_iter, - '{}': self.serialize_dict - } - self.dependencies = dict(classes) if classes else {} + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -542,14 +584,12 @@ def _serialize(self, target_obj, data_type=None, **kwargs): class_name = target_obj.__class__.__name__ if data_type: - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) if not hasattr(target_obj, "_attribute_map"): data_type = type(target_obj).__name__ if data_type in self.basic_types.values(): - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) # Force "is_xml" kwargs if we detect a XML model try: @@ -564,10 +604,10 @@ def _serialize(self, target_obj, data_type=None, **kwargs): attributes = target_obj._attribute_map for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): continue - if attr_name == "additional_properties" and attr_desc["key"] == '': + if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: serialized.update(target_obj.additional_properties) continue @@ -575,68 +615,60 @@ def _serialize(self, target_obj, data_type=None, **kwargs): orig_attr = getattr(target_obj, attr) if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) keys = keys if isinstance(keys, list) else [keys] - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) - + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) if is_xml_model_serialization: - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) - xml_prefix = xml_desc.get('prefix', None) - xml_ns = xml_desc.get('ns', None) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if 'name' not in getattr(orig_attr, '_xml_map', {}): + if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace + if len(splitted_tag) == 2: # Namespace new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary - local_node = _create_xml_node( - xml_name, - xml_prefix, - xml_ns - ) + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format( - attr_name, class_name, str(target_obj)) + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise_with_traceback(SerializationError, msg, err) else: return serialized @@ -652,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip('[]{}') - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -668,19 +700,18 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: deserializer.key_extractors = [ rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor + last_rest_key_case_insensitive_extractor, ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback( - SerializationError, "Unable to build a model: "+str(err), err) + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) return self._serialize(data, data_type, **kwargs) @@ -695,13 +726,13 @@ def url(self, name, data, data_type, **kwargs): """ try: output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -720,27 +751,19 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [ - self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" - for d - in data - ] - if not kwargs.get('skip_quote', False): - data = [ - quote(str(d), safe='') - for d - in data - ] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] return str(self.serialize_iter(data, internal_data_type, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -756,11 +779,11 @@ def header(self, name, data, data_type, **kwargs): :raises: ValueError if data is None """ try: - if data_type in ['[str]']: + if data_type in ["[str]"]: data = ["" if d is None else d for d in data] output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) @@ -782,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -796,13 +821,11 @@ def serialize_data(self, data, data_type, **kwargs): iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: - return self.serialize_type[iter_type]( - data, data_type[1:-1], **kwargs) + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback( - SerializationError, msg.format(data, data_type), err) + raise_with_traceback(SerializationError, msg.format(data, data_type), err) else: return self._serialize(data, **kwargs) @@ -829,7 +852,7 @@ def serialize_basic(cls, data, data_type, **kwargs): custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) - if data_type == 'str': + if data_type == "str": return cls.serialize_unicode(data) return eval(data_type)(data) # nosec @@ -847,7 +870,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -886,25 +909,21 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialized.append(None) if div: - serialized = ['' if s is None else str(s) for s in serialized] + serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) - if 'xml' in serialization_ctxt or is_xml: + if "xml" in serialization_ctxt or is_xml: # XML serialization is more complicated - xml_desc = serialization_ctxt.get('xml', {}) - xml_name = xml_desc.get('name') + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") if not xml_name: - xml_name = serialization_ctxt['key'] + xml_name = serialization_ctxt["key"] # Create a wrap node if necessary (use the fact that Element and list have "append") is_wrapped = xml_desc.get("wrapped", False) node_name = xml_desc.get("itemsName", xml_name) if is_wrapped: - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) else: final_result = [] # All list elements to "local_node" @@ -912,11 +931,7 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): if isinstance(el, ET.Element): el_node = el else: - el_node = _create_xml_node( - node_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) if el is not None: # Otherwise it writes "None" :-p el_node.text = str(el) final_result.append(el_node) @@ -936,21 +951,16 @@ def serialize_dict(self, attr, dict_type, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_data( - value, dict_type, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None - if 'xml' in serialization_ctxt: + if "xml" in serialization_ctxt: # XML serialization is more complicated - xml_desc = serialization_ctxt['xml'] - xml_name = xml_desc['name'] + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) for key, value in serialized.items(): ET.SubElement(final_result, key).text = value return final_result @@ -996,8 +1006,7 @@ def serialize_object(self, attr, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_object( - value, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None return serialized @@ -1006,8 +1015,7 @@ def serialize_object(self, attr, **kwargs): serialized = [] for obj in attr: try: - serialized.append(self.serialize_object( - obj, **kwargs)) + serialized.append(self.serialize_object(obj, **kwargs)) except ValueError: pass return serialized @@ -1020,10 +1028,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1045,8 +1053,8 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr).decode('ascii') - return encoded.strip('=').replace('+', '-').replace('/', '_') + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod def serialize_decimal(attr, **kwargs): @@ -1113,16 +1121,20 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], utc.tm_mday, - Serializer.months[utc.tm_mon], utc.tm_year, - utc.tm_hour, utc.tm_min, utc.tm_sec) + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) @staticmethod def serialize_iso(attr, **kwargs): @@ -1136,19 +1148,18 @@ def serialize_iso(attr, **kwargs): attr = isodate.parse_datetime(attr) try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") - microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") if microseconds: - microseconds = '.'+microseconds + microseconds = "." + microseconds date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, - utc.tm_hour, utc.tm_min, utc.tm_sec) - return date + microseconds + 'Z' + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) @@ -1169,18 +1180,19 @@ def serialize_unix(attr, **kwargs): return attr try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") + def rest_key_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: - dict_keys = _FLATTEN.split(key) + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1191,15 +1203,16 @@ def rest_key_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) return working_data.get(key) + def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1211,30 +1224,33 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) if working_data: return attribute_key_case_insensitive_extractor(key, None, working_data) + def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - """ - key = attr_desc['key'] + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) + def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" """ - key = attr_desc['key'] + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + def attribute_key_extractor(attr, _, data): return data.get(attr) + def attribute_key_case_insensitive_extractor(attr, _, data): found_key = None lower_attr = attr.lower() @@ -1245,6 +1261,7 @@ def attribute_key_case_insensitive_extractor(attr, _, data): return data.get(found_key) + def _extract_name_from_internal_type(internal_type): """Given an internal type XML description, extract correct XML name with namespace. @@ -1253,7 +1270,7 @@ def _extract_name_from_internal_type(internal_type): :returns: A tuple XML name + namespace dict """ internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1268,17 +1285,17 @@ def xml_key_extractor(attr, attr_desc, data): if not isinstance(data, ET.Element): return None - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) # Look for a children - is_iter_type = attr_desc['type'].startswith("[") + is_iter_type = attr_desc["type"].startswith("[") is_wrapped = xml_desc.get("wrapped", False) internal_type = attr_desc.get("internalType", None) internal_type_xml_map = getattr(internal_type, "_xml_map", {}) # Integrate namespace if necessary - xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1294,15 +1311,15 @@ def xml_key_extractor(attr, attr_desc, data): # - Wrapped node # - Internal type is an enum (considered basic types) # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): children = data.findall(xml_name) # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: xml_name = _extract_name_from_internal_type(internal_type) children = data.findall(xml_name) # That's an array else: - if internal_type: # Complex type, ignore itemsName and use the complex type name + if internal_type: # Complex type, ignore itemsName and use the complex type name items_name = _extract_name_from_internal_type(internal_type) else: items_name = xml_desc.get("itemsName", xml_name) @@ -1311,21 +1328,22 @@ def xml_key_extractor(attr, attr_desc, data): if len(children) == 0: if is_iter_type: if is_wrapped: - return None # is_wrapped no node, we want None + return None # is_wrapped no node, we want None else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) + else: # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name - )) + ) + ) return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty @@ -1333,6 +1351,7 @@ def xml_key_extractor(attr, attr_desc, data): raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) return children[0] + class Deserializer(object): """Response object model deserializer. @@ -1340,37 +1359,32 @@ class Deserializer(object): :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. """ - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile( - r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' - r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { - 'iso-8601': Deserializer.deserialize_iso, - 'rfc-1123': Deserializer.deserialize_rfc, - 'unix-time': Deserializer.deserialize_unix, - 'duration': Deserializer.deserialize_duration, - 'date': Deserializer.deserialize_date, - 'time': Deserializer.deserialize_time, - 'decimal': Deserializer.deserialize_decimal, - 'long': Deserializer.deserialize_long, - 'bytearray': Deserializer.deserialize_bytearray, - 'base64': Deserializer.deserialize_base64, - 'object': self.deserialize_object, - '[]': self.deserialize_iter, - '{}': self.deserialize_dict - } + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } self.deserialize_expected_types = { - 'duration': (isodate.Duration, datetime.timedelta), - 'iso-8601': (datetime.datetime) + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [ - rest_key_extractor, - xml_key_extractor - ] + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much # complicated, with no real scenario for now. @@ -1403,8 +1417,7 @@ def _deserialize(self, target_obj, data): """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, '_validation', {}).items() - if config.get('constant')] + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: for attr, mapconfig in data._attribute_map.items(): if attr in constants: @@ -1412,15 +1425,11 @@ def _deserialize(self, target_obj, data): value = getattr(data, attr) if value is None: continue - local_type = mapconfig['type'] - internal_data_type = local_type.strip('[]{}') + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): continue - setattr( - data, - attr, - self._deserialize(local_type, value) - ) + setattr(data, attr, self._deserialize(local_type, value)) return data except AttributeError: return @@ -1435,16 +1444,16 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == '': + if attr == "additional_properties" and attr_desc["key"] == "": continue raw_value = None # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip('[]{}') + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") if internal_data_type in self.dependencies: attr_desc["internalType"] = self.dependencies[internal_data_type] @@ -1452,21 +1461,18 @@ def _deserialize(self, target_obj, data): found_value = key_extractor(attr, attr_desc, data) if found_value is not None: if raw_value is not None and raw_value != found_value: - msg = ("Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" ) - _LOGGER.warning( - msg, - found_value, - key_extractor, - attr + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning(msg, found_value, key_extractor, attr) continue raw_value = found_value - value = self.deserialize_data(raw_value, attr_desc['type']) + value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1475,14 +1481,17 @@ def _deserialize(self, target_obj, data): def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": # Check empty string. If it's not empty, someone has a real "additionalProperties" return None if isinstance(data, ET.Element): data = {el.tag: el.text for el in data} - known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) - for desc in attribute_map.values() if desc['key'] != ''} + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } present_keys = set(data.keys()) missing_keys = present_keys - known_keys return {key: data[key] for key in missing_keys} @@ -1493,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1508,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1518,15 +1527,14 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: return self(target_obj, data, content_type=content_type) except: _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None @@ -1554,22 +1562,16 @@ def _unpack_content(raw_data, content_type=None): return context[RawDeserializer.CONTEXT_NAME] raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - #Assume this is enough to recognize universal_http.ClientResponse without importing it + # Assume this is enough to recognize universal_http.ClientResponse without importing it if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text(), - raw_data.headers - ) + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, '_content_consumed'): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text, - raw_data.headers - ) + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1579,14 +1581,11 @@ def _instantiate_model(self, response, attrs, additional_properties=None): :param d_attrs: The deserialized response attributes. """ if callable(response): - subtype = getattr(response, '_subtype_map', {}) + subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() - if v.get('readonly')] - const = [k for k, v in response._validation.items() - if v.get('constant')] - kwargs = {k: v for k, v in attrs.items() - if k not in subtype and k not in readonly + const} + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) @@ -1594,8 +1593,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format( - kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1659,13 +1657,10 @@ def deserialize_iter(self, attr, iter_type): """ if attr is None: return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children + if isinstance(attr, ET.Element): # If I receive an element here, get the children attr = list(attr) if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( - iter_type, - type(attr) - )) + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) return [self.deserialize_data(a, iter_type) for a in attr] def deserialize_dict(self, attr, dict_type): @@ -1677,7 +1672,7 @@ def deserialize_dict(self, attr, dict_type): :rtype: dict """ if isinstance(attr, list): - return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} if isinstance(attr, ET.Element): # Transform value into {"Key": "value"} @@ -1698,7 +1693,7 @@ def deserialize_object(self, attr, **kwargs): # Do no recurse on XML, just return the tree as-is return attr if isinstance(attr, basestring): - return self.deserialize_basic(attr, 'str') + return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: return self.deserialize_basic(attr, self.basic_types[obj_type]) @@ -1709,8 +1704,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = {} for key, value in attr.items(): try: - deserialized[key] = self.deserialize_object( - value, **kwargs) + deserialized[key] = self.deserialize_object(value, **kwargs) except ValueError: deserialized[key] = None return deserialized @@ -1719,8 +1713,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = [] for obj in attr: try: - deserialized.append(self.deserialize_object( - obj, **kwargs)) + deserialized.append(self.deserialize_object(obj, **kwargs)) except ValueError: pass return deserialized @@ -1747,23 +1740,23 @@ def deserialize_basic(self, attr, data_type): if not attr: if data_type == "str": # None or '', node is empty string. - return '' + return "" else: # None or '', node with a strong type is None. # Don't try to model "empty bool" or "empty int" return None - if data_type == 'bool': + if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) elif isinstance(attr, basestring): - if attr.lower() in ['true', '1']: + if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ['false', '0']: + elif attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) - if data_type == 'str': + if data_type == "str": return self.deserialize_unicode(attr) return eval(data_type)(attr) # nosec @@ -1782,7 +1775,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1833,7 +1826,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1845,9 +1838,9 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = '=' * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace('-', '+').replace('_', '/') + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @staticmethod @@ -1861,7 +1854,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1876,7 +1869,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1890,7 +1883,7 @@ def deserialize_duration(attr): attr = attr.text try: duration = isodate.parse_duration(attr) - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1906,7 +1899,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1921,7 +1914,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1936,10 +1929,9 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], - tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -1960,12 +1952,12 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) - check_decimal = attr.split('.') + check_decimal = attr.split(".") if len(check_decimal) > 1: decimal_str = "" for digit in check_decimal[1]: @@ -1980,7 +1972,7 @@ def deserialize_iso(attr): test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1996,7 +1988,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_version.py index 63bcd0444b12..535d2f36bd9c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_client.py index f0f6bd291330..f915e16913fc 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_client.py @@ -117,7 +117,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = AuthorizationManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_configuration.py index 502298fa4957..a9ce559ac2cf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_configuration.py @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_client.py index 741bc9176d54..b4ee79f796c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ClassicAdministratorsOperations @@ -54,7 +54,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -84,15 +84,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_configuration.py index f4e0aa46402a..4242158b1dc2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01") # type: str + api_version: Literal["2015-06-01"] = kwargs.pop("api_version", "2015-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_metadata.json index cfef4806a84d..aa6ebd5cdd75 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -99,4 +107,4 @@ "operation_groups": { "classic_administrators": "ClassicAdministratorsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_client.py index 7cdba0c76b93..b0130382535d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ClassicAdministratorsOperations @@ -54,7 +54,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -91,5 +91,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_configuration.py index eb55f967b883..c3c0d6a7df15 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01") # type: str + api_version: Literal["2015-06-01"] = kwargs.pop("api_version", "2015-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/__init__.py index 9e01044d00f2..eb44c2838d09 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._classic_administrators_operations import ClassicAdministratorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_operations.py index 49501032e89b..4fb7f9ae3332 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._classic_administrators_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClassicAdministratorListResult] + api_version: Literal["2015-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01")) + cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -88,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -105,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ClassicAdministratorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -125,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py index 2880be4b9399..22ce374ed7ae 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py @@ -12,7 +12,7 @@ from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py index d03ac48443d6..1062cba94c1a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization @@ -47,8 +47,8 @@ def __init__( type: Optional[str] = None, email_address: Optional[str] = None, role: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the administrator. :paramtype id: str @@ -84,8 +84,12 @@ class ClassicAdministratorListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ClassicAdministrator"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ClassicAdministrator"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of administrators. :paramtype value: list[~azure.mgmt.authorization.v2015_06_01.models.ClassicAdministrator] @@ -118,7 +122,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -159,7 +163,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -170,7 +174,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail @@ -180,7 +185,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py index 9e01044d00f2..eb44c2838d09 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._classic_administrators_operations import ClassicAdministratorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py index e9efdd59d626..d9121b8c3c46 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01")) # type: str + api_version: Literal["2015-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,8 +100,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClassicAdministratorListResult] + api_version: Literal["2015-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01")) + cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,16 +122,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +146,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ClassicAdministratorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,4 +166,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_client.py index 78926d77a8f4..e6ed4720ac43 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -75,7 +75,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -118,15 +118,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_configuration.py index ca09948b8d42..fcc2b94f2916 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01") # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", "2015-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_metadata.json index ae96668f87bc..a3fd15ea9150 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -104,4 +112,4 @@ "role_assignments": "RoleAssignmentsOperations", "classic_administrators": "ClassicAdministratorsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_client.py index 1b1376b5421c..49e2dd5d81c0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -75,7 +75,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -125,5 +125,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_configuration.py index 2494b3a27155..287787077427 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01") # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", "2015-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/__init__.py index dc8d1317eb29..5e4c27bb4cc7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/__init__.py @@ -14,7 +14,7 @@ from ._classic_administrators_operations import ClassicAdministratorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_operations.py index 333247eafc86..f57a66eb146c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._classic_administrators_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClassicAdministratorListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -88,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -105,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ClassicAdministratorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -125,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_operations.py index 5b899a295704..cc8b6e516d0b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._global_administrator_operations import build_elevate_access_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,8 @@ async def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_elevate_access_request( api_version=api_version, @@ -80,9 +85,9 @@ async def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=incons params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -96,4 +101,4 @@ async def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=incons if cls: return cls(pipeline_response, None, {}) - elevate_access.metadata = {"url": "/providers/Microsoft.Authorization/elevateAccess"} # type: ignore + elevate_access.metadata = {"url": "/providers/Microsoft.Authorization/elevateAccess"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_operations.py index 41440ce2d7bb..fd7733456fbd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,8 +73,8 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -91,16 +96,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,13 +120,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -128,7 +140,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" + } @distributed_trace def list_for_resource( @@ -162,8 +176,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -189,16 +203,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -206,13 +227,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -226,4 +247,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_operations.py index 924ac5ccf614..2883bdba582b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._provider_operations_metadata_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadata] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) request = build_get_request( resource_provider_namespace=resource_provider_namespace, @@ -91,9 +96,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +116,7 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} @distributed_trace def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_models.ProviderOperationsMetadata"]: @@ -129,8 +134,8 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadataListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -151,16 +156,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -168,13 +180,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,4 +200,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_operations.py index 9cba2302967b..521c43a4f79d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -41,6 +42,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,8 +106,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,16 +134,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +158,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -166,7 +178,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -190,8 +204,8 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -214,16 +228,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -231,13 +252,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -251,7 +272,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace_async async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -277,8 +300,8 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -289,9 +312,9 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +334,7 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload async def create( @@ -399,8 +422,8 @@ async def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -422,9 +445,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -446,9 +469,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -466,7 +489,7 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: @@ -492,8 +515,8 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -504,9 +527,9 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -524,7 +547,7 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -552,8 +575,8 @@ async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_assignment_id=role_assignment_id, @@ -563,9 +586,9 @@ async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -585,7 +608,7 @@ async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional return deserialized - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload async def create_by_id( @@ -650,8 +673,8 @@ async def create_by_id( /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -673,9 +696,9 @@ async def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -696,9 +719,9 @@ async def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -716,7 +739,7 @@ async def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace_async async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssignment: @@ -744,8 +767,8 @@ async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.Rol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_assignment_id=role_assignment_id, @@ -755,9 +778,9 @@ async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.Rol params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -775,7 +798,7 @@ async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.Rol return deserialized - get_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleAssignment"]: @@ -794,8 +817,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -817,16 +840,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -834,13 +864,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -854,7 +884,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -877,8 +907,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -900,16 +930,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -917,13 +954,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -937,4 +974,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_operations.py index 9093cc69aea3..a477aaa4886f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,8 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleDefinition]] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -95,9 +100,9 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,7 +122,7 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace_async async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -143,8 +148,8 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -155,9 +160,9 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -175,7 +180,7 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @overload async def create_or_update( @@ -241,8 +246,8 @@ async def create_or_update( :type scope: str :param role_definition_id: The ID of the role definition. Required. :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a model type or a IO - type. Required. + :param role_definition: The values for the role definition. Is either a RoleDefinition type or + a IO type. Required. :type role_definition: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -263,9 +268,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -287,9 +292,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -307,7 +312,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]: @@ -327,8 +332,8 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -350,16 +355,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -367,13 +379,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -387,7 +399,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} @distributed_trace_async async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -415,8 +427,8 @@ async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.Rol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( role_definition_id=role_definition_id, @@ -426,9 +438,9 @@ async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.Rol params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -446,4 +458,4 @@ async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.Rol return deserialized - get_by_id.metadata = {"url": "/{roleDefinitionId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleDefinitionId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py index 6081c8853a04..476bc48f5b50 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py @@ -27,7 +27,7 @@ from ._models_py3 import RoleDefinitionFilter from ._models_py3 import RoleDefinitionListResult from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py index 4328a93efcd0..6cb02fbd54fe 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py @@ -12,13 +12,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -53,8 +54,8 @@ def __init__( type: Optional[str] = None, email_address: Optional[str] = None, role: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the administrator. :paramtype id: str @@ -90,8 +91,12 @@ class ClassicAdministratorListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ClassicAdministrator"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ClassicAdministrator"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of administrators. :paramtype value: list[~azure.mgmt.authorization.v2015_07_01.models.ClassicAdministrator] @@ -124,7 +129,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -165,7 +170,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -176,7 +181,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2015_07_01.models.ErrorDetail @@ -186,7 +192,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2015_07_01.models.ErrorDetail @@ -209,7 +215,9 @@ class Permission(_serialization.Model): "not_actions": {"key": "notActions", "type": "[str]"}, } - def __init__(self, *, actions: Optional[List[str]] = None, not_actions: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, actions: Optional[List[str]] = None, not_actions: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword actions: Allowed actions. :paramtype actions: list[str] @@ -236,8 +244,8 @@ class PermissionGetResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of permissions. :paramtype value: list[~azure.mgmt.authorization.v2015_07_01.models.Permission] @@ -280,8 +288,8 @@ def __init__( description: Optional[str] = None, origin: Optional[str] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The operation name. :paramtype name: str @@ -337,8 +345,8 @@ def __init__( display_name: Optional[str] = None, resource_types: Optional[List["_models.ResourceType"]] = None, operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The provider id. :paramtype id: str @@ -381,8 +389,8 @@ def __init__( *, value: Optional[List["_models.ProviderOperationsMetadata"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The list of providers. :paramtype value: list[~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadata] @@ -417,8 +425,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The resource type name. :paramtype name: str @@ -462,7 +470,9 @@ class RoleAssignment(_serialization.Model): "properties": {"key": "properties", "type": "RoleAssignmentPropertiesWithScope"}, } - def __init__(self, *, properties: Optional["_models.RoleAssignmentPropertiesWithScope"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.RoleAssignmentPropertiesWithScope"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Role assignment properties. :paramtype properties: @@ -492,7 +502,7 @@ class RoleAssignmentCreateParameters(_serialization.Model): "properties": {"key": "properties", "type": "RoleAssignmentProperties"}, } - def __init__(self, *, properties: "_models.RoleAssignmentProperties", **kwargs): + def __init__(self, *, properties: "_models.RoleAssignmentProperties", **kwargs: Any) -> None: """ :keyword properties: Role assignment properties. Required. :paramtype properties: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentProperties @@ -512,7 +522,7 @@ class RoleAssignmentFilter(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str @@ -536,8 +546,8 @@ class RoleAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Role assignment list. :paramtype value: list[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] @@ -571,7 +581,7 @@ class RoleAssignmentProperties(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, } - def __init__(self, *, role_definition_id: str, principal_id: str, **kwargs): + def __init__(self, *, role_definition_id: str, principal_id: str, **kwargs: Any) -> None: """ :keyword role_definition_id: The role definition ID used in the role assignment. Required. :paramtype role_definition_id: str @@ -607,8 +617,8 @@ def __init__( scope: Optional[str] = None, role_definition_id: Optional[str] = None, principal_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment scope. :paramtype scope: str @@ -671,8 +681,8 @@ def __init__( role_type: Optional[str] = None, permissions: Optional[List["_models.Permission"]] = None, assignable_scopes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_name: The role name. :paramtype role_name: str @@ -707,7 +717,7 @@ class RoleDefinitionFilter(_serialization.Model): "role_name": {"key": "roleName", "type": "str"}, } - def __init__(self, *, role_name: Optional[str] = None, **kwargs): + def __init__(self, *, role_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword role_name: Returns role definition with the specific name. :paramtype role_name: str @@ -731,8 +741,8 @@ class RoleDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Role definition list. :paramtype value: list[~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py index dc8d1317eb29..5e4c27bb4cc7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py @@ -14,7 +14,7 @@ from ._classic_administrators_operations import ClassicAdministratorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py index fe5faa4cf503..ec8b10a97f71 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,8 +100,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClassicAdministratorListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,16 +122,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +146,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ClassicAdministratorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,4 +166,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py index 01c8652445e8..9481b88e8715 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_elevate_access_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,8 +97,8 @@ def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_elevate_access_request( api_version=api_version, @@ -102,9 +107,9 @@ def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,4 +123,4 @@ def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=inconsistent if cls: return cls(pipeline_response, None, {}) - elevate_access.metadata = {"url": "/providers/Microsoft.Authorization/elevateAccess"} # type: ignore + elevate_access.metadata = {"url": "/providers/Microsoft.Authorization/elevateAccess"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py index fcd696d6e14e..e37cea284e49 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +83,7 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +102,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,8 +147,8 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -165,16 +170,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -182,13 +194,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -202,7 +214,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" + } @distributed_trace def list_for_resource( @@ -235,8 +249,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -262,16 +276,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -279,13 +300,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -299,4 +320,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py index 4025fada096a..15a62f4e79ef 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,7 +73,7 @@ def build_list_request(*, expand: str = "resourceTypes", **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,8 +135,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadata] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) request = build_get_request( resource_provider_namespace=resource_provider_namespace, @@ -142,9 +147,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -162,7 +167,7 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} @distributed_trace def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_models.ProviderOperationsMetadata"]: @@ -180,8 +185,8 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadataListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -202,16 +207,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -219,13 +231,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,4 +251,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py index 9816ed8cc941..98cf324bea85 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +74,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -88,7 +93,7 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +108,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -120,7 +125,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +135,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,8 +150,8 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +161,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +178,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +188,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -198,7 +203,7 @@ def build_delete_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +212,7 @@ def build_delete_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,8 +227,8 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +237,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +254,7 @@ def build_get_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,7 +263,7 @@ def build_get_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpReque "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -273,7 +278,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +289,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -301,7 +306,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +315,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -379,8 +384,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -407,16 +412,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -424,13 +436,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +456,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -468,8 +482,8 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -492,16 +506,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -509,13 +530,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -529,7 +550,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -555,8 +578,8 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -567,9 +590,9 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +612,7 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload def create( @@ -677,8 +700,8 @@ def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -700,9 +723,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -724,9 +747,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -744,7 +767,7 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: @@ -770,8 +793,8 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -782,9 +805,9 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -802,7 +825,7 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -830,8 +853,8 @@ def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_assignment_id=role_assignment_id, @@ -841,9 +864,9 @@ def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -863,7 +886,7 @@ def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_mode return deserialized - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload def create_by_id( @@ -928,8 +951,8 @@ def create_by_id( /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -951,9 +974,9 @@ def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -974,9 +997,9 @@ def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -994,7 +1017,7 @@ def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssignment: @@ -1022,8 +1045,8 @@ def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssig _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_assignment_id=role_assignment_id, @@ -1033,9 +1056,9 @@ def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssig params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1053,7 +1076,7 @@ def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssig return deserialized - get_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleAssignment"]: @@ -1072,8 +1095,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1095,16 +1118,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1112,13 +1142,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1132,7 +1162,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -1155,8 +1185,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1178,16 +1208,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1195,13 +1232,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1215,4 +1252,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py index 77504630828f..97618562794c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +55,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,7 +70,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +80,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,8 +95,8 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +106,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +123,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +132,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -144,7 +149,7 @@ def build_get_by_id_request(role_definition_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +158,7 @@ def build_get_by_id_request(role_definition_id: str, **kwargs: Any) -> HttpReque "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,8 +212,8 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleDefinition]] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -219,9 +224,9 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -241,7 +246,7 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -267,8 +272,8 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -279,9 +284,9 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -299,7 +304,7 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @overload def create_or_update( @@ -365,8 +370,8 @@ def create_or_update( :type scope: str :param role_definition_id: The ID of the role definition. Required. :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a model type or a IO - type. Required. + :param role_definition: The values for the role definition. Is either a RoleDefinition type or + a IO type. Required. :type role_definition: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -387,9 +392,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -411,9 +416,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -431,7 +436,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]: @@ -451,8 +456,8 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -474,16 +479,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -491,13 +503,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -511,7 +523,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} @distributed_trace def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -539,8 +551,8 @@ def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2015-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( role_definition_id=role_definition_id, @@ -550,9 +562,9 @@ def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefin params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -570,4 +582,4 @@ def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefin return deserialized - get_by_id.metadata = {"url": "/{roleDefinitionId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleDefinitionId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_client.py index 45a20f313676..ea40c166091c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -66,7 +66,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -103,15 +103,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_configuration.py index 2eb0f4a2715b..c4bac4cd99e0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-01-01-preview") # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop("api_version", "2018-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_metadata.json index f439dbba8f9f..9a806fbd35d2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -102,4 +110,4 @@ "permissions": "PermissionsOperations", "role_definitions": "RoleDefinitionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_client.py index 414d979c0f47..b56d53d0ed69 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -66,7 +66,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -110,5 +110,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_configuration.py index a94cae2aa4d2..d08362782f39 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-01-01-preview") # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop("api_version", "2018-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/__init__.py index 88276b0bfd94..0185ff6c9bb0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/__init__.py @@ -12,7 +12,7 @@ from ._role_definitions_operations import RoleDefinitionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py index b1955371b476..eb29dae42535 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,8 +73,10 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -91,16 +98,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -128,7 +142,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" + } @distributed_trace def list_for_resource( @@ -162,8 +178,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -189,16 +207,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -206,13 +231,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -226,4 +251,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_operations.py index efa1c118d233..0be63a1243c4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._provider_operations_metadata_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadata] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) request = build_get_request( resource_provider_namespace=resource_provider_namespace, @@ -91,9 +98,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,7 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} @distributed_trace def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_models.ProviderOperationsMetadata"]: @@ -129,8 +136,10 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadataListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -151,16 +160,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -168,13 +184,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,4 +204,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_operations.py index e64ff2d7ea23..6d9771dab898 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -41,6 +42,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,8 +106,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,16 +136,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +160,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -166,7 +180,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -190,8 +206,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -214,16 +232,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -231,13 +256,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -251,7 +276,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace_async async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -277,8 +304,10 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -289,9 +318,9 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +340,7 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload async def create( @@ -400,8 +429,8 @@ async def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -423,9 +452,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -447,9 +478,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -467,7 +498,7 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: @@ -493,8 +524,10 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -505,9 +538,9 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -525,7 +558,7 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -549,8 +582,10 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_id=role_id, @@ -560,9 +595,9 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -582,7 +617,7 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro return deserialized - delete_by_id.metadata = {"url": "/{roleId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleId}"} @overload async def create_by_id( @@ -636,8 +671,8 @@ async def create_by_id( :param role_id: The ID of the role assignment to create. Required. :type role_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -659,9 +694,11 @@ async def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -682,9 +719,9 @@ async def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -702,7 +739,7 @@ async def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleId}"} @distributed_trace_async async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: @@ -726,8 +763,10 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -737,9 +776,9 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -757,7 +796,7 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleAssignment"]: @@ -776,8 +815,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -799,16 +840,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -816,13 +864,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -836,7 +884,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -859,8 +907,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -882,16 +932,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -899,13 +956,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -919,4 +976,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_operations.py index 1c743fbda7b7..9ef999483de9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleDefinition]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -95,9 +102,9 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,7 +124,7 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace_async async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -143,8 +150,10 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -155,9 +164,9 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -175,7 +184,7 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @overload async def create_or_update( @@ -241,8 +250,8 @@ async def create_or_update( :type scope: str :param role_definition_id: The ID of the role definition. Required. :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a model type or a IO - type. Required. + :param role_definition: The values for the role definition. Is either a RoleDefinition type or + a IO type. Required. :type role_definition: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -264,9 +273,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -288,9 +299,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -308,7 +319,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]: @@ -328,8 +339,10 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -351,16 +364,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -368,13 +388,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -388,7 +408,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} @distributed_trace_async async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -416,8 +436,10 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -427,9 +449,9 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -447,4 +469,4 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py index 31dede27de75..402dae854cc4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py @@ -23,7 +23,7 @@ from ._models_py3 import RoleDefinitionFilter from ._models_py3 import RoleDefinitionListResult from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py index 3e95a2460325..03998151c3c9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py @@ -12,13 +12,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -43,7 +44,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -84,7 +85,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -95,7 +96,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorDetail @@ -105,7 +107,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorDetail @@ -141,8 +143,8 @@ def __init__( not_actions: Optional[List[str]] = None, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Allowed actions. :paramtype actions: list[str] @@ -175,8 +177,8 @@ class PermissionGetResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of permissions. :paramtype value: list[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission] @@ -223,8 +225,8 @@ def __init__( origin: Optional[str] = None, properties: Optional[JSON] = None, is_data_action: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The operation name. :paramtype name: str @@ -285,8 +287,8 @@ def __init__( display_name: Optional[str] = None, resource_types: Optional[List["_models.ResourceType"]] = None, operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The provider id. :paramtype id: str @@ -332,8 +334,8 @@ def __init__( *, value: Optional[List["_models.ProviderOperationsMetadata"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The list of providers. :paramtype value: @@ -370,8 +372,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The resource type name. :paramtype name: str @@ -431,8 +433,8 @@ def __init__( role_definition_id: Optional[str] = None, principal_id: Optional[str] = None, can_delegate: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment scope. :paramtype scope: str @@ -478,7 +480,9 @@ class RoleAssignmentCreateParameters(_serialization.Model): "can_delegate": {"key": "properties.canDelegate", "type": "bool"}, } - def __init__(self, *, role_definition_id: str, principal_id: str, can_delegate: Optional[bool] = None, **kwargs): + def __init__( + self, *, role_definition_id: str, principal_id: str, can_delegate: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID used in the role assignment. Required. :paramtype role_definition_id: str @@ -508,7 +512,9 @@ class RoleAssignmentFilter(_serialization.Model): "can_delegate": {"key": "canDelegate", "type": "bool"}, } - def __init__(self, *, principal_id: Optional[str] = None, can_delegate: Optional[bool] = None, **kwargs): + def __init__( + self, *, principal_id: Optional[str] = None, can_delegate: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str @@ -535,8 +541,8 @@ class RoleAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Role assignment list. :paramtype value: list[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] @@ -596,8 +602,8 @@ def __init__( role_type: Optional[str] = None, permissions: Optional[List["_models.Permission"]] = None, assignable_scopes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_name: The role name. :paramtype role_name: str @@ -635,7 +641,7 @@ class RoleDefinitionFilter(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, role_name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, role_name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword role_name: Returns role definition with the specific name. :paramtype role_name: str @@ -662,8 +668,8 @@ class RoleDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Role definition list. :paramtype value: list[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py index 88276b0bfd94..0185ff6c9bb0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py @@ -12,7 +12,7 @@ from ._role_definitions_operations import RoleDefinitionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py index df3bd3932900..0abda985ccc8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +85,9 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +108,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,8 +154,10 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -168,16 +179,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -185,13 +203,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,7 +223,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" + } @distributed_trace def list_for_resource( @@ -239,8 +259,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -266,16 +288,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -283,13 +312,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -303,4 +332,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py index 8b7173f18219..c88498b5bd7c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +77,9 @@ def build_list_request(*, expand: str = "resourceTypes", **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,8 +141,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadata] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) request = build_get_request( resource_provider_namespace=resource_provider_namespace, @@ -144,9 +155,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,7 +175,7 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} @distributed_trace def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_models.ProviderOperationsMetadata"]: @@ -182,8 +193,10 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadataListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -204,16 +217,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -221,13 +241,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -241,4 +261,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py index 17fbec816a1f..25978061ec6c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,9 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +78,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -90,7 +97,9 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +114,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +131,9 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +143,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,8 +158,10 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +171,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +188,9 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +200,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -200,7 +215,9 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,7 +226,7 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,8 +241,10 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +253,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,7 +270,9 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -260,7 +281,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +296,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +309,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -303,7 +326,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,7 +337,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -381,8 +406,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -409,16 +436,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -426,13 +460,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -446,7 +480,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -470,8 +506,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -494,16 +532,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -511,13 +556,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -531,7 +576,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -557,8 +604,10 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -569,9 +618,9 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -591,7 +640,7 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload def create( @@ -680,8 +729,8 @@ def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -703,9 +752,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -727,9 +778,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -747,7 +798,7 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: @@ -773,8 +824,10 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -785,9 +838,9 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -805,7 +858,7 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -829,8 +882,10 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_id=role_id, @@ -840,9 +895,9 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -862,7 +917,7 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi return deserialized - delete_by_id.metadata = {"url": "/{roleId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleId}"} @overload def create_by_id( @@ -916,8 +971,8 @@ def create_by_id( :param role_id: The ID of the role assignment to create. Required. :type role_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -939,9 +994,11 @@ def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -962,9 +1019,9 @@ def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -982,7 +1039,7 @@ def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: @@ -1006,8 +1063,10 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -1017,9 +1076,9 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1037,7 +1096,7 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleAssignment"]: @@ -1056,8 +1115,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1079,16 +1140,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1096,13 +1164,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1116,7 +1184,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -1139,8 +1207,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1162,16 +1232,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1179,13 +1256,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1199,4 +1276,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py index 68700b13c8ff..98b6c777bf47 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +57,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,7 +72,9 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +84,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,8 +99,10 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +112,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +129,9 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +140,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -144,7 +157,9 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +168,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,8 +222,10 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleDefinition]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -219,9 +236,9 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -241,7 +258,7 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -267,8 +284,10 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -279,9 +298,9 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -299,7 +318,7 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @overload def create_or_update( @@ -365,8 +384,8 @@ def create_or_update( :type scope: str :param role_definition_id: The ID of the role definition. Required. :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a model type or a IO - type. Required. + :param role_definition: The values for the role definition. Is either a RoleDefinition type or + a IO type. Required. :type role_definition: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -388,9 +407,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -412,9 +433,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -432,7 +453,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]: @@ -452,8 +473,10 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -475,16 +498,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -492,13 +522,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -512,7 +542,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} @distributed_trace def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -540,8 +570,10 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -551,9 +583,9 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -571,4 +603,4 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py index 1809788a3d16..ce3df4b2254b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -87,7 +87,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -141,15 +141,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py index 5ebeec3f5a83..11f434ff7c4c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-05-01-preview") # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop("api_version", "2018-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_metadata.json index 73b4e50e9931..aefc25530dbf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -107,4 +115,4 @@ "access_review_instances_assigned_for_my_approval": "AccessReviewInstancesAssignedForMyApprovalOperations", "access_review_instance_my_decisions": "AccessReviewInstanceMyDecisionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_client.py index 7612f2b6d18d..0aa7a1ab1e25 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -87,7 +87,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -148,5 +148,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_configuration.py index f3f281185604..e5741020ed1b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-05-01-preview") # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop("api_version", "2018-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py index 2ed7cbae216b..0bb9a6bebd04 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py @@ -21,7 +21,7 @@ from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_operations.py index 65dc2dd6ea33..5f04ecd25f16 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._access_review_default_settings_operations import build_get_request, build_put_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,10 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -81,9 +88,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -101,7 +108,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload async def put( @@ -144,8 +153,8 @@ async def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -167,9 +176,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -190,9 +201,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,4 +221,6 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_operations.py index f77bae8a3575..11dca1734914 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instance_decisions_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -96,16 +103,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -113,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,4 +147,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py index 74391fd06e17..61a7cc154296 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_patch_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,8 +82,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,16 +107,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +151,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace_async async def get_by_id( @@ -167,8 +183,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -180,9 +198,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,7 +218,9 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload async def patch( @@ -280,8 +300,8 @@ async def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -303,9 +323,11 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -328,9 +350,9 @@ async def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -348,4 +370,6 @@ async def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_operations.py index 83d0bc9c4408..374c89342fae 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -95,9 +102,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,9 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace_async async def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -139,8 +148,10 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -152,9 +163,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -168,7 +179,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace_async async def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -196,8 +209,10 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -209,9 +224,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -225,7 +240,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace_async async def send_reminders( # pylint: disable=inconsistent-return-statements @@ -253,8 +270,10 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -266,9 +285,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -282,7 +301,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace_async async def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -310,8 +331,10 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -322,9 +345,9 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -338,4 +361,6 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py index ee4ba247b570..1da679427135 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,10 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,16 +101,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,7 +145,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -157,8 +173,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -169,9 +187,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -189,4 +207,6 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_operations.py index 2db6374d42a3..7e49cad7a141 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instances_operations import build_get_by_id_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,8 +74,10 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,16 +99,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -109,13 +123,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -129,7 +143,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -155,8 +171,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -168,9 +186,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -188,4 +206,6 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index 05e1c3aa8bec..d30961112329 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_schedule_definitions_assigned_for_my_approval_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,8 +71,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AccessReviewScheduleDefi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -87,16 +94,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -104,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -124,4 +138,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_operations.py index cb6f84b1f701..adf406d950e4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,8 +78,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AccessReviewScheduleDefi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,16 +102,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,7 +146,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -156,8 +172,10 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -168,9 +186,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -188,7 +206,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -214,8 +234,10 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -226,9 +248,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -242,7 +264,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload async def create_or_update_by_id( @@ -299,8 +323,8 @@ async def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -323,9 +347,11 @@ async def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -347,9 +373,9 @@ async def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -367,7 +393,9 @@ async def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def stop( # pylint: disable=inconsistent-return-statements @@ -393,8 +421,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -405,9 +435,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -421,4 +451,6 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_operations.py index 246fb2ada880..220805ed8b9a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,8 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -86,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -103,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py index b555500e3ca2..62c0a076e536 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py @@ -40,7 +40,7 @@ from ._authorization_management_client_enums import DecisionTargetType from ._authorization_management_client_enums import DefaultDecisionType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py index 35479109a8a8..1440b3c8986f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -138,8 +138,8 @@ def __init__( *, decision: Optional[Union[str, "_models.AccessReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -167,7 +167,7 @@ def __init__( self.principal_type_properties_reviewed_by_principal_type = None self.principal_name_properties_reviewed_by_principal_name = None self.user_principal_name_properties_reviewed_by_user_principal_name = None - self.type_properties_target_type = None # type: Optional[str] + self.type_properties_target_type: Optional[str] = None class AccessReviewDecisionListResult(_serialization.Model): @@ -185,8 +185,12 @@ class AccessReviewDecisionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewDecision"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewDecision"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Decision list. :paramtype value: @@ -287,8 +291,8 @@ def __init__( *, decision: Optional[Union[str, "_models.AccessReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -313,7 +317,7 @@ def __init__( self.principal_type_reviewed_by_principal_type = None self.principal_name_reviewed_by_principal_name = None self.user_principal_name_reviewed_by_user_principal_name = None - self.type = None # type: Optional[str] + self.type: Optional[str] = None class AccessReviewDecisionTarget(_serialization.Model): @@ -339,10 +343,10 @@ class AccessReviewDecisionTarget(_serialization.Model): _subtype_map = {"type": {"servicePrincipal": "ServicePrincipalDecisionTarget", "user": "UserDecisionTarget"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None class AccessReviewDefaultSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -448,8 +452,8 @@ def __init__( Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -560,8 +564,8 @@ def __init__( *, start_date_time: Optional[datetime.datetime] = None, end_date_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: The DateTime when the review instance is scheduled to be start. :paramtype start_date_time: ~datetime.datetime @@ -592,8 +596,12 @@ class AccessReviewInstanceListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewInstance"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Instance list. :paramtype value: @@ -628,7 +636,7 @@ class AccessReviewReviewer(_serialization.Model): "principal_type": {"key": "principalType", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: The id of the reviewer(user/servicePrincipal). :paramtype principal_id: str @@ -825,8 +833,8 @@ def __init__( # pylint: disable=too-many-locals Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -943,8 +951,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewScheduleDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review Schedule Definition list. :paramtype value: @@ -1116,8 +1124,8 @@ def __init__( # pylint: disable=too-many-locals end_date: Optional[datetime.datetime] = None, type_settings_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -1293,8 +1301,8 @@ def __init__( end_date: Optional[datetime.datetime] = None, type_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -1370,7 +1378,7 @@ class ErrorDefinition(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinitionProperties"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs: Any) -> None: """ :keyword error: Error of the list gateway status. :paramtype error: @@ -1400,7 +1408,7 @@ class ErrorDefinitionProperties(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code of list gateway. :paramtype code: str @@ -1437,8 +1445,8 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -1485,7 +1493,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1508,7 +1516,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.authorization.v2018_05_01_preview.models.Operation] @@ -1552,10 +1562,10 @@ class ServicePrincipalDecisionTarget(AccessReviewDecisionTarget): "app_id": {"key": "appId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "servicePrincipal" # type: str + self.type: str = "servicePrincipal" self.principal_id = None self.principal_name = None self.app_id = None @@ -1593,10 +1603,10 @@ class UserDecisionTarget(AccessReviewDecisionTarget): "user_principal_name": {"key": "userPrincipalName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "user" # type: str + self.type: str = "user" self.principal_id = None self.principal_name = None self.user_principal_name = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py index 2ed7cbae216b..0bb9a6bebd04 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py @@ -21,7 +21,7 @@ from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py index 5868fcfc85ea..7a38a356f575 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +57,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,8 +72,10 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +87,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,8 +139,10 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -141,9 +152,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -161,7 +172,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload def put( @@ -204,8 +217,8 @@ def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -227,9 +240,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -250,9 +265,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +285,6 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py index fbc8aede25eb..128faf85f680 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,8 +109,10 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,16 +135,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -143,13 +159,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -163,4 +179,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py index 4f74b93be30b..441c9a38197b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,7 +75,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,8 +106,10 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +123,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,8 +173,10 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,16 +198,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -202,13 +222,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -222,7 +242,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace def get_by_id( @@ -252,8 +274,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -265,9 +289,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -285,7 +309,9 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload def patch( @@ -365,8 +391,8 @@ def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -388,9 +414,11 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -413,9 +441,9 @@ def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -433,4 +461,6 @@ def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py index 52cb1d9fc285..dfb30661c7b3 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_reset_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +92,7 @@ def build_reset_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +109,9 @@ def build_apply_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +125,7 @@ def build_apply_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +142,9 @@ def build_send_reminders_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +158,7 @@ def build_send_reminders_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +173,9 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +188,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,8 +244,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -242,9 +259,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +275,9 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -286,8 +305,10 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -299,9 +320,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +336,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -343,8 +366,10 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -356,9 +381,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -372,7 +397,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace def send_reminders( # pylint: disable=inconsistent-return-statements @@ -400,8 +427,10 @@ def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -413,9 +442,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,7 +458,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -457,8 +488,10 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -469,9 +502,9 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -485,4 +518,6 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py index 836331f4cca8..a075d2b4b7b0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(schedule_definition_id: str, **kwargs: Any) -> HttpReques "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +74,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +89,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +135,10 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -148,16 +159,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -165,13 +183,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -185,7 +203,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -211,8 +231,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -223,9 +245,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -243,4 +265,6 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py index a54a6c24d73d..a300e37bc52b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_list_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,7 +75,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,8 +137,10 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -151,16 +162,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -168,13 +186,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,7 +206,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -214,8 +234,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -227,9 +249,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -247,4 +269,6 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index 494e70f11dc8..d1d10cb9b866 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,8 +95,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinitio _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,16 +118,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +142,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,4 +162,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py index cba325380587..11cc419021f2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +74,9 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +89,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,7 +104,9 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +119,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,8 +136,10 @@ def build_create_or_update_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +152,7 @@ def build_create_or_update_by_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,7 +169,9 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +184,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,8 +228,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinitio _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -235,16 +252,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -252,13 +276,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -272,7 +296,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -296,8 +322,10 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -308,9 +336,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -328,7 +356,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -354,8 +384,10 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -366,9 +398,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -382,7 +414,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload def create_or_update_by_id( @@ -439,8 +473,8 @@ def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -463,9 +497,11 @@ def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -487,9 +523,9 @@ def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -507,7 +543,9 @@ def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def stop( # pylint: disable=inconsistent-return-statements @@ -533,8 +571,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -545,9 +585,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -561,4 +601,6 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py index 213e2d503735..32eaeb999c6d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,8 +94,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-05-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-05-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,16 +117,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +141,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,4 +161,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_client.py index 25571d732e13..5cd2b7ff925f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import DenyAssignmentsOperations @@ -54,7 +54,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -84,15 +84,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_configuration.py index ba36ff26b3f6..bbcb89ce542d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-07-01-preview") # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop("api_version", "2018-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_metadata.json index b3aba2436812..92e1896abe79 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -99,4 +107,4 @@ "operation_groups": { "deny_assignments": "DenyAssignmentsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_client.py index 9431541b6d63..924e1a8eb9fd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import DenyAssignmentsOperations @@ -54,7 +54,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -91,5 +91,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_configuration.py index 623797489983..4d5f43b46e4c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-07-01-preview") # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop("api_version", "2018-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/__init__.py index 590e6d32085d..9118a306bbaa 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._deny_assignments_operations import DenyAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_operations.py index f0627b5b6eeb..83c5fe7ce1bf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,8 +109,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,16 +139,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -149,13 +163,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -169,7 +183,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list_for_resource_group( @@ -200,8 +216,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -224,16 +242,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -241,13 +266,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -261,7 +286,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.DenyAssignment"]: @@ -287,8 +314,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -310,16 +339,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -327,13 +363,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -347,7 +383,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} @distributed_trace_async async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -373,8 +409,10 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -385,9 +423,9 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +443,7 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} @distributed_trace_async async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -433,8 +471,10 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( deny_assignment_id=deny_assignment_id, @@ -444,9 +484,9 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +504,7 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den return deserialized - get_by_id.metadata = {"url": "/{denyAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{denyAssignmentId}"} @distributed_trace def list_for_scope( @@ -494,8 +534,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -517,16 +559,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -534,13 +583,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -554,4 +603,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py index f7ab42f8b402..c01af9a96f46 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py @@ -15,7 +15,7 @@ from ._models_py3 import ErrorResponse from ._models_py3 import Principal from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py index 7cdcc357e35b..0d2f93fa38ae 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization @@ -80,8 +80,8 @@ def __init__( principals: Optional[List["_models.Principal"]] = None, exclude_principals: Optional[List["_models.Principal"]] = None, is_system_protected: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword deny_assignment_name: The display name of the deny assignment. :paramtype deny_assignment_name: str @@ -143,8 +143,8 @@ def __init__( deny_assignment_name: Optional[str] = None, principal_id: Optional[str] = None, gdpr_export_principal_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword deny_assignment_name: Return deny assignment with specified name. :paramtype deny_assignment_name: str @@ -176,8 +176,8 @@ class DenyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DenyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DenyAssignment"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Deny assignment list. :paramtype value: list[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment] @@ -217,8 +217,8 @@ def __init__( not_actions: Optional[List[str]] = None, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Actions to which the deny assignment does not grant access. :paramtype actions: list[str] @@ -258,7 +258,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -299,7 +299,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -310,7 +310,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorDetail @@ -320,7 +321,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorDetail @@ -356,8 +357,8 @@ def __init__( display_name: Optional[str] = None, type: Optional[str] = None, email: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the principal made changes. :paramtype id: str diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/__init__.py index 590e6d32085d..9118a306bbaa 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._deny_assignments_operations import DenyAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py index 0f13a8bdb899..c2001be55816 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,9 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +78,7 @@ def build_list_for_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +97,9 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +114,7 @@ def build_list_for_resource_group_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,7 +131,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +144,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,7 +161,9 @@ def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +173,7 @@ def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> Htt "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +188,9 @@ def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +199,7 @@ def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpReque "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +214,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +225,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -284,8 +301,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -312,16 +331,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -329,13 +355,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -349,7 +375,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list_for_resource_group( @@ -380,8 +408,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -404,16 +434,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -421,13 +458,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,7 +478,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.DenyAssignment"]: @@ -467,8 +506,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -490,16 +531,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -507,13 +555,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -527,7 +575,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} @distributed_trace def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -553,8 +601,10 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -565,9 +615,9 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -585,7 +635,7 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} @distributed_trace def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -613,8 +663,10 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( deny_assignment_id=deny_assignment_id, @@ -624,9 +676,9 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -644,7 +696,7 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig return deserialized - get_by_id.metadata = {"url": "/{denyAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{denyAssignmentId}"} @distributed_trace def list_for_scope( @@ -674,8 +726,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2018-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-07-01-preview") + ) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -697,16 +751,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -714,13 +775,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -734,4 +795,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_client.py index 2b5fe0b7c6cf..4e9bb5925287 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import RoleAssignmentsOperations @@ -53,7 +53,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -83,15 +83,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_configuration.py index 511ac76fb69b..2e3a8e14a14a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-09-01-preview") # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop("api_version", "2018-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_metadata.json index 90923eb42d7d..a6c48bf89a75 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -99,4 +107,4 @@ "operation_groups": { "role_assignments": "RoleAssignmentsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_client.py index a80803a2efeb..450a81c81356 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import RoleAssignmentsOperations @@ -53,7 +53,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -90,5 +90,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_configuration.py index caf1b9fdc96d..d316d94eec2e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-09-01-preview") # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop("api_version", "2018-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/__init__.py index 3b7b5d5c2721..0d22b3a23897 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._role_assignments_operations import RoleAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_operations.py index c8e52cba4b8f..9f635d880d56 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -41,6 +42,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,8 +106,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,16 +136,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +160,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -166,7 +180,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -190,8 +206,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -214,16 +232,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -231,13 +256,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -251,7 +276,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace_async async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -277,8 +304,10 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -289,9 +318,9 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +340,7 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload async def create( @@ -400,8 +429,8 @@ async def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -423,9 +452,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -447,9 +478,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -467,7 +498,7 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: @@ -493,8 +524,10 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -505,9 +538,9 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -525,7 +558,7 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -549,8 +582,10 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_id=role_id, @@ -560,9 +595,9 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -582,7 +617,7 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro return deserialized - delete_by_id.metadata = {"url": "/{roleId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleId}"} @overload async def create_by_id( @@ -636,8 +671,8 @@ async def create_by_id( :param role_id: The ID of the role assignment to create. Required. :type role_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -659,9 +694,11 @@ async def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -682,9 +719,9 @@ async def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -702,7 +739,7 @@ async def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleId}"} @distributed_trace_async async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: @@ -726,8 +763,10 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -737,9 +776,9 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -757,7 +796,7 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleAssignment"]: @@ -776,8 +815,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -799,16 +840,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -816,13 +864,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -836,7 +884,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -859,8 +907,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -882,16 +932,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -899,13 +956,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -919,4 +976,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py index c44ad4c485a6..ca8ae3cbd5a1 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py @@ -16,7 +16,7 @@ from ._authorization_management_client_enums import PrincipalType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py index 78dc3345e488..ab4f4604c7cd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -37,7 +37,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -78,7 +78,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -89,7 +89,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorDetail @@ -99,7 +100,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorDetail @@ -158,8 +159,8 @@ def __init__( principal_id: Optional[str] = None, principal_type: Optional[Union[str, "_models.PrincipalType"]] = None, can_delegate: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment scope. :paramtype scope: str @@ -222,8 +223,8 @@ def __init__( principal_id: str, principal_type: Optional[Union[str, "_models.PrincipalType"]] = None, can_delegate: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID used in the role assignment. Required. :paramtype role_definition_id: str @@ -258,7 +259,9 @@ class RoleAssignmentFilter(_serialization.Model): "can_delegate": {"key": "canDelegate", "type": "bool"}, } - def __init__(self, *, principal_id: Optional[str] = None, can_delegate: Optional[bool] = None, **kwargs): + def __init__( + self, *, principal_id: Optional[str] = None, can_delegate: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str @@ -285,8 +288,8 @@ class RoleAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Role assignment list. :paramtype value: list[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/__init__.py index 3b7b5d5c2721..0d22b3a23897 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._role_assignments_operations import RoleAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py index 21dc63ea170e..61d1997f001e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,9 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +78,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -90,7 +97,9 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +114,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -122,7 +131,9 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +143,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,8 +158,10 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +171,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +188,9 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +200,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -200,7 +215,9 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,7 +226,7 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,8 +241,10 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +253,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,7 +270,9 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -260,7 +281,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +296,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +309,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -303,7 +326,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,7 +337,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -381,8 +406,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -409,16 +436,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -426,13 +460,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -446,7 +480,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -470,8 +506,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -494,16 +532,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -511,13 +556,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -531,7 +576,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -557,8 +604,10 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -569,9 +618,9 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -591,7 +640,7 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload def create( @@ -680,8 +729,8 @@ def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -703,9 +752,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -727,9 +778,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -747,7 +798,7 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: @@ -773,8 +824,10 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -785,9 +838,9 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -805,7 +858,7 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]: @@ -829,8 +882,10 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_id=role_id, @@ -840,9 +895,9 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -862,7 +917,7 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi return deserialized - delete_by_id.metadata = {"url": "/{roleId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleId}"} @overload def create_by_id( @@ -916,8 +971,8 @@ def create_by_id( :param role_id: The ID of the role assignment to create. Required. :type role_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -939,9 +994,11 @@ def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -962,9 +1019,9 @@ def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -982,7 +1039,7 @@ def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: @@ -1006,8 +1063,10 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -1017,9 +1076,9 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1037,7 +1096,7 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment: return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleAssignment"]: @@ -1056,8 +1115,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1079,16 +1140,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1096,13 +1164,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1116,7 +1184,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -1139,8 +1207,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2018-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-09-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1162,16 +1232,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1179,13 +1256,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1199,4 +1276,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_client.py index 1083218a30ba..f9f8c0a60a4f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import RoleAssignmentMetricsOperations @@ -53,7 +53,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -83,15 +83,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_configuration.py index 8724ba0d3d5e..0cd2e2fc51a3 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01-preview") # type: str + api_version: Literal["2019-08-01-preview"] = kwargs.pop("api_version", "2019-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_metadata.json index 77aac5fc6501..935618b6c875 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -99,4 +107,4 @@ "operation_groups": { "role_assignment_metrics": "RoleAssignmentMetricsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_client.py index e155a08766bd..c929eddddb3c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import RoleAssignmentMetricsOperations @@ -53,7 +53,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -90,5 +90,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_configuration.py index 6e7d2124318a..9a1813c34827 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01-preview") # type: str + api_version: Literal["2019-08-01-preview"] = kwargs.pop("api_version", "2019-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/__init__.py index 61c09223d665..b9b816cbd62e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._role_assignment_metrics_operations import RoleAssignmentMetricsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_operations.py index 84f0b6094479..dbf7da09f207 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._role_assignment_metrics_operations import build_get_metrics_for_subscription_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,10 @@ async def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssig _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentMetricsResult] + api_version: Literal["2019-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-08-01-preview") + ) + cls: ClsType[_models.RoleAssignmentMetricsResult] = kwargs.pop("cls", None) request = build_get_metrics_for_subscription_request( subscription_id=self._config.subscription_id, @@ -81,9 +88,9 @@ async def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssig params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -101,4 +108,6 @@ async def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssig return deserialized - get_metrics_for_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics"} # type: ignore + get_metrics_for_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py index bc45d64bf62c..9af825dd8848 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py @@ -11,7 +11,7 @@ from ._models_py3 import ErrorResponse from ._models_py3 import RoleAssignmentMetricsResult from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/_models_py3.py index 0020262403dd..0d8478057cff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from ... import _serialization @@ -37,7 +37,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -78,7 +78,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -89,7 +89,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2019_08_01_preview.models.ErrorDetail @@ -99,7 +100,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2019_08_01_preview.models.ErrorDetail @@ -137,7 +138,7 @@ class RoleAssignmentMetricsResult(_serialization.Model): "role_assignments_remaining_count": {"key": "roleAssignmentsRemainingCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subscription_id = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/__init__.py index 61c09223d665..b9b816cbd62e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._role_assignment_metrics_operations import RoleAssignmentMetricsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py index 4313cc50305f..98f4c3da5991 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_metrics_for_subscription_request(subscription_id: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01-preview")) # type: str + api_version: Literal["2019-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +56,7 @@ def build_get_metrics_for_subscription_request(subscription_id: str, **kwargs: A "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,8 +106,10 @@ def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssignmentM _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentMetricsResult] + api_version: Literal["2019-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-08-01-preview") + ) + cls: ClsType[_models.RoleAssignmentMetricsResult] = kwargs.pop("cls", None) request = build_get_metrics_for_subscription_request( subscription_id=self._config.subscription_id, @@ -110,9 +119,9 @@ def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssignmentM params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -130,4 +139,6 @@ def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssignmentM return deserialized - get_metrics_for_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics"} # type: ignore + get_metrics_for_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py index f6324930b890..8592aac5d41f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import RoleAssignmentsOperations @@ -53,7 +53,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -83,15 +83,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py index a42be946092f..c2371220e545 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-04-01-preview") # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop("api_version", "2020-04-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_metadata.json index 662d784476fc..6ff2f6e79701 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -99,4 +107,4 @@ "operation_groups": { "role_assignments": "RoleAssignmentsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_client.py index ef3ab491bda6..b20be67ae083 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import RoleAssignmentsOperations @@ -53,7 +53,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -90,5 +90,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_configuration.py index 528e17149abb..1e24eeec05ce 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-04-01-preview") # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop("api_version", "2020-04-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/__init__.py index 3b7b5d5c2721..0d22b3a23897 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._role_assignments_operations import RoleAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_operations.py index 13f6dec0ff7f..afcd87d8a6bd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -41,6 +42,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,8 +109,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,16 +140,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -150,13 +164,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -170,7 +184,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -196,8 +212,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -221,16 +239,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -238,13 +263,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -258,7 +283,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace_async async def delete( @@ -288,8 +315,10 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -301,9 +330,9 @@ async def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -323,7 +352,7 @@ async def delete( return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload async def create( @@ -412,8 +441,8 @@ async def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -435,9 +464,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,9 +490,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -479,7 +510,7 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def get( @@ -509,8 +540,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -522,9 +555,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -542,7 +575,7 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def delete_by_id( @@ -570,8 +603,10 @@ async def delete_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_id=role_id, @@ -582,9 +617,9 @@ async def delete_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -604,7 +639,7 @@ async def delete_by_id( return deserialized - delete_by_id.metadata = {"url": "/{roleId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleId}"} @overload async def create_by_id( @@ -658,8 +693,8 @@ async def create_by_id( :param role_id: The ID of the role assignment to create. Required. :type role_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -681,9 +716,11 @@ async def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -704,9 +741,9 @@ async def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -724,7 +761,7 @@ async def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleId}"} @distributed_trace_async async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> _models.RoleAssignment: @@ -750,8 +787,10 @@ async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -762,9 +801,9 @@ async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -782,7 +821,7 @@ async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwarg return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def list( @@ -805,8 +844,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -829,16 +870,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -846,13 +894,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -866,7 +914,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -891,8 +939,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -915,16 +965,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -932,13 +989,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -952,4 +1009,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py index c44ad4c485a6..ca8ae3cbd5a1 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py @@ -16,7 +16,7 @@ from ._authorization_management_client_enums import PrincipalType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py index fd8c02d51c6c..805b0304cbb9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -38,7 +38,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -79,7 +79,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -90,7 +90,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorDetail @@ -100,7 +101,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorDetail @@ -197,8 +198,8 @@ def __init__( created_by: Optional[str] = None, updated_by: Optional[str] = None, delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment scope. :paramtype scope: str @@ -310,8 +311,8 @@ def __init__( condition: Optional[str] = None, condition_version: Optional[str] = None, delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID used in the role assignment. Required. :paramtype role_definition_id: str @@ -361,7 +362,9 @@ class RoleAssignmentFilter(_serialization.Model): "can_delegate": {"key": "canDelegate", "type": "bool"}, } - def __init__(self, *, principal_id: Optional[str] = None, can_delegate: Optional[bool] = None, **kwargs): + def __init__( + self, *, principal_id: Optional[str] = None, can_delegate: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str @@ -388,8 +391,8 @@ class RoleAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Role assignment list. :paramtype value: list[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py index 3b7b5d5c2721..0d22b3a23897 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._role_assignments_operations import RoleAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py index b0d27b11d526..94763a477338 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,9 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +79,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -98,7 +105,9 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +122,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -134,7 +143,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +155,7 @@ def build_delete_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,8 +172,10 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +185,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,7 +204,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +216,7 @@ def build_get_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,7 +233,9 @@ def build_delete_by_id_request(role_id: str, *, tenant_id: Optional[str] = None, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -227,7 +244,7 @@ def build_delete_by_id_request(role_id: str, *, tenant_id: Optional[str] = None, "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -244,8 +261,10 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +273,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -271,7 +290,9 @@ def build_get_by_id_request(role_id: str, *, tenant_id: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,7 +301,7 @@ def build_get_by_id_request(role_id: str, *, tenant_id: Optional[str] = None, ** "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -299,7 +320,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +333,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -331,7 +354,9 @@ def build_list_for_scope_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +365,7 @@ def build_list_for_scope_request( "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -414,8 +439,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -443,16 +470,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -460,13 +494,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -480,7 +514,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -506,8 +542,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -531,16 +569,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -548,13 +593,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -568,7 +613,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def delete( @@ -598,8 +645,10 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -611,9 +660,9 @@ def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -633,7 +682,7 @@ def delete( return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload def create( @@ -722,8 +771,8 @@ def create( :param role_assignment_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -745,9 +794,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -769,9 +820,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -789,7 +840,7 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def get( @@ -819,8 +870,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -832,9 +885,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -852,7 +905,7 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def delete_by_id( @@ -880,8 +933,10 @@ def delete_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_id=role_id, @@ -892,9 +947,9 @@ def delete_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -914,7 +969,7 @@ def delete_by_id( return deserialized - delete_by_id.metadata = {"url": "/{roleId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleId}"} @overload def create_by_id( @@ -968,8 +1023,8 @@ def create_by_id( :param role_id: The ID of the role assignment to create. Required. :type role_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -991,9 +1046,11 @@ def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1014,9 +1071,9 @@ def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1034,7 +1091,7 @@ def create_by_id( return deserialized - create_by_id.metadata = {"url": "/{roleId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> _models.RoleAssignment: @@ -1060,8 +1117,10 @@ def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -1072,9 +1131,9 @@ def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1092,7 +1151,7 @@ def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} @distributed_trace def list( @@ -1115,8 +1174,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1139,16 +1200,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1156,13 +1224,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1176,7 +1244,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def list_for_scope( @@ -1201,8 +1269,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-04-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-04-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1225,16 +1295,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1242,13 +1319,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1262,4 +1339,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_client.py index 397a326166d1..009040715eaf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -80,7 +80,7 @@ def __init__( self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -134,15 +134,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_configuration.py index c4a52b09f711..376ee2739847 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -34,7 +40,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-10-01") # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", "2020-10-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_metadata.json index 15e1f81b0488..29397fd61b07 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -95,4 +102,4 @@ "role_management_policies": "RoleManagementPoliciesOperations", "role_management_policy_assignments": "RoleManagementPolicyAssignmentsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_client.py index a315f4ed9df7..aefa1773d7c9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -80,7 +80,7 @@ def __init__( self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -141,5 +141,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_configuration.py index 19bf4398fdc5..809ef8b4e808 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,7 +40,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-10-01") # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", "2020-10-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py index 53e733602baa..31a4ba4b86ec 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py @@ -17,7 +17,7 @@ from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_resources_operations.py index a30e682a9494..5c3e5b4c39fe 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_resources_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_resources_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._eligible_child_resources_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,8 +80,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EligibleChildResourcesListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,16 +103,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -115,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EligibleChildResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,4 +146,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_operations.py index ab4ae525a7e2..f649b6676fa7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._role_assignment_schedule_instances_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstanceListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,16 +106,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +130,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +149,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} @distributed_trace_async async def get( @@ -166,8 +178,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstance] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -178,9 +190,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +209,6 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_operations.py index f4488f2ea60d..389b882a2554 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_validate_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -145,8 +150,8 @@ async def create( :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role assignment schedule request. Is either a + RoleAssignmentScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -168,9 +173,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -192,9 +197,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -211,7 +216,9 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace_async async def get( @@ -240,8 +247,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -252,9 +259,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -271,7 +278,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -299,8 +308,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequestListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -322,16 +331,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -339,13 +355,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -358,7 +374,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} @distributed_trace_async async def cancel( # pylint: disable=inconsistent-return-statements @@ -387,8 +403,8 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -399,9 +415,9 @@ async def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,7 +430,9 @@ async def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" + } @overload async def validate( @@ -487,8 +505,8 @@ async def validate( :param role_assignment_schedule_request_name: The name of the role assignment request to validate. Required. :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role assignment schedule request. Is either a + RoleAssignmentScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -510,9 +528,9 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -534,9 +552,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -553,4 +571,6 @@ async def validate( return deserialized - validate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate"} # type: ignore + validate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_operations.py index 8632c1348a3a..92fa28b17c66 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._role_assignment_schedules_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentSchedule] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -92,9 +97,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +116,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" + } @distributed_trace def list_for_scope( @@ -138,8 +145,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -161,16 +168,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +192,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,4 +211,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_operations.py index 1addcecc8cff..7db4bbc62cb4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_list_for_scope_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstanceListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,16 +109,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +152,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} @distributed_trace_async async def get( @@ -169,8 +181,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstance] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -181,9 +193,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,4 +212,6 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_operations.py index 509c518b93b3..4849d8d9e1e5 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_validate_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -145,8 +150,8 @@ async def create( :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It can be any valid GUID. Required. :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role eligibility schedule request. Is either a + RoleEligibilityScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -168,9 +173,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -192,9 +197,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -211,7 +216,9 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace_async async def get( @@ -240,8 +247,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -252,9 +259,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -271,7 +278,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -299,8 +308,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequestListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -322,16 +331,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -339,13 +355,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -358,7 +374,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} @distributed_trace_async async def cancel( # pylint: disable=inconsistent-return-statements @@ -387,8 +403,8 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -399,9 +415,9 @@ async def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,7 +430,9 @@ async def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" + } @overload async def validate( @@ -487,8 +505,8 @@ async def validate( :param role_eligibility_schedule_request_name: The name of the role eligibility request to validate. Required. :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role eligibility schedule request. Is either a + RoleEligibilityScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -510,9 +528,9 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -534,9 +552,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -553,4 +571,6 @@ async def validate( return deserialized - validate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate"} # type: ignore + validate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_operations.py index 573ec559964c..be3e24b02060 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._role_eligibility_schedules_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilitySchedule] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -92,9 +97,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +116,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" + } @distributed_trace def list_for_scope( @@ -138,8 +145,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -161,16 +168,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +192,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,4 +211,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_operations.py index f81040e97167..86646fb1a1ca 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,8 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -95,9 +100,9 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -114,7 +119,9 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @overload async def update( @@ -187,8 +194,8 @@ async def update( :param role_management_policy_name: The name (guid) of the role management policy to upsert. Required. :type role_management_policy_name: str - :param parameters: Parameters for the role management policy. Is either a model type or a IO - type. Required. + :param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -209,9 +216,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,9 +240,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -252,7 +259,9 @@ async def update( return deserialized - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + update.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -281,8 +290,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -293,9 +302,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -308,7 +317,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicy"]: @@ -326,8 +337,8 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -348,16 +359,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -365,13 +383,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -384,4 +402,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_operations.py index b0b097fbddf5..441a34de92f9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_for_scope_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -97,9 +102,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -116,7 +121,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @overload async def create( @@ -189,8 +196,8 @@ async def create( :param role_management_policy_assignment_name: The name of format {guid_guid} the role management policy assignment to upsert. Required. :type role_management_policy_assignment_name: str - :param parameters: Parameters for the role management policy assignment. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role management policy assignment. Is either a + RoleManagementPolicyAssignment type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -212,9 +219,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -236,9 +243,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -255,7 +262,9 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -284,8 +293,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -296,9 +305,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +320,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicyAssignment"]: @@ -329,8 +340,8 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignmentListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -351,16 +362,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -368,13 +386,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -387,4 +405,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py index ef957fbb40f8..1f18506a6b36 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py @@ -74,7 +74,7 @@ from ._authorization_management_client_enums import Type from ._authorization_management_client_enums import UserType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/_models_py3.py index fbaefb8b5e24..bdd139feaa79 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -51,8 +51,8 @@ def __init__( is_requestor_justification_required: Optional[bool] = None, approval_mode: Optional[Union[str, "_models.ApprovalMode"]] = None, approval_stages: Optional[List["_models.ApprovalStage"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_approval_required: Determines whether approval is required or not. :paramtype is_approval_required: bool @@ -114,8 +114,8 @@ def __init__( primary_approvers: Optional[List["_models.UserSet"]] = None, is_escalation_enabled: Optional[bool] = None, escalation_approvers: Optional[List["_models.UserSet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword approval_stage_time_out_in_days: The time in days when approval request would be timed out. @@ -158,7 +158,7 @@ class CloudErrorBody(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -197,7 +197,7 @@ class EligibleChildResource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -224,8 +224,8 @@ def __init__( *, value: Optional[List["_models.EligibleChildResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Eligible child resource list. :paramtype value: list[~azure.mgmt.authorization.v2020_10_01.models.EligibleChildResource] @@ -261,8 +261,8 @@ def __init__( scope: Optional["_models.ExpandedPropertiesScope"] = None, role_definition: Optional["_models.ExpandedPropertiesRoleDefinition"] = None, principal: Optional["_models.ExpandedPropertiesPrincipal"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: Details of the resource scope. :paramtype scope: ~azure.mgmt.authorization.v2020_10_01.models.ExpandedPropertiesScope @@ -305,8 +305,8 @@ def __init__( display_name: Optional[str] = None, email: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the principal. :paramtype id: str @@ -347,8 +347,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the role definition. :paramtype id: str @@ -386,8 +386,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Scope id of the resource. :paramtype id: str @@ -429,8 +429,8 @@ def __init__( not_actions: Optional[List[str]] = None, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Allowed actions. :paramtype actions: list[str] @@ -472,8 +472,8 @@ def __init__( scope: Optional["_models.PolicyAssignmentPropertiesScope"] = None, role_definition: Optional["_models.PolicyAssignmentPropertiesRoleDefinition"] = None, policy: Optional["_models.PolicyAssignmentPropertiesPolicy"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: Details of the resource scope. :paramtype scope: ~azure.mgmt.authorization.v2020_10_01.models.PolicyAssignmentPropertiesScope @@ -518,8 +518,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin last_modified_date_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the policy. :paramtype id: str @@ -555,8 +555,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the role definition. :paramtype id: str @@ -594,8 +594,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Scope id of the resource. :paramtype id: str @@ -627,7 +627,7 @@ class PolicyProperties(_serialization.Model): "scope": {"key": "scope", "type": "PolicyPropertiesScope"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.scope = None @@ -656,8 +656,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Scope id of the resource. :paramtype id: str @@ -699,8 +699,8 @@ def __init__( display_name: Optional[str] = None, type: Optional[str] = None, email: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the principal made changes. :paramtype id: str @@ -823,8 +823,8 @@ def __init__( created_on: Optional[datetime.datetime] = None, updated_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment schedule scope. :paramtype scope: str @@ -917,8 +917,8 @@ def __init__( principal_id: Optional[str] = None, role_definition_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment schedule of the specific principal. :paramtype principal_id: str @@ -1044,8 +1044,8 @@ def __init__( condition_version: Optional[str] = None, created_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment schedule scope. :paramtype scope: str @@ -1146,8 +1146,8 @@ def __init__( role_definition_id: Optional[str] = None, status: Optional[str] = None, role_assignment_schedule_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment schedule instances of the specific principal. :paramtype principal_id: str @@ -1187,8 +1187,8 @@ def __init__( *, value: Optional[List["_models.RoleAssignmentScheduleInstance"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role assignment schedule instance list. :paramtype value: @@ -1220,8 +1220,8 @@ def __init__( *, value: Optional[List["_models.RoleAssignmentSchedule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role assignment schedule list. :paramtype value: list[~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentSchedule] @@ -1355,8 +1355,8 @@ def __init__( ticket_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesTicketInfo"] = None, condition: Optional[str] = None, condition_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str @@ -1442,8 +1442,8 @@ def __init__( role_definition_id: Optional[str] = None, requestor_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment requests of the specific principal. :paramtype principal_id: str @@ -1481,8 +1481,8 @@ def __init__( *, value: Optional[List["_models.RoleAssignmentScheduleRequest"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role assignment schedule request list. :paramtype value: @@ -1515,8 +1515,8 @@ def __init__( *, start_date_time: Optional[datetime.datetime] = None, expiration: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: Start DateTime of the role assignment schedule. :paramtype start_date_time: ~datetime.datetime @@ -1553,8 +1553,8 @@ def __init__( type: Optional[Union[str, "_models.Type"]] = None, end_date_time: Optional[datetime.datetime] = None, duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of the role assignment schedule expiration. Known values are: "AfterDuration", "AfterDateTime", and "NoExpiration". @@ -1584,7 +1584,9 @@ class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model): "ticket_system": {"key": "ticketSystem", "type": "str"}, } - def __init__(self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs): + def __init__( + self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword ticket_number: Ticket number for the role assignment. :paramtype ticket_number: str @@ -1691,8 +1693,8 @@ def __init__( created_on: Optional[datetime.datetime] = None, updated_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role eligibility schedule scope. :paramtype scope: str @@ -1777,8 +1779,8 @@ def __init__( principal_id: Optional[str] = None, role_definition_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role eligibility schedule of the specific principal. :paramtype principal_id: str @@ -1883,8 +1885,8 @@ def __init__( condition_version: Optional[str] = None, created_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role eligibility schedule scope. :paramtype scope: str @@ -1971,8 +1973,8 @@ def __init__( role_definition_id: Optional[str] = None, status: Optional[str] = None, role_eligibility_schedule_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role eligibility schedule instances of the specific principal. :paramtype principal_id: str @@ -2012,8 +2014,8 @@ def __init__( *, value: Optional[List["_models.RoleEligibilityScheduleInstance"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role eligibility schedule instance list. :paramtype value: @@ -2045,8 +2047,8 @@ def __init__( *, value: Optional[List["_models.RoleEligibilitySchedule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: role eligibility schedule list. :paramtype value: list[~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilitySchedule] @@ -2175,8 +2177,8 @@ def __init__( ticket_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesTicketInfo"] = None, condition: Optional[str] = None, condition_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str @@ -2258,8 +2260,8 @@ def __init__( role_definition_id: Optional[str] = None, requestor_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role eligibility requests of the specific principal. :paramtype principal_id: str @@ -2297,8 +2299,8 @@ def __init__( *, value: Optional[List["_models.RoleEligibilityScheduleRequest"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role eligibility schedule request list. :paramtype value: @@ -2331,8 +2333,8 @@ def __init__( *, start_date_time: Optional[datetime.datetime] = None, expiration: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: Start DateTime of the role eligibility schedule. :paramtype start_date_time: ~datetime.datetime @@ -2369,8 +2371,8 @@ def __init__( type: Optional[Union[str, "_models.Type"]] = None, end_date_time: Optional[datetime.datetime] = None, duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of the role eligibility schedule expiration. Known values are: "AfterDuration", "AfterDateTime", and "NoExpiration". @@ -2400,7 +2402,9 @@ class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model): "ticket_system": {"key": "ticketSystem", "type": "str"}, } - def __init__(self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs): + def __init__( + self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword ticket_number: Ticket number for the role eligibility. :paramtype ticket_number: str @@ -2477,8 +2481,8 @@ def __init__( description: Optional[str] = None, is_organization_default: Optional[bool] = None, rules: Optional[List["_models.RoleManagementPolicyRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role management policy scope. :paramtype scope: str @@ -2553,8 +2557,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -2563,7 +2567,7 @@ def __init__( """ super().__init__(**kwargs) self.id = id - self.rule_type = None # type: Optional[str] + self.rule_type: Optional[str] = None self.target = target @@ -2603,8 +2607,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, setting: Optional["_models.ApprovalSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -2614,7 +2618,7 @@ def __init__( :paramtype setting: ~azure.mgmt.authorization.v2020_10_01.models.ApprovalSettings """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyApprovalRule" # type: str + self.rule_type: str = "RoleManagementPolicyApprovalRule" self.setting = setting @@ -2671,8 +2675,8 @@ def __init__( scope: Optional[str] = None, role_definition_id: Optional[str] = None, policy_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role management policy scope. :paramtype scope: str @@ -2712,8 +2716,8 @@ def __init__( *, value: Optional[List["_models.RoleManagementPolicyAssignment"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role management policy assignment list. :paramtype value: @@ -2766,8 +2770,8 @@ def __init__( target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, is_enabled: Optional[bool] = None, claim_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -2779,7 +2783,7 @@ def __init__( :paramtype claim_value: str """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyAuthenticationContextRule" # type: str + self.rule_type: str = "RoleManagementPolicyAuthenticationContextRule" self.is_enabled = is_enabled self.claim_value = claim_value @@ -2821,8 +2825,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, enabled_rules: Optional[List[Union[str, "_models.EnablementRules"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -2833,7 +2837,7 @@ def __init__( ~azure.mgmt.authorization.v2020_10_01.models.EnablementRules] """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyEnablementRule" # type: str + self.rule_type: str = "RoleManagementPolicyEnablementRule" self.enabled_rules = enabled_rules @@ -2877,8 +2881,8 @@ def __init__( target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, is_expiration_required: Optional[bool] = None, maximum_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -2890,7 +2894,7 @@ def __init__( :paramtype maximum_duration: str """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyExpirationRule" # type: str + self.rule_type: str = "RoleManagementPolicyExpirationRule" self.is_expiration_required = is_expiration_required self.maximum_duration = maximum_duration @@ -2910,8 +2914,12 @@ class RoleManagementPolicyListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleManagementPolicy"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.RoleManagementPolicy"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Role management policy list. :paramtype value: list[~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy] @@ -2980,8 +2988,8 @@ def __init__( recipient_type: Optional[Union[str, "_models.RecipientType"]] = None, notification_recipients: Optional[List[str]] = None, is_default_recipients_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -3004,7 +3012,7 @@ def __init__( :paramtype is_default_recipients_enabled: bool """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyNotificationRule" # type: str + self.rule_type: str = "RoleManagementPolicyNotificationRule" self.notification_type = notification_type self.notification_level = notification_level self.recipient_type = recipient_type @@ -3047,8 +3055,8 @@ def __init__( target_objects: Optional[List[str]] = None, inheritable_settings: Optional[List[str]] = None, enforced_settings: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword caller: The caller of the setting. :paramtype caller: str @@ -3099,8 +3107,8 @@ def __init__( is_backup: Optional[bool] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_type: The type of user. Known values are: "User" and "Group". :paramtype user_type: str or ~azure.mgmt.authorization.v2020_10_01.models.UserType diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py index 53e733602baa..31a4ba4b86ec 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py @@ -17,7 +17,7 @@ from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py index babb8b816293..7e84a109922c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +54,7 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -102,8 +107,8 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EligibleChildResourcesListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,16 +130,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -142,13 +154,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EligibleChildResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,4 +173,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py index ba447575db0a..5bef3905b896 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +54,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -66,7 +71,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +86,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,8 +141,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstanceListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -159,16 +164,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +188,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,7 +207,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} @distributed_trace def get( @@ -224,8 +236,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstance] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -236,9 +248,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -255,4 +267,6 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py index ec1be49d323f..c91685e7f558 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,8 +45,8 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +61,7 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +78,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +93,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, ** ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +108,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +117,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -129,7 +134,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +149,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,8 +164,8 @@ def build_validate_request(scope: str, role_assignment_schedule_request_name: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +180,7 @@ def build_validate_request(scope: str, role_assignment_schedule_request_name: st ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -293,8 +298,8 @@ def create( :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role assignment schedule request. Is either a + RoleAssignmentScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -316,9 +321,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -340,9 +345,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -359,7 +364,9 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace def get( @@ -388,8 +395,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -400,9 +407,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -419,7 +426,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -447,8 +456,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequestListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -470,16 +479,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -487,13 +503,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -506,7 +522,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} @distributed_trace def cancel( # pylint: disable=inconsistent-return-statements @@ -535,8 +551,8 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -547,9 +563,9 @@ def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -562,7 +578,9 @@ def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" + } @overload def validate( @@ -635,8 +653,8 @@ def validate( :param role_assignment_schedule_request_name: The name of the role assignment request to validate. Required. :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role assignment schedule request. Is either a + RoleAssignmentScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -658,9 +676,9 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -682,9 +700,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -701,4 +719,6 @@ def validate( return deserialized - validate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate"} # type: ignore + validate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py index b8f2c1f688bf..5d19cf5cb051 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +75,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +84,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -136,8 +141,8 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentSchedule] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -148,9 +153,9 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -167,7 +172,9 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" + } @distributed_trace def list_for_scope( @@ -194,8 +201,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -217,16 +224,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -234,13 +248,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -253,4 +267,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py index fdec036dbbac..41cd6824f1b3 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +54,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -66,7 +71,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +86,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str, ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,8 +141,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstanceListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -159,16 +164,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +188,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,7 +207,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} @distributed_trace def get( @@ -224,8 +236,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstance] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -236,9 +248,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -255,4 +267,6 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py index 80415c24b3f2..2b3b6cc9c8c7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,8 +45,8 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +61,7 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +78,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +93,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +108,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +117,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -129,7 +134,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +149,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,8 +164,8 @@ def build_validate_request(scope: str, role_eligibility_schedule_request_name: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +180,7 @@ def build_validate_request(scope: str, role_eligibility_schedule_request_name: s ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -293,8 +298,8 @@ def create( :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It can be any valid GUID. Required. :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role eligibility schedule request. Is either a + RoleEligibilityScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -316,9 +321,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -340,9 +345,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -359,7 +364,9 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace def get( @@ -388,8 +395,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -400,9 +407,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -419,7 +426,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -447,8 +456,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequestListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -470,16 +479,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -487,13 +503,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -506,7 +522,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} @distributed_trace def cancel( # pylint: disable=inconsistent-return-statements @@ -535,8 +551,8 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -547,9 +563,9 @@ def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -562,7 +578,9 @@ def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" + } @overload def validate( @@ -635,8 +653,8 @@ def validate( :param role_eligibility_schedule_request_name: The name of the role eligibility request to validate. Required. :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role eligibility schedule request. Is either a + RoleEligibilityScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -658,9 +676,9 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -682,9 +700,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -701,4 +719,6 @@ def validate( return deserialized - validate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate"} # type: ignore + validate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py index cb3b0f6eb005..65a770fba628 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +75,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +84,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -136,8 +141,8 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilitySchedule] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -148,9 +153,9 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -167,7 +172,9 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" + } @distributed_trace def list_for_scope( @@ -194,8 +201,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -217,16 +224,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -234,13 +248,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -253,4 +267,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py index 78e288890b1d..1eda9081fddf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +72,8 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +85,7 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +102,7 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,7 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +129,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,8 +193,8 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -200,9 +205,9 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -219,7 +224,9 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @overload def update( @@ -292,8 +299,8 @@ def update( :param role_management_policy_name: The name (guid) of the role management policy to upsert. Required. :type role_management_policy_name: str - :param parameters: Parameters for the role management policy. Is either a model type or a IO - type. Required. + :param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -314,9 +321,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -338,9 +345,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -357,7 +364,9 @@ def update( return deserialized - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + update.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -386,8 +395,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -398,9 +407,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -413,7 +422,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicy"]: @@ -431,8 +442,8 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -453,16 +464,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -470,13 +488,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -489,4 +507,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py index 779aff60d74e..a6198f01e45a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,8 +75,8 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +91,7 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +108,7 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +123,7 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +138,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +147,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,8 +204,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -211,9 +216,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,7 +235,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @overload def create( @@ -303,8 +310,8 @@ def create( :param role_management_policy_assignment_name: The name of format {guid_guid} the role management policy assignment to upsert. Required. :type role_management_policy_assignment_name: str - :param parameters: Parameters for the role management policy assignment. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role management policy assignment. Is either a + RoleManagementPolicyAssignment type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -326,9 +333,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,9 +357,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -369,7 +376,9 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -398,8 +407,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -410,9 +419,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -425,7 +434,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicyAssignment"]: @@ -443,8 +454,8 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignmentListResult] + api_version: Literal["2020-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01")) + cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -465,16 +476,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -482,13 +500,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -501,4 +519,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_client.py index ba9327b59d3f..f8d8547f289a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -92,7 +92,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -149,15 +149,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_configuration.py index 8d58a6a56d8d..c842ed190345 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-10-01-preview") # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop("api_version", "2020-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_metadata.json index de12071396ec..90e687cae95a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -108,4 +116,4 @@ "role_management_policies": "RoleManagementPoliciesOperations", "role_management_policy_assignments": "RoleManagementPolicyAssignmentsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_client.py index 402f800c3412..2b42d5b78520 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -92,7 +92,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -156,5 +156,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_configuration.py index 76759d0c5f11..2f6a2af4da83 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-10-01-preview") # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop("api_version", "2020-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/__init__.py index baf561800ad2..c2480d05193e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/__init__.py @@ -18,7 +18,7 @@ from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_resources_operations.py index 7399c878a5e7..49c0593b1348 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_resources_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_resources_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._eligible_child_resources_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,8 +80,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EligibleChildResourcesListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,16 +105,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -115,13 +129,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EligibleChildResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,4 +148,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_operations.py index 043e4bf1976a..7ca83d1a84a9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._role_assignment_schedule_instances_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstanceListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,16 +108,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +132,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +151,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} @distributed_trace_async async def get( @@ -166,8 +180,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstance] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -178,9 +194,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +213,6 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py index 2a7f9a6fc080..8c8fb8978841 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_for_scope_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -148,8 +153,8 @@ async def create( :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role assignment schedule request. Is either a + RoleAssignmentScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -171,9 +176,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -195,9 +202,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -214,7 +221,9 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace_async async def get( @@ -243,8 +252,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -255,9 +266,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -274,7 +285,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -302,8 +315,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequestListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -325,16 +340,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -342,13 +364,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -361,7 +383,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} @distributed_trace_async async def cancel( # pylint: disable=inconsistent-return-statements @@ -390,8 +412,10 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -402,9 +426,9 @@ async def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -417,4 +441,6 @@ async def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_operations.py index c7702b5bd386..4f8d62e701d4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._role_assignment_schedules_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentSchedule] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -92,9 +99,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" + } @distributed_trace def list_for_scope( @@ -138,8 +147,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -161,16 +172,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +196,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,4 +215,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py index a873b099133b..27601acacb7c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -43,6 +44,10 @@ build_validate_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,8 +92,10 @@ def list_for_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,16 +118,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +142,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -148,7 +162,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -174,8 +190,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -199,16 +217,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +241,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -236,7 +261,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource( @@ -276,8 +303,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,16 +333,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -321,13 +357,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -341,7 +377,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace_async async def get( @@ -376,8 +414,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -389,9 +429,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -409,7 +449,7 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload async def create( @@ -495,8 +535,8 @@ async def create( :param role_assignment_name: The name of the role assignment. It can be any valid GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -518,9 +558,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -542,9 +584,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -562,11 +604,11 @@ async def create( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def delete( @@ -601,8 +643,10 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -614,9 +658,9 @@ async def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -636,7 +680,7 @@ async def delete( return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload async def validate( @@ -722,8 +766,8 @@ async def validate( :param role_assignment_name: The name of the role assignment. It can be any valid GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -745,9 +789,11 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidationResponse] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -769,9 +815,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -789,7 +835,9 @@ async def validate( return deserialized - validate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate"} # type: ignore + validate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate" + } @distributed_trace def list_for_scope( @@ -818,8 +866,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -842,16 +892,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -859,13 +916,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -879,7 +936,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace_async async def get_by_id( @@ -911,8 +968,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_assignment_id=role_assignment_id, @@ -923,9 +982,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -943,7 +1002,7 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload async def create_by_id( @@ -1009,8 +1068,8 @@ async def create_by_id( /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1032,9 +1091,11 @@ async def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1055,9 +1116,9 @@ async def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1075,11 +1136,11 @@ async def create_by_id( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace_async async def delete_by_id( @@ -1111,8 +1172,10 @@ async def delete_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_assignment_id=role_assignment_id, @@ -1123,9 +1186,9 @@ async def delete_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1145,7 +1208,7 @@ async def delete_by_id( return deserialized - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload async def validate_by_id( @@ -1211,8 +1274,8 @@ async def validate_by_id( /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1234,9 +1297,11 @@ async def validate_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidationResponse] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1257,9 +1322,9 @@ async def validate_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1277,4 +1342,4 @@ async def validate_by_id( return deserialized - validate_by_id.metadata = {"url": "/{roleAssignmentId}/validate"} # type: ignore + validate_by_id.metadata = {"url": "/{roleAssignmentId}/validate"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_operations.py index 8c8f5d1887e6..b7f91b58fbd6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_list_for_scope_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstanceListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,16 +111,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +154,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} @distributed_trace_async async def get( @@ -169,8 +183,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstance] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -181,9 +197,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,4 +216,6 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py index 49003f725e84..269790e22cba 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_for_scope_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -148,8 +153,8 @@ async def create( :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It can be any valid GUID. Required. :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role eligibility schedule request. Is either a + RoleEligibilityScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -171,9 +176,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -195,9 +202,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -214,7 +221,9 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace_async async def get( @@ -243,8 +252,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -255,9 +266,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -274,7 +285,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -302,8 +315,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequestListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -325,16 +340,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -342,13 +364,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -361,7 +383,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} @distributed_trace_async async def cancel( # pylint: disable=inconsistent-return-statements @@ -390,8 +412,10 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -402,9 +426,9 @@ async def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -417,4 +441,6 @@ async def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_operations.py index 7e5f8b8ab1a8..c12b5ff59e6a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._role_eligibility_schedules_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilitySchedule] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -92,9 +99,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" + } @distributed_trace def list_for_scope( @@ -138,8 +147,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -161,16 +172,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +196,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,4 +215,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_operations.py index 0d997f1bc18a..6f2e9489b73b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -95,9 +102,9 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -114,7 +121,9 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @overload async def update( @@ -187,8 +196,8 @@ async def update( :param role_management_policy_name: The name (guid) of the role management policy to upsert. Required. :type role_management_policy_name: str - :param parameters: Parameters for the role management policy. Is either a model type or a IO - type. Required. + :param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -210,9 +219,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -234,9 +245,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -253,7 +264,9 @@ async def update( return deserialized - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + update.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -282,8 +295,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -294,9 +309,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -309,7 +324,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicy"]: @@ -327,8 +344,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -349,16 +368,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -366,13 +392,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -385,4 +411,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_operations.py index 634224145401..ad570701939c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_for_scope_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -97,9 +104,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -116,7 +123,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @overload async def create( @@ -190,8 +199,8 @@ async def create( :param role_management_policy_assignment_name: The name of format {guid_guid} the role management policy assignment to upsert. Required. :type role_management_policy_assignment_name: str - :param parameters: Parameters for the role management policy assignment. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role management policy assignment. Is either a + RoleManagementPolicyAssignment type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -213,9 +222,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -237,9 +248,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -256,7 +267,9 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -285,8 +298,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -297,9 +312,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -312,7 +327,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicyAssignment"]: @@ -330,8 +347,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -352,16 +371,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -369,13 +395,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -388,4 +414,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py index e8c2129fdb2d..3dac2f0b2994 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py @@ -83,7 +83,7 @@ from ._authorization_management_client_enums import Type from ._authorization_management_client_enums import UserType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py index aca5adf0008a..a7053c060d6e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -52,8 +52,8 @@ def __init__( is_requestor_justification_required: Optional[bool] = None, approval_mode: Optional[Union[str, "_models.ApprovalMode"]] = None, approval_stages: Optional[List["_models.ApprovalStage"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_approval_required: Determine whether approval is required or not. :paramtype is_approval_required: bool @@ -118,8 +118,8 @@ def __init__( primary_approvers: Optional[List["_models.UserSet"]] = None, is_escalation_enabled: Optional[bool] = None, escalation_approvers: Optional[List["_models.UserSet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword approval_stage_time_out_in_days: The time in days when approval request would be timed out. @@ -164,7 +164,7 @@ class CloudErrorBody(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -203,7 +203,7 @@ class EligibleChildResource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -231,8 +231,8 @@ def __init__( *, value: Optional[List["_models.EligibleChildResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Eligible child resource list. :paramtype value: @@ -266,7 +266,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -307,7 +307,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -318,7 +318,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2020_10_01_preview.models.ErrorDetail @@ -328,7 +329,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2020_10_01_preview.models.ErrorDetail @@ -362,8 +363,8 @@ def __init__( scope: Optional["_models.ExpandedPropertiesScope"] = None, role_definition: Optional["_models.ExpandedPropertiesRoleDefinition"] = None, principal: Optional["_models.ExpandedPropertiesPrincipal"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: Details of the resource scope. :paramtype scope: ~azure.mgmt.authorization.v2020_10_01_preview.models.ExpandedPropertiesScope @@ -407,8 +408,8 @@ def __init__( display_name: Optional[str] = None, email: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the principal. :paramtype id: str @@ -449,8 +450,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the role definition. :paramtype id: str @@ -488,8 +489,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Scope id of the resource. :paramtype id: str @@ -531,8 +532,8 @@ def __init__( not_actions: Optional[List[str]] = None, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Allowed actions. :paramtype actions: list[str] @@ -576,8 +577,8 @@ def __init__( scope: Optional["_models.PolicyAssignmentPropertiesScope"] = None, role_definition: Optional["_models.PolicyAssignmentPropertiesRoleDefinition"] = None, policy: Optional["_models.PolicyAssignmentPropertiesPolicy"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: Details of the resource scope. :paramtype scope: @@ -623,8 +624,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin last_modified_date_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the policy. :paramtype id: str @@ -660,8 +661,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the role definition. :paramtype id: str @@ -699,8 +700,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Scope id of the resource. :paramtype id: str @@ -732,7 +733,7 @@ class PolicyProperties(_serialization.Model): "scope": {"key": "scope", "type": "PolicyPropertiesScope"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.scope = None @@ -761,8 +762,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Scope id of the resource. :paramtype id: str @@ -804,8 +805,8 @@ def __init__( display_name: Optional[str] = None, type: Optional[str] = None, email: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the principal made changes. :paramtype id: str @@ -907,8 +908,8 @@ def __init__( condition: Optional[str] = None, condition_version: Optional[str] = None, delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str @@ -1024,8 +1025,8 @@ def __init__( condition: Optional[str] = None, condition_version: Optional[str] = None, delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. Required. :paramtype role_definition_id: str @@ -1073,7 +1074,7 @@ class RoleAssignmentFilter(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str @@ -1102,7 +1103,7 @@ class RoleAssignmentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, **kwargs: Any) -> None: """ :keyword value: Role assignment list. :paramtype value: list[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment] @@ -1220,8 +1221,8 @@ def __init__( created_on: Optional[datetime.datetime] = None, updated_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment schedule scope. :paramtype scope: str @@ -1317,8 +1318,8 @@ def __init__( principal_id: Optional[str] = None, role_definition_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment schedule of the specific principal. :paramtype principal_id: str @@ -1447,8 +1448,8 @@ def __init__( condition_version: Optional[str] = None, created_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role assignment schedule scope. :paramtype scope: str @@ -1552,8 +1553,8 @@ def __init__( role_definition_id: Optional[str] = None, status: Optional[str] = None, role_assignment_schedule_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment schedule instances of the specific principal. :paramtype principal_id: str @@ -1593,8 +1594,8 @@ def __init__( *, value: Optional[List["_models.RoleAssignmentScheduleInstance"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role assignment schedule instance list. :paramtype value: @@ -1627,8 +1628,8 @@ def __init__( *, value: Optional[List["_models.RoleAssignmentSchedule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role assignment schedule list. :paramtype value: @@ -1765,8 +1766,8 @@ def __init__( ticket_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesTicketInfo"] = None, condition: Optional[str] = None, condition_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str @@ -1853,8 +1854,8 @@ def __init__( role_definition_id: Optional[str] = None, requestor_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role assignment requests of the specific principal. :paramtype principal_id: str @@ -1892,8 +1893,8 @@ def __init__( *, value: Optional[List["_models.RoleAssignmentScheduleRequest"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role assignment schedule request list. :paramtype value: @@ -1926,8 +1927,8 @@ def __init__( *, start_date_time: Optional[datetime.datetime] = None, expiration: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: Start DateTime of the role assignment schedule. :paramtype start_date_time: ~datetime.datetime @@ -1964,8 +1965,8 @@ def __init__( type: Optional[Union[str, "_models.Type"]] = None, end_date_time: Optional[datetime.datetime] = None, duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of the role assignment schedule expiration. Known values are: "AfterDuration", "AfterDateTime", and "NoExpiration". @@ -1995,7 +1996,9 @@ class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model): "ticket_system": {"key": "ticketSystem", "type": "str"}, } - def __init__(self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs): + def __init__( + self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword ticket_number: Ticket number for the role assignment. :paramtype ticket_number: str @@ -2104,8 +2107,8 @@ def __init__( created_on: Optional[datetime.datetime] = None, updated_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role eligibility schedule scope. :paramtype scope: str @@ -2192,8 +2195,8 @@ def __init__( principal_id: Optional[str] = None, role_definition_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role eligibility schedule of the specific principal. :paramtype principal_id: str @@ -2300,8 +2303,8 @@ def __init__( condition_version: Optional[str] = None, created_on: Optional[datetime.datetime] = None, expanded_properties: Optional["_models.ExpandedProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role eligibility schedule scope. :paramtype scope: str @@ -2390,8 +2393,8 @@ def __init__( role_definition_id: Optional[str] = None, status: Optional[str] = None, role_eligibility_schedule_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role eligibility schedule instances of the specific principal. :paramtype principal_id: str @@ -2431,8 +2434,8 @@ def __init__( *, value: Optional[List["_models.RoleEligibilityScheduleInstance"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role eligibility schedule instance list. :paramtype value: @@ -2465,8 +2468,8 @@ def __init__( *, value: Optional[List["_models.RoleEligibilitySchedule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: role eligibility schedule list. :paramtype value: @@ -2598,8 +2601,8 @@ def __init__( ticket_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesTicketInfo"] = None, condition: Optional[str] = None, condition_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str @@ -2682,8 +2685,8 @@ def __init__( role_definition_id: Optional[str] = None, requestor_id: Optional[str] = None, status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: Returns role eligibility requests of the specific principal. :paramtype principal_id: str @@ -2721,8 +2724,8 @@ def __init__( *, value: Optional[List["_models.RoleEligibilityScheduleRequest"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role eligibility schedule request list. :paramtype value: @@ -2755,8 +2758,8 @@ def __init__( *, start_date_time: Optional[datetime.datetime] = None, expiration: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: Start DateTime of the role eligibility schedule. :paramtype start_date_time: ~datetime.datetime @@ -2793,8 +2796,8 @@ def __init__( type: Optional[Union[str, "_models.Type"]] = None, end_date_time: Optional[datetime.datetime] = None, duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of the role eligibility schedule expiration. Known values are: "AfterDuration", "AfterDateTime", and "NoExpiration". @@ -2824,7 +2827,9 @@ class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model): "ticket_system": {"key": "ticketSystem", "type": "str"}, } - def __init__(self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs): + def __init__( + self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword ticket_number: Ticket number for the role eligibility. :paramtype ticket_number: str @@ -2903,8 +2908,8 @@ def __init__( description: Optional[str] = None, is_organization_default: Optional[bool] = None, rules: Optional[List["_models.RoleManagementPolicyRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role management policy scope. :paramtype scope: str @@ -2981,8 +2986,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -2992,7 +2997,7 @@ def __init__( """ super().__init__(**kwargs) self.id = id - self.rule_type = None # type: Optional[str] + self.rule_type: Optional[str] = None self.target = target @@ -3033,8 +3038,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, setting: Optional["_models.ApprovalSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -3045,7 +3050,7 @@ def __init__( :paramtype setting: ~azure.mgmt.authorization.v2020_10_01_preview.models.ApprovalSettings """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyApprovalRule" # type: str + self.rule_type: str = "RoleManagementPolicyApprovalRule" self.setting = setting @@ -3097,8 +3102,8 @@ def __init__( scope: Optional[str] = None, role_definition_id: Optional[str] = None, policy_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The role management policy scope. :paramtype scope: str @@ -3137,8 +3142,8 @@ def __init__( *, value: Optional[List["_models.RoleManagementPolicyAssignment"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Role management policy assignment list. :paramtype value: @@ -3192,8 +3197,8 @@ def __init__( target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, is_enabled: Optional[bool] = None, claim_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -3206,7 +3211,7 @@ def __init__( :paramtype claim_value: str """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyAuthenticationContextRule" # type: str + self.rule_type: str = "RoleManagementPolicyAuthenticationContextRule" self.is_enabled = is_enabled self.claim_value = claim_value @@ -3249,8 +3254,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, enabled_rules: Optional[List[Union[str, "_models.EnablementRules"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -3262,7 +3267,7 @@ def __init__( ~azure.mgmt.authorization.v2020_10_01_preview.models.EnablementRules] """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyEnablementRule" # type: str + self.rule_type: str = "RoleManagementPolicyEnablementRule" self.enabled_rules = enabled_rules @@ -3307,8 +3312,8 @@ def __init__( target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, is_expiration_required: Optional[bool] = None, maximum_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -3321,7 +3326,7 @@ def __init__( :paramtype maximum_duration: str """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyExpirationRule" # type: str + self.rule_type: str = "RoleManagementPolicyExpirationRule" self.is_expiration_required = is_expiration_required self.maximum_duration = maximum_duration @@ -3341,8 +3346,12 @@ class RoleManagementPolicyListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleManagementPolicy"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.RoleManagementPolicy"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Role management policy list. :paramtype value: @@ -3414,8 +3423,8 @@ def __init__( recipient_type: Optional[Union[str, "_models.RecipientType"]] = None, notification_recipients: Optional[List[str]] = None, is_default_recipients_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -3440,7 +3449,7 @@ def __init__( :paramtype is_default_recipients_enabled: bool """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyNotificationRule" # type: str + self.rule_type: str = "RoleManagementPolicyNotificationRule" self.notification_type = notification_type self.notification_level = notification_level self.recipient_type = recipient_type @@ -3483,8 +3492,8 @@ def __init__( target_objects: Optional[List[str]] = None, inheritable_settings: Optional[List[str]] = None, enforced_settings: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword caller: The caller of the setting. :paramtype caller: str @@ -3535,8 +3544,8 @@ def __init__( is_backup: Optional[bool] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_type: The type of user. Known values are: "User" and "Group". :paramtype user_type: str or ~azure.mgmt.authorization.v2020_10_01_preview.models.UserType @@ -3575,7 +3584,7 @@ class ValidationResponse(_serialization.Model): "error_info": {"key": "errorInfo", "type": "ValidationResponseErrorInfo"}, } - def __init__(self, *, error_info: Optional["_models.ValidationResponseErrorInfo"] = None, **kwargs): + def __init__(self, *, error_info: Optional["_models.ValidationResponseErrorInfo"] = None, **kwargs: Any) -> None: """ :keyword error_info: Failed validation result details. :paramtype error_info: @@ -3607,7 +3616,7 @@ class ValidationResponseErrorInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/__init__.py index baf561800ad2..c2480d05193e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/__init__.py @@ -18,7 +18,7 @@ from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py index 6c9331e95d9c..a91a75074465 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +56,7 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -102,8 +109,10 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EligibleChildResourcesListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,16 +134,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -142,13 +158,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EligibleChildResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,4 +177,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py index 19025d2ee66b..9fd008c896c7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +56,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -66,7 +73,9 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +90,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,8 +145,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstanceListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -159,16 +170,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +194,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,7 +213,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"} @distributed_trace def get( @@ -224,8 +242,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleInstance] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -236,9 +256,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -255,4 +275,6 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py index 5b05c2dcb80e..4b41385fc441 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,8 +45,10 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +80,9 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +97,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, ** ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +112,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +123,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -129,7 +140,9 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +157,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,8 +277,8 @@ def create( :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required. :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role assignment schedule request. Is either a + RoleAssignmentScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -287,9 +300,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -311,9 +326,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -330,7 +345,9 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace def get( @@ -359,8 +376,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -371,9 +390,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -390,7 +409,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -418,8 +439,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleRequestListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -441,16 +464,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -458,13 +488,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -477,7 +507,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} @distributed_trace def cancel( # pylint: disable=inconsistent-return-statements @@ -506,8 +536,10 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -518,9 +550,9 @@ def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -533,4 +565,6 @@ def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py index 2469f234a69c..8b60d6d2787e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +77,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +88,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -136,8 +145,10 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentSchedule] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -148,9 +159,9 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -167,7 +178,9 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" + } @distributed_trace def list_for_scope( @@ -194,8 +207,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentScheduleListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -217,16 +232,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -234,13 +256,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -253,4 +275,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py index 56df6f58e249..4aa61a03e9e8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_for_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_list_for_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +86,9 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +103,7 @@ def build_list_for_resource_group_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,7 +132,9 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +154,7 @@ def build_list_for_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +175,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +187,7 @@ def build_get_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,8 +204,10 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +217,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -221,7 +236,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +248,7 @@ def build_delete_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -248,8 +265,10 @@ def build_validate_request(scope: str, role_assignment_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -261,7 +280,7 @@ def build_validate_request(scope: str, role_assignment_name: str, **kwargs: Any) "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -280,7 +299,9 @@ def build_list_for_scope_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -289,7 +310,7 @@ def build_list_for_scope_request( "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -308,7 +329,9 @@ def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str] _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +340,7 @@ def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str] "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -334,8 +357,10 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -344,7 +369,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -363,7 +388,9 @@ def build_delete_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -372,7 +399,7 @@ def build_delete_by_id_request( "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -389,8 +416,10 @@ def build_validate_by_id_request(role_assignment_id: str, **kwargs: Any) -> Http _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -399,7 +428,7 @@ def build_validate_by_id_request(role_assignment_id: str, **kwargs: Any) -> Http "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -452,8 +481,10 @@ def list_for_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -476,16 +507,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -493,13 +531,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -513,7 +551,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -539,8 +579,10 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -564,16 +606,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -581,13 +630,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -601,7 +650,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource( @@ -641,8 +692,10 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -669,16 +722,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -686,13 +746,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -706,7 +766,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def get( @@ -741,8 +803,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -754,9 +818,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -774,7 +838,7 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload def create( @@ -860,8 +924,8 @@ def create( :param role_assignment_name: The name of the role assignment. It can be any valid GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -883,9 +947,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -907,9 +973,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -927,11 +993,11 @@ def create( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def delete( @@ -966,8 +1032,10 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -979,9 +1047,9 @@ def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1001,7 +1069,7 @@ def delete( return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload def validate( @@ -1087,8 +1155,8 @@ def validate( :param role_assignment_name: The name of the role assignment. It can be any valid GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1110,9 +1178,11 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidationResponse] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1134,9 +1204,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1154,7 +1224,9 @@ def validate( return deserialized - validate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate"} # type: ignore + validate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate" + } @distributed_trace def list_for_scope( @@ -1183,8 +1255,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1207,16 +1281,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1224,13 +1305,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1244,7 +1325,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def get_by_id( @@ -1276,8 +1357,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_assignment_id=role_assignment_id, @@ -1288,9 +1371,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1308,7 +1391,7 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload def create_by_id( @@ -1374,8 +1457,8 @@ def create_by_id( /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1397,9 +1480,11 @@ def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1420,9 +1505,9 @@ def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1440,11 +1525,11 @@ def create_by_id( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace def delete_by_id( @@ -1476,8 +1561,10 @@ def delete_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_assignment_id=role_assignment_id, @@ -1488,9 +1575,9 @@ def delete_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1510,7 +1597,7 @@ def delete_by_id( return deserialized - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload def validate_by_id( @@ -1576,8 +1663,8 @@ def validate_by_id( /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1599,9 +1686,11 @@ def validate_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidationResponse] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1622,9 +1711,9 @@ def validate_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1642,4 +1731,4 @@ def validate_by_id( return deserialized - validate_by_id.metadata = {"url": "/{roleAssignmentId}/validate"} # type: ignore + validate_by_id.metadata = {"url": "/{roleAssignmentId}/validate"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py index 1a2d7a87d2c8..24e514c9ddb7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +56,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -66,7 +73,9 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +90,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str, ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,8 +145,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstanceListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -159,16 +170,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +194,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,7 +213,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"} @distributed_trace def get( @@ -224,8 +242,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleInstance] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -236,9 +256,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -255,4 +275,6 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py index 6c9e9f8dcb3f..033cfedeb8f2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,8 +45,10 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +80,9 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +97,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +112,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +123,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -129,7 +140,9 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +157,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,8 +277,8 @@ def create( :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It can be any valid GUID. Required. :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role eligibility schedule request. Is either a + RoleEligibilityScheduleRequest type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -287,9 +300,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -311,9 +326,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -330,7 +345,9 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace def get( @@ -359,8 +376,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequest] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -371,9 +390,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -390,7 +409,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + } @distributed_trace def list_for_scope( @@ -418,8 +439,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleRequestListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -441,16 +464,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -458,13 +488,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleRequestListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -477,7 +507,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} @distributed_trace def cancel( # pylint: disable=inconsistent-return-statements @@ -506,8 +536,10 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_request( scope=scope, @@ -518,9 +550,9 @@ def cancel( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -533,4 +565,6 @@ def cancel( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - cancel.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"} # type: ignore + cancel.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py index 36916d3915bd..2336f3e92f67 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +77,9 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +88,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -136,8 +145,10 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilitySchedule] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -148,9 +159,9 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -167,7 +178,9 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" + } @distributed_trace def list_for_scope( @@ -194,8 +207,10 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleEligibilityScheduleListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -217,16 +232,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -234,13 +256,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleEligibilityScheduleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -253,4 +275,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py index a2f0dc0556df..a9eb288161c8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +74,10 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +89,7 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +106,9 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +120,7 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +135,9 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +146,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,8 +201,10 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -200,9 +215,9 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -219,7 +234,9 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @overload def update( @@ -292,8 +309,8 @@ def update( :param role_management_policy_name: The name (guid) of the role management policy to upsert. Required. :type role_management_policy_name: str - :param parameters: Parameters for the role management policy. Is either a model type or a IO - type. Required. + :param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -315,9 +332,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicy] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -339,9 +358,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -358,7 +377,9 @@ def update( return deserialized - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + update.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -387,8 +408,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -399,9 +422,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,7 +437,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicy"]: @@ -432,8 +457,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -454,16 +481,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -471,13 +505,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -490,4 +524,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py index d74864306f37..aba2fad557c8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,8 +77,10 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +95,7 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +112,9 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +129,7 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +144,9 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +155,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,8 +212,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -211,9 +226,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,7 +245,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @overload def create( @@ -304,8 +321,8 @@ def create( :param role_management_policy_assignment_name: The name of format {guid_guid} the role management policy assignment to upsert. Required. :type role_management_policy_assignment_name: str - :param parameters: Parameters for the role management policy assignment. Is either a model type - or a IO type. Required. + :param parameters: Parameters for the role management policy assignment. Is either a + RoleManagementPolicyAssignment type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -327,9 +344,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignment] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -351,9 +370,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -370,7 +389,9 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -399,8 +420,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -411,9 +434,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -426,7 +449,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicyAssignment"]: @@ -444,8 +469,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-10-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleManagementPolicyAssignmentListResult] + api_version: Literal["2020-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-10-01-preview") + ) + cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -466,16 +493,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -483,13 +517,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleManagementPolicyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -502,4 +536,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py index 44d345ff7a1f..4ffd0e024224 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -70,7 +70,7 @@ def __init__( self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -116,15 +116,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py index ac72476dce75..e2710dad0da9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -34,7 +40,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01-preview") # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop("api_version", "2021-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_metadata.json index 985abca5526f..c964b3aa4069 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -93,4 +100,4 @@ "scope_role_assignment_approval_steps": "ScopeRoleAssignmentApprovalStepsOperations", "scope_role_assignment_approval_step": "ScopeRoleAssignmentApprovalStepOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_client.py index 1bdb789a1478..2deb987fa59e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -70,7 +70,7 @@ def __init__( self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -123,5 +123,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_configuration.py index 2259bb63e28c..4f4e36007980 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,7 +40,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01-preview") # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop("api_version", "2021-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/__init__.py index c9d41189173e..1349e3f13a6f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._scope_role_assignment_approval_step_operations import ScopeRoleAssignmentApprovalStepOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_operations.py index fb47a071d828..f7a9c1c7b6e8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,8 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -86,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -103,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_operations.py index eefc4acbd8d8..aeab8702039e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._role_assignment_approval_operations import build_get_by_id_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,16 +105,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -115,13 +129,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentApprovalListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -135,7 +149,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals"} @distributed_trace_async async def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApproval: @@ -159,8 +173,10 @@ async def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssign _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApproval] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -170,9 +186,9 @@ async def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssign params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -190,4 +206,4 @@ async def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssign return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} # type: ignore + get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_operations.py index 9b72f42600b0..54852ff5d014 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,10 @@ build_put_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ async def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -90,9 +97,9 @@ async def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -110,7 +117,9 @@ async def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _mo return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } @overload async def patch( @@ -175,8 +184,8 @@ async def patch( :type approval_id: str :param stage_id: The id of the role assignment approval stage. Required. :type stage_id: str - :param properties: Role Assignment Approval stage properties to patch. Is either a model type - or a IO type. Required. + :param properties: Role Assignment Approval stage properties to patch. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -198,9 +207,11 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -222,9 +233,9 @@ async def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -242,7 +253,7 @@ async def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + patch.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} @overload async def put( @@ -307,8 +318,8 @@ async def put( :type approval_id: str :param stage_id: The id of the role assignment approval stage. Required. :type stage_id: str - :param properties: Role Assignment Approval stage properties to put. Is either a model type or - a IO type. Required. + :param properties: Role Assignment Approval stage properties to put. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -330,9 +341,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -354,9 +367,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -374,4 +387,4 @@ async def put( return deserialized - put.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + put.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_operations.py index f37091a75ad6..0d32bf5409f9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._role_assignment_approval_steps_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,8 +78,10 @@ async def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStepListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None) request = build_list_request( approval_id=approval_id, @@ -84,9 +91,9 @@ async def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentA params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -104,4 +111,4 @@ async def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentA return deserialized - list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_operations.py index 5985d4f00f58..856e2e2abbbf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._scope_role_assignment_approval_operations import build_get_by_id_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,16 +110,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -120,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentApprovalListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +154,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals"} @distributed_trace_async async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssignmentApproval: @@ -166,8 +180,10 @@ async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApproval] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -178,9 +194,9 @@ async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _model params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,4 +214,4 @@ async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _model return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} # type: ignore + get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_operations.py index 1e1a68b0cc4e..53f8461d9fd2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,10 @@ build_put_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -95,9 +102,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -115,7 +122,9 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } @overload async def patch( @@ -195,8 +204,8 @@ async def patch( :type stage_id: str :param scope: The scope of the resource. Required. :type scope: str - :param properties: Role Assignment Approval stage properties to patch. Is either a model type - or a IO type. Required. + :param properties: Role Assignment Approval stage properties to patch. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -218,9 +227,11 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -243,9 +254,9 @@ async def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -263,7 +274,9 @@ async def patch( return deserialized - patch.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + patch.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } @overload async def put( @@ -343,8 +356,8 @@ async def put( :type stage_id: str :param scope: The scope of the resource. Required. :type scope: str - :param properties: Role Assignment Approval stage properties to put. Is either a model type or - a IO type. Required. + :param properties: Role Assignment Approval stage properties to put. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -366,9 +379,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -391,9 +406,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -411,4 +426,6 @@ async def put( return deserialized - put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + put.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_operations.py index 647f003a7a7f..b5a8d5db2f86 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._scope_role_assignment_approval_steps_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,8 +80,10 @@ async def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Rol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStepListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None) request = build_list_request( approval_id=approval_id, @@ -87,9 +94,9 @@ async def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Rol params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -107,4 +114,4 @@ async def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Rol return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py index a784ef8770fe..939a734a9b72 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py @@ -21,7 +21,7 @@ from ._authorization_management_client_enums import RoleAssignmentApprovalStepReviewResult from ._authorization_management_client_enums import RoleAssignmentApprovalStepStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py index 163516e08ef3..ee0554ffecee 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -27,7 +27,7 @@ class ErrorDefinition(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinitionProperties"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs: Any) -> None: """ :keyword error: Error of the list gateway status. :paramtype error: @@ -57,7 +57,7 @@ class ErrorDefinitionProperties(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code of list gateway. :paramtype code: str @@ -94,8 +94,8 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -142,7 +142,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -165,7 +165,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.authorization.v2021_01_01_preview.models.Operation] @@ -206,7 +208,7 @@ class RoleAssignmentApproval(_serialization.Model): "stages": {"key": "properties.stages", "type": "[RoleAssignmentApprovalStep]"}, } - def __init__(self, *, stages: Optional[List["_models.RoleAssignmentApprovalStep"]] = None, **kwargs): + def __init__(self, *, stages: Optional[List["_models.RoleAssignmentApprovalStep"]] = None, **kwargs: Any) -> None: """ :keyword stages: This is the collection of stages returned when one does an expand on it. :paramtype stages: @@ -240,7 +242,7 @@ class RoleAssignmentApprovalListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RoleAssignmentApproval"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RoleAssignmentApproval"]] = None, **kwargs: Any) -> None: """ :keyword value: Role Assignment Approval list. :paramtype value: @@ -327,8 +329,8 @@ def __init__( display_name: Optional[str] = None, review_result: Optional[Union[str, "_models.RoleAssignmentApprovalStepReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the approval stage. :paramtype display_name: str @@ -377,7 +379,7 @@ class RoleAssignmentApprovalStepListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RoleAssignmentApprovalStep"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RoleAssignmentApprovalStep"]] = None, **kwargs: Any) -> None: """ :keyword value: Role Assignment Approval Step list. :paramtype value: @@ -452,8 +454,8 @@ def __init__( display_name: Optional[str] = None, review_result: Optional[Union[str, "_models.RoleAssignmentApprovalStepReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the approval stage. :paramtype display_name: str diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py index c9d41189173e..1349e3f13a6f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py @@ -15,7 +15,7 @@ from ._scope_role_assignment_approval_step_operations import ScopeRoleAssignmentApprovalStepOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py index 67d44cf0189a..1de307229ae6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,8 +94,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,16 +117,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +141,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,4 +161,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py index e7a63ecf9e81..a87bbe049914 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +68,9 @@ def build_get_by_id_request(approval_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +79,7 @@ def build_get_by_id_request(approval_id: str, **kwargs: Any) -> HttpRequest: "approvalId": _SERIALIZER.url("approval_id", approval_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,8 +132,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -145,16 +156,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -162,13 +180,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentApprovalListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -182,7 +200,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals"} @distributed_trace def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApproval: @@ -206,8 +224,10 @@ def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentAp _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApproval] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -217,9 +237,9 @@ def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentAp params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -237,4 +257,4 @@ def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentAp return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} # type: ignore + get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py index 5ef565293886..e5224a587606 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_by_id_request(approval_id: str, stage_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +57,7 @@ def build_get_by_id_request(approval_id: str, stage_id: str, **kwargs: Any) -> H "stageId": _SERIALIZER.url("stage_id", stage_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,8 +72,10 @@ def build_patch_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +87,7 @@ def build_patch_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpR "stageId": _SERIALIZER.url("stage_id", stage_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,8 +104,10 @@ def build_put_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +119,7 @@ def build_put_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpReq "stageId": _SERIALIZER.url("stage_id", stage_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,8 +175,10 @@ def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _models.R _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -176,9 +189,9 @@ def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _models.R params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -196,7 +209,9 @@ def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _models.R return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } @overload def patch( @@ -261,8 +276,8 @@ def patch( :type approval_id: str :param stage_id: The id of the role assignment approval stage. Required. :type stage_id: str - :param properties: Role Assignment Approval stage properties to patch. Is either a model type - or a IO type. Required. + :param properties: Role Assignment Approval stage properties to patch. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -284,9 +299,11 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -308,9 +325,9 @@ def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -328,7 +345,7 @@ def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + patch.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} @overload def put( @@ -393,8 +410,8 @@ def put( :type approval_id: str :param stage_id: The id of the role assignment approval stage. Required. :type stage_id: str - :param properties: Role Assignment Approval stage properties to put. Is either a model type or - a IO type. Required. + :param properties: Role Assignment Approval stage properties to put. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -416,9 +433,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -440,9 +459,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -460,4 +479,4 @@ def put( return deserialized - put.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + put.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py index acb2b466023d..95ccfa2eb1f2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_list_request(approval_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47,7 +54,7 @@ def build_list_request(approval_id: str, **kwargs: Any) -> HttpRequest: "approvalId": _SERIALIZER.url("approval_id", approval_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +107,10 @@ def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApprova _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStepListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None) request = build_list_request( approval_id=approval_id, @@ -111,9 +120,9 @@ def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApprova params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -131,4 +140,4 @@ def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApprova return deserialized - list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py index b4cf7ac2ecb2..069895b17663 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +56,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -66,7 +73,9 @@ def build_get_by_id_request(approval_id: str, scope: str, **kwargs: Any) -> Http _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +85,7 @@ def build_get_by_id_request(approval_id: str, scope: str, **kwargs: Any) -> Http "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,8 +142,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -156,16 +167,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -173,13 +191,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentApprovalListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -193,7 +211,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals"} @distributed_trace def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssignmentApproval: @@ -219,8 +237,10 @@ def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Role _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApproval] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -231,9 +251,9 @@ def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Role params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -251,4 +271,4 @@ def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Role return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} # type: ignore + get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py index 71067dc9453f..def0997c7ac4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_by_id_request(approval_id: str, stage_id: str, scope: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_get_by_id_request(approval_id: str, stage_id: str, scope: str, **kwarg "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +74,10 @@ def build_patch_request(approval_id: str, stage_id: str, scope: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_patch_request(approval_id: str, stage_id: str, scope: str, **kwargs: A "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,8 +108,10 @@ def build_put_request(approval_id: str, stage_id: str, scope: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +125,7 @@ def build_put_request(approval_id: str, stage_id: str, scope: str, **kwargs: Any "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,8 +185,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) request = build_get_by_id_request( approval_id=approval_id, @@ -187,9 +200,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -207,7 +220,9 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } @overload def patch( @@ -287,8 +302,8 @@ def patch( :type stage_id: str :param scope: The scope of the resource. Required. :type scope: str - :param properties: Role Assignment Approval stage properties to patch. Is either a model type - or a IO type. Required. + :param properties: Role Assignment Approval stage properties to patch. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -310,9 +325,11 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -335,9 +352,9 @@ def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -355,7 +372,9 @@ def patch( return deserialized - patch.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + patch.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } @overload def put( @@ -435,8 +454,8 @@ def put( :type stage_id: str :param scope: The scope of the resource. Required. :type scope: str - :param properties: Role Assignment Approval stage properties to put. Is either a model type or - a IO type. Required. + :param properties: Role Assignment Approval stage properties to put. Is either a + RoleAssignmentApprovalStepProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -458,9 +477,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStep] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -483,9 +504,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -503,4 +524,6 @@ def put( return deserialized - put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"} # type: ignore + put.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py index 3dfaf5381728..96a45a55f093 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_list_request(approval_id: str, scope: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +57,7 @@ def build_list_request(approval_id: str, scope: str, **kwargs: Any) -> HttpReque "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,8 +112,10 @@ def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssig _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentApprovalStepListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None) request = build_list_request( approval_id=approval_id, @@ -117,9 +126,9 @@ def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssig params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -137,4 +146,4 @@ def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssig return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py index 995dd4565987..c2f0d5ce5583 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -87,7 +87,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -141,15 +141,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py index 189ab49d5019..e57a0d1338da 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-01-preview") # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop("api_version", "2021-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_metadata.json index 1fad7f188224..9b441250f678 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -107,4 +115,4 @@ "access_review_instances_assigned_for_my_approval": "AccessReviewInstancesAssignedForMyApprovalOperations", "access_review_instance_my_decisions": "AccessReviewInstanceMyDecisionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_client.py index 2ca77d4e2063..9228db7e71f8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -87,7 +87,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -148,5 +148,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_configuration.py index 5df9e6760bf5..d0e761234bb8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-01-preview") # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop("api_version", "2021-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py index 2ed7cbae216b..0bb9a6bebd04 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py @@ -21,7 +21,7 @@ from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_operations.py index 609ff0b952e5..c55a23d88a3d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._access_review_default_settings_operations import build_get_request, build_put_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,10 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -81,9 +88,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -101,7 +108,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload async def put( @@ -144,8 +153,8 @@ async def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -167,9 +176,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -190,9 +201,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,4 +221,6 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_operations.py index 08d8a2891fc1..fe4f313b8bdb 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instance_decisions_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,8 +82,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,16 +109,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -139,4 +153,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py index 83f8b528ab09..2cd2e87f208e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_patch_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,16 +113,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -123,13 +137,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +157,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace_async async def get_by_id( @@ -173,8 +189,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -186,9 +204,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -206,7 +224,9 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload async def patch( @@ -286,8 +306,8 @@ async def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -309,9 +329,11 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,9 +356,9 @@ async def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -354,4 +376,6 @@ async def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_operations.py index a6852695ba4d..37ac3ccfc6f1 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -95,9 +102,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,9 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace_async async def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -139,8 +148,10 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -152,9 +163,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -168,7 +179,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace_async async def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -196,8 +209,10 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -209,9 +224,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -225,7 +240,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace_async async def send_reminders( # pylint: disable=inconsistent-return-statements @@ -253,8 +270,10 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -266,9 +285,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -282,7 +301,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace_async async def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -310,8 +331,10 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -322,9 +345,9 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -338,4 +361,6 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py index d6a93c393900..b0651d24b4b5 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,16 +109,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -139,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -165,8 +181,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -177,9 +195,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +215,6 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_operations.py index 2225f897e6f7..4866dd3fa5f6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instances_operations import build_get_by_id_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,16 +107,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +151,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -163,8 +179,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -176,9 +194,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -196,4 +214,6 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index 0f9d9b31e54b..8a0d4a03a557 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_schedule_definitions_assigned_for_my_approval_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,8 +78,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,16 +102,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,4 +146,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_operations.py index df10b9ee7969..4b553241a136 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,16 +110,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -120,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -164,8 +180,10 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -176,9 +194,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -196,7 +214,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -222,8 +242,10 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -234,9 +256,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,7 +272,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload async def create_or_update_by_id( @@ -307,8 +331,8 @@ async def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -331,9 +355,11 @@ async def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -355,9 +381,9 @@ async def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -375,7 +401,9 @@ async def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def stop( # pylint: disable=inconsistent-return-statements @@ -401,8 +429,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -413,9 +443,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,4 +459,6 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_operations.py index f1a1fc8fbbdf..44066486508f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,8 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -86,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -103,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py index 25e650b919ec..c5e060119af7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py @@ -43,7 +43,7 @@ from ._authorization_management_client_enums import DecisionTargetType from ._authorization_management_client_enums import DefaultDecisionType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py index cb7fc95c1bad..866793ed7b3b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -160,8 +160,8 @@ def __init__( *, decision: Optional[Union[str, "_models.AccessReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -189,10 +189,10 @@ def __init__( self.principal_type_properties_reviewed_by_principal_type = None self.principal_name_properties_reviewed_by_principal_name = None self.user_principal_name_properties_reviewed_by_user_principal_name = None - self.type_properties_resource_type = None # type: Optional[str] + self.type_properties_resource_type: Optional[str] = None self.id_properties_resource_id = None self.display_name_properties_resource_display_name = None - self.type_properties_principal_type = None # type: Optional[str] + self.type_properties_principal_type: Optional[str] = None self.id_properties_principal_id = None self.display_name_properties_principal_display_name = None @@ -235,10 +235,10 @@ class AccessReviewDecisionIdentity(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None self.id = None self.display_name = None @@ -258,8 +258,12 @@ class AccessReviewDecisionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewDecision"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewDecision"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Decision list. :paramtype value: @@ -383,8 +387,8 @@ def __init__( *, decision: Optional[Union[str, "_models.AccessReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -409,10 +413,10 @@ def __init__( self.principal_type_reviewed_by_principal_type = None self.principal_name_reviewed_by_principal_name = None self.user_principal_name_reviewed_by_user_principal_name = None - self.type_resource_type = None # type: Optional[str] + self.type_resource_type: Optional[str] = None self.id_resource_id = None self.display_name_resource_display_name = None - self.type_principal_type = None # type: Optional[str] + self.type_principal_type: Optional[str] = None self.id_principal_id = None self.display_name_principal_display_name = None @@ -444,10 +448,10 @@ class AccessReviewDecisionResource(_serialization.Model): "display_name": {"key": "displayName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None self.id = None self.display_name = None @@ -484,10 +488,10 @@ class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity) "app_id": {"key": "appId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "servicePrincipal" # type: str + self.type: str = "servicePrincipal" self.app_id = None @@ -523,10 +527,10 @@ class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity): "user_principal_name": {"key": "userPrincipalName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "user" # type: str + self.type: str = "user" self.user_principal_name = None @@ -633,8 +637,8 @@ def __init__( Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -745,8 +749,8 @@ def __init__( *, start_date_time: Optional[datetime.datetime] = None, end_date_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: The DateTime when the review instance is scheduled to be start. :paramtype start_date_time: ~datetime.datetime @@ -777,8 +781,12 @@ class AccessReviewInstanceListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewInstance"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Instance list. :paramtype value: @@ -813,7 +821,7 @@ class AccessReviewReviewer(_serialization.Model): "principal_type": {"key": "principalType", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: The id of the reviewer(user/servicePrincipal). :paramtype principal_id: str @@ -1028,8 +1036,8 @@ def __init__( # pylint: disable=too-many-locals Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -1157,8 +1165,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewScheduleDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review Schedule Definition list. :paramtype value: @@ -1348,8 +1356,8 @@ def __init__( # pylint: disable=too-many-locals end_date: Optional[datetime.datetime] = None, type_settings_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -1536,8 +1544,8 @@ def __init__( end_date: Optional[datetime.datetime] = None, type_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -1613,7 +1621,7 @@ class ErrorDefinition(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinitionProperties"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs: Any) -> None: """ :keyword error: Error of the list gateway status. :paramtype error: @@ -1643,7 +1651,7 @@ class ErrorDefinitionProperties(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code of list gateway. :paramtype code: str @@ -1680,8 +1688,8 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -1728,7 +1736,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1751,7 +1759,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.authorization.v2021_03_01_preview.models.Operation] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py index 2ed7cbae216b..0bb9a6bebd04 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py @@ -21,7 +21,7 @@ from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py index dd90161f2752..b4e66729d749 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +57,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,8 +72,10 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +87,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,8 +139,10 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -141,9 +152,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -161,7 +172,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload def put( @@ -204,8 +217,8 @@ def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -227,9 +240,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -250,9 +265,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +285,6 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py index 0f804c6a526e..557b1b0e1513 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,8 +120,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -138,16 +147,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,13 +171,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -175,4 +191,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py index 9c98e48e737f..12873c32262a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +79,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +95,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,8 +110,10 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +127,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,8 +184,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -197,16 +210,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,13 +234,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -234,7 +254,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace def get_by_id( @@ -264,8 +286,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -277,9 +301,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -297,7 +321,9 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload def patch( @@ -377,8 +403,8 @@ def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -400,9 +426,11 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -425,9 +453,9 @@ def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -445,4 +473,6 @@ def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py index 04cc3daa106e..147cbd196587 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_reset_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +92,7 @@ def build_reset_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +109,9 @@ def build_apply_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +125,7 @@ def build_apply_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +142,9 @@ def build_send_reminders_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +158,7 @@ def build_send_reminders_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +173,9 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +188,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,8 +244,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -242,9 +259,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +275,9 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -286,8 +305,10 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -299,9 +320,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +336,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -343,8 +366,10 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -356,9 +381,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -372,7 +397,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace def send_reminders( # pylint: disable=inconsistent-return-statements @@ -400,8 +427,10 @@ def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -413,9 +442,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,7 +458,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -457,8 +488,10 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -469,9 +502,9 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -485,4 +518,6 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py index 285a25a6175a..b670bdb721bf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,8 +144,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -158,16 +169,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -175,13 +193,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,7 +213,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -221,8 +241,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -233,9 +255,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -253,4 +275,6 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py index 0219b6dfdece..48a0ec2c137f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +79,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +95,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,8 +148,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -163,16 +174,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -180,13 +198,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -200,7 +218,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -226,8 +246,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -239,9 +261,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -259,4 +281,6 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index bcc73df99753..168494e7a05a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,8 +102,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,16 +126,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +150,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,4 +170,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py index abbf64e0904a..2fa6de62a5cc 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +106,9 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +121,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,8 +138,10 @@ def build_create_or_update_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +154,7 @@ def build_create_or_update_by_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +171,9 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +186,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,8 +235,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -243,16 +260,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,13 +284,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -280,7 +304,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -304,8 +330,10 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -316,9 +344,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -336,7 +364,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -362,8 +392,10 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -374,9 +406,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -390,7 +422,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload def create_or_update_by_id( @@ -447,8 +481,8 @@ def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -471,9 +505,11 @@ def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -495,9 +531,9 @@ def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -515,7 +551,9 @@ def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def stop( # pylint: disable=inconsistent-return-statements @@ -541,8 +579,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -553,9 +593,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -569,4 +609,6 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py index a81299a60bc8..e7aa08e6c521 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,8 +94,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,16 +117,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +141,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,4 +161,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_client.py index f7c1492f1f36..53094e52aba0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -97,7 +97,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -159,15 +159,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_configuration.py index 63ea1a05b649..c231de1374f9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop("api_version", "2021-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_metadata.json index b93a659c7349..c1ad5b13cc4e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -109,4 +117,4 @@ "access_review_instance_my_decisions": "AccessReviewInstanceMyDecisionsOperations", "tenant_level_access_review_instance_contacted_reviewers": "TenantLevelAccessReviewInstanceContactedReviewersOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_client.py index 4e6628a6c587..72faba936804 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -97,7 +97,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -166,5 +166,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_configuration.py index 372648548d31..51a5656cd282 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop("api_version", "2021-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py index 58318912431f..dda9abe5b586 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py @@ -25,7 +25,7 @@ ) from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_operations.py index 4ca7c165661b..f414b0c15bcf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._access_review_default_settings_operations import build_get_request, build_put_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,10 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -81,9 +88,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -101,7 +108,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload async def put( @@ -144,8 +153,8 @@ async def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -167,9 +176,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -190,9 +201,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,4 +221,6 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py index 80af2c9056fc..92ced287cd72 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instance_contacted_reviewers_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -96,16 +103,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -113,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,4 +147,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_operations.py index 49af0f09b996..d07cc8d9c37e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instance_decisions_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,8 +82,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,16 +109,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -139,4 +153,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py index 4088dd2bb2c6..0aba82fdfe03 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_patch_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,16 +113,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -123,13 +137,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +157,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace_async async def get_by_id( @@ -173,8 +189,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -186,9 +204,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -206,7 +224,9 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload async def patch( @@ -286,8 +306,8 @@ async def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -309,9 +329,11 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,9 +356,9 @@ async def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -354,4 +376,6 @@ async def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_operations.py index 2ba6c31ec8e2..a5d2b5b02851 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -95,9 +102,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,9 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace_async async def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -139,8 +148,10 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -152,9 +163,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -168,7 +179,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace_async async def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -196,8 +209,10 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -209,9 +224,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -225,7 +240,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace_async async def send_reminders( # pylint: disable=inconsistent-return-statements @@ -253,8 +270,10 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -266,9 +285,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -282,7 +301,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace_async async def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -310,8 +331,10 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -322,9 +345,9 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -338,4 +361,6 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py index 5fe768eed11b..7fe2eb650476 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,16 +109,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -139,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -165,8 +181,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -177,9 +195,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +215,6 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_operations.py index 6aafd08331ed..cee0faadf5ba 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,16 +111,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,7 +155,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -167,8 +183,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -180,9 +198,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,7 +218,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } @overload async def create( @@ -271,8 +291,8 @@ async def create( :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Access review instance properties. Is either a model type or a IO type. - Required. + :param properties: Access review instance properties. Is either a + AccessReviewInstanceProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstanceProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -294,9 +314,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -319,9 +341,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -339,4 +361,6 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index 25f1a48c5e1d..b8139a47da40 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_schedule_definitions_assigned_for_my_approval_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,8 +78,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,16 +102,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,4 +146,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_operations.py index 6c4552a738d0..8813a3b3c387 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,16 +110,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -120,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -164,8 +180,10 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -176,9 +194,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -196,7 +214,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -222,8 +242,10 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -234,9 +256,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,7 +272,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload async def create_or_update_by_id( @@ -307,8 +331,8 @@ async def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -331,9 +355,11 @@ async def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -355,9 +381,9 @@ async def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -375,7 +401,9 @@ async def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def stop( # pylint: disable=inconsistent-return-statements @@ -401,8 +429,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -413,9 +443,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,4 +459,6 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_operations.py index aa665255ab17..0db12e5f8ace 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,8 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -86,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -103,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py index 18f37c2fc82c..a5ad9699197e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._tenant_level_access_review_instance_contacted_reviewers_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,16 +102,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,4 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py index 71ce66bf7d01..2d6f150deeda 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py @@ -47,7 +47,7 @@ from ._authorization_management_client_enums import DecisionTargetType from ._authorization_management_client_enums import DefaultDecisionType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/_models_py3.py index cf216148920b..3d2415396bf5 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -54,7 +54,7 @@ class AccessReviewContactedReviewer(_serialization.Model): "created_date_time": {"key": "properties.createdDateTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -85,8 +85,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewContactedReviewer"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review Contacted Reviewer. :paramtype value: @@ -242,8 +242,8 @@ def __init__( *, decision: Optional[Union[str, "_models.AccessReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -271,10 +271,10 @@ def __init__( self.principal_type_properties_reviewed_by_principal_type = None self.principal_name_properties_reviewed_by_principal_name = None self.user_principal_name_properties_reviewed_by_user_principal_name = None - self.type_properties_resource_type = None # type: Optional[str] + self.type_properties_resource_type: Optional[str] = None self.id_properties_resource_id = None self.display_name_properties_resource_display_name = None - self.type_properties_principal_type = None # type: Optional[str] + self.type_properties_principal_type: Optional[str] = None self.id_properties_principal_id = None self.display_name_properties_principal_display_name = None @@ -317,10 +317,10 @@ class AccessReviewDecisionIdentity(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None self.id = None self.display_name = None @@ -340,8 +340,12 @@ class AccessReviewDecisionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewDecision"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewDecision"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Decision list. :paramtype value: @@ -465,8 +469,8 @@ def __init__( *, decision: Optional[Union[str, "_models.AccessReviewResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -491,10 +495,10 @@ def __init__( self.principal_type_reviewed_by_principal_type = None self.principal_name_reviewed_by_principal_name = None self.user_principal_name_reviewed_by_user_principal_name = None - self.type_resource_type = None # type: Optional[str] + self.type_resource_type: Optional[str] = None self.id_resource_id = None self.display_name_resource_display_name = None - self.type_principal_type = None # type: Optional[str] + self.type_principal_type: Optional[str] = None self.id_principal_id = None self.display_name_principal_display_name = None @@ -526,10 +530,10 @@ class AccessReviewDecisionResource(_serialization.Model): "display_name": {"key": "displayName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None self.id = None self.display_name = None @@ -566,10 +570,10 @@ class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity) "app_id": {"key": "appId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "servicePrincipal" # type: str + self.type: str = "servicePrincipal" self.app_id = None @@ -605,10 +609,10 @@ class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity): "user_principal_name": {"key": "userPrincipalName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "user" # type: str + self.type: str = "user" self.user_principal_name = None @@ -725,8 +729,8 @@ def __init__( Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -864,8 +868,8 @@ def __init__( end_date_time: Optional[datetime.datetime] = None, reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, backup_reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: The DateTime when the review instance is scheduled to be start. :paramtype start_date_time: ~datetime.datetime @@ -905,8 +909,12 @@ class AccessReviewInstanceListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewInstance"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Instance list. :paramtype value: @@ -968,8 +976,8 @@ def __init__( end_date_time: Optional[datetime.datetime] = None, reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, backup_reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: The DateTime when the review instance is scheduled to be start. :paramtype start_date_time: ~datetime.datetime @@ -1013,7 +1021,7 @@ class AccessReviewReviewer(_serialization.Model): "principal_type": {"key": "principalType", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: The id of the reviewer(user/servicePrincipal). :paramtype principal_id: str @@ -1246,8 +1254,8 @@ def __init__( # pylint: disable=too-many-locals Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -1388,8 +1396,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewScheduleDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review Schedule Definition list. :paramtype value: @@ -1594,8 +1602,8 @@ def __init__( # pylint: disable=too-many-locals end_date: Optional[datetime.datetime] = None, type_settings_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -1805,8 +1813,8 @@ def __init__( end_date: Optional[datetime.datetime] = None, type_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -1891,7 +1899,7 @@ class ErrorDefinition(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinitionProperties"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs: Any) -> None: """ :keyword error: Error of the list gateway status. :paramtype error: @@ -1921,7 +1929,7 @@ class ErrorDefinitionProperties(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code of list gateway. :paramtype code: str @@ -1958,8 +1966,8 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -2006,7 +2014,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2029,7 +2037,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.authorization.v2021_07_01_preview.models.Operation] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py index 58318912431f..dda9abe5b586 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py @@ -25,7 +25,7 @@ ) from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py index 484bc54b7fee..acb5bf8a0759 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +57,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,8 +72,10 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +87,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,8 +139,10 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -141,9 +152,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -161,7 +172,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload def put( @@ -204,8 +217,8 @@ def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -227,9 +240,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -250,9 +265,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +285,6 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py index 8acb39896ba5..7098d37d935a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,8 +111,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -128,16 +137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -145,13 +161,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -165,4 +181,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py index e7e4db26119e..44b4d12e3153 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,8 +120,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -138,16 +147,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,13 +171,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -175,4 +191,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py index 1d47910242d2..dc4006cfce8b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +79,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +95,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,8 +110,10 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +127,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,8 +184,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -197,16 +210,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,13 +234,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -234,7 +254,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace def get_by_id( @@ -264,8 +286,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -277,9 +301,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -297,7 +321,9 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload def patch( @@ -377,8 +403,8 @@ def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -400,9 +426,11 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -425,9 +453,9 @@ def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -445,4 +473,6 @@ def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py index 6a2882f894f1..c90aa916c90f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_reset_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +92,7 @@ def build_reset_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +109,9 @@ def build_apply_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +125,7 @@ def build_apply_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +142,9 @@ def build_send_reminders_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +158,7 @@ def build_send_reminders_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +173,9 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +188,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,8 +244,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -242,9 +259,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +275,9 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -286,8 +305,10 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -299,9 +320,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +336,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -343,8 +366,10 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -356,9 +381,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -372,7 +397,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace def send_reminders( # pylint: disable=inconsistent-return-statements @@ -400,8 +427,10 @@ def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -413,9 +442,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,7 +458,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -457,8 +488,10 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -469,9 +502,9 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -485,4 +518,6 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py index 12ac7d26e5b6..486f378d7e68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,8 +144,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -158,16 +169,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -175,13 +193,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,7 +213,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -221,8 +241,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -233,9 +255,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -253,4 +275,6 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py index 7242fd35f829..3ea68e813970 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +79,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +95,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,8 +110,10 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +127,7 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,8 +182,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -195,16 +208,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -212,13 +232,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -232,7 +252,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -258,8 +280,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -271,9 +295,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -291,7 +315,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } @overload def create( @@ -362,8 +388,8 @@ def create( :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Access review instance properties. Is either a model type or a IO type. - Required. + :param properties: Access review instance properties. Is either a + AccessReviewInstanceProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstanceProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -385,9 +411,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -410,9 +438,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -430,4 +458,6 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index 1cd2a71810c1..7a7703f07a3f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,8 +102,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,16 +126,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +150,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,4 +170,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py index 025df9b6ca7a..1d001c12928b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +106,9 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +121,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,8 +138,10 @@ def build_create_or_update_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +154,7 @@ def build_create_or_update_by_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +171,9 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +186,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,8 +235,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -243,16 +260,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,13 +284,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -280,7 +304,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -304,8 +330,10 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -316,9 +344,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -336,7 +364,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -362,8 +392,10 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -374,9 +406,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -390,7 +422,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload def create_or_update_by_id( @@ -447,8 +481,8 @@ def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -471,9 +505,11 @@ def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -495,9 +531,9 @@ def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -515,7 +551,9 @@ def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def stop( # pylint: disable=inconsistent-return-statements @@ -541,8 +579,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -553,9 +593,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -569,4 +609,6 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_operations.py index 3e67c27cbd08..f9e7474b7a0f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,8 +94,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,16 +117,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +141,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,4 +161,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py index 2d1375870b07..720ea6937edc 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,8 +110,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,16 +135,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -143,13 +159,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -163,4 +179,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_client.py index d0e22addc8c4..a46d1d3a4131 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -181,7 +181,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -294,15 +294,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_configuration.py index 6f0f7d898333..90fcd975c71d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_configuration.py @@ -44,10 +44,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_metadata.json index 96baefa219b0..9886474c998f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -128,4 +136,4 @@ "alert_incidents": "AlertIncidentsOperations", "alert_operation": "AlertOperationOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_client.py index f5571412e0f8..7a4005894d3d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -181,7 +181,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -301,5 +301,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py index 96a5dd0f6950..44a7777850b2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py @@ -50,7 +50,7 @@ from ._alert_operation_operations import AlertOperationOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_operations.py index 905e72c0e6c5..fe5ea6c01c08 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._access_review_default_settings_operations import build_get_request, build_put_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,10 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -81,9 +88,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -101,7 +108,9 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload async def put( @@ -144,8 +153,8 @@ async def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -167,9 +176,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -190,9 +201,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,4 +221,6 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_operations.py index 9e96b11d337c..fcdd1bdb3873 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._access_review_history_definition_instance_operations import build_generate_download_uri_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ async def generate_download_uri( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None) request = build_generate_download_uri_request( history_definition_id=history_definition_id, @@ -91,9 +98,9 @@ async def generate_download_uri( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,4 +118,6 @@ async def generate_download_uri( return deserialized - generate_download_uri.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"} # type: ignore + generate_download_uri.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_operations.py index a76662228006..4585577d1121 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._access_review_history_definition_instances_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,8 +72,10 @@ def list(self, history_definition_id: str, **kwargs: Any) -> AsyncIterable["_mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -90,12 +97,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -103,13 +110,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,4 +130,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_operations.py index 3f2e22e82e9c..bffe33ec479e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._access_review_history_definition_operations import build_create_request, build_delete_by_id_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -105,8 +110,8 @@ async def create( :param history_definition_id: The id of the access review history definition. Required. :type history_definition_id: str - :param properties: Access review history definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review history definition properties. Is either a + AccessReviewHistoryDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or IO @@ -129,9 +134,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -153,9 +160,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +180,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } @distributed_trace_async async def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -199,8 +208,10 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( history_definition_id=history_definition_id, @@ -211,9 +222,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -227,4 +238,6 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_operations.py index 231d3e5291af..ccb5e38cd7de 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._access_review_history_definitions_operations import build_get_by_id_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,12 +102,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -128,7 +135,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions" + } @distributed_trace_async async def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.AccessReviewHistoryDefinition: @@ -152,8 +161,10 @@ async def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( history_definition_id=history_definition_id, @@ -164,9 +175,9 @@ async def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models. params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -184,4 +195,6 @@ async def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models. return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py index 11aeca60f191..97d48eba6f81 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instance_contacted_reviewers_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,8 +76,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,12 +102,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -128,4 +135,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_operations.py index 830efb11953b..cd6eafc899a0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._access_review_instance_decisions_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,12 +108,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,13 +121,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,4 +141,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py index 17980d374525..62e2004d2199 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,6 +34,10 @@ build_patch_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,12 +112,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,7 +145,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace_async async def get_by_id( @@ -168,8 +177,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -181,9 +192,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -201,7 +212,9 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload async def patch( @@ -281,8 +294,8 @@ async def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -304,9 +317,11 @@ async def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -329,9 +344,9 @@ async def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -349,4 +364,6 @@ async def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_operations.py index 378596af3f8a..59734f22a992 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -95,9 +102,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,9 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace_async async def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -139,8 +148,10 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -152,9 +163,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -168,7 +179,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace_async async def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -196,8 +209,10 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -209,9 +224,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -225,7 +240,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace_async async def send_reminders( # pylint: disable=inconsistent-return-statements @@ -253,8 +270,10 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -266,9 +285,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -282,7 +301,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace_async async def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -310,8 +331,10 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -322,9 +345,9 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -338,4 +361,6 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py index d18174fb4204..0538b39bb6b7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,6 +33,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,12 +108,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,13 +121,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,7 +141,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -160,8 +169,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -172,9 +183,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -192,4 +203,6 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_operations.py index 2b546a853b64..2b0b3a028c86 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,12 +110,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +123,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +143,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -162,8 +171,10 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -175,9 +186,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -195,7 +206,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) - return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } @overload async def create( @@ -266,8 +279,8 @@ async def create( :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Access review instance properties. Is either a model type or a IO type. - Required. + :param properties: Access review instance properties. Is either a + AccessReviewInstanceProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -289,9 +302,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -314,9 +329,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -334,4 +349,6 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index 8dc9c55cc684..443cc9d9f040 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._access_review_schedule_definitions_assigned_for_my_approval_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,12 +101,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -107,13 +114,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,4 +134,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_operations.py index 6bbc963e6236..335d0e93795b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,12 +109,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -115,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -135,7 +142,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace_async async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -159,8 +168,10 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -171,9 +182,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -191,7 +202,9 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -217,8 +230,10 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -229,9 +244,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -245,7 +260,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload async def create_or_update_by_id( @@ -302,8 +319,8 @@ async def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -326,9 +343,11 @@ async def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,9 +369,9 @@ async def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -370,7 +389,9 @@ async def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def stop( # pylint: disable=inconsistent-return-statements @@ -396,8 +417,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -408,9 +431,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -424,4 +447,6 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_configurations_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_configurations_operations.py index 024cacb776bc..d1a8739579a2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_configurations_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_configurations_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,6 +34,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,8 +91,10 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertCo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertConfiguration] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertConfiguration] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -98,9 +105,9 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertCo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,10 +124,10 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertCo return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} @overload - async def update( + async def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, @@ -128,7 +135,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AlertConfiguration: + ) -> None: """Update an alert configuration. :param scope: The scope of the alert configuration. Required. @@ -141,15 +148,15 @@ async def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AlertConfiguration: + ) -> None: """Update an alert configuration. :param scope: The scope of the alert configuration. Required. @@ -162,30 +169,30 @@ async def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO], **kwargs: Any - ) -> _models.AlertConfiguration: + ) -> None: """Update an alert configuration. :param scope: The scope of the alert configuration. Required. :type scope: str :param alert_id: The name of the alert configuration to update. Required. :type alert_id: str - :param parameters: Parameters for the alert configuration. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the alert configuration. Is either a AlertConfiguration type + or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -199,9 +206,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertConfiguration] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -223,26 +232,22 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AlertConfiguration", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations/{alertId}"} # type: ignore + update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.AlertConfiguration"]: @@ -259,8 +264,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertConfigurationListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertConfigurationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -281,12 +288,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -294,13 +301,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -313,4 +320,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_definitions_operations.py index 0464db6778ac..98338e383c5b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._alert_definitions_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertDefinition] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -94,9 +101,9 @@ async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -113,7 +120,9 @@ async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _mod return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertDefinitions/{alertDefinitionId}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.AlertDefinition"]: @@ -130,8 +139,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertDefinitionListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,12 +163,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -165,13 +176,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -184,4 +195,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertDefinitions"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_incidents_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_incidents_operations.py index 803f81a0706b..58bfe85793d4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_incidents_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_incidents_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,6 +34,10 @@ build_remediate_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,8 +93,10 @@ async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertIncident] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertIncident] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -101,9 +108,9 @@ async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -120,7 +127,9 @@ async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents/{alertIncidentId}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}" + } @distributed_trace def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncIterable["_models.AlertIncident"]: @@ -139,8 +148,10 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncItera _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertIncidentListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertIncidentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -162,12 +173,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -175,13 +186,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertIncidentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -194,7 +205,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents"} # type: ignore + list_for_scope.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" + } @distributed_trace_async async def remediate( # pylint: disable=inconsistent-return-statements @@ -224,8 +237,10 @@ async def remediate( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_remediate_request( scope=scope, @@ -237,9 +252,9 @@ async def remediate( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -252,4 +267,6 @@ async def remediate( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - remediate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents/{alertIncidentId}/remediate"} # type: ignore + remediate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_operation_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_operation_operations.py index a4e26fd47547..3ccd6d860aa2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_operation_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alert_operation_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._alert_operation_operations import build_get_request, build_list_for_scope_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,8 +79,10 @@ async def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.Ale _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -86,9 +93,9 @@ async def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.Ale params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +112,7 @@ async def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.Ale return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/operations/{operationId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}"} @distributed_trace_async async def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperationListResult: @@ -129,8 +136,10 @@ async def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationListResult] = kwargs.pop("cls", None) request = build_list_for_scope_request( scope=scope, @@ -140,9 +149,9 @@ async def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -159,4 +168,4 @@ async def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperat return deserialized - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/operations"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alerts_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alerts_operations.py index 8b9859bb7937..592817a3a0ad 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alerts_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_alerts_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,6 +38,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,8 +94,10 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -101,9 +108,9 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -120,10 +127,10 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} @overload - async def update( + async def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, @@ -131,7 +138,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Alert: + ) -> None: """Update an alert. :param scope: The scope of the alert. Required. @@ -144,15 +151,15 @@ async def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Alert: + ) -> None: """Update an alert. :param scope: The scope of the alert. Required. @@ -165,29 +172,29 @@ async def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO], **kwargs: Any - ) -> _models.Alert: + ) -> None: """Update an alert. :param scope: The scope of the alert. Required. :type scope: str :param alert_id: The name of the alert to dismiss. Required. :type alert_id: str - :param parameters: Parameters for the alert. Is either a model type or a IO type. Required. + :param parameters: Parameters for the alert. Is either a Alert type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -201,9 +208,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -225,26 +234,22 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}"} # type: ignore + update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -261,8 +266,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -283,12 +290,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -296,13 +303,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -315,7 +322,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts"} async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertOperationResult: error_map = { @@ -329,8 +336,10 @@ async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) request = build_refresh_request( scope=scope, @@ -341,9 +350,9 @@ async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -363,7 +372,9 @@ async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _m return deserialized - _refresh_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/refresh"} # type: ignore + _refresh_initial.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" + } @distributed_trace_async async def begin_refresh( @@ -392,13 +403,15 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._refresh_initial( # type: ignore + raw_result = await self._refresh_initial( scope=scope, alert_id=alert_id, api_version=api_version, @@ -420,9 +433,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -434,9 +447,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_refresh.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/refresh"} # type: ignore + begin_refresh.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" + } async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperationResult: error_map = { @@ -450,8 +465,10 @@ async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.Alert _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) request = build_refresh_all_request( scope=scope, @@ -461,9 +478,9 @@ async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.Alert params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -483,7 +500,7 @@ async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.Alert return deserialized - _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/refresh"} # type: ignore + _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} @distributed_trace_async async def begin_refresh_all(self, scope: str, **kwargs: Any) -> AsyncLROPoller[_models.AlertOperationResult]: @@ -508,13 +525,15 @@ async def begin_refresh_all(self, scope: str, **kwargs: Any) -> AsyncLROPoller[_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._refresh_all_initial( # type: ignore + raw_result = await self._refresh_all_initial( scope=scope, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) kwargs.pop("error_map", None) @@ -530,9 +549,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -544,6 +563,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/refresh"} # type: ignore + begin_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_operations.py index c91866fefb83..42cad046de48 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,8 +69,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -85,12 +92,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -98,13 +105,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -118,4 +125,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_operations.py index bb72f9e61314..63e8503dd0da 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._scope_access_review_default_settings_operations import build_get_request, build_put_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,10 @@ async def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSet _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -83,9 +90,9 @@ async def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSet params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +110,7 @@ async def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSet return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} @overload async def put( @@ -157,8 +164,8 @@ async def put( :param scope: The scope of the resource. Required. :type scope: str - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -180,9 +187,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -203,9 +212,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -223,4 +232,4 @@ async def put( return deserialized - put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_operations.py index bdee04f37e00..2628f9c41ba9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,6 +30,10 @@ build_generate_download_uri_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def generate_download_uri( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None) request = build_generate_download_uri_request( scope=scope, @@ -95,9 +102,9 @@ async def generate_download_uri( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -115,4 +122,6 @@ async def generate_download_uri( return deserialized - generate_download_uri.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"} # type: ignore + generate_download_uri.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_operations.py index 6e2711f432aa..63e6bf89a2ee 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._scope_access_review_history_definition_instances_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,8 +76,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,12 +101,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -107,13 +114,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,4 +134,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_operations.py index ba58dfb1c056..4cb909ab0aea 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -30,6 +31,10 @@ build_delete_by_id_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -122,8 +127,8 @@ async def create( :type scope: str :param history_definition_id: The id of the access review history definition. Required. :type history_definition_id: str - :param properties: Access review history definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review history definition properties. Is either a + AccessReviewHistoryDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or IO @@ -146,9 +151,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -170,9 +177,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -190,7 +197,9 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } @distributed_trace_async async def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -218,8 +227,10 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( scope=scope, @@ -230,9 +241,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -246,4 +257,6 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_operations.py index dcb54bce26c8..4ae2c993d524 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,6 +33,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,8 +82,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,12 +107,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -113,13 +120,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,7 +140,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"} @distributed_trace_async async def get_by_id( @@ -161,8 +168,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( scope=scope, @@ -173,9 +182,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -193,4 +202,6 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_operations.py index 8f4106c0564e..c1ba484742bf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._scope_access_review_instance_contacted_reviewers_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,8 +78,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -97,12 +104,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -110,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,4 +137,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_operations.py index 8cd5d24f3f04..ed9f1bb9782f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._scope_access_review_instance_decisions_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,12 +110,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +123,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,4 +143,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_operations.py index c2c5b31b79e7..9c73708f0b0a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +89,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( scope=scope, @@ -97,9 +104,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -113,7 +120,9 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @overload async def record_all_decisions( # pylint: disable=inconsistent-return-statements @@ -193,7 +202,8 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Record all decisions payload. Is either a model type or a IO type. Required. + :param properties: Record all decisions payload. Is either a RecordAllDecisionsProperties type + or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.RecordAllDecisionsProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -215,9 +225,11 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -240,9 +252,9 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -256,7 +268,9 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - record_all_decisions.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions"} # type: ignore + record_all_decisions.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions" + } @distributed_trace_async async def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -286,8 +300,10 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( scope=scope, @@ -299,9 +315,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +331,9 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace_async async def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -345,8 +363,10 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( scope=scope, @@ -358,9 +378,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -374,7 +394,9 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace_async async def send_reminders( # pylint: disable=inconsistent-return-statements @@ -404,8 +426,10 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( scope=scope, @@ -417,9 +441,9 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -433,4 +457,6 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_operations.py index cd92e2258509..a4ff9cbdba95 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,12 +112,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,7 +145,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace_async async def get_by_id( @@ -168,8 +177,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( scope=scope, @@ -181,9 +192,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -201,7 +212,9 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } @overload async def create( @@ -281,8 +294,8 @@ async def create( :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Access review instance properties. Is either a model type or a IO type. - Required. + :param properties: Access review instance properties. Is either a + AccessReviewInstanceProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -304,9 +317,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -329,9 +344,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -349,4 +364,6 @@ async def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_operations.py index 3a1405d342f2..a879d8f0f1ae 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ build_stop_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,12 +111,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +144,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} @distributed_trace_async async def get_by_id( @@ -165,8 +172,10 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( scope=scope, @@ -177,9 +186,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,7 +206,9 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -225,8 +236,10 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( scope=scope, @@ -237,9 +250,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -253,7 +266,9 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload async def create_or_update_by_id( @@ -324,8 +339,8 @@ async def create_or_update_by_id( :type scope: str :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -348,9 +363,11 @@ async def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -372,9 +389,9 @@ async def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -392,7 +409,9 @@ async def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace_async async def stop( # pylint: disable=inconsistent-return-statements @@ -420,8 +439,10 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( scope=scope, @@ -432,9 +453,9 @@ async def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -448,4 +469,6 @@ async def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py index 7822f74f4596..de85674a70c1 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,6 +29,10 @@ from ..._vendor import _convert_request from ...operations._tenant_level_access_review_instance_contacted_reviewers_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,8 +76,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,12 +101,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -107,13 +114,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,4 +134,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py index e75f1ded6c06..ec0b44dcef81 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py @@ -82,7 +82,7 @@ from ._authorization_management_client_enums import RecordAllDecisionsResult from ._authorization_management_client_enums import SeverityLevel from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/_models_py3.py index da9605ab33a7..5e0b94757ba1 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -54,7 +54,7 @@ class AccessReviewContactedReviewer(_serialization.Model): "created_date_time": {"key": "properties.createdDateTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -85,8 +85,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewContactedReviewer"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review Contacted Reviewer. :paramtype value: @@ -257,8 +257,8 @@ def __init__( # pylint: disable=too-many-locals List[Union[str, "_models.AccessReviewDecisionPrincipalResourceMembershipType"]] ] = None, type_properties_resource_type: Optional[Union[str, "_models.DecisionResourceType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -302,7 +302,7 @@ def __init__( # pylint: disable=too-many-locals self.type_properties_resource_type = type_properties_resource_type self.id_properties_resource_id = None self.display_name_properties_resource_display_name = None - self.type_properties_principal_type = None # type: Optional[str] + self.type_properties_principal_type: Optional[str] = None self.id_properties_principal_id = None self.display_name_properties_principal_display_name = None @@ -345,10 +345,10 @@ class AccessReviewDecisionIdentity(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None self.id = None self.display_name = None @@ -386,13 +386,13 @@ class AccessReviewDecisionInsight(_serialization.Model): "insight_created_date_time": {"key": "properties.insightCreatedDateTime", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None - self.type_properties_type = None # type: Optional[str] + self.type_properties_type: Optional[str] = None self.insight_created_date_time = None @@ -425,10 +425,10 @@ class AccessReviewDecisionInsightProperties(_serialization.Model): _subtype_map = {"type": {"userSignInInsight": "AccessReviewDecisionUserSignInInsightProperties"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None self.insight_created_date_time = None @@ -447,8 +447,12 @@ class AccessReviewDecisionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewDecision"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewDecision"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Decision list. :paramtype value: @@ -587,8 +591,8 @@ def __init__( List[Union[str, "_models.AccessReviewDecisionPrincipalResourceMembershipType"]] ] = None, type_resource_type: Optional[Union[str, "_models.DecisionResourceType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", @@ -629,7 +633,7 @@ def __init__( self.type_resource_type = type_resource_type self.id_resource_id = None self.display_name_resource_display_name = None - self.type_principal_type = None # type: Optional[str] + self.type_principal_type: Optional[str] = None self.id_principal_id = None self.display_name_principal_display_name = None @@ -666,10 +670,10 @@ class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity) "app_id": {"key": "appId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "servicePrincipal" # type: str + self.type: str = "servicePrincipal" self.app_id = None @@ -705,10 +709,10 @@ class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity): "user_principal_name": {"key": "userPrincipalName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "user" # type: str + self.type: str = "user" self.user_principal_name = None @@ -740,10 +744,10 @@ class AccessReviewDecisionUserSignInInsightProperties(AccessReviewDecisionInsigh "last_sign_in_date_time": {"key": "lastSignInDateTime", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "userSignInInsight" # type: str + self.type: str = "userSignInInsight" self.last_sign_in_date_time = None @@ -860,8 +864,8 @@ def __init__( Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -1061,8 +1065,8 @@ def __init__( end_date: Optional[datetime.datetime] = None, type_properties_settings_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the history definition. :paramtype display_name: str @@ -1141,8 +1145,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewHistoryInstance"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review History Definition's Instance list. :paramtype value: @@ -1175,8 +1179,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewHistoryDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review History Definition list. :paramtype value: @@ -1297,8 +1301,8 @@ def __init__( end_date: Optional[datetime.datetime] = None, type_settings_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the history definition. :paramtype display_name: str @@ -1428,8 +1432,8 @@ def __init__( run_date_time: Optional[datetime.datetime] = None, fulfilled_date_time: Optional[datetime.datetime] = None, expiration: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword review_history_period_start_date_time: Date time used when selecting review data, all reviews included in data start on or after this date. For use only with one-time/non-recurring @@ -1525,8 +1529,8 @@ def __init__( end_date_time: Optional[datetime.datetime] = None, reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, backup_reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: The DateTime when the review instance is scheduled to be start. :paramtype start_date_time: ~datetime.datetime @@ -1566,8 +1570,12 @@ class AccessReviewInstanceListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AccessReviewInstance"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AccessReviewInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Access Review Instance list. :paramtype value: @@ -1629,8 +1637,8 @@ def __init__( end_date_time: Optional[datetime.datetime] = None, reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, backup_reviewers: Optional[List["_models.AccessReviewReviewer"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_date_time: The DateTime when the review instance is scheduled to be start. :paramtype start_date_time: ~datetime.datetime @@ -1674,7 +1682,7 @@ class AccessReviewReviewer(_serialization.Model): "principal_type": {"key": "principalType", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: The id of the reviewer(user/servicePrincipal). :paramtype principal_id: str @@ -1925,8 +1933,8 @@ def __init__( # pylint: disable=too-many-locals Union[str, "_models.AccessReviewRecurrencePatternType"] ] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -2082,8 +2090,8 @@ def __init__( *, value: Optional[List["_models.AccessReviewScheduleDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Access Review Schedule Definition list. :paramtype value: @@ -2306,8 +2314,8 @@ def __init__( # pylint: disable=too-many-locals end_date: Optional[datetime.datetime] = None, type_settings_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the schedule definition. :paramtype display_name: str @@ -2532,8 +2540,8 @@ def __init__( end_date: Optional[datetime.datetime] = None, type_recurrence_pattern_type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None, interval: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the review creator is enabled. @@ -2672,8 +2680,8 @@ def __init__( include_access_below_resource: Optional[bool] = None, exclude_resource_id: Optional[str] = None, exclude_role_definition_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword inactive_duration: Duration users are inactive for. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert @@ -2767,7 +2775,7 @@ class Alert(_serialization.Model): # pylint: disable=too-many-instance-attribut "alert_configuration": {"key": "properties.alertConfiguration", "type": "AlertConfiguration"}, } - def __init__(self, *, is_active: Optional[bool] = None, **kwargs): + def __init__(self, *, is_active: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_active: False by default; true if the alert is active. :paramtype is_active: bool @@ -2806,6 +2814,8 @@ class AlertConfiguration(_serialization.Model): :vartype is_enabled: bool :ivar alert_configuration_type: The alert configuration type. :vartype alert_configuration_type: str + :ivar alert_definition: The alert definition. + :vartype alert_definition: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertDefinition """ _validation = { @@ -2814,6 +2824,7 @@ class AlertConfiguration(_serialization.Model): "type": {"readonly": True}, "alert_definition_id": {"readonly": True}, "scope": {"readonly": True}, + "alert_definition": {"readonly": True}, } _attribute_map = { @@ -2824,9 +2835,10 @@ class AlertConfiguration(_serialization.Model): "scope": {"key": "properties.scope", "type": "str"}, "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, "alert_configuration_type": {"key": "properties.alertConfigurationType", "type": "str"}, + "alert_definition": {"key": "properties.alertDefinition", "type": "AlertDefinition"}, } - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the specific alert. @@ -2839,7 +2851,8 @@ def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): self.alert_definition_id = None self.scope = None self.is_enabled = is_enabled - self.alert_configuration_type = None # type: Optional[str] + self.alert_configuration_type: Optional[str] = None + self.alert_definition = None class AlertConfigurationListResult(_serialization.Model): @@ -2857,8 +2870,12 @@ class AlertConfigurationListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AlertConfiguration"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AlertConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Alert configuration list. :paramtype value: list[~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration] @@ -2892,12 +2909,15 @@ class AlertConfigurationProperties(_serialization.Model): :vartype is_enabled: bool :ivar alert_configuration_type: The alert configuration type. Required. :vartype alert_configuration_type: str + :ivar alert_definition: The alert definition. + :vartype alert_definition: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertDefinition """ _validation = { "alert_definition_id": {"readonly": True}, "scope": {"readonly": True}, "alert_configuration_type": {"required": True}, + "alert_definition": {"readonly": True}, } _attribute_map = { @@ -2905,6 +2925,7 @@ class AlertConfigurationProperties(_serialization.Model): "scope": {"key": "scope", "type": "str"}, "is_enabled": {"key": "isEnabled", "type": "bool"}, "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, + "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, } _subtype_map = { @@ -2916,7 +2937,7 @@ class AlertConfigurationProperties(_serialization.Model): } } - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the specific alert. @@ -2926,7 +2947,8 @@ def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): self.alert_definition_id = None self.scope = None self.is_enabled = is_enabled - self.alert_configuration_type = None # type: Optional[str] + self.alert_configuration_type: Optional[str] = None + self.alert_definition = None class AlertDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -2992,7 +3014,7 @@ class AlertDefinition(_serialization.Model): # pylint: disable=too-many-instanc "is_configurable": {"key": "properties.isConfigurable", "type": "bool"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -3024,8 +3046,8 @@ class AlertDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AlertDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.AlertDefinition"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Alert definition list. :paramtype value: list[~azure.mgmt.authorization.v2021_12_01_preview.models.AlertDefinition] @@ -3065,13 +3087,13 @@ class AlertIncident(_serialization.Model): "alert_incident_type": {"key": "properties.alertIncidentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None - self.alert_incident_type = None # type: Optional[str] + self.alert_incident_type: Optional[str] = None class AlertIncidentListResult(_serialization.Model): @@ -3089,8 +3111,8 @@ class AlertIncidentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AlertIncident"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.AlertIncident"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Alert incident list. :paramtype value: list[~azure.mgmt.authorization.v2021_12_01_preview.models.AlertIncident] @@ -3134,10 +3156,10 @@ class AlertIncidentProperties(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.alert_incident_type = None # type: Optional[str] + self.alert_incident_type: Optional[str] = None class AlertListResult(_serialization.Model): @@ -3154,7 +3176,9 @@ class AlertListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Alert"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Alert"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Alert list. :paramtype value: list[~azure.mgmt.authorization.v2021_12_01_preview.models.Alert] @@ -3181,8 +3205,12 @@ class AlertOperationListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AlertOperationResult"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AlertOperationResult"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Alert operation list. :paramtype value: @@ -3216,7 +3244,7 @@ class AlertOperationResult(_serialization.Model): "status": {"key": "status", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -3239,12 +3267,15 @@ class AzureRolesAssignedOutsidePimAlertConfigurationProperties(AlertConfiguratio :vartype is_enabled: bool :ivar alert_configuration_type: The alert configuration type. Required. :vartype alert_configuration_type: str + :ivar alert_definition: The alert definition. + :vartype alert_definition: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertDefinition """ _validation = { "alert_definition_id": {"readonly": True}, "scope": {"readonly": True}, "alert_configuration_type": {"required": True}, + "alert_definition": {"readonly": True}, } _attribute_map = { @@ -3252,16 +3283,17 @@ class AzureRolesAssignedOutsidePimAlertConfigurationProperties(AlertConfiguratio "scope": {"key": "scope", "type": "str"}, "is_enabled": {"key": "isEnabled", "type": "bool"}, "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, + "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, } - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the specific alert. :paramtype is_enabled: bool """ super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type = "AzureRolesAssignedOutsidePimAlertConfiguration" # type: str + self.alert_configuration_type: str = "AzureRolesAssignedOutsidePimAlertConfiguration" class AzureRolesAssignedOutsidePimAlertIncidentProperties( @@ -3325,10 +3357,10 @@ class AzureRolesAssignedOutsidePimAlertIncidentProperties( "requestor_user_principal_name": {"key": "requestorUserPrincipalName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.alert_incident_type = "AzureRolesAssignedOutsidePimAlertIncident" # type: str + self.alert_incident_type: str = "AzureRolesAssignedOutsidePimAlertIncident" self.assignee_display_name = None self.assignee_user_principal_name = None self.assignee_id = None @@ -3357,7 +3389,7 @@ class CloudErrorBody(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -3387,12 +3419,15 @@ class DuplicateRoleCreatedAlertConfigurationProperties(AlertConfigurationPropert :vartype is_enabled: bool :ivar alert_configuration_type: The alert configuration type. Required. :vartype alert_configuration_type: str + :ivar alert_definition: The alert definition. + :vartype alert_definition: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertDefinition """ _validation = { "alert_definition_id": {"readonly": True}, "scope": {"readonly": True}, "alert_configuration_type": {"required": True}, + "alert_definition": {"readonly": True}, } _attribute_map = { @@ -3400,16 +3435,17 @@ class DuplicateRoleCreatedAlertConfigurationProperties(AlertConfigurationPropert "scope": {"key": "scope", "type": "str"}, "is_enabled": {"key": "isEnabled", "type": "bool"}, "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, + "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, } - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the specific alert. :paramtype is_enabled: bool """ super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type = "DuplicateRoleCreatedAlertConfiguration" # type: str + self.alert_configuration_type: str = "DuplicateRoleCreatedAlertConfiguration" class DuplicateRoleCreatedAlertIncidentProperties(AlertIncidentProperties): @@ -3443,10 +3479,10 @@ class DuplicateRoleCreatedAlertIncidentProperties(AlertIncidentProperties): "reason": {"key": "reason", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.alert_incident_type = "DuplicateRoleCreatedAlertIncident" # type: str + self.alert_incident_type: str = "DuplicateRoleCreatedAlertIncident" self.role_name = None self.duplicate_roles = None self.reason = None @@ -3463,7 +3499,7 @@ class ErrorDefinition(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinitionProperties"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinitionProperties"] = None, **kwargs: Any) -> None: """ :keyword error: Error of the list gateway status. :paramtype error: @@ -3493,7 +3529,7 @@ class ErrorDefinitionProperties(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code of list gateway. :paramtype code: str @@ -3530,8 +3566,8 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -3578,7 +3614,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -3601,7 +3637,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.authorization.v2021_12_01_preview.models.Operation] @@ -3647,8 +3685,8 @@ def __init__( *, decision: Optional[Union[str, "_models.RecordAllDecisionsResult"]] = None, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword decision: The decision to make. Approvers can take action of Approve/Deny. Known values are: "Approve" and "Deny". @@ -3680,6 +3718,8 @@ class TooManyOwnersAssignedToResourceAlertConfigurationProperties(AlertConfigura :vartype is_enabled: bool :ivar alert_configuration_type: The alert configuration type. Required. :vartype alert_configuration_type: str + :ivar alert_definition: The alert definition. + :vartype alert_definition: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertDefinition :ivar threshold_number_of_owners: The threshold number of owners. :vartype threshold_number_of_owners: int :ivar threshold_percentage_of_owners_out_of_all_role_members: The threshold percentage of @@ -3691,6 +3731,7 @@ class TooManyOwnersAssignedToResourceAlertConfigurationProperties(AlertConfigura "alert_definition_id": {"readonly": True}, "scope": {"readonly": True}, "alert_configuration_type": {"required": True}, + "alert_definition": {"readonly": True}, } _attribute_map = { @@ -3698,6 +3739,7 @@ class TooManyOwnersAssignedToResourceAlertConfigurationProperties(AlertConfigura "scope": {"key": "scope", "type": "str"}, "is_enabled": {"key": "isEnabled", "type": "bool"}, "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, + "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, "threshold_number_of_owners": {"key": "thresholdNumberOfOwners", "type": "int"}, "threshold_percentage_of_owners_out_of_all_role_members": { "key": "thresholdPercentageOfOwnersOutOfAllRoleMembers", @@ -3711,8 +3753,8 @@ def __init__( is_enabled: Optional[bool] = None, threshold_number_of_owners: Optional[int] = None, threshold_percentage_of_owners_out_of_all_role_members: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the specific alert. @@ -3724,7 +3766,7 @@ def __init__( :paramtype threshold_percentage_of_owners_out_of_all_role_members: int """ super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type = "TooManyOwnersAssignedToResourceAlertConfiguration" # type: str + self.alert_configuration_type: str = "TooManyOwnersAssignedToResourceAlertConfiguration" self.threshold_number_of_owners = threshold_number_of_owners self.threshold_percentage_of_owners_out_of_all_role_members = ( threshold_percentage_of_owners_out_of_all_role_members @@ -3758,10 +3800,10 @@ class TooManyOwnersAssignedToResourceAlertIncidentProperties(AlertIncidentProper "assignee_type": {"key": "assigneeType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.alert_incident_type = "TooManyOwnersAssignedToResourceAlertIncident" # type: str + self.alert_incident_type: str = "TooManyOwnersAssignedToResourceAlertIncident" self.assignee_name = None self.assignee_type = None @@ -3782,6 +3824,8 @@ class TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties(Alert :vartype is_enabled: bool :ivar alert_configuration_type: The alert configuration type. Required. :vartype alert_configuration_type: str + :ivar alert_definition: The alert definition. + :vartype alert_definition: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertDefinition :ivar threshold_number_of_permanent_owners: The threshold number of permanent owners. :vartype threshold_number_of_permanent_owners: int :ivar threshold_percentage_of_permanent_owners_out_of_all_owners: The threshold percentage of @@ -3793,6 +3837,7 @@ class TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties(Alert "alert_definition_id": {"readonly": True}, "scope": {"readonly": True}, "alert_configuration_type": {"required": True}, + "alert_definition": {"readonly": True}, } _attribute_map = { @@ -3800,6 +3845,7 @@ class TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties(Alert "scope": {"key": "scope", "type": "str"}, "is_enabled": {"key": "isEnabled", "type": "bool"}, "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, + "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, "threshold_number_of_permanent_owners": {"key": "thresholdNumberOfPermanentOwners", "type": "int"}, "threshold_percentage_of_permanent_owners_out_of_all_owners": { "key": "thresholdPercentageOfPermanentOwnersOutOfAllOwners", @@ -3813,8 +3859,8 @@ def __init__( is_enabled: Optional[bool] = None, threshold_number_of_permanent_owners: Optional[int] = None, threshold_percentage_of_permanent_owners_out_of_all_owners: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the specific alert. @@ -3826,7 +3872,7 @@ def __init__( :paramtype threshold_percentage_of_permanent_owners_out_of_all_owners: int """ super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type = "TooManyPermanentOwnersAssignedToResourceAlertConfiguration" # type: str + self.alert_configuration_type: str = "TooManyPermanentOwnersAssignedToResourceAlertConfiguration" self.threshold_number_of_permanent_owners = threshold_number_of_permanent_owners self.threshold_percentage_of_permanent_owners_out_of_all_owners = ( threshold_percentage_of_permanent_owners_out_of_all_owners @@ -3860,9 +3906,9 @@ class TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties(AlertIncid "assignee_type": {"key": "assigneeType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.alert_incident_type = "TooManyPermanentOwnersAssignedToResourceAlertIncident" # type: str + self.alert_incident_type: str = "TooManyPermanentOwnersAssignedToResourceAlertIncident" self.assignee_name = None self.assignee_type = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py index 96a5dd0f6950..44a7777850b2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py @@ -50,7 +50,7 @@ from ._alert_operation_operations import AlertOperationOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py index 357b52a5f8b4..b07bcf628801 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +57,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,8 +72,10 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +87,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,8 +139,10 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -141,9 +152,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -161,7 +172,9 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } @overload def put( @@ -204,8 +217,8 @@ def put( ) -> _models.AccessReviewDefaultSettings: """Get access review default settings for the subscription. - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -227,9 +240,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -250,9 +265,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +285,6 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py index 9bb57b7d5260..97fb6a61f4be 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_generate_download_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_generate_download_uri_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,8 +119,10 @@ def generate_download_uri( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None) request = build_generate_download_uri_request( history_definition_id=history_definition_id, @@ -125,9 +134,9 @@ def generate_download_uri( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -145,4 +154,6 @@ def generate_download_uri( return deserialized - generate_download_uri.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"} # type: ignore + generate_download_uri.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py index 53b6f65a1e9d..fdd6c29638d2 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(history_definition_id: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(history_definition_id: str, subscription_id: str, **kwarg "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +105,10 @@ def list(self, history_definition_id: str, **kwargs: Any) -> Iterable["_models.A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -121,12 +130,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +143,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,4 +163,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py index f31c78f32b17..301cb8fc2e2d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,10 @@ def build_create_request(history_definition_id: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_create_request(history_definition_id: str, subscription_id: str, **kwa "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_delete_by_id_request(history_definition_id: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_delete_by_id_request(history_definition_id: str, subscription_id: str, "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,8 +176,8 @@ def create( :param history_definition_id: The id of the access review history definition. Required. :type history_definition_id: str - :param properties: Access review history definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review history definition properties. Is either a + AccessReviewHistoryDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or IO @@ -191,9 +200,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +226,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,7 +246,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } @distributed_trace def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -261,8 +274,10 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( history_definition_id=history_definition_id, @@ -273,9 +288,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -289,4 +304,6 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py index 60aba776bdf1..debcbd9bcb13 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +58,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,7 +75,9 @@ def build_get_by_id_request(history_definition_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +90,7 @@ def build_get_by_id_request(history_definition_id: str, subscription_id: str, ** "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -129,8 +138,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,12 +163,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -165,13 +176,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -185,7 +196,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions" + } @distributed_trace def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.AccessReviewHistoryDefinition: @@ -209,8 +222,10 @@ def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.Access _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( history_definition_id=history_definition_id, @@ -221,9 +236,9 @@ def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.Access params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -241,4 +256,6 @@ def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.Access return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py index 026cc2eb83ef..48e4f6e3a48f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,8 +110,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -127,12 +136,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,13 +149,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -160,4 +169,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py index fbfe008e68b6..7e40672e5b8e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,8 +119,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -137,12 +146,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -150,13 +159,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -170,4 +179,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py index 5c44aa062620..8da810e0f28f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +78,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +94,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +109,10 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +126,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,8 +183,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,12 +209,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +222,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -229,7 +242,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } @distributed_trace def get_by_id( @@ -259,8 +274,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -272,9 +289,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -292,7 +309,9 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } @overload def patch( @@ -372,8 +391,8 @@ def patch( :type id: str :param decision_id: The id of the decision record. Required. :type decision_id: str - :param properties: Access review decision properties to patch. Is either a model type or a IO - type. Required. + :param properties: Access review decision properties to patch. Is either a + AccessReviewDecisionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecisionProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -395,9 +414,11 @@ def patch( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecision] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -420,9 +441,9 @@ def patch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -440,4 +461,6 @@ def patch( return deserialized - patch.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"} # type: ignore + patch.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py index 9dae5630af10..295b9c5e4f96 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_reset_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +92,7 @@ def build_reset_decisions_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +109,9 @@ def build_apply_decisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +125,7 @@ def build_apply_decisions_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +142,9 @@ def build_send_reminders_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +158,7 @@ def build_send_reminders_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +173,9 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +188,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,8 +244,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -242,9 +259,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +275,9 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @distributed_trace def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -286,8 +305,10 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( schedule_definition_id=schedule_definition_id, @@ -299,9 +320,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +336,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -343,8 +366,10 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( schedule_definition_id=schedule_definition_id, @@ -356,9 +381,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -372,7 +397,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace def send_reminders( # pylint: disable=inconsistent-return-statements @@ -400,8 +427,10 @@ def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( schedule_definition_id=schedule_definition_id, @@ -413,9 +442,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,7 +458,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } @distributed_trace def accept_recommendations( # pylint: disable=inconsistent-return-statements @@ -457,8 +488,10 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_accept_recommendations_request( schedule_definition_id=schedule_definition_id, @@ -469,9 +502,9 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -485,4 +518,6 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - accept_recommendations.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"} # type: ignore + accept_recommendations.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py index ecebf5871bdb..12a9ea56e606 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +58,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,7 +75,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +90,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,8 +143,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -157,12 +168,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -170,13 +181,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -190,7 +201,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -216,8 +229,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -228,9 +243,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -248,4 +263,6 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py index 79461040509c..475033dd25c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_list_request( "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +78,9 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +94,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +109,10 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +126,7 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id: "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,8 +181,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -194,12 +207,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -207,13 +220,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -227,7 +240,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance: @@ -253,8 +268,10 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -266,9 +283,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -286,7 +303,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } @overload def create( @@ -357,8 +376,8 @@ def create( :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Access review instance properties. Is either a model type or a IO type. - Required. + :param properties: Access review instance properties. Is either a + AccessReviewInstanceProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -380,9 +399,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -405,9 +426,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -425,4 +446,6 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py index 4b70ae4ce6e1..940614345fae 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,8 +101,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,12 +125,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -129,13 +138,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -149,4 +158,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py index 08acdeedb539..ccd8600dbded 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +58,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,7 +75,9 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +90,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,7 +105,9 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +120,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +137,10 @@ def build_create_or_update_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +153,7 @@ def build_create_or_update_by_id_request( "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +170,9 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +185,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,8 +234,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -242,12 +259,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -255,13 +272,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,7 +292,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + } @distributed_trace def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition: @@ -299,8 +318,10 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( schedule_definition_id=schedule_definition_id, @@ -311,9 +332,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -331,7 +352,9 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces return deserialized - get_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -357,8 +380,10 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( schedule_definition_id=schedule_definition_id, @@ -369,9 +394,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -385,7 +410,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload def create_or_update_by_id( @@ -442,8 +469,8 @@ def create_or_update_by_id( :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -466,9 +493,11 @@ def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -490,9 +519,9 @@ def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -510,7 +539,9 @@ def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def stop( # pylint: disable=inconsistent-return-statements @@ -536,8 +567,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( schedule_definition_id=schedule_definition_id, @@ -548,9 +581,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -564,4 +597,6 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_configurations_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_configurations_operations.py index b08eef5d17d0..22dbe76c70ab 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_configurations_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_configurations_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,19 +44,21 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations/{alertId}" + "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" ) # pylint: disable=line-too-long path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -66,20 +73,22 @@ def build_update_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations/{alertId}" + "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" ) # pylint: disable=line-too-long path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,18 +105,18 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations" - ) + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations") path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,8 +176,10 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfigur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertConfiguration] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertConfiguration] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -179,9 +190,9 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfigur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,10 +209,10 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfigur return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} @overload - def update( + def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, @@ -209,7 +220,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AlertConfiguration: + ) -> None: """Update an alert configuration. :param scope: The scope of the alert configuration. Required. @@ -222,15 +233,15 @@ def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AlertConfiguration: + ) -> None: """Update an alert configuration. :param scope: The scope of the alert configuration. Required. @@ -243,30 +254,30 @@ def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO], **kwargs: Any - ) -> _models.AlertConfiguration: + ) -> None: """Update an alert configuration. :param scope: The scope of the alert configuration. Required. :type scope: str :param alert_id: The name of the alert configuration to update. Required. :type alert_id: str - :param parameters: Parameters for the alert configuration. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the alert configuration. Is either a AlertConfiguration type + or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AlertConfiguration + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -280,9 +291,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertConfiguration] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -304,26 +317,22 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AlertConfiguration", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations/{alertId}"} # type: ignore + update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertConfiguration"]: @@ -340,8 +349,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertCo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertConfigurationListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertConfigurationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -362,12 +373,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -375,13 +386,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -394,4 +405,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertConfigurations"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_definitions_operations.py index 4c755bc06115..9eef431f483f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,20 +44,21 @@ def build_get_request(scope: str, alert_definition_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertDefinitions/{alertDefinitionId}", + "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" ) # pylint: disable=line-too-long path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "alertDefinitionId": _SERIALIZER.url("alert_definition_id", alert_definition_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,18 +73,18 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertDefinitions" - ) + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions") path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,8 +144,10 @@ def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.Al _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertDefinition] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -150,9 +158,9 @@ def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.Al params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -169,7 +177,9 @@ def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.Al return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertDefinitions/{alertDefinitionId}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" + } @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertDefinition"]: @@ -186,8 +196,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertDefinitionListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -208,12 +220,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -221,13 +233,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -240,4 +252,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alertDefinitions"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_incidents_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_incidents_operations.py index 3ae21275bfb7..eef74339ffb0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_incidents_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_incidents_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,13 +44,15 @@ def build_get_request(scope: str, alert_id: str, alert_incident_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents/{alertIncidentId}", + "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}", ) # pylint: disable=line-too-long path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), @@ -53,7 +60,7 @@ def build_get_request(scope: str, alert_id: str, alert_incident_id: str, **kwarg "alertIncidentId": _SERIALIZER.url("alert_incident_id", alert_incident_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,20 +75,21 @@ def build_list_for_scope_request(scope: str, alert_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents", + "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" ) # pylint: disable=line-too-long path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,13 +104,15 @@ def build_remediate_request(scope: str, alert_id: str, alert_incident_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents/{alertIncidentId}/remediate", + "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate", ) # pylint: disable=line-too-long path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), @@ -110,7 +120,7 @@ def build_remediate_request(scope: str, alert_id: str, alert_incident_id: str, * "alertIncidentId": _SERIALIZER.url("alert_incident_id", alert_incident_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,8 +182,10 @@ def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertIncident] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertIncident] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -185,9 +197,9 @@ def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +216,9 @@ def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents/{alertIncidentId}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}" + } @distributed_trace def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> Iterable["_models.AlertIncident"]: @@ -223,8 +237,10 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> Iterable[" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertIncidentListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertIncidentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -246,12 +262,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -259,13 +275,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertIncidentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -278,7 +294,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents"} # type: ignore + list_for_scope.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" + } @distributed_trace def remediate( # pylint: disable=inconsistent-return-statements @@ -308,8 +326,10 @@ def remediate( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_remediate_request( scope=scope, @@ -321,9 +341,9 @@ def remediate( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -336,4 +356,6 @@ def remediate( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - remediate.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/alertIncidents/{alertIncidentId}/remediate"} # type: ignore + remediate.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_operation_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_operation_operations.py index 4d5c35946423..b833b3b71471 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_operation_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alert_operation_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,19 +43,21 @@ def build_get_request(scope: str, operation_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/operations/{operationId}" + "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}" ) # pylint: disable=line-too-long path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "operationId": _SERIALIZER.url("operation_id", operation_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,16 +72,18 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/operations") + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations") path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,8 +137,10 @@ def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOper _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -140,9 +151,9 @@ def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOper params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -159,7 +170,7 @@ def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOper return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/operations/{operationId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}"} @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperationListResult: @@ -183,8 +194,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperationLis _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationListResult] = kwargs.pop("cls", None) request = build_list_for_scope_request( scope=scope, @@ -194,9 +207,9 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperationLis params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -213,4 +226,4 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> _models.AlertOperationLis return deserialized - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/operations"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alerts_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alerts_operations.py index d0d7045843a0..bebf37da7718 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alerts_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_alerts_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,19 +46,19 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}" - ) + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}") path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,20 +73,20 @@ def build_update_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}" - ) + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}") path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,16 +103,18 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts") + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts") path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,19 +129,21 @@ def build_refresh_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/refresh" - ) # pylint: disable=line-too-long + "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,16 +158,18 @@ def build_refresh_all_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/refresh") + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh") path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -217,8 +228,10 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -229,9 +242,9 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -248,10 +261,10 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} @overload - def update( + def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, @@ -259,7 +272,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Alert: + ) -> None: """Update an alert. :param scope: The scope of the alert. Required. @@ -272,15 +285,15 @@ def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def update( # pylint: disable=inconsistent-return-statements self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Alert: + ) -> None: """Update an alert. :param scope: The scope of the alert. Required. @@ -293,27 +306,29 @@ def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update(self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO], **kwargs: Any) -> _models.Alert: + def update( # pylint: disable=inconsistent-return-statements + self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO], **kwargs: Any + ) -> None: """Update an alert. :param scope: The scope of the alert. Required. :type scope: str :param alert_id: The name of the alert to dismiss. Required. :type alert_id: str - :param parameters: Parameters for the alert. Is either a model type or a IO type. Required. + :param parameters: Parameters for the alert. Is either a Alert type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.Alert + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -327,9 +342,11 @@ def update(self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO] _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -351,26 +368,22 @@ def update(self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO] params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}"} # type: ignore + update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} @distributed_trace def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -387,8 +400,10 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.Alert"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertListResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -409,12 +424,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -422,13 +437,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,7 +456,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts"} def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertOperationResult: error_map = { @@ -455,8 +470,10 @@ def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) request = build_refresh_request( scope=scope, @@ -467,9 +484,9 @@ def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models. params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -489,7 +506,9 @@ def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models. return deserialized - _refresh_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/refresh"} # type: ignore + _refresh_initial.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" + } @distributed_trace def begin_refresh(self, scope: str, alert_id: str, **kwargs: Any) -> LROPoller[_models.AlertOperationResult]: @@ -516,13 +535,15 @@ def begin_refresh(self, scope: str, alert_id: str, **kwargs: Any) -> LROPoller[_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._refresh_initial( # type: ignore + raw_result = self._refresh_initial( scope=scope, alert_id=alert_id, api_version=api_version, @@ -544,9 +565,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -558,9 +579,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_refresh.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/{alertId}/refresh"} # type: ignore + begin_refresh.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" + } def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperationResult: error_map = { @@ -574,8 +597,10 @@ def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) request = build_refresh_all_request( scope=scope, @@ -585,9 +610,9 @@ def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -607,7 +632,7 @@ def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperat return deserialized - _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/refresh"} # type: ignore + _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} @distributed_trace def begin_refresh_all(self, scope: str, **kwargs: Any) -> LROPoller[_models.AlertOperationResult]: @@ -632,13 +657,15 @@ def begin_refresh_all(self, scope: str, **kwargs: Any) -> LROPoller[_models.Aler _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._refresh_all_initial( # type: ignore + raw_result = self._refresh_all_initial( scope=scope, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) kwargs.pop("error_map", None) @@ -654,9 +681,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -668,6 +695,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/alerts/refresh"} # type: ignore + begin_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_operations.py index 00ac57a8270d..2edfb87cc1cf 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,8 +93,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,12 +116,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -120,13 +129,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,4 +149,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/operations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py index 43ed386ee598..6082598e825b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47,7 +54,7 @@ def build_get_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -62,8 +69,10 @@ def build_put_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +81,7 @@ def build_put_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +135,10 @@ def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSettings: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -137,9 +148,9 @@ def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSettings: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -157,7 +168,7 @@ def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSettings: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} @overload def put( @@ -211,8 +222,8 @@ def put( :param scope: The scope of the resource. Required. :type scope: str - :param properties: Access review schedule settings. Is either a model type or a IO type. - Required. + :param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings + type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -234,9 +245,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDefaultSettings] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -257,9 +270,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -277,4 +290,4 @@ def put( return deserialized - put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} # type: ignore + put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py index b1c5e8bb74c3..5d810fc33548 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_generate_download_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_generate_download_uri_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +121,10 @@ def generate_download_uri( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None) request = build_generate_download_uri_request( scope=scope, @@ -127,9 +136,9 @@ def generate_download_uri( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -147,4 +156,6 @@ def generate_download_uri( return deserialized - generate_download_uri.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"} # type: ignore + generate_download_uri.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py index 9d8bdcd6de93..d4261c0256f6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(scope: str, history_definition_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(scope: str, history_definition_id: str, **kwargs: Any) -> "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,8 +109,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,12 +134,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +147,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,4 +167,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py index f51131afeebe..d598db73f681 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,10 @@ def build_create_request(scope: str, history_definition_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_create_request(scope: str, history_definition_id: str, **kwargs: Any) "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +76,9 @@ def build_delete_by_id_request(scope: str, history_definition_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_delete_by_id_request(scope: str, history_definition_id: str, **kwargs: "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,8 +190,8 @@ def create( :type scope: str :param history_definition_id: The id of the access review history definition. Required. :type history_definition_id: str - :param properties: Access review history definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review history definition properties. Is either a + AccessReviewHistoryDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or IO @@ -205,9 +214,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -229,9 +240,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -249,7 +260,9 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } @distributed_trace def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -277,8 +290,10 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( scope=scope, @@ -289,9 +304,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -305,4 +320,6 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py index 0b5e32881fb1..9a46310b95e8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -48,7 +55,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,7 +72,9 @@ def build_get_by_id_request(scope: str, history_definition_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +87,7 @@ def build_get_by_id_request(scope: str, history_definition_id: str, **kwargs: An "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,8 +139,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -153,12 +164,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -166,13 +177,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewHistoryDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -186,7 +197,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"} @distributed_trace def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _models.AccessReviewHistoryDefinition: @@ -212,8 +223,10 @@ def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewHistoryDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( scope=scope, @@ -224,9 +237,9 @@ def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -244,4 +257,6 @@ def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _m return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py index 9e15baefa1af..63f2e98e6a05 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(scope: str, schedule_definition_id: str, id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_list_request(scope: str, schedule_definition_id: str, id: str, **kwarg "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,8 +112,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,12 +138,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -142,13 +151,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -162,4 +171,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py index 65b648db5745..faf82a804478 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +121,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewDecisionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -139,12 +148,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -152,13 +161,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -172,4 +181,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py index 32c56a4c1acd..0e7934a55527 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_stop_request(scope: str, schedule_definition_id: str, id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_stop_request(scope: str, schedule_definition_id: str, id: str, **kwarg "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +74,10 @@ def build_record_all_decisions_request(scope: str, schedule_definition_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_record_all_decisions_request(scope: str, schedule_definition_id: str, "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,7 +108,9 @@ def build_reset_decisions_request(scope: str, schedule_definition_id: str, id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +124,7 @@ def build_reset_decisions_request(scope: str, schedule_definition_id: str, id: s "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +139,9 @@ def build_apply_decisions_request(scope: str, schedule_definition_id: str, id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +155,7 @@ def build_apply_decisions_request(scope: str, schedule_definition_id: str, id: s "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +170,9 @@ def build_send_reminders_request(scope: str, schedule_definition_id: str, id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +186,7 @@ def build_send_reminders_request(scope: str, schedule_definition_id: str, id: st "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,8 +244,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( scope=scope, @@ -242,9 +259,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +275,9 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"} # type: ignore + stop.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + } @overload def record_all_decisions( # pylint: disable=inconsistent-return-statements @@ -338,7 +357,8 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Record all decisions payload. Is either a model type or a IO type. Required. + :param properties: Record all decisions payload. Is either a RecordAllDecisionsProperties type + or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.RecordAllDecisionsProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -360,9 +380,11 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -385,9 +407,9 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -401,7 +423,9 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - record_all_decisions.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions"} # type: ignore + record_all_decisions.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions" + } @distributed_trace def reset_decisions( # pylint: disable=inconsistent-return-statements @@ -431,8 +455,10 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_decisions_request( scope=scope, @@ -444,9 +470,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -460,7 +486,9 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - reset_decisions.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"} # type: ignore + reset_decisions.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + } @distributed_trace def apply_decisions( # pylint: disable=inconsistent-return-statements @@ -490,8 +518,10 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_apply_decisions_request( scope=scope, @@ -503,9 +533,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -519,7 +549,9 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - apply_decisions.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"} # type: ignore + apply_decisions.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + } @distributed_trace def send_reminders( # pylint: disable=inconsistent-return-statements @@ -549,8 +581,10 @@ def send_reminders( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_send_reminders_request( scope=scope, @@ -562,9 +596,9 @@ def send_reminders( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -578,4 +612,6 @@ def send_reminders( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - send_reminders.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"} # type: ignore + send_reminders.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py index b14ff99e7c26..2ecbbf028264 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_list_request( "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +78,9 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +94,7 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, id: str, ** "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +109,10 @@ def build_create_request(scope: str, schedule_definition_id: str, id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +126,7 @@ def build_create_request(scope: str, schedule_definition_id: str, id: str, **kwa "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,8 +183,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstanceListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,12 +209,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +222,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -229,7 +242,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"} # type: ignore + list.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + } @distributed_trace def get_by_id( @@ -259,8 +274,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) request = build_get_by_id_request( scope=scope, @@ -272,9 +289,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -292,7 +309,9 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } @overload def create( @@ -372,8 +391,8 @@ def create( :type schedule_definition_id: str :param id: The id of the access review instance. Required. :type id: str - :param properties: Access review instance properties. Is either a model type or a IO type. - Required. + :param properties: Access review instance properties. Is either a + AccessReviewInstanceProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -395,9 +414,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewInstance] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -420,9 +441,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -440,4 +461,6 @@ def create( return deserialized - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"} # type: ignore + create.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py index 012b9717fb1f..51bc7f67a4ba 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -48,7 +55,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,7 +72,9 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +87,7 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, **kwargs: A "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +102,9 @@ def build_delete_by_id_request(scope: str, schedule_definition_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +117,7 @@ def build_delete_by_id_request(scope: str, schedule_definition_id: str, **kwargs "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,8 +132,10 @@ def build_create_or_update_by_id_request(scope: str, schedule_definition_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +148,7 @@ def build_create_or_update_by_id_request(scope: str, schedule_definition_id: str "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +165,9 @@ def build_stop_request(scope: str, schedule_definition_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +180,7 @@ def build_stop_request(scope: str, schedule_definition_id: str, **kwargs: Any) - "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,8 +233,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinitionListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -241,12 +258,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -254,13 +271,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -274,7 +291,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"} @distributed_trace def get_by_id( @@ -302,8 +319,10 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( scope=scope, @@ -314,9 +333,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -334,7 +353,9 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + get_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def delete_by_id( # pylint: disable=inconsistent-return-statements @@ -362,8 +383,10 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_id_request( scope=scope, @@ -374,9 +397,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -390,7 +413,9 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + delete_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @overload def create_or_update_by_id( @@ -461,8 +486,8 @@ def create_or_update_by_id( :type scope: str :param schedule_definition_id: The id of the access review schedule definition. Required. :type schedule_definition_id: str - :param properties: Access review schedule definition properties. Is either a model type or a IO - type. Required. + :param properties: Access review schedule definition properties. Is either a + AccessReviewScheduleDefinitionProperties type or a IO type. Required. :type properties: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties or IO @@ -485,9 +510,11 @@ def create_or_update_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewScheduleDefinition] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -509,9 +536,9 @@ def create_or_update_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -529,7 +556,9 @@ def create_or_update_by_id( return deserialized - create_or_update_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"} # type: ignore + create_or_update_by_id.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + } @distributed_trace def stop( # pylint: disable=inconsistent-return-statements @@ -557,8 +586,10 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( scope=scope, @@ -569,9 +600,9 @@ def stop( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -585,4 +616,6 @@ def stop( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - stop.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"} # type: ignore + stop.metadata = { + "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py index 48d84587e79c..5d075d692889 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,9 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H "id": _SERIALIZER.url("id", id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,8 +109,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccessReviewContactedReviewerListResult] + api_version: Literal["2021-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-12-01-preview") + ) + cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,12 +134,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +147,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AccessReviewContactedReviewerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,4 +167,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"} # type: ignore + list.metadata = { + "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py index 9eb8d3ec28cb..019f2f208c14 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py index 6f4840749c3a..e53ebc609245 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -71,7 +71,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -111,15 +111,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AuthorizationManagementClient + def __enter__(self) -> "AuthorizationManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py index 8231f4b9cfb9..c40f40e83dd1 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-04-01") # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", "2022-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json index 52c70819b933..1ded4f59232d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -103,4 +111,4 @@ "permissions": "PermissionsOperations", "role_definitions": "RoleDefinitionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py index dd28625b36f0..a6e41513a3c6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AuthorizationManagementClient"] +__all__ = [ + "AuthorizationManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py index 3c58e60529a5..80daee0dcafd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import AuthorizationManagementClientConfiguration from .operations import ( @@ -71,7 +71,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -118,5 +118,5 @@ async def __aenter__(self) -> "AuthorizationManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py index 481ef8539048..3cb70d1aef9b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-04-01") # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", "2022-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py index bbb62cee0617..336442a84fe5 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._role_definitions_operations import RoleDefinitionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py index 54f6121da98f..13fcd32eda1f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,8 +109,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,16 +137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -149,13 +161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -169,7 +181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list_for_resource_group( @@ -200,8 +214,8 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -224,16 +238,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -241,13 +262,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -261,7 +282,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.DenyAssignment"]: @@ -287,8 +310,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -310,16 +333,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -327,13 +357,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -347,7 +377,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} @distributed_trace_async async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -373,8 +403,8 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -385,9 +415,9 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +435,7 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} @distributed_trace_async async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -433,8 +463,8 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( deny_assignment_id=deny_assignment_id, @@ -444,9 +474,9 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +494,7 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den return deserialized - get_by_id.metadata = {"url": "/{denyAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{denyAssignmentId}"} @distributed_trace def list_for_scope( @@ -494,8 +524,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -517,16 +547,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -534,13 +571,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -554,4 +591,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py index 33799d741681..9bcdd3713308 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,8 +73,8 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -91,16 +96,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,13 +120,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -128,7 +140,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" + } @distributed_trace def list_for_resource( @@ -162,8 +176,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -189,16 +203,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -206,13 +227,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -226,4 +247,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py index 98bf7a711625..2749a3e9aa8f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._provider_operations_metadata_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadata] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) request = build_get_request( resource_provider_namespace=resource_provider_namespace, @@ -91,9 +96,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +116,7 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} @distributed_trace def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_models.ProviderOperationsMetadata"]: @@ -129,8 +134,8 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadataListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -151,16 +156,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -168,13 +180,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,4 +200,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py index edb09edb1a80..ef7545bb2cb8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -41,6 +42,10 @@ build_list_for_subscription_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,8 @@ def list_for_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,16 +114,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +138,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -172,8 +186,8 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -197,16 +211,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,13 +235,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -234,7 +255,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource( @@ -274,8 +297,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -302,16 +325,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -319,13 +349,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -339,7 +369,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace_async async def get( @@ -374,8 +406,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -387,9 +419,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -407,7 +439,7 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload async def create( @@ -492,8 +524,8 @@ async def create( :param role_assignment_name: The name of the role assignment. It can be any valid GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -515,9 +547,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -539,9 +571,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -559,11 +591,11 @@ async def create( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace_async async def delete( @@ -598,8 +630,8 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -611,9 +643,9 @@ async def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -633,7 +665,7 @@ async def delete( return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def list_for_scope( @@ -671,8 +703,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -696,16 +728,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -713,13 +752,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -733,7 +772,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace_async async def get_by_id( @@ -765,8 +804,8 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_assignment_id=role_assignment_id, @@ -777,9 +816,9 @@ async def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -797,7 +836,7 @@ async def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload async def create_by_id( @@ -862,8 +901,8 @@ async def create_by_id( /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -885,9 +924,9 @@ async def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -908,9 +947,9 @@ async def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -928,11 +967,11 @@ async def create_by_id( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace_async async def delete_by_id( @@ -964,8 +1003,8 @@ async def delete_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_assignment_id=role_assignment_id, @@ -976,9 +1015,9 @@ async def delete_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -998,4 +1037,4 @@ async def delete_by_id( return deserialized - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleAssignmentId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py index 9b6bf5a14758..b8da6ba2f816 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,8 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleDefinition]] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -95,9 +100,9 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,7 +122,7 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace_async async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -143,8 +148,8 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -155,9 +160,9 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -175,7 +180,7 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @overload async def create_or_update( @@ -241,8 +246,8 @@ async def create_or_update( :type scope: str :param role_definition_id: The ID of the role definition. Required. :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a model type or a IO - type. Required. + :param role_definition: The values for the role definition. Is either a RoleDefinition type or + a IO type. Required. :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -263,9 +268,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -287,9 +292,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -307,7 +312,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]: @@ -327,8 +332,8 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -350,16 +355,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -367,13 +379,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -387,7 +399,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} @distributed_trace_async async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -415,8 +427,8 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -426,9 +438,9 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -446,4 +458,4 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py index dc6219ed0e5e..198470fcd79b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py @@ -49,7 +49,7 @@ from ._authorization_management_client_enums import RoleManagementPolicyRuleType from ._authorization_management_client_enums import UserType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py index 3083c8145430..a25c36472046 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py @@ -12,13 +12,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -56,8 +57,8 @@ def __init__( is_requestor_justification_required: Optional[bool] = None, approval_mode: Optional[Union[str, "_models.ApprovalMode"]] = None, approval_stages: Optional[List["_models.ApprovalStage"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_approval_required: Determines whether approval is required or not. :paramtype is_approval_required: bool @@ -119,8 +120,8 @@ def __init__( primary_approvers: Optional[List["_models.UserSet"]] = None, is_escalation_enabled: Optional[bool] = None, escalation_approvers: Optional[List["_models.UserSet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword approval_stage_time_out_in_days: The time in days when approval request would be timed out. @@ -177,12 +178,31 @@ class DenyAssignment(_serialization.Model): # pylint: disable=too-many-instance :ivar is_system_protected: Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. :vartype is_system_protected: bool + :ivar condition: The conditions on the deny assignment. This limits the resources it can be + assigned to. e.g.: + @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + StringEqualsIgnoreCase 'foo_storage_container'. + :vartype condition: str + :ivar condition_version: Version of the condition. + :vartype condition_version: str + :ivar created_on: Time it was created. + :vartype created_on: ~datetime.datetime + :ivar updated_on: Time it was updated. + :vartype updated_on: ~datetime.datetime + :ivar created_by: Id of the user who created the assignment. + :vartype created_by: str + :ivar updated_by: Id of the user who updated the assignment. + :vartype updated_by: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "created_on": {"readonly": True}, + "updated_on": {"readonly": True}, + "created_by": {"readonly": True}, + "updated_by": {"readonly": True}, } _attribute_map = { @@ -197,6 +217,12 @@ class DenyAssignment(_serialization.Model): # pylint: disable=too-many-instance "principals": {"key": "properties.principals", "type": "[Principal]"}, "exclude_principals": {"key": "properties.excludePrincipals", "type": "[Principal]"}, "is_system_protected": {"key": "properties.isSystemProtected", "type": "bool"}, + "condition": {"key": "properties.condition", "type": "str"}, + "condition_version": {"key": "properties.conditionVersion", "type": "str"}, + "created_on": {"key": "properties.createdOn", "type": "iso-8601"}, + "updated_on": {"key": "properties.updatedOn", "type": "iso-8601"}, + "created_by": {"key": "properties.createdBy", "type": "str"}, + "updated_by": {"key": "properties.updatedBy", "type": "str"}, } def __init__( @@ -210,8 +236,10 @@ def __init__( principals: Optional[List["_models.Principal"]] = None, exclude_principals: Optional[List["_models.Principal"]] = None, is_system_protected: Optional[bool] = None, - **kwargs - ): + condition: Optional[str] = None, + condition_version: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword deny_assignment_name: The display name of the deny assignment. :paramtype deny_assignment_name: str @@ -232,6 +260,13 @@ def __init__( :keyword is_system_protected: Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. :paramtype is_system_protected: bool + :keyword condition: The conditions on the deny assignment. This limits the resources it can be + assigned to. e.g.: + @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + StringEqualsIgnoreCase 'foo_storage_container'. + :paramtype condition: str + :keyword condition_version: Version of the condition. + :paramtype condition_version: str """ super().__init__(**kwargs) self.id = None @@ -245,6 +280,12 @@ def __init__( self.principals = principals self.exclude_principals = exclude_principals self.is_system_protected = is_system_protected + self.condition = condition + self.condition_version = condition_version + self.created_on = None + self.updated_on = None + self.created_by = None + self.updated_by = None class DenyAssignmentFilter(_serialization.Model): @@ -272,8 +313,8 @@ def __init__( deny_assignment_name: Optional[str] = None, principal_id: Optional[str] = None, gdpr_export_principal_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword deny_assignment_name: Return deny assignment with specified name. :paramtype deny_assignment_name: str @@ -305,8 +346,8 @@ class DenyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DenyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DenyAssignment"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Deny assignment list. :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] @@ -355,8 +396,8 @@ def __init__( not_data_actions: Optional[List[str]] = None, condition: Optional[str] = None, condition_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Actions to which the deny assignment does not grant access. :paramtype actions: list[str] @@ -403,7 +444,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -444,7 +485,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -455,7 +496,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.authorization.v2022_04_01.models.ErrorDetail @@ -465,7 +507,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.authorization.v2022_04_01.models.ErrorDetail @@ -501,8 +543,8 @@ def __init__( not_actions: Optional[List[str]] = None, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Allowed actions. :paramtype actions: list[str] @@ -535,8 +577,8 @@ class PermissionGetResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of permissions. :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.Permission] @@ -575,8 +617,8 @@ def __init__( display_name: Optional[str] = None, type: Optional[str] = None, email: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the principal made changes. :paramtype id: str @@ -629,8 +671,8 @@ def __init__( origin: Optional[str] = None, properties: Optional[JSON] = None, is_data_action: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The operation name. :paramtype name: str @@ -689,8 +731,8 @@ def __init__( display_name: Optional[str] = None, resource_types: Optional[List["_models.ResourceType"]] = None, operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The provider id. :paramtype id: str @@ -733,8 +775,8 @@ def __init__( *, value: Optional[List["_models.ProviderOperationsMetadata"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The list of providers. :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata] @@ -769,8 +811,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The resource type name. :paramtype name: str @@ -868,8 +910,8 @@ def __init__( condition: Optional[str] = None, condition_version: Optional[str] = None, delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str @@ -984,8 +1026,8 @@ def __init__( condition: Optional[str] = None, condition_version: Optional[str] = None, delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The role definition ID. Required. :paramtype role_definition_id: str @@ -1033,7 +1075,7 @@ class RoleAssignmentFilter(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, } - def __init__(self, *, principal_id: Optional[str] = None, **kwargs): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str @@ -1062,7 +1104,7 @@ class RoleAssignmentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, **kwargs: Any) -> None: """ :keyword value: Role assignment list. :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] @@ -1072,7 +1114,7 @@ def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, ** self.next_link = None -class RoleDefinition(_serialization.Model): +class RoleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes """Role definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1093,12 +1135,24 @@ class RoleDefinition(_serialization.Model): :vartype permissions: list[~azure.mgmt.authorization.v2022_04_01.models.Permission] :ivar assignable_scopes: Role definition assignable scopes. :vartype assignable_scopes: list[str] + :ivar created_on: Time it was created. + :vartype created_on: ~datetime.datetime + :ivar updated_on: Time it was updated. + :vartype updated_on: ~datetime.datetime + :ivar created_by: Id of the user who created the assignment. + :vartype created_by: str + :ivar updated_by: Id of the user who updated the assignment. + :vartype updated_by: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "created_on": {"readonly": True}, + "updated_on": {"readonly": True}, + "created_by": {"readonly": True}, + "updated_by": {"readonly": True}, } _attribute_map = { @@ -1110,6 +1164,10 @@ class RoleDefinition(_serialization.Model): "role_type": {"key": "properties.type", "type": "str"}, "permissions": {"key": "properties.permissions", "type": "[Permission]"}, "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, + "created_on": {"key": "properties.createdOn", "type": "iso-8601"}, + "updated_on": {"key": "properties.updatedOn", "type": "iso-8601"}, + "created_by": {"key": "properties.createdBy", "type": "str"}, + "updated_by": {"key": "properties.updatedBy", "type": "str"}, } def __init__( @@ -1120,8 +1178,8 @@ def __init__( role_type: Optional[str] = None, permissions: Optional[List["_models.Permission"]] = None, assignable_scopes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_name: The role name. :paramtype role_name: str @@ -1143,6 +1201,10 @@ def __init__( self.role_type = role_type self.permissions = permissions self.assignable_scopes = assignable_scopes + self.created_on = None + self.updated_on = None + self.created_by = None + self.updated_by = None class RoleDefinitionFilter(_serialization.Model): @@ -1159,7 +1221,7 @@ class RoleDefinitionFilter(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, role_name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, role_name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword role_name: Returns role definition with the specific name. :paramtype role_name: str @@ -1186,8 +1248,8 @@ class RoleDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Role definition list. :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition] @@ -1246,8 +1308,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -1256,7 +1318,7 @@ def __init__( """ super().__init__(**kwargs) self.id = id - self.rule_type = None # type: Optional[str] + self.rule_type: Optional[str] = None self.target = target @@ -1296,8 +1358,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, setting: Optional["_models.ApprovalSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -1307,7 +1369,7 @@ def __init__( :paramtype setting: ~azure.mgmt.authorization.v2022_04_01.models.ApprovalSettings """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyApprovalRule" # type: str + self.rule_type: str = "RoleManagementPolicyApprovalRule" self.setting = setting @@ -1351,8 +1413,8 @@ def __init__( target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, is_enabled: Optional[bool] = None, claim_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -1364,7 +1426,7 @@ def __init__( :paramtype claim_value: str """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyAuthenticationContextRule" # type: str + self.rule_type: str = "RoleManagementPolicyAuthenticationContextRule" self.is_enabled = is_enabled self.claim_value = claim_value @@ -1406,8 +1468,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, enabled_rules: Optional[List[Union[str, "_models.EnablementRules"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -1418,7 +1480,7 @@ def __init__( ~azure.mgmt.authorization.v2022_04_01.models.EnablementRules] """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyEnablementRule" # type: str + self.rule_type: str = "RoleManagementPolicyEnablementRule" self.enabled_rules = enabled_rules @@ -1462,8 +1524,8 @@ def __init__( target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, is_expiration_required: Optional[bool] = None, maximum_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -1475,7 +1537,7 @@ def __init__( :paramtype maximum_duration: str """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyExpirationRule" # type: str + self.rule_type: str = "RoleManagementPolicyExpirationRule" self.is_expiration_required = is_expiration_required self.maximum_duration = maximum_duration @@ -1537,8 +1599,8 @@ def __init__( recipient_type: Optional[Union[str, "_models.RecipientType"]] = None, notification_recipients: Optional[List[str]] = None, is_default_recipients_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the rule. :paramtype id: str @@ -1561,7 +1623,7 @@ def __init__( :paramtype is_default_recipients_enabled: bool """ super().__init__(id=id, target=target, **kwargs) - self.rule_type = "RoleManagementPolicyNotificationRule" # type: str + self.rule_type: str = "RoleManagementPolicyNotificationRule" self.notification_type = notification_type self.notification_level = notification_level self.recipient_type = recipient_type @@ -1604,8 +1666,8 @@ def __init__( target_objects: Optional[List[str]] = None, inheritable_settings: Optional[List[str]] = None, enforced_settings: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword caller: The caller of the setting. :paramtype caller: str @@ -1656,8 +1718,8 @@ def __init__( is_backup: Optional[bool] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_type: The type of user. Known values are: "User" and "Group". :paramtype user_type: str or ~azure.mgmt.authorization.v2022_04_01.models.UserType @@ -1695,7 +1757,7 @@ class ValidationResponse(_serialization.Model): "error_info": {"key": "errorInfo", "type": "ValidationResponseErrorInfo"}, } - def __init__(self, *, error_info: Optional["_models.ValidationResponseErrorInfo"] = None, **kwargs): + def __init__(self, *, error_info: Optional["_models.ValidationResponseErrorInfo"] = None, **kwargs: Any) -> None: """ :keyword error_info: Failed validation result details. :paramtype error_info: ~azure.mgmt.authorization.v2022_04_01.models.ValidationResponseErrorInfo @@ -1726,7 +1788,7 @@ class ValidationResponseErrorInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py index bbb62cee0617..336442a84fe5 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py @@ -13,7 +13,7 @@ from ._role_definitions_operations import RoleDefinitionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py index a1808f1c6d98..ec87aaacecb7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +76,7 @@ def build_list_for_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +95,7 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +110,7 @@ def build_list_for_resource_group_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,7 +127,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,7 +155,7 @@ def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +165,7 @@ def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> Htt "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +180,7 @@ def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +189,7 @@ def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpReque "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +204,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +213,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -284,8 +289,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -312,16 +317,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -329,13 +341,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -349,7 +361,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list_for_resource_group( @@ -380,8 +394,8 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -404,16 +418,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -421,13 +442,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,7 +462,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" + } @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.DenyAssignment"]: @@ -467,8 +490,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -490,16 +513,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -507,13 +537,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -527,7 +557,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} @distributed_trace def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -553,8 +583,8 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -565,9 +595,9 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -585,7 +615,7 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} @distributed_trace def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: @@ -613,8 +643,8 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( deny_assignment_id=deny_assignment_id, @@ -624,9 +654,9 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -644,7 +674,7 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig return deserialized - get_by_id.metadata = {"url": "/{denyAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{denyAssignmentId}"} @distributed_trace def list_for_scope( @@ -674,8 +704,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DenyAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -697,16 +727,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -714,13 +751,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -734,4 +771,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py index 1b862e408a1e..e5b2f2989419 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +83,7 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +104,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,8 +149,8 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -167,16 +172,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -184,13 +196,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -204,7 +216,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" + } @distributed_trace def list_for_resource( @@ -237,8 +251,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PermissionGetResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -264,16 +278,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -281,13 +302,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PermissionGetResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -301,4 +322,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" + } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py index 8f10fe224015..ad0144d74e6f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +58,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +75,7 @@ def build_list_request(*, expand: str = "resourceTypes", **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,8 +137,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadata] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) request = build_get_request( resource_provider_namespace=resource_provider_namespace, @@ -144,9 +149,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,7 +169,7 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} @distributed_trace def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_models.ProviderOperationsMetadata"]: @@ -182,8 +187,8 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationsMetadataListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -204,16 +209,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -221,13 +233,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -241,4 +253,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py index bb3d960b87b1..5ca5a15a175c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_for_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +58,7 @@ def build_list_for_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +84,7 @@ def build_list_for_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +99,7 @@ def build_list_for_resource_group_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,7 +128,7 @@ def build_list_for_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +148,7 @@ def build_list_for_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +169,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +179,7 @@ def build_get_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,8 +196,8 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +207,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -221,7 +226,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +236,7 @@ def build_delete_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,7 +260,7 @@ def build_list_for_scope_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +269,7 @@ def build_list_for_scope_request( "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -285,7 +290,7 @@ def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str] _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -294,7 +299,7 @@ def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str] "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -311,8 +316,8 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -321,7 +326,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -340,7 +345,7 @@ def build_delete_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -349,7 +354,7 @@ def build_delete_by_id_request( "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -402,8 +407,8 @@ def list_for_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -426,16 +431,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -443,13 +455,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -463,7 +475,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource_group( @@ -489,8 +503,8 @@ def list_for_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -514,16 +528,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -531,13 +552,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -551,7 +572,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def list_for_resource( @@ -591,8 +614,8 @@ def list_for_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -619,16 +642,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -636,13 +666,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -656,7 +686,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + } @distributed_trace def get( @@ -691,8 +723,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -704,9 +736,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -724,7 +756,7 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @overload def create( @@ -809,8 +841,8 @@ def create( :param role_assignment_name: The name of the role assignment. It can be any valid GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -832,9 +864,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -856,9 +888,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -876,11 +908,11 @@ def create( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def delete( @@ -915,8 +947,8 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -928,9 +960,9 @@ def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -950,7 +982,7 @@ def delete( return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} @distributed_trace def list_for_scope( @@ -988,8 +1020,8 @@ def list_for_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1013,16 +1045,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1030,13 +1069,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1050,7 +1089,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} @distributed_trace def get_by_id( @@ -1082,8 +1121,8 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) request = build_get_by_id_request( role_assignment_id=role_assignment_id, @@ -1094,9 +1133,9 @@ def get_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1114,7 +1153,7 @@ def get_by_id( return deserialized - get_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleAssignmentId}"} @overload def create_by_id( @@ -1179,8 +1218,8 @@ def create_by_id( /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. Required. :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the role assignment. Is either a + RoleAssignmentCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1202,9 +1241,9 @@ def create_by_id( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1225,9 +1264,9 @@ def create_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1245,11 +1284,11 @@ def create_by_id( deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + create_by_id.metadata = {"url": "/{roleAssignmentId}"} @distributed_trace def delete_by_id( @@ -1281,8 +1320,8 @@ def delete_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleAssignment]] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) request = build_delete_by_id_request( role_assignment_id=role_assignment_id, @@ -1293,9 +1332,9 @@ def delete_by_id( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1315,4 +1354,4 @@ def delete_by_id( return deserialized - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} # type: ignore + delete_by_id.metadata = {"url": "/{roleAssignmentId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py index 6c9b72517993..2c3815d1f2e6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +55,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,7 +70,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +80,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,8 +95,8 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +106,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +123,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +132,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -144,7 +149,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +158,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,8 +212,8 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RoleDefinition]] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -219,9 +224,9 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -241,7 +246,7 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional return deserialized - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -267,8 +272,8 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -279,9 +284,9 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -299,7 +304,7 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @overload def create_or_update( @@ -365,8 +370,8 @@ def create_or_update( :type scope: str :param role_definition_id: The ID of the role definition. Required. :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a model type or a IO - type. Required. + :param role_definition: The values for the role definition. Is either a RoleDefinition type or + a IO type. Required. :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -387,9 +392,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -411,9 +416,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -431,7 +436,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} @distributed_trace def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]: @@ -451,8 +456,8 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -474,16 +479,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -491,13 +503,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -511,7 +523,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} @distributed_trace def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: @@ -539,8 +551,8 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) + cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) request = build_get_by_id_request( role_id=role_id, @@ -550,9 +562,9 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -570,4 +582,4 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: return deserialized - get_by_id.metadata = {"url": "/{roleId}"} # type: ignore + get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/delete_role_definition.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/delete_role_definition.py new file mode 100644 index 000000000000..6b2656137037 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/delete_role_definition.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python delete_role_definition.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_definitions.delete( + scope="scope", + role_definition_id="roleDefinitionId", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/DeleteRoleDefinition.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_deny_assignments.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_deny_assignments.py new file mode 100644 index 000000000000..7cf4c74f39aa --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_deny_assignments.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_all_deny_assignments.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subId", + ) + + response = client.deny_assignments.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllDenyAssignments.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_provider_operations.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_provider_operations.py new file mode 100644 index 000000000000..8c832da5bdf7 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_provider_operations.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_all_provider_operations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.provider_operations_metadata.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllProviderOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_id.py new file mode 100644 index 000000000000..8bf0ac555760 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_id.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_deny_assignment_by_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.deny_assignments.get_by_id( + deny_assignment_id="subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/denyAssignments/daId", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentById.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_name_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_name_id.py new file mode 100644 index 000000000000..0406575e2e6a --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_name_id.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_deny_assignment_by_name_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.deny_assignments.get( + scope="subscriptions/subId/resourcegroups/rgname", + deny_assignment_id="denyAssignmentId", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByNameId.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_list_by_resource_group.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_scope.py similarity index 68% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_list_by_resource_group.py rename to sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_scope.py index 77b5c36b6782..39d6ac8f0b11 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_list_by_resource_group.py +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_scope.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.workloads import WorkloadsClient +from azure.mgmt.authorization import AuthorizationManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-workloads + pip install azure-mgmt-authorization # USAGE - python php_workloads_list_by_resource_group.py + python get_deny_assignment_by_scope.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,18 +24,18 @@ def main(): - client = WorkloadsClient( + client = AuthorizationManagementClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.php_workloads.list_by_resource_group( - resource_group_name="test-rg", + response = client.deny_assignments.list_for_scope( + scope="subscriptions/subId", ) for item in response: print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/PhpWorkloads_ListByResourceGroup.json +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByScope.json if __name__ == "__main__": main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource.py new file mode 100644 index 000000000000..473ed4991a81 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_deny_assignments_for_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subId", + ) + + response = client.deny_assignments.list_for_resource( + resource_group_name="rgname", + resource_provider_namespace="resourceProviderNamespace", + parent_resource_path="parentResourcePath", + resource_type="resourceType", + resource_name="resourceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResource.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_list.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource_group.py similarity index 68% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_list.py rename to sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource_group.py index 94faa062476c..1250e4947513 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_list.py +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource_group.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.workloads import WorkloadsClient +from azure.mgmt.authorization import AuthorizationManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-workloads + pip install azure-mgmt-authorization # USAGE - python wordpress_instances_list.py + python get_deny_assignments_for_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,18 @@ def main(): - client = WorkloadsClient( + client = AuthorizationManagementClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="subId", ) - response = client.wordpress_instances.list( - resource_group_name="test-rg", - php_workload_name="wp39", + response = client.deny_assignments.list_for_resource_group( + resource_group_name="rgname", ) for item in response: print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/WordpressInstances_List.json +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_permissions.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_permissions.py new file mode 100644 index 000000000000..0b9782cadbff --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_permissions.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_permissions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subID", + ) + + response = client.permissions.list_for_resource_group( + resource_group_name="rgname", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetPermissions.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_provider_operations_rp.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_provider_operations_rp.py new file mode 100644 index 000000000000..7099bb62050d --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_provider_operations_rp.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_provider_operations_rp.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.provider_operations_metadata.get( + resource_provider_namespace="resourceProviderNamespace", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetProviderOperationsRP.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_resource_permissions.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_resource_permissions.py new file mode 100644 index 000000000000..4e4cb20f687e --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_resource_permissions.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_resource_permissions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subId", + ) + + response = client.permissions.list_for_resource( + resource_group_name="rgname", + resource_provider_namespace="rpnamespace", + parent_resource_path="parentResourcePath", + resource_type="resourceType", + resource_name="resourceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetResourcePermissions.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_at_scope.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_at_scope.py new file mode 100644 index 000000000000..31d5ddb37f83 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_at_scope.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_role_definition_at_scope.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_definitions.list( + scope="scope", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionAtScope.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_id.py new file mode 100644 index 000000000000..344bd2f600e6 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_id.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_role_definition_by_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_definitions.get_by_id( + role_id="roleDefinitionId", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionById.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_name.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_name.py new file mode 100644 index 000000000000..e46ca94e24e6 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_name.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python get_role_definition_by_name.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_definitions.get( + scope="scope", + role_definition_id="roleDefinitionId", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionByName.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_by_id.py new file mode 100644 index 000000000000..79724354e685 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_by_id.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_create_by_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.create_by_id( + role_assignment_id="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", + parameters={ + "properties": { + "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987", + "principalType": "User", + "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateById.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource.py new file mode 100644 index 000000000000..b571ac6a53ad --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_create_for_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.create( + scope="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + role_assignment_name="05c5a614-a7d6-4502-b150-c2fb455033ff", + parameters={ + "properties": { + "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987", + "principalType": "User", + "roleDefinitionId": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResource.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource_group.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource_group.py new file mode 100644 index 000000000000..0bf104c5c3f6 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource_group.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_create_for_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.create( + scope="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg", + role_assignment_name="05c5a614-a7d6-4502-b150-c2fb455033ff", + parameters={ + "properties": { + "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987", + "principalType": "User", + "roleDefinitionId": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_subscription.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_subscription.py new file mode 100644 index 000000000000..0349481e954e --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_subscription.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_create_for_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.create( + scope="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", + role_assignment_name="05c5a614-a7d6-4502-b150-c2fb455033ff", + parameters={ + "properties": { + "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987", + "principalType": "User", + "roleDefinitionId": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete.py new file mode 100644 index 000000000000..3065d4fd2aa6 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.delete( + scope="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", + role_assignment_name="b0f43c54-e787-4862-89b1-a653fa9cf747", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete_by_id.py new file mode 100644 index 000000000000..f1d6ec361703 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete_by_id.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_delete_by_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.delete_by_id( + role_assignment_id="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_DeleteById.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get.py new file mode 100644 index 000000000000..95346f257c47 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.get( + scope="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", + role_assignment_name="b0f43c54-e787-4862-89b1-a653fa9cf747", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get_by_id.py new file mode 100644 index 000000000000..e7520e7b690a --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get_by_id.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_get_by_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.get_by_id( + role_assignment_id="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", + ) + print(response) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_GetById.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource.py new file mode 100644 index 000000000000..10593e632922 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_list_for_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", + ) + + response = client.role_assignments.list_for_resource( + resource_group_name="testrg", + resource_provider_namespace="Microsoft.DocumentDb", + resource_type="databaseAccounts", + resource_name="test-db-account", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResource.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource_group.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource_group.py new file mode 100644 index 000000000000..03de94e5fed0 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_list_for_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", + ) + + response = client.role_assignments.list_for_resource_group( + resource_group_name="testrg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_scope.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_scope.py new file mode 100644 index 000000000000..afca98926b25 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_scope.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_list_for_scope.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.role_assignments.list_for_scope( + scope="subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForScope.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_subscription.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_subscription.py new file mode 100644 index 000000000000..b83a8d4ffe33 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.authorization import AuthorizationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-authorization +# USAGE + python role_assignments_list_for_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AuthorizationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", + ) + + response = client.role_assignments.list_for_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/authorization/azure-mgmt-authorization/setup.py b/sdk/authorization/azure-mgmt-authorization/setup.py index 7f652f336cab..3c68e22ceb9f 100644 --- a/sdk/authorization/azure-mgmt-authorization/setup.py +++ b/sdk/authorization/azure-mgmt-authorization/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -69,9 +70,10 @@ 'pytyped': ['py.typed'], }, install_requires=[ - 'msrest>=0.7.1', - 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.2,<2.0.0', + "msrest>=0.7.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", ], python_requires=">=3.7" ) diff --git a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_cli_mgmt_authorization.pyTestMgmtAuthorizationtest_list_by_resource.json b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_cli_mgmt_authorization.pyTestMgmtAuthorizationtest_list_by_resource.json index cbf2c5cd2299..f16021d0f79d 100644 --- a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_cli_mgmt_authorization.pyTestMgmtAuthorizationtest_list_by_resource.json +++ b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_cli_mgmt_authorization.pyTestMgmtAuthorizationtest_list_by_resource.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.11.0 Python/3.8.14 (Linux-5.15.0-1020-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 11 Oct 2022 02:41:41 GMT", + "Date": "Wed, 15 Feb 2023 03:43:04 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13871.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0 Python/3.8.14 (Linux-5.15.0-1020-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 11 Oct 2022 02:41:41 GMT", + "Date": "Wed, 15 Feb 2023 03:43:05 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13845.9 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "95ddc384-b740-4477-a840-0bf5527bdf88", + "client-request-id": "424f6838-bfde-4901-a814-82eff72266b8", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0 Python/3.8.14 (Linux-5.15.0-1020-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.20.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "95ddc384-b740-4477-a840-0bf5527bdf88", + "client-request-id": "424f6838-bfde-4901-a814-82eff72266b8", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 11 Oct 2022 02:41:41 GMT", + "Date": "Wed, 15 Feb 2023 03:43:05 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.13871.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "22", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/21.1.0 Python/3.8.14 (Linux-5.15.0-1020-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "eastus" @@ -231,7 +231,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 11 Oct 2022 02:41:43 GMT", + "Date": "Wed, 15 Feb 2023 03:43:07 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -242,10 +242,10 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0c6d11b3-2488-46d5-be2a-79e4b53189d3", + "x-ms-correlation-request-id": "bf9c1e16-4e9d-41de-9df3-c967617fe137", "x-ms-ratelimit-remaining-resource": "Microsoft.Compute/PutVM3Min;239,Microsoft.Compute/PutVM30Min;1199", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "WESTUS:20221011T024143Z:0c6d11b3-2488-46d5-be2a-79e4b53189d3" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T034308Z:bf9c1e16-4e9d-41de-9df3-c967617fe137" }, "ResponseBody": { "name": "resourcexxx", diff --git a/sdk/batch/azure-batch/pyproject.toml b/sdk/batch/azure-batch/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/batch/azure-batch/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-personalizer/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-personalizer/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-personalizer/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-autosuggest/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-autosuggest/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-autosuggest/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-customimagesearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-customimagesearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-customimagesearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-customsearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-customsearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-customsearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-entitysearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-entitysearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-entitysearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-imagesearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-imagesearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-imagesearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-newssearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-newssearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-newssearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-videosearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-videosearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-videosearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-visualsearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-visualsearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-visualsearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-search-websearch/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-search-websearch/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-search-websearch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md index 111c4a40cb2a..30606f8a6278 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 13.4.0 (2023-02-15) + +### Features Added + + - Added operation CommitmentPlansOperations.begin_create_or_update_association + - Added operation CommitmentPlansOperations.begin_create_or_update_plan + - Added operation CommitmentPlansOperations.begin_delete_association + - Added operation CommitmentPlansOperations.begin_delete_plan + - Added operation CommitmentPlansOperations.begin_update_plan + - Added operation CommitmentPlansOperations.get_association + - Added operation CommitmentPlansOperations.get_plan + - Added operation CommitmentPlansOperations.list_associations + - Added operation CommitmentPlansOperations.list_plans_by_resource_group + - Added operation CommitmentPlansOperations.list_plans_by_subscription + - Model AccountModel has a new parameter finetune_capabilities + - Model AccountModel has a new parameter lifecycle_status + - Model AccountProperties has a new parameter commitment_plan_associations + - Model AccountProperties has a new parameter locations + - Model CommitmentPlan has a new parameter kind + - Model CommitmentPlan has a new parameter location + - Model CommitmentPlan has a new parameter sku + - Model CommitmentPlan has a new parameter tags + - Model CommitmentPlanProperties has a new parameter commitment_plan_guid + - Model CommitmentPlanProperties has a new parameter provisioning_state + ## 13.4.0b1 (2022-12-29) ### Features Added diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md index 17aed0290080..591bc8c850cc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md @@ -45,7 +45,8 @@ client = CognitiveServicesManagementClient(credential=DefaultAzureCredential(), ## Examples -Code samples for this package can be found at [Cognitive Services Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/cognitiveservices) + +Code samples for this package can be found at [Cognitive Services Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) ## Troubleshooting diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json index d69f1304f878..f105bc4fcd40 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "f38115ac455af89493b0a0719d9a987404560dda", + "commit": "2d9846d81852452cf10270b18329ac382a881bf7", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/cognitiveservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py index 736da5bc66a5..1866139c50f9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py index 7dc1645854db..7312c68631c6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "13.4.0b1" +VERSION = "13.4.0" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py index 9bc1504e294e..23fd7fbae4a3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py @@ -51,7 +51,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -90,14 +90,15 @@ class AzureEntityResource(Resource): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.etag = None class Account(AzureEntityResource): # pylint: disable=too-many-instance-attributes - """Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. + """Cognitive Services account is an Azure resource representing the provisioned account, it's + type, location and SKU. Variables are only populated by the server, and will be ignored when sending a request. @@ -158,8 +159,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, properties: Optional["_models.AccountProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The Kind of the resource. :paramtype kind: str @@ -204,7 +205,7 @@ class AccountListResult(_serialization.Model): "value": {"key": "value", "type": "[Account]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of accounts. :paramtype next_link: str @@ -241,8 +242,8 @@ class DeploymentModel(_serialization.Model): } def __init__( - self, *, format: Optional[str] = None, name: Optional[str] = None, version: Optional[str] = None, **kwargs - ): + self, *, format: Optional[str] = None, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword format: Deployment model format. :paramtype format: str @@ -319,8 +320,8 @@ def __init__( finetune_capabilities: Optional[Dict[str, str]] = None, deprecation: Optional["_models.ModelDeprecationInfo"] = None, lifecycle_status: Optional[Union[str, "_models.ModelLifecycleStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword format: Deployment model format. :paramtype format: str @@ -367,8 +368,8 @@ class AccountModelListResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.AccountModel"]] = None, **kwargs - ): + self, *, next_link: Optional[str] = None, value: Optional[List["_models.AccountModel"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of Model. :paramtype next_link: str @@ -514,8 +515,8 @@ def __init__( # pylint: disable=too-many-locals disable_local_auth: Optional[bool] = None, restore: Optional[bool] = None, locations: Optional["_models.MultiRegionSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword migration_token: Resource migration token. :paramtype migration_token: str @@ -591,7 +592,9 @@ class AccountSku(_serialization.Model): "sku": {"key": "sku", "type": "Sku"}, } - def __init__(self, *, resource_type: Optional[str] = None, sku: Optional["_models.Sku"] = None, **kwargs): + def __init__( + self, *, resource_type: Optional[str] = None, sku: Optional["_models.Sku"] = None, **kwargs: Any + ) -> None: """ :keyword resource_type: Resource Namespace and Type. :paramtype resource_type: str @@ -614,7 +617,7 @@ class AccountSkuListResult(_serialization.Model): "value": {"key": "value", "type": "[AccountSku]"}, } - def __init__(self, *, value: Optional[List["_models.AccountSku"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AccountSku"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets the list of Cognitive Services accounts and their properties. :paramtype value: list[~azure.mgmt.cognitiveservices.models.AccountSku] @@ -637,7 +640,7 @@ class ApiKeys(_serialization.Model): "key2": {"key": "key2", "type": "str"}, } - def __init__(self, *, key1: Optional[str] = None, key2: Optional[str] = None, **kwargs): + def __init__(self, *, key1: Optional[str] = None, key2: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key1: Gets the value of key 1. :paramtype key1: str @@ -722,8 +725,8 @@ def __init__( aad_tenant_id: Optional[str] = None, super_user: Optional[str] = None, website_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -790,8 +793,8 @@ def __init__( count: Optional[float] = None, renewal_period: Optional[float] = None, rules: Optional[List["_models.ThrottlingRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword count: The count value of Call Rate Limit. :paramtype count: float @@ -830,7 +833,7 @@ class CheckDomainAvailabilityParameter(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, subdomain_name: str, type: str, kind: Optional[str] = None, **kwargs): + def __init__(self, *, subdomain_name: str, type: str, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword subdomain_name: The subdomain name to use. Required. :paramtype subdomain_name: str @@ -870,7 +873,7 @@ class CheckSkuAvailabilityParameter(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, skus: List[str], kind: str, type: str, **kwargs): + def __init__(self, *, skus: List[str], kind: str, type: str, **kwargs: Any) -> None: """ :keyword skus: The SKU of the resource. Required. :paramtype skus: list[str] @@ -899,7 +902,9 @@ class CommitmentCost(_serialization.Model): "overage_meter_id": {"key": "overageMeterId", "type": "str"}, } - def __init__(self, *, commitment_meter_id: Optional[str] = None, overage_meter_id: Optional[str] = None, **kwargs): + def __init__( + self, *, commitment_meter_id: Optional[str] = None, overage_meter_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword commitment_meter_id: Commitment meter Id. :paramtype commitment_meter_id: str @@ -942,7 +947,7 @@ class CommitmentPeriod(_serialization.Model): "end_date": {"key": "endDate", "type": "str"}, } - def __init__(self, *, tier: Optional[str] = None, count: Optional[int] = None, **kwargs): + def __init__(self, *, tier: Optional[str] = None, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword tier: Commitment period commitment tier. :paramtype tier: str @@ -958,7 +963,8 @@ def __init__(self, *, tier: Optional[str] = None, count: Optional[int] = None, * class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -984,7 +990,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -1047,8 +1053,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, properties: Optional["_models.CommitmentPlanProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The Kind of the resource. :paramtype kind: str @@ -1109,7 +1115,7 @@ class CommitmentPlanAccountAssociation(ProxyResource): "account_id": {"key": "properties.accountId", "type": "str"}, } - def __init__(self, *, account_id: Optional[str] = None, **kwargs): + def __init__(self, *, account_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword account_id: The Azure resource id of the account. :paramtype account_id: str @@ -1141,7 +1147,7 @@ class CommitmentPlanAccountAssociationListResult(_serialization.Model): "value": {"key": "value", "type": "[CommitmentPlanAccountAssociation]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of Commitment Plan Account Association. :paramtype next_link: str @@ -1166,8 +1172,8 @@ class CommitmentPlanAssociation(_serialization.Model): } def __init__( - self, *, commitment_plan_id: Optional[str] = None, commitment_plan_location: Optional[str] = None, **kwargs - ): + self, *, commitment_plan_id: Optional[str] = None, commitment_plan_location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword commitment_plan_id: The Azure resource id of the commitment plan. :paramtype commitment_plan_id: str @@ -1199,7 +1205,7 @@ class CommitmentPlanListResult(_serialization.Model): "value": {"key": "value", "type": "[CommitmentPlan]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of CommitmentPlan. :paramtype next_link: str @@ -1261,8 +1267,8 @@ def __init__( current: Optional["_models.CommitmentPeriod"] = None, auto_renew: Optional[bool] = None, next: Optional["_models.CommitmentPeriod"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword commitment_plan_guid: Commitment plan guid. :paramtype commitment_plan_guid: str @@ -1303,7 +1309,7 @@ class CommitmentQuota(_serialization.Model): "unit": {"key": "unit", "type": "str"}, } - def __init__(self, *, quantity: Optional[int] = None, unit: Optional[str] = None, **kwargs): + def __init__(self, *, quantity: Optional[int] = None, unit: Optional[str] = None, **kwargs: Any) -> None: """ :keyword quantity: Commitment quota quantity. :paramtype quantity: int @@ -1359,8 +1365,8 @@ def __init__( max_count: Optional[int] = None, quota: Optional["_models.CommitmentQuota"] = None, cost: Optional["_models.CommitmentCost"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The Kind of the resource. :paramtype kind: str @@ -1411,7 +1417,7 @@ class CommitmentTierListResult(_serialization.Model): "value": {"key": "value", "type": "[CommitmentTier]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of CommitmentTier. :paramtype next_link: str @@ -1459,7 +1465,7 @@ class Deployment(ProxyResource): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of Cognitive Services account deployment. :paramtype properties: ~azure.mgmt.cognitiveservices.models.DeploymentProperties @@ -1490,7 +1496,7 @@ class DeploymentListResult(_serialization.Model): "value": {"key": "value", "type": "[Deployment]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of Deployment. :paramtype next_link: str @@ -1542,8 +1548,8 @@ def __init__( model: Optional["_models.DeploymentModel"] = None, scale_settings: Optional["_models.DeploymentScaleSettings"] = None, rai_policy_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword model: Properties of Cognitive Services account deployment model. :paramtype model: ~azure.mgmt.cognitiveservices.models.DeploymentModel @@ -1590,8 +1596,8 @@ def __init__( *, scale_type: Optional[Union[str, "_models.DeploymentScaleType"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scale_type: Deployment scale type. Known values are: "Standard" and "Manual". :paramtype scale_type: str or ~azure.mgmt.cognitiveservices.models.DeploymentScaleType @@ -1635,8 +1641,8 @@ def __init__( subdomain_name: Optional[str] = None, type: Optional[str] = None, kind: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_subdomain_available: Indicates the given SKU is available or not. :paramtype is_subdomain_available: bool @@ -1677,8 +1683,8 @@ def __init__( *, key_vault_properties: Optional["_models.KeyVaultProperties"] = None, key_source: Union[str, "_models.KeySource"] = "Microsoft.KeyVault", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Properties of KeyVault. :paramtype key_vault_properties: ~azure.mgmt.cognitiveservices.models.KeyVaultProperties @@ -1712,7 +1718,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1752,7 +1758,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1763,7 +1769,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.cognitiveservices.models.ErrorDetail @@ -1773,7 +1780,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.cognitiveservices.models.ErrorDetail @@ -1818,8 +1825,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". @@ -1855,7 +1862,7 @@ class IpRule(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: str, **kwargs): + def __init__(self, *, value: str, **kwargs: Any) -> None: """ :keyword value: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). Required. @@ -1892,8 +1899,8 @@ def __init__( key_version: Optional[str] = None, key_vault_uri: Optional[str] = None, identity_client_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: Name of the Key from KeyVault. :paramtype key_name: str @@ -1925,7 +1932,7 @@ class MetricName(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The name of the metric. :paramtype value: str @@ -1951,7 +1958,7 @@ class ModelDeprecationInfo(_serialization.Model): "inference": {"key": "inference", "type": "str"}, } - def __init__(self, *, fine_tune: Optional[str] = None, inference: Optional[str] = None, **kwargs): + def __init__(self, *, fine_tune: Optional[str] = None, inference: Optional[str] = None, **kwargs: Any) -> None: """ :keyword fine_tune: The datetime of deprecation of the fineTune Model. :paramtype fine_tune: str @@ -1983,8 +1990,8 @@ def __init__( *, routing_method: Optional[Union[str, "_models.RoutingMethods"]] = None, regions: Optional[List["_models.RegionSetting"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_method: Multiregion routing methods. Known values are: "Priority", "Weighted", and "Performance". @@ -2022,8 +2029,8 @@ def __init__( default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, ip_rules: Optional[List["_models.IpRule"]] = None, virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. @@ -2077,7 +2084,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.cognitiveservices.models.OperationDisplay @@ -2123,7 +2130,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2133,7 +2140,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -2153,7 +2161,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2171,7 +2179,7 @@ class PatchResourceTags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2181,7 +2189,8 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): class PatchResourceTagsAndSku(PatchResourceTags): - """The object being used to update tags and sku of a resource, in general used for PATCH operations. + """The object being used to update tags and sku of a resource, in general used for PATCH + operations. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -2194,7 +2203,9 @@ class PatchResourceTagsAndSku(PatchResourceTags): "sku": {"key": "sku", "type": "Sku"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.Sku"] = None, **kwargs): + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.Sku"] = None, **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2222,7 +2233,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2274,8 +2285,8 @@ def __init__( *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: Resource properties. :paramtype properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionProperties @@ -2299,7 +2310,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private endpoint connections. :paramtype value: list[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] @@ -2350,8 +2361,8 @@ def __init__( private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", private_endpoint: Optional["_models.PrivateEndpoint"] = None, group_ids: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The resource of private end point. :paramtype private_endpoint: ~azure.mgmt.cognitiveservices.models.PrivateEndpoint @@ -2399,7 +2410,7 @@ class PrivateLinkResource(Resource): "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, } - def __init__(self, *, properties: Optional["_models.PrivateLinkResourceProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.PrivateLinkResourceProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Resource properties. :paramtype properties: ~azure.mgmt.cognitiveservices.models.PrivateLinkResourceProperties @@ -2419,7 +2430,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private link resources. :paramtype value: list[~azure.mgmt.cognitiveservices.models.PrivateLinkResource] @@ -2456,7 +2467,7 @@ class PrivateLinkResourceProperties(_serialization.Model): "display_name": {"key": "displayName", "type": "str"}, } - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs): + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword required_zone_names: The private link resource Private link DNS zone name. :paramtype required_zone_names: list[str] @@ -2469,7 +2480,8 @@ def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs) class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. + """A collection of information about the state of the connection between service consumer and + provider. :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Known values are: "Pending", "Approved", and "Rejected". @@ -2494,8 +2506,8 @@ def __init__( status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Known values are: "Pending", "Approved", and "Rejected". @@ -2536,8 +2548,8 @@ def __init__( count: Optional[float] = None, renewal_period: Optional[float] = None, rules: Optional[List["_models.ThrottlingRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword count: :paramtype count: float @@ -2570,7 +2582,7 @@ class RegenerateKeyParameters(_serialization.Model): "key_name": {"key": "keyName", "type": "str"}, } - def __init__(self, *, key_name: Union[str, "_models.KeyName"], **kwargs): + def __init__(self, *, key_name: Union[str, "_models.KeyName"], **kwargs: Any) -> None: """ :keyword key_name: key name to generate (Key1|Key2). Required. Known values are: "Key1" and "Key2". @@ -2603,8 +2615,8 @@ def __init__( name: Optional[str] = None, value: Optional[float] = None, customsubdomain: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the region. :paramtype name: str @@ -2633,7 +2645,7 @@ class RequestMatchPattern(_serialization.Model): "method": {"key": "method", "type": "str"}, } - def __init__(self, *, path: Optional[str] = None, method: Optional[str] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, method: Optional[str] = None, **kwargs: Any) -> None: """ :keyword path: :paramtype path: str @@ -2681,8 +2693,8 @@ def __init__( kind: Optional[str] = None, locations: Optional[List[str]] = None, restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The type of resource the SKU applies to. :paramtype resource_type: str @@ -2727,7 +2739,7 @@ class ResourceSkuListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ResourceSku"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.ResourceSku"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The list of skus available for the subscription. Required. :paramtype value: list[~azure.mgmt.cognitiveservices.models.ResourceSku] @@ -2753,7 +2765,9 @@ class ResourceSkuRestrictionInfo(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, locations: Optional[List[str]] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, locations: Optional[List[str]] = None, zones: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword locations: Locations where the SKU is restricted. :paramtype locations: list[str] @@ -2795,8 +2809,8 @@ def __init__( values: Optional[List[str]] = None, restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of restrictions. Known values are: "Location" and "Zone". :paramtype type: str or ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionsType @@ -2859,8 +2873,8 @@ def __init__( size: Optional[str] = None, family: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. :paramtype name: str @@ -2921,8 +2935,8 @@ def __init__( sku_available: Optional[bool] = None, reason: Optional[str] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The Kind of the resource. :paramtype kind: str @@ -2957,7 +2971,7 @@ class SkuAvailabilityListResult(_serialization.Model): "value": {"key": "value", "type": "[SkuAvailability]"}, } - def __init__(self, *, value: Optional[List["_models.SkuAvailability"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.SkuAvailability"]] = None, **kwargs: Any) -> None: """ :keyword value: Check SKU availability result list. :paramtype value: list[~azure.mgmt.cognitiveservices.models.SkuAvailability] @@ -2980,7 +2994,7 @@ class SkuCapability(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SkuCapability. :paramtype name: str @@ -3015,8 +3029,8 @@ def __init__( count_of_downgrades: Optional[float] = None, count_of_upgrades_after_downgrades: Optional[float] = None, last_change_date: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword count_of_downgrades: Gets the count of downgrades. :paramtype count_of_downgrades: float @@ -3068,8 +3082,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -3130,8 +3144,8 @@ def __init__( min_count: Optional[float] = None, dynamic_throttling_enabled: Optional[bool] = None, match_patterns: Optional[List["_models.RequestMatchPattern"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key: :paramtype key: str @@ -3196,8 +3210,8 @@ def __init__( current_value: Optional[float] = None, next_reset_time: Optional[str] = None, status: Optional[Union[str, "_models.QuotaUsageStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", "BytesPerSecond", and "Milliseconds". @@ -3237,7 +3251,7 @@ class UsageListResult(_serialization.Model): "value": {"key": "value", "type": "[Usage]"}, } - def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of usages for Cognitive Service account. :paramtype value: list[~azure.mgmt.cognitiveservices.models.Usage] @@ -3267,7 +3281,7 @@ class UserAssignedIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -3288,7 +3302,9 @@ class UserOwnedStorage(_serialization.Model): "identity_client_id": {"key": "identityClientId", "type": "str"}, } - def __init__(self, *, resource_id: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs): + def __init__( + self, *, resource_id: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resource_id: Full resource id of a Microsoft.Storage resource. :paramtype resource_id: str @@ -3331,8 +3347,8 @@ def __init__( id: str, # pylint: disable=redefined-builtin state: Optional[str] = None, ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. diff --git a/sdk/communication/azure-communication-chat/pyproject.toml b/sdk/communication/azure-communication-chat/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-chat/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/communication/azure-communication-email/pyproject.toml b/sdk/communication/azure-communication-email/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-email/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py index eaa12a76585b..eeb6f34237c4 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py @@ -30,7 +30,7 @@ class CommunicationIdentityClient(object): :param Union[TokenCredential, AzureKeyCredential] credential: The credential we use to authenticate against the service. :keyword api_version: Azure Communication Identity API version. - Default value is "2022-06-01". Note that overriding this default value may result in unsupported behavior. + Default value is "2022-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str .. admonition:: Example: @@ -230,4 +230,4 @@ def get_token_for_teams_user( body=request_body, cls=lambda pr, u, e: AccessToken(u['token'], u['expiresOn']), **kwargs) - \ No newline at end of file + \ No newline at end of file diff --git a/sdk/communication/azure-communication-identity/pyproject.toml b/sdk/communication/azure-communication-identity/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-identity/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/communication/azure-communication-jobrouter/pyproject.toml b/sdk/communication/azure-communication-jobrouter/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-jobrouter/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/communication/azure-communication-networktraversal/pyproject.toml b/sdk/communication/azure-communication-networktraversal/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-networktraversal/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/communication/azure-communication-phonenumbers/pyproject.toml b/sdk/communication/azure-communication-phonenumbers/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/communication/azure-communication-rooms/pyproject.toml b/sdk/communication/azure-communication-rooms/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-rooms/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/communication/azure-communication-sms/pyproject.toml b/sdk/communication/azure-communication-sms/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/communication/azure-communication-sms/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/confidentialledger/azure-confidentialledger/pyproject.toml b/sdk/confidentialledger/azure-confidentialledger/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/confidentialledger/azure-confidentialledger/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/containerregistry/azure-containerregistry/pyproject.toml b/sdk/containerregistry/azure-containerregistry/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/containerregistry/azure-containerregistry/samples/README.md b/sdk/containerregistry/azure-containerregistry/samples/README.md index bcd52e253def..c986811cfa6a 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/README.md +++ b/sdk/containerregistry/azure-containerregistry/samples/README.md @@ -20,6 +20,8 @@ These code samples show common scenario operations with the Azure Container Regi |[sample_delete_images.py][delete_images] ([sample_delete_images_async.py][delete_images_async]) | Delete images from a repository | |[sample_set_image_properties.py][set_image_properties] ([sample_set_image_properties_async.py][set_image_properties_async]) | Set read/write/delete properties on an image | |[sample_list_tags.py][list_tags] ([sample_list_tags_async.py][list_tags_async]) | List tags on an image with anonymous access | +|[sample_upload_download_blob.py][upload_download_blob] | Upload and download an OCI artifact blob to and from a repository | +|[sample_upload_download_manifest.py][upload_download_manifest] | Upload and download an OCI manifest to and from a repository | ### Prerequisites * Python 3.7 or later is required to use this package. @@ -38,7 +40,7 @@ pip install --pre azure-containerregistry 1. Open a terminal window and `cd` to the directory that the samples are saved in. 2. Set the environment variables specified in the sample file you wish to run. -3. Follow the usage described in the file, e.g. `python sample_basic_use.py` +3. Follow the usage described in the file, e.g. `python sample_hello_world.py` ## Next steps @@ -60,3 +62,5 @@ Check out the [API reference documentation][rest_docs] to learn more about what [set_image_properties_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_set_image_properties_async.py [list_tags]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_list_tags.py [list_tags_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_list_tags_async.py +[upload_download_blob]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_blob.py +[upload_download_manifest]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_manifest.py diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_delete_images.py b/sdk/containerregistry/azure-containerregistry/samples/sample_delete_images.py index 6d8a63f56117..84e080ad78e8 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/sample_delete_images.py +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_delete_images.py @@ -39,9 +39,7 @@ def __init__(self): self.endpoint = os.environ.get("CONTAINERREGISTRY_ENDPOINT") self.authority = get_authority(self.endpoint) self.audience = get_audience(self.authority) - self.credential = get_credential( - self.authority, exclude_environment_credential=True - ) + self.credential = get_credential(self.authority, exclude_environment_credential=True) def delete_images(self): load_registry() diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_delete_tags.py b/sdk/containerregistry/azure-containerregistry/samples/sample_delete_tags.py index 490e7365696b..541087c00283 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/sample_delete_tags.py +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_delete_tags.py @@ -40,9 +40,7 @@ def __init__(self): self.endpoint = os.environ.get("CONTAINERREGISTRY_ENDPOINT") self.authority = get_authority(self.endpoint) self.audience = get_audience(self.authority) - self.credential = get_credential( - self.authority, exclude_environment_credential=True - ) + self.credential = get_credential(self.authority, exclude_environment_credential=True) def delete_tags(self): load_registry() diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_hello_world.py b/sdk/containerregistry/azure-containerregistry/samples/sample_hello_world.py index c0bb0f6f6e33..6f4662c26cb8 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/sample_hello_world.py +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_hello_world.py @@ -40,9 +40,7 @@ def __init__(self): self.endpoint = os.environ.get("CONTAINERREGISTRY_ENDPOINT") self.authority = get_authority(self.endpoint) self.audience = get_audience(self.authority) - self.credential = get_credential( - self.authority, exclude_environment_credential=True - ) + self.credential = get_credential(self.authority, exclude_environment_credential=True) def basic_sample(self): load_registry() diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_list_tags.py b/sdk/containerregistry/azure-containerregistry/samples/sample_list_tags.py index ed3336f1aa2f..3d24911b163b 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/sample_list_tags.py +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_list_tags.py @@ -41,9 +41,7 @@ def __init__(self): self.endpoint = os.environ.get("CONTAINERREGISTRY_ENDPOINT") self.authority = get_authority(self.endpoint) self.audience = get_audience(self.authority) - self.credential = get_credential( - self.authority, exclude_environment_credential=True - ) + self.credential = get_credential(self.authority, exclude_environment_credential=True) def list_tags(self): load_registry() diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_set_image_properties.py b/sdk/containerregistry/azure-containerregistry/samples/sample_set_image_properties.py index 947117c47c50..7f1ca8a88758 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/sample_set_image_properties.py +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_set_image_properties.py @@ -41,9 +41,7 @@ def __init__(self): self.endpoint = os.environ.get("CONTAINERREGISTRY_ENDPOINT") self.authority = get_authority(self.endpoint) self.audience = get_audience(self.authority) - self.credential = get_credential( - self.authority, exclude_environment_credential=True - ) + self.credential = get_credential(self.authority, exclude_environment_credential=True) def set_image_properties(self): load_registry() diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_blob.py b/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_blob.py new file mode 100644 index 000000000000..83d2efade648 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_blob.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: sample_upload_download_blob.py + +DESCRIPTION: + This sample demonstrates uploading and downloading an OCI artifact blob to and from a repository. + +USAGE: + python sample_upload_download_blob.py + + Set the environment variables with your own values before running the sample: + 1) CONTAINERREGISTRY_ENDPOINT - The URL of you Container Registry account + + This sample assumes your registry has a repository "library/hello-world". +""" +import os +from io import BytesIO +from dotenv import find_dotenv, load_dotenv +from azure.containerregistry import ContainerRegistryClient +from sample_utilities import load_registry, get_authority, get_audience, get_credential + + +class UploadDownloadBlob(object): + def __init__(self): + load_dotenv(find_dotenv()) + self.endpoint = os.environ.get("CONTAINERREGISTRY_ENDPOINT") + self.authority = get_authority(self.endpoint) + self.audience = get_audience(self.authority) + self.credential = get_credential(self.authority, exclude_environment_credential=True) + + def upload_download_blob(self): + load_registry() + repository_name = "library/hello-world" + blob_content = BytesIO(b"Hello world!") + with ContainerRegistryClient(self.endpoint, self.credential, audience=self.audience) as client: + digest = client.upload_blob(repository_name, blob_content) + download_result = client.download_blob(repository_name, digest) + print(download_result.data.read()) + + +if __name__ == "__main__": + sample = UploadDownloadBlob() + sample.upload_download_blob() diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_manifest.py b/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_manifest.py new file mode 100644 index 000000000000..ccc44358d323 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_upload_download_manifest.py @@ -0,0 +1,80 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: sample_upload_download_manifest.py + +DESCRIPTION: + This sample demonstrates uploading and downloading an OCI manifest to a repository. + +USAGE: + python sample_upload_download_manifest.py + + Set the environment variables with your own values before running the sample: + 1) CONTAINERREGISTRY_ENDPOINT - The URL of you Container Registry account + + This sample assumes your registry has a repository "library/hello-world". +""" +import os +import json +from io import BytesIO +from dotenv import find_dotenv, load_dotenv +from azure.containerregistry import ContainerRegistryClient +from azure.containerregistry._generated.models import Annotations, Descriptor, OCIManifest +from sample_utilities import load_registry, get_authority, get_audience, get_credential + + +class UploadDownloadManifest(object): + def __init__(self): + load_dotenv(find_dotenv()) + self.endpoint = os.environ.get("CONTAINERREGISTRY_ENDPOINT") + self.authority = get_authority(self.endpoint) + self.audience = get_audience(self.authority) + self.credential = get_credential(self.authority, exclude_environment_credential=True) + load_registry() + + def upload_download_manifest(self): + repository_name = "library/hello-world" + layer = BytesIO(b"Sample layer") + config = BytesIO(json.dumps( + { + "sample config": "content", + }).encode()) + with ContainerRegistryClient(self.endpoint, self.credential, audience=self.audience) as client: + + + # Upload a layer + layer_digest = client.upload_blob(repository_name, layer) + # Upload a config + config_digest = client.upload_blob(repository_name, config) + # Create a manifest with config and layer info + manifest = OCIManifest( + config = Descriptor( + media_type="application/vnd.oci.image.config.v1+json", + digest=config_digest, + size=len(config.getbuffer()) + ), + schema_version=2, + layers=[ + Descriptor( + media_type="application/vnd.oci.image.layer.v1.tar", + digest=layer_digest, + size=len(layer.getbuffer()), + annotations=Annotations(name="artifact.txt") + ) + ] + ) + + digest = client.upload_manifest(repository_name, manifest) + download_result = client.download_manifest(repository_name, digest) + print(download_result.data.read()) + + +if __name__ == "__main__": + sample = UploadDownloadManifest() + sample.upload_download_manifest() diff --git a/sdk/core/azure-core-experimental/azure/__init__.py b/sdk/core/azure-core-experimental/azure/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-experimental/azure/__init__.py +++ b/sdk/core/azure-core-experimental/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-experimental/azure/core/__init__.py b/sdk/core/azure-core-experimental/azure/core/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-experimental/azure/core/__init__.py +++ b/sdk/core/azure-core-experimental/azure/core/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-experimental/azure/core/experimental/__init__.py b/sdk/core/azure-core-experimental/azure/core/experimental/__init__.py index a5db9f961fc2..58bcccc100fb 100644 --- a/sdk/core/azure-core-experimental/azure/core/experimental/__init__.py +++ b/sdk/core/azure-core-experimental/azure/core/experimental/__init__.py @@ -25,4 +25,5 @@ # -------------------------------------------------------------------------- from ._version import VERSION + __version__ = VERSION diff --git a/sdk/core/azure-core-experimental/azure/core/experimental/transport/__init__.py b/sdk/core/azure-core-experimental/azure/core/experimental/transport/__init__.py index b7d3501810c4..c031bc65e95a 100644 --- a/sdk/core/azure-core-experimental/azure/core/experimental/transport/__init__.py +++ b/sdk/core/azure-core-experimental/azure/core/experimental/transport/__init__.py @@ -29,16 +29,17 @@ if sys.version_info >= (3, 7): __all__ = [ - 'PyodideTransport', + "PyodideTransport", ] def __dir__(): return __all__ def __getattr__(name): - if name == 'PyodideTransport': + if name == "PyodideTransport": try: from ._pyodide import PyodideTransport + return PyodideTransport except ImportError: raise ImportError("pyodide package is not installed") diff --git a/sdk/core/azure-core-experimental/azure/core/experimental/transport/_pyodide.py b/sdk/core/azure-core-experimental/azure/core/experimental/transport/_pyodide.py index cb1220a29d63..b9e083f0a67e 100644 --- a/sdk/core/azure-core-experimental/azure/core/experimental/transport/_pyodide.py +++ b/sdk/core/azure-core-experimental/azure/core/experimental/transport/_pyodide.py @@ -27,7 +27,7 @@ from collections.abc import AsyncIterator from io import BytesIO -import js # pylint: disable=import-error +import js # pylint: disable=import-error from pyodide import JsException # pylint: disable=import-error from pyodide.http import pyfetch # pylint: disable=import-error @@ -42,7 +42,6 @@ class PyodideTransportResponse(AsyncHttpResponseImpl): """Async response object for the `PyodideTransport`.""" - def _js_stream(self): """So we get a fresh stream every time.""" return self._internal_response.clone().js_response.body @@ -62,6 +61,7 @@ async def load_body(self) -> None: if self._content is None: self._content = await self._internal_response.clone().bytes() + class PyodideStreamDownloadGenerator(AsyncIterator): """Simple stream download generator that returns the contents of a request. @@ -106,6 +106,7 @@ async def __anext__(self) -> bytes: self._buffer_left -= self._block_size return self._stream.read(self._block_size) + class PyodideTransport(AsyncioRequestsTransport): """**This object is experimental**, meaning it may be changed in a future release or might break with a future Pyodide release. This transport was built with Pyodide diff --git a/sdk/core/azure-core-experimental/samples/pyodide_integration/browser.py b/sdk/core/azure-core-experimental/samples/pyodide_integration/browser.py index d91762fbf0d8..e6a6a30ae07b 100644 --- a/sdk/core/azure-core-experimental/samples/pyodide_integration/browser.py +++ b/sdk/core/azure-core-experimental/samples/pyodide_integration/browser.py @@ -81,12 +81,9 @@ async def test_decompress_generator(self): data = b"".join([x async for x in response.iter_bytes()]) assert data == b"hello world\n" - async def test_sentiment_analysis(self): """Test that sentiment analysis works.""" - results = await self.text_analytics_client.analyze_sentiment( - ["good great amazing"] - ) + results = await self.text_analytics_client.analyze_sentiment(["good great amazing"]) assert len(results) == 1 result = results[0] assert result.sentiment == "positive" diff --git a/sdk/core/azure-core-experimental/setup.py b/sdk/core/azure-core-experimental/setup.py index 2dfc82062d89..b3277b94c575 100644 --- a/sdk/core/azure-core-experimental/setup.py +++ b/sdk/core/azure-core-experimental/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -18,50 +18,49 @@ package_folder_path = "azure/core/experimental" # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', # type: ignore - fd.read(), re.MULTILINE).group(1) +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) # type: ignore if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-experimental', + description="Microsoft Azure {} Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-experimental", classifiers=[ "Development Status :: 4 - Beta", - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", ], zip_safe=False, packages=[ - 'azure.core.experimental', + "azure.core.experimental", ], include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, python_requires=">=3.7", install_requires=[ - 'azure-core<2.0.0,>=1.25.0', + "azure-core<2.0.0,>=1.25.0", ], ) diff --git a/sdk/core/azure-core-experimental/tests/test_pyodide_transport.py b/sdk/core/azure-core-experimental/tests/test_pyodide_transport.py index 7b84222fa908..3855c3506a38 100644 --- a/sdk/core/azure-core-experimental/tests/test_pyodide_transport.py +++ b/sdk/core/azure-core-experimental/tests/test_pyodide_transport.py @@ -78,9 +78,7 @@ def mock_pyfetch(self, mock_pyodide_module): """Utility fixture for less typing.""" return mock_pyodide_module.http.pyfetch - def create_mock_response( - self, body: bytes, headers: dict, status: int, status_text: str - ) -> mock.Mock: + def create_mock_response(self, body: bytes, headers: dict, status: int, status_text: str) -> mock.Mock: """Create a mock response object that mimics `pyodide.http.FetchResponse`""" mock_response = mock.Mock() mock_response.body = body @@ -106,9 +104,7 @@ async def test_successful_send(self, mock_pyfetch, mock_pyodide_module, pipeline method = "POST" headers = {"key": "value"} data = b"data" - request = HttpRequest( - method=method, url=PLACEHOLDER_ENDPOINT, headers=headers, data=data - ) + request = HttpRequest(method=method, url=PLACEHOLDER_ENDPOINT, headers=headers, data=data) response_body = b"0123" response_headers = {"header": "value"} response_status = 200 @@ -167,4 +163,5 @@ def test_valid_import(self, transport): """ # Use patch so we don't clutter up the `sys.modules` namespace. import azure.core.experimental.transport as transport + assert transport.PyodideTransport diff --git a/sdk/core/azure-core-tracing-opencensus/azure/__init__.py b/sdk/core/azure-core-tracing-opencensus/azure/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opencensus/azure/__init__.py +++ b/sdk/core/azure-core-tracing-opencensus/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opencensus/azure/core/__init__.py b/sdk/core/azure-core-tracing-opencensus/azure/core/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opencensus/azure/core/__init__.py +++ b/sdk/core/azure-core-tracing-opencensus/azure/core/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/__init__.py b/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/__init__.py +++ b/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/__init__.py b/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/__init__.py +++ b/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/opencensus_span/__init__.py b/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/opencensus_span/__init__.py index 6aa9f9974582..b332ba8b7f4f 100644 --- a/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/opencensus_span/__init__.py +++ b/sdk/core/azure-core-tracing-opencensus/azure/core/tracing/ext/opencensus_span/__init__.py @@ -25,6 +25,7 @@ from typing import Dict, Optional, Union, Callable, Sequence, Any from azure.core.pipeline.transport import HttpRequest, HttpResponse + AttributeValue = Union[ str, bool, @@ -40,7 +41,7 @@ __version__ = VERSION -_config_integration.trace_integrations(['threading']) +_config_integration.trace_integrations(["threading"]) class OpenCensusSpan(HttpSpanMixin, object): @@ -61,20 +62,26 @@ def __init__(self, span=None, name="span", **kwargs): :paramtype links: list[~azure.core.tracing.Link] """ tracer = self.get_current_tracer() - value = kwargs.pop('kind', None) + value = kwargs.pop("kind", None) kind = ( - OpenCensusSpanKind.CLIENT if value == SpanKind.CLIENT else - OpenCensusSpanKind.CLIENT if value == SpanKind.PRODUCER else # No producer in opencensus - OpenCensusSpanKind.SERVER if value == SpanKind.SERVER else - OpenCensusSpanKind.CLIENT if value == SpanKind.CONSUMER else # No consumer in opencensus - OpenCensusSpanKind.UNSPECIFIED if value == SpanKind.INTERNAL else # No internal in opencensus - OpenCensusSpanKind.UNSPECIFIED if value == SpanKind.UNSPECIFIED else - None - ) # type: SpanKind + OpenCensusSpanKind.CLIENT + if value == SpanKind.CLIENT + else OpenCensusSpanKind.CLIENT + if value == SpanKind.PRODUCER + else OpenCensusSpanKind.SERVER # No producer in opencensus + if value == SpanKind.SERVER + else OpenCensusSpanKind.CLIENT + if value == SpanKind.CONSUMER + else OpenCensusSpanKind.UNSPECIFIED # No consumer in opencensus + if value == SpanKind.INTERNAL + else OpenCensusSpanKind.UNSPECIFIED # No internal in opencensus + if value == SpanKind.UNSPECIFIED + else None + ) # type: SpanKind if value and kind is None: raise ValueError("Kind {} is not supported in OpenCensus".format(value)) - links = kwargs.pop('links', None) + links = kwargs.pop("links", None) self._span_instance = span or tracer.start_span(name=name, **kwargs) if kind is not None: self._span_instance.span_kind = kind @@ -84,11 +91,8 @@ def __init__(self, span=None, name="span", **kwargs): for link in links: ctx = trace_context_http_header_format.TraceContextPropagator().from_headers(link.headers) self._span_instance.add_link( - Link( - trace_id=ctx.trace_id, - span_id=ctx.span_id, - attributes=link.attributes - )) + Link(trace_id=ctx.trace_id, span_id=ctx.span_id, attributes=link.attributes) + ) except AttributeError: # we will just send the links as is if it's not ~azure.core.tracing.Link without any validation # assuming user knows what they are doing. @@ -121,10 +125,13 @@ def kind(self): """Get the span kind of this span.""" value = self.span_instance.span_kind return ( - SpanKind.CLIENT if value == OpenCensusSpanKind.CLIENT else - SpanKind.SERVER if value == OpenCensusSpanKind.SERVER else - SpanKind.UNSPECIFIED if value == OpenCensusSpanKind.UNSPECIFIED else - None + SpanKind.CLIENT + if value == OpenCensusSpanKind.CLIENT + else SpanKind.SERVER + if value == OpenCensusSpanKind.SERVER + else SpanKind.UNSPECIFIED + if value == OpenCensusSpanKind.UNSPECIFIED + else None ) _KIND_MAPPING = { @@ -171,7 +178,7 @@ def to_header(self): :return: A key value pair dictionary """ tracer_from_context = self.get_current_tracer() - temp_headers = {} # type: Dict[str, str] + temp_headers = {} # type: Dict[str, str] if tracer_from_context is not None: ctx = tracer_from_context.span_context try: @@ -205,7 +212,7 @@ def get_trace_parent(self): :return: a traceparent string :rtype: str """ - return self.to_header()['traceparent'] + return self.to_header()["traceparent"] @classmethod def link(cls, traceparent, attributes=None): @@ -216,9 +223,7 @@ def link(cls, traceparent, attributes=None): :param traceparent: A complete traceparent :type traceparent: str """ - cls.link_from_headers({ - 'traceparent': traceparent - }, attributes) + cls.link_from_headers({"traceparent": traceparent}, attributes) @classmethod def link_from_headers(cls, headers, attributes=None): @@ -231,11 +236,7 @@ def link_from_headers(cls, headers, attributes=None): """ ctx = trace_context_http_header_format.TraceContextPropagator().from_headers(headers) current_span = cls.get_current_span() - current_span.add_link(Link( - trace_id=ctx.trace_id, - span_id=ctx.span_id, - attributes=attributes - )) + current_span.add_link(Link(trace_id=ctx.trace_id, span_id=ctx.span_id, attributes=attributes)) @classmethod def get_current_span(cls): @@ -268,8 +269,7 @@ def set_current_span(cls, span): @classmethod def change_context(cls, span): # type: (Span) -> ContextManager - """Change the context for the life of this context manager. - """ + """Change the context for the life of this context manager.""" original_span = cls.get_current_span() try: execution_context.set_current_span(span) diff --git a/sdk/core/azure-core-tracing-opencensus/setup.py b/sdk/core/azure-core-tracing-opencensus/setup.py index 66cc4aa4069a..2f8ad67562c5 100644 --- a/sdk/core/azure-core-tracing-opencensus/setup.py +++ b/sdk/core/azure-core-tracing-opencensus/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -18,53 +18,52 @@ package_folder_path = "azure/core/tracing/ext/opencensus_span" # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', # type: ignore - fd.read(), re.MULTILINE).group(1) +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) # type: ignore if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-tracing-opencensus', + description="Microsoft Azure {} Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-tracing-opencensus", classifiers=[ "Development Status :: 4 - Beta", - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'License :: OSI Approved :: MIT License', + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "License :: OSI Approved :: MIT License", ], zip_safe=False, packages=[ - 'azure.core.tracing.ext.opencensus_span', + "azure.core.tracing.ext.opencensus_span", ], include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, python_requires=">=3.6", install_requires=[ - 'opencensus>=0.6.0', - 'opencensus-ext-azure>=0.3.1', - 'opencensus-ext-threading', - 'azure-core<2.0.0,>=1.13.0', + "opencensus>=0.6.0", + "opencensus-ext-azure>=0.3.1", + "opencensus-ext-threading", + "azure-core<2.0.0,>=1.13.0", ], ) diff --git a/sdk/core/azure-core-tracing-opencensus/tests/test_threading.py b/sdk/core/azure-core-tracing-opencensus/tests/test_threading.py index fb1c6a20bfec..30041affe53a 100644 --- a/sdk/core/azure-core-tracing-opencensus/tests/test_threading.py +++ b/sdk/core/azure-core-tracing-opencensus/tests/test_threading.py @@ -14,6 +14,7 @@ def test_get_span_from_thread(): result = [] + def get_span_from_thread(output): current_span = OpenCensusSpan.get_current_span() output.append(current_span) @@ -21,13 +22,10 @@ def get_span_from_thread(output): tracer = Tracer(sampler=AlwaysOnSampler()) with tracer.span(name="TestSpan") as span: - thread = threading.Thread( - target=get_span_from_thread, - args=(result,) - ) + thread = threading.Thread(target=get_span_from_thread, args=(result,)) thread.start() thread.join() assert span is result[0] - execution_context.clear() \ No newline at end of file + execution_context.clear() diff --git a/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py b/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py index 885f00816d0e..081db68e8b0f 100644 --- a/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py +++ b/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py @@ -23,6 +23,7 @@ import pytest + class TestOpencensusWrapper(unittest.TestCase): def test_span_passed_in(self): with ContextHelper(): @@ -141,10 +142,7 @@ def test_passing_links_in_ctor(self): trace = tracer_module.Tracer(sampler=AlwaysOnSampler()) parent = trace.start_span() wrapped_class = OpenCensusSpan( - links=[Link( - headers= {"traceparent": "00-2578531519ed94423ceae67588eff2c9-231ebdc614cb9ddd-01"} - ) - ] + links=[Link(headers={"traceparent": "00-2578531519ed94423ceae67588eff2c9-231ebdc614cb9ddd-01"})] ) assert len(wrapped_class.span_instance.links) == 1 link = wrapped_class.span_instance.links[0] @@ -157,9 +155,10 @@ def test_passing_links_in_ctor_with_attr(self): trace = tracer_module.Tracer(sampler=AlwaysOnSampler()) parent = trace.start_span() wrapped_class = OpenCensusSpan( - links=[Link( - headers= {"traceparent": "00-2578531519ed94423ceae67588eff2c9-231ebdc614cb9ddd-01"}, - attributes=attributes + links=[ + Link( + headers={"traceparent": "00-2578531519ed94423ceae67588eff2c9-231ebdc614cb9ddd-01"}, + attributes=attributes, ) ] ) @@ -169,7 +168,6 @@ def test_passing_links_in_ctor_with_attr(self): assert link.trace_id == "2578531519ed94423ceae67588eff2c9" assert link.span_id == "231ebdc614cb9ddd" - def test_set_http_attributes(self): with ContextHelper(): trace = tracer_module.Tracer(sampler=AlwaysOnSampler()) diff --git a/sdk/core/azure-core-tracing-opentelemetry/azure/__init__.py b/sdk/core/azure-core-tracing-opentelemetry/azure/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/azure/__init__.py +++ b/sdk/core/azure-core-tracing-opentelemetry/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opentelemetry/azure/core/__init__.py b/sdk/core/azure-core-tracing-opentelemetry/azure/core/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/azure/core/__init__.py +++ b/sdk/core/azure-core-tracing-opentelemetry/azure/core/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/__init__.py b/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/__init__.py +++ b/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/__init__.py b/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/__init__.py +++ b/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/opentelemetry_span/__init__.py b/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/opentelemetry_span/__init__.py index f872222877ce..da1db4dd3f43 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/opentelemetry_span/__init__.py +++ b/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/opentelemetry_span/__init__.py @@ -24,6 +24,7 @@ from typing import Any, Mapping, Dict, Optional, Union, Callable, Sequence from azure.core.pipeline.transport import HttpRequest, HttpResponse + AttributeValue = Union[ str, bool, @@ -56,20 +57,26 @@ def __init__(self, span=None, name="span", **kwargs): current_tracer = self.get_current_tracer() ## kind - value = kwargs.pop('kind', None) + value = kwargs.pop("kind", None) kind = ( - OpenTelemetrySpanKind.CLIENT if value == SpanKind.CLIENT else - OpenTelemetrySpanKind.PRODUCER if value == SpanKind.PRODUCER else - OpenTelemetrySpanKind.SERVER if value == SpanKind.SERVER else - OpenTelemetrySpanKind.CONSUMER if value == SpanKind.CONSUMER else - OpenTelemetrySpanKind.INTERNAL if value == SpanKind.INTERNAL else - OpenTelemetrySpanKind.INTERNAL if value == SpanKind.UNSPECIFIED else - None - ) # type: SpanKind + OpenTelemetrySpanKind.CLIENT + if value == SpanKind.CLIENT + else OpenTelemetrySpanKind.PRODUCER + if value == SpanKind.PRODUCER + else OpenTelemetrySpanKind.SERVER + if value == SpanKind.SERVER + else OpenTelemetrySpanKind.CONSUMER + if value == SpanKind.CONSUMER + else OpenTelemetrySpanKind.INTERNAL + if value == SpanKind.INTERNAL + else OpenTelemetrySpanKind.INTERNAL + if value == SpanKind.UNSPECIFIED + else None + ) # type: SpanKind if value and kind is None: raise ValueError("Kind {} is not supported in OpenTelemetry".format(value)) - links = kwargs.pop('links', None) + links = kwargs.pop("links", None) if links: try: ot_links = [] @@ -77,11 +84,11 @@ def __init__(self, span=None, name="span", **kwargs): ctx = extract(link.headers) span_ctx = get_span_from_context(ctx).get_span_context() ot_links.append(OpenTelemetryLink(span_ctx, link.attributes)) - kwargs.setdefault('links', ot_links) + kwargs.setdefault("links", ot_links) except AttributeError: # we will just send the links as is if it's not ~azure.core.tracing.Link without any validation # assuming user knows what they are doing. - kwargs.setdefault('links', links) + kwargs.setdefault("links", links) self._span_instance = span or current_tracer.start_span(name=name, kind=kind, **kwargs) self._current_ctxt_manager = None @@ -112,32 +119,42 @@ def kind(self): """Get the span kind of this span.""" value = self.span_instance.kind return ( - SpanKind.CLIENT if value == OpenTelemetrySpanKind.CLIENT else - SpanKind.PRODUCER if value == OpenTelemetrySpanKind.PRODUCER else - SpanKind.SERVER if value == OpenTelemetrySpanKind.SERVER else - SpanKind.CONSUMER if value == OpenTelemetrySpanKind.CONSUMER else - SpanKind.INTERNAL if value == OpenTelemetrySpanKind.INTERNAL else - None + SpanKind.CLIENT + if value == OpenTelemetrySpanKind.CLIENT + else SpanKind.PRODUCER + if value == OpenTelemetrySpanKind.PRODUCER + else SpanKind.SERVER + if value == OpenTelemetrySpanKind.SERVER + else SpanKind.CONSUMER + if value == OpenTelemetrySpanKind.CONSUMER + else SpanKind.INTERNAL + if value == OpenTelemetrySpanKind.INTERNAL + else None ) - @kind.setter def kind(self, value): # type: (SpanKind) -> None """Set the span kind of this span.""" kind = ( - OpenTelemetrySpanKind.CLIENT if value == SpanKind.CLIENT else - OpenTelemetrySpanKind.PRODUCER if value == SpanKind.PRODUCER else - OpenTelemetrySpanKind.SERVER if value == SpanKind.SERVER else - OpenTelemetrySpanKind.CONSUMER if value == SpanKind.CONSUMER else - OpenTelemetrySpanKind.INTERNAL if value == SpanKind.INTERNAL else - OpenTelemetrySpanKind.INTERNAL if value == SpanKind.UNSPECIFIED else - None + OpenTelemetrySpanKind.CLIENT + if value == SpanKind.CLIENT + else OpenTelemetrySpanKind.PRODUCER + if value == SpanKind.PRODUCER + else OpenTelemetrySpanKind.SERVER + if value == SpanKind.SERVER + else OpenTelemetrySpanKind.CONSUMER + if value == SpanKind.CONSUMER + else OpenTelemetrySpanKind.INTERNAL + if value == SpanKind.INTERNAL + else OpenTelemetrySpanKind.INTERNAL + if value == SpanKind.UNSPECIFIED + else None ) if kind is None: raise ValueError("Kind {} is not supported in OpenTelemetry".format(value)) try: - self._span_instance._kind = kind # pylint: disable=protected-access + self._span_instance._kind = kind # pylint: disable=protected-access except AttributeError: warnings.warn( """Kind must be set while creating the span for OpenTelemetry. It might be possible @@ -148,13 +165,13 @@ def kind(self, value): def __enter__(self): """Start a span.""" self._current_ctxt_manager = trace.use_span(self._span_instance, end_on_exit=True) - self._current_ctxt_manager.__enter__() # pylint: disable=no-member + self._current_ctxt_manager.__enter__() # pylint: disable=no-member return self def __exit__(self, exception_type, exception_value, traceback): """Finish a span.""" if self._current_ctxt_manager: - self._current_ctxt_manager.__exit__(exception_type, exception_value, traceback) # pylint: disable=no-member + self._current_ctxt_manager.__exit__(exception_type, exception_value, traceback) # pylint: disable=no-member self._current_ctxt_manager = None def start(self): @@ -166,13 +183,13 @@ def finish(self): """Set the end time for a span.""" self.span_instance.end() - def to_header(self): # pylint: disable=no-self-use + def to_header(self): # pylint: disable=no-self-use # type: () -> Dict[str, str] """ Returns a dictionary with the header labels and values. :return: A key value pair dictionary """ - temp_headers = {} # type: Dict[str, str] + temp_headers = {} # type: Dict[str, str] inject(temp_headers) return temp_headers @@ -202,7 +219,7 @@ def get_trace_parent(self): :return: a traceparent string :rtype: str """ - return self.to_header()['traceparent'] + return self.to_header()["traceparent"] @classmethod def link(cls, traceparent, attributes=None): @@ -213,9 +230,7 @@ def link(cls, traceparent, attributes=None): :param traceparent: A complete traceparent :type traceparent: str """ - cls.link_from_headers({ - 'traceparent': traceparent - }, attributes) + cls.link_from_headers({"traceparent": traceparent}, attributes) @classmethod def link_from_headers(cls, headers, attributes=None): @@ -230,7 +245,7 @@ def link_from_headers(cls, headers, attributes=None): span_ctx = get_span_from_context(ctx).get_span_context() current_span = cls.get_current_span() try: - current_span._links.append(OpenTelemetryLink(span_ctx, attributes)) # pylint: disable=protected-access + current_span._links.append(OpenTelemetryLink(span_ctx, attributes)) # pylint: disable=protected-access except AttributeError: warnings.warn( """Link must be added while creating the span for OpenTelemetry. It might be possible @@ -257,15 +272,13 @@ def get_current_tracer(cls): @classmethod def change_context(cls, span): # type: (Span) -> ContextManager - """Change the context for the life of this context manager. - """ + """Change the context for the life of this context manager.""" return trace.use_span(span, end_on_exit=False) @classmethod def set_current_span(cls, span): # type: (Span) -> None - """Not supported by OpenTelemetry. - """ + """Not supported by OpenTelemetry.""" raise NotImplementedError( "set_current_span is not supported by OpenTelemetry plugin. Use change_context instead." ) diff --git a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventgrid.py b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventgrid.py index 8297190acd27..b31cbfe6e726 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventgrid.py +++ b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventgrid.py @@ -35,9 +35,7 @@ trace.set_tracer_provider(TracerProvider()) tracer = trace.get_tracer(__name__) -trace.get_tracer_provider().add_span_processor( - SimpleSpanProcessor(exporter) -) +trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(exporter)) # Example with Eventgrid SDKs import os @@ -45,14 +43,9 @@ from azure.eventgrid import EventGridPublisherClient from azure.core.credentials import AzureKeyCredential -hostname = os.environ['CLOUD_TOPIC_HOSTNAME'] -key = AzureKeyCredential(os.environ['CLOUD_ACCESS_KEY']) -cloud_event = CloudEvent( - source = 'demo', - type = 'sdk.demo', - data = {'test': 'hello'}, - extensions = {'test': 'maybe'} -) +hostname = os.environ["CLOUD_TOPIC_HOSTNAME"] +key = AzureKeyCredential(os.environ["CLOUD_ACCESS_KEY"]) +cloud_event = CloudEvent(source="demo", type="sdk.demo", data={"test": "hello"}, extensions={"test": "maybe"}) with tracer.start_as_current_span(name="MyApplication"): client = EventGridPublisherClient(hostname, key) client.send(cloud_event) diff --git a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventhubs.py b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventhubs.py index 1130f0703013..e4db96f1c3ee 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventhubs.py +++ b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_eventhubs.py @@ -34,29 +34,29 @@ trace.set_tracer_provider(TracerProvider()) tracer = trace.get_tracer(__name__) -trace.get_tracer_provider().add_span_processor( - SimpleSpanProcessor(exporter) -) +trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(exporter)) from azure.eventhub import EventHubProducerClient, EventData import os -FULLY_QUALIFIED_NAMESPACE = os.environ['EVENT_HUB_HOSTNAME'] -EVENTHUB_NAME = os.environ['EVENT_HUB_NAME'] +FULLY_QUALIFIED_NAMESPACE = os.environ["EVENT_HUB_HOSTNAME"] +EVENTHUB_NAME = os.environ["EVENT_HUB_NAME"] + +credential = os.environ["EVENTHUB_CONN_STR"] -credential = os.environ['EVENTHUB_CONN_STR'] def on_event(context, event): print(context.partition_id, ":", event) + with tracer.start_as_current_span(name="MyApplication"): producer_client = EventHubProducerClient.from_connection_string( conn_str=credential, fully_qualified_namespace=FULLY_QUALIFIED_NAMESPACE, eventhub_name=EVENTHUB_NAME, - logging_enable=True + logging_enable=True, ) with producer_client: event_data_batch = producer_client.create_batch() - event_data_batch.add(EventData('Single message')) + event_data_batch.add(EventData("Single message")) producer_client.send_batch(event_data_batch) diff --git a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_eh.py b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_eh.py index 8ace53558f24..7661bd819e9a 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_eh.py +++ b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_eh.py @@ -34,23 +34,23 @@ trace.set_tracer_provider(TracerProvider()) tracer = trace.get_tracer(__name__) -trace.get_tracer_provider().add_span_processor( - SimpleSpanProcessor(exporter) -) +trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(exporter)) from azure.eventhub import EventHubProducerClient, EventData, EventHubConsumerClient import os -FULLY_QUALIFIED_NAMESPACE = os.environ['EVENT_HUB_HOSTNAME'] -EVENTHUB_NAME = os.environ['EVENT_HUB_NAME'] +FULLY_QUALIFIED_NAMESPACE = os.environ["EVENT_HUB_HOSTNAME"] +EVENTHUB_NAME = os.environ["EVENT_HUB_NAME"] + +credential = os.environ["EVENTHUB_CONN_STR"] -credential = os.environ['EVENTHUB_CONN_STR'] def on_event(partition_context, event): # Put your code here. # If the operation is i/o intensive, multi-thread will have better performance. print("Received event from partition: {}.".format(partition_context.partition_id)) + def on_partition_initialize(partition_context): # Put your code here. print("Partition: {} has been initialized.".format(partition_context.partition_id)) @@ -58,26 +58,25 @@ def on_partition_initialize(partition_context): def on_partition_close(partition_context, reason): # Put your code here. - print("Partition: {} has been closed, reason for closing: {}.".format( - partition_context.partition_id, - reason - )) + print("Partition: {} has been closed, reason for closing: {}.".format(partition_context.partition_id, reason)) def on_error(partition_context, error): # Put your code here. partition_context can be None in the on_error callback. if partition_context: - print("An exception: {} occurred during receiving from Partition: {}.".format( - partition_context.partition_id, - error - )) + print( + "An exception: {} occurred during receiving from Partition: {}.".format( + partition_context.partition_id, error + ) + ) else: print("An exception: {} occurred during the load balance process.".format(error)) + with tracer.start_as_current_span(name="MyApplication"): consumer_client = EventHubConsumerClient.from_connection_string( conn_str=credential, - consumer_group='$Default', + consumer_group="$Default", eventhub_name=EVENTHUB_NAME, ) @@ -91,5 +90,4 @@ def on_error(partition_context, error): starting_position="-1", # "-1" is from the beginning of the partition. ) except KeyboardInterrupt: - print('Stopped receiving.') - + print("Stopped receiving.") diff --git a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_sb.py b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_sb.py index 5a7327235f93..79b0e988506d 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_sb.py +++ b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_receive_sb.py @@ -30,21 +30,19 @@ # Simple console exporter exporter = ConsoleSpanExporter() -span_processor = SimpleSpanProcessor( - exporter -) +span_processor = SimpleSpanProcessor(exporter) trace.get_tracer_provider().add_span_processor(span_processor) # Example with Servicebus SDKs from azure.servicebus import ServiceBusClient, ServiceBusMessage -connstr = os.environ['SERVICE_BUS_CONN_STR'] -queue_name = os.environ['SERVICE_BUS_QUEUE_NAME'] +connstr = os.environ["SERVICE_BUS_CONN_STR"] +queue_name = os.environ["SERVICE_BUS_QUEUE_NAME"] with tracer.start_as_current_span(name="MyApplication2"): with ServiceBusClient.from_connection_string(connstr) as client: with client.get_queue_sender(queue_name) as sender: - #Sending a single message + # Sending a single message single_message = ServiceBusMessage("Single message") sender.send_messages(single_message) # continually receives new messages until it doesn't receive any new messages for 5 (max_wait_time) seconds. diff --git a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_servicebus.py b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_servicebus.py index 558527a06aea..84a1bb50d6a5 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_servicebus.py +++ b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_servicebus.py @@ -34,17 +34,15 @@ trace.set_tracer_provider(TracerProvider()) tracer = trace.get_tracer(__name__) -trace.get_tracer_provider().add_span_processor( - SimpleSpanProcessor(exporter) -) +trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(exporter)) # Example with Servicebus SDKs from azure.servicebus import ServiceBusClient, ServiceBusMessage import os -connstr = os.environ['SERVICE_BUS_CONN_STR'] -queue_name = os.environ['SERVICE_BUS_QUEUE_NAME'] +connstr = os.environ["SERVICE_BUS_CONN_STR"] +queue_name = os.environ["SERVICE_BUS_QUEUE_NAME"] with tracer.start_as_current_span(name="MyApplication"): diff --git a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_storage.py b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_storage.py index 7cd50751b14a..39655accd674 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/samples/sample_storage.py +++ b/sdk/core/azure-core-tracing-opentelemetry/samples/sample_storage.py @@ -35,16 +35,14 @@ trace.set_tracer_provider(TracerProvider()) tracer = trace.get_tracer(__name__) -trace.get_tracer_provider().add_span_processor( - SimpleSpanProcessor(exporter) -) +trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(exporter)) # Example with Storage SDKs import os from azure.storage.blob import BlobServiceClient -connection_string = os.environ['AZURE_STORAGE_CONNECTION_STRING'] -container_name = os.environ['AZURE_STORAGE_BLOB_CONTAINER_NAME'] +connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] +container_name = os.environ["AZURE_STORAGE_BLOB_CONTAINER_NAME"] with tracer.start_as_current_span(name="MyApplication"): client = BlobServiceClient.from_connection_string(connection_string) diff --git a/sdk/core/azure-core-tracing-opentelemetry/setup.py b/sdk/core/azure-core-tracing-opentelemetry/setup.py index 003aa6d5badf..8293cebe9faa 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/setup.py +++ b/sdk/core/azure-core-tracing-opentelemetry/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -18,51 +18,50 @@ package_folder_path = "azure/core/tracing/ext/opentelemetry_span" # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', # type: ignore - fd.read(), re.MULTILINE).group(1) +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) # type: ignore if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-tracing-opentelemetry', + description="Microsoft Azure {} Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-tracing-opentelemetry", classifiers=[ "Development Status :: 4 - Beta", - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'License :: OSI Approved :: MIT License', + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "License :: OSI Approved :: MIT License", ], zip_safe=False, packages=[ - 'azure.core.tracing.ext.opentelemetry_span', + "azure.core.tracing.ext.opentelemetry_span", ], include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, python_requires=">=3.6", install_requires=[ - 'opentelemetry-api<2.0.0,>=1.0.0', - 'azure-core<2.0.0,>=1.13.0', + "opentelemetry-api<2.0.0,>=1.0.0", + "azure-core<2.0.0,>=1.13.0", ], ) diff --git a/sdk/core/azure-core-tracing-opentelemetry/tests/test_threading.py b/sdk/core/azure-core-tracing-opentelemetry/tests/test_threading.py index ffdea46be91f..19b6c561a872 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/tests/test_threading.py +++ b/sdk/core/azure-core-tracing-opentelemetry/tests/test_threading.py @@ -10,16 +10,14 @@ def test_get_span_from_thread(tracer): result = [] + def get_span_from_thread(output): current_span = OpenTelemetrySpan.get_current_span() output.append(current_span) with tracer.start_as_current_span(name="TestSpan") as span: - thread = threading.Thread( - target=OpenTelemetrySpan.with_current_context(get_span_from_thread), - args=(result,) - ) + thread = threading.Thread(target=OpenTelemetrySpan.with_current_context(get_span_from_thread), args=(result,)) thread.start() thread.join() diff --git a/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py b/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py index 769207087099..df6cf33bb7d7 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py +++ b/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py @@ -41,7 +41,6 @@ def test_no_span_passed_in_with_no_environ(self, tracer): assert parent is trace.get_current_span() - def test_span(self, tracer): with tracer.start_as_current_span("Root") as parent: with OpenTelemetrySpan() as wrapped_span: @@ -188,4 +187,4 @@ def test_span_kind(self, tracer): assert wrapped_class.kind == SpanKind.INTERNAL with pytest.raises(ValueError): - wrapped_class.kind = "somethingstuid" \ No newline at end of file + wrapped_class.kind = "somethingstuid" diff --git a/sdk/core/azure-core/azure/core/_enum_meta.py b/sdk/core/azure-core/azure/core/_enum_meta.py index 3015ce3faf24..1d821573115a 100644 --- a/sdk/core/azure-core/azure/core/_enum_meta.py +++ b/sdk/core/azure-core/azure/core/_enum_meta.py @@ -45,9 +45,7 @@ class MyCustomEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): def __getitem__(cls, name: str) -> Any: # disabling pylint bc of pylint bug https://github.com/PyCQA/astroid/issues/713 - return super( # pylint: disable=no-value-for-parameter - CaseInsensitiveEnumMeta, cls - ).__getitem__(name.upper()) + return super(CaseInsensitiveEnumMeta, cls).__getitem__(name.upper()) # pylint: disable=no-value-for-parameter def __getattr__(cls, name: str) -> Enum: """Return the enum member matching `name` diff --git a/sdk/core/azure-core/azure/core/_pipeline_client.py b/sdk/core/azure-core/azure/core/_pipeline_client.py index 6460eb0a04f4..c3773924f873 100644 --- a/sdk/core/azure-core/azure/core/_pipeline_client.py +++ b/sdk/core/azure-core/azure/core/_pipeline_client.py @@ -152,8 +152,7 @@ def _build_pipeline(self, config, **kwargs): # pylint: disable=no-self-use index_of_retry = index if index_of_retry == -1: raise ValueError( - "Failed to add per_retry_policies; " - "no RetryPolicy found in the supplied list of policies. " + "Failed to add per_retry_policies; no RetryPolicy found in the supplied list of policies. " ) policies_1 = policies[: index_of_retry + 1] policies_2 = policies[index_of_retry + 1 :] @@ -185,9 +184,7 @@ def send_request(self, request: "HTTPRequestType", **kwargs) -> "HTTPResponseTyp """ stream = kwargs.pop("stream", False) # want to add default value return_pipeline_response = kwargs.pop("_return_pipeline_response", False) - pipeline_response = self._pipeline.run( - request, stream=stream, **kwargs - ) # pylint: disable=protected-access + pipeline_response = self._pipeline.run(request, stream=stream, **kwargs) # pylint: disable=protected-access if return_pipeline_response: return pipeline_response return pipeline_response.http_response diff --git a/sdk/core/azure-core/azure/core/_pipeline_client_async.py b/sdk/core/azure-core/azure/core/_pipeline_client_async.py index 8207e4d4216d..7008f8fa119e 100644 --- a/sdk/core/azure-core/azure/core/_pipeline_client_async.py +++ b/sdk/core/azure-core/azure/core/_pipeline_client_async.py @@ -58,9 +58,7 @@ async def close(self): HTTPRequestType = TypeVar("HTTPRequestType") -AsyncHTTPResponseType = TypeVar( - "AsyncHTTPResponseType", bound="_AsyncContextManagerCloseable" -) +AsyncHTTPResponseType = TypeVar("AsyncHTTPResponseType", bound="_AsyncContextManagerCloseable") _LOGGER = logging.getLogger(__name__) @@ -126,9 +124,7 @@ async def close(self) -> None: await self._response.close() -class AsyncPipelineClient( - PipelineClientBase, AsyncContextManager["AsyncPipelineClient"] -): +class AsyncPipelineClient(PipelineClientBase, AsyncContextManager["AsyncPipelineClient"]): """Service client core methods. Builds an AsyncPipeline client. @@ -233,8 +229,7 @@ def _build_pipeline(self, config, **kwargs): # pylint: disable=no-self-use index_of_retry = index if index_of_retry == -1: raise ValueError( - "Failed to add per_retry_policies; " - "no RetryPolicy found in the supplied list of policies. " + "Failed to add per_retry_policies; no RetryPolicy found in the supplied list of policies. " ) policies_1 = policies[: index_of_retry + 1] policies_2 = policies[index_of_retry + 1 :] @@ -251,9 +246,7 @@ def _build_pipeline(self, config, **kwargs): # pylint: disable=no-self-use async def _make_pipeline_call(self, request, **kwargs): return_pipeline_response = kwargs.pop("_return_pipeline_response", False) - pipeline_response = await self._pipeline.run( - request, **kwargs # pylint: disable=protected-access - ) + pipeline_response = await self._pipeline.run(request, **kwargs) # pylint: disable=protected-access if return_pipeline_response: return pipeline_response return pipeline_response.http_response diff --git a/sdk/core/azure-core/azure/core/async_paging.py b/sdk/core/azure-core/azure/core/async_paging.py index 62f7eda3ae6f..3b3ef9d54131 100644 --- a/sdk/core/azure-core/azure/core/async_paging.py +++ b/sdk/core/azure-core/azure/core/async_paging.py @@ -70,9 +70,7 @@ class AsyncPageIterator(AsyncIterator[AsyncIterator[ReturnType]]): def __init__( self, get_next: Callable[[Optional[str]], Awaitable[ResponseType]], - extract_data: Callable[ - [ResponseType], Awaitable[Tuple[str, AsyncIterator[ReturnType]]] - ], + extract_data: Callable[[ResponseType], Awaitable[Tuple[str, AsyncIterator[ReturnType]]]], continuation_token: Optional[str] = None, ) -> None: """Return an async iterator of pages. @@ -101,9 +99,7 @@ async def __anext__(self) -> AsyncIterator[ReturnType]: self._did_a_call_already = True - self.continuation_token, self._current_page = await self._extract_data( - self._response - ) + self.continuation_token, self._current_page = await self._extract_data(self._response) # If current_page was a sync list, wrap it async-like if isinstance(self._current_page, collections.abc.Iterable): @@ -123,9 +119,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self._kwargs = kwargs self._page_iterator: Optional[AsyncIterator[AsyncIterator[ReturnType]]] = None self._page: Optional[AsyncIterator[ReturnType]] = None - self._page_iterator_class = self._kwargs.pop( - "page_iterator_class", AsyncPageIterator - ) + self._page_iterator_class = self._kwargs.pop("page_iterator_class", AsyncPageIterator) def by_page( self, @@ -139,9 +133,7 @@ def by_page( this generator will begin returning results from this point. :returns: An async iterator of pages (themselves async iterator of objects) """ - return self._page_iterator_class( - *self._args, **self._kwargs, continuation_token=continuation_token - ) + return self._page_iterator_class(*self._args, **self._kwargs, continuation_token=continuation_token) async def __anext__(self) -> ReturnType: if self._page_iterator is None: diff --git a/sdk/core/azure-core/azure/core/credentials.py b/sdk/core/azure-core/azure/core/credentials.py index dbf09d7d2e8f..cb06e7d4cdf8 100644 --- a/sdk/core/azure-core/azure/core/credentials.py +++ b/sdk/core/azure-core/azure/core/credentials.py @@ -24,11 +24,7 @@ class TokenCredential(Protocol): """Protocol for classes able to provide OAuth tokens.""" def get_token( - self, - *scopes: str, - claims: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any + self, *scopes: str, claims: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any ) -> AccessToken: """Request an access token for `scopes`. diff --git a/sdk/core/azure-core/azure/core/credentials_async.py b/sdk/core/azure-core/azure/core/credentials_async.py index 378dd91d8b28..0c02cc37281f 100644 --- a/sdk/core/azure-core/azure/core/credentials_async.py +++ b/sdk/core/azure-core/azure/core/credentials_async.py @@ -12,11 +12,7 @@ class AsyncTokenCredential(Protocol): """Protocol for classes able to provide OAuth tokens.""" async def get_token( - self, - *scopes: str, - claims: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any + self, *scopes: str, claims: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any ) -> _AccessToken: """Request an access token for `scopes`. diff --git a/sdk/core/azure-core/azure/core/exceptions.py b/sdk/core/azure-core/azure/core/exceptions.py index 177c6070ab4c..8c702a7580dc 100644 --- a/sdk/core/azure-core/azure/core/exceptions.py +++ b/sdk/core/azure-core/azure/core/exceptions.py @@ -164,10 +164,7 @@ def __init__(self, json_object: Dict[str, Any]): self.message: Optional[str] = json_object.get(cls.MESSAGE_LABEL) if not (self.code or self.message): - raise ValueError( - "Impossible to extract code/message from received JSON:\n" - + json.dumps(json_object) - ) + raise ValueError("Impossible to extract code/message from received JSON:\n" + json.dumps(json_object)) # Optional fields self.target: Optional[str] = json_object.get(cls.TARGET_LABEL) @@ -209,9 +206,7 @@ def message_details(self) -> str: error_str += "\n".join("\t" + s for s in str(error_obj).splitlines()) if self.innererror: - error_str += "\nInner error: {}".format( - json.dumps(self.innererror, indent=4) - ) + error_str += "\nInner error: {}".format(json.dumps(self.innererror, indent=4)) return error_str @@ -236,9 +231,7 @@ class AzureError(Exception): def __init__(self, message, *args, **kwargs): self.inner_exception = kwargs.get("error") self.exc_type, self.exc_value, self.exc_traceback = sys.exc_info() - self.exc_type = ( - self.exc_type.__name__ if self.exc_type else type(self.inner_exception) - ) + self.exc_type = self.exc_type.__name__ if self.exc_type else type(self.inner_exception) self.exc_msg = "{}, {}: {}".format(message, self.exc_type, self.exc_value) self.message = str(message) self.continuation_token = kwargs.get("continuation_token") @@ -310,9 +303,7 @@ def __init__(self, message=None, response=None, **kwargs): self.model = model else: # autorest azure-core, for KV 1.0, Storage 12.0, etc. self.model: Optional[Any] = getattr(self, "error", None) - self.error: Optional[ODataV4Format] = self._parse_odata_body( - error_format, response - ) + self.error: Optional[ODataV4Format] = self._parse_odata_body(error_format, response) # By priority, message is: # - odatav4 message, OR @@ -321,16 +312,12 @@ def __init__(self, message=None, response=None, **kwargs): if self.error: message = str(self.error) else: - message = message or "Operation returned an invalid status '{}'".format( - self.reason - ) + message = message or "Operation returned an invalid status '{}'".format(self.reason) super(HttpResponseError, self).__init__(message=message, **kwargs) @staticmethod - def _parse_odata_body( - error_format: Type[ODataV4Format], response: "_HttpResponseBase" - ) -> Optional[ODataV4Format]: + def _parse_odata_body(error_format: Type[ODataV4Format], response: "_HttpResponseBase") -> Optional[ODataV4Format]: try: odata_json = json.loads(response.text()) return error_format(odata_json) @@ -436,18 +423,10 @@ def __init__(self, response: "_HttpResponseBase", **kwargs) -> None: try: error_node = self.odata_json["error"] self._error_format = self._ERROR_FORMAT(error_node) - self.__dict__.update( - { - k: v - for k, v in self._error_format.__dict__.items() - if v is not None - } - ) + self.__dict__.update({k: v for k, v in self._error_format.__dict__.items() if v is not None}) except Exception: # pylint: disable=broad-except _LOGGER.info("Received error message was not valid OdataV4 format.") - self._error_format = "JSON was invalid for format " + str( - self._ERROR_FORMAT - ) + self._error_format = "JSON was invalid for format " + str(self._ERROR_FORMAT) def __str__(self): if self._error_format: @@ -465,9 +444,7 @@ class StreamConsumedError(AzureError): def __init__(self, response): message = ( "You are attempting to read or stream the content from request {}. " - "You have likely already consumed this stream, so it can not be accessed anymore.".format( - response.request - ) + "You have likely already consumed this stream, so it can not be accessed anymore.".format(response.request) ) super(StreamConsumedError, self).__init__(message) diff --git a/sdk/core/azure-core/azure/core/messaging.py b/sdk/core/azure-core/azure/core/messaging.py index 5140558335e7..414447dff11f 100644 --- a/sdk/core/azure-core/azure/core/messaging.py +++ b/sdk/core/azure-core/azure/core/messaging.py @@ -124,9 +124,7 @@ def __init__( if self.extensions: for key in self.extensions.keys(): if not key.islower() or not key.isalnum(): - raise ValueError( - "Extension attributes should be lower cased and alphanumeric." - ) + raise ValueError("Extension attributes should be lower cased and alphanumeric.") if kwargs: remaining = ", ".join(kwargs.keys()) @@ -163,17 +161,13 @@ def from_dict(cls, event: Dict[str, Any]) -> "CloudEvent": ] if "data" in event and "data_base64" in event: - raise ValueError( - "Invalid input. Only one of data and data_base64 must be present." - ) + raise ValueError("Invalid input. Only one of data and data_base64 must be present.") if "data" in event: data = event.get("data") kwargs["data"] = data if data is not None else NULL elif "data_base64" in event: - kwargs["data"] = b64decode( - cast(Union[str, bytes], event.get("data_base64")) - ) + kwargs["data"] = b64decode(cast(Union[str, bytes], event.get("data_base64"))) for item in ["datacontenttype", "dataschema", "subject"]: if item in event: diff --git a/sdk/core/azure-core/azure/core/paging.py b/sdk/core/azure-core/azure/core/paging.py index f0ee547039a3..beed33671674 100644 --- a/sdk/core/azure-core/azure/core/paging.py +++ b/sdk/core/azure-core/azure/core/paging.py @@ -98,13 +98,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self._args = args self._kwargs = kwargs self._page_iterator: Optional[Iterator[ReturnType]] = None - self._page_iterator_class = self._kwargs.pop( - "page_iterator_class", PageIterator - ) + self._page_iterator_class = self._kwargs.pop("page_iterator_class", PageIterator) - def by_page( - self, continuation_token: Optional[str] = None - ) -> Iterator[Iterator[ReturnType]]: + def by_page(self, continuation_token: Optional[str] = None) -> Iterator[Iterator[ReturnType]]: """Get an iterator of pages of objects, instead of an iterator of objects. :param str continuation_token: @@ -113,14 +109,10 @@ def by_page( this generator will begin returning results from this point. :returns: An iterator of pages (themselves iterator of objects) """ - return self._page_iterator_class( - continuation_token=continuation_token, *self._args, **self._kwargs - ) + return self._page_iterator_class(continuation_token=continuation_token, *self._args, **self._kwargs) def __repr__(self) -> str: - return "".format( - hex(id(self)) - ) + return "".format(hex(id(self))) def __iter__(self) -> Iterator[ReturnType]: """Return 'self'.""" diff --git a/sdk/core/azure-core/azure/core/pipeline/_base.py b/sdk/core/azure-core/azure/core/pipeline/_base.py index ecb62e9677ed..483d3047dccf 100644 --- a/sdk/core/azure-core/azure/core/pipeline/_base.py +++ b/sdk/core/azure-core/azure/core/pipeline/_base.py @@ -121,9 +121,7 @@ class Pipeline(AbstractContextManager, Generic[HTTPRequestType, HTTPResponseType :caption: Builds the pipeline for synchronous transport. """ - def __init__( - self, transport: HttpTransportType, policies: Optional[PoliciesType] = None - ) -> None: + def __init__(self, transport: HttpTransportType, policies: Optional[PoliciesType] = None) -> None: self._impl_policies: List[HTTPPolicy] = [] self._transport = transport @@ -194,12 +192,6 @@ def run(self, request: HTTPRequestType, **kwargs: Any) -> PipelineResponse: """ self._prepare_multipart(request) context = PipelineContext(self._transport, **kwargs) - pipeline_request: PipelineRequest[HTTPRequestType] = PipelineRequest( - request, context - ) - first_node = ( - self._impl_policies[0] - if self._impl_policies - else _TransportRunner(self._transport) - ) + pipeline_request: PipelineRequest[HTTPRequestType] = PipelineRequest(request, context) + first_node = self._impl_policies[0] if self._impl_policies else _TransportRunner(self._transport) return first_node.send(pipeline_request) # type: ignore diff --git a/sdk/core/azure-core/azure/core/pipeline/_base_async.py b/sdk/core/azure-core/azure/core/pipeline/_base_async.py index 7cbd458da942..6584ec82a875 100644 --- a/sdk/core/azure-core/azure/core/pipeline/_base_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/_base_async.py @@ -33,9 +33,7 @@ AsyncHTTPResponseType = TypeVar("AsyncHTTPResponseType") HTTPRequestType = TypeVar("HTTPRequestType") ImplPoliciesType = List[ - AsyncHTTPPolicy[ # pylint: disable=unsubscriptable-object - HTTPRequestType, AsyncHTTPResponseType - ] + AsyncHTTPPolicy[HTTPRequestType, AsyncHTTPResponseType] # pylint: disable=unsubscriptable-object ] AsyncPoliciesType = List[Union[AsyncHTTPPolicy, SansIOHTTPPolicy]] @@ -103,9 +101,7 @@ async def send(self, request): ) -class AsyncPipeline( - AbstractAsyncContextManager, Generic[HTTPRequestType, AsyncHTTPResponseType] -): +class AsyncPipeline(AbstractAsyncContextManager, Generic[HTTPRequestType, AsyncHTTPResponseType]): """Async pipeline implementation. This is implemented as a context manager, that will activate the context @@ -192,9 +188,5 @@ async def run(self, request: HTTPRequestType, **kwargs: Any): await self._prepare_multipart(request) context = PipelineContext(self._transport, **kwargs) pipeline_request = PipelineRequest(request, context) - first_node = ( - self._impl_policies[0] - if self._impl_policies - else _AsyncTransportRunner(self._transport) - ) + first_node = self._impl_policies[0] if self._impl_policies else _AsyncTransportRunner(self._transport) return await first_node.send(pipeline_request) diff --git a/sdk/core/azure-core/azure/core/pipeline/_tools.py b/sdk/core/azure-core/azure/core/pipeline/_tools.py index c19460f73a2c..a51cf2407e2d 100644 --- a/sdk/core/azure-core/azure/core/pipeline/_tools.py +++ b/sdk/core/azure-core/azure/core/pipeline/_tools.py @@ -34,9 +34,7 @@ def await_result(func, *args, **kwargs): """If func returns an awaitable, raise that this runner can't handle it.""" result = func(*args, **kwargs) if hasattr(result, "__await__"): - raise TypeError( - "Policy {} returned awaitable object in non-async pipeline.".format(func) - ) + raise TypeError("Policy {} returned awaitable object in non-async pipeline.".format(func)) return result diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_authentication.py b/sdk/core/azure-core/azure/core/pipeline/policies/_authentication.py index 2a70d753f33b..e1296189f845 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_authentication.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_authentication.py @@ -29,12 +29,7 @@ class _BearerTokenCredentialPolicyBase: :param str scopes: Lets you specify the type of access needed. """ - def __init__( - self, - credential: "TokenCredential", - *scopes: str, - **kwargs # pylint:disable=unused-argument - ) -> None: + def __init__(self, credential: "TokenCredential", *scopes: str, **kwargs) -> None: # pylint:disable=unused-argument super(_BearerTokenCredentialPolicyBase, self).__init__() self._scopes = scopes self._credential = credential @@ -92,9 +87,7 @@ def on_request(self, request: "PipelineRequest") -> None: self._token = self._credential.get_token(*self._scopes) self._update_headers(request.http_request.headers, self._token.token) - def authorize_request( - self, request: "PipelineRequest", *scopes: str, **kwargs - ) -> None: + def authorize_request(self, request: "PipelineRequest", *scopes: str, **kwargs) -> None: """Acquire a token from the credential and authorize the request with it. Keyword arguments are passed to the credential's get_token method. The token will be cached and used to @@ -134,9 +127,7 @@ def send(self, request: "PipelineRequest") -> "PipelineResponse": return response - def on_challenge( - self, request: "PipelineRequest", response: "PipelineResponse" - ) -> bool: + def on_challenge(self, request: "PipelineRequest", response: "PipelineResponse") -> bool: """Authorize request according to an authentication challenge This method is called when the resource provider responds 401 with a WWW-Authenticate header. @@ -148,9 +139,7 @@ def on_challenge( # pylint:disable=unused-argument,no-self-use return False - def on_response( - self, request: "PipelineRequest", response: "PipelineResponse" - ) -> None: + def on_response(self, request: "PipelineRequest", response: "PipelineResponse") -> None: """Executed after the request comes back from the next policy. :param request: Request to be modified after returning from the policy. @@ -181,10 +170,7 @@ class AzureKeyCredentialPolicy(SansIOHTTPPolicy): """ def __init__( - self, - credential: "AzureKeyCredential", - name: str, - **kwargs # pylint: disable=unused-argument + self, credential: "AzureKeyCredential", name: str, **kwargs # pylint: disable=unused-argument ) -> None: super(AzureKeyCredentialPolicy, self).__init__() self._credential = credential @@ -206,11 +192,7 @@ class AzureSasCredentialPolicy(SansIOHTTPPolicy): :raises: ValueError or TypeError """ - def __init__( - self, - credential: "AzureSasCredential", - **kwargs # pylint: disable=unused-argument - ) -> None: + def __init__(self, credential: "AzureSasCredential", **kwargs) -> None: # pylint: disable=unused-argument super(AzureSasCredentialPolicy, self).__init__() if not credential: raise ValueError("credential can not be None") diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py b/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py index 9bd4730e569b..4460b553024c 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py @@ -28,9 +28,7 @@ class AsyncBearerTokenCredentialPolicy(AsyncHTTPPolicy): :param str scopes: Lets you specify the type of access needed. """ - def __init__( - self, credential: "AsyncTokenCredential", *scopes: str, **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", *scopes: str, **kwargs: Any) -> None: # pylint:disable=unused-argument super().__init__() self._credential = credential @@ -38,18 +36,14 @@ def __init__( self._scopes = scopes self._token: Optional["AccessToken"] = None - async def on_request( - self, request: "PipelineRequest" - ) -> None: # pylint:disable=invalid-overridden-method + async def on_request(self, request: "PipelineRequest") -> None: # pylint:disable=invalid-overridden-method """Adds a bearer token Authorization header to request and sends request to next policy. :param request: The pipeline request object to be modified. :type request: ~azure.core.pipeline.PipelineRequest :raises: :class:`~azure.core.exceptions.ServiceRequestError` """ - _BearerTokenCredentialPolicyBase._enforce_https( # pylint:disable=protected-access - request - ) + _BearerTokenCredentialPolicyBase._enforce_https(request) # pylint:disable=protected-access if self._token is None or self._need_new_token(): async with self._lock: @@ -58,9 +52,7 @@ async def on_request( self._token = await self._credential.get_token(*self._scopes) request.http_request.headers["Authorization"] = "Bearer " + self._token.token - async def authorize_request( - self, request: "PipelineRequest", *scopes: str, **kwargs: Any - ) -> None: + async def authorize_request(self, request: "PipelineRequest", *scopes: str, **kwargs: Any) -> None: """Acquire a token from the credential and authorize the request with it. Keyword arguments are passed to the credential's get_token method. The token will be cached and used to @@ -103,9 +95,7 @@ async def send(self, request: "PipelineRequest") -> "PipelineResponse": return response - async def on_challenge( - self, request: "PipelineRequest", response: "PipelineResponse" - ) -> bool: + async def on_challenge(self, request: "PipelineRequest", response: "PipelineResponse") -> bool: """Authorize request according to an authentication challenge This method is called when the resource provider responds 401 with a WWW-Authenticate header. @@ -117,9 +107,7 @@ async def on_challenge( # pylint:disable=unused-argument,no-self-use return False - def on_response( - self, request: "PipelineRequest", response: "PipelineResponse" - ) -> Optional[Awaitable[None]]: + def on_response(self, request: "PipelineRequest", response: "PipelineResponse") -> Optional[Awaitable[None]]: """Executed after the request comes back from the next policy. :param request: Request to be modified after returning from the policy. diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_base.py b/sdk/core/azure-core/azure/core/pipeline/policies/_base.py index 8ed9fbb17ebd..078feda760d6 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_base.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_base.py @@ -94,9 +94,7 @@ class SansIOHTTPPolicy(Generic[HTTPRequestTypeVar, HTTPResponseTypeVar]): but they will then be tied to AsyncPipeline usage. """ - def on_request( - self, request: PipelineRequest[HTTPRequestTypeVar] - ) -> Union[None, Awaitable[None]]: + def on_request(self, request: PipelineRequest[HTTPRequestTypeVar]) -> Union[None, Awaitable[None]]: """Is executed before sending the request from next policy. :param request: Request to be modified before sent from next policy. diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_custom_hook.py b/sdk/core/azure-core/azure/core/pipeline/policies/_custom_hook.py index c8c34eb16ef4..db4c41c6706e 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_custom_hook.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_custom_hook.py @@ -35,15 +35,11 @@ class CustomHookPolicy(SansIOHTTPPolicy): :keyword callback raw_response_hook: Callback function. Will be invoked on response. """ - def __init__( - self, **kwargs - ): # pylint: disable=unused-argument,super-init-not-called + def __init__(self, **kwargs): # pylint: disable=unused-argument,super-init-not-called self._request_callback = kwargs.get("raw_request_hook") self._response_callback = kwargs.get("raw_response_hook") - def on_request( - self, request: PipelineRequest - ) -> None: # pylint: disable=arguments-differ + def on_request(self, request: PipelineRequest) -> None: # pylint: disable=arguments-differ """This is executed before sending the request to the next policy. :param request: The PipelineRequest object. diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py b/sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py index 05f31620ffd0..5a81a8473e6d 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py @@ -81,9 +81,7 @@ class DistributedTracingPolicy(SansIOHTTPPolicy): _RESPONSE_ID = "x-ms-request-id" def __init__(self, **kwargs): - self._network_span_namer = kwargs.get( - "network_span_namer", _default_network_span_namer - ) + self._network_span_namer = kwargs.get("network_span_namer", _default_network_span_namer) self._tracing_attributes = kwargs.get("tracing_attributes", {}) def on_request(self, request: "PipelineRequest") -> None: @@ -126,17 +124,13 @@ def end_span( if request_id is not None: span.add_attribute(self._REQUEST_ID, request_id) if response and self._RESPONSE_ID in response.headers: - span.add_attribute( - self._RESPONSE_ID, response.headers[self._RESPONSE_ID] - ) + span.add_attribute(self._RESPONSE_ID, response.headers[self._RESPONSE_ID]) if exc_info: span.__exit__(*exc_info) else: span.finish() - def on_response( - self, request: "PipelineRequest", response: "PipelineResponse" - ) -> None: + def on_response(self, request: "PipelineRequest", response: "PipelineResponse") -> None: self.end_span(request, response=response.http_response) def on_exception(self, request: "PipelineRequest") -> None: diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_redirect.py b/sdk/core/azure-core/azure/core/pipeline/policies/_redirect.py index 823216343d07..d08a5395a1f5 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_redirect.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_redirect.py @@ -48,9 +48,7 @@ def __init__(self, **kwargs): self.max_redirects = kwargs.get("redirect_max", 30) remove_headers = set(kwargs.get("redirect_remove_headers", [])) - self._remove_headers_on_redirect = remove_headers.union( - self.REDIRECT_HEADERS_BLACKLIST - ) + self._remove_headers_on_redirect = remove_headers.union(self.REDIRECT_HEADERS_BLACKLIST) redirect_status = set(kwargs.get("redirect_on_status_codes", [])) self._redirect_on_status_codes = redirect_status.union(self.REDIRECT_STATUSES) super(RedirectPolicyBase, self).__init__() @@ -107,9 +105,7 @@ def increment(self, settings, response, redirect_location): """ # TODO: Revise some of the logic here. settings["redirects"] -= 1 - settings["history"].append( - RequestHistory(response.http_request, http_response=response.http_response) - ) + settings["history"].append(RequestHistory(response.http_request, http_response=response.http_response)) redirected = urlparse(redirect_location) if not redirected.netloc: @@ -160,9 +156,7 @@ def send(self, request): response = self.next.send(request) redirect_location = self.get_redirect_location(response) if redirect_location and redirect_settings["allow"]: - retryable = self.increment( - redirect_settings, response, redirect_location - ) + retryable = self.increment(redirect_settings, response, redirect_location) request.http_request = response.http_request continue return response diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_redirect_async.py b/sdk/core/azure-core/azure/core/pipeline/policies/_redirect_async.py index bd8536daa725..bd7738042a5c 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_redirect_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_redirect_async.py @@ -62,9 +62,7 @@ async def send(self, request): # pylint:disable=invalid-overridden-method response = await self.next.send(request) redirect_location = self.get_redirect_location(response) if redirect_location and redirect_settings["allow"]: - redirects_remaining = self.increment( - redirect_settings, response, redirect_location - ) + redirects_remaining = self.increment(redirect_settings, response, redirect_location) request.http_request = response.http_request continue return response diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py b/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py index 22e9d291f23e..b63dce649bd8 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py @@ -74,9 +74,7 @@ def __init__(self, **kwargs): retry_codes = self._RETRY_CODES status_codes = kwargs.pop("retry_on_status_codes", []) self._retry_on_status_codes = set(status_codes) | retry_codes - self._method_whitelist = frozenset( - ["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"] - ) + self._method_whitelist = frozenset(["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"]) self._respect_retry_after_header = True super(RetryPolicyBase, self).__init__() @@ -164,11 +162,7 @@ def _is_method_retryable(self, settings, request, response=None): :return: True if method should be retried upon. False if not in method allowlist. :rtype: bool """ - if ( - response - and request.method.upper() in ["POST", "PATCH"] - and response.status_code in [500, 503, 504] - ): + if response and request.method.upper() in ["POST", "PATCH"] and response.status_code in [500, 503, 504]: return True if request.method.upper() not in settings["methods"]: return False @@ -201,14 +195,9 @@ def is_retry(self, settings, response): has_retry_after = bool(response.http_response.headers.get("Retry-After")) if has_retry_after and self._respect_retry_after_header: return True - if not self._is_method_retryable( - settings, response.http_request, response=response.http_response - ): + if not self._is_method_retryable(settings, response.http_request, response=response.http_response): return False - return ( - settings["total"] - and response.http_response.status_code in self._retry_on_status_codes - ) + return settings["total"] and response.http_response.status_code in self._retry_on_status_codes def is_exhausted(self, settings): """Checks if any retries left. @@ -243,39 +232,28 @@ def increment(self, settings, response=None, error=None): """ settings["total"] -= 1 - if ( - isinstance(response, PipelineResponse) - and response.http_response.status_code == 202 - ): + if isinstance(response, PipelineResponse) and response.http_response.status_code == 202: return False if error and self._is_connection_error(error): # Connect retry? settings["connect"] -= 1 - settings["history"].append( - RequestHistory(response.http_request, error=error) - ) + settings["history"].append(RequestHistory(response.http_request, error=error)) elif error and self._is_read_error(error): # Read retry? settings["read"] -= 1 if hasattr(response, "http_request"): - settings["history"].append( - RequestHistory(response.http_request, error=error) - ) + settings["history"].append(RequestHistory(response.http_request, error=error)) else: # Incrementing because of a server error like a 500 in # status_forcelist and a the given method is in the allowlist if response: settings["status"] -= 1 - if hasattr(response, "http_request") and hasattr( - response, "http_response" - ): + if hasattr(response, "http_request") and hasattr(response, "http_response"): settings["history"].append( - RequestHistory( - response.http_request, http_response=response.http_response - ) + RequestHistory(response.http_request, http_response=response.http_response) ) if self.is_exhausted(settings): @@ -323,16 +301,12 @@ def _configure_timeout(self, request, absolute_timeout, is_response_error): # if connection_timeout is already set, ensure it doesn't exceed absolute_timeout connection_timeout = request.context.options.get("connection_timeout") if connection_timeout: - request.context.options["connection_timeout"] = min( - connection_timeout, absolute_timeout - ) + request.context.options["connection_timeout"] = min(connection_timeout, absolute_timeout) # otherwise, try to ensure the transport's configured connection_timeout doesn't exceed absolute_timeout # ("connection_config" isn't defined on Async/HttpTransport but all implementations in this library have it) elif hasattr(request.context.transport, "connection_config"): - default_timeout = getattr( - request.context.transport.connection_config, "timeout", absolute_timeout - ) + default_timeout = getattr(request.context.transport.connection_config, "timeout", absolute_timeout) try: if absolute_timeout < default_timeout: request.context.options["connection_timeout"] = absolute_timeout @@ -475,9 +449,7 @@ def send(self, request): if self.is_retry(retry_settings, response): retry_active = self.increment(retry_settings, response=response) if retry_active: - self.sleep( - retry_settings, request.context.transport, response=response - ) + self.sleep(retry_settings, request.context.transport, response=response) is_response_error = True continue break @@ -486,12 +458,8 @@ def send(self, request): # succeed--we'll never have a response to it, so propagate the exception raise except AzureError as err: - if absolute_timeout > 0 and self._is_method_retryable( - retry_settings, request.http_request - ): - retry_active = self.increment( - retry_settings, response=request, error=err - ) + if absolute_timeout > 0 and self._is_method_retryable(retry_settings, request.http_request): + retry_active = self.increment(retry_settings, response=request, error=err) if retry_active: self.sleep(retry_settings, request.context.transport) if isinstance(err, ServiceRequestError): diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_retry_async.py b/sdk/core/azure-core/azure/core/pipeline/policies/_retry_async.py index d9df848f6d0d..38a57bb7056e 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_retry_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_retry_async.py @@ -75,9 +75,7 @@ class AsyncRetryPolicy(RetryPolicyBase, AsyncHTTPPolicy): :caption: Configuring an async retry policy. """ - async def _sleep_for_retry( - self, response, transport - ): # pylint:disable=invalid-overridden-method + async def _sleep_for_retry(self, response, transport): # pylint:disable=invalid-overridden-method """Sleep based on the Retry-After response header value. :param response: The PipelineResponse object. @@ -90,9 +88,7 @@ async def _sleep_for_retry( return True return False - async def _sleep_backoff( - self, settings, transport - ): # pylint:disable=invalid-overridden-method + async def _sleep_backoff(self, settings, transport): # pylint:disable=invalid-overridden-method """Sleep using exponential backoff. Immediately returns if backoff is 0. :param dict settings: The retry settings. @@ -103,9 +99,7 @@ async def _sleep_backoff( return await transport.sleep(backoff) - async def sleep( - self, settings, transport, response=None - ): # pylint:disable=invalid-overridden-method + async def sleep(self, settings, transport, response=None): # pylint:disable=invalid-overridden-method """Sleep between retry attempts. This method will respect a server's ``Retry-After`` response header @@ -150,9 +144,7 @@ async def send(self, request): # pylint:disable=invalid-overridden-method if self.is_retry(retry_settings, response): retry_active = self.increment(retry_settings, response=response) if retry_active: - await self.sleep( - retry_settings, request.context.transport, response=response - ) + await self.sleep(retry_settings, request.context.transport, response=response) is_response_error = True continue break @@ -161,12 +153,8 @@ async def send(self, request): # pylint:disable=invalid-overridden-method # succeed--we'll never have a response to it, so propagate the exception raise except AzureError as err: - if absolute_timeout > 0 and self._is_method_retryable( - retry_settings, request.http_request - ): - retry_active = self.increment( - retry_settings, response=request, error=err - ) + if absolute_timeout > 0 and self._is_method_retryable(retry_settings, request.http_request): + retry_active = self.increment(retry_settings, response=request, error=err) if retry_active: await self.sleep(retry_settings, request.context.transport) if isinstance(err, ServiceRequestError): diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py b/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py index fea1da1c7d77..9751be46de7c 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py @@ -234,9 +234,7 @@ def __init__( def user_agent(self) -> str: """The current user agent value.""" if self.use_env: - add_user_agent_header = os.environ.get( - self._ENV_ADDITIONAL_USER_AGENT, None - ) + add_user_agent_header = os.environ.get(self._ENV_ADDITIONAL_USER_AGENT, None) if add_user_agent_header is not None: return "{} {}".format(self._user_agent, add_user_agent_header) return self._user_agent @@ -285,9 +283,7 @@ class NetworkTraceLoggingPolicy(SansIOHTTPPolicy[HTTPRequestType, HTTPResponseTy :caption: Configuring a network trace logging policy. """ - def __init__( - self, logging_enable=False, **kwargs - ): # pylint: disable=unused-argument + def __init__(self, logging_enable=False, **kwargs): # pylint: disable=unused-argument self.enable_http_logger = logging_enable def on_request( @@ -367,9 +363,7 @@ def on_response( if header and pattern.match(header): filename = header.partition("=")[2] log_string += "\nFile attachments: {}".format(filename) - elif http_response.headers.get("content-type", "").endswith( - "octet-stream" - ): + elif http_response.headers.get("content-type", "").endswith("octet-stream"): log_string += "\nBody contains binary data." elif http_response.headers.get("content-type", "").startswith("image"): log_string += "\nBody contains image data." @@ -435,31 +429,17 @@ class HttpLoggingPolicy( MULTI_RECORD_LOG = "AZURE_SDK_LOGGING_MULTIRECORD" def __init__(self, logger=None, **kwargs): # pylint: disable=unused-argument - self.logger = logger or logging.getLogger( - "azure.core.pipeline.policies.http_logging_policy" - ) + self.logger = logger or logging.getLogger("azure.core.pipeline.policies.http_logging_policy") self.allowed_query_params = set() self.allowed_header_names = set(self.__class__.DEFAULT_HEADERS_ALLOWLIST) def _redact_query_param(self, key, value): - lower_case_allowed_query_params = [ - param.lower() for param in self.allowed_query_params - ] - return ( - value - if key.lower() in lower_case_allowed_query_params - else HttpLoggingPolicy.REDACTED_PLACEHOLDER - ) + lower_case_allowed_query_params = [param.lower() for param in self.allowed_query_params] + return value if key.lower() in lower_case_allowed_query_params else HttpLoggingPolicy.REDACTED_PLACEHOLDER def _redact_header(self, key, value): - lower_case_allowed_header_names = [ - header.lower() for header in self.allowed_header_names - ] - return ( - value - if key.lower() in lower_case_allowed_header_names - else HttpLoggingPolicy.REDACTED_PLACEHOLDER - ) + lower_case_allowed_header_names = [header.lower() for header in self.allowed_header_names] + return value if key.lower() in lower_case_allowed_header_names else HttpLoggingPolicy.REDACTED_PLACEHOLDER def on_request( # pylint: disable=too-many-return-statements self, request: PipelineRequest[HTTPRequestType] @@ -473,9 +453,7 @@ def on_request( # pylint: disable=too-many-return-statements # Get logger in my context first (request has been retried) # then read from kwargs (pop if that's the case) # then use my instance logger - logger = request.context.setdefault( - "logger", options.pop("logger", self.logger) - ) + logger = request.context.setdefault("logger", options.pop("logger", self.logger)) if not logger.isEnabledFor(logging.INFO): return @@ -483,9 +461,7 @@ def on_request( # pylint: disable=too-many-return-statements try: parsed_url = list(urllib.parse.urlparse(http_request.url)) parsed_qp = urllib.parse.parse_qsl(parsed_url[4], keep_blank_values=True) - filtered_qp = [ - (key, self._redact_query_param(key, value)) for key, value in parsed_qp - ] + filtered_qp = [(key, self._redact_query_param(key, value)) for key, value in parsed_qp] # 4 is query parsed_url[4] = "&".join(["=".join(part) for part in filtered_qp]) redacted_url = urllib.parse.urlunparse(parsed_url) @@ -551,9 +527,7 @@ def on_response( # then use my instance logger # If on_request was called, should always read from context options = request.context.options - logger = request.context.setdefault( - "logger", options.pop("logger", self.logger) - ) + logger = request.context.setdefault("logger", options.pop("logger", self.logger)) try: if not logger.isEnabledFor(logging.INFO): @@ -590,11 +564,7 @@ class ContentDecodePolicy(SansIOHTTPPolicy[HTTPRequestType, HTTPResponseType]): # Name used in context CONTEXT_NAME = "deserialized_data" - def __init__( - self, - response_encoding: Optional[str] = None, - **kwargs # pylint: disable=unused-argument - ) -> None: + def __init__(self, response_encoding: Optional[str] = None, **kwargs) -> None: # pylint: disable=unused-argument self._response_encoding = response_encoding @classmethod @@ -663,9 +633,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback( - DecodeError, message="XML is invalid", response=response - ) + raise_with_traceback(DecodeError, message="XML is invalid", response=response) elif mime_type.startswith("text/"): return data_as_str raise DecodeError("Cannot deserialize content-type: {}".format(mime_type)) @@ -706,9 +674,7 @@ def deserialize_from_http_generics( # even if it's likely dead code if not inspect.iscoroutinefunction(response.read): # type: ignore response.read() # type: ignore - return cls.deserialize_from_text( - response.text(encoding), mime_type, response=response - ) + return cls.deserialize_from_text(response.text(encoding), mime_type, response=response) def on_request(self, request: PipelineRequest) -> None: options = request.context.options @@ -767,9 +733,7 @@ class ProxyPolicy(SansIOHTTPPolicy[HTTPRequestType, HTTPResponseType]): :caption: Configuring a proxy policy. """ - def __init__( - self, proxies=None, **kwargs - ): # pylint: disable=unused-argument,super-init-not-called + def __init__(self, proxies=None, **kwargs): # pylint: disable=unused-argument,super-init-not-called self.proxies = proxies def on_request(self, request: PipelineRequest[HTTPRequestType]) -> None: diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/__init__.py b/sdk/core/azure-core/azure/core/pipeline/transport/__init__.py index ef473d245463..cb72c6a914ce 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/__init__.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/__init__.py @@ -114,6 +114,4 @@ def __getattr__(name): raise ImportError("trio package is not installed") if transport: return transport - raise AttributeError( - f"module 'azure.core.pipeline.transport' has no attribute {name}" - ) + raise AttributeError(f"module 'azure.core.pipeline.transport' has no attribute {name}") diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py b/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py index 3c75ec9bad1f..8678e5e2a7f8 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py @@ -86,18 +86,9 @@ class AioHttpTransport(AsyncHttpTransport): :caption: Asynchronous transport with aiohttp. """ - def __init__( - self, - *, - session: Optional[aiohttp.ClientSession] = None, - loop=None, - session_owner=True, - **kwargs - ): + def __init__(self, *, session: Optional[aiohttp.ClientSession] = None, loop=None, session_owner=True, **kwargs): if loop and sys.version_info >= (3, 10): - raise ValueError( - "Starting with Python 3.10, asyncio doesn’t support loop as a parameter anymore" - ) + raise ValueError("Starting with Python 3.10, asyncio doesn’t support loop as a parameter anymore") self._loop = loop self._session_owner = session_owner self.session = session @@ -154,18 +145,14 @@ def _get_request_data(self, request): # pylint: disable=no-self-use for form_file, data in request.files.items(): content_type = data[2] if len(data) > 2 else None try: - form_data.add_field( - form_file, data[1], filename=data[0], content_type=content_type - ) + form_data.add_field(form_file, data[1], filename=data[0], content_type=content_type) except IndexError: raise ValueError("Invalid formdata formatting: {}".format(data)) return form_data return request.data @overload - async def send( - self, request: HttpRequest, **config: Any - ) -> Optional[AsyncHttpResponse]: + async def send(self, request: HttpRequest, **config: Any) -> Optional[AsyncHttpResponse]: """Send the request using this HTTP sender. Will pre-load the body into memory to be available with a sync method. @@ -183,9 +170,7 @@ async def send( """ @overload - async def send( - self, request: "RestHttpRequest", **config: Any - ) -> Optional["RestAsyncHttpResponse"]: + async def send(self, request: "RestHttpRequest", **config: Any) -> Optional["RestAsyncHttpResponse"]: """Send the `azure.core.rest` request using this HTTP sender. Will pre-load the body into memory to be available with a sync method. @@ -248,12 +233,8 @@ async def send(self, request, **config): try: stream_response = config.pop("stream", False) timeout = config.pop("connection_timeout", self.connection_config.timeout) - read_timeout = config.pop( - "read_timeout", self.connection_config.read_timeout - ) - socket_timeout = aiohttp.ClientTimeout( - sock_connect=timeout, sock_read=read_timeout - ) + read_timeout = config.pop("read_timeout", self.connection_config.read_timeout) + socket_timeout = aiohttp.ClientTimeout(sock_connect=timeout, sock_read=read_timeout) result = await self.session.request( # type: ignore request.method, request.url, @@ -301,9 +282,7 @@ class AioHttpStreamDownloadGenerator(AsyncIterator): on the *content-encoding* header. """ - def __init__( - self, pipeline: Pipeline, response: AsyncHttpResponse, *, decompress=True - ) -> None: + def __init__(self, pipeline: Pipeline, response: AsyncHttpResponse, *, decompress=True) -> None: self.pipeline = pipeline self.request = response.request self.response = response @@ -365,16 +344,9 @@ class AioHttpTransportResponse(AsyncHttpResponse): """ def __init__( - self, - request: HttpRequest, - aiohttp_response: aiohttp.ClientResponse, - block_size=None, - *, - decompress=True + self, request: HttpRequest, aiohttp_response: aiohttp.ClientResponse, block_size=None, *, decompress=True ) -> None: - super(AioHttpTransportResponse, self).__init__( - request, aiohttp_response, block_size=block_size - ) + super(AioHttpTransportResponse, self).__init__(request, aiohttp_response, block_size=block_size) # https://aiohttp.readthedocs.io/en/stable/client_reference.html#aiohttp.ClientResponse self.status_code = aiohttp_response.status self.headers = CIMultiDict(aiohttp_response.headers) @@ -411,9 +383,7 @@ def text(self, encoding: Optional[str] = None) -> str: except LookupError: encoding = None if not encoding: - if mimetype.type == "application" and ( - mimetype.subtype == "json" or mimetype.subtype == "rdap" - ): + if mimetype.type == "application" and (mimetype.subtype == "json" or mimetype.subtype == "rdap"): # RFC 7159 states that the default encoding is UTF-8. # RFC 7483 defines application/rdap+json encoding = "utf-8" @@ -458,8 +428,6 @@ def __getstate__(self): state = self.__dict__.copy() # Remove the unpicklable entries. - state[ - "internal_response" - ] = None # aiohttp response are not pickable (see headers comments) + state["internal_response"] = None # aiohttp response are not pickable (see headers comments) state["headers"] = CIMultiDict(self.headers) # MultiDictProxy is not pickable return state diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_base.py b/sdk/core/azure-core/azure/core/pipeline/transport/_base.py index 1a5a568a6325..77c286abb1e2 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_base.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_base.py @@ -94,9 +94,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{{{}}}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{{{}}}".format(key.args[0]) not in c] template = "/".join(components) # No URL sections left - returning None @@ -114,9 +112,7 @@ def _urljoin(base_url: str, stub_url: str) -> str: return parsed.geturl() -class HttpTransport( - AbstractContextManager, abc.ABC, Generic[HTTPRequestType, HTTPResponseType] -): +class HttpTransport(AbstractContextManager, abc.ABC, Generic[HTTPRequestType, HTTPResponseType]): """An http sender ABC.""" @abc.abstractmethod @@ -206,9 +202,7 @@ def body(self, value: DataType): self.data = value @staticmethod - def _format_data( - data: Union[str, IO] - ) -> Union[Tuple[None, str], Tuple[Optional[str], IO, str]]: + def _format_data(data: Union[str, IO]) -> Union[Tuple[None, str], Tuple[Optional[str], IO, str]]: """Format field data according to whether it is a stream or a string for a form-data request. @@ -235,9 +229,7 @@ def set_streamed_data_body(self, data): if not isinstance(data, binary_type) and not any( hasattr(data, attr) for attr in ["read", "__iter__", "__aiter__"] ): - raise TypeError( - "A streamable data source must be an open file-like object or iterable." - ) + raise TypeError("A streamable data source must be an open file-like object or iterable.") self.data = data self.files = None @@ -294,9 +286,7 @@ def set_formdata_body(self, data=None): self.data = {f: d for f, d in data.items() if d is not None} self.files = None else: # Assume "multipart/form-data" - self.files = { - f: self._format_data(d) for f, d in data.items() if d is not None - } + self.files = {f: self._format_data(d) for f, d in data.items() if d is not None} self.data = None def set_bytes_body(self, data): @@ -405,9 +395,7 @@ def _decode_parts( requests: List[HttpRequest], ) -> List["HttpResponse"]: """Rebuild an HTTP response from pure string.""" - return _decode_parts_helper( - self, message, http_response_type, requests, _deserialize_response - ) + return _decode_parts_helper(self, message, http_response_type, requests, _deserialize_response) def _get_raw_parts( self, http_response_type: Optional[Type["_HttpResponseBase"]] = None @@ -417,9 +405,7 @@ def _get_raw_parts( If parts are application/http use http_response_type or HttpClientTransportResponse as envelope. """ - return _get_raw_parts_helper( - self, http_response_type or HttpClientTransportResponse - ) + return _get_raw_parts_helper(self, http_response_type or HttpClientTransportResponse) def raise_for_status(self) -> None: """Raises an HttpResponseError if the response has an error status code. @@ -430,12 +416,8 @@ def raise_for_status(self) -> None: def __repr__(self): # there doesn't have to be a content type - content_type_str = ( - ", Content-Type: {}".format(self.content_type) if self.content_type else "" - ) - return "<{}: {} {}{}>".format( - type(self).__name__, self.status_code, self.reason, content_type_str - ) + content_type_str = ", Content-Type: {}".format(self.content_type) if self.content_type else "" + return "<{}: {} {}{}>".format(type(self).__name__, self.status_code, self.reason, content_type_str) class HttpResponse(_HttpResponseBase): # pylint: disable=abstract-method @@ -487,9 +469,7 @@ class HttpClientTransportResponse(_HttpClientTransportResponse, HttpResponse): """ -def _deserialize_response( - http_response_as_bytes, http_request, http_response_type=HttpClientTransportResponse -): +def _deserialize_response(http_response_as_bytes, http_request, http_response_type=HttpClientTransportResponse): local_socket = BytesIOSocket(http_response_as_bytes) response = _HTTPResponse(local_socket, method=http_request.method) response.begin() @@ -602,9 +582,7 @@ def get( :return: An HttpRequest object :rtype: ~azure.core.pipeline.transport.HttpRequest """ - request = self._request( - "GET", url, params, headers, content, form_content, None - ) + request = self._request("GET", url, params, headers, content, form_content, None) request.method = "GET" return request @@ -627,9 +605,7 @@ def put( :return: An HttpRequest object :rtype: ~azure.core.pipeline.transport.HttpRequest """ - request = self._request( - "PUT", url, params, headers, content, form_content, stream_content - ) + request = self._request("PUT", url, params, headers, content, form_content, stream_content) return request def post( @@ -651,9 +627,7 @@ def post( :return: An HttpRequest object :rtype: ~azure.core.pipeline.transport.HttpRequest """ - request = self._request( - "POST", url, params, headers, content, form_content, stream_content - ) + request = self._request("POST", url, params, headers, content, form_content, stream_content) return request def head( @@ -675,9 +649,7 @@ def head( :return: An HttpRequest object :rtype: ~azure.core.pipeline.transport.HttpRequest """ - request = self._request( - "HEAD", url, params, headers, content, form_content, stream_content - ) + request = self._request("HEAD", url, params, headers, content, form_content, stream_content) return request def patch( @@ -699,9 +671,7 @@ def patch( :return: An HttpRequest object :rtype: ~azure.core.pipeline.transport.HttpRequest """ - request = self._request( - "PATCH", url, params, headers, content, form_content, stream_content - ) + request = self._request("PATCH", url, params, headers, content, form_content, stream_content) return request def delete( @@ -722,9 +692,7 @@ def delete( :return: An HttpRequest object :rtype: ~azure.core.pipeline.transport.HttpRequest """ - request = self._request( - "DELETE", url, params, headers, content, form_content, None - ) + request = self._request("DELETE", url, params, headers, content, form_content, None) return request def merge( @@ -745,17 +713,11 @@ def merge( :return: An HttpRequest object :rtype: ~azure.core.pipeline.transport.HttpRequest """ - request = self._request( - "MERGE", url, params, headers, content, form_content, None - ) + request = self._request("MERGE", url, params, headers, content, form_content, None) return request def options( - self, - url: str, - params: Optional[Dict[str, str]] = None, - headers: Optional[Dict[str, str]] = None, - **kwargs + self, url: str, params: Optional[Dict[str, str]] = None, headers: Optional[Dict[str, str]] = None, **kwargs ) -> HttpRequest: """Create a OPTIONS request object. @@ -769,7 +731,5 @@ def options( """ content = kwargs.get("content") form_content = kwargs.get("form_content") - request = self._request( - "OPTIONS", url, params, headers, content, form_content, None - ) + request = self._request("OPTIONS", url, params, headers, content, form_content, None) return request diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_base_async.py b/sdk/core/azure-core/azure/core/pipeline/transport/_base_async.py index aa749b10b4cb..6ddce089bc17 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_base_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_base_async.py @@ -80,13 +80,9 @@ def parts(self) -> AsyncIterator: :raises ValueError: If the content is not multipart/mixed """ if not self.content_type or not self.content_type.startswith("multipart/mixed"): - raise ValueError( - "You can't get parts if the response is not multipart/mixed" - ) + raise ValueError("You can't get parts if the response is not multipart/mixed") - return _PartGenerator( - self, default_http_response_type=AsyncHttpClientTransportResponse - ) + return _PartGenerator(self, default_http_response_type=AsyncHttpClientTransportResponse) class AsyncHttpClientTransportResponse(_HttpClientTransportResponse, AsyncHttpResponse): diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py index 365703bc712a..2b0f4929e074 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py @@ -158,12 +158,8 @@ async def send(self, request, **kwargs): # pylint:disable=invalid-overridden-me headers=request.headers, data=data_to_send, files=request.files, - verify=kwargs.pop( - "connection_verify", self.connection_config.verify - ), - timeout=kwargs.pop( - "connection_timeout", self.connection_config.timeout - ), + verify=kwargs.pop("connection_verify", self.connection_config.verify), + timeout=kwargs.pop("connection_timeout", self.connection_config.timeout), cert=kwargs.pop("connection_cert", self.connection_config.cert), allow_redirects=False, **kwargs @@ -207,9 +203,7 @@ async def send(self, request, **kwargs): # pylint:disable=invalid-overridden-me await _handle_no_stream_rest_response(retval) return retval - return AsyncioRequestsTransportResponse( - request, response, self.connection_config.data_block_size - ) + return AsyncioRequestsTransportResponse(request, response, self.connection_config.data_block_size) class AsyncioStreamDownloadGenerator(AsyncIterator): @@ -221,25 +215,19 @@ class AsyncioStreamDownloadGenerator(AsyncIterator): on the *content-encoding* header. """ - def __init__( - self, pipeline: Pipeline, response: AsyncHttpResponse, **kwargs - ) -> None: + def __init__(self, pipeline: Pipeline, response: AsyncHttpResponse, **kwargs) -> None: self.pipeline = pipeline self.request = response.request self.response = response self.block_size = response.block_size decompress = kwargs.pop("decompress", True) if len(kwargs) > 0: - raise TypeError( - "Got an unexpected keyword argument: {}".format(list(kwargs.keys())[0]) - ) + raise TypeError("Got an unexpected keyword argument: {}".format(list(kwargs.keys())[0])) internal_response = response.internal_response if decompress: self.iter_content_func = internal_response.iter_content(self.block_size) else: - self.iter_content_func = _read_raw_stream( - internal_response, self.block_size - ) + self.iter_content_func = _read_raw_stream(internal_response, self.block_size) self.content_length = int(response.headers.get("Content-Length", 0)) def __len__(self): diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py index e28fdd9419f1..359354907503 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py @@ -100,9 +100,7 @@ class _RequestsTransportResponseBase(_HttpResponseBase): """ def __init__(self, request, requests_response, block_size=None): - super(_RequestsTransportResponseBase, self).__init__( - request, requests_response, block_size=block_size - ) + super(_RequestsTransportResponseBase, self).__init__(request, requests_response, block_size=block_size) self.status_code = requests_response.status_code self.headers = requests_response.headers self.reason = requests_response.reason @@ -155,16 +153,12 @@ def __init__(self, pipeline, response, **kwargs): self.block_size = response.block_size decompress = kwargs.pop("decompress", True) if len(kwargs) > 0: - raise TypeError( - "Got an unexpected keyword argument: {}".format(list(kwargs.keys())[0]) - ) + raise TypeError("Got an unexpected keyword argument: {}".format(list(kwargs.keys())[0])) internal_response = response.internal_response if decompress: self.iter_content_func = internal_response.iter_content(self.block_size) else: - self.iter_content_func = _read_raw_stream( - internal_response, self.block_size - ) + self.iter_content_func = _read_raw_stream(internal_response, self.block_size) self.content_length = int(response.headers.get("Content-Length", 0)) def __len__(self): @@ -319,21 +313,15 @@ def send(self, request, **kwargs): error: Optional[AzureErrorUnion] = None try: - connection_timeout = kwargs.pop( - "connection_timeout", self.connection_config.timeout - ) + connection_timeout = kwargs.pop("connection_timeout", self.connection_config.timeout) if isinstance(connection_timeout, tuple): if "read_timeout" in kwargs: - raise ValueError( - "Cannot set tuple connection_timeout and read_timeout together" - ) + raise ValueError("Cannot set tuple connection_timeout and read_timeout together") _LOGGER.warning("Tuple timeout setting is deprecated") timeout = connection_timeout else: - read_timeout = kwargs.pop( - "read_timeout", self.connection_config.read_timeout - ) + read_timeout = kwargs.pop("read_timeout", self.connection_config.read_timeout) timeout = (connection_timeout, read_timeout) response = self.session.request( # type: ignore request.method, @@ -385,6 +373,4 @@ def send(self, request, **kwargs): if not kwargs.get("stream"): _handle_non_stream_rest_response(retval) return retval - return RequestsTransportResponse( - request, response, self.connection_config.data_block_size - ) + return RequestsTransportResponse(request, response, self.connection_config.data_block_size) diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py index 68aa033b77d3..8dfb9f48c169 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py @@ -81,25 +81,19 @@ class TrioStreamDownloadGenerator(AsyncIterator): on the *content-encoding* header. """ - def __init__( - self, pipeline: Pipeline, response: AsyncHttpResponse, **kwargs - ) -> None: + def __init__(self, pipeline: Pipeline, response: AsyncHttpResponse, **kwargs) -> None: self.pipeline = pipeline self.request = response.request self.response = response self.block_size = response.block_size decompress = kwargs.pop("decompress", True) if len(kwargs) > 0: - raise TypeError( - "Got an unexpected keyword argument: {}".format(list(kwargs.keys())[0]) - ) + raise TypeError("Got an unexpected keyword argument: {}".format(list(kwargs.keys())[0])) internal_response = response.internal_response if decompress: self.iter_content_func = internal_response.iter_content(self.block_size) else: - self.iter_content_func = _read_raw_stream( - internal_response, self.block_size - ) + self.iter_content_func = _read_raw_stream(internal_response, self.block_size) self.content_length = int(response.headers.get("Content-Length", 0)) def __len__(self): @@ -114,11 +108,9 @@ async def __anext__(self): self.iter_content_func, ) except AttributeError: # trio < 0.12.1 - chunk = ( - await trio.run_sync_in_worker_thread( # pylint: disable=no-member - _iterate_response_content, - self.iter_content_func, - ) + chunk = await trio.run_sync_in_worker_thread( # pylint: disable=no-member + _iterate_response_content, + self.iter_content_func, ) if not chunk: raise _ResponseStopIteration() @@ -206,9 +198,7 @@ async def send( # pylint:disable=invalid-overridden-method :keyword dict proxies: will define the proxy to use. Proxy is a dict (protocol, url) """ - async def send( - self, request, **kwargs: Any - ): # pylint:disable=invalid-overridden-method + async def send(self, request, **kwargs: Any): # pylint:disable=invalid-overridden-method """Send the request using this HTTP sender. :param request: The HttpRequest @@ -235,12 +225,8 @@ async def send( headers=request.headers, data=data_to_send, files=request.files, - verify=kwargs.pop( - "connection_verify", self.connection_config.verify - ), - timeout=kwargs.pop( - "connection_timeout", self.connection_config.timeout - ), + verify=kwargs.pop("connection_verify", self.connection_config.verify), + timeout=kwargs.pop("connection_timeout", self.connection_config.timeout), cert=kwargs.pop("connection_cert", self.connection_config.cert), allow_redirects=False, **kwargs @@ -248,29 +234,21 @@ async def send( limiter=trio_limiter, ) except AttributeError: # trio < 0.12.1 - response = ( - await trio.run_sync_in_worker_thread( # pylint: disable=no-member - functools.partial( - self.session.request, - request.method, - request.url, - headers=request.headers, - data=request.data, - files=request.files, - verify=kwargs.pop( - "connection_verify", self.connection_config.verify - ), - timeout=kwargs.pop( - "connection_timeout", self.connection_config.timeout - ), - cert=kwargs.pop( - "connection_cert", self.connection_config.cert - ), - allow_redirects=False, - **kwargs - ), - limiter=trio_limiter, - ) + response = await trio.run_sync_in_worker_thread( # pylint: disable=no-member + functools.partial( + self.session.request, + request.method, + request.url, + headers=request.headers, + data=request.data, + files=request.files, + verify=kwargs.pop("connection_verify", self.connection_config.verify), + timeout=kwargs.pop("connection_timeout", self.connection_config.timeout), + cert=kwargs.pop("connection_cert", self.connection_config.cert), + allow_redirects=False, + **kwargs + ), + limiter=trio_limiter, ) response.raw.enforce_content_length = True @@ -308,6 +286,4 @@ async def send( await _handle_no_stream_rest_response(retval) return retval - return TrioRequestsTransportResponse( - request, response, self.connection_config.data_block_size - ) + return TrioRequestsTransportResponse(request, response, self.connection_config.data_block_size) diff --git a/sdk/core/azure-core/azure/core/polling/_async_poller.py b/sdk/core/azure-core/azure/core/polling/_async_poller.py index 5b98c65ee76c..c50222363531 100644 --- a/sdk/core/azure-core/azure/core/polling/_async_poller.py +++ b/sdk/core/azure-core/azure/core/polling/_async_poller.py @@ -39,9 +39,7 @@ class AsyncPollingMethod(Generic[PollingReturnType]): """ABC class for polling method.""" - def initialize( - self, client: Any, initial_response: Any, deserialization_callback: Any - ) -> None: + def initialize(self, client: Any, initial_response: Any, deserialization_callback: Any) -> None: raise NotImplementedError("This method needs to be implemented") async def run(self) -> None: @@ -57,21 +55,11 @@ def resource(self) -> PollingReturnType: raise NotImplementedError("This method needs to be implemented") def get_continuation_token(self) -> str: - raise TypeError( - "Polling method '{}' doesn't support get_continuation_token".format( - self.__class__.__name__ - ) - ) + raise TypeError("Polling method '{}' doesn't support get_continuation_token".format(self.__class__.__name__)) @classmethod - def from_continuation_token( - cls, continuation_token: str, **kwargs - ) -> Tuple[Any, Any, Callable]: - raise TypeError( - "Polling method '{}' doesn't support from_continuation_token".format( - cls.__name__ - ) - ) + def from_continuation_token(cls, continuation_token: str, **kwargs) -> Tuple[Any, Any, Callable]: + raise TypeError("Polling method '{}' doesn't support from_continuation_token".format(cls.__name__)) class AsyncNoPolling(_NoPolling): @@ -83,9 +71,7 @@ async def run(self): # pylint:disable=invalid-overridden-method """ -async def async_poller( - client, initial_response, deserialization_callback, polling_method -): +async def async_poller(client, initial_response, deserialization_callback, polling_method): """Async Poller for long running operations. .. deprecated:: 1.5.0 @@ -101,9 +87,7 @@ async def async_poller( :param polling_method: The polling strategy to adopt :type polling_method: ~azure.core.polling.PollingMethod """ - poller = AsyncLROPoller( - client, initial_response, deserialization_callback, polling_method - ) + poller = AsyncLROPoller(client, initial_response, deserialization_callback, polling_method) return await poller @@ -137,9 +121,7 @@ def __init__( except AttributeError: pass - self._polling_method.initialize( - client, initial_response, deserialization_callback - ) + self._polling_method.initialize(client, initial_response, deserialization_callback) def polling_method(self) -> AsyncPollingMethod[PollingReturnType]: """Return the polling method associated to this poller.""" @@ -155,10 +137,7 @@ def continuation_token(self) -> str: @classmethod def from_continuation_token( - cls, - polling_method: AsyncPollingMethod[PollingReturnType], - continuation_token: str, - **kwargs + cls, polling_method: AsyncPollingMethod[PollingReturnType], continuation_token: str, **kwargs ) -> "AsyncLROPoller[PollingReturnType]": ( client, diff --git a/sdk/core/azure-core/azure/core/polling/_poller.py b/sdk/core/azure-core/azure/core/polling/_poller.py index c7d208d49548..84067f301392 100644 --- a/sdk/core/azure-core/azure/core/polling/_poller.py +++ b/sdk/core/azure-core/azure/core/polling/_poller.py @@ -41,9 +41,7 @@ class PollingMethod(Generic[PollingReturnType]): """ABC class for polling method.""" - def initialize( - self, client: Any, initial_response: Any, deserialization_callback: Any - ) -> None: + def initialize(self, client: Any, initial_response: Any, deserialization_callback: Any) -> None: raise NotImplementedError("This method needs to be implemented") def run(self) -> None: @@ -59,21 +57,11 @@ def resource(self) -> PollingReturnType: raise NotImplementedError("This method needs to be implemented") def get_continuation_token(self) -> str: - raise TypeError( - "Polling method '{}' doesn't support get_continuation_token".format( - self.__class__.__name__ - ) - ) + raise TypeError("Polling method '{}' doesn't support get_continuation_token".format(self.__class__.__name__)) @classmethod - def from_continuation_token( - cls, continuation_token: str, **kwargs - ) -> Tuple[Any, Any, Callable]: - raise TypeError( - "Polling method '{}' doesn't support from_continuation_token".format( - cls.__name__ - ) - ) + def from_continuation_token(cls, continuation_token: str, **kwargs) -> Tuple[Any, Any, Callable]: + raise TypeError("Polling method '{}' doesn't support from_continuation_token".format(cls.__name__)) class NoPolling(PollingMethod): @@ -83,9 +71,7 @@ def __init__(self): self._initial_response = None self._deserialization_callback = None - def initialize( - self, _: Any, initial_response: Any, deserialization_callback: Callable - ) -> None: + def initialize(self, _: Any, initial_response: Any, deserialization_callback: Callable) -> None: self._initial_response = initial_response self._deserialization_callback = deserialization_callback @@ -115,15 +101,11 @@ def get_continuation_token(self) -> str: return base64.b64encode(pickle.dumps(self._initial_response)).decode("ascii") @classmethod - def from_continuation_token( - cls, continuation_token: str, **kwargs - ) -> Tuple[Any, Any, Callable]: + def from_continuation_token(cls, continuation_token: str, **kwargs) -> Tuple[Any, Any, Callable]: try: deserialization_callback = kwargs["deserialization_callback"] except KeyError: - raise ValueError( - "Need kwarg 'deserialization_callback' to be recreated from continuation_token" - ) + raise ValueError("Need kwarg 'deserialization_callback' to be recreated from continuation_token") import pickle initial_response = pickle.loads(base64.b64decode(continuation_token)) # nosec @@ -161,9 +143,7 @@ def __init__( pass # Might raise a CloudError - self._polling_method.initialize( - client, initial_response, deserialization_callback - ) + self._polling_method.initialize(client, initial_response, deserialization_callback) # Prepare thread execution self._thread = None @@ -222,10 +202,7 @@ def continuation_token(self) -> str: @classmethod def from_continuation_token( - cls, - polling_method: PollingMethod[PollingReturnType], - continuation_token: str, - **kwargs + cls, polling_method: PollingMethod[PollingReturnType], continuation_token: str, **kwargs ) -> "LROPoller[PollingReturnType]": ( client, diff --git a/sdk/core/azure-core/azure/core/polling/async_base_polling.py b/sdk/core/azure-core/azure/core/polling/async_base_polling.py index 275f4b248d24..f57ae55eacdc 100644 --- a/sdk/core/azure-core/azure/core/polling/async_base_polling.py +++ b/sdk/core/azure-core/azure/core/polling/async_base_polling.py @@ -46,9 +46,7 @@ async def run(self): # pylint:disable=invalid-overridden-method except BadStatus as err: self._status = "Failed" - raise HttpResponseError( - response=self._pipeline_response.http_response, error=err - ) + raise HttpResponseError(response=self._pipeline_response.http_response, error=err) except BadResponse as err: self._status = "Failed" @@ -59,9 +57,7 @@ async def run(self): # pylint:disable=invalid-overridden-method ) except OperationFailed as err: - raise HttpResponseError( - response=self._pipeline_response.http_response, error=err - ) + raise HttpResponseError(response=self._pipeline_response.http_response, error=err) async def _poll(self): # pylint:disable=invalid-overridden-method """Poll status of operation so long as operation is incomplete and @@ -99,15 +95,11 @@ async def _delay(self): # pylint:disable=invalid-overridden-method async def update_status(self): # pylint:disable=invalid-overridden-method """Update the current status of the LRO.""" - self._pipeline_response = await self.request_status( - self._operation.get_polling_url() - ) + self._pipeline_response = await self.request_status(self._operation.get_polling_url()) _raise_if_bad_http_status_and_method(self._pipeline_response.http_response) self._status = self._operation.get_status(self._pipeline_response) - async def request_status( - self, status_link - ): # pylint:disable=invalid-overridden-method + async def request_status(self, status_link): # pylint:disable=invalid-overridden-method """Do a simple GET to this status link. This method re-inject 'x-ms-client-request-id'. @@ -115,9 +107,7 @@ async def request_status( :rtype: azure.core.pipeline.PipelineResponse """ if self._path_format_arguments: - status_link = self._client.format_url( - status_link, **self._path_format_arguments - ) + status_link = self._client.format_url(status_link, **self._path_format_arguments) # Re-inject 'x-ms-client-request-id' while polling if "request_id" not in self._operation_config: self._operation_config["request_id"] = self._get_request_id() @@ -127,9 +117,7 @@ async def request_status( from azure.core.rest import HttpRequest as RestHttpRequest request = RestHttpRequest("GET", status_link) - return await self._client.send_request( - request, _return_pipeline_response=True, **self._operation_config - ) + return await self._client.send_request(request, _return_pipeline_response=True, **self._operation_config) # if I am a azure.core.pipeline.transport.HttpResponse request = self._client.get(status_link) diff --git a/sdk/core/azure-core/azure/core/polling/base_polling.py b/sdk/core/azure-core/azure/core/polling/base_polling.py index 7562db2f9131..0d8c0730e18e 100644 --- a/sdk/core/azure-core/azure/core/polling/base_polling.py +++ b/sdk/core/azure-core/azure/core/polling/base_polling.py @@ -107,11 +107,7 @@ def _raise_if_bad_http_status_and_method(response: "ResponseType") -> None: code = response.status_code if code in {200, 201, 202, 204}: return - raise BadStatus( - "Invalid return status {!r} for {!r} operation".format( - code, response.request.method - ) - ) + raise BadStatus("Invalid return status {!r} for {!r} operation".format(code, response.request.method)) def _is_empty(response: "ResponseType") -> bool: @@ -157,9 +153,7 @@ def get_status(self, pipeline_response: "PipelineResponseType") -> str: raise NotImplementedError() @abc.abstractmethod - def get_final_get_url( - self, pipeline_response: "PipelineResponseType" - ) -> Optional[str]: + def get_final_get_url(self, pipeline_response: "PipelineResponseType") -> Optional[str]: """If a final GET is needed, returns the URL. :rtype: str @@ -189,9 +183,7 @@ class OperationResourcePolling(LongRunningOperation): https://aka.ms/azsdk/autorest/openapi/lro-options """ - def __init__( - self, operation_location_header="operation-location", *, lro_options=None - ): + def __init__(self, operation_location_header="operation-location", *, lro_options=None): self._operation_location_header = operation_location_header # Store the initial URLs @@ -209,16 +201,13 @@ def get_polling_url(self) -> str: """Return the polling URL.""" return self._async_url - def get_final_get_url( - self, pipeline_response: "PipelineResponseType" - ) -> Optional[str]: + def get_final_get_url(self, pipeline_response: "PipelineResponseType") -> Optional[str]: """If a final GET is needed, returns the URL. :rtype: str """ if ( - self._lro_options.get(_LroOption.FINAL_STATE_VIA) - == _FinalStateViaOption.LOCATION_FINAL_STATE + self._lro_options.get(_LroOption.FINAL_STATE_VIA) == _FinalStateViaOption.LOCATION_FINAL_STATE and self._location_url ): return self._location_url @@ -276,9 +265,7 @@ def get_status(self, pipeline_response: "PipelineResponseType") -> str: """ response = pipeline_response.http_response if _is_empty(response): - raise BadResponse( - "The response from long running operation does not contain a body." - ) + raise BadResponse("The response from long running operation does not contain a body.") body = _as_json(response) status = body.get("status") @@ -302,9 +289,7 @@ def get_polling_url(self) -> str: """Return the polling URL.""" return self._location_url - def get_final_get_url( - self, pipeline_response: "PipelineResponseType" - ) -> Optional[str]: + def get_final_get_url(self, pipeline_response: "PipelineResponseType") -> Optional[str]: """If a final GET is needed, returns the URL. :rtype: str @@ -361,9 +346,7 @@ def set_initial_status(self, pipeline_response: "PipelineResponseType") -> str: def get_status(self, pipeline_response: "PipelineResponseType") -> str: return "Succeeded" - def get_final_get_url( - self, pipeline_response: "PipelineResponseType" - ) -> Optional[str]: + def get_final_get_url(self, pipeline_response: "PipelineResponseType") -> Optional[str]: """If a final GET is needed, returns the URL. :rtype: str @@ -383,12 +366,7 @@ class LROBasePolling(PollingMethod): # pylint: disable=too-many-instance-attrib """ def __init__( - self, - timeout=30, - lro_algorithms=None, - lro_options=None, - path_format_arguments=None, - **operation_config + self, timeout=30, lro_algorithms=None, lro_options=None, path_format_arguments=None, **operation_config ): self._lro_algorithms = lro_algorithms or [ OperationResourcePolling(lro_options=lro_options), @@ -412,9 +390,7 @@ def status(self): :rtype: str """ if not self._operation: - raise ValueError( - "set_initial_status was never called. Did you give this instance to a poller?" - ) + raise ValueError("set_initial_status was never called. Did you give this instance to a poller?") return self._status def finished(self): @@ -457,9 +433,7 @@ def initialize(self, client, initial_response, deserialization_callback): raise HttpResponseError(response=initial_response.http_response, error=err) except BadResponse as err: self._status = "Failed" - raise HttpResponseError( - response=initial_response.http_response, message=str(err), error=err - ) + raise HttpResponseError(response=initial_response.http_response, message=str(err), error=err) except OperationFailed as err: raise HttpResponseError(response=initial_response.http_response, error=err) @@ -469,30 +443,22 @@ def get_continuation_token(self) -> str: return base64.b64encode(pickle.dumps(self._initial_response)).decode("ascii") @classmethod - def from_continuation_token( - cls, continuation_token: str, **kwargs - ) -> Tuple[Any, Any, Callable]: + def from_continuation_token(cls, continuation_token: str, **kwargs) -> Tuple[Any, Any, Callable]: try: client = kwargs["client"] except KeyError: - raise ValueError( - "Need kwarg 'client' to be recreated from continuation_token" - ) + raise ValueError("Need kwarg 'client' to be recreated from continuation_token") try: deserialization_callback = kwargs["deserialization_callback"] except KeyError: - raise ValueError( - "Need kwarg 'deserialization_callback' to be recreated from continuation_token" - ) + raise ValueError("Need kwarg 'deserialization_callback' to be recreated from continuation_token") import pickle initial_response = pickle.loads(base64.b64decode(continuation_token)) # nosec # Restore the transport in the context - initial_response.context.transport = ( - client._pipeline._transport # pylint: disable=protected-access - ) + initial_response.context.transport = client._pipeline._transport # pylint: disable=protected-access return client, initial_response, deserialization_callback def run(self): @@ -501,9 +467,7 @@ def run(self): except BadStatus as err: self._status = "Failed" - raise HttpResponseError( - response=self._pipeline_response.http_response, error=err - ) + raise HttpResponseError(response=self._pipeline_response.http_response, error=err) except BadResponse as err: self._status = "Failed" @@ -514,9 +478,7 @@ def run(self): ) except OperationFailed as err: - raise HttpResponseError( - response=self._pipeline_response.http_response, error=err - ) + raise HttpResponseError(response=self._pipeline_response.http_response, error=err) def _poll(self): """Poll status of operation so long as operation is incomplete and @@ -542,9 +504,7 @@ def _poll(self): self._pipeline_response = self.request_status(final_get_url) _raise_if_bad_http_status_and_method(self._pipeline_response.http_response) - def _parse_resource( - self, pipeline_response: "PipelineResponseType" - ) -> Optional[Any]: + def _parse_resource(self, pipeline_response: "PipelineResponseType") -> Optional[Any]: """Assuming this response is a resource, use the deserialization callback to parse it. If body is empty, assuming no resource to return. """ @@ -578,9 +538,7 @@ def update_status(self): self._status = self._operation.get_status(self._pipeline_response) def _get_request_id(self): - return self._pipeline_response.http_response.request.headers[ - "x-ms-client-request-id" - ] + return self._pipeline_response.http_response.request.headers["x-ms-client-request-id"] def request_status(self, status_link): """Do a simple GET to this status link. @@ -590,9 +548,7 @@ def request_status(self, status_link): :rtype: azure.core.pipeline.PipelineResponse """ if self._path_format_arguments: - status_link = self._client.format_url( - status_link, **self._path_format_arguments - ) + status_link = self._client.format_url(status_link, **self._path_format_arguments) # Re-inject 'x-ms-client-request-id' while polling if "request_id" not in self._operation_config: self._operation_config["request_id"] = self._get_request_id() @@ -602,9 +558,7 @@ def request_status(self, status_link): from azure.core.rest import HttpRequest as RestHttpRequest request = RestHttpRequest("GET", status_link) - return self._client.send_request( - request, _return_pipeline_response=True, **self._operation_config - ) + return self._client.send_request(request, _return_pipeline_response=True, **self._operation_config) # if I am a azure.core.pipeline.transport.HttpResponse request = self._client.get(status_link) return self._client._pipeline.run( # pylint: disable=protected-access diff --git a/sdk/core/azure-core/azure/core/rest/_aiohttp.py b/sdk/core/azure-core/azure/core/rest/_aiohttp.py index 6b4775fc054b..62843ef26b04 100644 --- a/sdk/core/azure-core/azure/core/rest/_aiohttp.py +++ b/sdk/core/azure-core/azure/core/rest/_aiohttp.py @@ -155,9 +155,7 @@ def __getattr__(self, attr): return super().__getattr__(attr) -class RestAioHttpTransportResponse( - AsyncHttpResponseImpl, _RestAioHttpTransportResponseBackcompatMixin -): +class RestAioHttpTransportResponse(AsyncHttpResponseImpl, _RestAioHttpTransportResponseBackcompatMixin): def __init__(self, *, internal_response, decompress: bool = True, **kwargs): headers = _CIMultiDict(internal_response.headers) super().__init__( @@ -176,9 +174,7 @@ def __init__(self, *, internal_response, decompress: bool = True, **kwargs): def __getstate__(self): state = self.__dict__.copy() # Remove the unpicklable entries. - state[ - "_internal_response" - ] = None # aiohttp response are not pickable (see headers comments) + state["_internal_response"] = None # aiohttp response are not pickable (see headers comments) state["headers"] = CIMultiDict(self.headers) # MultiDictProxy is not pickable return state diff --git a/sdk/core/azure-core/azure/core/rest/_helpers.py b/sdk/core/azure-core/azure/core/rest/_helpers.py index 42dbff631b37..bcc2a8c71c06 100644 --- a/sdk/core/azure-core/azure/core/rest/_helpers.py +++ b/sdk/core/azure-core/azure/core/rest/_helpers.py @@ -72,17 +72,9 @@ def _verify_data_object(name, value): if not isinstance(name, str): - raise TypeError( - "Invalid type for data name. Expected str, got {}: {}".format( - type(name), name - ) - ) + raise TypeError("Invalid type for data name. Expected str, got {}: {}".format(type(name), name)) if value is not None and not isinstance(value, (str, bytes, int, float)): - raise TypeError( - "Invalid type for data value. Expected primitive type, got {}: {}".format( - type(name), name - ) - ) + raise TypeError("Invalid type for data value. Expected primitive type, got {}: {}".format(type(name), name)) def set_urlencoded_body(data, has_files): @@ -105,9 +97,7 @@ def set_urlencoded_body(data, has_files): def set_multipart_body(files): - formatted_files = { - f: _format_data_helper(d) for f, d in files.items() if d is not None - } + formatted_files = {f: _format_data_helper(d) for f, d in files.items() if d is not None} return {}, formatted_files @@ -277,9 +267,7 @@ def _set_streamed_data_body(self, data): if not isinstance(data, binary_type) and not any( hasattr(data, attr) for attr in ["read", "__iter__", "__aiter__"] ): - raise TypeError( - "A streamable data source must be an open file-like object or iterable." - ) + raise TypeError("A streamable data source must be an open file-like object or iterable.") headers = self._set_body(content=data) self._files = None self.headers.update(headers) @@ -367,6 +355,6 @@ def _serialize(self): def _add_backcompat_properties(self, request, memo): """While deepcopying, we also need to add the private backcompat attrs""" - request._multipart_mixed_info = ( # pylint: disable=protected-access - copy.deepcopy(self._multipart_mixed_info, memo) + request._multipart_mixed_info = copy.deepcopy( # pylint: disable=protected-access + self._multipart_mixed_info, memo ) diff --git a/sdk/core/azure-core/azure/core/rest/_http_response_impl.py b/sdk/core/azure-core/azure/core/rest/_http_response_impl.py index 4078696c7e1a..035f26ecedbe 100644 --- a/sdk/core/azure-core/azure/core/rest/_http_response_impl.py +++ b/sdk/core/azure-core/azure/core/rest/_http_response_impl.py @@ -96,9 +96,7 @@ def _decode_parts(self, message, http_response_type, requests): Rebuild an HTTP response from pure string. """ - def _deserialize_response( - http_response_as_bytes, http_request, http_response_type - ): + def _deserialize_response(http_response_as_bytes, http_request, http_response_type): local_socket = BytesIOSocket(http_response_as_bytes) response = _HTTPResponse(local_socket, method=http_request.method) response.begin() @@ -120,9 +118,7 @@ def _get_raw_parts(self, http_response_type=None): If parts are application/http use http_response_type or HttpClientTransportResponse as envelope. """ - return _get_raw_parts_helper( - self, http_response_type or RestHttpClientTransportResponse - ) + return _get_raw_parts_helper(self, http_response_type or RestHttpClientTransportResponse) def _stream_download(self, pipeline, **kwargs): """DEPRECATED: Generator for streaming request body data. @@ -180,9 +176,7 @@ def __init__(self, **kwargs) -> None: self._reason: str = kwargs.pop("reason") self._content_type: str = kwargs.pop("content_type") self._headers: MutableMapping[str, str] = kwargs.pop("headers") - self._stream_download_generator: Callable = kwargs.pop( - "stream_download_generator" - ) + self._stream_download_generator: Callable = kwargs.pop("stream_download_generator") self._is_closed = False self._is_stream_consumed = False self._json = None # this is filled in ContentDecodePolicy, when we deserialize @@ -323,17 +317,11 @@ def content(self) -> bytes: return self._content def __repr__(self) -> str: - content_type_str = ( - ", Content-Type: {}".format(self.content_type) if self.content_type else "" - ) - return "".format( - self.status_code, self.reason, content_type_str - ) + content_type_str = ", Content-Type: {}".format(self.content_type) if self.content_type else "" + return "".format(self.status_code, self.reason, content_type_str) -class HttpResponseImpl( - _HttpResponseBaseImpl, _HttpResponse, HttpResponseBackcompatMixin -): +class HttpResponseImpl(_HttpResponseBaseImpl, _HttpResponse, HttpResponseBackcompatMixin): """HttpResponseImpl built on top of our HttpResponse protocol class. Since ~azure.core.rest.HttpResponse is an abstract base class, we need to @@ -404,25 +392,19 @@ def iter_raw(self, **kwargs) -> Iterator[bytes]: :rtype: Iterator[str] """ self._stream_download_check() - for part in self._stream_download_generator( - response=self, pipeline=None, decompress=False - ): + for part in self._stream_download_generator(response=self, pipeline=None, decompress=False): yield part self.close() -class _RestHttpClientTransportResponseBackcompatBaseMixin( - _HttpResponseBackcompatMixinBase -): +class _RestHttpClientTransportResponseBackcompatBaseMixin(_HttpResponseBackcompatMixinBase): def body(self): if self._content is None: self._content = self.internal_response.read() return self.content -class _RestHttpClientTransportResponseBase( - _HttpResponseBaseImpl, _RestHttpClientTransportResponseBackcompatBaseMixin -): +class _RestHttpClientTransportResponseBase(_HttpResponseBaseImpl, _RestHttpClientTransportResponseBackcompatBaseMixin): def __init__(self, **kwargs): internal_response = kwargs.pop("internal_response") headers = case_insensitive_dict(internal_response.getheaders()) @@ -437,9 +419,7 @@ def __init__(self, **kwargs): ) -class RestHttpClientTransportResponse( - _RestHttpClientTransportResponseBase, HttpResponseImpl -): +class RestHttpClientTransportResponse(_RestHttpClientTransportResponseBase, HttpResponseImpl): """Create a Rest HTTPResponse from an http.client response.""" def iter_bytes(self, **kwargs): diff --git a/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py b/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py index da5be566f4e3..b3449fb3e4f8 100644 --- a/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py +++ b/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py @@ -49,18 +49,12 @@ def parts(self): :raises ValueError: If the content is not multipart/mixed """ if not self.content_type or not self.content_type.startswith("multipart/mixed"): - raise ValueError( - "You can't get parts if the response is not multipart/mixed" - ) + raise ValueError("You can't get parts if the response is not multipart/mixed") - return _PartGenerator( - self, default_http_response_type=RestAsyncHttpClientTransportResponse - ) + return _PartGenerator(self, default_http_response_type=RestAsyncHttpClientTransportResponse) -class AsyncHttpResponseImpl( - _HttpResponseBaseImpl, _AsyncHttpResponse, AsyncHttpResponseBackcompatMixin -): +class AsyncHttpResponseImpl(_HttpResponseBaseImpl, _AsyncHttpResponse, AsyncHttpResponseBackcompatMixin): """AsyncHttpResponseImpl built on top of our HttpResponse protocol class. Since ~azure.core.rest.AsyncHttpResponse is an abstract base class, we need to @@ -103,9 +97,7 @@ async def iter_raw(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] """ self._stream_download_check() - async for part in self._stream_download_generator( - response=self, pipeline=None, decompress=False - ): + async for part in self._stream_download_generator(response=self, pipeline=None, decompress=False): yield part await self.close() @@ -119,9 +111,7 @@ async def iter_bytes(self, **kwargs: Any) -> AsyncIterator[bytes]: yield self.content[i : i + self._block_size] else: self._stream_download_check() - async for part in self._stream_download_generator( - response=self, pipeline=None, decompress=True - ): + async for part in self._stream_download_generator(response=self, pipeline=None, decompress=True): yield part await self.close() @@ -139,17 +129,11 @@ async def __aexit__(self, *args) -> None: await self.close() def __repr__(self) -> str: - content_type_str = ( - ", Content-Type: {}".format(self.content_type) if self.content_type else "" - ) - return "".format( - self.status_code, self.reason, content_type_str - ) + content_type_str = ", Content-Type: {}".format(self.content_type) if self.content_type else "" + return "".format(self.status_code, self.reason, content_type_str) -class RestAsyncHttpClientTransportResponse( - _RestHttpClientTransportResponseBase, AsyncHttpResponseImpl -): +class RestAsyncHttpClientTransportResponse(_RestHttpClientTransportResponseBase, AsyncHttpResponseImpl): """Create a Rest HTTPResponse from an http.client response.""" async def iter_bytes(self, **kwargs): diff --git a/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py b/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py index b787ec9f3a5c..35e896676e42 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py @@ -33,9 +33,7 @@ class RestAsyncioRequestsTransportResponse(AsyncHttpResponseImpl, _RestRequestsT """Asynchronous streaming of data from the response.""" def __init__(self, **kwargs): - super().__init__( - stream_download_generator=AsyncioStreamDownloadGenerator, **kwargs - ) + super().__init__(stream_download_generator=AsyncioStreamDownloadGenerator, **kwargs) async def close(self) -> None: """Close the response. diff --git a/sdk/core/azure-core/azure/core/rest/_requests_basic.py b/sdk/core/azure-core/azure/core/rest/_requests_basic.py index b07a1aa828c9..f00300c0c74d 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_basic.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_basic.py @@ -75,9 +75,7 @@ def _body(self): return self._content -class _RestRequestsTransportResponseBase( - _HttpResponseBaseImpl, _RestRequestsTransportResponseBaseMixin -): +class _RestRequestsTransportResponseBase(_HttpResponseBaseImpl, _RestRequestsTransportResponseBaseMixin): def __init__(self, **kwargs): internal_response = kwargs.pop("internal_response") content = None @@ -95,10 +93,6 @@ def __init__(self, **kwargs): ) -class RestRequestsTransportResponse( - HttpResponseImpl, _RestRequestsTransportResponseBase -): +class RestRequestsTransportResponse(HttpResponseImpl, _RestRequestsTransportResponseBase): def __init__(self, **kwargs): - super(RestRequestsTransportResponse, self).__init__( - stream_download_generator=StreamDownloadGenerator, **kwargs - ) + super(RestRequestsTransportResponse, self).__init__(stream_download_generator=StreamDownloadGenerator, **kwargs) diff --git a/sdk/core/azure-core/azure/core/rest/_requests_trio.py b/sdk/core/azure-core/azure/core/rest/_requests_trio.py index 3a5e7f720b89..8a8415d4d03b 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_trio.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_trio.py @@ -33,9 +33,7 @@ class RestTrioRequestsTransportResponse(AsyncHttpResponseImpl, _RestRequestsTran """Asynchronous streaming of data from the response.""" def __init__(self, **kwargs): - super().__init__( - stream_download_generator=TrioStreamDownloadGenerator, **kwargs - ) + super().__init__(stream_download_generator=TrioStreamDownloadGenerator, **kwargs) async def close(self) -> None: if not self.is_closed: diff --git a/sdk/core/azure-core/azure/core/rest/_rest_py3.py b/sdk/core/azure-core/azure/core/rest/_rest_py3.py index f65dc7537eb1..902c01d13821 100644 --- a/sdk/core/azure-core/azure/core/rest/_rest_py3.py +++ b/sdk/core/azure-core/azure/core/rest/_rest_py3.py @@ -122,9 +122,7 @@ def __init__( if kwargs: raise TypeError( - "You have passed in kwargs '{}' that are not valid kwargs.".format( - "', '".join(list(kwargs.keys())) - ) + "You have passed in kwargs '{}' that are not valid kwargs.".format("', '".join(list(kwargs.keys()))) ) def _set_body( @@ -148,9 +146,7 @@ def _set_body( if files: default_headers, self._files = set_multipart_body(files) if data: - default_headers, self._data = set_urlencoded_body( - data, has_files=bool(files) - ) + default_headers, self._data = set_urlencoded_body(data, has_files=bool(files)) return default_headers @property @@ -371,12 +367,8 @@ def iter_bytes(self, **kwargs: Any) -> Iterator[bytes]: ... def __repr__(self) -> str: - content_type_str = ( - ", Content-Type: {}".format(self.content_type) if self.content_type else "" - ) - return "".format( - self.status_code, self.reason, content_type_str - ) + content_type_str = ", Content-Type: {}".format(self.content_type) if self.content_type else "" + return "".format(self.status_code, self.reason, content_type_str) class AsyncHttpResponse(_HttpResponseBase, AsyncContextManager["AsyncHttpResponse"]): diff --git a/sdk/core/azure-core/azure/core/settings.py b/sdk/core/azure-core/azure/core/settings.py index ee804cfc4cb0..2f078e9f9729 100644 --- a/sdk/core/azure-core/azure/core/settings.py +++ b/sdk/core/azure-core/azure/core/settings.py @@ -111,11 +111,7 @@ def convert_logging(value: Union[str, int]) -> int: val = cast(str, value).upper() level = _levels.get(val) if not level: - raise ValueError( - "Cannot convert {} to log level, valid values are: {}".format( - value, ", ".join(_levels) - ) - ) + raise ValueError("Cannot convert {} to log level, valid values are: {}".format(value, ", ".join(_levels))) return level @@ -142,9 +138,7 @@ def get_opencensus_span_if_opencensus_is_imported() -> Optional[Type[AbstractSpa } -def convert_tracing_impl( - value: Union[str, Type[AbstractSpan]] -) -> Optional[Type[AbstractSpan]]: +def convert_tracing_impl(value: Union[str, Type[AbstractSpan]]) -> Optional[Type[AbstractSpan]]: """Convert a string to AbstractSpan If a AbstractSpan is passed in, it is returned as-is. Otherwise the function @@ -205,9 +199,7 @@ class PrioritizedSetting: """ - def __init__( - self, name, env_var=None, system_hook=None, default=_Unset, convert=None - ): + def __init__(self, name, env_var=None, system_hook=None, default=_Unset, convert=None): self._name = name self._env_var = env_var @@ -384,11 +376,7 @@ def defaults(self): :rtype: namedtuple """ - props = { - k: v.default - for (k, v) in self.__class__.__dict__.items() - if isinstance(v, PrioritizedSetting) - } + props = {k: v.default for (k, v) in self.__class__.__dict__.items() if isinstance(v, PrioritizedSetting)} return self._config(props) @property @@ -412,11 +400,7 @@ def config(self, **kwargs): settings.config(log_level=logging.DEBUG) """ - props = { - k: v() - for (k, v) in self.__class__.__dict__.items() - if isinstance(v, PrioritizedSetting) - } + props = {k: v() for (k, v) in self.__class__.__dict__.items() if isinstance(v, PrioritizedSetting)} props.update(kwargs) return self._config(props) diff --git a/sdk/core/azure-core/azure/core/tracing/_abstract_span.py b/sdk/core/azure-core/azure/core/tracing/_abstract_span.py index 8e4305690440..b29103dbcb23 100644 --- a/sdk/core/azure-core/azure/core/tracing/_abstract_span.py +++ b/sdk/core/azure-core/azure/core/tracing/_abstract_span.py @@ -105,9 +105,7 @@ def add_attribute(self, key: str, value: Union[str, int]) -> None: :type value: str """ - def set_http_attributes( - self, request: "HttpRequest", response: Optional["HttpResponseType"] = None - ) -> None: + def set_http_attributes(self, request: "HttpRequest", response: Optional["HttpResponseType"] = None) -> None: """ Add correct attributes for a http client span. @@ -140,9 +138,7 @@ def link(cls, traceparent: str, attributes: Optional["Attributes"] = None) -> No """ @classmethod - def link_from_headers( - cls, headers: Dict[str, str], attributes: Optional["Attributes"] = None - ) -> None: + def link_from_headers(cls, headers: Dict[str, str], attributes: Optional["Attributes"] = None) -> None: """ Given a dictionary, extracts the context and links the context to the current tracer. @@ -207,9 +203,7 @@ class HttpSpanMixin(_MIXIN_BASE): _HTTP_URL = "http.url" _HTTP_STATUS_CODE = "http.status_code" - def set_http_attributes( - self, request: "HttpRequest", response: Optional["HttpResponseType"] = None - ) -> None: + def set_http_attributes(self, request: "HttpRequest", response: Optional["HttpResponseType"] = None) -> None: """ Add correct attributes for a http client span. @@ -240,8 +234,6 @@ class Link: :type attributes: dict """ - def __init__( - self, headers: Dict[str, str], attributes: Optional["Attributes"] = None - ) -> None: + def __init__(self, headers: Dict[str, str], attributes: Optional["Attributes"] = None) -> None: self.headers = headers self.attributes = attributes diff --git a/sdk/core/azure-core/azure/core/tracing/common.py b/sdk/core/azure-core/azure/core/tracing/common.py index b23186c855e8..f3741cdfdd04 100644 --- a/sdk/core/azure-core/azure/core/tracing/common.py +++ b/sdk/core/azure-core/azure/core/tracing/common.py @@ -51,9 +51,7 @@ def get_function_and_class_name(func: Callable, *args) -> str: return func.__qualname__ except AttributeError: if args: - return "{}.{}".format( - args[0].__class__.__name__, func.__name__ - ) # pylint: disable=protected-access + return "{}.{}".format(args[0].__class__.__name__, func.__name__) # pylint: disable=protected-access return func.__name__ diff --git a/sdk/core/azure-core/azure/core/tracing/decorator.py b/sdk/core/azure-core/azure/core/tracing/decorator.py index 6773d01d82de..02b1bcc0099b 100644 --- a/sdk/core/azure-core/azure/core/tracing/decorator.py +++ b/sdk/core/azure-core/azure/core/tracing/decorator.py @@ -50,9 +50,7 @@ def distributed_trace( # pylint:disable=function-redefined pass -def distributed_trace( # pylint:disable=function-redefined - __func: Callable[P, T] = None, **kwargs: Any -): +def distributed_trace(__func: Callable[P, T] = None, **kwargs: Any): # pylint:disable=function-redefined """Decorator to apply to function to get traced automatically. Span will use the func name or "name_of_span". diff --git a/sdk/core/azure-core/azure/core/tracing/decorator_async.py b/sdk/core/azure-core/azure/core/tracing/decorator_async.py index 96fe11ac88bc..ed82bdf09cb6 100644 --- a/sdk/core/azure-core/azure/core/tracing/decorator_async.py +++ b/sdk/core/azure-core/azure/core/tracing/decorator_async.py @@ -38,9 +38,7 @@ @overload -def distributed_trace_async( - __func: Callable[P, Awaitable[T]] -) -> Callable[P, Awaitable[T]]: +def distributed_trace_async(__func: Callable[P, Awaitable[T]]) -> Callable[P, Awaitable[T]]: pass diff --git a/sdk/core/azure-core/azure/core/utils/_connection_string_parser.py b/sdk/core/azure-core/azure/core/utils/_connection_string_parser.py index 62a2f50989a8..50d5001546f1 100644 --- a/sdk/core/azure-core/azure/core/utils/_connection_string_parser.py +++ b/sdk/core/azure-core/azure/core/utils/_connection_string_parser.py @@ -7,9 +7,7 @@ from typing import Mapping -def parse_connection_string( - conn_str: str, case_sensitive_keys: bool = False -) -> Mapping[str, str]: +def parse_connection_string(conn_str: str, case_sensitive_keys: bool = False) -> Mapping[str, str]: """Parses the connection string into a dict of its component parts, with the option of preserving case of keys, and validates that each key in the connection string has a provided value. If case of keys is not preserved (ie. `case_sensitive_keys=False`), then a dict with LOWERCASE KEYS will be returned. @@ -38,9 +36,7 @@ def parse_connection_string( for key in args_dict.keys(): new_key = key.lower() if new_key in new_args_dict: - raise ValueError( - "Duplicate key in connection string: {}".format(new_key) - ) + raise ValueError("Duplicate key in connection string: {}".format(new_key)) new_args_dict[new_key] = args_dict[key] return new_args_dict diff --git a/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared.py b/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared.py index b9f280390e69..e15964dc5e5a 100644 --- a/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared.py +++ b/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared.py @@ -80,9 +80,7 @@ def _format_parameters_helper(http_request, params): query = urlparse(http_request.url).query if query: http_request.url = http_request.url.partition("?")[0] - existing_params = { - p[0]: p[-1] for p in [p.partition("=") for p in query.split("&")] - } + existing_params = {p[0]: p[-1] for p in [p.partition("=") for p in query.split("&")]} params.update(existing_params) query_params = [] for k, v in params.items(): @@ -112,9 +110,7 @@ def _pad_attr_name(attr: str, backcompat_attrs: List[str]) -> str: return "_{}".format(attr) if attr in backcompat_attrs else attr -def _prepare_multipart_body_helper( - http_request: "HTTPRequestType", content_index: int = 0 -) -> int: +def _prepare_multipart_body_helper(http_request: "HTTPRequestType", content_index: int = 0) -> int: """Helper for prepare_multipart_body. Will prepare the body of this request according to the multipart information. @@ -162,9 +158,7 @@ def _prepare_multipart_body_helper( eol = b"\r\n" _, _, body = full_message.split(eol, 2) http_request.set_bytes_body(body) - http_request.headers["Content-Type"] = ( - "multipart/mixed; boundary=" + main_message.get_boundary() - ) + http_request.headers["Content-Type"] = "multipart/mixed; boundary=" + main_message.get_boundary() return content_index @@ -231,16 +225,12 @@ def _decode_parts_helper( elif content_type == "multipart/mixed" and requests[index].multipart_mixed_info: # The message batch contains one or more change sets changeset_requests = requests[index].multipart_mixed_info[0] # type: ignore - changeset_responses = ( - response._decode_parts( # pylint: disable=protected-access - raw_response, http_response_type, changeset_requests - ) + changeset_responses = response._decode_parts( # pylint: disable=protected-access + raw_response, http_response_type, changeset_requests ) responses.extend(changeset_responses) else: - raise ValueError( - "Multipart doesn't support part other than application/http for now" - ) + raise ValueError("Multipart doesn't support part other than application/http for now") return responses @@ -254,17 +244,10 @@ def _get_raw_parts_helper(response, http_response_type): """ body_as_bytes = response.body() # In order to use email.message parser, I need full HTTP bytes. Faking something to make the parser happy - http_body = ( - b"Content-Type: " - + response.content_type.encode("ascii") - + b"\r\n\r\n" - + body_as_bytes - ) + http_body = b"Content-Type: " + response.content_type.encode("ascii") + b"\r\n\r\n" + body_as_bytes message: Message = message_parser(http_body) requests = response.request.multipart_mixed_info[0] - return response._decode_parts( # pylint: disable=protected-access - message, http_response_type, requests - ) + return response._decode_parts(message, http_response_type, requests) # pylint: disable=protected-access def _parts_helper( @@ -275,9 +258,7 @@ def _parts_helper( :rtype: iterator[HttpResponse] :raises ValueError: If the content is not multipart/mixed """ - if not response.content_type or not response.content_type.startswith( - "multipart/mixed" - ): + if not response.content_type or not response.content_type.startswith("multipart/mixed"): raise ValueError("You can't get parts if the response is not multipart/mixed") responses = response._get_raw_parts() # pylint: disable=protected-access @@ -291,9 +272,7 @@ def parse_responses(response): http_request = response.request context = PipelineContext(None) pipeline_request = PipelineRequest(http_request, context) - pipeline_response = PipelineResponse( - http_request, response, context=context - ) + pipeline_response = PipelineResponse(http_request, response, context=context) for policy in policies: _await_result(policy.on_response, pipeline_request, pipeline_response) @@ -307,9 +286,7 @@ def parse_responses(response): return responses -def _format_data_helper( - data: Union[str, IO] -) -> Union[Tuple[None, str], Tuple[Optional[str], IO, str]]: +def _format_data_helper(data: Union[str, IO]) -> Union[Tuple[None, str], Tuple[Optional[str], IO, str]]: """Helper for _format_data. Format field data according to whether it is a stream or @@ -343,9 +320,7 @@ def _aiohttp_body_helper( :rtype: bytes """ if response._content is None: - raise ValueError( - "Body is not available. Call async method load_body, or do your call with stream=False." - ) + raise ValueError("Body is not available. Call async method load_body, or do your call with stream=False.") if not response._decompress: return response._content if response._decompressed_content: diff --git a/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared_async.py b/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared_async.py index b30b7c02349b..3d03f4b93771 100644 --- a/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared_async.py +++ b/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared_async.py @@ -30,22 +30,16 @@ async def _parse_response(self): http_response_type=self._default_http_response_type ) if self._response.request.multipart_mixed_info: - policies: List[ - "SansIOHTTPPolicy" - ] = self._response.request.multipart_mixed_info[1] + policies: List["SansIOHTTPPolicy"] = self._response.request.multipart_mixed_info[1] async def parse_responses(response): http_request = response.request context = PipelineContext(None) pipeline_request = PipelineRequest(http_request, context) - pipeline_response = PipelineResponse( - http_request, response, context=context - ) + pipeline_response = PipelineResponse(http_request, response, context=context) for policy in policies: - await _await_result( - policy.on_response, pipeline_request, pipeline_response - ) + await _await_result(policy.on_response, pipeline_request, pipeline_response) # Not happy to make this code asyncio specific, but that's multipart only for now # If we need trio and multipart, let's reinvesitgate that later diff --git a/sdk/core/azure-core/azure/core/utils/_utils.py b/sdk/core/azure-core/azure/core/utils/_utils.py index fc4a97433c06..134d79be781c 100644 --- a/sdk/core/azure-core/azure/core/utils/_utils.py +++ b/sdk/core/azure-core/azure/core/utils/_utils.py @@ -105,9 +105,7 @@ class CaseInsensitiveDict(MutableMapping[str, Any]): """ def __init__( - self, - data: Optional[Union[Mapping[str, Any], Iterable[Tuple[str, Any]]]] = None, - **kwargs: Any + self, data: Optional[Union[Mapping[str, Any], Iterable[Tuple[str, Any]]]] = None, **kwargs: Any ) -> None: self._store: Dict[str, Any] = {} if data is None: @@ -137,9 +135,7 @@ def __len__(self) -> int: return len(self._store) def lowerkey_items(self): - return ( - (lower_case_key, pair[1]) for lower_case_key, pair in self._store.items() - ) + return ((lower_case_key, pair[1]) for lower_case_key, pair in self._store.items()) def __eq__(self, other: Any) -> bool: if isinstance(other, Mapping): diff --git a/sdk/core/azure-core/samples/test_example_async.py b/sdk/core/azure-core/samples/test_example_async.py index 7f439e273ac9..2d4db41febc2 100644 --- a/sdk/core/azure-core/samples/test_example_async.py +++ b/sdk/core/azure-core/samples/test_example_async.py @@ -35,19 +35,16 @@ @pytest.mark.asyncio async def test_example_trio(): - async def req(): request = HttpRequest("GET", "https://bing.com/") - policies = [ - UserAgentPolicy("myuseragent"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), AsyncRedirectPolicy()] # [START trio] from azure.core.pipeline.transport import TrioRequestsTransport async with AsyncPipeline(TrioRequestsTransport(), policies=policies) as pipeline: return await pipeline.run(request) # [END trio] + response = trio.run(req) assert isinstance(response.http_response.status_code, int) @@ -56,10 +53,7 @@ async def req(): async def test_example_asyncio(): request = HttpRequest("GET", "https://bing.com") - policies = [ - UserAgentPolicy("myuseragent"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), AsyncRedirectPolicy()] # [START asyncio] from azure.core.pipeline.transport import AsyncioRequestsTransport @@ -74,10 +68,7 @@ async def test_example_asyncio(): async def test_example_aiohttp(): request = HttpRequest("GET", "https://bing.com") - policies = [ - UserAgentPolicy("myuseragent"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), AsyncRedirectPolicy()] # [START aiohttp] from azure.core.pipeline.transport import AioHttpTransport @@ -97,10 +88,7 @@ async def test_example_async_pipeline(): # example: create request and policies request = HttpRequest("GET", "https://bing.com") - policies = [ - UserAgentPolicy("myuseragent"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), AsyncRedirectPolicy()] # run the pipeline async with AsyncPipeline(transport=AioHttpTransport(), policies=policies) as pipeline: @@ -221,7 +209,7 @@ async def test_example_async_retry_policy(): retry_status=5, retry_backoff_factor=0.5, retry_backoff_max=60, - retry_on_methods=['GET'] + retry_on_methods=["GET"], ) # [END async_retry_policy] diff --git a/sdk/core/azure-core/samples/test_example_policies.py b/sdk/core/azure-core/samples/test_example_policies.py index cbf1a9933c2b..50dd93ff0908 100644 --- a/sdk/core/azure-core/samples/test_example_policies.py +++ b/sdk/core/azure-core/samples/test_example_policies.py @@ -24,6 +24,7 @@ # # -------------------------------------------------------------------------- + def test_example_raw_response_hook(): def callback(response): response.http_response.status_code = 200 @@ -35,9 +36,7 @@ def callback(response): from azure.core.pipeline.policies import CustomHookPolicy request = HttpRequest("GET", "https://bing.com") - policies = [ - CustomHookPolicy(raw_response_hook=callback) - ] + policies = [CustomHookPolicy(raw_response_hook=callback)] with Pipeline(transport=RequestsTransport(), policies=policies) as pipeline: response = pipeline.run(request) diff --git a/sdk/core/azure-core/samples/test_example_sansio.py b/sdk/core/azure-core/samples/test_example_sansio.py index 9006aaffa8b2..d63852c778cb 100644 --- a/sdk/core/azure-core/samples/test_example_sansio.py +++ b/sdk/core/azure-core/samples/test_example_sansio.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import sys from azure.core.pipeline.transport import HttpRequest @@ -35,16 +35,13 @@ def test_example_headers_policy(): url = "https://bing.com" - policies = [ - UserAgentPolicy("myuseragent"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), RedirectPolicy()] # [START headers_policy] from azure.core.pipeline.policies import HeadersPolicy headers_policy = HeadersPolicy() - headers_policy.add_header('CustomValue', 'Foo') + headers_policy.add_header("CustomValue", "Foo") # Or headers can be added per operation. These headers will supplement existing headers # or those defined in the config headers policy. They will also overwrite existing @@ -52,24 +49,22 @@ def test_example_headers_policy(): policies.append(headers_policy) client = PipelineClient(base_url=url, policies=policies) request = client.get(url) - pipeline_response = client._pipeline.run(request, headers={'CustomValue': 'Bar'}) + pipeline_response = client._pipeline.run(request, headers={"CustomValue": "Bar"}) # [END headers_policy] response = pipeline_response.http_response assert isinstance(response.status_code, int) + def test_example_request_id_policy(): url = "https://bing.com" - policies = [ - UserAgentPolicy("myuseragent"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), RedirectPolicy()] # [START request_id_policy] from azure.core.pipeline.policies import HeadersPolicy request_id_policy = RequestIdPolicy() - request_id_policy.set_request_id('azconfig-test') + request_id_policy.set_request_id("azconfig-test") # Or headers can be added per operation. These headers will supplement existing headers # or those defined in the config headers policy. They will also overwrite existing @@ -98,7 +93,7 @@ def test_example_user_agent_policy(): # You can also pass in a custom value per operation to append to the end of the user-agent. # This can be used together with the policy configuration to append multiple values. - policies=[ + policies = [ redirect_policy, user_agent_policy, ] @@ -114,10 +109,7 @@ def test_example_user_agent_policy(): def example_network_trace_logging(): filename = "log.txt" url = "https://bing.com" - policies = [ - UserAgentPolicy("myuseragent"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), RedirectPolicy()] # [START network_trace_logging_policy] from azure.core.pipeline.policies import NetworkTraceLoggingPolicy @@ -151,6 +143,7 @@ def example_network_trace_logging(): response = pipeline_response.http_response assert isinstance(response.status_code, int) + def example_proxy_policy(): # [START proxy_policy] @@ -159,10 +152,10 @@ def example_proxy_policy(): proxy_policy = ProxyPolicy() # Example - proxy_policy.proxies = {'http': 'http://10.10.1.10:3148'} + proxy_policy.proxies = {"http": "http://10.10.1.10:3148"} # Use basic auth - proxy_policy.proxies = {'https': 'http://user:password@10.10.1.10:1180/'} + proxy_policy.proxies = {"https": "http://user:password@10.10.1.10:1180/"} # You can also configure proxies by setting the environment variables # HTTP_PROXY and HTTPS_PROXY. diff --git a/sdk/core/azure-core/samples/test_example_sync.py b/sdk/core/azure-core/samples/test_example_sync.py index 071d1a643ef0..073ed9f4b84c 100644 --- a/sdk/core/azure-core/samples/test_example_sync.py +++ b/sdk/core/azure-core/samples/test_example_sync.py @@ -27,20 +27,12 @@ from azure.core.pipeline import Pipeline from azure.core import PipelineClient from azure.core.pipeline.transport import HttpRequest -from azure.core.pipeline.policies import ( - UserAgentPolicy, - RedirectPolicy, - RetryPolicy -) +from azure.core.pipeline.policies import UserAgentPolicy, RedirectPolicy, RetryPolicy def test_example_requests(): request = HttpRequest("GET", "https://bing.com") - policies = [ - UserAgentPolicy("myuseragent"), - RedirectPolicy(), - RetryPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), RedirectPolicy(), RetryPolicy()] # [START requests] from azure.core.pipeline.transport import RequestsTransport @@ -59,10 +51,7 @@ def test_example_pipeline(): # example: create request and policies request = HttpRequest("GET", "https://bing.com") - policies = [ - UserAgentPolicy("myuseragent"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), RedirectPolicy()] # run the pipeline with Pipeline(transport=RequestsTransport(), policies=policies) as pipeline: @@ -79,10 +68,7 @@ def test_example_pipeline_client(): from azure.core.pipeline.policies import RedirectPolicy, UserAgentPolicy # example configuration with some policies - policies = [ - UserAgentPolicy("myuseragent"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), RedirectPolicy()] client = PipelineClient(base_url=url, policies=policies) request = client.get("https://bing.com") @@ -93,6 +79,7 @@ def test_example_pipeline_client(): response = pipeline_response.http_response assert isinstance(response.status_code, int) + def test_example_redirect_policy(): url = "https://bing.com" @@ -139,10 +126,7 @@ def test_example_retry_policy(): url = "https://bing.com" - policies = [ - UserAgentPolicy("myuseragent"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myuseragent"), RedirectPolicy()] # [START retry_policy] from azure.core.pipeline.policies import RetryPolicy @@ -193,13 +177,14 @@ def test_example_retry_policy(): retry_status=5, retry_backoff_factor=0.5, retry_backoff_max=120, - retry_on_methods=['GET'] + retry_on_methods=["GET"], ) # [END retry_policy] response = pipeline_response.http_response assert isinstance(response.status_code, int) + def test_example_no_retries(): url = "https://bing.com" diff --git a/sdk/core/azure-core/setup.py b/sdk/core/azure-core/setup.py index f882a330ce7e..8cd4d45c1be6 100644 --- a/sdk/core/azure-core/setup.py +++ b/sdk/core/azure-core/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,59 +16,60 @@ PACKAGE_PPRINT_NAME = "Core" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', # type: ignore - fd.read(), re.MULTILINE).group(1) +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) # type: ignore if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, include_package_data=True, - description='Microsoft Azure {} Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core', + description="Microsoft Azure {} Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core", classifiers=[ "Development Status :: 5 - Production/Stable", - 'Programming Language :: Python', + "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", ], zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + ] + ), package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, python_requires=">=3.7", install_requires=[ - 'requests>=2.18.4', - 'six>=1.11.0', + "requests>=2.18.4", + "six>=1.11.0", "typing-extensions>=4.0.1", ], extras_require={ diff --git a/sdk/core/azure-core/tests/async_tests/conftest.py b/sdk/core/azure-core/tests/async_tests/conftest.py index 99b7a90b0918..329c8970efd0 100644 --- a/sdk/core/azure-core/tests/async_tests/conftest.py +++ b/sdk/core/azure-core/tests/async_tests/conftest.py @@ -33,6 +33,7 @@ import urllib from rest_client_async import AsyncTestRestClient + def is_port_available(port_num): req = urllib.request.Request("http://localhost:{}/health".format(port_num)) try: @@ -40,6 +41,7 @@ def is_port_available(port_num): except Exception as e: return True + def get_port(): count = 3 for _ in range(count): @@ -48,19 +50,21 @@ def get_port(): return port_num raise TypeError("Tried {} times, can't find an open port".format(count)) + @pytest.fixture def port(): return os.environ["FLASK_PORT"] + def start_testserver(): port = get_port() os.environ["FLASK_APP"] = "coretestserver" os.environ["FLASK_PORT"] = str(port) cmd = "flask run -p {}".format(port) - if os.name == 'nt': #On windows, subprocess creation works without being in the shell + if os.name == "nt": # On windows, subprocess creation works without being in the shell child_process = subprocess.Popen(cmd, env=dict(os.environ)) else: - #On linux, have to set shell=True + # On linux, have to set shell=True child_process = subprocess.Popen(cmd, shell=True, preexec_fn=os.setsid, env=dict(os.environ)) count = 5 for _ in range(count): @@ -69,12 +73,14 @@ def start_testserver(): time.sleep(1) raise ValueError("Didn't start!") + def terminate_testserver(process): - if os.name == 'nt': + if os.name == "nt": process.kill() else: os.killpg(os.getpgid(process.pid), signal.SIGTERM) # Send the signal to all the process groups + @pytest.fixture(autouse=True, scope="package") def testserver(): """Start the Autorest testserver.""" @@ -82,6 +88,7 @@ def testserver(): yield terminate_testserver(server) + @pytest.fixture def client(port): return AsyncTestRestClient(port) diff --git a/sdk/core/azure-core/tests/async_tests/rest_client_async.py b/sdk/core/azure-core/tests/async_tests/rest_client_async.py index 2ad83c2dea4c..ce0b08be957c 100644 --- a/sdk/core/azure-core/tests/async_tests/rest_client_async.py +++ b/sdk/core/azure-core/tests/async_tests/rest_client_async.py @@ -8,10 +8,9 @@ from azure.core.pipeline import policies from azure.core.configuration import Configuration + class TestRestClientConfiguration(Configuration): - def __init__( - self, **kwargs - ): + def __init__(self, **kwargs): # type: (...) -> None super(TestRestClientConfiguration, self).__init__(**kwargs) @@ -29,16 +28,12 @@ def _configure(self, **kwargs) -> None: self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") -class AsyncTestRestClient(object): +class AsyncTestRestClient(object): def __init__(self, port, **kwargs): self._config = TestRestClientConfiguration(**kwargs) - self._client = AsyncPipelineClient( - base_url="http://localhost:{}".format(port), - config=self._config, - **kwargs - ) + self._client = AsyncPipelineClient(base_url="http://localhost:{}".format(port), config=self._config, **kwargs) def send_request(self, request, **kwargs): """Runs the network request through the client's chained policies. diff --git a/sdk/core/azure-core/tests/async_tests/test_authentication_async.py b/sdk/core/azure-core/tests/async_tests/test_authentication_async.py index 2120b8efb018..3c676a2e97aa 100644 --- a/sdk/core/azure-core/tests/async_tests/test_authentication_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_authentication_async.py @@ -17,6 +17,7 @@ pytestmark = pytest.mark.asyncio from utils import HTTP_REQUESTS + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_bearer_policy_adds_header(http_request): """The bearer token policy should add a header containing a token from its credential""" @@ -209,6 +210,7 @@ async def fake_send(*args, **kwargs): fake_send.calls = 1 return Mock(status_code=401, headers={"WWW-Authenticate": 'Basic realm="localhost"'}) raise TestException() + fake_send.calls = 0 policy = TestPolicy(credential, "scope") diff --git a/sdk/core/azure-core/tests/async_tests/test_base_polling_async.py b/sdk/core/azure-core/tests/async_tests/test_base_polling_async.py index f5cdf7425cae..e737b8804f11 100644 --- a/sdk/core/azure-core/tests/async_tests/test_base_polling_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_base_polling_async.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import base64 import json import pickle @@ -31,6 +31,7 @@ from azure.core.pipeline._tools import is_rest import types import unittest + try: from unittest import mock except ImportError: @@ -52,6 +53,7 @@ from utils import ASYNCIO_REQUESTS_TRANSPORT_RESPONSES, request_and_responses_product, create_transport_response from rest_client_async import AsyncTestRestClient + class SimpleResource: """An implementation of Python 3 SimpleNamespace. Used to deserialize resource objects from response bodies where @@ -69,25 +71,31 @@ def __repr__(self): def __eq__(self, other): return self.__dict__ == other.__dict__ + class BadEndpointError(Exception): pass -TEST_NAME = 'foo' -RESPONSE_BODY = {'properties':{'provisioningState': 'InProgress'}} -ASYNC_BODY = json.dumps({ 'status': 'Succeeded' }) -ASYNC_URL = 'http://dummyurlFromAzureAsyncOPHeader_Return200' -LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) -LOCATION_URL = 'http://dummyurlurlFromLocationHeader_Return200' -RESOURCE_BODY = json.dumps({ 'name': TEST_NAME }) -RESOURCE_URL = 'http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1' -ERROR = 'http://dummyurl_ReturnError' + +TEST_NAME = "foo" +RESPONSE_BODY = {"properties": {"provisioningState": "InProgress"}} +ASYNC_BODY = json.dumps({"status": "Succeeded"}) +ASYNC_URL = "http://dummyurlFromAzureAsyncOPHeader_Return200" +LOCATION_BODY = json.dumps({"name": TEST_NAME}) +LOCATION_URL = "http://dummyurlurlFromLocationHeader_Return200" +RESOURCE_BODY = json.dumps({"name": TEST_NAME}) +RESOURCE_URL = "http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1" +ERROR = "http://dummyurl_ReturnError" POLLING_STATUS = 200 CLIENT = AsyncPipelineClient("http://example.org") CLIENT.http_request_type = None CLIENT.http_response_type = None + + async def mock_run(client_self, request, **kwargs): return TestBasePolling.mock_update(client_self.http_request_type, client_self.http_response_type, request.url) + + CLIENT._pipeline.run = types.MethodType(mock_run, CLIENT) @@ -103,21 +111,23 @@ def async_pipeline_client_builder(): send will receive "request" and kwargs as any transport layer """ + def create_client(send_cb): class TestHttpTransport(AsyncHttpTransport): - async def open(self): pass - async def close(self): pass - async def __aexit__(self, *args, **kwargs): pass + async def open(self): + pass + + async def close(self): + pass + + async def __aexit__(self, *args, **kwargs): + pass async def send(self, request, **kwargs): return await send_cb(request, **kwargs) - return AsyncPipelineClient( - 'http://example.org/', - pipeline=AsyncPipeline( - transport=TestHttpTransport() - ) - ) + return AsyncPipelineClient("http://example.org/", pipeline=AsyncPipeline(transport=TestHttpTransport())) + return create_client @@ -125,6 +135,7 @@ async def send(self, request, **kwargs): def deserialization_cb(): def cb(pipeline_response): return json.loads(pipeline_response.http_response.text()) + return cb @@ -143,7 +154,7 @@ def polling_response(): None, response, ), - PipelineContext(None) + PipelineContext(None), ) polling._initial_response = polling._pipeline_response return polling, headers @@ -165,145 +176,116 @@ def test_base_polling_continuation_token(client, polling_response): @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_post(async_pipeline_client_builder, deserialization_cb, http_request, http_response): - # Test POST LRO with both Location and Operation-Location - - # The initial response contains both Location and Operation-Location, a 202 and no Body - initial_response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', - 202, - { - 'location': 'http://example.org/location', - 'operation-location': 'http://example.org/async_monitor', - }, - '' - ) + # Test POST LRO with both Location and Operation-Location + + # The initial response contains both Location and Operation-Location, a 202 and no Body + initial_response = TestBasePolling.mock_send( + http_request, + http_response, + "POST", + 202, + { + "location": "http://example.org/location", + "operation-location": "http://example.org/async_monitor", + }, + "", + ) + + async def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/location": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"location_result": True} + ).http_response + elif request.url == "http://example.org/async_monitor": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"status": "Succeeded"} + ).http_response + else: + pytest.fail("No other query allowed") + + client = async_pipeline_client_builder(send) + + # LRO options with Location final state + poll = async_poller(client, initial_response, deserialization_cb, AsyncLROBasePolling(0)) + result = await poll + assert result["location_result"] == True + + # Location has no body + + async def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/location": + return TestBasePolling.mock_send(http_request, http_response, "GET", 200, body=None).http_response + elif request.url == "http://example.org/async_monitor": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"status": "Succeeded"} + ).http_response + else: + pytest.fail("No other query allowed") - async def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/location': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'location_result': True} - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") - - client = async_pipeline_client_builder(send) - - # LRO options with Location final state - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncLROBasePolling(0)) - result = await poll - assert result['location_result'] == True - - # Location has no body - - async def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/location': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body=None - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") - - client = async_pipeline_client_builder(send) - - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncLROBasePolling(0)) - result = await poll - assert result is None + client = async_pipeline_client_builder(send) + + poll = async_poller(client, initial_response, deserialization_cb, AsyncLROBasePolling(0)) + result = await poll + assert result is None @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_post_resource_location(async_pipeline_client_builder, deserialization_cb, http_request, http_response): - # ResourceLocation - - # The initial response contains both Location and Operation-Location, a 202 and no Body - initial_response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', - 202, - { - 'operation-location': 'http://example.org/async_monitor', - }, - '' - ) + # ResourceLocation + + # The initial response contains both Location and Operation-Location, a 202 and no Body + initial_response = TestBasePolling.mock_send( + http_request, + http_response, + "POST", + 202, + { + "operation-location": "http://example.org/async_monitor", + }, + "", + ) + + async def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/resource_location": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"location_result": True} + ).http_response + elif request.url == "http://example.org/async_monitor": + return TestBasePolling.mock_send( + http_request, + http_response, + "GET", + 200, + body={"status": "Succeeded", "resourceLocation": "http://example.org/resource_location"}, + ).http_response + else: + pytest.fail("No other query allowed") + + client = async_pipeline_client_builder(send) + + poll = async_poller(client, initial_response, deserialization_cb, AsyncLROBasePolling(0)) + result = await poll + assert result["location_result"] == True - async def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/resource_location': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'location_result': True} - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded', 'resourceLocation': 'http://example.org/resource_location'} - ).http_response - else: - pytest.fail("No other query allowed") - - client = async_pipeline_client_builder(send) - - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncLROBasePolling(0)) - result = await poll - assert result['location_result'] == True class TestBasePolling(object): - convert = re.compile('([a-z0-9])([A-Z])') + convert = re.compile("([a-z0-9])([A-Z])") @staticmethod def mock_send(http_request, http_response, method, status, headers=None, body=RESPONSE_BODY): @@ -311,13 +293,11 @@ def mock_send(http_request, http_response, method, status, headers=None, body=RE headers = {} response = Response() response._content_consumed = True - response._content = json.dumps(body).encode('ascii') if body is not None else None + response._content = json.dumps(body).encode("ascii") if body is not None else None response.request = Request() response.request.method = method response.request.url = RESOURCE_URL - response.request.headers = { - 'x-ms-client-request-id': '67f4dd4e-6262-45e1-8bed-5c45cf23b6d9' - } + response.request.headers = {"x-ms-client-request-id": "67f4dd4e-6262-45e1-8bed-5c45cf23b6d9"} response.status_code = status response.headers = headers response.headers.update({"content-type": "application/json; charset=utf8"}) @@ -338,23 +318,19 @@ def mock_send(http_request, http_response, method, status, headers=None, body=RE response.request.headers, body, None, # form_content - None # stream_content + None, # stream_content ) response = create_transport_response(http_response, request, response) if is_rest(http_response): response.body() - return PipelineResponse( - request, - response, - None # context - ) + return PipelineResponse(request, response, None) # context @staticmethod def mock_update(http_request, http_response, url, headers=None): response = Response() response._content_consumed = True response.request = mock.create_autospec(Request) - response.request.method = 'GET' + response.request.method = "GET" response.headers = headers or {} response.headers.update({"content-type": "application/json; charset=utf8"}) response.reason = "OK" @@ -362,13 +338,13 @@ def mock_update(http_request, http_response, url, headers=None): if url == ASYNC_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = ASYNC_BODY.encode('ascii') + response._content = ASYNC_BODY.encode("ascii") response.randomFieldFromPollAsyncOpHeader = None elif url == LOCATION_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = LOCATION_BODY.encode('ascii') + response._content = LOCATION_BODY.encode("ascii") response.randomFieldFromPollLocationHeader = None elif url == ERROR: @@ -377,10 +353,10 @@ def mock_update(http_request, http_response, url, headers=None): elif url == RESOURCE_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = RESOURCE_BODY.encode('ascii') + response._content = RESOURCE_BODY.encode("ascii") else: - raise Exception('URL does not match') + raise Exception("URL does not match") request = http_request( response.request.method, @@ -391,11 +367,7 @@ def mock_update(http_request, http_response, url, headers=None): if is_rest(http_response): response.body() - return PipelineResponse( - request, - response, - None # context - ) + return PipelineResponse(request, response, None) # context @staticmethod def mock_outputs(pipeline_response): @@ -405,15 +377,13 @@ def mock_outputs(pipeline_response): except ValueError: raise DecodeError("Impossible to deserialize") - body = {TestBasePolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in body.items()} - properties = body.setdefault('properties', {}) - if 'name' in body: - properties['name'] = body['name'] + body = {TestBasePolling.convert.sub(r"\1_\2", k).lower(): v for k, v in body.items()} + properties = body.setdefault("properties", {}) + if "name" in body: + properties["name"] = body["name"] if properties: - properties = {TestBasePolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in properties.items()} - del body['properties'] + properties = {TestBasePolling.convert.sub(r"\1_\2", k).lower(): v for k, v in properties.items()} + del body["properties"] body.update(properties) resource = SimpleResource(**body) else: @@ -423,110 +393,74 @@ def mock_outputs(pipeline_response): @staticmethod def mock_deserialization_no_body(pipeline_response): - """Use this mock when you don't expect a return (last body irrelevant) - """ + """Use this mock when you don't expect a return (last body irrelevant)""" return None + @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_long_running_put(http_request, http_response): - #TODO: Test custom header field + # TODO: Test custom header field CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response # Test throw on non LRO related status code - response = TestBasePolling.mock_send( - http_request, http_response, 'PUT', 1000, {} - ) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 1000, {}) with pytest.raises(HttpResponseError): - await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + await async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) # Test with no polling necessary - response_body = { - 'properties':{'provisioningState': 'Succeeded'}, - 'name': TEST_NAME - } - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {}, response_body - ) + response_body = {"properties": {"provisioningState": "Succeeded"}, "name": TEST_NAME} + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {}, response_body) + def no_update_allowed(url, headers=None): raise ValueError("Should not try to update") + polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method - ) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'operation-location': ASYNC_URL}) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"operation-location": ASYNC_URL}) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'location': LOCATION_URL}) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"location": LOCATION_URL}) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test polling initial payload invalid (SQLDb) response_body = {} # Empty will raise response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'location': LOCATION_URL}, response_body) + http_request, http_response, "PUT", 201, {"location": LOCATION_URL}, response_body + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test fail to poll from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'operation-location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"operation-location": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) # Test fail to poll from location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) + @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_long_running_patch(http_request, http_response): CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response @@ -534,13 +468,13 @@ async def test_long_running_patch(http_request, http_response): response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", + 202, + {"location": LOCATION_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None @@ -548,27 +482,27 @@ async def test_long_running_patch(http_request, http_response): response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 202, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", + 202, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from location header response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 200, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", + 200, + {"location": LOCATION_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None @@ -576,60 +510,48 @@ async def test_long_running_patch(http_request, http_response): response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 200, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", + 200, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test fail to poll from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PATCH', 202, - {'operation-location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PATCH", 202, {"operation-location": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) # Test fail to poll from location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PATCH', 202, - {'location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PATCH", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) + @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_long_running_delete(http_request, http_response): # Test polling from operation-location header CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response response = TestBasePolling.mock_send( - http_request, - http_response, - 'DELETE', 202, - {'operation-location': ASYNC_URL}, - body="" + http_request, http_response, "DELETE", 202, {"operation-location": ASYNC_URL}, body="" ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_deserialization_no_body, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_deserialization_no_body, polling_method) assert poll is None assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_long_running_post(http_request, http_response): CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response @@ -637,118 +559,91 @@ async def test_long_running_post(http_request, http_response): response = TestBasePolling.mock_send( http_request, http_response, - 'POST', 201, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "POST", + 201, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_deserialization_no_body, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_deserialization_no_body, polling_method) assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None # Test polling from operation-location header response = TestBasePolling.mock_send( http_request, http_response, - 'POST', 202, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "POST", + 202, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_deserialization_no_body, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_deserialization_no_body, polling_method) assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None # Test polling from location header response = TestBasePolling.mock_send( http_request, http_response, - 'POST', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "POST", + 202, + {"location": LOCATION_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) polling_method = AsyncLROBasePolling(0) - poll = await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestBasePolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test fail to poll from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'operation-location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"operation-location": ERROR}) with pytest.raises(BadEndpointError): - await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + await async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) # Test fail to poll from location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - await async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + await async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) + @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_long_running_negative(http_request, http_response): global LOCATION_BODY global POLLING_STATUS CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response # Test LRO PUT throws for invalid json - LOCATION_BODY = '{' - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': LOCATION_URL}) - poll = async_poller( - CLIENT, - response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0) - ) + LOCATION_BODY = "{" + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": LOCATION_URL}) + poll = async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) with pytest.raises(DecodeError): await poll - LOCATION_BODY = '{\'"}' - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': LOCATION_URL}) - poll = async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) + LOCATION_BODY = "{'\"}" + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": LOCATION_URL}) + poll = async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) with pytest.raises(DecodeError): await poll - LOCATION_BODY = '{' + LOCATION_BODY = "{" POLLING_STATUS = 203 - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': LOCATION_URL}) - poll = async_poller(CLIENT, response, - TestBasePolling.mock_outputs, - AsyncLROBasePolling(0)) - with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": LOCATION_URL}) + poll = async_poller(CLIENT, response, TestBasePolling.mock_outputs, AsyncLROBasePolling(0)) + with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization await poll - assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode('ascii') + assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode("ascii") - LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) + LOCATION_BODY = json.dumps({"name": TEST_NAME}) POLLING_STATUS = 200 + @pytest.mark.asyncio -@pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response", request_and_responses_product(ASYNCIO_REQUESTS_TRANSPORT_RESPONSES) +) async def test_post_final_state_via(async_pipeline_client_builder, deserialization_cb, http_request, http_response): # Test POST LRO with both Location and Operation-Location CLIENT.http_request_type = http_request @@ -757,33 +652,25 @@ async def test_post_final_state_via(async_pipeline_client_builder, deserializati initial_response = TestBasePolling.mock_send( http_request, http_response, - 'POST', + "POST", 202, { - 'location': 'http://example.org/location', - 'operation-location': 'http://example.org/async_monitor', + "location": "http://example.org/location", + "operation-location": "http://example.org/async_monitor", }, - '' + "", ) async def send(request, **kwargs): - assert request.method == 'GET' + assert request.method == "GET" - if request.url == 'http://example.org/location': + if request.url == "http://example.org/location": return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'location_result': True} + http_request, http_response, "GET", 200, body={"location_result": True} ).http_response - elif request.url == 'http://example.org/async_monitor': + elif request.url == "http://example.org/async_monitor": return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} + http_request, http_response, "GET", 200, body={"status": "Succeeded"} ).http_response else: pytest.fail("No other query allowed") @@ -795,48 +682,36 @@ async def send(request, **kwargs): client, initial_response, deserialization_cb, - AsyncLROBasePolling(0, lro_options={"final-state-via": "location"})) + AsyncLROBasePolling(0, lro_options={"final-state-via": "location"}), + ) result = await poll - assert result['location_result'] == True + assert result["location_result"] == True # Test 2, LRO options with Operation-Location final state poll = async_poller( client, initial_response, deserialization_cb, - AsyncLROBasePolling(0, lro_options={"final-state-via": "operation-location"})) + AsyncLROBasePolling(0, lro_options={"final-state-via": "operation-location"}), + ) result = await poll - assert result['status'] == 'Succeeded' + assert result["status"] == "Succeeded" # Test 3, "do the right thing" and use Location by default - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncLROBasePolling(0)) + poll = async_poller(client, initial_response, deserialization_cb, AsyncLROBasePolling(0)) result = await poll - assert result['location_result'] == True + assert result["location_result"] == True # Test 4, location has no body async def send(request, **kwargs): - assert request.method == 'GET' + assert request.method == "GET" - if request.url == 'http://example.org/location': + if request.url == "http://example.org/location": + return TestBasePolling.mock_send(http_request, http_response, "GET", 200, body=None).http_response + elif request.url == "http://example.org/async_monitor": return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body=None - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} + http_request, http_response, "GET", 200, body={"status": "Succeeded"} ).http_response else: pytest.fail("No other query allowed") @@ -847,10 +722,12 @@ async def send(request, **kwargs): client, initial_response, deserialization_cb, - AsyncLROBasePolling(0, lro_options={"final-state-via": "location"})) + AsyncLROBasePolling(0, lro_options={"final-state-via": "location"}), + ) result = await poll assert result is None + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_final_get_via_location(port, http_request, deserialization_cb): diff --git a/sdk/core/azure-core/tests/async_tests/test_basic_transport_async.py b/sdk/core/azure-core/tests/async_tests/test_basic_transport_async.py index f68634652040..018aff29a251 100644 --- a/sdk/core/azure-core/tests/async_tests/test_basic_transport_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_basic_transport_async.py @@ -3,7 +3,11 @@ # Licensed under the MIT License. See LICENSE.txt in the project root for # license information. # ------------------------------------------------------------------------- -from azure.core.pipeline.transport import AsyncHttpResponse as PipelineTransportAsyncHttpResponse, AsyncHttpTransport, AioHttpTransport +from azure.core.pipeline.transport import ( + AsyncHttpResponse as PipelineTransportAsyncHttpResponse, + AsyncHttpTransport, + AioHttpTransport, +) from azure.core.rest._http_response_impl_async import AsyncHttpResponseImpl as RestAsyncHttpResponse from azure.core.pipeline.policies import HeadersPolicy from azure.core.pipeline import AsyncPipeline @@ -17,12 +21,22 @@ # MagicMock support async cxt manager only after 3.8 # https://github.com/python/cpython/pull/9296 + class MockAsyncHttpTransport(AsyncHttpTransport): - async def __aenter__(self): return self - async def __aexit__(self, *args): pass - async def open(self): pass - async def close(self): pass - async def send(self, request, **kwargs): pass + async def __aenter__(self): + return self + + async def __aexit__(self, *args): + pass + + async def open(self): + pass + + async def close(self): + pass + + async def send(self, request, **kwargs): + pass class PipelineTransportMockResponse(PipelineTransportAsyncHttpResponse): @@ -34,6 +48,7 @@ def __init__(self, request, body, content_type): def body(self): return self._body + class RestMockResponse(RestAsyncHttpResponse): def __init__(self, request, body, content_type): super(RestMockResponse, self).__init__( @@ -57,8 +72,10 @@ def body(self): def content(self): return self._content + MOCK_RESPONSES = [PipelineTransportMockResponse, RestMockResponse] + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_basic_options_aiohttp(port, http_request): @@ -79,7 +96,7 @@ async def test_multipart_send(http_request): class RequestPolicy(object): async def on_request(self, request): # type: (PipelineRequest) -> None - request.http_request.headers['x-ms-date'] = 'Thu, 14 Jun 2018 16:46:54 GMT' + request.http_request.headers["x-ms-date"] = "Thu, 14 Jun 2018 16:46:54 GMT" req0 = http_request("DELETE", "/container0/blob0") req1 = http_request("DELETE", "/container1/blob1") @@ -89,32 +106,32 @@ async def on_request(self, request): req0, req1, policies=[RequestPolicy()], - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" # Fix it so test are deterministic + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", # Fix it so test are deterministic ) async with AsyncPipeline(transport) as pipeline: await pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -128,7 +145,7 @@ async def test_multipart_send_with_context(http_request): class RequestPolicy(object): async def on_request(self, request): # type: (PipelineRequest) -> None - request.http_request.headers['x-ms-date'] = 'Thu, 14 Jun 2018 16:46:54 GMT' + request.http_request.headers["x-ms-date"] = "Thu, 14 Jun 2018 16:46:54 GMT" req0 = http_request("DELETE", "/container0/blob0") req1 = http_request("DELETE", "/container1/blob1") @@ -138,35 +155,35 @@ async def on_request(self, request): req0, req1, policies=[header_policy, RequestPolicy()], - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", # Fix it so test are deterministic - headers={'Accept': 'application/json'} + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", # Fix it so test are deterministic + headers={"Accept": "application/json"}, ) async with AsyncPipeline(transport) as pipeline: await pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'Accept: application/json\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'Accept: application/json\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"Accept: application/json\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"Accept: application/json\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -174,48 +191,39 @@ async def on_request(self, request): @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_multipart_send_with_one_changeset(http_request): transport = MockAsyncHttpTransport() - requests = [ - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") - ] + requests = [http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1")] changeset = http_request("", "") - changeset.set_multipart_mixed( - *requests, - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" - ) + changeset.set_multipart_mixed(*requests, boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525") request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") - request.set_multipart_mixed( - changeset, - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" - ) + request.set_multipart_mixed(changeset, boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525") async with AsyncPipeline(transport) as pipeline: await pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -227,13 +235,13 @@ async def test_multipart_send_with_multiple_changesets(http_request): changeset1.set_multipart_mixed( http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1"), - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) changeset2 = http_request("", "") changeset2.set_multipart_mixed( http_request("DELETE", "/container2/blob2"), http_request("DELETE", "/container3/blob3"), - boundary="changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314" + boundary="changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314", ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") @@ -247,49 +255,49 @@ async def test_multipart_send_with_multiple_changesets(http_request): await pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 3\r\n' - b'\r\n' - b'DELETE /container3/blob3 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 3\r\n" + b"\r\n" + b"DELETE /container3/blob3 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -302,49 +310,47 @@ async def test_multipart_send_with_combination_changeset_first(http_request): changeset.set_multipart_mixed( http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1"), - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( - changeset, - http_request("DELETE", "/container2/blob2"), - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" + changeset, http_request("DELETE", "/container2/blob2"), boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" ) async with AsyncPipeline(transport) as pipeline: await pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -356,49 +362,47 @@ async def test_multipart_send_with_combination_changeset_last(http_request): changeset.set_multipart_mixed( http_request("DELETE", "/container1/blob1"), http_request("DELETE", "/container2/blob2"), - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - changeset, - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" + http_request("DELETE", "/container0/blob0"), changeset, boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" ) async with AsyncPipeline(transport) as pipeline: await pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -408,77 +412,71 @@ async def test_multipart_send_with_combination_changeset_middle(http_request): transport = MockAsyncHttpTransport() changeset = http_request("", "") changeset.set_multipart_mixed( - http_request("DELETE", "/container1/blob1"), - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + http_request("DELETE", "/container1/blob1"), boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( http_request("DELETE", "/container0/blob0"), changeset, http_request("DELETE", "/container2/blob2"), - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) async with AsyncPipeline(transport) as pipeline: await pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @pytest.mark.asyncio @pytest.mark.parametrize("http_request,mock_response", request_and_responses_product(MOCK_RESPONSES)) async def test_multipart_receive(http_request, mock_response): - class ResponsePolicy(object): def on_response(self, request, response): # type: (PipelineRequest, PipelineResponse) -> None - response.http_response.headers['x-ms-fun'] = 'true' + response.http_response.headers["x-ms-fun"] = "true" class AsyncResponsePolicy(object): async def on_response(self, request, response): # type: (PipelineRequest, PipelineResponse) -> None - response.http_response.headers['x-ms-async-fun'] = 'true' + response.http_response.headers["x-ms-async-fun"] = "true" req0 = http_request("DELETE", "/container0/blob0") req1 = http_request("DELETE", "/container1/blob1") request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") - request.set_multipart_mixed( - req0, - req1, - policies=[ResponsePolicy(), AsyncResponsePolicy()] - ) + request.set_multipart_mixed(req0, req1, policies=[ResponsePolicy(), AsyncResponsePolicy()]) body_as_str = ( "--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" @@ -509,8 +507,8 @@ async def on_response(self, request, response): response = mock_response( request, - body_as_str.encode('ascii'), - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + body_as_str.encode("ascii"), + "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed", ) parts = [] @@ -521,13 +519,13 @@ async def on_response(self, request, response): res0 = parts[0] assert res0.status_code == 202 - assert res0.headers['x-ms-fun'] == 'true' - assert res0.headers['x-ms-async-fun'] == 'true' + assert res0.headers["x-ms-fun"] == "true" + assert res0.headers["x-ms-async-fun"] == "true" res1 = parts[1] assert res1.status_code == 404 - assert res1.headers['x-ms-fun'] == 'true' - assert res1.headers['x-ms-async-fun'] == 'true' + assert res1.headers["x-ms-fun"] == "true" + assert res1.headers["x-ms-async-fun"] == "true" @pytest.mark.asyncio @@ -535,45 +533,42 @@ async def on_response(self, request, response): async def test_multipart_receive_with_one_changeset(http_request, mock_response): changeset = http_request("", "") changeset.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") + http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(changeset) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 202 Accepted\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 202 Accepted\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 202 Accepted\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 202 Accepted\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -591,75 +586,71 @@ async def test_multipart_receive_with_multiple_changesets(http_request, mock_res changeset1 = http_request("", "") changeset1.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") + http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1") ) changeset2 = http_request("", "") changeset2.set_multipart_mixed( - http_request("DELETE", "/container2/blob2"), - http_request("DELETE", "/container3/blob3") + http_request("DELETE", "/container2/blob2"), http_request("DELETE", "/container3/blob3") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(changeset1, changeset2) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314"\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 3\r\n' - b'\r\n' - b'HTTP/1.1 409\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 3\r\n" + b"\r\n" + b"HTTP/1.1 409\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -678,55 +669,52 @@ async def test_multipart_receive_with_combination_changeset_first(http_request, changeset = http_request("", "") changeset.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") + http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(changeset, http_request("DELETE", "/container2/blob2")) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -737,6 +725,7 @@ async def test_multipart_receive_with_combination_changeset_first(http_request, assert parts[1].status_code == 202 assert parts[2].status_code == 404 + @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_raise_for_status_bad_response(mock_response): response = mock_response(request=None, body=None, content_type=None) @@ -744,6 +733,7 @@ def test_raise_for_status_bad_response(mock_response): with pytest.raises(HttpResponseError): response.raise_for_status() + @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_raise_for_status_good_response(mock_response): response = mock_response(request=None, body=None, content_type=None) @@ -760,53 +750,49 @@ async def test_multipart_receive_with_combination_changeset_middle(http_request, request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - changeset, - http_request("DELETE", "/container2/blob2") + http_request("DELETE", "/container0/blob0"), changeset, http_request("DELETE", "/container2/blob2") ) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -824,56 +810,53 @@ async def test_multipart_receive_with_combination_changeset_last(http_request, m changeset = http_request("", "") changeset.set_multipart_mixed( - http_request("DELETE", "/container1/blob1"), - http_request("DELETE", "/container2/blob2") + http_request("DELETE", "/container1/blob1"), http_request("DELETE", "/container2/blob2") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(http_request("DELETE", "/container0/blob0"), changeset) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -898,21 +881,19 @@ async def test_multipart_receive_with_bom(http_request, mock_response): b"Content-Type: application/http\n" b"Content-Transfer-Encoding: binary\n" b"Content-ID: 0\n" - b'\r\n' - b'HTTP/1.1 400 One of the request inputs is not valid.\r\n' - b'Content-Length: 220\r\n' - b'Content-Type: application/xml\r\n' - b'Server: Windows-Azure-Blob/1.0\r\n' - b'\r\n' + b"\r\n" + b"HTTP/1.1 400 One of the request inputs is not valid.\r\n" + b"Content-Length: 220\r\n" + b"Content-Type: application/xml\r\n" + b"Server: Windows-Azure-Blob/1.0\r\n" + b"\r\n" b'\xef\xbb\xbf\nInvalidInputOne' - b'of the request inputs is not valid.\nRequestId:5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\nTime:2019-09-17T23:44:07.4671860Z\n' + b"of the request inputs is not valid.\nRequestId:5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\nTime:2019-09-17T23:44:07.4671860Z\n" b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -922,7 +903,7 @@ async def test_multipart_receive_with_bom(http_request, mock_response): res0 = parts[0] assert res0.status_code == 400 - assert res0.body().startswith(b'\xef\xbb\xbf') + assert res0.body().startswith(b"\xef\xbb\xbf") @pytest.mark.asyncio @@ -960,8 +941,8 @@ async def test_recursive_multipart_receive(http_request, mock_response): response = mock_response( request, - body_as_str.encode('ascii'), - "multipart/mixed; boundary=batchresponse_8d5f5bcd-2cb5-44bb-91b5-e9a722e68cb6" + body_as_str.encode("ascii"), + "multipart/mixed; boundary=batchresponse_8d5f5bcd-2cb5-44bb-91b5-e9a722e68cb6", ) parts = [] @@ -986,6 +967,7 @@ async def test_recursive_multipart_receive(http_request, mock_response): def test_aiohttp_loop(): import asyncio from azure.core.pipeline.transport import AioHttpTransport + loop = asyncio.get_event_loop() with pytest.raises(ValueError): transport = AioHttpTransport(loop=loop) diff --git a/sdk/core/azure-core/tests/async_tests/test_http_logging_policy_async.py b/sdk/core/azure-core/tests/async_tests/test_http_logging_policy_async.py index e8e5b1b80236..0f28c70c2c4b 100644 --- a/sdk/core/azure-core/tests/async_tests/test_http_logging_policy_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_http_logging_policy_async.py @@ -9,27 +9,26 @@ import pytest import sys from unittest.mock import Mock -from azure.core.pipeline import ( - PipelineResponse, - PipelineRequest, - PipelineContext -) +from azure.core.pipeline import PipelineResponse, PipelineRequest, PipelineContext from azure.core.pipeline.policies import ( HttpLoggingPolicy, ) from utils import HTTP_RESPONSES, request_and_responses_product, create_http_response + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_http_logger(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -38,7 +37,7 @@ def emit(self, record): policy = HttpLoggingPolicy(logger=logger) - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") http_response = create_http_response(http_response, universal_request, None) http_response.status_code = 202 request = PipelineRequest(universal_request, PipelineContext(None)) @@ -49,16 +48,16 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'No body was attached to the request' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "No body was attached to the request" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" mock_handler.reset() @@ -72,7 +71,7 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 4 messages_request1 = mock_handler.messages[0].message.split("\n") messages_response1 = mock_handler.messages[1].message.split("\n") @@ -80,22 +79,22 @@ def emit(self, record): messages_response2 = mock_handler.messages[3].message.split("\n") assert messages_request1[0] == "Request URL: 'http://localhost/'" assert messages_request1[1] == "Request method: 'GET'" - assert messages_request1[2] == 'Request headers:' - assert messages_request1[3] == 'No body was attached to the request' - assert messages_response1[0] == 'Response status: 202' - assert messages_response1[1] == 'Response headers:' + assert messages_request1[2] == "Request headers:" + assert messages_request1[3] == "No body was attached to the request" + assert messages_response1[0] == "Response status: 202" + assert messages_response1[1] == "Response headers:" assert messages_request2[0] == "Request URL: 'http://localhost/'" assert messages_request2[1] == "Request method: 'GET'" - assert messages_request2[2] == 'Request headers:' - assert messages_request2[3] == 'No body was attached to the request' - assert messages_response2[0] == 'Response status: 202' - assert messages_response2[1] == 'Response headers:' + assert messages_request2[2] == "Request headers:" + assert messages_request2[3] == "No body was attached to the request" + assert messages_response2[0] == "Response status: 202" + assert messages_response2[1] == "Response headers:" mock_handler.reset() # Headers and query parameters - policy.allowed_query_params = ['country'] + policy.allowed_query_params = ["country"] universal_request.headers = { "Accept": "Caramel", @@ -111,7 +110,7 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") @@ -119,39 +118,31 @@ def emit(self, record): assert messages_request[1] == "Request method: 'GET'" assert messages_request[2] == "Request headers:" # Dict not ordered in Python, exact logging order doesn't matter - assert set([ - messages_request[3], - messages_request[4] - ]) == set([ - " 'Accept': 'Caramel'", - " 'Hate': 'REDACTED'" - ]) - assert messages_request[5] == 'No body was attached to the request' + assert set([messages_request[3], messages_request[4]]) == set([" 'Accept': 'Caramel'", " 'Hate': 'REDACTED'"]) + assert messages_request[5] == "No body was attached to the request" assert messages_response[0] == "Response status: 202" assert messages_response[1] == "Response headers:" # Dict not ordered in Python, exact logging order doesn't matter - assert set([ - messages_response[2], - messages_response[3] - ]) == set([ - " 'Content-Type': 'Caramel'", - " 'HateToo': 'REDACTED'" - ]) + assert set([messages_response[2], messages_response[3]]) == set( + [" 'Content-Type': 'Caramel'", " 'HateToo': 'REDACTED'"] + ) mock_handler.reset() @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_http_logger_operation_level(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -159,9 +150,9 @@ def emit(self, record): logger.setLevel(logging.DEBUG) policy = HttpLoggingPolicy() - kwargs={'logger': logger} + kwargs = {"logger": logger} - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") http_response = create_http_response(http_response, universal_request, None) http_response.status_code = 202 request = PipelineRequest(universal_request, PipelineContext(None, **kwargs)) @@ -172,16 +163,16 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'No body was attached to the request' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "No body was attached to the request" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" mock_handler.reset() @@ -197,7 +188,7 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 4 messages_request1 = mock_handler.messages[0].message.split("\n") messages_response1 = mock_handler.messages[1].message.split("\n") @@ -205,30 +196,33 @@ def emit(self, record): messages_response2 = mock_handler.messages[3].message.split("\n") assert messages_request1[0] == "Request URL: 'http://localhost/'" assert messages_request1[1] == "Request method: 'GET'" - assert messages_request1[2] == 'Request headers:' - assert messages_request1[3] == 'No body was attached to the request' - assert messages_response1[0] == 'Response status: 202' - assert messages_response1[1] == 'Response headers:' + assert messages_request1[2] == "Request headers:" + assert messages_request1[3] == "No body was attached to the request" + assert messages_response1[0] == "Response status: 202" + assert messages_response1[1] == "Response headers:" assert messages_request2[0] == "Request URL: 'http://localhost/'" assert messages_request2[1] == "Request method: 'GET'" - assert messages_request2[2] == 'Request headers:' - assert messages_request2[3] == 'No body was attached to the request' - assert messages_response2[0] == 'Response status: 202' - assert messages_response2[1] == 'Response headers:' + assert messages_request2[2] == "Request headers:" + assert messages_request2[3] == "No body was attached to the request" + assert messages_response2[0] == "Response status: 202" + assert messages_response2[1] == "Response headers:" mock_handler.reset() + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_http_logger_with_body(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -237,7 +231,7 @@ def emit(self, record): policy = HttpLoggingPolicy(logger=logger) - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") universal_request.body = "testbody" http_response = create_http_response(http_response, universal_request, None) http_response.status_code = 202 @@ -247,16 +241,16 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'A body is sent with the request' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "A body is sent with the request" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" mock_handler.reset() @@ -264,15 +258,17 @@ def emit(self, record): @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) @pytest.mark.skipif(sys.version_info < (3, 6), reason="types.AsyncGeneratorType does not exist in 3.5") def test_http_logger_with_generator_body(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -281,7 +277,7 @@ def emit(self, record): policy = HttpLoggingPolicy(logger=logger) - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") mock = Mock() mock.__class__ = types.AsyncGeneratorType universal_request.body = mock @@ -293,15 +289,15 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'File upload' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "File upload" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" mock_handler.reset() diff --git a/sdk/core/azure-core/tests/async_tests/test_paging_async.py b/sdk/core/azure-core/tests/async_tests/test_paging_async.py index 0cb60339aa8b..3f372ddba8fe 100644 --- a/sdk/core/azure-core/tests/async_tests/test_paging_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_paging_async.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- from typing import AsyncIterator, TypeVar, List @@ -48,96 +48,72 @@ async def _as_list(async_iter: AsyncIterator[T]) -> List[T]: class TestPaging: - @pytest.mark.asyncio async def test_basic_paging(self): - async def get_next(continuation_token=None): - """Simplify my life and return JSON and not response, but should be response. - """ + """Simplify my life and return JSON and not response, but should be response.""" if not continuation_token: - return { - 'nextLink': 'page2', - 'value': ['value1.0', 'value1.1'] - } + return {"nextLink": "page2", "value": ["value1.0", "value1.1"]} else: - return { - 'nextLink': None, - 'value': ['value2.0', 'value2.1'] - } + return {"nextLink": None, "value": ["value2.0", "value2.1"]} async def extract_data(response): - return response['nextLink'], AsyncList(response['value']) + return response["nextLink"], AsyncList(response["value"]) pager = AsyncItemPaged(get_next, extract_data) result_iterated = await _as_list(pager) - assert ['value1.0', 'value1.1', 'value2.0', 'value2.1'] == result_iterated + assert ["value1.0", "value1.1", "value2.0", "value2.1"] == result_iterated @pytest.mark.asyncio async def test_advance_paging(self): - async def get_next(continuation_token=None): - """Simplify my life and return JSON and not response, but should be response. - """ + """Simplify my life and return JSON and not response, but should be response.""" if not continuation_token: - return { - 'nextLink': 'page2', - 'value': ['value1.0', 'value1.1'] - } + return {"nextLink": "page2", "value": ["value1.0", "value1.1"]} else: - return { - 'nextLink': None, - 'value': ['value2.0', 'value2.1'] - } + return {"nextLink": None, "value": ["value2.0", "value2.1"]} async def extract_data(response): - return response['nextLink'], AsyncList(response['value']) + return response["nextLink"], AsyncList(response["value"]) pager = AsyncItemPaged(get_next, extract_data).by_page() page1 = await pager.__anext__() - assert ['value1.0', 'value1.1'] == await _as_list(page1) + assert ["value1.0", "value1.1"] == await _as_list(page1) page2 = await pager.__anext__() - assert ['value2.0', 'value2.1'] == await _as_list(page2) + assert ["value2.0", "value2.1"] == await _as_list(page2) with pytest.raises(StopAsyncIteration): await pager.__anext__() - @pytest.mark.asyncio async def test_none_value(self): async def get_next(continuation_token=None): - return { - 'nextLink': None, - 'value': None - } + return {"nextLink": None, "value": None} async def extract_data(response): - return response['nextLink'], AsyncList(response['value'] or []) + return response["nextLink"], AsyncList(response["value"] or []) pager = AsyncItemPaged(get_next, extract_data) result_iterated = await _as_list(pager) assert len(result_iterated) == 0 - @pytest.mark.asyncio async def test_paging_continue_on_error(self): async def get_next(continuation_token=None): if not continuation_token: - return { - 'nextLink': 'foo', - 'value': ['bar'] - } + return {"nextLink": "foo", "value": ["bar"]} else: raise HttpResponseError() + async def extract_data(response): - return response['nextLink'], iter(response['value'] or []) - + return response["nextLink"], iter(response["value"] or []) + pager = AsyncItemPaged(get_next, extract_data) - assert await pager.__anext__() == 'bar' + assert await pager.__anext__() == "bar" with pytest.raises(HttpResponseError) as err: await pager.__anext__() - assert err.value.continuation_token == 'foo' + assert err.value.continuation_token == "foo" diff --git a/sdk/core/azure-core/tests/async_tests/test_pipeline_async.py b/sdk/core/azure-core/tests/async_tests/test_pipeline_async.py index d72f716052da..0dfbbfdf01e1 100644 --- a/sdk/core/azure-core/tests/async_tests/test_pipeline_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_pipeline_async.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import sys from azure.core.pipeline import AsyncPipeline @@ -40,7 +40,7 @@ AsyncHttpTransport, AsyncioRequestsTransport, TrioRequestsTransport, - AioHttpTransport + AioHttpTransport, ) from azure.core.polling.async_base_polling import AsyncLROBasePolling @@ -76,7 +76,7 @@ async def __aexit__(self, exc_type, exc_value, traceback): pipeline = AsyncPipeline(BrokenSender(), [SansIOHTTPPolicy()]) - req = http_request('GET', '/') + req = http_request("GET", "/") with pytest.raises(ValueError): await pipeline.run(req) @@ -89,15 +89,13 @@ def on_exception(self, requests, **kwargs): with pytest.raises(NotImplementedError): await pipeline.run(req) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_basic_aiohttp(port, http_request): request = http_request("GET", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), AsyncRedirectPolicy()] async with AsyncPipeline(AioHttpTransport(), policies=policies) as pipeline: response = await pipeline.run(request) @@ -105,16 +103,14 @@ async def test_basic_aiohttp(port, http_request): # all we need to check is if we are able to make the call assert isinstance(response.http_response.status_code, int) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_basic_aiohttp_separate_session(port, http_request): session = aiohttp.ClientSession() request = http_request("GET", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), AsyncRedirectPolicy()] transport = AioHttpTransport(session=session, session_owner=False) async with AsyncPipeline(transport, policies=policies) as pipeline: response = await pipeline.run(request) @@ -125,20 +121,19 @@ async def test_basic_aiohttp_separate_session(port, http_request): assert transport.session await transport.session.close() + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_basic_async_requests(port, http_request): request = http_request("GET", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), AsyncRedirectPolicy()] async with AsyncPipeline(AsyncioRequestsTransport(), policies=policies) as pipeline: response = await pipeline.run(request) assert isinstance(response.http_response.status_code, int) + @pytest.mark.asyncio async def test_async_transport_sleep(): @@ -148,26 +143,27 @@ async def test_async_transport_sleep(): async with AioHttpTransport() as transport: await transport.sleep(1) + def test_polling_with_path_format_arguments(): - method = AsyncLROBasePolling( - timeout=0, - path_format_arguments={"host": "host:3000", "accountName": "local"} - ) + method = AsyncLROBasePolling(timeout=0, path_format_arguments={"host": "host:3000", "accountName": "local"}) client = AsyncPipelineClient(base_url="http://{accountName}{host}") method._operation = LocationPolling() method._operation._location_url = "/results/1" method._client = client - assert "http://localhost:3000/results/1" == method._client.format_url(method._operation.get_polling_url(), **method._path_format_arguments) + assert "http://localhost:3000/results/1" == method._client.format_url( + method._operation.get_polling_url(), **method._path_format_arguments + ) -def test_async_trio_transport_sleep(): +def test_async_trio_transport_sleep(): async def do(): async with TrioRequestsTransport() as transport: await transport.sleep(1) response = trio.run(do) + def test_default_http_logging_policy(): config = Configuration() pipeline_client = AsyncPipelineClient(base_url="test") @@ -176,70 +172,70 @@ def test_default_http_logging_policy(): assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST + def test_pass_in_http_logging_policy(): config = Configuration() http_logging_policy = HttpLoggingPolicy() - http_logging_policy.allowed_header_names.update( - {"x-ms-added-header"} - ) + http_logging_policy.allowed_header_names.update({"x-ms-added-header"}) config.http_logging_policy = http_logging_policy pipeline_client = AsyncPipelineClient(base_url="test") pipeline = pipeline_client._build_pipeline(config) http_logging_policy = pipeline._impl_policies[-1]._policy - assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union({"x-ms-added-header"}) - assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union({"x-ms-added-header"}) + assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union( + {"x-ms-added-header"} + ) + assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union( + {"x-ms-added-header"} + ) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_conf_async_requests(port, http_request): request = http_request("GET", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), AsyncRedirectPolicy()] async with AsyncPipeline(AsyncioRequestsTransport(), policies=policies) as pipeline: response = await pipeline.run(request) assert isinstance(response.http_response.status_code, int) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_conf_async_trio_requests(port, http_request): - async def do(): request = http_request("GET", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - AsyncRedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), AsyncRedirectPolicy()] async with AsyncPipeline(TrioRequestsTransport(), policies=policies) as pipeline: return await pipeline.run(request) response = trio.run(do) assert isinstance(response.http_response.status_code, int) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_retry_without_http_response(http_request): class NaughtyPolicy(AsyncHTTPPolicy): def send(*args): - raise AzureError('boo') + raise AzureError("boo") policies = [AsyncRetryPolicy(), NaughtyPolicy()] pipeline = AsyncPipeline(policies=policies, transport=None) with pytest.raises(AzureError): - await pipeline.run(http_request('GET', url='https://foo.bar')) + await pipeline.run(http_request("GET", url="https://foo.bar")) + @pytest.mark.asyncio async def test_add_custom_policy(): class BooPolicy(AsyncHTTPPolicy): def send(*args): - raise AzureError('boo') + raise AzureError("boo") class FooPolicy(AsyncHTTPPolicy): def send(*args): - raise AzureError('boo') + raise AzureError("boo") config = Configuration() retry_policy = AsyncRetryPolicy() @@ -274,8 +270,9 @@ def send(*args): pos_retry = policies.index(retry_policy) assert pos_boo > pos_retry - client = AsyncPipelineClient(base_url="test", config=config, per_call_policies=boo_policy, - per_retry_policies=foo_policy) + client = AsyncPipelineClient( + base_url="test", config=config, per_call_policies=boo_policy, per_retry_policies=foo_policy + ) policies = client._pipeline._impl_policies assert boo_policy in policies assert foo_policy in policies @@ -285,8 +282,9 @@ def send(*args): assert pos_boo < pos_retry assert pos_foo > pos_retry - client = AsyncPipelineClient(base_url="test", config=config, per_call_policies=[boo_policy], - per_retry_policies=[foo_policy]) + client = AsyncPipelineClient( + base_url="test", config=config, per_call_policies=[boo_policy], per_retry_policies=[foo_policy] + ) policies = client._pipeline._impl_policies assert boo_policy in policies assert foo_policy in policies @@ -296,9 +294,7 @@ def send(*args): assert pos_boo < pos_retry assert pos_foo > pos_retry - policies = [UserAgentPolicy(), - AsyncRetryPolicy(), - DistributedTracingPolicy()] + policies = [UserAgentPolicy(), AsyncRetryPolicy(), DistributedTracingPolicy()] client = AsyncPipelineClient(base_url="test", policies=policies, per_call_policies=boo_policy) actual_policies = client._pipeline._impl_policies assert boo_policy == actual_policies[0] @@ -313,19 +309,20 @@ def send(*args): actual_policies = client._pipeline._impl_policies assert foo_policy == actual_policies[2] - client = AsyncPipelineClient(base_url="test", policies=policies, per_call_policies=boo_policy, - per_retry_policies=[foo_policy]) + client = AsyncPipelineClient( + base_url="test", policies=policies, per_call_policies=boo_policy, per_retry_policies=[foo_policy] + ) actual_policies = client._pipeline._impl_policies assert boo_policy == actual_policies[0] assert foo_policy == actual_policies[3] - client = AsyncPipelineClient(base_url="test", policies=policies, per_call_policies=[boo_policy], - per_retry_policies=[foo_policy]) + client = AsyncPipelineClient( + base_url="test", policies=policies, per_call_policies=[boo_policy], per_retry_policies=[foo_policy] + ) actual_policies = client._pipeline._impl_policies assert boo_policy == actual_policies[0] assert foo_policy == actual_policies[3] - policies = [UserAgentPolicy(), - DistributedTracingPolicy()] + policies = [UserAgentPolicy(), DistributedTracingPolicy()] with pytest.raises(ValueError): client = AsyncPipelineClient(base_url="test", policies=policies, per_retry_policies=foo_policy) with pytest.raises(ValueError): diff --git a/sdk/core/azure-core/tests/async_tests/test_polling_async.py b/sdk/core/azure-core/tests/async_tests/test_polling_async.py index 469f30ba42f3..45f1227fbb7c 100644 --- a/sdk/core/azure-core/tests/async_tests/test_polling_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_polling_async.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,9 +22,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import asyncio import time + try: from unittest import mock except ImportError: @@ -35,6 +36,7 @@ from azure.core import AsyncPipelineClient from azure.core.polling import * from azure.core.exceptions import ServiceResponseError + # from msrest.serialization import Model @@ -49,34 +51,33 @@ async def test_no_polling(client): no_polling = AsyncNoPolling() initial_response = "initial response" + def deserialization_cb(response): assert response == initial_response - return "Treated: "+response + return "Treated: " + response no_polling.initialize(client, initial_response, deserialization_cb) - await no_polling.run() # Should no raise and do nothing + await no_polling.run() # Should no raise and do nothing assert no_polling.status() == "succeeded" assert no_polling.finished() - assert no_polling.resource() == "Treated: "+initial_response + assert no_polling.resource() == "Treated: " + initial_response continuation_token = no_polling.get_continuation_token() assert isinstance(continuation_token, str) no_polling_revived_args = NoPolling.from_continuation_token( - continuation_token, - deserialization_callback=deserialization_cb, - client=client + continuation_token, deserialization_callback=deserialization_cb, client=client ) no_polling_revived = NoPolling() no_polling_revived.initialize(*no_polling_revived_args) assert no_polling_revived.status() == "succeeded" assert no_polling_revived.finished() - assert no_polling_revived.resource() == "Treated: "+initial_response + assert no_polling_revived.resource() == "Treated: " + initial_response class PollingTwoSteps(AsyncPollingMethod): - """An empty poller that returns the deserialized initial response. - """ + """An empty poller that returns the deserialized initial response.""" + def __init__(self, sleep=0): self._initial_response = None self._deserialization_callback = None @@ -88,10 +89,9 @@ def initialize(self, _, initial_response, deserialization_callback): self._finished = False async def run(self): - """Empty run, no polling. - """ + """Empty run, no polling.""" self._finished = True - await asyncio.sleep(self._sleep) # Give me time to add callbacks! + await asyncio.sleep(self._sleep) # Give me time to add callbacks! def status(self): """Return the current status as a string. @@ -115,7 +115,7 @@ def get_continuation_token(self): def from_continuation_token(cls, continuation_token, **kwargs): # type(str, Any) -> Tuple initial_response = continuation_token - deserialization_callback = kwargs['deserialization_callback'] + deserialization_callback = kwargs["deserialization_callback"] return None, initial_response, deserialization_callback @@ -128,7 +128,7 @@ async def test_poller(client): # Same for deserialization_callback, just pass to the polling_method def deserialization_callback(response): assert response == initial_response - return "Treated: "+response + return "Treated: " + response method = AsyncNoPolling() @@ -140,7 +140,7 @@ def deserialization_callback(response): result = await poller assert poller.done() - assert result == "Treated: "+initial_response + assert result == "Treated: " + initial_response assert raw_poller.status() == "succeeded" assert raw_poller.polling_method() is method done_cb.assert_called_once_with(poller) @@ -160,7 +160,7 @@ def deserialization_callback(response): poller.remove_done_callback(done_cb2) result = await poller - assert result == "Treated: "+initial_response + assert result == "Treated: " + initial_response assert raw_poller.status() == "succeeded" done_cb.assert_called_once_with(poller) done_cb2.assert_not_called() @@ -174,23 +174,23 @@ def deserialization_callback(response): client=client, initial_response=initial_response, deserialization_callback=deserialization_callback, - polling_method=method + polling_method=method, ) result = await new_poller.result() - assert result == "Treated: "+initial_response + assert result == "Treated: " + initial_response assert new_poller.status() == "succeeded" @pytest.mark.asyncio async def test_broken_poller(client): - class NoPollingError(PollingTwoSteps): async def run(self): raise ValueError("Something bad happened") initial_response = "Initial response" + def deserialization_callback(response): - return "Treated: "+response + return "Treated: " + response method = NoPollingError() poller = AsyncLROPoller(client, initial_response, deserialization_callback, method) @@ -202,14 +202,14 @@ def deserialization_callback(response): @pytest.mark.asyncio async def test_async_poller_error_continuation(client): - class NoPollingError(PollingTwoSteps): async def run(self): raise ServiceResponseError("Something bad happened") initial_response = "Initial response" + def deserialization_callback(response): - return "Treated: "+response + return "Treated: " + response method = NoPollingError() poller = AsyncLROPoller(client, initial_response, deserialization_callback, method) diff --git a/sdk/core/azure-core/tests/async_tests/test_request_asyncio.py b/sdk/core/azure-core/tests/async_tests/test_request_asyncio.py index 189a09eaccb4..753c0e146acb 100644 --- a/sdk/core/azure-core/tests/async_tests/test_request_asyncio.py +++ b/sdk/core/azure-core/tests/async_tests/test_request_asyncio.py @@ -28,18 +28,19 @@ async def __anext__(self): raise StopAsyncIteration async with AsyncioRequestsTransport() as transport: - req = http_request('GET', 'http://localhost:{}/basic/anything'.format(port), data=AsyncGen()) + req = http_request("GET", "http://localhost:{}/basic/anything".format(port), data=AsyncGen()) response = await transport.send(req) if is_rest(http_request): assert is_rest(response) - assert json.loads(response.text())['data'] == "azerty" + assert json.loads(response.text())["data"] == "azerty" + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_send_data(port, http_request): async with AsyncioRequestsTransport() as transport: - req = http_request('PUT', 'http://localhost:{}/basic/anything'.format(port), data=b"azerty") + req = http_request("PUT", "http://localhost:{}/basic/anything".format(port), data=b"azerty") response = await transport.send(req) if is_rest(http_request): assert is_rest(response) - assert json.loads(response.text())['data'] == "azerty" + assert json.loads(response.text())["data"] == "azerty" diff --git a/sdk/core/azure-core/tests/async_tests/test_request_trio.py b/sdk/core/azure-core/tests/async_tests/test_request_trio.py index 092a550cb67b..668e07288824 100644 --- a/sdk/core/azure-core/tests/async_tests/test_request_trio.py +++ b/sdk/core/azure-core/tests/async_tests/test_request_trio.py @@ -29,18 +29,19 @@ async def __anext__(self): raise StopAsyncIteration async with TrioRequestsTransport() as transport: - req = http_request('GET', 'http://localhost:{}/basic/anything'.format(port), data=AsyncGen()) + req = http_request("GET", "http://localhost:{}/basic/anything".format(port), data=AsyncGen()) response = await transport.send(req) if is_rest(http_request): assert is_rest(response) - assert json.loads(response.text())['data'] == "azerty" + assert json.loads(response.text())["data"] == "azerty" + @pytest.mark.trio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_send_data(port, http_request): async with TrioRequestsTransport() as transport: - req = http_request('PUT', 'http://localhost:{}/basic/anything'.format(port), data=b"azerty") + req = http_request("PUT", "http://localhost:{}/basic/anything".format(port), data=b"azerty") response = await transport.send(req) if is_rest(http_request): assert is_rest(response) - assert json.loads(response.text())['data'] == "azerty" \ No newline at end of file + assert json.loads(response.text())["data"] == "azerty" diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py b/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py index cfa7af589937..194efb4a8dde 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py @@ -11,12 +11,14 @@ import pytest from utils import readonly_checks + @pytest.fixture async def client(port): async with AsyncioRequestsTransport() as transport: async with AsyncTestRestClient(port, transport=transport) as client: yield client + @pytest.mark.asyncio async def test_async_gen_data(port, client): class AsyncGen: @@ -32,16 +34,18 @@ async def __anext__(self): except StopIteration: raise StopAsyncIteration - request = HttpRequest('GET', 'http://localhost:{}/basic/anything'.format(port), content=AsyncGen()) + request = HttpRequest("GET", "http://localhost:{}/basic/anything".format(port), content=AsyncGen()) response = await client.send_request(request) - assert response.json()['data'] == "azerty" + assert response.json()["data"] == "azerty" + @pytest.mark.asyncio async def test_send_data(port, client): - request = HttpRequest('PUT', 'http://localhost:{}/basic/anything'.format(port), content=b"azerty") + request = HttpRequest("PUT", "http://localhost:{}/basic/anything".format(port), content=b"azerty") response = await client.send_request(request) - assert response.json()['data'] == "azerty" + assert response.json()["data"] == "azerty" + @pytest.mark.asyncio async def test_readonly(client): @@ -51,8 +55,10 @@ async def test_readonly(client): assert isinstance(response, RestAsyncioRequestsTransportResponse) from azure.core.pipeline.transport import AsyncioRequestsTransportResponse + readonly_checks(response, old_response_class=AsyncioRequestsTransportResponse) + @pytest.mark.asyncio async def test_decompress_compressed_header(client): # expect plain text @@ -63,6 +69,7 @@ async def test_decompress_compressed_header(client): assert response.content == content assert response.text() == "hello world" + @pytest.mark.asyncio async def test_deflate_decompress_compressed_header(client): # expect plain text @@ -73,6 +80,7 @@ async def test_deflate_decompress_compressed_header(client): assert response.content == content assert response.text() == "hi there" + @pytest.mark.asyncio async def test_decompress_compressed_header_stream(client): # expect plain text @@ -83,6 +91,7 @@ async def test_decompress_compressed_header_stream(client): assert response.content == content assert response.text() == "hello world" + @pytest.mark.asyncio async def test_decompress_compressed_header_stream_body_content(client): # expect plain text diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_context_manager_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_context_manager_async.py index 6866baa41f42..5aebfd5b9ed3 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_context_manager_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_context_manager_async.py @@ -9,12 +9,14 @@ from azure.core.rest import HttpRequest from rest_client_async import AsyncTestRestClient + @pytest.mark.asyncio async def test_normal_call(client): async def _raise_and_get_text(response): response.raise_for_status() assert response.text() == "Hello, world!" assert response.is_closed + request = HttpRequest("GET", url="/basic/string") response = await client.send_request(request) await _raise_and_get_text(response) @@ -27,6 +29,7 @@ async def _raise_and_get_text(response): async with response as response: await _raise_and_get_text(response) + @pytest.mark.asyncio async def test_stream_call(client): async def _raise_and_get_text(response): @@ -37,6 +40,7 @@ async def _raise_and_get_text(response): await response.read() assert response.text() == "Hello, world!" assert response.is_closed + request = HttpRequest("GET", url="/streams/basic") response = await client.send_request(request, stream=True) await _raise_and_get_text(response) @@ -50,6 +54,7 @@ async def _raise_and_get_text(response): async with response as response: await _raise_and_get_text(response) + # TODO: commenting until https://github.com/Azure/azure-sdk-for-python/issues/18086 is fixed # @pytest.mark.asyncio @@ -79,4 +84,4 @@ async def _raise_and_get_text(response): # assert error.error.code == "BadRequest" # assert error.error.message == "You made a bad request" # assert error.model.code == "BadRequest" -# assert error.error.message == "You made a bad request" \ No newline at end of file +# assert error.error.message == "You made a bad request" diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py index 3b61c59b69d5..a0156b8ed738 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py @@ -19,6 +19,7 @@ "Date", ] + @pytest.fixture def get_response_headers(client): async def _get_response_headers(request): @@ -27,8 +28,10 @@ async def _get_response_headers(request): for header in RESPONSE_HEADERS_TO_IGNORE: response.headers.pop(header, None) return response.headers + return _get_response_headers + @pytest.mark.asyncio async def test_headers_response(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) @@ -45,7 +48,7 @@ async def test_headers_response(get_response_headers): assert h.get("nope", default="default") is "default" assert h.get("nope", default=None) is None assert h.get("nope", default=[]) == [] - assert list(h) == ['a', 'b'] + assert list(h) == ["a", "b"] assert list(h.keys()) == ["a", "b"] assert list(h.values()) == ["123, 456", "789"] @@ -53,6 +56,7 @@ async def test_headers_response(get_response_headers): assert list(h) == ["a", "b"] assert dict(h) == {"a": "123, 456", "b": "789"} + @pytest.mark.asyncio async def test_headers_response_keys(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) @@ -66,14 +70,18 @@ async def test_headers_response_keys(get_response_headers): assert "B" in h.keys() assert set(h.keys()) == set(ref_dict.keys()) -@pytest.mark.skipif(platform.python_implementation() == 'PyPy', reason="https://github.com/aio-libs/aiohttp/issues/5967") + +@pytest.mark.skipif( + platform.python_implementation() == "PyPy", reason="https://github.com/aio-libs/aiohttp/issues/5967" +) @pytest.mark.asyncio async def test_headers_response_keys_mutability(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) # test mutability before_mutation_keys = h.keys() - h['c'] = '000' - assert 'c' in before_mutation_keys + h["c"] = "000" + assert "c" in before_mutation_keys + @pytest.mark.asyncio async def test_headers_response_values(get_response_headers): @@ -82,18 +90,22 @@ async def test_headers_response_values(get_response_headers): ref_dict = {"a": "123, 456", "b": "789"} assert list(h.values()) == list(ref_dict.values()) assert repr(h.values()) == repr(ref_dict.values()) - assert '123, 456' in h.values() - assert '789' in h.values() + assert "123, 456" in h.values() + assert "789" in h.values() assert set(h.values()) == set(ref_dict.values()) -@pytest.mark.skipif(platform.python_implementation() == 'PyPy', reason="https://github.com/aio-libs/aiohttp/issues/5967") + +@pytest.mark.skipif( + platform.python_implementation() == "PyPy", reason="https://github.com/aio-libs/aiohttp/issues/5967" +) @pytest.mark.asyncio async def test_headers_response_values_mutability(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) # test mutability before_mutation_values = h.values() - h['c'] = '000' - assert '000' in before_mutation_values + h["c"] = "000" + assert "000" in before_mutation_values + @pytest.mark.asyncio async def test_headers_response_items(get_response_headers): @@ -102,22 +114,26 @@ async def test_headers_response_items(get_response_headers): ref_dict = {"a": "123, 456", "b": "789"} assert list(h.items()) == list(ref_dict.items()) assert repr(h.items()) == repr(ref_dict.items()) - assert ("a", '123, 456') in h.items() - assert not ("a", '123, 456', '123, 456') in h.items() + assert ("a", "123, 456") in h.items() + assert not ("a", "123, 456", "123, 456") in h.items() assert not {"a": "blah", "123, 456": "blah"} in h.items() - assert ("A", '123, 456') in h.items() - assert ("b", '789') in h.items() - assert ("B", '789') in h.items() + assert ("A", "123, 456") in h.items() + assert ("b", "789") in h.items() + assert ("B", "789") in h.items() assert set(h.items()) == set(ref_dict.items()) -@pytest.mark.skipif(platform.python_implementation() == 'PyPy', reason="https://github.com/aio-libs/aiohttp/issues/5967") + +@pytest.mark.skipif( + platform.python_implementation() == "PyPy", reason="https://github.com/aio-libs/aiohttp/issues/5967" +) @pytest.mark.asyncio async def test_headers_response_items_mutability(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) # test mutability before_mutation_items = h.items() - h['c'] = '000' - assert ('c', '000') in before_mutation_items + h["c"] = "000" + assert ("c", "000") in before_mutation_items + @pytest.mark.asyncio async def test_header_mutations(get_response_headers): @@ -134,6 +150,7 @@ async def test_header_mutations(get_response_headers): del h["a"] assert dict(h) == {"b": "4"} + @pytest.mark.asyncio async def test_copy_headers_method(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/case-insensitive")) @@ -141,77 +158,80 @@ async def test_copy_headers_method(get_response_headers): assert h == headers_copy assert h is not headers_copy + @pytest.mark.asyncio async def test_headers_insert_retains_ordering(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/ordered")) h["b"] = "123" assert list(h.values()) == ["a", "123", "c"] + @pytest.mark.asyncio async def test_headers_insert_appends_if_new(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/case-insensitive")) h["d"] = "123" assert list(h.values()) == ["lowercase", "ALLCAPS", "camelCase", "123"] + @pytest.mark.asyncio async def test_headers_insert_removes_all_existing(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) h["a"] = "789" assert dict(h) == {"a": "789", "b": "789"} + @pytest.mark.asyncio async def test_headers_delete_removes_all_existing(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) del h["a"] assert dict(h) == {"b": "789"} + @pytest.mark.asyncio async def test_response_headers_case_insensitive(client): request = HttpRequest("GET", "/headers/case-insensitive") response = await client.send_request(request) response.raise_for_status() assert ( - response.headers["lowercase-header"] == - response.headers["LOWERCASE-HEADER"] == - response.headers["Lowercase-Header"] == - response.headers["lOwErCasE-HeADer"] == - "lowercase" + response.headers["lowercase-header"] + == response.headers["LOWERCASE-HEADER"] + == response.headers["Lowercase-Header"] + == response.headers["lOwErCasE-HeADer"] + == "lowercase" ) assert ( - response.headers["allcaps-header"] == - response.headers["ALLCAPS-HEADER"] == - response.headers["Allcaps-Header"] == - response.headers["AlLCapS-HeADer"] == - "ALLCAPS" + response.headers["allcaps-header"] + == response.headers["ALLCAPS-HEADER"] + == response.headers["Allcaps-Header"] + == response.headers["AlLCapS-HeADer"] + == "ALLCAPS" ) assert ( - response.headers["camelcase-header"] == - response.headers["CAMELCASE-HEADER"] == - response.headers["CamelCase-Header"] == - response.headers["cAMeLCaSE-hEadER"] == - "camelCase" + response.headers["camelcase-header"] + == response.headers["CAMELCASE-HEADER"] + == response.headers["CamelCase-Header"] + == response.headers["cAMeLCaSE-hEadER"] + == "camelCase" ) return response + @pytest.mark.asyncio async def test_multiple_headers_duplicate_case_insensitive(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/case-insensitive")) - assert ( - h["Duplicate-Header"] == - h['duplicate-header'] == - h['DupLicAte-HeaDER'] == - "one, two, three" - ) + assert h["Duplicate-Header"] == h["duplicate-header"] == h["DupLicAte-HeaDER"] == "one, two, three" + @pytest.mark.asyncio async def test_multiple_headers_commas(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/commas")) assert h["Set-Cookie"] == "a, b, c" + @pytest.mark.asyncio async def test_update(get_response_headers): h = await get_response_headers(HttpRequest("GET", "/headers/duplicate/commas")) assert h["Set-Cookie"] == "a, b, c" h.update({"Set-Cookie": "override", "new-key": "new-value"}) - assert h['Set-Cookie'] == 'override' + assert h["Set-Cookie"] == "override" assert h["new-key"] == "new-value" diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_http_request_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_http_request_async.py index 5ec0e71d0843..84f6926c7a32 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_http_request_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_http_request_async.py @@ -10,6 +10,7 @@ from azure.core.rest import HttpRequest import collections.abc + @pytest.fixture def assert_aiterator_body(): async def _comparer(request, final_value): @@ -18,8 +19,10 @@ async def _comparer(request, final_value): parts.append(part) content = b"".join(parts) assert content == final_value + return _comparer + def test_transfer_encoding_header(): async def streaming_body(data): yield data # pragma: nocover @@ -29,6 +32,7 @@ async def streaming_body(data): request = HttpRequest("POST", "http://example.org", data=data) assert "Content-Length" not in request.headers + def test_override_content_length_header(): async def streaming_body(data): yield data # pragma: nocover @@ -39,8 +43,9 @@ async def streaming_body(data): request = HttpRequest("POST", "http://example.org", data=data, headers=headers) assert request.headers["Content-Length"] == "0" + @pytest.mark.asyncio -async def test_aiterable_content(assert_aiterator_body): # cspell:disable-line +async def test_aiterable_content(assert_aiterator_body): # cspell:disable-line class Content: async def __aiter__(self): yield b"test 123" @@ -49,6 +54,7 @@ async def __aiter__(self): assert request.headers == {} await assert_aiterator_body(request, b"test 123") + @pytest.mark.asyncio async def test_aiterator_content(assert_aiterator_body): async def hello_world(): @@ -78,6 +84,7 @@ async def hello_world(): assert request.headers == {} await assert_aiterator_body(request, b"Hello, world!") + @pytest.mark.asyncio async def test_read_content(assert_aiterator_body): async def content(): diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py index aac14a6c27f6..5945aafb4abf 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py @@ -14,6 +14,7 @@ from azure.core.exceptions import HttpResponseError from utils import readonly_checks + @pytest.fixture def send_request(client): async def _send_request(request): @@ -21,8 +22,10 @@ async def _send_request(request): response = await client.send_request(request, stream=False) response.raise_for_status() return response + return _send_request + @pytest.mark.asyncio async def test_response(send_request, port): response = await send_request( @@ -35,6 +38,7 @@ async def test_response(send_request, port): assert response.request.method == "GET" assert response.request.url == "http://localhost:{}/basic/string".format(port) + @pytest.mark.asyncio async def test_response_content(send_request): response = await send_request( @@ -46,6 +50,7 @@ async def test_response_content(send_request): assert content == b"Hello, world!" assert response.text() == "Hello, world!" + @pytest.mark.asyncio async def test_response_text(send_request): response = await send_request( @@ -56,8 +61,9 @@ async def test_response_text(send_request): content = await response.read() assert content == b"Hello, world!" assert response.text() == "Hello, world!" - assert response.headers["Content-Length"] == '13' - assert response.headers['Content-Type'] == "text/plain; charset=utf-8" + assert response.headers["Content-Length"] == "13" + assert response.headers["Content-Type"] == "text/plain; charset=utf-8" + @pytest.mark.asyncio async def test_response_html(send_request): @@ -70,6 +76,7 @@ async def test_response_html(send_request): assert content == b"Hello, world!" assert response.text() == "Hello, world!" + @pytest.mark.asyncio async def test_raise_for_status(client): # response = await client.send_request( @@ -92,23 +99,21 @@ async def test_raise_for_status(client): with pytest.raises(HttpResponseError): response.raise_for_status() + @pytest.mark.asyncio async def test_response_repr(send_request): - response = await send_request( - HttpRequest("GET", "/basic/string") - ) + response = await send_request(HttpRequest("GET", "/basic/string")) assert repr(response) == "" + @pytest.mark.asyncio async def test_response_content_type_encoding(send_request): """ Use the charset encoding in the Content-Type header if possible. """ - response = await send_request( - request=HttpRequest("GET", "/encoding/latin-1") - ) + response = await send_request(request=HttpRequest("GET", "/encoding/latin-1")) assert response.content_type == "text/plain; charset=latin-1" - assert response.content == b'Latin 1: \xff' + assert response.content == b"Latin 1: \xff" assert response.text() == "Latin 1: ÿ" assert response.encoding == "latin-1" @@ -118,10 +123,8 @@ async def test_response_autodetect_encoding(send_request): """ Autodetect encoding if there is no Content-Type header. """ - response = await send_request( - request=HttpRequest("GET", "/encoding/latin-1") - ) - assert response.text() == u'Latin 1: ÿ' + response = await send_request(request=HttpRequest("GET", "/encoding/latin-1")) + assert response.text() == "Latin 1: ÿ" assert response.encoding == "latin-1" @@ -130,9 +133,7 @@ async def test_response_fallback_to_autodetect(send_request): """ Fallback to autodetection if we get an invalid charset in the Content-Type header. """ - response = await send_request( - request=HttpRequest("GET", "/encoding/invalid-codec-name") - ) + response = await send_request(request=HttpRequest("GET", "/encoding/invalid-codec-name")) assert response.headers["Content-Type"] == "text/plain; charset=invalid-codec-name" assert response.text() == "おはようございます。" assert response.encoding is None @@ -168,6 +169,7 @@ async def test_response_no_charset_with_iso_8859_1_content(send_request): assert response.text() == "Accented: �sterreich" assert response.encoding is None + @pytest.mark.asyncio async def test_json(send_request): response = await send_request( @@ -176,6 +178,7 @@ async def test_json(send_request): assert response.json() == {"greeting": "hello", "recipient": "world"} assert response.encoding is None + @pytest.mark.asyncio async def test_json_with_specified_encoding(send_request): response = await send_request( @@ -184,6 +187,7 @@ async def test_json_with_specified_encoding(send_request): assert response.json() == {"greeting": "hello", "recipient": "world"} assert response.encoding == "utf-16" + @pytest.mark.asyncio async def test_emoji(send_request): response = await send_request( @@ -191,6 +195,7 @@ async def test_emoji(send_request): ) assert response.text() == "👩" + @pytest.mark.asyncio async def test_emoji_family_with_skin_tone_modifier(send_request): response = await send_request( @@ -198,6 +203,7 @@ async def test_emoji_family_with_skin_tone_modifier(send_request): ) assert response.text() == "👩🏻‍👩🏽‍👧🏾‍👦🏿 SSN: 859-98-0987" + @pytest.mark.asyncio async def test_korean_nfc(send_request): response = await send_request( @@ -205,16 +211,16 @@ async def test_korean_nfc(send_request): ) assert response.text() == "아가" + @pytest.mark.asyncio async def test_urlencoded_content(send_request): await send_request( request=HttpRequest( - "POST", - "/urlencoded/pet/add/1", - data={ "pet_type": "dog", "pet_food": "meat", "name": "Fido", "pet_age": 42 } + "POST", "/urlencoded/pet/add/1", data={"pet_type": "dog", "pet_food": "meat", "name": "Fido", "pet_age": 42} ), ) + # @pytest.mark.asyncio # async def test_multipart_files_content(send_request): # request = HttpRequest( @@ -224,6 +230,7 @@ async def test_urlencoded_content(send_request): # ) # await send_request(request) + @pytest.mark.asyncio async def test_send_request_return_pipeline_response(client): # we use return_pipeline_response for some cases in autorest @@ -235,22 +242,24 @@ async def test_send_request_return_pipeline_response(client): assert response.http_response.text() == "Hello, world!" assert hasattr(response.http_request, "content") + @pytest.mark.asyncio async def test_text_and_encoding(send_request): response = await send_request( request=HttpRequest("GET", "/encoding/emoji"), ) - assert response.content == u"👩".encode("utf-8") - assert response.text() == u"👩" + assert response.content == "👩".encode("utf-8") + assert response.text() == "👩" # try setting encoding as a property response.encoding = "utf-16" - assert response.text() == u"鿰ꦑ" == response.content.decode(response.encoding) + assert response.text() == "鿰ꦑ" == response.content.decode(response.encoding) # assert latin-1 changes text decoding without changing encoding property - assert response.text("latin-1") == 'ð\x9f\x91©' == response.content.decode("latin-1") + assert response.text("latin-1") == "ð\x9f\x91©" == response.content.decode("latin-1") assert response.encoding == "utf-16" + # @pytest.mark.asyncio # async def test_multipart_encode_non_seekable_filelike(send_request): # """ @@ -278,11 +287,13 @@ async def test_text_and_encoding(send_request): # ) # await send_request(request) + def test_initialize_response_abc(): with pytest.raises(TypeError) as ex: AsyncHttpResponse() assert "Can't instantiate abstract class" in str(ex) + @pytest.mark.asyncio async def test_readonly(send_request): """Make sure everything that is readonly is readonly""" @@ -290,4 +301,5 @@ async def test_readonly(send_request): assert isinstance(response, RestAioHttpTransportResponse) from azure.core.pipeline.transport import AioHttpTransportResponse + readonly_checks(response, old_response_class=AioHttpTransportResponse) diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_polling_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_polling_async.py index b80ac0596768..1f435cf7acaf 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_polling_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_polling_async.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,39 +22,39 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import pytest from azure.core.exceptions import ServiceRequestError from azure.core.rest import HttpRequest from azure.core.polling import AsyncLROPoller from azure.core.polling.async_base_polling import AsyncLROBasePolling + @pytest.fixture def deserialization_callback(): def _callback(response): return response.http_response.json() + return _callback + @pytest.fixture def lro_poller(client, deserialization_callback): async def _callback(request, **kwargs): - initial_response = await client.send_request( - request=request, - _return_pipeline_response=True - ) + initial_response = await client.send_request(request=request, _return_pipeline_response=True) return AsyncLROPoller( - client._client, - initial_response, - deserialization_callback, - AsyncLROBasePolling(0, **kwargs) + client._client, initial_response, deserialization_callback, AsyncLROBasePolling(0, **kwargs) ) + return _callback + @pytest.mark.asyncio async def test_post_with_location_and_operation_location_headers(lro_poller): poller = await lro_poller(HttpRequest("POST", "/polling/post/location-and-operation-location")) result = await poller.result() - assert result == {'location_result': True} + assert result == {"location_result": True} + @pytest.mark.asyncio async def test_post_with_location_and_operation_location_headers_no_body(lro_poller): @@ -62,62 +62,74 @@ async def test_post_with_location_and_operation_location_headers_no_body(lro_pol result = await poller.result() assert result is None + @pytest.mark.asyncio async def test_post_resource_location(lro_poller): poller = await lro_poller(HttpRequest("POST", "/polling/post/resource-location")) result = await poller.result() - assert result == {'location_result': True} + assert result == {"location_result": True} + @pytest.mark.asyncio async def test_put_no_polling(lro_poller): result = await (await lro_poller(HttpRequest("PUT", "/polling/no-polling"))).result() - assert result['properties']['provisioningState'] == 'Succeeded' + assert result["properties"]["provisioningState"] == "Succeeded" + @pytest.mark.asyncio async def test_put_location(lro_poller): result = await (await lro_poller(HttpRequest("PUT", "/polling/location"))).result() - assert result['location_result'] + assert result["location_result"] + @pytest.mark.asyncio async def test_put_initial_response_body_invalid(lro_poller): # initial body is invalid result = await (await lro_poller(HttpRequest("PUT", "/polling/initial-body-invalid"))).result() - assert result['location_result'] + assert result["location_result"] + @pytest.mark.asyncio async def test_put_operation_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): await (await lro_poller(HttpRequest("PUT", "/polling/bad-operation-location"), retry_total=0)).result() + @pytest.mark.asyncio async def test_put_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): await (await lro_poller(HttpRequest("PUT", "/polling/bad-location"), retry_total=0)).result() + @pytest.mark.asyncio async def test_patch_location(lro_poller): result = await (await lro_poller(HttpRequest("PATCH", "/polling/location"))).result() - assert result['location_result'] + assert result["location_result"] + @pytest.mark.asyncio async def test_patch_operation_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): await (await lro_poller(HttpRequest("PUT", "/polling/bad-operation-location"), retry_total=0)).result() + @pytest.mark.asyncio async def test_patch_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): await (await lro_poller(HttpRequest("PUT", "/polling/bad-location"), retry_total=0)).result() + @pytest.mark.asyncio async def test_delete_operation_location(lro_poller): result = await (await lro_poller(HttpRequest("DELETE", "/polling/operation-location"))).result() - assert result['status'] == 'Succeeded' + assert result["status"] == "Succeeded" + @pytest.mark.asyncio async def test_request_id(lro_poller): result = await (await lro_poller(HttpRequest("POST", "/polling/request-id"), request_id="123456789")).result() - assert result['status'] == "Succeeded" + assert result["status"] == "Succeeded" + @pytest.mark.asyncio async def test_continuation_token(client, lro_poller, deserialization_callback): @@ -130,4 +142,4 @@ async def test_continuation_token(client, lro_poller, deserialization_callback): deserialization_callback=deserialization_callback, ) result = await new_poller.result() - assert result == {'location_result': True} + assert result == {"location_result": True} diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_response_backcompat_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_response_backcompat_async.py index 9d45ea118e98..20248b9848f2 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_response_backcompat_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_response_backcompat_async.py @@ -13,53 +13,64 @@ TRANSPORTS = [AioHttpTransport, AsyncioRequestsTransport] -@pytest.fixture +@pytest.fixture def old_request(port): return PipelineTransportHttpRequest("GET", "http://localhost:{}/streams/basic".format(port)) + @pytest.fixture @pytest.mark.asyncio async def get_old_response(old_request): async def _callback(transport, **kwargs): async with transport() as sender: return await sender.send(old_request, **kwargs) + return _callback + @pytest.fixture @pytest.mark.trio async def get_old_response_trio(old_request): async def _callback(**kwargs): async with TrioRequestsTransport() as sender: return await sender.send(old_request, **kwargs) + return _callback + @pytest.fixture def new_request(port): return RestHttpRequest("GET", "http://localhost:{}/streams/basic".format(port)) + @pytest.fixture @pytest.mark.asyncio async def get_new_response(new_request): async def _callback(transport, **kwargs): async with transport() as sender: return await sender.send(new_request, **kwargs) + return _callback + @pytest.fixture @pytest.mark.trio async def get_new_response_trio(new_request): async def _callback(**kwargs): async with TrioRequestsTransport() as sender: return await sender.send(new_request, **kwargs) + return _callback + def _test_response_attr_parity(old_response, new_response): for attr in dir(old_response): if not attr[0] == "_": # if not a private attr, we want parity assert hasattr(new_response, attr) + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_attr_parity(get_old_response, get_new_response, transport): @@ -67,12 +78,14 @@ async def test_response_attr_parity(get_old_response, get_new_response, transpor new_response = await get_new_response(transport) _test_response_attr_parity(old_response, new_response) + @pytest.mark.trio async def test_response_attr_parity_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_attr_parity(old_response, new_response) + def _test_response_set_attrs(old_response, new_response): for attr in dir(old_response): if attr[0] == "_": @@ -87,6 +100,7 @@ def _test_response_set_attrs(old_response, new_response): setattr(new_response, attr, "foo") assert getattr(old_response, attr) == getattr(new_response, attr) == "foo" + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_set_attrs(get_old_response, get_new_response, transport): @@ -94,18 +108,21 @@ async def test_response_set_attrs(get_old_response, get_new_response, transport) new_response = await get_new_response(transport) _test_response_set_attrs(old_response, new_response) + @pytest.mark.trio async def test_response_set_attrs_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_set_attrs(old_response, new_response) + def _test_response_block_size(old_response, new_response): assert old_response.block_size == new_response.block_size == 4096 old_response.block_size = 500 new_response.block_size = 500 assert old_response.block_size == new_response.block_size == 500 + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_block_size(get_old_response, get_new_response, transport): @@ -113,12 +130,14 @@ async def test_response_block_size(get_old_response, get_new_response, transport new_response = await get_new_response(transport) _test_response_block_size(old_response, new_response) + @pytest.mark.trio async def test_response_block_size_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_block_size(old_response, new_response) + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_body(get_old_response, get_new_response, transport): @@ -126,18 +145,25 @@ async def test_response_body(get_old_response, get_new_response, transport): new_response = await get_new_response(transport) assert old_response.body() == new_response.body() == b"Hello, world!" + @pytest.mark.trio async def test_response_body_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() assert old_response.body() == new_response.body() == b"Hello, world!" + def _test_response_internal_response(old_response, new_response, port): - assert str(old_response.internal_response.url) == str(new_response.internal_response.url) == "http://localhost:{}/streams/basic".format(port) + assert ( + str(old_response.internal_response.url) + == str(new_response.internal_response.url) + == "http://localhost:{}/streams/basic".format(port) + ) old_response.internal_response = "foo" new_response.internal_response = "foo" assert old_response.internal_response == new_response.internal_response == "foo" + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_internal_response(get_old_response, get_new_response, transport, port): @@ -145,12 +171,14 @@ async def test_response_internal_response(get_old_response, get_new_response, tr new_response = await get_new_response(transport) _test_response_internal_response(old_response, new_response, port) + @pytest.mark.trio async def test_response_internal_response_trio(get_old_response_trio, get_new_response_trio, port): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_internal_response(old_response, new_response, port) + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_stream_download(get_old_response, get_new_response, transport): @@ -165,6 +193,7 @@ async def test_response_stream_download(get_old_response, get_new_response, tran assert old_string in b"Hello, world!" assert new_string in b"Hello, world!" + @pytest.mark.trio async def test_response_stream_download_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio(stream=True) @@ -174,12 +203,14 @@ async def test_response_stream_download_trio(get_old_response_trio, get_new_resp new_string = b"".join([part async for part in new_response.stream_download(pipeline=pipeline)]) assert old_string == new_string == b"Hello, world!" + def _test_response_request(old_response, new_response, port): assert old_response.request.url == new_response.request.url == "http://localhost:{}/streams/basic".format(port) old_response.request = "foo" new_response.request = "foo" assert old_response.request == new_response.request == "foo" + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_request(get_old_response, get_new_response, port, transport): @@ -187,18 +218,21 @@ async def test_response_request(get_old_response, get_new_response, port, transp new_response = await get_new_response(transport) _test_response_request(old_response, new_response, port) + @pytest.mark.trio async def test_response_request_trio(get_old_response_trio, get_new_response_trio, port): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_request(old_response, new_response, port) + def _test_response_status_code(old_response, new_response): assert old_response.status_code == new_response.status_code == 200 old_response.status_code = 202 new_response.status_code = 202 assert old_response.status_code == new_response.status_code == 202 + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_status_code(get_old_response, get_new_response, transport): @@ -206,18 +240,25 @@ async def test_response_status_code(get_old_response, get_new_response, transpor new_response = await get_new_response(transport) _test_response_status_code(old_response, new_response) + @pytest.mark.trio async def test_response_status_code_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_status_code(old_response, new_response) + def _test_response_headers(old_response, new_response): - assert set(old_response.headers.keys()) == set(new_response.headers.keys()) == set(["Content-Type", "Connection", "Server", "Date"]) + assert ( + set(old_response.headers.keys()) + == set(new_response.headers.keys()) + == set(["Content-Type", "Connection", "Server", "Date"]) + ) old_response.headers = {"Hello": "world!"} new_response.headers = {"Hello": "world!"} assert old_response.headers == new_response.headers == {"Hello": "world!"} + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_headers(get_old_response, get_new_response, transport): @@ -225,18 +266,21 @@ async def test_response_headers(get_old_response, get_new_response, transport): new_response = await get_new_response(transport) _test_response_headers(old_response, new_response) + @pytest.mark.trio async def test_response_headers_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_headers(old_response, new_response) + def _test_response_reason(old_response, new_response): assert old_response.reason == new_response.reason == "OK" old_response.reason = "Not OK" new_response.reason = "Not OK" assert old_response.reason == new_response.reason == "Not OK" + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_reason(get_old_response, get_new_response, transport): @@ -244,18 +288,21 @@ async def test_response_reason(get_old_response, get_new_response, transport): new_response = await get_new_response(transport) _test_response_reason(old_response, new_response) + @pytest.mark.trio async def test_response_reason_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_reason(old_response, new_response) + def _test_response_content_type(old_response, new_response): assert old_response.content_type == new_response.content_type == "text/html; charset=utf-8" old_response.content_type = "application/json" new_response.content_type = "application/json" assert old_response.content_type == new_response.content_type == "application/json" + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) async def test_response_content_type(get_old_response, get_new_response, transport): @@ -263,26 +310,28 @@ async def test_response_content_type(get_old_response, get_new_response, transpo new_response = await get_new_response(transport) _test_response_content_type(old_response, new_response) + @pytest.mark.trio async def test_response_content_type_trio(get_old_response_trio, get_new_response_trio): old_response = await get_old_response_trio() new_response = await get_new_response_trio() _test_response_content_type(old_response, new_response) + def _create_multiapart_request(http_request_class): class ResponsePolicy(object): def on_request(self, *args): return def on_response(self, request, response): - response.http_response.headers['x-ms-fun'] = 'true' + response.http_response.headers["x-ms-fun"] = "true" class AsyncResponsePolicy(object): def on_request(self, *args): return async def on_response(self, request, response): - response.http_response.headers['x-ms-async-fun'] = 'true' + response.http_response.headers["x-ms-async-fun"] = "true" req0 = http_request_class("DELETE", "/container0/blob0") req1 = http_request_class("DELETE", "/container1/blob1") @@ -290,6 +339,7 @@ async def on_response(self, request, response): request.set_multipart_mixed(req0, req1, policies=[ResponsePolicy(), AsyncResponsePolicy()]) return request + async def _test_parts(response): # hack the content type parts = [p async for p in response.parts()] @@ -297,13 +347,14 @@ async def _test_parts(response): parts0 = parts[0] assert parts0.status_code == 202 - assert parts0.headers['x-ms-fun'] == 'true' - assert parts0.headers['x-ms-async-fun'] == 'true' + assert parts0.headers["x-ms-fun"] == "true" + assert parts0.headers["x-ms-async-fun"] == "true" parts1 = parts[1] assert parts1.status_code == 404 - assert parts1.headers['x-ms-fun'] == 'true' - assert parts1.headers['x-ms-async-fun'] == 'true' + assert parts1.headers["x-ms-fun"] == "true" + assert parts1.headers["x-ms-async-fun"] == "true" + @pytest.mark.asyncio @pytest.mark.parametrize("transport", TRANSPORTS) diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_stream_responses_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_stream_responses_async.py index 575bee305794..740b5d80fa62 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_stream_responses_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_stream_responses_async.py @@ -8,6 +8,7 @@ from azure.core.rest import HttpRequest from azure.core.exceptions import StreamClosedError, StreamConsumedError, ResponseNotReadError + @pytest.mark.asyncio async def test_iter_raw(client): request = HttpRequest("GET", "/streams/basic") @@ -17,6 +18,7 @@ async def test_iter_raw(client): raw += part assert raw == b"Hello, world!" + @pytest.mark.asyncio async def test_iter_raw_on_iterable(client): request = HttpRequest("GET", "/streams/iterable") @@ -27,6 +29,7 @@ async def test_iter_raw_on_iterable(client): raw += part assert raw == b"Hello, world!" + @pytest.mark.asyncio async def test_iter_with_error(client): request = HttpRequest("GET", "/errors/403") @@ -52,6 +55,7 @@ async def test_iter_with_error(client): raise ValueError("Should error before entering") assert response.is_closed + @pytest.mark.asyncio async def test_iter_bytes(client): request = HttpRequest("GET", "/streams/basic") @@ -66,6 +70,7 @@ async def test_iter_bytes(client): assert response.is_closed assert raw == b"Hello, world!" + @pytest.mark.skip(reason="We've gotten rid of iter_text for now") @pytest.mark.asyncio async def test_iter_text(client): @@ -77,6 +82,7 @@ async def test_iter_text(client): content += part assert content == "Hello, world!" + @pytest.mark.skip(reason="We've gotten rid of iter_lines for now") @pytest.mark.asyncio async def test_iter_lines(client): @@ -102,6 +108,7 @@ async def test_streaming_response(client): assert response.content == b"Hello, world!" assert response.is_closed + @pytest.mark.asyncio async def test_cannot_read_after_stream_consumed(port, client): request = HttpRequest("GET", "/streams/basic") @@ -127,6 +134,7 @@ async def test_cannot_read_after_response_closed(port, client): assert "".format(port) in str(ex.value) assert "can no longer be read or streamed, since the response has already been closed" in str(ex.value) + @pytest.mark.asyncio async def test_decompress_plain_no_header(client): # thanks to Xiang Yan for this test! @@ -140,6 +148,7 @@ async def test_decompress_plain_no_header(client): await response.read() assert response.content == b"test" + @pytest.mark.asyncio async def test_compress_plain_no_header(client): # thanks to Xiang Yan for this test! @@ -154,6 +163,7 @@ async def test_compress_plain_no_header(client): data += d assert data == b"test" + @pytest.mark.asyncio async def test_iter_read_back_and_forth(client): # thanks to McCoy Patiño for this test! @@ -174,6 +184,7 @@ async def test_iter_read_back_and_forth(client): with pytest.raises(ResponseNotReadError): response.text() + @pytest.mark.asyncio async def test_stream_with_return_pipeline_response(client): request = HttpRequest("GET", "/basic/string") @@ -185,9 +196,10 @@ async def test_stream_with_return_pipeline_response(client): parts = [] async for part in pipeline_response.http_response.iter_bytes(): parts.append(part) - assert parts == [b'Hello, world!'] + assert parts == [b"Hello, world!"] await client.close() + @pytest.mark.asyncio async def test_error_reading(client): request = HttpRequest("GET", "/errors/403") @@ -203,6 +215,7 @@ async def test_error_reading(client): assert response.content == b"" await client.close() + @pytest.mark.asyncio async def test_pass_kwarg_to_iter_bytes(client): request = HttpRequest("GET", "/basic/string") @@ -210,6 +223,7 @@ async def test_pass_kwarg_to_iter_bytes(client): async for part in response.iter_bytes(chunk_size=5): assert part + @pytest.mark.asyncio async def test_pass_kwarg_to_iter_raw(client): request = HttpRequest("GET", "/basic/string") @@ -217,6 +231,7 @@ async def test_pass_kwarg_to_iter_raw(client): async for part in response.iter_raw(chunk_size=5): assert part + @pytest.mark.asyncio async def test_decompress_compressed_header(client): # expect plain text @@ -227,6 +242,7 @@ async def test_decompress_compressed_header(client): assert response.content == content assert response.text() == "hello world" + @pytest.mark.asyncio async def test_deflate_decompress_compressed_header(client): # expect plain text @@ -237,6 +253,7 @@ async def test_deflate_decompress_compressed_header(client): assert response.content == content assert response.text() == "hi there" + @pytest.mark.asyncio async def test_decompress_compressed_header_stream(client): # expect plain text @@ -247,6 +264,7 @@ async def test_decompress_compressed_header_stream(client): assert response.content == content assert response.text() == "hello world" + @pytest.mark.asyncio async def test_decompress_compressed_header_stream_body_content(client): # expect plain text diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py b/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py index 813864544407..38075eef44ae 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py @@ -10,12 +10,14 @@ from utils import readonly_checks import pytest + @pytest.fixture async def client(port): async with TrioRequestsTransport() as transport: async with AsyncTestRestClient(port, transport=transport) as client: yield client + @pytest.mark.trio async def test_async_gen_data(client, port): class AsyncGen: @@ -31,15 +33,17 @@ async def __anext__(self): except StopIteration: raise StopAsyncIteration - request = HttpRequest('GET', 'http://localhost:{}/basic/anything'.format(port), content=AsyncGen()) + request = HttpRequest("GET", "http://localhost:{}/basic/anything".format(port), content=AsyncGen()) response = await client.send_request(request) - assert response.json()['data'] == "azerty" + assert response.json()["data"] == "azerty" + @pytest.mark.trio async def test_send_data(port, client): - request = HttpRequest('PUT', 'http://localhost:{}/basic/anything'.format(port), content=b"azerty") + request = HttpRequest("PUT", "http://localhost:{}/basic/anything".format(port), content=b"azerty") response = await client.send_request(request) - assert response.json()['data'] == "azerty" + assert response.json()["data"] == "azerty" + @pytest.mark.trio async def test_readonly(client): @@ -49,8 +53,10 @@ async def test_readonly(client): assert isinstance(response, RestTrioRequestsTransportResponse) from azure.core.pipeline.transport import TrioRequestsTransportResponse + readonly_checks(response, old_response_class=TrioRequestsTransportResponse) + @pytest.mark.trio async def test_decompress_compressed_header(client): # expect plain text @@ -61,6 +67,7 @@ async def test_decompress_compressed_header(client): assert response.content == content assert response.text() == "hello world" + @pytest.mark.trio async def test_decompress_compressed_header_stream(client): # expect plain text @@ -71,6 +78,7 @@ async def test_decompress_compressed_header_stream(client): assert response.content == content assert response.text() == "hello world" + @pytest.mark.trio async def test_decompress_compressed_header_stream_body_content(client): # expect plain text diff --git a/sdk/core/azure-core/tests/async_tests/test_retry_policy_async.py b/sdk/core/azure-core/tests/async_tests/test_retry_policy_async.py index 270cc5c5684d..d86bdaad05f7 100644 --- a/sdk/core/azure-core/tests/async_tests/test_retry_policy_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_retry_policy_async.py @@ -16,7 +16,7 @@ ServiceRequestError, ServiceRequestTimeoutError, ServiceResponseError, - ServiceResponseTimeoutError + ServiceResponseTimeoutError, ) from azure.core.pipeline.policies import ( AsyncRetryPolicy, @@ -34,6 +34,7 @@ from itertools import product from utils import HTTP_REQUESTS + def test_retry_code_class_variables(): retry_policy = AsyncRetryPolicy() assert retry_policy._RETRY_CODES is not None @@ -41,13 +42,10 @@ def test_retry_code_class_variables(): assert 429 in retry_policy._RETRY_CODES assert 501 not in retry_policy._RETRY_CODES + def test_retry_types(): history = ["1", "2", "3"] - settings = { - 'history': history, - 'backoff': 1, - 'max_backoff': 10 - } + settings = {"history": history, "backoff": 1, "max_backoff": 10} retry_policy = AsyncRetryPolicy() backoff_time = retry_policy.get_backoff_time(settings) assert backoff_time == 4 @@ -60,7 +58,8 @@ def test_retry_types(): backoff_time = retry_policy.get_backoff_time(settings) assert backoff_time == 4 -@pytest.mark.parametrize("retry_after_input,http_request", product(['0', '800', '1000', '1200'], HTTP_REQUESTS)) + +@pytest.mark.parametrize("retry_after_input,http_request", product(["0", "800", "1000", "1200"], HTTP_REQUESTS)) def test_retry_after(retry_after_input, http_request): retry_policy = AsyncRetryPolicy() request = http_request("GET", "http://localhost") @@ -69,7 +68,7 @@ def test_retry_after(retry_after_input, http_request): pipeline_response = PipelineResponse(request, response, None) retry_after = retry_policy.get_retry_after(pipeline_response) seconds = float(retry_after_input) - assert retry_after == seconds/1000.0 + assert retry_after == seconds / 1000.0 response.headers.pop("retry-after-ms") response.headers["Retry-After"] = retry_after_input retry_after = retry_policy.get_retry_after(pipeline_response) @@ -78,7 +77,8 @@ def test_retry_after(retry_after_input, http_request): retry_after = retry_policy.get_retry_after(pipeline_response) assert retry_after == float(retry_after_input) -@pytest.mark.parametrize("retry_after_input,http_request", product(['0', '800', '1000', '1200'], HTTP_REQUESTS)) + +@pytest.mark.parametrize("retry_after_input,http_request", product(["0", "800", "1000", "1200"], HTTP_REQUESTS)) def test_x_ms_retry_after(retry_after_input, http_request): retry_policy = AsyncRetryPolicy() request = http_request("GET", "http://localhost") @@ -87,7 +87,7 @@ def test_x_ms_retry_after(retry_after_input, http_request): pipeline_response = PipelineResponse(request, response, None) retry_after = retry_policy.get_retry_after(pipeline_response) seconds = float(retry_after_input) - assert retry_after == seconds/1000.0 + assert retry_after == seconds / 1000.0 response.headers.pop("x-ms-retry-after-ms") response.headers["Retry-After"] = retry_after_input retry_after = retry_policy.get_retry_after(pipeline_response) @@ -96,16 +96,20 @@ def test_x_ms_retry_after(retry_after_input, http_request): retry_after = retry_policy.get_retry_after(pipeline_response) assert retry_after == float(retry_after_input) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_retry_on_429(http_request): class MockTransport(AsyncHttpTransport): def __init__(self): self._count = 0 + async def __aexit__(self, exc_type, exc_val, exc_tb): pass + async def close(self): pass + async def open(self): pass @@ -115,23 +119,27 @@ async def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> Pipe response.status_code = 429 return response - http_request = http_request('GET', 'http://localhost/') - http_retry = AsyncRetryPolicy(retry_total = 1) + http_request = http_request("GET", "http://localhost/") + http_retry = AsyncRetryPolicy(retry_total=1) transport = MockTransport() pipeline = AsyncPipeline(transport, [http_retry]) await pipeline.run(http_request) assert transport._count == 2 + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_no_retry_on_201(http_request): class MockTransport(AsyncHttpTransport): def __init__(self): self._count = 0 + async def __aexit__(self, exc_type, exc_val, exc_tb): pass + async def close(self): pass + async def open(self): pass @@ -143,31 +151,35 @@ async def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> Pipe response.headers = headers return response - http_request = http_request('GET', 'http://localhost/') - http_retry = AsyncRetryPolicy(retry_total = 1) + http_request = http_request("GET", "http://localhost/") + http_retry = AsyncRetryPolicy(retry_total=1) transport = MockTransport() pipeline = AsyncPipeline(transport, [http_retry]) await pipeline.run(http_request) assert transport._count == 1 + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_retry_seekable_stream(http_request): class MockTransport(AsyncHttpTransport): def __init__(self): self._first = True + async def __aexit__(self, exc_type, exc_val, exc_tb): pass + async def close(self): pass + async def open(self): pass async def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineResponse if self._first: self._first = False - request.body.seek(0,2) - raise AzureError('fail on first') + request.body.seek(0, 2) + raise AzureError("fail on first") position = request.body.tell() assert position == 0 response = HttpResponse(request, None) @@ -175,22 +187,26 @@ async def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> Pipe return response data = BytesIO(b"Lots of dataaaa") - http_request = http_request('GET', 'http://localhost/') + http_request = http_request("GET", "http://localhost/") http_request.set_streamed_data_body(data) - http_retry = AsyncRetryPolicy(retry_total = 1) + http_retry = AsyncRetryPolicy(retry_total=1) pipeline = AsyncPipeline(MockTransport(), [http_retry]) await pipeline.run(http_request) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_retry_seekable_file(http_request): class MockTransport(AsyncHttpTransport): def __init__(self): self._first = True + async def __aexit__(self, exc_type, exc_val, exc_tb): pass + async def close(self): pass + async def open(self): pass @@ -199,12 +215,12 @@ async def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> Pipe self._first = False for value in request.files.values(): name, body = value[0], value[1] - if name and body and hasattr(body, 'read'): - body.seek(0,2) - raise AzureError('fail on first') + if name and body and hasattr(body, "read"): + body.seek(0, 2) + raise AzureError("fail on first") for value in request.files.values(): name, body = value[0], value[1] - if name and body and hasattr(body, 'read'): + if name and body and hasattr(body, "read"): position = body.tell() assert not position response = HttpResponse(request, None) @@ -212,15 +228,15 @@ async def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> Pipe return response file = tempfile.NamedTemporaryFile(delete=False) - file.write(b'Lots of dataaaa') + file.write(b"Lots of dataaaa") file.close() - http_request = http_request('GET', 'http://localhost/') - headers = {'Content-Type': "multipart/form-data"} + http_request = http_request("GET", "http://localhost/") + headers = {"Content-Type": "multipart/form-data"} http_request.headers = headers - with open(file.name, 'rb') as f: + with open(file.name, "rb") as f: form_data_content = { - 'fileContent': f, - 'fileName': f.name, + "fileContent": f, + "fileName": f.name, } http_request.set_formdata_body(form_data_content) http_retry = AsyncRetryPolicy(retry_total=1) @@ -272,8 +288,10 @@ async def send(request, **kwargs): await pipeline.run(http_request("GET", "http://localhost/")) assert transport.send.call_count == 1, "policy should not retry: its first send succeeded" + combinations = [(ServiceRequestError, ServiceRequestTimeoutError), (ServiceResponseError, ServiceResponseTimeoutError)] + @pytest.mark.asyncio @pytest.mark.parametrize( "combinations,http_request", diff --git a/sdk/core/azure-core/tests/async_tests/test_stream_generator_async.py b/sdk/core/azure-core/tests/async_tests/test_stream_generator_async.py index f9be72d1a9da..ad2e5d39cb02 100644 --- a/sdk/core/azure-core/tests/async_tests/test_stream_generator_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_stream_generator_async.py @@ -14,6 +14,7 @@ import pytest from utils import request_and_responses_product, ASYNC_HTTP_RESPONSES, create_http_response + @pytest.mark.asyncio @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(ASYNC_HTTP_RESPONSES)) async def test_connection_error_response(http_request, http_response): @@ -32,18 +33,20 @@ def __init__(self): async def __aexit__(self, exc_type, exc_val, exc_tb): pass + async def close(self): pass + async def open(self): pass async def send(self, request, **kwargs): - request = http_request('GET', 'http://localhost/') + request = http_request("GET", "http://localhost/") response = create_http_response(http_response, request, None) response.status_code = 200 return response - class MockContent(): + class MockContent: def __init__(self): self._first = True @@ -53,7 +56,7 @@ async def read(self, block_size): raise ConnectionError return None - class MockInternalResponse(): + class MockInternalResponse: def __init__(self): self.headers = {} self.content = MockContent() @@ -65,15 +68,16 @@ class AsyncMock(mock.MagicMock): async def __call__(self, *args, **kwargs): return super(AsyncMock, self).__call__(*args, **kwargs) - http_request = http_request('GET', 'http://localhost/') + http_request = http_request("GET", "http://localhost/") pipeline = AsyncPipeline(MockTransport()) http_response = create_http_response(http_response, http_request, None) http_response.internal_response = MockInternalResponse() stream = AioHttpStreamDownloadGenerator(pipeline, http_response, decompress=False) - with mock.patch('asyncio.sleep', new_callable=AsyncMock): + with mock.patch("asyncio.sleep", new_callable=AsyncMock): with pytest.raises(ConnectionError): await stream.__anext__() + @pytest.mark.asyncio @pytest.mark.parametrize("http_response", ASYNC_HTTP_RESPONSES) async def test_response_streaming_error_behavior(http_response): diff --git a/sdk/core/azure-core/tests/async_tests/test_streaming_async.py b/sdk/core/azure-core/tests/async_tests/test_streaming_async.py index 1385126b5ce1..b7b4f8cc17dc 100644 --- a/sdk/core/azure-core/tests/async_tests/test_streaming_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_streaming_async.py @@ -29,6 +29,7 @@ from azure.core.exceptions import DecodeError from utils import HTTP_REQUESTS + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_decompress_plain_no_header(http_request): @@ -45,9 +46,10 @@ async def test_decompress_plain_no_header(http_request): content = b"" async for d in data: content += d - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_compress_plain_no_header(http_request): @@ -64,9 +66,10 @@ async def test_compress_plain_no_header(http_request): content = b"" async for d in data: content += d - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_decompress_compressed_no_header(http_request): @@ -84,11 +87,12 @@ async def test_decompress_compressed_no_header(http_request): async for d in data: content += d try: - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert False except UnicodeDecodeError: pass + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_compress_compressed_no_header(http_request): @@ -106,7 +110,7 @@ async def test_compress_compressed_no_header(http_request): async for d in data: content += d try: - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert False except UnicodeDecodeError: pass @@ -118,6 +122,7 @@ async def test_compress_compressed_no_header(http_request): async def test_decompress_plain_header(http_request): # expect error import zlib + account_name = "coretests" account_url = "https://{}.blob.core.windows.net".format(account_name) url = "https://{}.blob.core.windows.net/tests/test_with_header.txt".format(account_name) @@ -135,6 +140,7 @@ async def test_decompress_plain_header(http_request): except (zlib.error, DecodeError): pass + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_compress_plain_header(http_request): @@ -151,9 +157,10 @@ async def test_compress_plain_header(http_request): content = b"" async for d in data: content += d - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_decompress_compressed_header(http_request): @@ -170,9 +177,10 @@ async def test_decompress_compressed_header(http_request): content = b"" async for d in data: content += d - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.live_test_only @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) @@ -191,7 +199,7 @@ async def test_compress_compressed_header(http_request): async for d in data: content += d try: - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert False except UnicodeDecodeError: pass diff --git a/sdk/core/azure-core/tests/async_tests/test_testserver_async.py b/sdk/core/azure-core/tests/async_tests/test_testserver_async.py index d6557b2b3e7c..bf294e54a105 100644 --- a/sdk/core/azure-core/tests/async_tests/test_testserver_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_testserver_async.py @@ -26,8 +26,10 @@ import pytest from azure.core.pipeline.transport import AioHttpTransport from utils import HTTP_REQUESTS + """This file does a simple call to the testserver to make sure we can use the testserver""" + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_smoke(port, http_request): diff --git a/sdk/core/azure-core/tests/async_tests/test_tracing_decorator_async.py b/sdk/core/azure-core/tests/async_tests/test_tracing_decorator_async.py index eefda90c3737..b668e49ce000 100644 --- a/sdk/core/azure-core/tests/async_tests/test_tracing_decorator_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_tracing_decorator_async.py @@ -56,7 +56,7 @@ async def make_request(self, numb_times, **kwargs): return None response = self.pipeline.run(self.request, **kwargs) await self.get_foo(merge_span=True) - kwargs['merge_span'] = True + kwargs["merge_span"] = True await self.make_request(numb_times - 1, **kwargs) return response @@ -77,7 +77,7 @@ async def get_foo(self): async def check_name_is_different(self): time.sleep(0.001) - @distributed_trace_async(tracing_attributes={'foo': 'bar'}) + @distributed_trace_async(tracing_attributes={"foo": "bar"}) async def tracing_attr(self): time.sleep(0.001) @@ -92,7 +92,6 @@ async def raising_exception(self): @pytest.mark.usefixtures("fake_span") class TestAsyncDecorator(object): - @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_decorator_tracing_attr(self, http_request): @@ -104,8 +103,7 @@ async def test_decorator_tracing_attr(self, http_request): assert parent.children[0].name == "MockClient.__init__" assert parent.children[1].name == "MockClient.tracing_attr" assert parent.children[1].kind == SpanKind.INTERNAL - assert parent.children[1].attributes == {'foo': 'bar'} - + assert parent.children[1].attributes == {"foo": "bar"} @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) @@ -146,7 +144,6 @@ async def test_used(self, http_request): assert parent.children[2].name == "MockClient.get_foo" assert not parent.children[2].children - @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_span_merge_span(self, http_request): @@ -163,7 +160,6 @@ async def test_span_merge_span(self, http_request): assert parent.children[2].name == "MockClient.no_merge_span_method" assert parent.children[2].children[0].name == "MockClient.get_foo" - @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_span_complicated(self, http_request): @@ -189,8 +185,7 @@ async def test_span_complicated(self, http_request): @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_span_with_exception(self, http_request): - """Assert that if an exception is raised, the next sibling method is actually a sibling span. - """ + """Assert that if an exception is raised, the next sibling method is actually a sibling span.""" with FakeSpan(name="parent") as parent: client = MockClient(http_request) try: @@ -203,5 +198,5 @@ async def test_span_with_exception(self, http_request): assert parent.children[0].name == "MockClient.__init__" assert parent.children[1].name == "MockClient.raising_exception" # Exception should propagate status for Opencensus - assert parent.children[1].status == 'Something went horribly wrong here' + assert parent.children[1].status == "Something went horribly wrong here" assert parent.children[2].name == "MockClient.get_foo" diff --git a/sdk/core/azure-core/tests/async_tests/test_universal_http_async.py b/sdk/core/azure-core/tests/async_tests/test_universal_http_async.py index 04d11c2f9010..23e1e6e867bf 100644 --- a/sdk/core/azure-core/tests/async_tests/test_universal_http_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_universal_http_async.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,12 +22,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- from azure.core.pipeline.transport import ( AioHttpTransport, AioHttpTransportResponse, AsyncioRequestsTransport, - TrioRequestsTransport) + TrioRequestsTransport, +) import aiohttp import trio @@ -36,6 +37,7 @@ from utils import HTTP_REQUESTS, AIOHTTP_TRANSPORT_RESPONSES, create_transport_response from azure.core.pipeline._tools import is_rest + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_basic_aiohttp(port, http_request): @@ -48,6 +50,7 @@ async def test_basic_aiohttp(port, http_request): assert sender.session is None assert isinstance(response.status_code, int) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_aiohttp_auto_headers(port, http_request): @@ -56,7 +59,8 @@ async def test_aiohttp_auto_headers(port, http_request): async with AioHttpTransport() as sender: response = await sender.send(request) auto_headers = response.internal_response.request_info.headers - assert 'Content-Type' not in auto_headers + assert "Content-Type" not in auto_headers + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) @@ -69,6 +73,7 @@ async def test_basic_async_requests(port, http_request): assert isinstance(response.status_code, int) + @pytest.mark.asyncio @pytest.mark.parametrize("http_request", HTTP_REQUESTS) async def test_conf_async_requests(port, http_request): @@ -80,9 +85,9 @@ async def test_conf_async_requests(port, http_request): assert isinstance(response.status_code, int) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_conf_async_trio_requests(port, http_request): - async def do(): request = http_request("GET", "http://localhost:{}/basic/string".format(port)) async with TrioRequestsTransport() as sender: @@ -104,11 +109,7 @@ def __init__(self, body_bytes, headers=None): req_response = MockAiohttpClientResponse(body_bytes, headers) - response = create_transport_response( - http_response, - None, # Don't need a request here - req_response - ) + response = create_transport_response(http_response, None, req_response) # Don't need a request here response._content = body_bytes return response @@ -120,14 +121,11 @@ async def test_aiohttp_response_text(http_response): for encoding in ["utf-8", "utf-8-sig", None]: - res = _create_aiohttp_response( - http_response, - b'\xef\xbb\xbf56', - {'Content-Type': 'text/plain'} - ) + res = _create_aiohttp_response(http_response, b"\xef\xbb\xbf56", {"Content-Type": "text/plain"}) if is_rest(http_response): await res.read() - assert res.text(encoding) == '56', "Encoding {} didn't work".format(encoding) + assert res.text(encoding) == "56", "Encoding {} didn't work".format(encoding) + @pytest.mark.asyncio @pytest.mark.parametrize("http_response", AIOHTTP_TRANSPORT_RESPONSES) @@ -144,21 +142,25 @@ async def test_aiohttp_response_decompression(http_response): b"\xe4o\xc6T\xdeVw\x9dgL\x7f\xe0n\xc0\x91q\x02'w0b\x98JZe^\x89|\xce\x9b" b"\x0e\xcbW\x8a\x97\xf4X\x97\xc8\xbf\xfeYU\x1d\xc2\x85\xfc\xf4@\xb7\xbe" b"\xf7+&$\xf6\xa9\x8a\xcb\x96\xdc\xef\xff\xaa\xa1\x1c\xf9$\x01\x00\x00", - {'Content-Type': 'text/plain', 'Content-Encoding':"gzip"} + {"Content-Type": "text/plain", "Content-Encoding": "gzip"}, ) # cSpell:enable body = res.body() - expect = b'{"id":"e7877039-1376-4dcd-9b0a-192897cff780","createdDateTimeUtc":' \ - b'"2021-05-07T17:35:36.3121065Z","lastActionDateTimeUtc":' \ - b'"2021-05-07T17:35:36.3121069Z","status":"NotStarted",' \ - b'"summary":{"total":0,"failed":0,"success":0,"inProgress":0,' \ - b'"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' + expect = ( + b'{"id":"e7877039-1376-4dcd-9b0a-192897cff780","createdDateTimeUtc":' + b'"2021-05-07T17:35:36.3121065Z","lastActionDateTimeUtc":' + b'"2021-05-07T17:35:36.3121069Z","status":"NotStarted",' + b'"summary":{"total":0,"failed":0,"success":0,"inProgress":0,' + b'"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' + ) assert res.body() == expect, "Decompression didn't work" + @pytest.mark.asyncio @pytest.mark.parametrize("http_response", AIOHTTP_TRANSPORT_RESPONSES) async def test_aiohttp_response_decompression_negative(http_response): import zlib + # cSpell:disable res = _create_aiohttp_response( http_response, @@ -170,19 +172,16 @@ async def test_aiohttp_response_decompression_negative(http_response): b"\xe4o\xc6T\xdeVw\x9dgL\x7f\xe0n\xc0\x91q\x02'w0b\x98JZe^\x89|\xce\x9b" b"\x0e\xcbW\x8a\x97\xf4X\x97\xc8\xbf\xfeYU\x1d\xc2\x85\xfc\xf4@\xb7\xbe" b"\xf7+&$\xf6\xa9\x8a\xcb\x96\xdc\xef\xff\xaa\xa1\x1c\xf9$\x01\x00\x00", - {'Content-Type': 'text/plain', 'Content-Encoding':"gzip"} + {"Content-Type": "text/plain", "Content-Encoding": "gzip"}, ) # cSpell:enable with pytest.raises(zlib.error): body = res.body() + @pytest.mark.parametrize("http_response", AIOHTTP_TRANSPORT_RESPONSES) def test_repr(http_response): - res = _create_aiohttp_response( - http_response, - b'\xef\xbb\xbf56', - {} - ) + res = _create_aiohttp_response(http_response, b"\xef\xbb\xbf56", {}) res.content_type = "text/plain" class_name = "AsyncHttpResponse" if is_rest(http_response) else "AioHttpTransportResponse" diff --git a/sdk/core/azure-core/tests/conftest.py b/sdk/core/azure-core/tests/conftest.py index 0937d265b648..e0790cca3c9f 100644 --- a/sdk/core/azure-core/tests/conftest.py +++ b/sdk/core/azure-core/tests/conftest.py @@ -39,10 +39,12 @@ try: from azure.core.tracing.ext.opencensus_span import OpenCensusSpan from opencensus.trace.tracer import Tracer + Tracer() except ImportError: pass + def is_port_available(port_num): req = urllib.request.Request("http://localhost:{}/health".format(port_num)) try: @@ -50,6 +52,7 @@ def is_port_available(port_num): except Exception as e: return True + def get_port(): count = 3 for _ in range(count): @@ -58,24 +61,26 @@ def get_port(): return port_num raise TypeError("Tried {} times, can't find an open port".format(count)) + @pytest.fixture def port(): return os.environ["FLASK_PORT"] + def start_testserver(): port = get_port() os.environ["FLASK_APP"] = "coretestserver" os.environ["FLASK_PORT"] = str(port) - if platform.python_implementation() == 'PyPy': + if platform.python_implementation() == "PyPy": # pypy is now getting mad at us for some of our encoding / text, so need # to set these additional env vars for pypy os.environ["LC_ALL"] = "C.UTF-8" os.environ["LANG"] = "C.UTF-8" cmd = "flask run -p {}".format(port) - if os.name == 'nt': #On windows, subprocess creation works without being in the shell + if os.name == "nt": # On windows, subprocess creation works without being in the shell child_process = subprocess.Popen(cmd, env=dict(os.environ)) else: - #On linux, have to set shell=True + # On linux, have to set shell=True child_process = subprocess.Popen(cmd, shell=True, preexec_fn=os.setsid, env=dict(os.environ)) count = 5 for _ in range(count): @@ -84,12 +89,14 @@ def start_testserver(): time.sleep(1) raise ValueError("Didn't start!") + def terminate_testserver(process): - if os.name == 'nt': + if os.name == "nt": process.kill() else: os.killpg(os.getpgid(process.pid), signal.SIGTERM) # Send the signal to all the process groups + @pytest.fixture(autouse=True, scope="package") def testserver(): """Start the Autorest testserver.""" @@ -97,6 +104,7 @@ def testserver(): yield terminate_testserver(server) + @pytest.fixture def client(port): return TestRestClient(port) diff --git a/sdk/core/azure-core/tests/rest_client.py b/sdk/core/azure-core/tests/rest_client.py index 0589ab1bf6bd..25765faeac7a 100644 --- a/sdk/core/azure-core/tests/rest_client.py +++ b/sdk/core/azure-core/tests/rest_client.py @@ -1,4 +1,3 @@ - # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -31,18 +30,14 @@ class TestRestClientConfiguration(Configuration): - def __init__( - self, **kwargs - ): + def __init__(self, **kwargs): # type: (...) -> None super(TestRestClientConfiguration, self).__init__(**kwargs) kwargs.setdefault("sdk_moniker", "autorestswaggerbatfileservice/1.0.0b1") self._configure(**kwargs) - def _configure( - self, **kwargs - ): + def _configure(self, **kwargs): # type: (...) -> None self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) @@ -54,15 +49,11 @@ def _configure( self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") -class TestRestClient(object): +class TestRestClient(object): def __init__(self, port, **kwargs): self._config = TestRestClientConfiguration(**kwargs) - self._client = PipelineClient( - base_url="http://localhost:{}/".format(port), - config=self._config, - **kwargs - ) + self._client = PipelineClient(base_url="http://localhost:{}/".format(port), config=self._config, **kwargs) def send_request(self, request, **kwargs): """Runs the network request through the client's chained policies. diff --git a/sdk/core/azure-core/tests/test_authentication.py b/sdk/core/azure-core/tests/test_authentication.py index 1c8f0123322e..2b115046e32c 100644 --- a/sdk/core/azure-core/tests/test_authentication.py +++ b/sdk/core/azure-core/tests/test_authentication.py @@ -245,6 +245,7 @@ def raise_the_second_time(*args, **kwargs): raise_the_second_time.calls = 1 return Mock(status_code=401, headers={"WWW-Authenticate": 'Basic realm="localhost"'}) raise TestException() + raise_the_second_time.calls = 0 policy = TestPolicy(credential, "scope") @@ -270,7 +271,7 @@ def test_key_vault_regression(http_request): assert policy._credential is credential headers = {} - token = "alphanums" # cspell:disable-line + token = "alphanums" # cspell:disable-line policy._update_headers(headers, token) assert headers["Authorization"] == "Bearer " + token @@ -321,31 +322,51 @@ def test_azure_key_credential_updates(): credential.update(api_key) assert credential.key == api_key + combinations = [ ("sig=test_signature", "https://test_sas_credential", "https://test_sas_credential?sig=test_signature"), ("?sig=test_signature", "https://test_sas_credential", "https://test_sas_credential?sig=test_signature"), - ("sig=test_signature", "https://test_sas_credential?sig=test_signature", "https://test_sas_credential?sig=test_signature"), - ("?sig=test_signature", "https://test_sas_credential?sig=test_signature", "https://test_sas_credential?sig=test_signature"), + ( + "sig=test_signature", + "https://test_sas_credential?sig=test_signature", + "https://test_sas_credential?sig=test_signature", + ), + ( + "?sig=test_signature", + "https://test_sas_credential?sig=test_signature", + "https://test_sas_credential?sig=test_signature", + ), ("sig=test_signature", "https://test_sas_credential?", "https://test_sas_credential?sig=test_signature"), ("?sig=test_signature", "https://test_sas_credential?", "https://test_sas_credential?sig=test_signature"), - ("sig=test_signature", "https://test_sas_credential?foo=bar", "https://test_sas_credential?foo=bar&sig=test_signature"), - ("?sig=test_signature", "https://test_sas_credential?foo=bar", "https://test_sas_credential?foo=bar&sig=test_signature"), + ( + "sig=test_signature", + "https://test_sas_credential?foo=bar", + "https://test_sas_credential?foo=bar&sig=test_signature", + ), + ( + "?sig=test_signature", + "https://test_sas_credential?foo=bar", + "https://test_sas_credential?foo=bar&sig=test_signature", + ), ] + @pytest.mark.parametrize("combinations,http_request", product(combinations, HTTP_REQUESTS)) def test_azure_sas_credential_policy(combinations, http_request): """Tests to see if we can create an AzureSasCredentialPolicy""" sas, url, expected_url = combinations + def verify_authorization(request): assert request.url == expected_url - transport=Mock(send=verify_authorization) + transport = Mock(send=verify_authorization) credential = AzureSasCredential(sas) credential_policy = AzureSasCredentialPolicy(credential=credential) pipeline = Pipeline(transport=transport, policies=[credential_policy]) pipeline.run(http_request("GET", url)) + def test_azure_sas_credential_updates(): """Tests AzureSasCredential updates""" sas = "original" @@ -357,12 +378,14 @@ def test_azure_sas_credential_updates(): credential.update(sas) assert credential.signature == sas + def test_azure_sas_credential_policy_raises(): """Tests AzureSasCredential and AzureSasCredentialPolicy raises with non-string input parameters.""" sas = 1234 with pytest.raises(TypeError): credential = AzureSasCredential(sas) + def test_azure_named_key_credential(): cred = AzureNamedKeyCredential("sample_name", "samplekey") @@ -375,6 +398,7 @@ def test_azure_named_key_credential(): assert cred.named_key.key == "newkey" assert isinstance(cred.named_key, tuple) + def test_azure_named_key_credential_raises(): with pytest.raises(TypeError, match="Both name and key must be strings."): cred = AzureNamedKeyCredential("sample_name", 123345) diff --git a/sdk/core/azure-core/tests/test_base_polling.py b/sdk/core/azure-core/tests/test_base_polling.py index c0a403de289a..b470f088ee75 100644 --- a/sdk/core/azure-core/tests/test_base_polling.py +++ b/sdk/core/azure-core/tests/test_base_polling.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import base64 import datetime import json @@ -52,6 +52,7 @@ from azure.core.pipeline._tools import is_rest from rest_client import TestRestClient + class SimpleResource: """An implementation of Python 3 SimpleNamespace. Used to deserialize resource objects from response bodies where @@ -69,25 +70,33 @@ def __repr__(self): def __eq__(self, other): return self.__dict__ == other.__dict__ + class BadEndpointError(Exception): pass -TEST_NAME = 'foo' -RESPONSE_BODY = {'properties':{'provisioningState': 'InProgress'}} -ASYNC_BODY = json.dumps({ 'status': 'Succeeded' }) -ASYNC_URL = 'http://dummyurlFromAzureAsyncOPHeader_Return200' -LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) -LOCATION_URL = 'http://dummyurlurlFromLocationHeader_Return200' -RESOURCE_BODY = json.dumps({ 'name': TEST_NAME }) -RESOURCE_URL = 'http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1' -ERROR = 'http://dummyurl_ReturnError' + +TEST_NAME = "foo" +RESPONSE_BODY = {"properties": {"provisioningState": "InProgress"}} +ASYNC_BODY = json.dumps({"status": "Succeeded"}) +ASYNC_URL = "http://dummyurlFromAzureAsyncOPHeader_Return200" +LOCATION_BODY = json.dumps({"name": TEST_NAME}) +LOCATION_URL = "http://dummyurlurlFromLocationHeader_Return200" +RESOURCE_BODY = json.dumps({"name": TEST_NAME}) +RESOURCE_URL = "http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1" +ERROR = "http://dummyurl_ReturnError" POLLING_STATUS = 200 CLIENT = PipelineClient("http://example.org") CLIENT.http_request_type = None CLIENT.http_response_type = None + + def mock_run(client_self, request, **kwargs): - return TestBasePolling.mock_update(client_self.http_request_type, client_self.http_response_type, request.url, request.headers) + return TestBasePolling.mock_update( + client_self.http_request_type, client_self.http_response_type, request.url, request.headers + ) + + CLIENT._pipeline.run = types.MethodType(mock_run, CLIENT) @@ -103,21 +112,23 @@ def pipeline_client_builder(): send will receive "request" and kwargs as any transport layer """ + def create_client(send_cb): class TestHttpTransport(HttpTransport): - def open(self): pass - def close(self): pass - def __exit__(self, *args, **kwargs): pass + def open(self): + pass + + def close(self): + pass + + def __exit__(self, *args, **kwargs): + pass def send(self, request, **kwargs): return send_cb(request, **kwargs) - return PipelineClient( - 'http://example.org/', - pipeline=Pipeline( - transport=TestHttpTransport() - ) - ) + return PipelineClient("http://example.org/", pipeline=Pipeline(transport=TestHttpTransport())) + return create_client @@ -125,6 +136,7 @@ def send(self, request, **kwargs): def deserialization_cb(): def cb(pipeline_response): return json.loads(pipeline_response.http_response.text()) + return cb @@ -142,15 +154,13 @@ def _callback(http_response, headers={}): None, response, ) - polling._pipeline_response = PipelineResponse( - None, - response, - PipelineContext(None) - ) + polling._pipeline_response = PipelineResponse(None, response, PipelineContext(None)) polling._initial_response = polling._pipeline_response return polling + return _callback + @pytest.mark.parametrize("http_response", REQUESTS_TRANSPORT_RESPONSES) def test_base_polling_continuation_token(client, polling_response, http_response): polling = polling_response(http_response) @@ -166,166 +176,138 @@ def test_base_polling_continuation_token(client, polling_response, http_response new_polling = LROBasePolling() new_polling.initialize(*polling_args) + @pytest.mark.parametrize("http_response", REQUESTS_TRANSPORT_RESPONSES) def test_delay_extraction_int(polling_response, http_response): polling = polling_response(http_response, {"Retry-After": "10"}) assert polling._extract_delay() == 10 -@pytest.mark.skipif(platform.python_implementation() == 'PyPy', reason="https://stackoverflow.com/questions/11146725/isinstance-and-mocking") +@pytest.mark.skipif( + platform.python_implementation() == "PyPy", + reason="https://stackoverflow.com/questions/11146725/isinstance-and-mocking", +) @pytest.mark.parametrize("http_response", REQUESTS_TRANSPORT_RESPONSES) def test_delay_extraction_httpdate(polling_response, http_response): polling = polling_response(http_response, {"Retry-After": "Mon, 20 Nov 1995 19:12:08 -0500"}) - from datetime import datetime as basedatetime - now_mock_datetime = datetime.datetime(1995, 11, 20, 18, 12, 8, tzinfo=_FixedOffset(-5*60)) - with mock.patch('datetime.datetime') as mock_datetime: + + now_mock_datetime = datetime.datetime(1995, 11, 20, 18, 12, 8, tzinfo=_FixedOffset(-5 * 60)) + with mock.patch("datetime.datetime") as mock_datetime: mock_datetime.now.return_value = now_mock_datetime mock_datetime.side_effect = lambda *args, **kw: basedatetime(*args, **kw) - assert polling._extract_delay() == 60*60 # one hour in seconds + assert polling._extract_delay() == 60 * 60 # one hour in seconds assert str(mock_datetime.now.call_args[0][0]) == "" + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) def test_post(pipeline_client_builder, deserialization_cb, http_request, http_response): - # Test POST LRO with both Location and Operation-Location + # Test POST LRO with both Location and Operation-Location + + # The initial response contains both Location and Operation-Location, a 202 and no Body + initial_response = TestBasePolling.mock_send( + http_request, + http_response, + "POST", + 202, + { + "location": "http://example.org/location", + "operation-location": "http://example.org/async_monitor", + }, + "", + ) - # The initial response contains both Location and Operation-Location, a 202 and no Body - initial_response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', - 202, - { - 'location': 'http://example.org/location', - 'operation-location': 'http://example.org/async_monitor', - }, - '' - ) + def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/location": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"location_result": True} + ).http_response + elif request.url == "http://example.org/async_monitor": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"status": "Succeeded"} + ).http_response + else: + pytest.fail("No other query allowed") - def send(request, **kwargs): - assert request.method == 'GET' + client = pipeline_client_builder(send) - if request.url == 'http://example.org/location': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'location_result': True} - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") + # LRO options with Location final state + poll = LROPoller(client, initial_response, deserialization_cb, LROBasePolling(0)) + result = poll.result() + assert result["location_result"] == True - client = pipeline_client_builder(send) + # Location has no body - # LRO options with Location final state - poll = LROPoller( - client, - initial_response, - deserialization_cb, - LROBasePolling(0)) - result = poll.result() - assert result['location_result'] == True + def send(request, **kwargs): + assert request.method == "GET" - # Location has no body + if request.url == "http://example.org/location": + response = TestBasePolling.mock_send(http_request, http_response, "GET", 200, body=None).http_response + return response + elif request.url == "http://example.org/async_monitor": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"status": "Succeeded"} + ).http_response + else: + pytest.fail("No other query allowed") - def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/location': - response = TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body=None - ).http_response - return response - elif request.url == 'http://example.org/async_monitor': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") + client = pipeline_client_builder(send) - client = pipeline_client_builder(send) + poll = LROPoller(client, initial_response, deserialization_cb, LROBasePolling(0)) + result = poll.result() + assert result is None - poll = LROPoller( - client, - initial_response, - deserialization_cb, - LROBasePolling(0)) - result = poll.result() - assert result is None @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) def test_post_resource_location(pipeline_client_builder, deserialization_cb, http_request, http_response): - # ResourceLocation - - # The initial response contains both Location and Operation-Location, a 202 and no Body - initial_response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', - 202, - { - 'operation-location': 'http://example.org/async_monitor', - }, - '' - ) - - def send(request, **kwargs): - assert request.method == 'GET' + # ResourceLocation + + # The initial response contains both Location and Operation-Location, a 202 and no Body + initial_response = TestBasePolling.mock_send( + http_request, + http_response, + "POST", + 202, + { + "operation-location": "http://example.org/async_monitor", + }, + "", + ) - if request.url == 'http://example.org/resource_location': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'location_result': True} - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded', 'resourceLocation': 'http://example.org/resource_location'} - ).http_response - else: - pytest.fail("No other query allowed") + def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/resource_location": + return TestBasePolling.mock_send( + http_request, http_response, "GET", 200, body={"location_result": True} + ).http_response + elif request.url == "http://example.org/async_monitor": + return TestBasePolling.mock_send( + http_request, + http_response, + "GET", + 200, + body={"status": "Succeeded", "resourceLocation": "http://example.org/resource_location"}, + ).http_response + else: + pytest.fail("No other query allowed") - client = pipeline_client_builder(send) + client = pipeline_client_builder(send) - poll = LROPoller( - client, - initial_response, - deserialization_cb, - LROBasePolling(0)) - result = poll.result() - assert result['location_result'] == True + poll = LROPoller(client, initial_response, deserialization_cb, LROBasePolling(0)) + result = poll.result() + assert result["location_result"] == True class TestBasePolling(object): - convert = re.compile('([a-z0-9])([A-Z])') + convert = re.compile("([a-z0-9])([A-Z])") @staticmethod def mock_send(http_request, http_response, method, status, headers=None, body=RESPONSE_BODY): @@ -333,13 +315,11 @@ def mock_send(http_request, http_response, method, status, headers=None, body=RE headers = {} response = Response() response._content_consumed = True - response._content = json.dumps(body).encode('ascii') if body is not None else None + response._content = json.dumps(body).encode("ascii") if body is not None else None response.request = Request() response.request.method = method response.request.url = RESOURCE_URL - response.request.headers = { - 'x-ms-client-request-id': '67f4dd4e-6262-45e1-8bed-5c45cf23b6d9' - } + response.request.headers = {"x-ms-client-request-id": "67f4dd4e-6262-45e1-8bed-5c45cf23b6d9"} response.status_code = status response.headers = headers response.headers.update({"content-type": "application/json; charset=utf8"}) @@ -360,25 +340,21 @@ def mock_send(http_request, http_response, method, status, headers=None, body=RE response.request.headers, body, None, # form_content - None # stream_content + None, # stream_content ) response = create_transport_response( http_response, request, response, ) - return PipelineResponse( - request, - response, - None # context - ) + return PipelineResponse(request, response, None) # context @staticmethod def mock_update(http_request, http_response, url, headers=None): response = Response() response._content_consumed = True response.request = mock.create_autospec(Request) - response.request.method = 'GET' + response.request.method = "GET" response.headers = headers or {} response.headers.update({"content-type": "application/json; charset=utf8"}) response.reason = "OK" @@ -386,13 +362,13 @@ def mock_update(http_request, http_response, url, headers=None): if url == ASYNC_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = ASYNC_BODY.encode('ascii') + response._content = ASYNC_BODY.encode("ascii") response.randomFieldFromPollAsyncOpHeader = None elif url == LOCATION_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = LOCATION_BODY.encode('ascii') + response._content = LOCATION_BODY.encode("ascii") response.randomFieldFromPollLocationHeader = None elif url == ERROR: @@ -401,10 +377,10 @@ def mock_update(http_request, http_response, url, headers=None): elif url == RESOURCE_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = RESOURCE_BODY.encode('ascii') + response._content = RESOURCE_BODY.encode("ascii") else: - raise Exception('URL does not match') + raise Exception("URL does not match") request = http_request( response.request.method, response.request.url, @@ -414,11 +390,7 @@ def mock_update(http_request, http_response, url, headers=None): request, response, ) - return PipelineResponse( - request, - response, - None # context - ) + return PipelineResponse(request, response, None) # context @staticmethod def mock_outputs(pipeline_response): @@ -428,15 +400,13 @@ def mock_outputs(pipeline_response): except ValueError: raise DecodeError("Impossible to deserialize") - body = {TestBasePolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in body.items()} - properties = body.setdefault('properties', {}) - if 'name' in body: - properties['name'] = body['name'] + body = {TestBasePolling.convert.sub(r"\1_\2", k).lower(): v for k, v in body.items()} + properties = body.setdefault("properties", {}) + if "name" in body: + properties["name"] = body["name"] if properties: - properties = {TestBasePolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in properties.items()} - del body['properties'] + properties = {TestBasePolling.convert.sub(r"\1_\2", k).lower(): v for k, v in properties.items()} + del body["properties"] body.update(properties) resource = SimpleResource(**body) else: @@ -446,103 +416,67 @@ def mock_outputs(pipeline_response): @staticmethod def mock_deserialization_no_body(pipeline_response): - """Use this mock when you don't expect a return (last body irrelevant) - """ + """Use this mock when you don't expect a return (last body irrelevant)""" return None @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) def test_long_running_put(self, http_request, http_response): - #TODO: Test custom header field + # TODO: Test custom header field # Test throw on non LRO related status code - response = TestBasePolling.mock_send( - http_request, - http_response, 'PUT', 1000, {}) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 1000, {}) CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response with pytest.raises(HttpResponseError): - LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)).result() + LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)).result() # Test with no polling necessary - response_body = { - 'properties':{'provisioningState': 'Succeeded'}, - 'name': TEST_NAME - } - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {}, response_body - ) + response_body = {"properties": {"provisioningState": "Succeeded"}, "name": TEST_NAME} + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {}, response_body) + def no_update_allowed(url, headers=None): raise ValueError("Should not try to update") - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0) - ) + + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'operation-location': ASYNC_URL}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"operation-location": ASYNC_URL}) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'location': LOCATION_URL}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test polling initial payload invalid (SQLDb) response_body = {} # Empty will raise response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'location': LOCATION_URL}, response_body) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + http_request, http_response, "PUT", 201, {"location": LOCATION_URL}, response_body + ) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test fail to poll from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'operation-location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"operation-location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)).result() + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)).result() # Test fail to poll from location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PUT', 201, - {'location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PUT", 201, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)).result() + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)).result() @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) def test_long_running_patch(self, http_request, http_response): @@ -552,93 +486,84 @@ def test_long_running_patch(self, http_request, http_response): response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + "PATCH", + 202, + {"location": LOCATION_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test polling from operation-location header response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 202, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + "PATCH", + 202, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from location header response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 200, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + "PATCH", + 200, + {"location": LOCATION_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test polling from operation-location header response = TestBasePolling.mock_send( http_request, http_response, - 'PATCH', 200, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + "PATCH", + 200, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test fail to poll from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PATCH', 202, - {'operation-location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PATCH", 202, {"operation-location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)).result() + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)).result() # Test fail to poll from location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'PATCH', 202, - {'location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "PATCH", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)).result() + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)).result() @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) def test_long_running_delete(self, http_request, http_response): # Test polling from operation-location header response = TestBasePolling.mock_send( - http_request, - http_response, - 'DELETE', 202, - {'operation-location': ASYNC_URL}, - body="" + http_request, http_response, "DELETE", 202, {"operation-location": ASYNC_URL}, body="" ) CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_deserialization_no_body, - LROBasePolling(0)) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_deserialization_no_body, LROBasePolling(0)) poll.wait() - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader + is None + ) @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) def test_long_running_post_legacy(self, http_request, http_response): @@ -648,64 +573,61 @@ def test_long_running_post_legacy(self, http_request, http_response): response = TestBasePolling.mock_send( http_request, http_response, - 'POST', 201, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "POST", + 201, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_deserialization_no_body, - LROBasePolling(0)) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_deserialization_no_body, LROBasePolling(0)) poll.wait() - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader + is None + ) # Test polling from operation-location header response = TestBasePolling.mock_send( http_request, http_response, - 'POST', 202, - {'operation-location': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_deserialization_no_body, - LROBasePolling(0)) + "POST", + 202, + {"operation-location": ASYNC_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_deserialization_no_body, LROBasePolling(0)) poll.wait() - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader + is None + ) # Test polling from location header response = TestBasePolling.mock_send( http_request, http_response, - 'POST', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + "POST", + 202, + {"location": LOCATION_URL}, + body={"properties": {"provisioningState": "Succeeded"}}, + ) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test fail to poll from operation-location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'operation-location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"operation-location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)).result() + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)).result() # Test fail to poll from location header - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': ERROR}) + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)).result() + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)).result() @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) def test_long_running_negative(self, http_request, http_response): @@ -714,48 +636,27 @@ def test_long_running_negative(self, http_request, http_response): CLIENT.http_request_type = http_request CLIENT.http_response_type = http_response # Test LRO PUT throws for invalid json - LOCATION_BODY = '{' - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': LOCATION_URL}) - poll = LROPoller( - CLIENT, - response, - TestBasePolling.mock_outputs, - LROBasePolling(0) - ) + LOCATION_BODY = "{" + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) with pytest.raises(DecodeError): poll.result() - LOCATION_BODY = '{\'"}' - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': LOCATION_URL}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) + LOCATION_BODY = "{'\"}" + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) with pytest.raises(DecodeError): poll.result() - LOCATION_BODY = '{' + LOCATION_BODY = "{" POLLING_STATUS = 203 - response = TestBasePolling.mock_send( - http_request, - http_response, - 'POST', 202, - {'location': LOCATION_URL}) - poll = LROPoller(CLIENT, response, - TestBasePolling.mock_outputs, - LROBasePolling(0)) - with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization + response = TestBasePolling.mock_send(http_request, http_response, "POST", 202, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestBasePolling.mock_outputs, LROBasePolling(0)) + with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization poll.result() - assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode('ascii') + assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode("ascii") - LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) + LOCATION_BODY = json.dumps({"name": TEST_NAME}) POLLING_STATUS = 200 @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(REQUESTS_TRANSPORT_RESPONSES)) @@ -767,33 +668,25 @@ def test_post_final_state_via(self, pipeline_client_builder, deserialization_cb, initial_response = TestBasePolling.mock_send( http_request, http_response, - 'POST', + "POST", 202, { - 'location': 'http://example.org/location', - 'operation-location': 'http://example.org/async_monitor', + "location": "http://example.org/location", + "operation-location": "http://example.org/async_monitor", }, - '' + "", ) def send(request, **kwargs): - assert request.method == 'GET' + assert request.method == "GET" - if request.url == 'http://example.org/location': + if request.url == "http://example.org/location": return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'location_result': True} + http_request, http_response, "GET", 200, body={"location_result": True} ).http_response - elif request.url == 'http://example.org/async_monitor': + elif request.url == "http://example.org/async_monitor": return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} + http_request, http_response, "GET", 200, body={"status": "Succeeded"} ).http_response else: pytest.fail("No other query allowed") @@ -802,51 +695,36 @@ def send(request, **kwargs): # Test 1, LRO options with Location final state poll = LROPoller( - client, - initial_response, - deserialization_cb, - LROBasePolling(0, lro_options={"final-state-via": "location"})) + client, initial_response, deserialization_cb, LROBasePolling(0, lro_options={"final-state-via": "location"}) + ) result = poll.result() - assert result['location_result'] == True + assert result["location_result"] == True # Test 2, LRO options with Operation-Location final state poll = LROPoller( client, initial_response, deserialization_cb, - LROBasePolling(0, lro_options={"final-state-via": "operation-location"})) + LROBasePolling(0, lro_options={"final-state-via": "operation-location"}), + ) result = poll.result() - assert result['status'] == 'Succeeded' + assert result["status"] == "Succeeded" # Test 3, "do the right thing" and use Location by default - poll = LROPoller( - client, - initial_response, - deserialization_cb, - LROBasePolling(0)) + poll = LROPoller(client, initial_response, deserialization_cb, LROBasePolling(0)) result = poll.result() - assert result['location_result'] == True + assert result["location_result"] == True # Test 4, location has no body def send(request, **kwargs): - assert request.method == 'GET' + assert request.method == "GET" - if request.url == 'http://example.org/location': - return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body=None - ).http_response - elif request.url == 'http://example.org/async_monitor': + if request.url == "http://example.org/location": + return TestBasePolling.mock_send(http_request, http_response, "GET", 200, body=None).http_response + elif request.url == "http://example.org/async_monitor": return TestBasePolling.mock_send( - http_request, - http_response, - 'GET', - 200, - body={'status': 'Succeeded'} + http_request, http_response, "GET", 200, body={"status": "Succeeded"} ).http_response else: pytest.fail("No other query allowed") @@ -854,13 +732,12 @@ def send(request, **kwargs): client = pipeline_client_builder(send) poll = LROPoller( - client, - initial_response, - deserialization_cb, - LROBasePolling(0, lro_options={"final-state-via": "location"})) + client, initial_response, deserialization_cb, LROBasePolling(0, lro_options={"final-state-via": "location"}) + ) result = poll.result() assert result is None + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_final_get_via_location(port, http_request, deserialization_cb): client = TestRestClient(port) @@ -879,6 +756,7 @@ def test_final_get_via_location(port, http_request, deserialization_cb): result = poller.result() assert result == {"returnedFrom": "locationHeaderUrl"} + # THIS TEST WILL BE REMOVED SOON """Weird test, but we are temporarily adding back the POST check in OperationResourcePolling get_final_get_url. With the test added back, we should not exit on final state via checks and @@ -886,6 +764,8 @@ def test_final_get_via_location(port, http_request, deserialization_cb): and since I don't want to bother with adding a pipeline response object, just check that we get past the final state via checks """ + + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_post_check_patch(http_request): algorithm = OperationResourcePolling(lro_options={"final-state-via": "azure-async-operation"}) diff --git a/sdk/core/azure-core/tests/test_basic_transport.py b/sdk/core/azure-core/tests/test_basic_transport.py index 46a157fbce14..1a316a78a13b 100644 --- a/sdk/core/azure-core/tests/test_basic_transport.py +++ b/sdk/core/azure-core/tests/test_basic_transport.py @@ -19,7 +19,12 @@ from azure.core.exceptions import HttpResponseError import logging import pytest -from utils import HTTP_REQUESTS, request_and_responses_product, HTTP_CLIENT_TRANSPORT_RESPONSES, create_transport_response +from utils import ( + HTTP_REQUESTS, + request_and_responses_product, + HTTP_CLIENT_TRANSPORT_RESPONSES, + create_transport_response, +) from azure.core.rest._http_response_impl import HttpResponseImpl as RestHttpResponseImpl from azure.core.pipeline._tools import is_rest @@ -33,6 +38,7 @@ def __init__(self, request, body, content_type): def body(self): return self._body + class RestMockResponse(RestHttpResponseImpl): def __init__(self, request, body, content_type): super(RestMockResponse, self).__init__( @@ -56,6 +62,7 @@ def body(self): def content(self): return self._body + MOCK_RESPONSES = [PipelineTransportMockResponse, RestMockResponse] @@ -66,9 +73,9 @@ def test_http_request_serialization(http_request): serialized = request.serialize() expected = ( - b'DELETE /container0/blob0 HTTP/1.1\r\n' + b"DELETE /container0/blob0 HTTP/1.1\r\n" # No headers - b'\r\n' + b"\r\n" ) assert serialized == expected @@ -77,24 +84,25 @@ def test_http_request_serialization(http_request): "DELETE", "/container0/blob0", # Use OrderedDict to get consistent test result on 3.5 where order is not guaranteed - headers=OrderedDict({ - "x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT", - "Authorization": "SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=", # fake key suppressed in credscan - "Content-Length": "0", - }) + headers=OrderedDict( + { + "x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT", + "Authorization": "SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=", # fake key suppressed in credscan + "Content-Length": "0", + } + ), ) serialized = request.serialize() expected = ( - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'Authorization: SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=\r\n' # fake key suppressed in credscan - b'Content-Length: 0\r\n' - b'\r\n' + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"Authorization: SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=\r\n" # fake key suppressed in credscan + b"Content-Length: 0\r\n" + b"\r\n" ) assert serialized == expected - # Method + Url + Headers + Body request = http_request( "DELETE", @@ -107,21 +115,21 @@ def test_http_request_serialization(http_request): serialized = request.serialize() expected = ( - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'Content-Length: 10\r\n' - b'\r\n' - b'I am groot' + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"Content-Length: 10\r\n" + b"\r\n" + b"I am groot" ) assert serialized == expected @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_url_join(http_request): - assert _urljoin('devstoreaccount1', '') == 'devstoreaccount1/' - assert _urljoin('devstoreaccount1', 'testdir/') == 'devstoreaccount1/testdir/' - assert _urljoin('devstoreaccount1/', '') == 'devstoreaccount1/' - assert _urljoin('devstoreaccount1/', 'testdir/') == 'devstoreaccount1/testdir/' + assert _urljoin("devstoreaccount1", "") == "devstoreaccount1/" + assert _urljoin("devstoreaccount1", "testdir/") == "devstoreaccount1/testdir/" + assert _urljoin("devstoreaccount1/", "") == "devstoreaccount1/" + assert _urljoin("devstoreaccount1/", "testdir/") == "devstoreaccount1/testdir/" @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_CLIENT_TRANSPORT_RESPONSES)) @@ -154,19 +162,16 @@ def test_response_deserialization(http_request): # Method + Url request = http_request("DELETE", "/container0/blob0") body = ( - b'HTTP/1.1 202 Accepted\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' + b"HTTP/1.1 202 Accepted\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" ) response = _deserialize_response(body, request) assert response.status_code == 202 assert response.reason == "Accepted" - assert response.headers == { - 'x-ms-request-id': '778fdc83-801e-0000-62ff-0334671e284f', - 'x-ms-version': '2018-11-09' - } + assert response.headers == {"x-ms-request-id": "778fdc83-801e-0000-62ff-0334671e284f", "x-ms-version": "2018-11-09"} # Method + Url + Headers + Body request = http_request( @@ -178,41 +183,39 @@ def test_response_deserialization(http_request): ) request.set_bytes_body(b"I am groot") body = ( - b'HTTP/1.1 200 OK\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'I am groot' + b"HTTP/1.1 200 OK\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"I am groot" ) response = _deserialize_response(body, request) assert isinstance(response.status_code, int) assert response.reason == "OK" - assert response.headers == { - 'x-ms-request-id': '778fdc83-801e-0000-62ff-0334671e284f', - 'x-ms-version': '2018-11-09' - } + assert response.headers == {"x-ms-request-id": "778fdc83-801e-0000-62ff-0334671e284f", "x-ms-version": "2018-11-09"} assert response.text() == "I am groot" + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_response_deserialization_utf8_bom(http_request): request = http_request("DELETE", "/container0/blob0") body = ( - b'HTTP/1.1 400 One of the request inputs is not valid.\r\n' - b'x-ms-error-code: InvalidInput\r\n' - b'x-ms-request-id: 5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\r\n' - b'x-ms-version: 2019-02-02\r\n' - b'Content-Length: 220\r\n' - b'Content-Type: application/xml\r\n' - b'Server: Windows-Azure-Blob/1.0\r\n' - b'\r\n' + b"HTTP/1.1 400 One of the request inputs is not valid.\r\n" + b"x-ms-error-code: InvalidInput\r\n" + b"x-ms-request-id: 5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\r\n" + b"x-ms-version: 2019-02-02\r\n" + b"Content-Length: 220\r\n" + b"Content-Type: application/xml\r\n" + b"Server: Windows-Azure-Blob/1.0\r\n" + b"\r\n" b'\xef\xbb\xbf\nInvalidInputOne' - b'of the request inputs is not valid.\nRequestId:5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\nTime:2019-09-17T23:44:07.4671860Z' + b"of the request inputs is not valid.\nRequestId:5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\nTime:2019-09-17T23:44:07.4671860Z" ) response = _deserialize_response(body, request) - assert response.body().startswith(b'\xef\xbb\xbf') + assert response.body().startswith(b"\xef\xbb\xbf") @pytest.mark.parametrize("http_request", HTTP_REQUESTS) @@ -220,9 +223,7 @@ def test_multipart_send(http_request): transport = mock.MagicMock(spec=HttpTransport) - header_policy = HeadersPolicy({ - 'x-ms-date': 'Thu, 14 Jun 2018 16:46:54 GMT' - }) + header_policy = HeadersPolicy({"x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT"}) req0 = http_request("DELETE", "/container0/blob0") req1 = http_request("DELETE", "/container1/blob1") @@ -232,32 +233,32 @@ def test_multipart_send(http_request): req0, req1, policies=[header_policy], - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" # Fix it so test are deterministic + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", # Fix it so test are deterministic ) with Pipeline(transport) as pipeline: pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -265,9 +266,7 @@ def test_multipart_send(http_request): def test_multipart_send_with_context(http_request): transport = mock.MagicMock(spec=HttpTransport) - header_policy = HeadersPolicy({ - 'x-ms-date': 'Thu, 14 Jun 2018 16:46:54 GMT' - }) + header_policy = HeadersPolicy({"x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT"}) req0 = http_request("DELETE", "/container0/blob0") req1 = http_request("DELETE", "/container1/blob1") @@ -277,35 +276,35 @@ def test_multipart_send_with_context(http_request): req0, req1, policies=[header_policy], - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", # Fix it so test are deterministic - headers={'Accept': 'application/json'} + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", # Fix it so test are deterministic + headers={"Accept": "application/json"}, ) with Pipeline(transport) as pipeline: pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'Accept: application/json\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'Accept: application/json\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"Accept: application/json\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"Accept: application/json\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -314,20 +313,13 @@ def test_multipart_send_with_one_changeset(http_request): transport = mock.MagicMock(spec=HttpTransport) - header_policy = HeadersPolicy({ - 'x-ms-date': 'Thu, 14 Jun 2018 16:46:54 GMT' - }) + header_policy = HeadersPolicy({"x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT"}) - requests = [ - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") - ] + requests = [http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1")] changeset = http_request("", "") changeset.set_multipart_mixed( - *requests, - policies=[header_policy], - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + *requests, policies=[header_policy], boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") @@ -340,30 +332,30 @@ def test_multipart_send_with_one_changeset(http_request): pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -372,23 +364,21 @@ def test_multipart_send_with_multiple_changesets(http_request): transport = mock.MagicMock(spec=HttpTransport) - header_policy = HeadersPolicy({ - 'x-ms-date': 'Thu, 14 Jun 2018 16:46:54 GMT' - }) + header_policy = HeadersPolicy({"x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT"}) changeset1 = http_request("", "") changeset1.set_multipart_mixed( http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1"), policies=[header_policy], - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) changeset2 = http_request("", "") changeset2.set_multipart_mixed( http_request("DELETE", "/container2/blob2"), http_request("DELETE", "/container3/blob3"), policies=[header_policy], - boundary="changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314" + boundary="changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314", ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") @@ -403,53 +393,53 @@ def test_multipart_send_with_multiple_changesets(http_request): pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 3\r\n' - b'\r\n' - b'DELETE /container3/blob3 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 3\r\n" + b"\r\n" + b"DELETE /container3/blob3 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -458,62 +448,60 @@ def test_multipart_send_with_combination_changeset_first(http_request): transport = mock.MagicMock(spec=HttpTransport) - header_policy = HeadersPolicy({ - 'x-ms-date': 'Thu, 14 Jun 2018 16:46:54 GMT' - }) + header_policy = HeadersPolicy({"x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT"}) changeset = http_request("", "") changeset.set_multipart_mixed( http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1"), policies=[header_policy], - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( changeset, http_request("DELETE", "/container2/blob2"), policies=[header_policy], - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) with Pipeline(transport) as pipeline: pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -522,62 +510,60 @@ def test_multipart_send_with_combination_changeset_last(http_request): transport = mock.MagicMock(spec=HttpTransport) - header_policy = HeadersPolicy({ - 'x-ms-date': 'Thu, 14 Jun 2018 16:46:54 GMT' - }) + header_policy = HeadersPolicy({"x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT"}) changeset = http_request("", "") changeset.set_multipart_mixed( http_request("DELETE", "/container1/blob1"), http_request("DELETE", "/container2/blob2"), policies=[header_policy], - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( http_request("DELETE", "/container0/blob0"), changeset, policies=[header_policy], - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) with Pipeline(transport) as pipeline: pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @@ -586,15 +572,13 @@ def test_multipart_send_with_combination_changeset_middle(http_request): transport = mock.MagicMock(spec=HttpTransport) - header_policy = HeadersPolicy({ - 'x-ms-date': 'Thu, 14 Jun 2018 16:46:54 GMT' - }) + header_policy = HeadersPolicy({"x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT"}) changeset = http_request("", "") changeset.set_multipart_mixed( http_request("DELETE", "/container1/blob1"), policies=[header_policy], - boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( @@ -602,66 +586,61 @@ def test_multipart_send_with_combination_changeset_middle(http_request): changeset, http_request("DELETE", "/container2/blob2"), policies=[header_policy], - boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525" + boundary="batch_357de4f7-6d0b-4e02-8cd2-6361411a9525", ) with Pipeline(transport) as pipeline: pipeline.run(request) assert request.body == ( - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'DELETE /container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'DELETE /container1/blob1 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'DELETE /container2/blob2 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'\r\n' - b'\r\n' - b'--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"DELETE /container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: multipart/mixed; boundary=changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"DELETE /container1/blob1 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"DELETE /container2/blob2 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"\r\n" + b"\r\n" + b"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" ) @pytest.mark.parametrize("http_request,mock_response", request_and_responses_product(MOCK_RESPONSES)) def test_multipart_receive(http_request, mock_response): - class ResponsePolicy(object): def on_response(self, request, response): # type: (PipelineRequest, PipelineResponse) -> None - response.http_response.headers['x-ms-fun'] = 'true' + response.http_response.headers["x-ms-fun"] = "true" req0 = http_request("DELETE", "/container0/blob0") req1 = http_request("DELETE", "/container1/blob1") request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") - request.set_multipart_mixed( - req0, - req1, - policies=[ResponsePolicy()] - ) + request.set_multipart_mixed(req0, req1, policies=[ResponsePolicy()]) body_as_str = ( "--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" @@ -692,8 +671,8 @@ def on_response(self, request, response): response = mock_response( request, - body_as_str.encode('ascii'), - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + body_as_str.encode("ascii"), + "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed", ) response = response.parts() @@ -702,11 +681,12 @@ def on_response(self, request, response): res0 = response[0] assert res0.status_code == 202 - assert res0.headers['x-ms-fun'] == 'true' + assert res0.headers["x-ms-fun"] == "true" res1 = response[1] assert res1.status_code == 404 - assert res1.headers['x-ms-fun'] == 'true' + assert res1.headers["x-ms-fun"] == "true" + @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_raise_for_status_bad_response(mock_response): @@ -715,6 +695,7 @@ def test_raise_for_status_bad_response(mock_response): with pytest.raises(HttpResponseError): response.raise_for_status() + @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_raise_for_status_good_response(mock_response): response = mock_response(request=None, body=None, content_type=None) @@ -727,46 +708,43 @@ def test_multipart_receive_with_one_changeset(http_request, mock_response): changeset = http_request(None, None) changeset.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") + http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(changeset) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 202 Accepted\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 202 Accepted\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 202 Accepted\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 202 Accepted\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -783,75 +761,71 @@ def test_multipart_receive_with_multiple_changesets(http_request, mock_response) changeset1 = http_request(None, None) changeset1.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") + http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1") ) changeset2 = http_request(None, None) changeset2.set_multipart_mixed( - http_request("DELETE", "/container2/blob2"), - http_request("DELETE", "/container3/blob3") + http_request("DELETE", "/container2/blob2"), http_request("DELETE", "/container3/blob3") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(changeset1, changeset2) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314"\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 3\r\n' - b'\r\n' - b'HTTP/1.1 409\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 3\r\n" + b"\r\n" + b"HTTP/1.1 409\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_8b9e487e-a353-4dcb-a6f4-0688191e0314--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -869,55 +843,52 @@ def test_multipart_receive_with_combination_changeset_first(http_request, mock_r changeset = http_request(None, None) changeset.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - http_request("DELETE", "/container1/blob1") + http_request("DELETE", "/container0/blob0"), http_request("DELETE", "/container1/blob1") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(changeset, http_request("DELETE", "/container2/blob2")) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -937,53 +908,49 @@ def test_multipart_receive_with_combination_changeset_middle(http_request, mock_ request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed( - http_request("DELETE", "/container0/blob0"), - changeset, - http_request("DELETE", "/container2/blob2") + http_request("DELETE", "/container0/blob0"), changeset, http_request("DELETE", "/container2/blob2") ) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -1000,56 +967,53 @@ def test_multipart_receive_with_combination_changeset_last(http_request, mock_re changeset = http_request(None, None) changeset.set_multipart_mixed( - http_request("DELETE", "/container1/blob1"), - http_request("DELETE", "/container2/blob2") + http_request("DELETE", "/container1/blob1"), http_request("DELETE", "/container2/blob2") ) request = http_request("POST", "http://account.blob.core.windows.net/?comp=batch") request.set_multipart_mixed(http_request("DELETE", "/container0/blob0"), changeset) body_as_bytes = ( - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 2\r\n' - b'\r\n' - b'HTTP/1.1 200\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n' + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 2\r\n" + b"\r\n" + b"HTTP/1.1 200\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" b'Content-Type: multipart/mixed; boundary="changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525"\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 0\r\n' - b'\r\n' - b'HTTP/1.1 202\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n' - b'Content-Type: application/http\r\n' - b'Content-Transfer-Encoding: binary\r\n' - b'Content-ID: 1\r\n' - b'\r\n' - b'HTTP/1.1 404\r\n' - b'x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n' - b'x-ms-version: 2018-11-09\r\n' - b'\r\n' - b'\r\n' - b'--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n' - b'\r\n' - b'--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n' + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 0\r\n" + b"\r\n" + b"HTTP/1.1 202\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525\r\n" + b"Content-Type: application/http\r\n" + b"Content-Transfer-Encoding: binary\r\n" + b"Content-ID: 1\r\n" + b"\r\n" + b"HTTP/1.1 404\r\n" + b"x-ms-request-id: 778fdc83-801e-0000-62ff-0334671e284f\r\n" + b"x-ms-version: 2018-11-09\r\n" + b"\r\n" + b"\r\n" + b"--changeset_357de4f7-6d0b-4e02-8cd2-6361411a9525--\r\n" + b"\r\n" + b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--\r\n" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) parts = [] @@ -1073,21 +1037,19 @@ def test_multipart_receive_with_bom(http_request, mock_response): b"Content-Type: application/http\n" b"Content-Transfer-Encoding: binary\n" b"Content-ID: 0\n" - b'\r\n' - b'HTTP/1.1 400 One of the request inputs is not valid.\r\n' - b'Content-Length: 220\r\n' - b'Content-Type: application/xml\r\n' - b'Server: Windows-Azure-Blob/1.0\r\n' - b'\r\n' + b"\r\n" + b"HTTP/1.1 400 One of the request inputs is not valid.\r\n" + b"Content-Length: 220\r\n" + b"Content-Type: application/xml\r\n" + b"Server: Windows-Azure-Blob/1.0\r\n" + b"\r\n" b'\xef\xbb\xbf\nInvalidInputOne' - b'of the request inputs is not valid.\nRequestId:5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\nTime:2019-09-17T23:44:07.4671860Z\n' + b"of the request inputs is not valid.\nRequestId:5f3f9f2f-e01e-00cc-6eb1-6d00b5000000\nTime:2019-09-17T23:44:07.4671860Z\n" b"--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--" ) response = mock_response( - request, - body_as_bytes, - "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" + request, body_as_bytes, "multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" ) response = response.parts() @@ -1095,7 +1057,7 @@ def test_multipart_receive_with_bom(http_request, mock_response): res0 = response[0] assert res0.status_code == 400 - assert res0.body().startswith(b'\xef\xbb\xbf') + assert res0.body().startswith(b"\xef\xbb\xbf") @pytest.mark.parametrize("http_request,mock_response", request_and_responses_product(MOCK_RESPONSES)) @@ -1132,8 +1094,8 @@ def test_recursive_multipart_receive(http_request, mock_response): response = mock_response( request, - body_as_str.encode('ascii'), - "multipart/mixed; boundary=batchresponse_8d5f5bcd-2cb5-44bb-91b5-e9a722e68cb6" + body_as_str.encode("ascii"), + "multipart/mixed; boundary=batchresponse_8d5f5bcd-2cb5-44bb-91b5-e9a722e68cb6", ) response = response.parts() @@ -1188,4 +1150,4 @@ def test_conflict_timeout(caplog, port, http_request): with pytest.raises(ValueError): with Pipeline(transport) as pipeline: - pipeline.run(request, connection_timeout=(100, 100), read_timeout = 100) + pipeline.run(request, connection_timeout=(100, 100), read_timeout=100) diff --git a/sdk/core/azure-core/tests/test_connection_string_parsing.py b/sdk/core/azure-core/tests/test_connection_string_parsing.py index 1a3957e5b35d..713d973e8fd2 100644 --- a/sdk/core/azure-core/tests/test_connection_string_parsing.py +++ b/sdk/core/azure-core/tests/test_connection_string_parsing.py @@ -3,14 +3,15 @@ from devtools_testutils import AzureMgmtTestCase + class CoreConnectionStringParserTests(AzureMgmtTestCase): # cSpell:disable def test_parsing_with_case_sensitive_keys_for_sensitive_conn_str(self, **kwargs): - conn_str = 'Endpoint=XXXXENDPOINTXXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "Endpoint=XXXXENDPOINTXXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, True) - assert parse_result["Endpoint"] == 'XXXXENDPOINTXXXX' - assert parse_result["SharedAccessKeyName"] == 'XXXXPOLICYXXXX' - assert parse_result["SharedAccessKey"] == 'THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + assert parse_result["Endpoint"] == "XXXXENDPOINTXXXX" + assert parse_result["SharedAccessKeyName"] == "XXXXPOLICYXXXX" + assert parse_result["SharedAccessKey"] == "THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" with pytest.raises(KeyError): parse_result["endPoint"] with pytest.raises(KeyError): @@ -19,37 +20,37 @@ def test_parsing_with_case_sensitive_keys_for_sensitive_conn_str(self, **kwargs) parse_result["sharedaccesskey"] def test_parsing_with_case_insensitive_keys_for_sensitive_conn_str(self, **kwargs): - conn_str = 'Endpoint=XXXXENDPOINTXXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "Endpoint=XXXXENDPOINTXXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) - assert parse_result["endpoint"] == 'XXXXENDPOINTXXXX' - assert parse_result["sharedaccesskeyname"] == 'XXXXPOLICYXXXX' - assert parse_result["sharedaccesskey"] == 'THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + assert parse_result["endpoint"] == "XXXXENDPOINTXXXX" + assert parse_result["sharedaccesskeyname"] == "XXXXPOLICYXXXX" + assert parse_result["sharedaccesskey"] == "THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" def test_parsing_with_case_insensitive_keys_for_insensitive_conn_str(self, **kwargs): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) - assert parse_result["endpoint"] == 'XXXXENDPOINTXXXX' - assert parse_result["sharedaccesskeyname"] == 'XXXXPOLICYXXXX' - assert parse_result["sharedaccesskey"] == 'THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + assert parse_result["endpoint"] == "XXXXENDPOINTXXXX" + assert parse_result["sharedaccesskeyname"] == "XXXXPOLICYXXXX" + assert parse_result["sharedaccesskey"] == "THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" def test_error_with_duplicate_case_sensitive_keys_for_sensitive_conn_str(self, **kwargs): - conn_str = 'Endpoint=XXXXENDPOINTXXXX;Endpoint=XXXXENDPOINT2XXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "Endpoint=XXXXENDPOINTXXXX;Endpoint=XXXXENDPOINT2XXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" with pytest.raises(ValueError) as e: parse_result = parse_connection_string(conn_str, True) assert str(e.value) == "Connection string is either blank or malformed." def test_success_with_duplicate_case_sensitive_keys_for_sensitive_conn_str(self, **kwargs): - conn_str = 'enDpoInt=XXXXENDPOINTXXXX;Endpoint=XXXXENDPOINT2XXXX;' + conn_str = "enDpoInt=XXXXENDPOINTXXXX;Endpoint=XXXXENDPOINT2XXXX;" parse_result = parse_connection_string(conn_str, True) - assert parse_result["enDpoInt"] == 'XXXXENDPOINTXXXX' - assert parse_result["Endpoint"] == 'XXXXENDPOINT2XXXX' + assert parse_result["enDpoInt"] == "XXXXENDPOINTXXXX" + assert parse_result["Endpoint"] == "XXXXENDPOINT2XXXX" def test_error_with_duplicate_case_insensitive_keys_for_insensitive_conn_str(self, **kwargs): - conn_str = 'endPoinT=XXXXENDPOINTXXXX;eNdpOint=XXXXENDPOINT2XXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "endPoinT=XXXXENDPOINTXXXX;eNdpOint=XXXXENDPOINT2XXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" with pytest.raises(ValueError) as e: parse_result = parse_connection_string(conn_str, False) assert str(e.value) == "Duplicate key in connection string: endpoint" - + def test_error_with_malformed_conn_str(self): for conn_str in ["", "foobar", "foo;bar;baz", ";", "foo=;bar=;", "=", "=;=="]: with pytest.raises(ValueError) as e: @@ -57,34 +58,34 @@ def test_error_with_malformed_conn_str(self): self.assertEqual(str(e.value), "Connection string is either blank or malformed.") def test_case_insensitive_clear_method(self): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) parse_result.clear() assert len(parse_result) == 0 def test_case_insensitive_copy_method(self): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) copied = parse_result.copy() assert copied == parse_result - + def test_case_insensitive_get_method(self): - conn_str = 'Endpoint=XXXXENDPOINTXXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "Endpoint=XXXXENDPOINTXXXX;SharedAccessKeyName=XXXXPOLICYXXXX;SharedAccessKey=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) - assert parse_result.get("sharedaccesskeyname") == 'XXXXPOLICYXXXX' - assert parse_result.get("sharedaccesskey") == 'THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + assert parse_result.get("sharedaccesskeyname") == "XXXXPOLICYXXXX" + assert parse_result.get("sharedaccesskey") == "THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" assert parse_result.get("accesskey") is None assert parse_result.get("accesskey", "XXothertestkeyXX=") == "XXothertestkeyXX=" def test_case_insensitive_keys_method(self): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) keys = parse_result.keys() assert len(keys) == 3 assert "endpoint" in keys - + def test_case_insensitive_pop_method(self): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) endpoint = parse_result.pop("endpoint") sharedaccesskey = parse_result.pop("sharedaccesskey") @@ -93,8 +94,8 @@ def test_case_insensitive_pop_method(self): assert sharedaccesskey == "THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" def test_case_insensitive_update_with_insensitive_method(self): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' - conn_str2 = 'hostName=XXXXENDPOINTXXXX;ACCessKEy=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=;' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" + conn_str2 = "hostName=XXXXENDPOINTXXXX;ACCessKEy=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=;" parse_result_insensitive = parse_connection_string(conn_str, False) parse_result_insensitive2 = parse_connection_string(conn_str2, False) @@ -108,12 +109,12 @@ def test_case_insensitive_update_with_insensitive_method(self): parse_result_insensitive_dupe = parse_connection_string(conn_str_duplicate_key, False) parse_result_insensitive.update(parse_result_insensitive_dupe) assert parse_result_insensitive_dupe["endpoint"] == "XXXXENDPOINT2XXXX" - assert parse_result_insensitive_dupe["accesskey"] == "TestKey" + assert parse_result_insensitive_dupe["accesskey"] == "TestKey" assert len(parse_result_insensitive) == 5 def test_case_sensitive_update_with_insensitive_method(self): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' - conn_str2 = 'hostName=XXXXENDPOINTXXXX;ACCessKEy=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=;' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" + conn_str2 = "hostName=XXXXENDPOINTXXXX;ACCessKEy=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=;" parse_result_insensitive = parse_connection_string(conn_str, False) parse_result_sensitive = parse_connection_string(conn_str2, True) @@ -124,8 +125,9 @@ def test_case_sensitive_update_with_insensitive_method(self): parse_result_sensitive["hostname"] def test_case_insensitive_values_method(self): - conn_str = 'enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=' + conn_str = "enDpoiNT=XXXXENDPOINTXXXX;sharedaccesskeyname=XXXXPOLICYXXXX;SHAREDACCESSKEY=THISISATESTKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXX=" parse_result = parse_connection_string(conn_str, False) values = parse_result.values() assert len(values) == 3 - # cSpell:enable \ No newline at end of file + + # cSpell:enable diff --git a/sdk/core/azure-core/tests/test_custom_hook_policy.py b/sdk/core/azure-core/tests/test_custom_hook_policy.py index 8ff38e0c203f..402582d148a4 100644 --- a/sdk/core/azure-core/tests/test_custom_hook_policy.py +++ b/sdk/core/azure-core/tests/test_custom_hook_policy.py @@ -9,10 +9,11 @@ import mock from azure.core import PipelineClient from azure.core.pipeline.policies import CustomHookPolicy, UserAgentPolicy -from azure.core.pipeline.transport import HttpTransport +from azure.core.pipeline.transport import HttpTransport import pytest from utils import HTTP_REQUESTS + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_response_hook_policy_in_init(http_request): def test_callback(response): @@ -21,15 +22,13 @@ def test_callback(response): transport = mock.MagicMock(spec=HttpTransport) url = "http://localhost" custom_hook_policy = CustomHookPolicy(raw_response_hook=test_callback) - policies = [ - UserAgentPolicy("myuseragent"), - custom_hook_policy - ] + policies = [UserAgentPolicy("myuseragent"), custom_hook_policy] client = PipelineClient(base_url=url, policies=policies, transport=transport) request = http_request("GET", url) with pytest.raises(ValueError): client._pipeline.run(request) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_response_hook_policy_in_request(http_request): def test_callback(response): @@ -38,15 +37,13 @@ def test_callback(response): transport = mock.MagicMock(spec=HttpTransport) url = "http://localhost" custom_hook_policy = CustomHookPolicy() - policies = [ - UserAgentPolicy("myuseragent"), - custom_hook_policy - ] + policies = [UserAgentPolicy("myuseragent"), custom_hook_policy] client = PipelineClient(base_url=url, policies=policies, transport=transport) request = http_request("GET", url) with pytest.raises(ValueError): client._pipeline.run(request, raw_response_hook=test_callback) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_response_hook_policy_in_both(http_request): def test_callback(response): @@ -58,15 +55,13 @@ def test_callback_request(response): transport = mock.MagicMock(spec=HttpTransport) url = "http://localhost" custom_hook_policy = CustomHookPolicy(raw_response_hook=test_callback) - policies = [ - UserAgentPolicy("myuseragent"), - custom_hook_policy - ] + policies = [UserAgentPolicy("myuseragent"), custom_hook_policy] client = PipelineClient(base_url=url, policies=policies, transport=transport) request = http_request("GET", url) with pytest.raises(TypeError): client._pipeline.run(request, raw_response_hook=test_callback_request) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_hook_policy_in_init(http_request): def test_callback(response): @@ -75,15 +70,13 @@ def test_callback(response): transport = mock.MagicMock(spec=HttpTransport) url = "http://localhost" custom_hook_policy = CustomHookPolicy(raw_request_hook=test_callback) - policies = [ - UserAgentPolicy("myuseragent"), - custom_hook_policy - ] + policies = [UserAgentPolicy("myuseragent"), custom_hook_policy] client = PipelineClient(base_url=url, policies=policies, transport=transport) request = http_request("GET", url) with pytest.raises(ValueError): client._pipeline.run(request) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_hook_policy_in_request(http_request): def test_callback(response): @@ -92,15 +85,13 @@ def test_callback(response): transport = mock.MagicMock(spec=HttpTransport) url = "http://localhost" custom_hook_policy = CustomHookPolicy() - policies = [ - UserAgentPolicy("myuseragent"), - custom_hook_policy - ] + policies = [UserAgentPolicy("myuseragent"), custom_hook_policy] client = PipelineClient(base_url=url, policies=policies, transport=transport) request = http_request("GET", url) with pytest.raises(ValueError): client._pipeline.run(request, raw_request_hook=test_callback) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_hook_policy_in_both(http_request): def test_callback(response): @@ -112,10 +103,7 @@ def test_callback_request(response): transport = mock.MagicMock(spec=HttpTransport) url = "http://localhost" custom_hook_policy = CustomHookPolicy(raw_request_hook=test_callback) - policies = [ - UserAgentPolicy("myuseragent"), - custom_hook_policy - ] + policies = [UserAgentPolicy("myuseragent"), custom_hook_policy] client = PipelineClient(base_url=url, policies=policies, transport=transport) request = http_request("GET", url) with pytest.raises(TypeError): diff --git a/sdk/core/azure-core/tests/test_enums.py b/sdk/core/azure-core/tests/test_enums.py index 144444b8f51f..2c42d67b6dee 100644 --- a/sdk/core/azure-core/tests/test_enums.py +++ b/sdk/core/azure-core/tests/test_enums.py @@ -27,17 +27,18 @@ from azure.core import CaseInsensitiveEnumMeta + class MyCustomEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - FOO = 'foo' - BAR = 'bar' + FOO = "foo" + BAR = "bar" def test_case_insensitive_enums(): - assert MyCustomEnum.foo.value == 'foo' - assert MyCustomEnum.FOO.value == 'foo' - assert MyCustomEnum('bar').value == 'bar' - assert 'bar' == MyCustomEnum.BAR - assert 'bar' == MyCustomEnum.bar - assert MyCustomEnum['foo'] == 'foo' - assert MyCustomEnum['FOO'] == 'foo' + assert MyCustomEnum.foo.value == "foo" + assert MyCustomEnum.FOO.value == "foo" + assert MyCustomEnum("bar").value == "bar" + assert "bar" == MyCustomEnum.BAR + assert "bar" == MyCustomEnum.bar + assert MyCustomEnum["foo"] == "foo" + assert MyCustomEnum["FOO"] == "foo" assert isinstance(MyCustomEnum.BAR, str) diff --git a/sdk/core/azure-core/tests/test_error_map.py b/sdk/core/azure-core/tests/test_error_map.py index 267ab1a5ee62..51422493d71e 100644 --- a/sdk/core/azure-core/tests/test_error_map.py +++ b/sdk/core/azure-core/tests/test_error_map.py @@ -32,36 +32,34 @@ ) from utils import request_and_responses_product, create_http_response, HTTP_RESPONSES + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_error_map(http_request, http_response): request = http_request("GET", "") response = create_http_response(http_response, request, None) - error_map = { - 404: ResourceNotFoundError - } + error_map = {404: ResourceNotFoundError} with pytest.raises(ResourceNotFoundError): map_error(404, response, error_map) + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_error_map_no_default(http_request, http_response): request = http_request("GET", "") response = create_http_response(http_response, request, None) - error_map = ErrorMap({ - 404: ResourceNotFoundError - }) + error_map = ErrorMap({404: ResourceNotFoundError}) with pytest.raises(ResourceNotFoundError): map_error(404, response, error_map) + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_error_map_with_default(http_request, http_response): request = http_request("GET", "") response = create_http_response(http_response, request, None) - error_map = ErrorMap({ - 404: ResourceNotFoundError - }, default_error=ResourceExistsError) + error_map = ErrorMap({404: ResourceNotFoundError}, default_error=ResourceExistsError) with pytest.raises(ResourceExistsError): map_error(401, response, error_map) + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_only_default(http_request, http_response): request = http_request("GET", "") diff --git a/sdk/core/azure-core/tests/test_exceptions.py b/sdk/core/azure-core/tests/test_exceptions.py index cb28b1bea121..71db780dae6d 100644 --- a/sdk/core/azure-core/tests/test_exceptions.py +++ b/sdk/core/azure-core/tests/test_exceptions.py @@ -29,17 +29,24 @@ from unittest.mock import Mock # module under test -from azure.core.exceptions import HttpResponseError, ODataV4Error, ODataV4Format, SerializationError, DeserializationError +from azure.core.exceptions import ( + HttpResponseError, + ODataV4Error, + ODataV4Format, + SerializationError, + DeserializationError, +) from azure.core.pipeline.transport import RequestsTransportResponse from azure.core.pipeline.transport._base import _HttpResponseBase as PipelineTransportHttpResponseBase from azure.core.rest._http_response_impl import _HttpResponseBaseImpl as RestHttpResponseBase from utils import HTTP_REQUESTS + class PipelineTransportMockResponse(PipelineTransportHttpResponseBase): def __init__(self, json_body): super(PipelineTransportMockResponse, self).__init__( request=None, - internal_response = None, + internal_response=None, ) self.status_code = 400 self.reason = "Bad Request" @@ -49,6 +56,7 @@ def __init__(self, json_body): def body(self): return self._body + class RestMockResponse(RestHttpResponseBase): def __init__(self, json_body): super(RestMockResponse, self).__init__( @@ -69,30 +77,28 @@ def body(self): def content(self): return self._body + MOCK_RESPONSES = [PipelineTransportMockResponse, RestMockResponse] -class FakeErrorOne(object): +class FakeErrorOne(object): def __init__(self): self.error = Mock(message="A fake error", code="FakeErrorOne") class FakeErrorTwo(object): - def __init__(self): self.code = "FakeErrorTwo" self.message = "A different fake error" class FakeHttpResponse(HttpResponseError): - def __init__(self, response, error, *args, **kwargs): self.error = error super(FakeHttpResponse, self).__init__(self, response=response, *args, **kwargs) class TestExceptions(object): - def test_empty_httpresponse_error(self): error = HttpResponseError() assert str(error) == "Operation returned an invalid status 'None'" @@ -112,14 +118,14 @@ def test_message_httpresponse_error(self): assert error.status_code is None def test_error_continuation_token(self): - error = HttpResponseError(message="Specific error message", continuation_token='foo') + error = HttpResponseError(message="Specific error message", continuation_token="foo") assert str(error) == "Specific error message" assert error.message == "Specific error message" assert error.response is None assert error.reason is None assert error.error is None assert error.status_code is None - assert error.continuation_token == 'foo' + assert error.continuation_token == "foo" @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_deserialized_httpresponse_error_code(self, mock_response): @@ -151,7 +157,6 @@ def test_deserialized_httpresponse_error_code(self, mock_response): assert str(error) == "(FakeErrorOne) A fake error\nCode: FakeErrorOne\nMessage: A fake error" - @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_deserialized_httpresponse_error_message(self, mock_response): """This is backward compat support for weird responses, adn even if it's likely @@ -183,7 +188,7 @@ def test_httpresponse_error_with_response(self, port, mock_response): error = HttpResponseError(response=http_response) assert error.message == "Operation returned an invalid status 'OK'" assert error.response is not None - assert error.reason == 'OK' + assert error.reason == "OK" assert isinstance(error.status_code, int) assert error.error is None @@ -194,15 +199,14 @@ def test_odata_v4_exception(self, mock_response): "code": "501", "message": "Unsupported functionality", "target": "query", - "details": [{ - "code": "301", - "target": "$search", - "message": "$search query option not supported", - }], - "innererror": { - "trace": [], - "context": {} - } + "details": [ + { + "code": "301", + "target": "$search", + "message": "$search query option not supported", + } + ], + "innererror": {"trace": [], "context": {}}, } } exp = ODataV4Error(mock_response(json.dumps(message).encode("utf-8"))) @@ -225,8 +229,7 @@ def test_odata_v4_exception(self, mock_response): @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_odata_v4_minimal(self, mock_response): - """Minimal valid OData v4 is code/message and nothing else. - """ + """Minimal valid OData v4 is code/message and nothing else.""" message = { "error": { "code": "501", @@ -242,17 +245,14 @@ def test_odata_v4_minimal(self, mock_response): @pytest.mark.parametrize("mock_response", MOCK_RESPONSES) def test_broken_odata_details(self, mock_response): - """Do not block creating a nice exception if "details" only is broken - """ + """Do not block creating a nice exception if "details" only is broken""" message = { "error": { "code": "Conflict", "message": "The maximum number of Free ServerFarms allowed in a Subscription is 10.", "target": None, "details": [ - { - "message": "The maximum number of Free ServerFarms allowed in a Subscription is 10." - }, + {"message": "The maximum number of Free ServerFarms allowed in a Subscription is 10."}, {"code": "Conflict"}, { "errorentity": { @@ -291,7 +291,10 @@ def test_non_odatav4_error_body(self, client, http_request): response = client.send_request(request) with pytest.raises(HttpResponseError) as ex: response.raise_for_status() - assert str(ex.value) == "Operation returned an invalid status 'BAD REQUEST'\nContent: {\"code\": 400, \"error\": {\"global\": [\"MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API\"]}}" + assert ( + str(ex.value) + == 'Operation returned an invalid status \'BAD REQUEST\'\nContent: {"code": 400, "error": {"global": ["MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API"]}}' + ) @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_malformed_json(self, client, http_request): @@ -299,7 +302,10 @@ def test_malformed_json(self, client, http_request): response = client.send_request(request) with pytest.raises(HttpResponseError) as ex: response.raise_for_status() - assert str(ex.value) == "Operation returned an invalid status 'BAD REQUEST'\nContent: {\"code\": 400, \"error\": {\"global\": [\"MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API\"]" + assert ( + str(ex.value) + == 'Operation returned an invalid status \'BAD REQUEST\'\nContent: {"code": 400, "error": {"global": ["MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API"]' + ) @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_text(self, client, http_request): @@ -315,7 +321,8 @@ def test_datav4_error(self, client, http_request): response = client.send_request(request) with pytest.raises(HttpResponseError) as ex: response.raise_for_status() - assert "Content: {\"" not in str(ex.value) + assert 'Content: {"' not in str(ex.value) + def test_serialization_error(): message = "Oopsy bad input passed for serialization" @@ -328,6 +335,7 @@ def test_serialization_error(): raise error assert str(ex.value) == message + def test_deserialization_error(): message = "Oopsy bad input passed for serialization" error = DeserializationError(message) diff --git a/sdk/core/azure-core/tests/test_http_logging_policy.py b/sdk/core/azure-core/tests/test_http_logging_policy.py index d882bcdecfe8..dfc397fa1da6 100644 --- a/sdk/core/azure-core/tests/test_http_logging_policy.py +++ b/sdk/core/azure-core/tests/test_http_logging_policy.py @@ -6,32 +6,32 @@ import pytest import logging import types + try: from unittest.mock import Mock except ImportError: # python < 3.3 from mock import Mock # type: ignore -from azure.core.pipeline import ( - PipelineResponse, - PipelineRequest, - PipelineContext -) +from azure.core.pipeline import PipelineResponse, PipelineRequest, PipelineContext from azure.core.pipeline.policies import ( HttpLoggingPolicy, ) from utils import HTTP_RESPONSES, create_http_response, request_and_responses_product from azure.core.pipeline._tools import is_rest + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_http_logger(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -40,7 +40,7 @@ def emit(self, record): policy = HttpLoggingPolicy(logger=logger) - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") http_response = create_http_response(http_response, universal_request, None) http_response.status_code = 202 http_response.headers["x-ms-error-code"] = "ERRORCODE" @@ -52,16 +52,16 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'No body was attached to the request' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "No body was attached to the request" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" assert messages_response[2] == " 'x-ms-error-code': 'ERRORCODE'" mock_handler.reset() @@ -76,7 +76,7 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 4 messages_request1 = mock_handler.messages[0].message.split("\n") messages_response1 = mock_handler.messages[1].message.split("\n") @@ -84,22 +84,22 @@ def emit(self, record): messages_response2 = mock_handler.messages[3].message.split("\n") assert messages_request1[0] == "Request URL: 'http://localhost/'" assert messages_request1[1] == "Request method: 'GET'" - assert messages_request1[2] == 'Request headers:' - assert messages_request1[3] == 'No body was attached to the request' - assert messages_response1[0] == 'Response status: 202' - assert messages_response1[1] == 'Response headers:' + assert messages_request1[2] == "Request headers:" + assert messages_request1[3] == "No body was attached to the request" + assert messages_response1[0] == "Response status: 202" + assert messages_response1[1] == "Response headers:" assert messages_request2[0] == "Request URL: 'http://localhost/'" assert messages_request2[1] == "Request method: 'GET'" - assert messages_request2[2] == 'Request headers:' - assert messages_request2[3] == 'No body was attached to the request' - assert messages_response2[0] == 'Response status: 202' - assert messages_response2[1] == 'Response headers:' + assert messages_request2[2] == "Request headers:" + assert messages_request2[3] == "No body was attached to the request" + assert messages_response2[0] == "Response status: 202" + assert messages_response2[1] == "Response headers:" mock_handler.reset() # Headers and query parameters - policy.allowed_query_params = ['country'] + policy.allowed_query_params = ["country"] universal_request.headers = { "Accept": "Caramel", @@ -115,7 +115,7 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") @@ -123,40 +123,31 @@ def emit(self, record): assert messages_request[1] == "Request method: 'GET'" assert messages_request[2] == "Request headers:" # Dict not ordered in Python, exact logging order doesn't matter - assert set([ - messages_request[3], - messages_request[4] - ]) == set([ - " 'Accept': 'Caramel'", - " 'Hate': 'REDACTED'" - ]) - assert messages_request[5] == 'No body was attached to the request' + assert set([messages_request[3], messages_request[4]]) == set([" 'Accept': 'Caramel'", " 'Hate': 'REDACTED'"]) + assert messages_request[5] == "No body was attached to the request" assert messages_response[0] == "Response status: 202" assert messages_response[1] == "Response headers:" # Dict not ordered in Python, exact logging order doesn't matter - assert set([ - messages_response[2], - messages_response[3] - ]) == set([ - " 'Content-Type': 'Caramel'", - " 'HateToo': 'REDACTED'" - ]) + assert set([messages_response[2], messages_response[3]]) == set( + [" 'Content-Type': 'Caramel'", " 'HateToo': 'REDACTED'"] + ) mock_handler.reset() - @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_http_logger_operation_level(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -164,9 +155,9 @@ def emit(self, record): logger.setLevel(logging.DEBUG) policy = HttpLoggingPolicy() - kwargs={'logger': logger} + kwargs = {"logger": logger} - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") http_response = create_http_response(http_response, universal_request, None) http_response.status_code = 202 request = PipelineRequest(universal_request, PipelineContext(None, **kwargs)) @@ -177,16 +168,16 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'No body was attached to the request' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "No body was attached to the request" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" mock_handler.reset() @@ -202,7 +193,7 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 4 messages_request1 = mock_handler.messages[0].message.split("\n") messages_response1 = mock_handler.messages[1].message.split("\n") @@ -210,31 +201,33 @@ def emit(self, record): messages_response2 = mock_handler.messages[3].message.split("\n") assert messages_request1[0] == "Request URL: 'http://localhost/'" assert messages_request1[1] == "Request method: 'GET'" - assert messages_request1[2] == 'Request headers:' - assert messages_request1[3] == 'No body was attached to the request' - assert messages_response1[0] == 'Response status: 202' - assert messages_response1[1] == 'Response headers:' + assert messages_request1[2] == "Request headers:" + assert messages_request1[3] == "No body was attached to the request" + assert messages_response1[0] == "Response status: 202" + assert messages_response1[1] == "Response headers:" assert messages_request2[0] == "Request URL: 'http://localhost/'" assert messages_request2[1] == "Request method: 'GET'" - assert messages_request2[2] == 'Request headers:' - assert messages_request2[3] == 'No body was attached to the request' - assert messages_response2[0] == 'Response status: 202' - assert messages_response2[1] == 'Response headers:' + assert messages_request2[2] == "Request headers:" + assert messages_request2[3] == "No body was attached to the request" + assert messages_response2[0] == "Response status: 202" + assert messages_response2[1] == "Response headers:" mock_handler.reset() @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_http_logger_with_body(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -243,7 +236,7 @@ def emit(self, record): policy = HttpLoggingPolicy(logger=logger) - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") universal_request.body = "testbody" http_response = create_http_response(http_response, universal_request, None) http_response.status_code = 202 @@ -253,31 +246,33 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'A body is sent with the request' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "A body is sent with the request" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" mock_handler.reset() @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_http_logger_with_generator_body(http_request, http_response): - class MockHandler(logging.Handler): def __init__(self): super(MockHandler, self).__init__() self.messages = [] + def reset(self): self.messages = [] + def emit(self, record): self.messages.append(record) + mock_handler = MockHandler() logger = logging.getLogger("testlogger") @@ -286,7 +281,7 @@ def emit(self, record): policy = HttpLoggingPolicy(logger=logger) - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") mock = Mock() mock.__class__ = types.GeneratorType universal_request.body = mock @@ -298,15 +293,15 @@ def emit(self, record): response = PipelineResponse(request, http_response, request.context) policy.on_response(request, response) - assert all(m.levelname == 'INFO' for m in mock_handler.messages) + assert all(m.levelname == "INFO" for m in mock_handler.messages) assert len(mock_handler.messages) == 2 messages_request = mock_handler.messages[0].message.split("\n") messages_response = mock_handler.messages[1].message.split("\n") assert messages_request[0] == "Request URL: 'http://localhost/'" assert messages_request[1] == "Request method: 'GET'" - assert messages_request[2] == 'Request headers:' - assert messages_request[3] == 'File upload' - assert messages_response[0] == 'Response status: 202' - assert messages_response[1] == 'Response headers:' + assert messages_request[2] == "Request headers:" + assert messages_request[3] == "File upload" + assert messages_response[0] == "Response status: 202" + assert messages_response[1] == "Response headers:" mock_handler.reset() diff --git a/sdk/core/azure-core/tests/test_messaging_cloud_event.py b/sdk/core/azure-core/tests/test_messaging_cloud_event.py index 23931f17c7a4..2148c6271908 100644 --- a/sdk/core/azure-core/tests/test_messaging_cloud_event.py +++ b/sdk/core/azure-core/tests/test_messaging_cloud_event.py @@ -11,6 +11,7 @@ from azure.core.utils._messaging_shared import _get_json_content from azure.core.serialization import NULL + class MockQueueMessage(object): def __init__(self, content=None): self.id = uuid.uuid4() @@ -21,31 +22,33 @@ def __init__(self, content=None): self.pop_receipt = None self.next_visible_on = None + class MockServiceBusReceivedMessage(object): def __init__(self, body=None, **kwargs): - self.body=body - self.application_properties=None - self.session_id=None - self.message_id='3f6c5441-5be5-4f33-80c3-3ffeb6a090ce' - self.content_type='application/cloudevents+json; charset=utf-8' - self.correlation_id=None - self.to=None - self.reply_to=None - self.reply_to_session_id=None - self.subject=None - self.time_to_live=datetime.timedelta(days=14) - self.partition_key=None - self.scheduled_enqueue_time_utc=None - self.auto_renew_error=None, - self.dead_letter_error_description=None - self.dead_letter_reason=None - self.dead_letter_source=None - self.delivery_count=13 - self.enqueued_sequence_number=0 - self.enqueued_time_utc=datetime.datetime(2021, 7, 22, 22, 27, 41, 236000) - self.expires_at_utc=datetime.datetime(2021, 8, 5, 22, 27, 41, 236000) - self.sequence_number=11219 - self.lock_token='233146e3-d5a6-45eb-826f-691d82fb8b13' + self.body = body + self.application_properties = None + self.session_id = None + self.message_id = "3f6c5441-5be5-4f33-80c3-3ffeb6a090ce" + self.content_type = "application/cloudevents+json; charset=utf-8" + self.correlation_id = None + self.to = None + self.reply_to = None + self.reply_to_session_id = None + self.subject = None + self.time_to_live = datetime.timedelta(days=14) + self.partition_key = None + self.scheduled_enqueue_time_utc = None + self.auto_renew_error = (None,) + self.dead_letter_error_description = None + self.dead_letter_reason = None + self.dead_letter_source = None + self.delivery_count = 13 + self.enqueued_sequence_number = 0 + self.enqueued_time_utc = datetime.datetime(2021, 7, 22, 22, 27, 41, 236000) + self.expires_at_utc = datetime.datetime(2021, 8, 5, 22, 27, 41, 236000) + self.sequence_number = 11219 + self.lock_token = "233146e3-d5a6-45eb-826f-691d82fb8b13" + class MockEventhubData(object): def __init__(self, body=None): @@ -55,7 +58,7 @@ def __init__(self, body=None): raise ValueError("EventData cannot be None.") # Internal usage only for transforming AmqpAnnotatedMessage to outgoing EventData - self.body=body + self.body = body self._raw_amqp_message = "some amqp data" self.message_id = None self.content_type = None @@ -68,21 +71,22 @@ def __init__(self, data=None): def __iter__(self): return self - + def __next__(self): if not self.data: return """{"id":"f208feff-099b-4bda-a341-4afd0fa02fef","source":"https://egsample.dev/sampleevent","data":"ServiceBus","type":"Azure.Sdk.Sample","time":"2021-07-22T22:27:38.960209Z","specversion":"1.0"}""" return self.data - + next = __next__ + class MockEhBody(object): def __init__(self, data=None): self.data = data def __iter__(self): return self - + def __next__(self): if not self.data: return b'[{"id":"f208feff-099b-4bda-a341-4afd0fa02fef","source":"https://egsample.dev/sampleevent","data":"Eventhub","type":"Azure.Sdk.Sample","time":"2021-07-22T22:27:38.960209Z","specversion":"1.0"}]' @@ -93,106 +97,96 @@ def __next__(self): # Cloud Event tests def test_cloud_event_constructor(): - event = CloudEvent( - source='Azure.Core.Sample', - type='SampleType', - data='cloudevent' - ) - - assert event.specversion == '1.0' + event = CloudEvent(source="Azure.Core.Sample", type="SampleType", data="cloudevent") + + assert event.specversion == "1.0" assert event.time.__class__ == datetime.datetime assert event.id is not None - assert event.source == 'Azure.Core.Sample' - assert event.data == 'cloudevent' + assert event.source == "Azure.Core.Sample" + assert event.data == "cloudevent" + def test_cloud_event_constructor_unexpected_keyword(): with pytest.raises(ValueError) as e: event = CloudEvent( - source='Azure.Core.Sample', - type='SampleType', - data='cloudevent', + source="Azure.Core.Sample", + type="SampleType", + data="cloudevent", unexpected_keyword="not allowed", - another_bad_kwarg="not allowed either" - ) + another_bad_kwarg="not allowed either", + ) assert "unexpected_keyword" in e assert "another_bad_kwarg" in e + def test_cloud_event_constructor_blank_data(): - event = CloudEvent( - source='Azure.Core.Sample', - type='SampleType', - data='' - ) - - assert event.specversion == '1.0' + event = CloudEvent(source="Azure.Core.Sample", type="SampleType", data="") + + assert event.specversion == "1.0" assert event.time.__class__ == datetime.datetime assert event.id is not None - assert event.source == 'Azure.Core.Sample' - assert event.data == '' + assert event.source == "Azure.Core.Sample" + assert event.data == "" + def test_cloud_event_constructor_NULL_data(): - event = CloudEvent( - source='Azure.Core.Sample', - type='SampleType', - data=NULL - ) + event = CloudEvent(source="Azure.Core.Sample", type="SampleType", data=NULL) assert event.data == NULL assert event.data is NULL + def test_cloud_event_constructor_none_data(): - event = CloudEvent( - source='Azure.Core.Sample', - type='SampleType', - data=None - ) + event = CloudEvent(source="Azure.Core.Sample", type="SampleType", data=None) assert event.data == None + def test_cloud_event_constructor_missing_data(): event = CloudEvent( - source='Azure.Core.Sample', - type='SampleType', - ) - + source="Azure.Core.Sample", + type="SampleType", + ) + assert event.data == None assert event.datacontenttype == None assert event.dataschema == None assert event.subject == None + def test_cloud_storage_dict(): cloud_storage_dict = { - "id":"a0517898-9fa4-4e70-b4a3-afda1dd68672", - "source":"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}", - "data":{ - "api":"PutBlockList", - "client_request_id":"6d79dbfb-0e37-4fc4-981f-442c9ca65760", - "request_id":"831e1650-001e-001b-66ab-eeb76e000000", - "e_tag":"0x8D4BCC2E4835CD0", - "content_type":"application/octet-stream", - "content_length":524288, - "blob_type":"BlockBlob", - "url":"https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", - "sequencer":"00000000000004420000000000028963", - "storage_diagnostics":{"batchId":"b68529f3-68cd-4744-baa4-3c0498ec19f0"} + "id": "a0517898-9fa4-4e70-b4a3-afda1dd68672", + "source": "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}", + "data": { + "api": "PutBlockList", + "client_request_id": "6d79dbfb-0e37-4fc4-981f-442c9ca65760", + "request_id": "831e1650-001e-001b-66ab-eeb76e000000", + "e_tag": "0x8D4BCC2E4835CD0", + "content_type": "application/octet-stream", + "content_length": 524288, + "blob_type": "BlockBlob", + "url": "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", + "sequencer": "00000000000004420000000000028963", + "storage_diagnostics": {"batchId": "b68529f3-68cd-4744-baa4-3c0498ec19f0"}, }, - "type":"Microsoft.Storage.BlobCreated", - "time":"2021-02-18T20:18:10.581147898Z", - "specversion":"1.0" + "type": "Microsoft.Storage.BlobCreated", + "time": "2021-02-18T20:18:10.581147898Z", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_storage_dict) assert event.data == { - "api":"PutBlockList", - "client_request_id":"6d79dbfb-0e37-4fc4-981f-442c9ca65760", - "request_id":"831e1650-001e-001b-66ab-eeb76e000000", - "e_tag":"0x8D4BCC2E4835CD0", - "content_type":"application/octet-stream", - "content_length":524288, - "blob_type":"BlockBlob", - "url":"https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", - "sequencer":"00000000000004420000000000028963", - "storage_diagnostics":{"batchId":"b68529f3-68cd-4744-baa4-3c0498ec19f0"} + "api": "PutBlockList", + "client_request_id": "6d79dbfb-0e37-4fc4-981f-442c9ca65760", + "request_id": "831e1650-001e-001b-66ab-eeb76e000000", + "e_tag": "0x8D4BCC2E4835CD0", + "content_type": "application/octet-stream", + "content_length": 524288, + "blob_type": "BlockBlob", + "url": "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", + "sequencer": "00000000000004420000000000028963", + "storage_diagnostics": {"batchId": "b68529f3-68cd-4744-baa4-3c0498ec19f0"}, } assert event.specversion == "1.0" assert event.time.__class__ == datetime.datetime @@ -207,14 +201,14 @@ def test_cloud_storage_dict(): def test_cloud_custom_dict_with_extensions(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10.539861122+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10.539861122+00:00", + "specversion": "1.0", "ext1": "example", - "ext2": "example2" + "ext2": "example2", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) assert event.data == {"team": "event grid squad"} @@ -225,14 +219,15 @@ def test_cloud_custom_dict_with_extensions(): assert event.time.microsecond == 539861 assert event.extensions == {"ext1": "example", "ext2": "example2"} + def test_cloud_custom_dict_ms_precision_is_gt_six(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10.539861122+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10.539861122+00:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) assert event.data == {"team": "event grid squad"} @@ -242,14 +237,15 @@ def test_cloud_custom_dict_ms_precision_is_gt_six(): assert event.time.hour == 20 assert event.time.microsecond == 539861 + def test_cloud_custom_dict_ms_precision_is_lt_six(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10.123+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10.123+00:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) assert event.data == {"team": "event grid squad"} @@ -259,14 +255,15 @@ def test_cloud_custom_dict_ms_precision_is_lt_six(): assert event.time.hour == 20 assert event.time.microsecond == 123000 + def test_cloud_custom_dict_ms_precision_is_eq_six(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10.123456+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10.123456+00:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) assert event.data == {"team": "event grid squad"} @@ -276,14 +273,15 @@ def test_cloud_custom_dict_ms_precision_is_eq_six(): assert event.time.hour == 20 assert event.time.microsecond == 123456 + def test_cloud_custom_dict_ms_precision_is_gt_six_z_not(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10.539861122Z", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10.539861122Z", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) assert event.data == {"team": "event grid squad"} @@ -293,14 +291,15 @@ def test_cloud_custom_dict_ms_precision_is_gt_six_z_not(): assert event.time.hour == 20 assert event.time.microsecond == 539861 + def test_cloud_custom_dict_ms_precision_is_lt_six_z_not(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10.123Z", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10.123Z", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) assert event.data == {"team": "event grid squad"} @@ -310,14 +309,15 @@ def test_cloud_custom_dict_ms_precision_is_lt_six_z_not(): assert event.time.hour == 20 assert event.time.microsecond == 123000 + def test_cloud_custom_dict_ms_precision_is_eq_six_z_not(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e034", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10.123456Z", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e034", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10.123456Z", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) assert event.data == {"team": "event grid squad"} @@ -327,85 +327,91 @@ def test_cloud_custom_dict_ms_precision_is_eq_six_z_not(): assert event.time.hour == 20 assert event.time.microsecond == 123456 + def test_cloud_custom_dict_blank_data(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":'', - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": "", + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10+00:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) - assert event.data == '' + assert event.data == "" assert event.__class__ == CloudEvent + def test_cloud_custom_dict_no_data(): cloud_custom_dict_with_missing_data = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10+00:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_missing_data) assert event.__class__ == CloudEvent assert event.data is None + def test_cloud_custom_dict_null_data(): cloud_custom_dict_with_none_data = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "type":"Azure.Sdk.Sample", - "data":None, - "dataschema":None, - "time":"2021-02-18T20:18:10+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "type": "Azure.Sdk.Sample", + "data": None, + "dataschema": None, + "time": "2021-02-18T20:18:10+00:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_none_data) assert event.__class__ == CloudEvent assert event.data == NULL assert event.dataschema is NULL + def test_cloud_custom_dict_valid_optional_attrs(): cloud_custom_dict_with_none_data = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "type":"Azure.Sdk.Sample", - "data":None, - "dataschema":"exists", - "time":"2021-02-18T20:18:10+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "type": "Azure.Sdk.Sample", + "data": None, + "dataschema": "exists", + "time": "2021-02-18T20:18:10+00:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_with_none_data) assert event.__class__ == CloudEvent assert event.data is NULL assert event.dataschema == "exists" + def test_cloud_custom_dict_both_data_and_base64(): cloud_custom_dict_with_data_and_base64 = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":"abc", - "data_base64":"Y2Wa==", - "type":"Azure.Sdk.Sample", - "time":"2021-02-18T20:18:10+00:00", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": "abc", + "data_base64": "Y2Wa==", + "type": "Azure.Sdk.Sample", + "time": "2021-02-18T20:18:10+00:00", + "specversion": "1.0", } with pytest.raises(ValueError): event = CloudEvent.from_dict(cloud_custom_dict_with_data_and_base64) + def test_cloud_custom_dict_base64(): cloud_custom_dict_base64 = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data_base64":'Y2xvdWRldmVudA==', # cspell:disable-line - "type":"Azure.Sdk.Sample", - "time":"2021-02-23T17:11:13.308772-08:00", - "specversion":"1.0" + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data_base64": "Y2xvdWRldmVudA==", # cspell:disable-line + "type": "Azure.Sdk.Sample", + "time": "2021-02-23T17:11:13.308772-08:00", + "specversion": "1.0", } event = CloudEvent.from_dict(cloud_custom_dict_base64) - assert event.data == b'cloudevent' + assert event.data == b"cloudevent" assert event.specversion == "1.0" assert event.time.hour == 17 assert event.time.minute == 11 @@ -413,59 +419,55 @@ def test_cloud_custom_dict_base64(): assert event.time.tzinfo is not None assert event.__class__ == CloudEvent + def test_data_and_base64_both_exist_raises(): with pytest.raises(ValueError): - CloudEvent.from_dict( - {"source":'sample', - "type":'type', - "data":'data', - "data_base64":'Y2kQ==' - } - ) + CloudEvent.from_dict({"source": "sample", "type": "type", "data": "data", "data_base64": "Y2kQ=="}) + def test_cloud_event_repr(): - event = CloudEvent( - source='Azure.Core.Sample', - type='SampleType', - data='cloudevent' - ) + event = CloudEvent(source="Azure.Core.Sample", type="SampleType", data="cloudevent") assert repr(event).startswith("CloudEvent(source=Azure.Core.Sample, type=SampleType, specversion=1.0,") -def test_extensions_upper_case_value_error(): - with pytest.raises(ValueError): - event = CloudEvent( - source='sample', - type='type', - data='data', - extensions={"lowercase123": "accepted", "NOTlower123": "not allowed"} + +def test_extensions_upper_case_value_error(): + with pytest.raises(ValueError): + event = CloudEvent( + source="sample", + type="type", + data="data", + extensions={"lowercase123": "accepted", "NOTlower123": "not allowed"}, ) -def test_extensions_not_alphanumeric_value_error(): - with pytest.raises(ValueError): - event = CloudEvent( - source='sample', - type='type', - data='data', - extensions={"lowercase123": "accepted", "not@lph@nu^^3ic": "not allowed"} + +def test_extensions_not_alphanumeric_value_error(): + with pytest.raises(ValueError): + event = CloudEvent( + source="sample", + type="type", + data="data", + extensions={"lowercase123": "accepted", "not@lph@nu^^3ic": "not allowed"}, ) + def test_cloud_from_dict_with_invalid_extensions(): cloud_custom_dict_with_extensions = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2020-08-07T02:06:08.11969Z", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2020-08-07T02:06:08.11969Z", + "specversion": "1.0", "ext1": "example", - "BADext2": "example2" + "BADext2": "example2", } with pytest.raises(ValueError): event = CloudEvent.from_dict(cloud_custom_dict_with_extensions) + def test_cloud_custom_dict_ms_precision_is_gt_six(): - time ="2021-02-18T20:18:10.539861122+00:00" + time = "2021-02-18T20:18:10.539861122+00:00" date_obj = _convert_to_isoformat(time) assert date_obj.month == 2 @@ -473,8 +475,9 @@ def test_cloud_custom_dict_ms_precision_is_gt_six(): assert date_obj.hour == 20 assert date_obj.microsecond == 539861 + def test_cloud_custom_dict_ms_precision_is_lt_six(): - time ="2021-02-18T20:18:10.123+00:00" + time = "2021-02-18T20:18:10.123+00:00" date_obj = _convert_to_isoformat(time) assert date_obj.month == 2 @@ -482,8 +485,9 @@ def test_cloud_custom_dict_ms_precision_is_lt_six(): assert date_obj.hour == 20 assert date_obj.microsecond == 123000 + def test_cloud_custom_dict_ms_precision_is_eq_six(): - time ="2021-02-18T20:18:10.123456+00:00" + time = "2021-02-18T20:18:10.123456+00:00" date_obj = _convert_to_isoformat(time) assert date_obj.month == 2 @@ -491,8 +495,9 @@ def test_cloud_custom_dict_ms_precision_is_eq_six(): assert date_obj.hour == 20 assert date_obj.microsecond == 123456 + def test_cloud_custom_dict_ms_precision_is_gt_six_z_not(): - time ="2021-02-18T20:18:10.539861122Z" + time = "2021-02-18T20:18:10.539861122Z" date_obj = _convert_to_isoformat(time) assert date_obj.month == 2 @@ -500,8 +505,9 @@ def test_cloud_custom_dict_ms_precision_is_gt_six_z_not(): assert date_obj.hour == 20 assert date_obj.microsecond == 539861 + def test_cloud_custom_dict_ms_precision_is_lt_six_z_not(): - time ="2021-02-18T20:18:10.123Z" + time = "2021-02-18T20:18:10.123Z" date_obj = _convert_to_isoformat(time) assert date_obj.month == 2 @@ -509,8 +515,9 @@ def test_cloud_custom_dict_ms_precision_is_lt_six_z_not(): assert date_obj.hour == 20 assert date_obj.microsecond == 123000 + def test_cloud_custom_dict_ms_precision_is_eq_six_z_not(): - time ="2021-02-18T20:18:10.123456Z" + time = "2021-02-18T20:18:10.123456Z" date_obj = _convert_to_isoformat(time) assert date_obj.month == 2 @@ -518,40 +525,53 @@ def test_cloud_custom_dict_ms_precision_is_eq_six_z_not(): assert date_obj.hour == 20 assert date_obj.microsecond == 123456 + def test_eventgrid_event_schema_raises(): cloud_custom_dict = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "data":{"team": "event grid squad"}, + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "data": {"team": "event grid squad"}, "dataVersion": "1.0", - "subject":"Azure.Sdk.Sample", - "eventTime":"2020-08-07T02:06:08.11969Z", - "eventType":"pull request", + "subject": "Azure.Sdk.Sample", + "eventTime": "2020-08-07T02:06:08.11969Z", + "eventType": "pull request", } - with pytest.raises(ValueError, match="The event you are trying to parse follows the Eventgrid Schema. You can parse EventGrid events using EventGridEvent.from_dict method in the azure-eventgrid library."): + with pytest.raises( + ValueError, + match="The event you are trying to parse follows the Eventgrid Schema. You can parse EventGrid events using EventGridEvent.from_dict method in the azure-eventgrid library.", + ): CloudEvent.from_dict(cloud_custom_dict) + def test_wrong_schema_raises_no_source(): cloud_custom_dict = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2020-08-07T02:06:08.11969Z", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2020-08-07T02:06:08.11969Z", + "specversion": "1.0", } - with pytest.raises(ValueError, match="The event does not conform to the cloud event spec https://github.com/cloudevents/spec. The `source` and `type` params are required."): + with pytest.raises( + ValueError, + match="The event does not conform to the cloud event spec https://github.com/cloudevents/spec. The `source` and `type` params are required.", + ): CloudEvent.from_dict(cloud_custom_dict) + def test_wrong_schema_raises_no_type(): cloud_custom_dict = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "data":{"team": "event grid squad"}, - "source":"Azure/Sdk/Sample", - "time":"2020-08-07T02:06:08.11969Z", - "specversion":"1.0", + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "data": {"team": "event grid squad"}, + "source": "Azure/Sdk/Sample", + "time": "2020-08-07T02:06:08.11969Z", + "specversion": "1.0", } - with pytest.raises(ValueError, match="The event does not conform to the cloud event spec https://github.com/cloudevents/spec. The `source` and `type` params are required."): + with pytest.raises( + ValueError, + match="The event does not conform to the cloud event spec https://github.com/cloudevents/spec. The `source` and `type` params are required.", + ): CloudEvent.from_dict(cloud_custom_dict) + def test_get_bytes_storage_queue(): cloud_storage_dict = """{ "id":"a0517898-9fa4-4e70-b4a3-afda1dd68672", @@ -575,116 +595,119 @@ def test_get_bytes_storage_queue(): obj = MockQueueMessage(content=cloud_storage_dict) dict = _get_json_content(obj) - assert dict.get('data') == { - "api":"PutBlockList", - "client_request_id":"6d79dbfb-0e37-4fc4-981f-442c9ca65760", - "request_id":"831e1650-001e-001b-66ab-eeb76e000000", - "e_tag":"0x8D4BCC2E4835CD0", - "content_type":"application/octet-stream", - "content_length":524288, - "blob_type":"BlockBlob", - "url":"https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", - "sequencer":"00000000000004420000000000028963", - "storage_diagnostics":{"batchId":"b68529f3-68cd-4744-baa4-3c0498ec19f0"} - } - assert dict.get('specversion') == "1.0" + assert dict.get("data") == { + "api": "PutBlockList", + "client_request_id": "6d79dbfb-0e37-4fc4-981f-442c9ca65760", + "request_id": "831e1650-001e-001b-66ab-eeb76e000000", + "e_tag": "0x8D4BCC2E4835CD0", + "content_type": "application/octet-stream", + "content_length": 524288, + "blob_type": "BlockBlob", + "url": "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", + "sequencer": "00000000000004420000000000028963", + "storage_diagnostics": {"batchId": "b68529f3-68cd-4744-baa4-3c0498ec19f0"}, + } + assert dict.get("specversion") == "1.0" + def test_get_bytes_storage_queue_wrong_content(): - cloud_storage_string = u'This is a random string which must fail' + cloud_storage_string = "This is a random string which must fail" obj = MockQueueMessage(content=cloud_storage_string) with pytest.raises(ValueError, match="Failed to load JSON content from the object."): _get_json_content(obj) + def test_get_bytes_servicebus(): obj = MockServiceBusReceivedMessage( body=MockBody(), - message_id='3f6c5441-5be5-4f33-80c3-3ffeb6a090ce', - content_type='application/cloudevents+json; charset=utf-8', + message_id="3f6c5441-5be5-4f33-80c3-3ffeb6a090ce", + content_type="application/cloudevents+json; charset=utf-8", time_to_live=datetime.timedelta(days=14), delivery_count=13, enqueued_sequence_number=0, enqueued_time_utc=datetime.datetime(2021, 7, 22, 22, 27, 41, 236000), expires_at_utc=datetime.datetime(2021, 8, 5, 22, 27, 41, 236000), sequence_number=11219, - lock_token='233146e3-d5a6-45eb-826f-691d82fb8b13' + lock_token="233146e3-d5a6-45eb-826f-691d82fb8b13", ) dict = _get_json_content(obj) - assert dict.get('data') == "ServiceBus" - assert dict.get('specversion') == '1.0' + assert dict.get("data") == "ServiceBus" + assert dict.get("specversion") == "1.0" + def test_get_bytes_servicebus_wrong_content(): obj = MockServiceBusReceivedMessage( body=MockBody(data="random string"), - message_id='3f6c5441-5be5-4f33-80c3-3ffeb6a090ce', - content_type='application/json; charset=utf-8', + message_id="3f6c5441-5be5-4f33-80c3-3ffeb6a090ce", + content_type="application/json; charset=utf-8", time_to_live=datetime.timedelta(days=14), delivery_count=13, enqueued_sequence_number=0, enqueued_time_utc=datetime.datetime(2021, 7, 22, 22, 27, 41, 236000), expires_at_utc=datetime.datetime(2021, 8, 5, 22, 27, 41, 236000), sequence_number=11219, - lock_token='233146e3-d5a6-45eb-826f-691d82fb8b13' + lock_token="233146e3-d5a6-45eb-826f-691d82fb8b13", ) with pytest.raises(ValueError, match="Failed to load JSON content from the object."): _get_json_content(obj) + def test_get_bytes_eventhubs(): - obj = MockEventhubData( - body=MockEhBody() - ) + obj = MockEventhubData(body=MockEhBody()) dict = _get_json_content(obj) - assert dict.get('data') == 'Eventhub' - assert dict.get('specversion') == '1.0' + assert dict.get("data") == "Eventhub" + assert dict.get("specversion") == "1.0" + def test_get_bytes_eventhubs_wrong_content(): - obj = MockEventhubData( - body=MockEhBody(data='random string') - ) + obj = MockEventhubData(body=MockEhBody(data="random string")) with pytest.raises(ValueError, match="Failed to load JSON content from the object."): dict = _get_json_content(obj) + def test_get_bytes_random_obj(): json_str = '{"id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", "source": "https://egtest.dev/cloudcustomevent", "data": {"team": "event grid squad"}, "type": "Azure.Sdk.Sample", "time": "2020-08-07T02:06:08.11969Z", "specversion": "1.0"}' - random_obj = { - "id":"de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", - "source":"https://egtest.dev/cloudcustomevent", - "data":{"team": "event grid squad"}, - "type":"Azure.Sdk.Sample", - "time":"2020-08-07T02:06:08.11969Z", - "specversion":"1.0" + random_obj = { + "id": "de0fd76c-4ef4-4dfb-ab3a-8f24a307e033", + "source": "https://egtest.dev/cloudcustomevent", + "data": {"team": "event grid squad"}, + "type": "Azure.Sdk.Sample", + "time": "2020-08-07T02:06:08.11969Z", + "specversion": "1.0", } assert _get_json_content(json_str) == random_obj + def test_from_json_sb(): obj = MockServiceBusReceivedMessage( body=MockBody(), - message_id='3f6c5441-5be5-4f33-80c3-3ffeb6a090ce', - content_type='application/cloudevents+json; charset=utf-8', + message_id="3f6c5441-5be5-4f33-80c3-3ffeb6a090ce", + content_type="application/cloudevents+json; charset=utf-8", time_to_live=datetime.timedelta(days=14), delivery_count=13, enqueued_sequence_number=0, enqueued_time_utc=datetime.datetime(2021, 7, 22, 22, 27, 41, 236000), expires_at_utc=datetime.datetime(2021, 8, 5, 22, 27, 41, 236000), sequence_number=11219, - lock_token='233146e3-d5a6-45eb-826f-691d82fb8b13' + lock_token="233146e3-d5a6-45eb-826f-691d82fb8b13", ) event = CloudEvent.from_json(obj) assert event.id == "f208feff-099b-4bda-a341-4afd0fa02fef" assert event.data == "ServiceBus" + def test_from_json_eh(): - obj = MockEventhubData( - body=MockEhBody() - ) + obj = MockEventhubData(body=MockEhBody()) event = CloudEvent.from_json(obj) assert event.id == "f208feff-099b-4bda-a341-4afd0fa02fef" assert event.data == "Eventhub" + def test_from_json_storage(): cloud_storage_dict = """{ "id":"a0517898-9fa4-4e70-b4a3-afda1dd68672", @@ -708,17 +731,17 @@ def test_from_json_storage(): obj = MockQueueMessage(content=cloud_storage_dict) event = CloudEvent.from_json(obj) assert event.data == { - "api":"PutBlockList", - "client_request_id":"6d79dbfb-0e37-4fc4-981f-442c9ca65760", - "request_id":"831e1650-001e-001b-66ab-eeb76e000000", - "e_tag":"0x8D4BCC2E4835CD0", - "content_type":"application/octet-stream", - "content_length":524288, - "blob_type":"BlockBlob", - "url":"https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", - "sequencer":"00000000000004420000000000028963", - "storage_diagnostics":{"batchId":"b68529f3-68cd-4744-baa4-3c0498ec19f0"} - } + "api": "PutBlockList", + "client_request_id": "6d79dbfb-0e37-4fc4-981f-442c9ca65760", + "request_id": "831e1650-001e-001b-66ab-eeb76e000000", + "e_tag": "0x8D4BCC2E4835CD0", + "content_type": "application/octet-stream", + "content_length": 524288, + "blob_type": "BlockBlob", + "url": "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", + "sequencer": "00000000000004420000000000028963", + "storage_diagnostics": {"batchId": "b68529f3-68cd-4744-baa4-3c0498ec19f0"}, + } def test_from_json(): diff --git a/sdk/core/azure-core/tests/test_paging.py b/sdk/core/azure-core/tests/test_paging.py index decf3fae94f9..7057a75aee53 100644 --- a/sdk/core/azure-core/tests/test_paging.py +++ b/sdk/core/azure-core/tests/test_paging.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- from azure.core.paging import ItemPaged from azure.core.exceptions import HttpResponseError @@ -31,101 +31,74 @@ class TestPaging(object): - def test_basic_paging(self): - def get_next(continuation_token=None): - """Simplify my life and return JSON and not response, but should be response. - """ + """Simplify my life and return JSON and not response, but should be response.""" if not continuation_token: - return { - 'nextLink': 'page2', - 'value': ['value1.0', 'value1.1'] - } + return {"nextLink": "page2", "value": ["value1.0", "value1.1"]} else: - return { - 'nextLink': None, - 'value': ['value2.0', 'value2.1'] - } + return {"nextLink": None, "value": ["value2.0", "value2.1"]} def extract_data(response): - return response['nextLink'], iter(response['value']) + return response["nextLink"], iter(response["value"]) pager = ItemPaged(get_next, extract_data) result_iterated = list(pager) - assert ['value1.0', 'value1.1', 'value2.0', 'value2.1'] == result_iterated + assert ["value1.0", "value1.1", "value2.0", "value2.1"] == result_iterated def test_by_page_paging(self): - def get_next(continuation_token=None): - """Simplify my life and return JSON and not response, but should be response. - """ + """Simplify my life and return JSON and not response, but should be response.""" if not continuation_token: - return { - 'nextLink': 'page2', - 'value': ['value1.0', 'value1.1'] - } + return {"nextLink": "page2", "value": ["value1.0", "value1.1"]} else: - return { - 'nextLink': None, - 'value': ['value2.0', 'value2.1'] - } + return {"nextLink": None, "value": ["value2.0", "value2.1"]} def extract_data(response): - return response['nextLink'], iter(response['value']) + return response["nextLink"], iter(response["value"]) pager = ItemPaged(get_next, extract_data).by_page() page1 = next(pager) - assert list(page1) == ['value1.0', 'value1.1'] + assert list(page1) == ["value1.0", "value1.1"] page2 = next(pager) - assert list(page2) == ['value2.0', 'value2.1'] + assert list(page2) == ["value2.0", "value2.1"] with pytest.raises(StopIteration): next(pager) def test_advance_paging(self): - def get_next(continuation_token=None): - """Simplify my life and return JSON and not response, but should be response. - """ + """Simplify my life and return JSON and not response, but should be response.""" if not continuation_token: - return { - 'nextLink': 'page2', - 'value': ['value1.0', 'value1.1'] - } + return {"nextLink": "page2", "value": ["value1.0", "value1.1"]} else: - return { - 'nextLink': None, - 'value': ['value2.0', 'value2.1'] - } + return {"nextLink": None, "value": ["value2.0", "value2.1"]} def extract_data(response): - return response['nextLink'], iter(response['value']) + return response["nextLink"], iter(response["value"]) pager = ItemPaged(get_next, extract_data) page1 = next(pager) - assert page1 == 'value1.0' + assert page1 == "value1.0" page1 = next(pager) - assert page1 == 'value1.1' + assert page1 == "value1.1" page2 = next(pager) - assert page2 == 'value2.0' + assert page2 == "value2.0" page2 = next(pager) - assert page2 == 'value2.1' + assert page2 == "value2.1" with pytest.raises(StopIteration): next(pager) def test_none_value(self): def get_next(continuation_token=None): - return { - 'nextLink': None, - 'value': None - } + return {"nextLink": None, "value": None} + def extract_data(response): - return response['nextLink'], iter(response['value'] or []) + return response["nextLink"], iter(response["value"] or []) pager = ItemPaged(get_next, extract_data) result_iterated = list(pager) @@ -133,31 +106,27 @@ def extract_data(response): def test_print(self): def get_next(continuation_token=None): - return { - 'nextLink': None, - 'value': None - } + return {"nextLink": None, "value": None} + def extract_data(response): - return response['nextLink'], iter(response['value'] or []) + return response["nextLink"], iter(response["value"] or []) pager = ItemPaged(get_next, extract_data) output = repr(pager) - assert output.startswith('\n" + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_url_with_params(http_request): @@ -246,22 +267,25 @@ def test_request_url_with_params(http_request): assert request.url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_url_with_params_as_list(http_request): request = http_request("GET", "/") request.url = "a/b/c?t=y" - request.format_parameters({"g": ["h","i"]}) + request.format_parameters({"g": ["h", "i"]}) assert request.url in ["a/b/c?g=h&g=i&t=y", "a/b/c?t=y&g=h&g=i"] + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_url_with_params_with_none_in_list(http_request): request = http_request("GET", "/") request.url = "a/b/c?t=y" with pytest.raises(ValueError): - request.format_parameters({"g": ["h",None]}) + request.format_parameters({"g": ["h", None]}) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_url_with_params_with_none(http_request): @@ -271,19 +295,21 @@ def test_request_url_with_params_with_none(http_request): with pytest.raises(ValueError): request.format_parameters({"g": None}) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_repr(http_request): request = http_request("GET", "hello.com") assert repr(request) == "" + def test_add_custom_policy(): class BooPolicy(HTTPPolicy): def send(*args): - raise AzureError('boo') + raise AzureError("boo") class FooPolicy(HTTPPolicy): def send(*args): - raise AzureError('boo') + raise AzureError("boo") config = Configuration() retry_policy = RetryPolicy() @@ -328,8 +354,9 @@ def send(*args): assert pos_boo < pos_retry assert pos_foo > pos_retry - client = PipelineClient(base_url="test", config=config, per_call_policies=[boo_policy], - per_retry_policies=[foo_policy]) + client = PipelineClient( + base_url="test", config=config, per_call_policies=[boo_policy], per_retry_policies=[foo_policy] + ) policies = client._pipeline._impl_policies assert boo_policy in policies assert foo_policy in policies @@ -339,9 +366,7 @@ def send(*args): assert pos_boo < pos_retry assert pos_foo > pos_retry - policies = [UserAgentPolicy(), - RetryPolicy(), - DistributedTracingPolicy()] + policies = [UserAgentPolicy(), RetryPolicy(), DistributedTracingPolicy()] client = PipelineClient(base_url="test", policies=policies, per_call_policies=boo_policy) actual_policies = client._pipeline._impl_policies assert boo_policy == actual_policies[0] @@ -356,33 +381,32 @@ def send(*args): actual_policies = client._pipeline._impl_policies assert foo_policy == actual_policies[2] - client = PipelineClient(base_url="test", policies=policies, per_call_policies=boo_policy, - per_retry_policies=foo_policy) + client = PipelineClient( + base_url="test", policies=policies, per_call_policies=boo_policy, per_retry_policies=foo_policy + ) actual_policies = client._pipeline._impl_policies assert boo_policy == actual_policies[0] assert foo_policy == actual_policies[3] - client = PipelineClient(base_url="test", policies=policies, per_call_policies=[boo_policy], - per_retry_policies=[foo_policy]) + client = PipelineClient( + base_url="test", policies=policies, per_call_policies=[boo_policy], per_retry_policies=[foo_policy] + ) actual_policies = client._pipeline._impl_policies assert boo_policy == actual_policies[0] assert foo_policy == actual_policies[3] - policies = [UserAgentPolicy(), - DistributedTracingPolicy()] + policies = [UserAgentPolicy(), DistributedTracingPolicy()] with pytest.raises(ValueError): client = PipelineClient(base_url="test", policies=policies, per_retry_policies=foo_policy) with pytest.raises(ValueError): client = PipelineClient(base_url="test", policies=policies, per_retry_policies=[foo_policy]) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_basic_requests(port, http_request): conf = Configuration() request = http_request("GET", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), RedirectPolicy()] with Pipeline(RequestsTransport(), policies=policies) as pipeline: response = pipeline.run(request) if is_rest(request): @@ -391,14 +415,12 @@ def test_basic_requests(port, http_request): assert pipeline._transport.session is None assert isinstance(response.http_response.status_code, int) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_basic_options_requests(port, http_request): request = http_request("OPTIONS", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), RedirectPolicy()] with Pipeline(RequestsTransport(), policies=policies) as pipeline: response = pipeline.run(request) if is_rest(request): @@ -407,15 +429,13 @@ def test_basic_options_requests(port, http_request): assert pipeline._transport.session is None assert isinstance(response.http_response.status_code, int) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_basic_requests_separate_session(port, http_request): session = requests.Session() request = http_request("GET", "http://localhost:{}/basic/string".format(port)) - policies = [ - UserAgentPolicy("myusergant"), - RedirectPolicy() - ] + policies = [UserAgentPolicy("myusergant"), RedirectPolicy()] transport = RequestsTransport(session=session, session_owner=False) with Pipeline(transport, policies=policies) as pipeline: response = pipeline.run(request) @@ -428,28 +448,22 @@ def test_basic_requests_separate_session(port, http_request): assert transport.session transport.session.close() + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_text(port, http_request): client = PipelineClientBase("http://localhost:{}".format(port)) if is_rest(http_request): request = http_request("GET", "/", json="foo") else: - request = client.get( - "/", - content="foo" - ) + request = client.get("/", content="foo") # In absence of information, everything is JSON (double quote added) assert request.data == json.dumps("foo") if is_rest(http_request): - request = http_request("POST", "/", headers={'content-type': 'text/whatever'}, content="foo") + request = http_request("POST", "/", headers={"content-type": "text/whatever"}, content="foo") else: - request = client.post( - "/", - headers={'content-type': 'text/whatever'}, - content="foo" - ) + request = client.post("/", headers={"content-type": "text/whatever"}, content="foo") # We want a direct string assert request.data == "foo" diff --git a/sdk/core/azure-core/tests/test_polling.py b/sdk/core/azure-core/tests/test_polling.py index 79549daadd1d..e3fb92e124b6 100644 --- a/sdk/core/azure-core/tests/test_polling.py +++ b/sdk/core/azure-core/tests/test_polling.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,8 +22,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import time + try: from unittest import mock except ImportError: @@ -34,9 +35,8 @@ from azure.core import PipelineClient from azure.core.exceptions import ServiceResponseError from azure.core.polling import * -from azure.core.polling.base_polling import ( - LROBasePolling, LocationPolling -) +from azure.core.polling.base_polling import LROBasePolling, LocationPolling + # from msrest.serialization import Model @@ -75,46 +75,45 @@ def test_no_polling(client): no_polling = NoPolling() initial_response = "initial response" + def deserialization_cb(response): assert response == initial_response - return "Treated: "+response + return "Treated: " + response no_polling.initialize(client, initial_response, deserialization_cb) - no_polling.run() # Should no raise and do nothing + no_polling.run() # Should no raise and do nothing assert no_polling.status() == "succeeded" assert no_polling.finished() - assert no_polling.resource() == "Treated: "+initial_response + assert no_polling.resource() == "Treated: " + initial_response continuation_token = no_polling.get_continuation_token() assert isinstance(continuation_token, str) no_polling_revived_args = NoPolling.from_continuation_token( - continuation_token, - deserialization_callback=deserialization_cb, - client=client + continuation_token, deserialization_callback=deserialization_cb, client=client ) no_polling_revived = NoPolling() no_polling_revived.initialize(*no_polling_revived_args) assert no_polling_revived.status() == "succeeded" assert no_polling_revived.finished() - assert no_polling_revived.resource() == "Treated: "+initial_response + assert no_polling_revived.resource() == "Treated: " + initial_response + def test_polling_with_path_format_arguments(client): - method = LROBasePolling( - timeout=0, - path_format_arguments={"host": "host:3000", "accountName": "local"} - ) + method = LROBasePolling(timeout=0, path_format_arguments={"host": "host:3000", "accountName": "local"}) client._base_url = "http://{accountName}{host}" method._operation = LocationPolling() method._operation._location_url = "/results/1" method._client = client - assert "http://localhost:3000/results/1" == method._client.format_url(method._operation.get_polling_url(), **method._path_format_arguments) + assert "http://localhost:3000/results/1" == method._client.format_url( + method._operation.get_polling_url(), **method._path_format_arguments + ) class PollingTwoSteps(PollingMethod): - """An empty poller that returns the deserialized initial response. - """ + """An empty poller that returns the deserialized initial response.""" + def __init__(self, sleep=0): self._initial_response = None self._deserialization_callback = None @@ -126,10 +125,9 @@ def initialize(self, _, initial_response, deserialization_callback): self._finished = False def run(self): - """Empty run, no polling. - """ + """Empty run, no polling.""" self._finished = True - time.sleep(self._sleep) # Give me time to add callbacks! + time.sleep(self._sleep) # Give me time to add callbacks! def status(self): """Return the current status as a string. @@ -153,7 +151,7 @@ def get_continuation_token(self): def from_continuation_token(cls, continuation_token, **kwargs): # type(str, Any) -> Tuple initial_response = continuation_token - deserialization_callback = kwargs['deserialization_callback'] + deserialization_callback = kwargs["deserialization_callback"] return None, initial_response, deserialization_callback @@ -165,7 +163,7 @@ def test_poller(client): # Same for deserialization_callback, just pass to the polling_method def deserialization_callback(response): assert response == initial_response - return "Treated: "+response + return "Treated: " + response method = NoPolling() @@ -176,7 +174,7 @@ def deserialization_callback(response): result = poller.result() assert poller.done() - assert result == "Treated: "+initial_response + assert result == "Treated: " + initial_response assert poller.status() == "succeeded" assert poller.polling_method() is method done_cb.assert_called_once_with(method) @@ -195,7 +193,7 @@ def deserialization_callback(response): poller.remove_done_callback(done_cb2) result = poller.result() - assert result == "Treated: "+initial_response + assert result == "Treated: " + initial_response assert poller.status() == "succeeded" done_cb.assert_called_once_with(method) done_cb2.assert_not_called() @@ -213,22 +211,22 @@ def deserialization_callback(response): client=client, initial_response=initial_response, deserialization_callback=deserialization_callback, - polling_method=method + polling_method=method, ) result = new_poller.result() - assert result == "Treated: "+initial_response + assert result == "Treated: " + initial_response assert new_poller.status() == "succeeded" def test_broken_poller(client): - class NoPollingError(PollingTwoSteps): def run(self): raise ValueError("Something bad happened") initial_response = "Initial response" + def deserialization_callback(response): - return "Treated: "+response + return "Treated: " + response method = NoPollingError() poller = LROPoller(client, initial_response, deserialization_callback, method) @@ -239,14 +237,14 @@ def deserialization_callback(response): def test_poller_error_continuation(client): - class NoPollingError(PollingTwoSteps): def run(self): raise ServiceResponseError("Something bad happened") initial_response = "Initial response" + def deserialization_callback(response): - return "Treated: "+response + return "Treated: " + response method = NoPollingError() poller = LROPoller(client, initial_response, deserialization_callback, method) diff --git a/sdk/core/azure-core/tests/test_request_id_policy.py b/sdk/core/azure-core/tests/test_request_id_policy.py index 44c8647982cb..e3c383ab746d 100644 --- a/sdk/core/azure-core/tests/test_request_id_policy.py +++ b/sdk/core/azure-core/tests/test_request_id_policy.py @@ -5,6 +5,7 @@ """Tests for the request id policy.""" from azure.core.pipeline.policies import RequestIdPolicy from azure.core.pipeline import PipelineRequest, PipelineContext + try: from unittest import mock except ImportError: @@ -17,24 +18,29 @@ request_id_init_values = ("foo", None, "_unset") request_id_set_values = ("bar", None, "_unset") request_id_req_values = ("baz", None, "_unset") -full_combination = list(product(auto_request_id_values, request_id_init_values, request_id_set_values, request_id_req_values, HTTP_REQUESTS)) +full_combination = list( + product(auto_request_id_values, request_id_init_values, request_id_set_values, request_id_req_values, HTTP_REQUESTS) +) + -@pytest.mark.parametrize("auto_request_id, request_id_init, request_id_set, request_id_req, http_request", full_combination) +@pytest.mark.parametrize( + "auto_request_id, request_id_init, request_id_set, request_id_req, http_request", full_combination +) def test_request_id_policy(auto_request_id, request_id_init, request_id_set, request_id_req, http_request): """Test policy with no other policy and happy path""" kwargs = {} if auto_request_id is not None: - kwargs['auto_request_id'] = auto_request_id + kwargs["auto_request_id"] = auto_request_id if request_id_init != "_unset": - kwargs['request_id'] = request_id_init + kwargs["request_id"] = request_id_init request_id_policy = RequestIdPolicy(**kwargs) if request_id_set != "_unset": request_id_policy.set_request_id(request_id_set) - request = http_request('GET', 'http://localhost/') + request = http_request("GET", "http://localhost/") pipeline_request = PipelineRequest(request, PipelineContext(None)) if request_id_req != "_unset": - pipeline_request.context.options['request_id'] = request_id_req - with mock.patch('uuid.uuid1', return_value="VALUE"): + pipeline_request.context.options["request_id"] = request_id_req + with mock.patch("uuid.uuid1", return_value="VALUE"): request_id_policy.on_request(pipeline_request) assert all(v is not None for v in request.headers.values()) @@ -55,11 +61,12 @@ def test_request_id_policy(auto_request_id, request_id_init, request_id_set, req else: assert not "x-ms-client-request-id" in request.headers + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_id_already_exists(http_request): """Test policy with no other policy and happy path""" request_id_policy = RequestIdPolicy() - request = http_request('GET', 'http://localhost/') + request = http_request("GET", "http://localhost/") request.headers["x-ms-client-request-id"] = "VALUE" pipeline_request = PipelineRequest(request, PipelineContext(None)) request_id_policy.on_request(pipeline_request) diff --git a/sdk/core/azure-core/tests/test_requests_universal.py b/sdk/core/azure-core/tests/test_requests_universal.py index 80dbf66299f8..880c414598ea 100644 --- a/sdk/core/azure-core/tests/test_requests_universal.py +++ b/sdk/core/azure-core/tests/test_requests_universal.py @@ -46,13 +46,15 @@ def thread_body(local_sender): future = executor.submit(thread_body, sender) assert future.result() + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_requests_auto_headers(port, http_request): request = http_request("POST", "http://localhost:{}/basic/string".format(port)) with RequestsTransport() as sender: response = sender.send(request) auto_headers = response.internal_response.request.headers - assert 'Content-Type' not in auto_headers + assert "Content-Type" not in auto_headers + def _create_requests_response(http_response, body_bytes, headers=None): # https://github.com/psf/requests/blob/67a7b2e8336951d527e223429672354989384197/requests/adapters.py#L255 @@ -60,40 +62,30 @@ def _create_requests_response(http_response, body_bytes, headers=None): req_response._content = body_bytes req_response._content_consumed = True req_response.status_code = 200 - req_response.reason = 'OK' + req_response.reason = "OK" if headers: # req_response.headers is type CaseInsensitiveDict req_response.headers.update(headers) req_response.encoding = requests.utils.get_encoding_from_headers(req_response.headers) - response = create_transport_response( - http_response, - None, # Don't need a request here - req_response - ) + response = create_transport_response(http_response, None, req_response) # Don't need a request here return response + @pytest.mark.parametrize("http_response", REQUESTS_TRANSPORT_RESPONSES) def test_requests_response_text(http_response): for encoding in ["utf-8", "utf-8-sig", None]: - res = _create_requests_response( - http_response, - b'\xef\xbb\xbf56', - {'Content-Type': 'text/plain'} - ) + res = _create_requests_response(http_response, b"\xef\xbb\xbf56", {"Content-Type": "text/plain"}) if is_rest(http_response): res.read() - assert res.text(encoding) == '56', "Encoding {} didn't work".format(encoding) + assert res.text(encoding) == "56", "Encoding {} didn't work".format(encoding) + @pytest.mark.parametrize("http_response", REQUESTS_TRANSPORT_RESPONSES) def test_repr(http_response): - res = _create_requests_response( - http_response, - b'\xef\xbb\xbf56', - {'Content-Type': 'text/plain'} - ) + res = _create_requests_response(http_response, b"\xef\xbb\xbf56", {"Content-Type": "text/plain"}) class_name = "HttpResponse" if is_rest(http_response) else "RequestsTransportResponse" assert repr(res) == "<{}: 200 OK, Content-Type: text/plain>".format(class_name) diff --git a/sdk/core/azure-core/tests/test_rest_context_manager.py b/sdk/core/azure-core/tests/test_rest_context_manager.py index 0531cfe1505c..194204239617 100644 --- a/sdk/core/azure-core/tests/test_rest_context_manager.py +++ b/sdk/core/azure-core/tests/test_rest_context_manager.py @@ -8,11 +8,13 @@ from azure.core.rest import HttpRequest from azure.core.exceptions import ResponseNotReadError + def test_normal_call(client, port): def _raise_and_get_text(response): response.raise_for_status() assert response.text() == "Hello, world!" assert response.is_closed + request = HttpRequest("GET", url="/basic/string") response = client.send_request(request) _raise_and_get_text(response) @@ -25,6 +27,7 @@ def _raise_and_get_text(response): with response as response: _raise_and_get_text(response) + def test_stream_call(client): def _raise_and_get_text(response): response.raise_for_status() @@ -34,6 +37,7 @@ def _raise_and_get_text(response): response.read() assert response.text() == "Hello, world!" assert response.is_closed + request = HttpRequest("GET", url="/streams/basic") response = client.send_request(request, stream=True) _raise_and_get_text(response) @@ -47,6 +51,7 @@ def _raise_and_get_text(response): with response as response: _raise_and_get_text(response) + # TODO: commenting until https://github.com/Azure/azure-sdk-for-python/issues/18086 is fixed # def test_stream_with_error(client): diff --git a/sdk/core/azure-core/tests/test_rest_headers.py b/sdk/core/azure-core/tests/test_rest_headers.py index 7bbeea9ee000..e5d170d1f738 100644 --- a/sdk/core/azure-core/tests/test_rest_headers.py +++ b/sdk/core/azure-core/tests/test_rest_headers.py @@ -12,13 +12,16 @@ # Thank you httpx for your wonderful tests! from azure.core.rest import HttpRequest + @pytest.fixture def get_request_headers(): def _get_request_headers(header_value): request = HttpRequest(method="GET", url="http://example.org", headers=header_value) return request.headers + return _get_request_headers + # flask returns these response headers, which we don't really need for these following tests RESPONSE_HEADERS_TO_IGNORE = [ "Connection", @@ -28,6 +31,7 @@ def _get_request_headers(header_value): "Date", ] + @pytest.fixture def get_response_headers(client): def _get_response_headers(request): @@ -36,13 +40,16 @@ def _get_response_headers(request): for header in RESPONSE_HEADERS_TO_IGNORE: response.headers.pop(header, None) return response.headers + return _get_response_headers + def test_headers_request(get_request_headers): h = get_request_headers({"a": "123", "b": "789"}) assert h["A"] == "123" assert h["B"] == "789" + def test_headers_response(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) assert "a" in h @@ -58,7 +65,7 @@ def test_headers_response(get_response_headers): assert h.get("nope", default="default") is "default" assert h.get("nope", default=None) is None assert h.get("nope", default=[]) == [] - assert list(h) == ['a', 'b'] + assert list(h) == ["a", "b"] assert set(h.keys()) == set(["a", "b"]) assert list(h.values()) == ["123, 456", "789"] @@ -66,6 +73,7 @@ def test_headers_response(get_response_headers): assert list(h) == ["a", "b"] assert dict(h) == {"a": "123, 456", "b": "789"} + def test_headers_response_keys(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) # basically want to make sure this behaves like dict {"a": "123, 456", "b": "789"} @@ -81,8 +89,9 @@ def test_headers_response_keys_mutability(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) # test mutability before_mutation_keys = h.keys() - h['c'] = '000' - assert 'c' in before_mutation_keys + h["c"] = "000" + assert "c" in before_mutation_keys + def test_headers_response_values(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) @@ -90,8 +99,8 @@ def test_headers_response_values(get_response_headers): ref_dict = {"a": "123, 456", "b": "789"} assert set(h.values()) == set(ref_dict.values()) assert repr(h.values()) == "ValuesView({'a': '123, 456', 'b': '789'})" - assert '123, 456' in h.values() - assert '789' in h.values() + assert "123, 456" in h.values() + assert "789" in h.values() assert set(h.values()) == set(ref_dict.values()) @@ -99,8 +108,8 @@ def test_headers_response_values_mutability(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) # test mutability before_mutation_values = h.values() - h['c'] = '000' - assert '000' in before_mutation_values + h["c"] = "000" + assert "000" in before_mutation_values def test_headers_response_items(get_response_headers): @@ -109,12 +118,12 @@ def test_headers_response_items(get_response_headers): ref_dict = {"a": "123, 456", "b": "789"} assert set(h.items()) == set(ref_dict.items()) assert repr(h.items()) == "ItemsView({'a': '123, 456', 'b': '789'})" - assert ("a", '123, 456') in h.items() - assert not ("a", '123, 456', '123, 456') in h.items() + assert ("a", "123, 456") in h.items() + assert not ("a", "123, 456", "123, 456") in h.items() assert not {"a": "blah", "123, 456": "blah"} in h.items() - assert ("A", '123, 456') in h.items() - assert ("b", '789') in h.items() - assert ("B", '789') in h.items() + assert ("A", "123, 456") in h.items() + assert ("b", "789") in h.items() + assert ("B", "789") in h.items() assert set(h.items()) == set(ref_dict.items()) @@ -122,8 +131,9 @@ def test_headers_response_items_mutability(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers")) # test mutability before_mutation_items = h.items() - h['c'] = '000' - assert ('c', '000') in before_mutation_items + h["c"] = "000" + assert ("c", "000") in before_mutation_items + def test_header_mutations(get_request_headers, get_response_headers): def _headers_check(h): @@ -138,21 +148,29 @@ def _headers_check(h): assert dict(h) == {"a": "2", "b": "4"} del h["a"] assert dict(h) == {"b": "4"} + _headers_check(get_request_headers({})) _headers_check(get_response_headers(HttpRequest("GET", "/headers/empty"))) + def test_copy_headers_method(get_request_headers, get_response_headers): def _header_check(h): headers_copy = h.copy() assert h == headers_copy assert h is not headers_copy - _header_check(get_request_headers({ - "lowercase-header": "lowercase", - "ALLCAPS-HEADER": "ALLCAPS", - "CamelCase-Header": "camelCase", - })) + + _header_check( + get_request_headers( + { + "lowercase-header": "lowercase", + "ALLCAPS-HEADER": "ALLCAPS", + "CamelCase-Header": "camelCase", + } + ) + ) _header_check(get_response_headers(HttpRequest("GET", "/headers/case-insensitive"))) + def test_headers_insert_retains_ordering(get_request_headers, get_response_headers): def _header_check(h): h["b"] = "123" @@ -160,6 +178,7 @@ def _header_check(h): assert list(h.values()) == ["a", "123", "c"] else: assert set(h.values()) == set(["a", "123", "c"]) + _header_check(get_request_headers({"a": "a", "b": "b", "c": "c"})) _header_check(get_response_headers(HttpRequest("GET", "/headers/ordered"))) @@ -171,11 +190,16 @@ def _headers_check(h): assert list(h.values()) == ["lowercase", "ALLCAPS", "camelCase", "123"] else: assert set(list(h.values())) == set(["lowercase", "ALLCAPS", "camelCase", "123"]) - _headers_check(get_request_headers({ - "lowercase-header": "lowercase", - "ALLCAPS-HEADER": "ALLCAPS", - "CamelCase-Header": "camelCase", - })) + + _headers_check( + get_request_headers( + { + "lowercase-header": "lowercase", + "ALLCAPS-HEADER": "ALLCAPS", + "CamelCase-Header": "camelCase", + } + ) + ) _headers_check(get_response_headers(HttpRequest("GET", "/headers/case-insensitive"))) @@ -183,6 +207,7 @@ def test_headers_insert_removes_all_existing(get_request_headers, get_response_h def _headers_check(h): h["a"] = "789" assert dict(h) == {"a": "789", "b": "789"} + _headers_check(get_request_headers([("a", "123"), ("a", "456"), ("b", "789")])) _headers_check(get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers"))) @@ -191,60 +216,65 @@ def test_headers_delete_removes_all_existing(get_request_headers, get_response_h def _headers_check(h): del h["a"] assert dict(h) == {"b": "789"} + _headers_check(get_request_headers([("a", "123"), ("a", "456"), ("b", "789")])) _headers_check(get_response_headers(HttpRequest("GET", "/headers/duplicate/numbers"))) + def test_headers_not_override(): - request = HttpRequest("PUT", "http://example.org", json={"hello": "world"}, headers={"Content-Length": "5000", "Content-Type": "application/my-content-type"}) + request = HttpRequest( + "PUT", + "http://example.org", + json={"hello": "world"}, + headers={"Content-Length": "5000", "Content-Type": "application/my-content-type"}, + ) assert request.headers["Content-Length"] == "5000" assert request.headers["Content-Type"] == "application/my-content-type" + def test_headers_case_insensitive(get_request_headers, get_response_headers): def _headers_check(h): assert ( - h["lowercase-header"] == - h["LOWERCASE-HEADER"] == - h["Lowercase-Header"] == - h["lOwErCasE-HeADer"] == - "lowercase" + h["lowercase-header"] + == h["LOWERCASE-HEADER"] + == h["Lowercase-Header"] + == h["lOwErCasE-HeADer"] + == "lowercase" ) + assert h["allcaps-header"] == h["ALLCAPS-HEADER"] == h["Allcaps-Header"] == h["AlLCapS-HeADer"] == "ALLCAPS" assert ( - h["allcaps-header"] == - h["ALLCAPS-HEADER"] == - h["Allcaps-Header"] == - h["AlLCapS-HeADer"] == - "ALLCAPS" + h["camelcase-header"] + == h["CAMELCASE-HEADER"] + == h["CamelCase-Header"] + == h["cAMeLCaSE-hEadER"] + == "camelCase" ) - assert ( - h["camelcase-header"] == - h["CAMELCASE-HEADER"] == - h["CamelCase-Header"] == - h["cAMeLCaSE-hEadER"] == - "camelCase" + + _headers_check( + get_request_headers( + { + "lowercase-header": "lowercase", + "ALLCAPS-HEADER": "ALLCAPS", + "CamelCase-Header": "camelCase", + } ) - _headers_check(get_request_headers({ - "lowercase-header": "lowercase", - "ALLCAPS-HEADER": "ALLCAPS", - "CamelCase-Header": "camelCase", - })) + ) _headers_check(get_response_headers(HttpRequest("GET", "/headers/case-insensitive"))) + def test_multiple_headers_duplicate_case_insensitive(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/case-insensitive")) - assert ( - h["Duplicate-Header"] == - h['duplicate-header'] == - h['DupLicAte-HeaDER'] == - "one, two, three" - ) + assert h["Duplicate-Header"] == h["duplicate-header"] == h["DupLicAte-HeaDER"] == "one, two, three" + def test_multiple_headers_commas(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/commas")) assert h["Set-Cookie"] == "a, b, c" + def test_update(get_response_headers): h = get_response_headers(HttpRequest("GET", "/headers/duplicate/commas")) assert h["Set-Cookie"] == "a, b, c" h.update({"Set-Cookie": "override", "new-key": "new-value"}) - assert h['Set-Cookie'] == 'override' + assert h["Set-Cookie"] == "override" assert h["new-key"] == "new-value" diff --git a/sdk/core/azure-core/tests/test_rest_http_request.py b/sdk/core/azure-core/tests/test_rest_http_request.py index 7cbeba563407..34bc046d7263 100644 --- a/sdk/core/azure-core/tests/test_rest_http_request.py +++ b/sdk/core/azure-core/tests/test_rest_http_request.py @@ -11,6 +11,7 @@ import pytest import sys import os + try: import collections.abc as collections except ImportError: @@ -18,28 +19,31 @@ from azure.core.configuration import Configuration from azure.core.rest import HttpRequest -from azure.core.pipeline.policies import ( - CustomHookPolicy, UserAgentPolicy, SansIOHTTPPolicy, RetryPolicy -) +from azure.core.pipeline.policies import CustomHookPolicy, UserAgentPolicy, SansIOHTTPPolicy, RetryPolicy from azure.core.pipeline._tools import is_rest from rest_client import TestRestClient from azure.core import PipelineClient + @pytest.fixture def assert_iterator_body(): def _comparer(request, final_value): content = b"".join([p for p in request.content]) assert content == final_value + return _comparer + def test_request_repr(): request = HttpRequest("GET", "http://example.org") assert repr(request) == "" + def test_no_content(): request = HttpRequest("GET", "http://example.org") assert "Content-Length" not in request.headers + def test_content_length_header(): request = HttpRequest("POST", "http://example.org", content=b"test 123") assert request.headers["Content-Length"] == "8" @@ -69,9 +73,7 @@ def content(): yield b"test 123" # pragma: nocover headers = {"Content-Length": "8"} - request = HttpRequest( - "POST", "http://example.org", content=content(), headers=headers - ) + request = HttpRequest("POST", "http://example.org", content=content(), headers=headers) assert request.headers == {"Content-Length": "8"} assert_iterator_body(request, b"test 123") @@ -80,7 +82,9 @@ def test_url_encoded_data(): request = HttpRequest("POST", "http://example.org", data={"test": "123"}) assert request.headers["Content-Type"] == "application/x-www-form-urlencoded" - assert request.content == {'test': '123'} # httpx makes this just b'test=123'. set_formdata_body is still keeping it as a dict + assert request.content == { + "test": "123" + } # httpx makes this just b'test=123'. set_formdata_body is still keeping it as a dict def test_json_encoded_data(): @@ -115,17 +119,22 @@ def streaming_body(data): assert "Transfer-Encoding" not in request.headers assert request.headers["Content-Length"] == "4" + def test_override_accept_encoding_header(): headers = {"Accept-Encoding": "identity"} request = HttpRequest("GET", "http://example.org", headers=headers) assert request.headers["Accept-Encoding"] == "identity" + """Test request body""" + + def test_empty_content(): request = HttpRequest("GET", "http://example.org") assert request.content is None + def test_string_content(): request = HttpRequest("PUT", "http://example.org", content="Hello, world!") assert request.headers == {"Content-Length": "13", "Content-Type": "text/plain"} @@ -163,6 +172,7 @@ def test_bytes_content(): assert request.headers == {"Content-Length": "13"} assert request.content == b"Hello, world!" + def test_iterator_content(assert_iterator_body): # NOTE: in httpx, content reads out the actual value. Don't do that (yet) in azure rest def hello_world(): @@ -199,6 +209,7 @@ def test_json_content(): } assert request.content == '{"Hello": "world!"}' + def test_urlencoded_content(): # NOTE: not adding content length setting and content testing bc we're not adding content length in the rest code # that's dealt with later in the pipeline. @@ -207,6 +218,7 @@ def test_urlencoded_content(): "Content-Type": "application/x-www-form-urlencoded", } + @pytest.mark.parametrize(("key"), (1, 2.3, None)) def test_multipart_invalid_key(key): @@ -237,26 +249,28 @@ def test_multipart_invalid_key_binary_string(): assert "Invalid type for data name" in str(e.value) assert repr(b"abc") in str(e.value) + def test_data_str_input(): data = { - 'scope': 'fake_scope', - u'grant_type': 'refresh_token', - 'refresh_token': u'REDACTED', - 'service': 'fake_url.azurecr.io' + "scope": "fake_scope", + "grant_type": "refresh_token", + "refresh_token": "REDACTED", + "service": "fake_url.azurecr.io", } request = HttpRequest("POST", "http://localhost:3000/", data=data) assert len(request.content) == 4 assert request.content["scope"] == "fake_scope" assert request.content["grant_type"] == "refresh_token" - assert request.content["refresh_token"] == u"REDACTED" + assert request.content["refresh_token"] == "REDACTED" assert request.content["service"] == "fake_url.azurecr.io" assert len(request.headers) == 1 - assert request.headers['Content-Type'] == 'application/x-www-form-urlencoded' + assert request.headers["Content-Type"] == "application/x-www-form-urlencoded" + def test_content_str_input(): requests = [ HttpRequest("POST", "/fake", content="hello, world!"), - HttpRequest("POST", "/fake", content=u"hello, world!"), + HttpRequest("POST", "/fake", content="hello, world!"), ] for request in requests: assert len(request.headers) == 2 @@ -264,6 +278,7 @@ def test_content_str_input(): assert request.headers["Content-Length"] == "13" assert request.content == "hello, world!" + @pytest.mark.parametrize(("value"), (object(), {"key": "value"})) def test_multipart_invalid_value(value): @@ -273,11 +288,13 @@ def test_multipart_invalid_value(value): HttpRequest("POST", "http://localhost:8000/", data=data, files=files) assert "Invalid type for data value" in str(e.value) + def test_empty_request(): request = HttpRequest("POST", url="http://example.org", data={}, files={}) assert request.headers == {} - assert not request.content # in core, we don't convert urlencoded dict to bytes representation in content + assert not request.content # in core, we don't convert urlencoded dict to bytes representation in content + def test_read_content(assert_iterator_body): def content(): @@ -288,22 +305,23 @@ def content(): # in this case, request._data is what we end up passing to the requests transport assert isinstance(request._data, collections.Iterable) + def test_complicated_json(client): # thanks to Sean Kane for this test! input = { - 'EmptyByte': '', - 'EmptyUnicode': '', - 'SpacesOnlyByte': ' ', - 'SpacesOnlyUnicode': ' ', - 'SpacesBeforeByte': ' Text', - 'SpacesBeforeUnicode': ' Text', - 'SpacesAfterByte': 'Text ', - 'SpacesAfterUnicode': 'Text ', - 'SpacesBeforeAndAfterByte': ' Text ', - 'SpacesBeforeAndAfterUnicode': ' Text ', - '啊齄丂狛': 'ꀕ', - 'RowKey': 'test2', - '啊齄丂狛狜': 'hello', + "EmptyByte": "", + "EmptyUnicode": "", + "SpacesOnlyByte": " ", + "SpacesOnlyUnicode": " ", + "SpacesBeforeByte": " Text", + "SpacesBeforeUnicode": " Text", + "SpacesAfterByte": "Text ", + "SpacesAfterUnicode": "Text ", + "SpacesBeforeAndAfterByte": " Text ", + "SpacesBeforeAndAfterUnicode": " Text ", + "啊齄丂狛": "ꀕ", + "RowKey": "test2", + "啊齄丂狛狜": "hello", "singlequote": "a''''b", "doublequote": 'a""""b', "None": None, @@ -312,25 +330,26 @@ def test_complicated_json(client): r = client.send_request(request) r.raise_for_status() + def test_use_custom_json_encoder(): # this is to test we're using azure.core.serialization.AzureJSONEncoder # to serialize our JSON objects # since json can't serialize bytes by default but AzureJSONEncoder can, # we pass in bytes and check that they are serialized request = HttpRequest("GET", "/headers", json=bytearray("mybytes", "utf-8")) - assert request.content == '"bXlieXRlcw=="' # cspell:disable-line + assert request.content == '"bXlieXRlcw=="' # cspell:disable-line + def test_request_policies_raw_request_hook(port): # test that the request all the way through the pipeline is a new request request = HttpRequest("GET", "/headers") + def callback(request): assert is_rest(request.http_request) raise ValueError("I entered the callback!") + custom_hook_policy = CustomHookPolicy(raw_request_hook=callback) - policies = [ - UserAgentPolicy("myuseragent"), - custom_hook_policy - ] + policies = [UserAgentPolicy("myuseragent"), custom_hook_policy] client = TestRestClient(port=port, policies=policies) with pytest.raises(ValueError) as ex: @@ -341,7 +360,7 @@ def callback(request): def test_request_policies_chain(port): class OldPolicyModifyBody(SansIOHTTPPolicy): def on_request(self, request): - assert is_rest(request.http_request) # first make sure this is a new request + assert is_rest(request.http_request) # first make sure this is a new request # deals with request like an old request request.http_request.set_json_body({"hello": "world"}) @@ -353,7 +372,7 @@ def on_request(self, request): # modify header to know we entered this callback request.http_request.headers = { "x-ms-date": "Thu, 14 Jun 2018 16:46:54 GMT", - "Authorization": "SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=", # fake key suppressed in credscan + "Authorization": "SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=", # fake key suppressed in credscan "Content-Length": "0", } @@ -363,11 +382,11 @@ def on_request(self, request): # don't want to deal with content in serialize, so let's first just remove it request.http_request.data = None expected = ( - b'DELETE http://localhost:5000/container0/blob0 HTTP/1.1\r\n' - b'x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n' - b'Authorization: SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=\r\n' # fake key suppressed in credscan - b'Content-Length: 0\r\n' - b'\r\n' + b"DELETE http://localhost:5000/container0/blob0 HTTP/1.1\r\n" + b"x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT\r\n" + b"Authorization: SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=\r\n" # fake key suppressed in credscan + b"Content-Length: 0\r\n" + b"\r\n" ) assert request.http_request.serialize() == expected raise ValueError("Passed through the policies!") @@ -403,17 +422,14 @@ def on_request(self, pipeline_request): return pipeline_request class NewPolicy(SansIOHTTPPolicy): - def on_request(self, pipeline_request): request = pipeline_request.http_request assert is_rest(request) - assert request.content == 'change to me!' # new request has property content + assert request.content == "change to me!" # new request has property content raise ValueError("I entered the policies!") pipeline_client = PipelineClient( - base_url="http://localhost:{}".format(port), - config=config, - per_call_policies=[OldPolicy(), NewPolicy()] + base_url="http://localhost:{}".format(port), config=config, per_call_policies=[OldPolicy(), NewPolicy()] ) client = TestRestClient(port=port) client._client = pipeline_client @@ -426,8 +442,9 @@ def on_request(self, pipeline_request): # work assert "I entered the policies!" in str(ex.value) + def test_json_file_valid(): - json_bytes = bytearray('{"more": "cowbell"}', encoding='utf-8') + json_bytes = bytearray('{"more": "cowbell"}', encoding="utf-8") with io.BytesIO(json_bytes) as json_file: request = HttpRequest("PUT", "/fake", json=json_file) assert request.headers == {"Content-Type": "application/json"} @@ -435,8 +452,9 @@ def test_json_file_valid(): assert not request.content.closed assert request.content.read() == b'{"more": "cowbell"}' + def test_json_file_invalid(): - json_bytes = bytearray('{"more": "cowbell" i am not valid', encoding='utf-8') + json_bytes = bytearray('{"more": "cowbell" i am not valid', encoding="utf-8") with io.BytesIO(json_bytes) as json_file: request = HttpRequest("PUT", "/fake", json=json_file) assert request.headers == {"Content-Type": "application/json"} @@ -444,8 +462,9 @@ def test_json_file_invalid(): assert not request.content.closed assert request.content.read() == b'{"more": "cowbell" i am not valid' + def test_json_file_content_type_input(): - json_bytes = bytearray('{"more": "cowbell"}', encoding='utf-8') + json_bytes = bytearray('{"more": "cowbell"}', encoding="utf-8") with io.BytesIO(json_bytes) as json_file: request = HttpRequest("PUT", "/fake", json=json_file, headers={"Content-Type": "application/json-special"}) assert request.headers == {"Content-Type": "application/json-special"} @@ -453,6 +472,7 @@ def test_json_file_content_type_input(): assert not request.content.closed assert request.content.read() == b'{"more": "cowbell"}' + class NonSeekableStream: def __init__(self, wrapped_stream): self.wrapped_stream = wrapped_stream @@ -469,13 +489,15 @@ def seek(self, *args, **kwargs): def tell(self): return self.wrapped_stream.tell() + def test_non_seekable_stream_input(): data = b"a" * 4 * 1024 data_stream = NonSeekableStream(io.BytesIO(data)) - HttpRequest(method="PUT", url="http://www.example.com", content=data_stream) # ensure we can make this HttpRequest + HttpRequest(method="PUT", url="http://www.example.com", content=data_stream) # ensure we can make this HttpRequest + class Stream: - def __init__(self, length, initial_buffer_length=4*1024): + def __init__(self, length, initial_buffer_length=4 * 1024): self._base_data = os.urandom(initial_buffer_length) self._base_data_length = initial_buffer_length self._position = 0 @@ -487,9 +509,10 @@ def read(self, size=None): def remaining(self): return self._remaining + def test_stream_input(): data_stream = Stream(length=4) - HttpRequest(method="PUT", url="http://www.example.com", content=data_stream) # ensure we can make this HttpRequest + HttpRequest(method="PUT", url="http://www.example.com", content=data_stream) # ensure we can make this HttpRequest # NOTE: For files, we don't allow list of tuples yet, just dict. Will uncomment when we add this capability diff --git a/sdk/core/azure-core/tests/test_rest_http_response.py b/sdk/core/azure-core/tests/test_rest_http_response.py index e0a6cd0d6839..0f3219517103 100644 --- a/sdk/core/azure-core/tests/test_rest_http_response.py +++ b/sdk/core/azure-core/tests/test_rest_http_response.py @@ -17,14 +17,17 @@ import xml.etree.ElementTree as ET from utils import readonly_checks + @pytest.fixture def send_request(client): def _send_request(request): response = client.send_request(request, stream=False) response.raise_for_status() return response + return _send_request + def test_response(send_request, port): response = send_request( request=HttpRequest("GET", "/basic/string"), @@ -52,10 +55,11 @@ def test_response_text(send_request): assert response.status_code == 200 assert response.reason == "OK" assert response.text() == "Hello, world!" - assert response.headers["Content-Length"] == '13' - assert response.headers['Content-Type'] == "text/plain; charset=utf-8" + assert response.headers["Content-Length"] == "13" + assert response.headers["Content-Type"] == "text/plain; charset=utf-8" assert response.content_type == "text/plain; charset=utf-8" + def test_response_html(send_request): response = send_request( request=HttpRequest("GET", "/basic/html"), @@ -64,6 +68,7 @@ def test_response_html(send_request): assert response.reason == "OK" assert response.text() == "Hello, world!" + def test_raise_for_status(client): response = client.send_request( HttpRequest("GET", "/basic/string"), @@ -85,21 +90,19 @@ def test_raise_for_status(client): with pytest.raises(HttpResponseError): response.raise_for_status() + def test_response_repr(send_request): - response = send_request( - request=HttpRequest("GET", "/basic/string") - ) + response = send_request(request=HttpRequest("GET", "/basic/string")) assert repr(response) == "" + def test_response_content_type_encoding(send_request): """ Use the charset encoding in the Content-Type header if possible. """ - response = send_request( - request=HttpRequest("GET", "/encoding/latin-1") - ) + response = send_request(request=HttpRequest("GET", "/encoding/latin-1")) assert response.content_type == "text/plain; charset=latin-1" - assert response.text() == u"Latin 1: ÿ" + assert response.text() == "Latin 1: ÿ" assert response.encoding == "latin-1" @@ -107,11 +110,9 @@ def test_response_autodetect_encoding(send_request): """ Autodetect encoding if there is no Content-Type header. """ - response = send_request( - request=HttpRequest("GET", "/encoding/latin-1") - ) + response = send_request(request=HttpRequest("GET", "/encoding/latin-1")) - assert response.text() == u'Latin 1: ÿ' + assert response.text() == "Latin 1: ÿ" assert response.encoding == "latin-1" @@ -119,12 +120,10 @@ def test_response_fallback_to_autodetect(send_request): """ Fallback to autodetection if we get an invalid charset in the Content-Type header. """ - response = send_request( - request=HttpRequest("GET", "/encoding/invalid-codec-name") - ) + response = send_request(request=HttpRequest("GET", "/encoding/invalid-codec-name")) assert response.headers["Content-Type"] == "text/plain; charset=invalid-codec-name" - assert response.text() == u"おはようございます。" + assert response.text() == "おはようございます。" assert response.encoding is None @@ -151,7 +150,7 @@ def test_response_no_charset_with_iso_8859_1_content(send_request): response = send_request( request=HttpRequest("GET", "/encoding/iso-8859-1"), ) - assert response.text() == u"Accented: �sterreich" + assert response.text() == "Accented: �sterreich" assert response.encoding is None @@ -162,6 +161,7 @@ def test_json(send_request): assert response.json() == {"greeting": "hello", "recipient": "world"} assert response.encoding is None + def test_json_with_specified_encoding(send_request): response = send_request( request=HttpRequest("GET", "/encoding/json"), @@ -169,33 +169,36 @@ def test_json_with_specified_encoding(send_request): assert response.json() == {"greeting": "hello", "recipient": "world"} assert response.encoding == "utf-16" + def test_emoji(send_request): response = send_request( request=HttpRequest("GET", "/encoding/emoji"), ) - assert response.text() == u"👩" + assert response.text() == "👩" + def test_emoji_family_with_skin_tone_modifier(send_request): response = send_request( request=HttpRequest("GET", "/encoding/emoji-family-skin-tone-modifier"), ) - assert response.text() == u"👩🏻‍👩🏽‍👧🏾‍👦🏿 SSN: 859-98-0987" + assert response.text() == "👩🏻‍👩🏽‍👧🏾‍👦🏿 SSN: 859-98-0987" + def test_korean_nfc(send_request): response = send_request( request=HttpRequest("GET", "/encoding/korean"), ) - assert response.text() == u"아가" + assert response.text() == "아가" + def test_urlencoded_content(send_request): send_request( request=HttpRequest( - "POST", - "/urlencoded/pet/add/1", - data={ "pet_type": "dog", "pet_food": "meat", "name": "Fido", "pet_age": 42 } + "POST", "/urlencoded/pet/add/1", data={"pet_type": "dog", "pet_food": "meat", "name": "Fido", "pet_age": 42} ), ) + def test_multipart_files_content(send_request): request = HttpRequest( "POST", @@ -204,6 +207,7 @@ def test_multipart_files_content(send_request): ) send_request(request) + def test_multipart_data_and_files_content(send_request): request = HttpRequest( "POST", @@ -240,6 +244,7 @@ def data(): ) send_request(request) + def test_get_xml_basic(send_request): request = HttpRequest( "GET", @@ -247,11 +252,12 @@ def test_get_xml_basic(send_request): ) response = send_request(request) parsed_xml = ET.fromstring(response.text()) - assert parsed_xml.tag == 'slideshow' + assert parsed_xml.tag == "slideshow" attributes = parsed_xml.attrib - assert attributes['title'] == "Sample Slide Show" - assert attributes['date'] == "Date of publication" - assert attributes['author'] == "Yours Truly" + assert attributes["title"] == "Sample Slide Show" + assert attributes["date"] == "Date of publication" + assert attributes["author"] == "Yours Truly" + def test_put_xml_basic(send_request): @@ -278,6 +284,7 @@ def test_put_xml_basic(send_request): ) send_request(request) + def test_send_request_return_pipeline_response(client): # we use return_pipeline_response for some cases in autorest request = HttpRequest("GET", "/basic/string") @@ -288,43 +295,48 @@ def test_send_request_return_pipeline_response(client): assert response.http_response.text() == "Hello, world!" assert hasattr(response.http_request, "content") + def test_text_and_encoding(send_request): response = send_request( request=HttpRequest("GET", "/encoding/emoji"), ) - assert response.content == u"👩".encode("utf-8") - assert response.text() == u"👩" + assert response.content == "👩".encode("utf-8") + assert response.text() == "👩" # try setting encoding as a property response.encoding = "utf-16" - assert response.text() == u"鿰ꦑ" == response.content.decode(response.encoding) + assert response.text() == "鿰ꦑ" == response.content.decode(response.encoding) # assert latin-1 changes text decoding without changing encoding property - assert response.text("latin-1") == u'ð\x9f\x91©' == response.content.decode("latin-1") + assert response.text("latin-1") == "ð\x9f\x91©" == response.content.decode("latin-1") assert response.encoding == "utf-16" + def test_passing_encoding_to_text(send_request): response = send_request( request=HttpRequest("GET", "/encoding/emoji"), ) - assert response.content == u"👩".encode("utf-8") - assert response.text() == u"👩" + assert response.content == "👩".encode("utf-8") + assert response.text() == "👩" # pass in different encoding - assert response.text("latin-1") == u'ð\x9f\x91©' + assert response.text("latin-1") == "ð\x9f\x91©" # check response.text() still gets us the old value - assert response.text() == u"👩" + assert response.text() == "👩" + def test_initialize_response_abc(): with pytest.raises(TypeError) as ex: HttpResponse() assert "Can't instantiate abstract class" in str(ex) + def test_readonly(send_request): """Make sure everything that is readonly is readonly""" response = send_request(HttpRequest("GET", "/health")) assert isinstance(response, RestRequestsTransportResponse) from azure.core.pipeline.transport import RequestsTransportResponse + readonly_checks(response, old_response_class=RequestsTransportResponse) diff --git a/sdk/core/azure-core/tests/test_rest_polling.py b/sdk/core/azure-core/tests/test_rest_polling.py index 3dfebef958db..fad744dee647 100644 --- a/sdk/core/azure-core/tests/test_rest_polling.py +++ b/sdk/core/azure-core/tests/test_rest_polling.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,89 +22,104 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import pytest from azure.core.exceptions import ServiceRequestError from azure.core.rest import HttpRequest from azure.core.polling import LROPoller from azure.core.polling.base_polling import LROBasePolling + @pytest.fixture def deserialization_callback(): def _callback(response): return response.http_response.json() + return _callback + @pytest.fixture def lro_poller(client, deserialization_callback): def _callback(request, **kwargs): - initial_response = client.send_request( - request=request, - _return_pipeline_response=True - ) + initial_response = client.send_request(request=request, _return_pipeline_response=True) return LROPoller( client._client, initial_response, deserialization_callback, LROBasePolling(0, **kwargs), ) + return _callback + def test_post_with_location_and_operation_location_headers(lro_poller): poller = lro_poller(HttpRequest("POST", "/polling/post/location-and-operation-location")) result = poller.result() - assert result == {'location_result': True} + assert result == {"location_result": True} + def test_post_with_location_and_operation_location_headers_no_body(lro_poller): poller = lro_poller(HttpRequest("POST", "/polling/post/location-and-operation-location-no-body")) result = poller.result() assert result is None + def test_post_resource_location(lro_poller): poller = lro_poller(HttpRequest("POST", "/polling/post/resource-location")) result = poller.result() - assert result == {'location_result': True} + assert result == {"location_result": True} + def test_put_no_polling(lro_poller): result = lro_poller(HttpRequest("PUT", "/polling/no-polling")).result() - assert result['properties']['provisioningState'] == 'Succeeded' + assert result["properties"]["provisioningState"] == "Succeeded" + def test_put_location(lro_poller): result = lro_poller(HttpRequest("PUT", "/polling/location")).result() - assert result['location_result'] + assert result["location_result"] + def test_put_initial_response_body_invalid(lro_poller): # initial body is invalid result = lro_poller(HttpRequest("PUT", "/polling/initial-body-invalid")).result() - assert result['location_result'] + assert result["location_result"] + def test_put_operation_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): lro_poller(HttpRequest("PUT", "/polling/bad-operation-location"), retry_total=0).result() + def test_put_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): lro_poller(HttpRequest("PUT", "/polling/bad-location"), retry_total=0).result() + def test_patch_location(lro_poller): result = lro_poller(HttpRequest("PATCH", "/polling/location")).result() - assert result['location_result'] + assert result["location_result"] + def test_patch_operation_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): lro_poller(HttpRequest("PUT", "/polling/bad-operation-location"), retry_total=0).result() + def test_patch_location_polling_fail(lro_poller): with pytest.raises(ServiceRequestError): lro_poller(HttpRequest("PUT", "/polling/bad-location"), retry_total=0).result() + def test_delete_operation_location(lro_poller): result = lro_poller(HttpRequest("DELETE", "/polling/operation-location")).result() - assert result['status'] == 'Succeeded' + assert result["status"] == "Succeeded" + def test_request_id(lro_poller): result = lro_poller(HttpRequest("POST", "/polling/request-id"), request_id="123456789").result() + def test_continuation_token(client, lro_poller, deserialization_callback): poller = lro_poller(HttpRequest("POST", "/polling/post/location-and-operation-location")) token = poller.continuation_token() @@ -115,4 +130,4 @@ def test_continuation_token(client, lro_poller, deserialization_callback): deserialization_callback=deserialization_callback, ) result = new_poller.result() - assert result == {'location_result': True} + assert result == {"location_result": True} diff --git a/sdk/core/azure-core/tests/test_rest_query.py b/sdk/core/azure-core/tests/test_rest_query.py index 7aeda360da6a..e35715ee5e5e 100644 --- a/sdk/core/azure-core/tests/test_rest_query.py +++ b/sdk/core/azure-core/tests/test_rest_query.py @@ -10,21 +10,26 @@ import pytest from azure.core.rest import HttpRequest + def _format_query_into_url(url, params): request = HttpRequest(method="GET", url=url, params=params) return request.url + def test_request_url_with_params(): url = _format_query_into_url(url="a/b/c?t=y", params={"g": "h"}) assert url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] + def test_request_url_with_params_as_list(): - url = _format_query_into_url(url="a/b/c?t=y", params={"g": ["h","i"]}) + url = _format_query_into_url(url="a/b/c?t=y", params={"g": ["h", "i"]}) assert url in ["a/b/c?g=h&g=i&t=y", "a/b/c?t=y&g=h&g=i"] + def test_request_url_with_params_with_none_in_list(): with pytest.raises(ValueError): - _format_query_into_url(url="a/b/c?t=y", params={"g": ["h",None]}) + _format_query_into_url(url="a/b/c?t=y", params={"g": ["h", None]}) + def test_request_url_with_params_with_none(): with pytest.raises(ValueError): diff --git a/sdk/core/azure-core/tests/test_rest_request_backcompat.py b/sdk/core/azure-core/tests/test_rest_request_backcompat.py index e2d4f866f470..17751f7625b3 100644 --- a/sdk/core/azure-core/tests/test_rest_request_backcompat.py +++ b/sdk/core/azure-core/tests/test_rest_request_backcompat.py @@ -10,25 +10,30 @@ import xml.etree.ElementTree as ET from azure.core.pipeline.transport import HttpRequest as PipelineTransportHttpRequest from azure.core.rest import HttpRequest as RestHttpRequest + try: import collections.abc as collections except ImportError: import collections + @pytest.fixture def old_request(): return PipelineTransportHttpRequest("GET", "/") + @pytest.fixture def new_request(): return RestHttpRequest("GET", "/") + def test_request_attr_parity(old_request, new_request): for attr in dir(old_request): if not attr[0] == "_": # if not a private attr, we want parity assert hasattr(new_request, attr) + def test_request_set_attrs(old_request, new_request): for attr in dir(old_request): if attr[0] == "_": @@ -43,65 +48,56 @@ def test_request_set_attrs(old_request, new_request): setattr(new_request, attr, "foo") assert getattr(old_request, attr) == getattr(new_request, attr) == "foo" + def test_request_multipart_mixed_info(old_request, new_request): old_request.multipart_mixed_info = "foo" new_request.multipart_mixed_info = "foo" assert old_request.multipart_mixed_info == new_request.multipart_mixed_info == "foo" + def test_request_files_attr(old_request, new_request): assert old_request.files == new_request.files == None old_request.files = {"hello": "world"} new_request.files = {"hello": "world"} assert old_request.files == new_request.files == {"hello": "world"} + def test_request_data_attr(old_request, new_request): assert old_request.data == new_request.data == None old_request.data = {"hello": "world"} new_request.data = {"hello": "world"} assert old_request.data == new_request.data == {"hello": "world"} + def test_request_query(old_request, new_request): assert old_request.query == new_request.query == {} old_request.url = "http://localhost:5000?a=b&c=d" new_request.url = "http://localhost:5000?a=b&c=d" - assert old_request.query == new_request.query == {'a': 'b', 'c': 'd'} + assert old_request.query == new_request.query == {"a": "b", "c": "d"} + def test_request_query_and_params_kwarg(old_request): # should be same behavior if we pass in query params through the params kwarg in the new requests old_request.url = "http://localhost:5000?a=b&c=d" - new_request = RestHttpRequest("GET", "http://localhost:5000", params={'a': 'b', 'c': 'd'}) - assert old_request.query == new_request.query == {'a': 'b', 'c': 'd'} + new_request = RestHttpRequest("GET", "http://localhost:5000", params={"a": "b", "c": "d"}) + assert old_request.query == new_request.query == {"a": "b", "c": "d"} + def test_request_body(old_request, new_request): assert old_request.body == new_request.body == None old_request.data = {"hello": "world"} new_request.data = {"hello": "world"} - assert ( - old_request.body == - new_request.body == - new_request.content == - {"hello": "world"} - ) + assert old_request.body == new_request.body == new_request.content == {"hello": "world"} # files will not override data old_request.files = {"foo": "bar"} new_request.files = {"foo": "bar"} - assert ( - old_request.body == - new_request.body == - new_request.content == - {"hello": "world"} - ) + assert old_request.body == new_request.body == new_request.content == {"hello": "world"} # nullify data old_request.data = None new_request.data = None - assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - None - ) + assert old_request.data == new_request.data == old_request.body == new_request.body == None + def test_format_parameters(old_request, new_request): old_request.url = "a/b/c?t=y" @@ -114,14 +110,13 @@ def test_format_parameters(old_request, new_request): assert old_request.url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] assert new_request.url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] + def test_request_format_parameters_and_params_kwarg(old_request): # calling format_parameters on an old request should be the same # behavior as passing in params to new request old_request.url = "a/b/c?t=y" old_request.format_parameters({"g": "h"}) - new_request = RestHttpRequest( - "GET", "a/b/c?t=y", params={"g": "h"} - ) + new_request = RestHttpRequest("GET", "a/b/c?t=y", params={"g": "h"}) assert old_request.url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] assert new_request.url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] @@ -130,6 +125,7 @@ def test_request_format_parameters_and_params_kwarg(old_request): assert new_request.url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] assert new_request.url in ["a/b/c?g=h&t=y", "a/b/c?t=y&g=h"] + def test_request_streamed_data_body(old_request, new_request): assert old_request.files == new_request.files == None assert old_request.data == new_request.data == None @@ -137,6 +133,7 @@ def test_request_streamed_data_body(old_request, new_request): # passing in iterable def streaming_body(data): yield data # pragma: nocover + old_request.set_streamed_data_body(streaming_body("i will be streamed")) new_request.set_streamed_data_body(streaming_body("i will be streamed")) @@ -148,6 +145,7 @@ def streaming_body(data): assert isinstance(new_request.content, collections.Iterable) assert old_request.headers == new_request.headers == {} + def test_request_streamed_data_body_non_iterable(old_request, new_request): # should fail before nullifying the files property old_request.files = new_request.files = "foo" @@ -165,11 +163,13 @@ def test_request_streamed_data_body_non_iterable(old_request, new_request): assert old_request.files == "foo" assert old_request.headers == new_request.headers == {} + def test_request_streamed_data_body_and_content_kwarg(old_request): # passing stream bodies to set_streamed_data_body # and passing a stream body to the content kwarg of the new request should be the same def streaming_body(data): yield data # pragma: nocover + old_request.set_streamed_data_body(streaming_body("stream")) new_request = RestHttpRequest("GET", "/", content=streaming_body("stream")) assert old_request.files == new_request.files == None @@ -180,6 +180,7 @@ def streaming_body(data): assert isinstance(new_request.content, collections.Iterable) assert old_request.headers == new_request.headers == {} + def test_request_text_body(old_request, new_request): assert old_request.files == new_request.files == None assert old_request.data == new_request.data == None @@ -189,31 +190,33 @@ def test_request_text_body(old_request, new_request): assert old_request.files == new_request.files == None assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - "i am text" + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == "i am text" ) - assert old_request.headers['Content-Length'] == new_request.headers['Content-Length'] == '9' + assert old_request.headers["Content-Length"] == new_request.headers["Content-Length"] == "9" assert not old_request.headers.get("Content-Type") assert new_request.headers["Content-Type"] == "text/plain" + def test_request_text_body_and_content_kwarg(old_request): old_request.set_text_body("i am text") new_request = RestHttpRequest("GET", "/", content="i am text") assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - "i am text" + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == "i am text" ) assert old_request.headers["Content-Length"] == new_request.headers["Content-Length"] == "9" assert old_request.files == new_request.files == None + def test_request_xml_body(old_request, new_request): assert old_request.files == new_request.files == None assert old_request.data == new_request.data == None @@ -224,29 +227,31 @@ def test_request_xml_body(old_request, new_request): assert old_request.files == new_request.files == None assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - b"\n" + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == b"\n" ) - assert old_request.headers == new_request.headers == {'Content-Length': '47'} + assert old_request.headers == new_request.headers == {"Content-Length": "47"} + def test_request_xml_body_and_content_kwarg(old_request): old_request.set_text_body("i am text") new_request = RestHttpRequest("GET", "/", content="i am text") assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - "i am text" + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == "i am text" ) assert old_request.headers["Content-Length"] == new_request.headers["Content-Length"] == "9" assert old_request.files == new_request.files == None + def test_request_json_body(old_request, new_request): assert old_request.files == new_request.files == None assert old_request.data == new_request.data == None @@ -257,34 +262,36 @@ def test_request_json_body(old_request, new_request): assert old_request.files == new_request.files == None assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - json.dumps(json_input) + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == json.dumps(json_input) ) - assert old_request.headers["Content-Length"] == new_request.headers['Content-Length'] == '18' + assert old_request.headers["Content-Length"] == new_request.headers["Content-Length"] == "18" assert not old_request.headers.get("Content-Type") assert new_request.headers["Content-Type"] == "application/json" + def test_request_json_body_and_json_kwarg(old_request): json_input = {"hello": "world"} old_request.set_json_body(json_input) new_request = RestHttpRequest("GET", "/", json=json_input) assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - json.dumps(json_input) + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == json.dumps(json_input) ) - assert old_request.headers["Content-Length"] == new_request.headers['Content-Length'] == '18' + assert old_request.headers["Content-Length"] == new_request.headers["Content-Length"] == "18" assert not old_request.headers.get("Content-Type") assert new_request.headers["Content-Type"] == "application/json" assert old_request.files == new_request.files == None + def test_request_formdata_body_files(old_request, new_request): assert old_request.files == new_request.files == None assert old_request.data == new_request.data == None @@ -297,17 +304,13 @@ def test_request_formdata_body_files(old_request, new_request): new_request.set_formdata_body({"fileName": "hello.jpg"}) assert old_request.data == new_request.data == None - assert ( - old_request.files == - new_request.files == - new_request.content == - {'fileName': (None, 'hello.jpg')} - ) + assert old_request.files == new_request.files == new_request.content == {"fileName": (None, "hello.jpg")} # we don't set any multipart headers with boundaries # we rely on the transport to boundary calculating assert old_request.headers == new_request.headers == {} + def test_request_formdata_body_data(old_request, new_request): assert old_request.files == new_request.files == None assert old_request.data == new_request.data == None @@ -323,17 +326,18 @@ def test_request_formdata_body_data(old_request, new_request): assert old_request.files == new_request.files == None assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - {"fileName": "hello.jpg"} + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == {"fileName": "hello.jpg"} ) # old behavior would pop out the Content-Type header # new behavior doesn't do that assert old_request.headers == {} - assert new_request.headers == {'Content-Type': "application/x-www-form-urlencoded"} + assert new_request.headers == {"Content-Type": "application/x-www-form-urlencoded"} + def test_request_formdata_body_and_files_kwarg(old_request): files = {"fileName": "hello.jpg"} @@ -342,7 +346,8 @@ def test_request_formdata_body_and_files_kwarg(old_request): assert old_request.data == new_request.data == None assert old_request.body == new_request.body == None assert old_request.headers == new_request.headers == {} - assert old_request.files == new_request.files == {'fileName': (None, 'hello.jpg')} + assert old_request.files == new_request.files == {"fileName": (None, "hello.jpg")} + def test_request_formdata_body_and_data_kwarg(old_request): data = {"fileName": "hello.jpg"} @@ -352,17 +357,18 @@ def test_request_formdata_body_and_data_kwarg(old_request): old_request.set_formdata_body(data) new_request = RestHttpRequest("GET", "/", data=data) assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - {"fileName": "hello.jpg"} + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == {"fileName": "hello.jpg"} ) assert old_request.headers == {} assert new_request.headers == {"Content-Type": "application/x-www-form-urlencoded"} assert old_request.files == new_request.files == None + def test_request_bytes_body(old_request, new_request): assert old_request.files == new_request.files == None assert old_request.data == new_request.data == None @@ -373,26 +379,27 @@ def test_request_bytes_body(old_request, new_request): assert old_request.files == new_request.files == None assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - bytes_input + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == bytes_input ) - assert old_request.headers == new_request.headers == {'Content-Length': '13'} + assert old_request.headers == new_request.headers == {"Content-Length": "13"} + def test_request_bytes_body_and_content_kwarg(old_request): bytes_input = b"hello, world!" old_request.set_bytes_body(bytes_input) new_request = RestHttpRequest("GET", "/", content=bytes_input) assert ( - old_request.data == - new_request.data == - old_request.body == - new_request.body == - new_request.content == - bytes_input + old_request.data + == new_request.data + == old_request.body + == new_request.body + == new_request.content + == bytes_input ) - assert old_request.headers == new_request.headers == {'Content-Length': '13'} + assert old_request.headers == new_request.headers == {"Content-Length": "13"} assert old_request.files == new_request.files diff --git a/sdk/core/azure-core/tests/test_rest_response_backcompat.py b/sdk/core/azure-core/tests/test_rest_response_backcompat.py index 2c890cb84fd7..c3a7cf9bbdf3 100644 --- a/sdk/core/azure-core/tests/test_rest_response_backcompat.py +++ b/sdk/core/azure-core/tests/test_rest_response_backcompat.py @@ -12,28 +12,34 @@ from azure.core.pipeline import Pipeline from azure.core.pipeline.transport import RequestsTransport + @pytest.fixture def old_request(port): return PipelineTransportHttpRequest("GET", "http://localhost:{}/streams/basic".format(port)) + @pytest.fixture def old_response(old_request): return RequestsTransport().send(old_request) + @pytest.fixture def new_request(port): return RestHttpRequest("GET", "http://localhost:{}/streams/basic".format(port)) + @pytest.fixture def new_response(new_request): return RequestsTransport().send(new_request) + def test_response_attr_parity(old_response, new_response): for attr in dir(old_response): if not attr[0] == "_": # if not a private attr, we want parity assert hasattr(new_response, attr) + def test_response_set_attrs(old_response, new_response): for attr in dir(old_response): if attr[0] == "_": @@ -48,21 +54,29 @@ def test_response_set_attrs(old_response, new_response): setattr(new_response, attr, "foo") assert getattr(old_response, attr) == getattr(new_response, attr) == "foo" + def test_response_block_size(old_response, new_response): assert old_response.block_size == new_response.block_size == 4096 old_response.block_size = 500 new_response.block_size = 500 assert old_response.block_size == new_response.block_size == 500 + def test_response_body(old_response, new_response): assert old_response.body() == new_response.body() == b"Hello, world!" + def test_response_internal_response(old_response, new_response, port): - assert old_response.internal_response.url == new_response.internal_response.url == "http://localhost:{}/streams/basic".format(port) + assert ( + old_response.internal_response.url + == new_response.internal_response.url + == "http://localhost:{}/streams/basic".format(port) + ) old_response.internal_response = "foo" new_response.internal_response = "foo" assert old_response.internal_response == new_response.internal_response == "foo" + def test_response_stream_download(old_request, new_request): transport = RequestsTransport() pipeline = Pipeline(transport) @@ -74,44 +88,53 @@ def test_response_stream_download(old_request, new_request): new_string = b"".join(new_response.stream_download(pipeline)) assert old_string == new_string == b"Hello, world!" + def test_response_request(old_response, new_response, port): assert old_response.request.url == new_response.request.url == "http://localhost:{}/streams/basic".format(port) old_response.request = "foo" new_response.request = "foo" assert old_response.request == new_response.request == "foo" + def test_response_status_code(old_response, new_response): assert old_response.status_code == new_response.status_code == 200 old_response.status_code = 202 new_response.status_code = 202 assert old_response.status_code == new_response.status_code == 202 + def test_response_headers(old_response, new_response): - assert set(old_response.headers.keys()) == set(new_response.headers.keys()) == set(["Content-Type", "Connection", "Server", "Date"]) + assert ( + set(old_response.headers.keys()) + == set(new_response.headers.keys()) + == set(["Content-Type", "Connection", "Server", "Date"]) + ) old_response.headers = {"Hello": "world!"} new_response.headers = {"Hello": "world!"} assert old_response.headers == new_response.headers == {"Hello": "world!"} + def test_response_reason(old_response, new_response): assert old_response.reason == new_response.reason == "OK" old_response.reason = "Not OK" new_response.reason = "Not OK" assert old_response.reason == new_response.reason == "Not OK" + def test_response_content_type(old_response, new_response): assert old_response.content_type == new_response.content_type == "text/html; charset=utf-8" old_response.content_type = "application/json" new_response.content_type = "application/json" assert old_response.content_type == new_response.content_type == "application/json" + def _create_multiapart_request(http_request_class): class ResponsePolicy(object): - def on_request(self, *args): return def on_response(self, request, response): - response.http_response.headers['x-ms-fun'] = 'true' + response.http_response.headers["x-ms-fun"] = "true" req0 = http_request_class("DELETE", "/container0/blob0") req1 = http_request_class("DELETE", "/container1/blob1") @@ -119,6 +142,7 @@ def on_response(self, request, response): request.set_multipart_mixed(req0, req1, policies=[ResponsePolicy()]) return request + def _test_parts(response): # hack the content type parts = response.parts() @@ -126,11 +150,11 @@ def _test_parts(response): parts0 = parts[0] assert parts0.status_code == 202 - assert parts0.headers['x-ms-fun'] == 'true' + assert parts0.headers["x-ms-fun"] == "true" parts1 = parts[1] assert parts1.status_code == 404 - assert parts1.headers['x-ms-fun'] == 'true' + assert parts1.headers["x-ms-fun"] == "true" def test_response_parts(port): diff --git a/sdk/core/azure-core/tests/test_rest_stream_responses.py b/sdk/core/azure-core/tests/test_rest_stream_responses.py index 645e86232ca2..7b37c9ee797a 100644 --- a/sdk/core/azure-core/tests/test_rest_stream_responses.py +++ b/sdk/core/azure-core/tests/test_rest_stream_responses.py @@ -9,19 +9,17 @@ from azure.core.exceptions import StreamClosedError, StreamConsumedError, ResponseNotReadError from azure.core.exceptions import HttpResponseError, ServiceRequestError + def _assert_stream_state(response, open): # if open is true, check the stream is open. # if false, check if everything is closed - checks = [ - response._internal_response._content_consumed, - response.is_closed, - response.is_stream_consumed - ] + checks = [response._internal_response._content_consumed, response.is_closed, response.is_stream_consumed] if open: assert not any(checks) else: assert all(checks) + def test_iter_raw(client): request = HttpRequest("GET", "/streams/basic") with client.send_request(request, stream=True) as response: @@ -36,6 +34,7 @@ def test_iter_raw(client): assert response.is_closed assert response.is_stream_consumed + def test_iter_raw_on_iterable(client): request = HttpRequest("GET", "/streams/iterable") @@ -45,6 +44,7 @@ def test_iter_raw_on_iterable(client): raw += part assert raw == b"Hello, world!" + def test_iter_with_error(client): request = HttpRequest("GET", "/errors/403") @@ -64,6 +64,7 @@ def test_iter_with_error(client): raise ValueError("Should error before entering") assert response.is_closed + def test_iter_bytes(client): request = HttpRequest("GET", "/streams/basic") @@ -79,6 +80,7 @@ def test_iter_bytes(client): assert response.is_stream_consumed assert raw == b"Hello, world!" + @pytest.mark.skip(reason="We've gotten rid of iter_text for now") def test_iter_text(client): request = HttpRequest("GET", "/basic/string") @@ -88,6 +90,7 @@ def test_iter_text(client): content += part assert content == "Hello, world!" + @pytest.mark.skip(reason="We've gotten rid of iter_lines for now") def test_iter_lines(client): request = HttpRequest("GET", "/basic/lines") @@ -98,6 +101,7 @@ def test_iter_lines(client): content.append(line) assert content == ["Hello,\n", "world!"] + def test_sync_streaming_response(client): request = HttpRequest("GET", "/streams/basic") @@ -111,6 +115,7 @@ def test_sync_streaming_response(client): assert response.content == b"Hello, world!" assert response.is_closed + def test_cannot_read_after_stream_consumed(client, port): request = HttpRequest("GET", "/streams/basic") @@ -127,6 +132,7 @@ def test_cannot_read_after_stream_consumed(client, port): assert "".format(port) in str(ex.value) assert "You have likely already consumed this stream, so it can not be accessed anymore" in str(ex.value) + def test_cannot_read_after_response_closed(port, client): request = HttpRequest("GET", "/streams/basic") @@ -138,6 +144,7 @@ def test_cannot_read_after_response_closed(port, client): assert "".format(port) in str(ex.value) assert "can no longer be read or streamed, since the response has already been closed" in str(ex.value) + def test_decompress_plain_no_header(client): # thanks to Xiang Yan for this test! account_name = "coretests" @@ -149,6 +156,7 @@ def test_decompress_plain_no_header(client): response.read() assert response.content == b"test" + def test_compress_plain_no_header(client): # thanks to Xiang Yan for this test! account_name = "coretests" @@ -159,6 +167,7 @@ def test_compress_plain_no_header(client): data = b"".join(list(iter)) assert data == b"test" + def test_decompress_compressed_no_header(client): # thanks to Xiang Yan for this test! account_name = "coretests" @@ -167,7 +176,8 @@ def test_decompress_compressed_no_header(client): response = client.send_request(request, stream=True) iter = response.iter_bytes() data = b"".join(list(iter)) - assert data == b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\n+I-.\x01\x00\x0c~\x7f\xd8\x04\x00\x00\x00' + assert data == b"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\n+I-.\x01\x00\x0c~\x7f\xd8\x04\x00\x00\x00" + def test_decompress_compressed_header(client): # thanks to Xiang Yan for this test! @@ -180,6 +190,7 @@ def test_decompress_compressed_header(client): data = b"".join(list(iter)) assert data == b"test" + def test_iter_read(client): # thanks to McCoy Patiño for this test! request = HttpRequest("GET", "/basic/string") @@ -190,6 +201,7 @@ def test_iter_read(client): assert part assert response.text() + def test_iter_read_back_and_forth(client): # thanks to McCoy Patiño for this test! @@ -209,13 +221,15 @@ def test_iter_read_back_and_forth(client): with pytest.raises(ResponseNotReadError): response.text() + def test_stream_with_return_pipeline_response(client): request = HttpRequest("GET", "/basic/string") pipeline_response = client.send_request(request, stream=True, _return_pipeline_response=True) assert hasattr(pipeline_response, "http_request") assert hasattr(pipeline_response, "http_response") assert hasattr(pipeline_response, "context") - assert list(pipeline_response.http_response.iter_bytes()) == [b'Hello, world!'] + assert list(pipeline_response.http_response.iter_bytes()) == [b"Hello, world!"] + def test_error_reading(client): request = HttpRequest("GET", "/errors/403") @@ -230,18 +244,21 @@ def test_error_reading(client): assert response.content == b"" # try giving a really slow response, see what happens + def test_pass_kwarg_to_iter_bytes(client): request = HttpRequest("GET", "/basic/string") response = client.send_request(request, stream=True) for part in response.iter_bytes(chunk_size=5): assert part + def test_pass_kwarg_to_iter_raw(client): request = HttpRequest("GET", "/basic/string") response = client.send_request(request, stream=True) for part in response.iter_raw(chunk_size=5): assert part + def test_decompress_compressed_header(client): # expect plain text request = HttpRequest("GET", "/encoding/gzip") @@ -251,6 +268,7 @@ def test_decompress_compressed_header(client): assert response.content == content assert response.text() == "hello world" + def test_deflate_decompress_compressed_header(client): # expect plain text request = HttpRequest("GET", "/encoding/deflate") @@ -260,6 +278,7 @@ def test_deflate_decompress_compressed_header(client): assert response.content == content assert response.text() == "hi there" + def test_decompress_compressed_header_stream(client): # expect plain text request = HttpRequest("GET", "/encoding/gzip") @@ -269,6 +288,7 @@ def test_decompress_compressed_header_stream(client): assert response.content == content assert response.text() == "hello world" + def test_decompress_compressed_header_stream_body_content(client): # expect plain text request = HttpRequest("GET", "/encoding/gzip") diff --git a/sdk/core/azure-core/tests/test_retry_policy.py b/sdk/core/azure-core/tests/test_retry_policy.py index 994841b52d22..c5a018014b28 100644 --- a/sdk/core/azure-core/tests/test_retry_policy.py +++ b/sdk/core/azure-core/tests/test_retry_policy.py @@ -43,13 +43,10 @@ def test_retry_code_class_variables(): assert 429 in retry_policy._RETRY_CODES assert 501 not in retry_policy._RETRY_CODES + def test_retry_types(): history = ["1", "2", "3"] - settings = { - 'history': history, - 'backoff': 1, - 'max_backoff': 10 - } + settings = {"history": history, "backoff": 1, "max_backoff": 10} retry_policy = RetryPolicy() backoff_time = retry_policy.get_backoff_time(settings) assert backoff_time == 4 @@ -62,7 +59,10 @@ def test_retry_types(): backoff_time = retry_policy.get_backoff_time(settings) assert backoff_time == 4 -@pytest.mark.parametrize("retry_after_input,http_request,http_response", product(['0', '800', '1000', '1200'], HTTP_REQUESTS, HTTP_RESPONSES)) + +@pytest.mark.parametrize( + "retry_after_input,http_request,http_response", product(["0", "800", "1000", "1200"], HTTP_REQUESTS, HTTP_RESPONSES) +) def test_retry_after(retry_after_input, http_request, http_response): retry_policy = RetryPolicy() request = http_request("GET", "http://localhost") @@ -71,7 +71,7 @@ def test_retry_after(retry_after_input, http_request, http_response): pipeline_response = PipelineResponse(request, response, None) retry_after = retry_policy.get_retry_after(pipeline_response) seconds = float(retry_after_input) - assert retry_after == seconds/1000.0 + assert retry_after == seconds / 1000.0 response.headers.pop("retry-after-ms") response.headers["Retry-After"] = retry_after_input retry_after = retry_policy.get_retry_after(pipeline_response) @@ -80,7 +80,10 @@ def test_retry_after(retry_after_input, http_request, http_response): retry_after = retry_policy.get_retry_after(pipeline_response) assert retry_after == float(retry_after_input) -@pytest.mark.parametrize("retry_after_input,http_request,http_response", product(['0', '800', '1000', '1200'], HTTP_REQUESTS, HTTP_RESPONSES)) + +@pytest.mark.parametrize( + "retry_after_input,http_request,http_response", product(["0", "800", "1000", "1200"], HTTP_REQUESTS, HTTP_RESPONSES) +) def test_x_ms_retry_after(retry_after_input, http_request, http_response): retry_policy = RetryPolicy() request = http_request("GET", "http://localhost") @@ -89,7 +92,7 @@ def test_x_ms_retry_after(retry_after_input, http_request, http_response): pipeline_response = PipelineResponse(request, response, None) retry_after = retry_policy.get_retry_after(pipeline_response) seconds = float(retry_after_input) - assert retry_after == seconds/1000.0 + assert retry_after == seconds / 1000.0 response.headers.pop("x-ms-retry-after-ms") response.headers["Retry-After"] = retry_after_input retry_after = retry_policy.get_retry_after(pipeline_response) @@ -98,15 +101,19 @@ def test_x_ms_retry_after(retry_after_input, http_request, http_response): retry_after = retry_policy.get_retry_after(pipeline_response) assert retry_after == float(retry_after_input) + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_retry_on_429(http_request, http_response): class MockTransport(HttpTransport): def __init__(self): self._count = 0 + def __exit__(self, exc_type, exc_val, exc_tb): pass + def close(self): pass + def open(self): pass @@ -116,22 +123,26 @@ def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineRe response.status_code = 429 return response - http_request = http_request('GET', 'http://localhost/') - http_retry = RetryPolicy(retry_total = 1) + http_request = http_request("GET", "http://localhost/") + http_retry = RetryPolicy(retry_total=1) transport = MockTransport() pipeline = Pipeline(transport, [http_retry]) pipeline.run(http_request) assert transport._count == 2 + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_no_retry_on_201(http_request, http_response): class MockTransport(HttpTransport): def __init__(self): self._count = 0 + def __exit__(self, exc_type, exc_val, exc_tb): pass + def close(self): pass + def open(self): pass @@ -143,30 +154,34 @@ def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineRe response.headers = headers return response - http_request = http_request('GET', 'http://localhost/') - http_retry = RetryPolicy(retry_total = 1) + http_request = http_request("GET", "http://localhost/") + http_retry = RetryPolicy(retry_total=1) transport = MockTransport() pipeline = Pipeline(transport, [http_retry]) pipeline.run(http_request) assert transport._count == 1 + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_retry_seekable_stream(http_request, http_response): class MockTransport(HttpTransport): def __init__(self): self._first = True + def __exit__(self, exc_type, exc_val, exc_tb): pass + def close(self): pass + def open(self): pass def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineResponse if self._first: self._first = False - request.body.seek(0,2) - raise AzureError('fail on first') + request.body.seek(0, 2) + raise AzureError("fail on first") position = request.body.tell() assert position == 0 response = create_http_response(http_response, request, None) @@ -174,21 +189,25 @@ def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineRe return response data = BytesIO(b"Lots of dataaaa") - http_request = http_request('GET', 'http://localhost/') + http_request = http_request("GET", "http://localhost/") http_request.set_streamed_data_body(data) - http_retry = RetryPolicy(retry_total = 1) + http_retry = RetryPolicy(retry_total=1) pipeline = Pipeline(MockTransport(), [http_retry]) pipeline.run(http_request) + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_retry_seekable_file(http_request, http_response): class MockTransport(HttpTransport): def __init__(self): self._first = True + def __exit__(self, exc_type, exc_val, exc_tb): pass + def close(self): pass + def open(self): pass @@ -197,12 +216,12 @@ def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineRe self._first = False for value in request.files.values(): name, body = value[0], value[1] - if name and body and hasattr(body, 'read'): - body.seek(0,2) - raise AzureError('fail on first') + if name and body and hasattr(body, "read"): + body.seek(0, 2) + raise AzureError("fail on first") for value in request.files.values(): name, body = value[0], value[1] - if name and body and hasattr(body, 'read'): + if name and body and hasattr(body, "read"): position = body.tell() assert not position response = create_http_response(http_response, request, None) @@ -210,15 +229,15 @@ def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineRe return response file = tempfile.NamedTemporaryFile(delete=False) - file.write(b'Lots of dataaaa') + file.write(b"Lots of dataaaa") file.close() - http_request = http_request('GET', 'http://localhost/') - headers = {'Content-Type': "multipart/form-data"} + http_request = http_request("GET", "http://localhost/") + headers = {"Content-Type": "multipart/form-data"} http_request.headers = headers - with open(file.name, 'rb') as f: + with open(file.name, "rb") as f: form_data_content = { - 'fileContent': f, - 'fileName': f.name, + "fileContent": f, + "fileName": f.name, } http_request.set_formdata_body(form_data_content) http_retry = RetryPolicy(retry_total=1) @@ -226,6 +245,7 @@ def send(self, request, **kwargs): # type: (PipelineRequest, Any) -> PipelineRe pipeline.run(http_request) os.unlink(f.name) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_retry_timeout(http_request): timeout = 1 @@ -245,6 +265,7 @@ def send(request, **kwargs): with pytest.raises(ServiceResponseTimeoutError): response = pipeline.run(http_request("GET", "http://localhost/")) + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_timeout_defaults(http_request, http_response): """When "timeout" is not set, the policy should not override the transport's timeout configuration""" @@ -266,8 +287,10 @@ def send(request, **kwargs): pipeline.run(http_request("GET", "http://localhost/")) assert transport.send.call_count == 1, "policy should not retry: its first send succeeded" + combinations = [(ServiceRequestError, ServiceRequestTimeoutError), (ServiceResponseError, ServiceResponseTimeoutError)] + @pytest.mark.parametrize( "combinations,http_request", product(combinations, HTTP_REQUESTS), @@ -275,7 +298,7 @@ def send(request, **kwargs): def test_does_not_sleep_after_timeout(combinations, http_request): # With default settings policy will sleep twice before exhausting its retries: 1.6s, 3.2s. # It should not sleep the second time when given timeout=1 - transport_error,expected_timeout_error = combinations + transport_error, expected_timeout_error = combinations timeout = 1 transport = Mock( diff --git a/sdk/core/azure-core/tests/test_serialization.py b/sdk/core/azure-core/tests/test_serialization.py index 01630132b58c..e76d9e80a86b 100644 --- a/sdk/core/azure-core/tests/test_serialization.py +++ b/sdk/core/azure-core/tests/test_serialization.py @@ -48,26 +48,34 @@ def to_dict(self): class NegativeUtcOffset(tzinfo): """tzinfo class with UTC offset of -12 hours""" + _offset = timedelta(seconds=-43200) _dst = timedelta(0) _name = "-1200" + def utcoffset(self, dt): return self.__class__._offset + def dst(self, dt): return self.__class__._dst + def tzname(self, dt): return self.__class__._name class PositiveUtcOffset(tzinfo): """tzinfo class with UTC offset of +12 hours""" + _offset = timedelta(seconds=43200) _dst = timedelta(0) _name = "+1200" + def utcoffset(self, dt): return self.__class__._offset + def dst(self, dt): return self.__class__._dst + def tzname(self, dt): return self.__class__._name @@ -77,32 +85,39 @@ def test_NULL_is_falsy(): assert bool(NULL) is False assert NULL is NULL + @pytest.fixture def json_dumps_with_encoder(): def func(obj): return json.dumps(obj, cls=AzureJSONEncoder) + return func + def test_bytes(json_dumps_with_encoder): test_bytes = b"mybytes" result = json.loads(json_dumps_with_encoder(test_bytes)) assert base64.b64decode(result) == test_bytes - + + def test_byte_array_ascii(json_dumps_with_encoder): test_byte_array = bytearray("mybytes", "ascii") result = json.loads(json_dumps_with_encoder(test_byte_array)) assert base64.b64decode(result) == test_byte_array + def test_byte_array_utf8(json_dumps_with_encoder): test_byte_array = bytearray("mybytes", "utf-8") result = json.loads(json_dumps_with_encoder(test_byte_array)) assert base64.b64decode(result) == test_byte_array + def test_byte_array_utf16(json_dumps_with_encoder): test_byte_array = bytearray("mybytes", "utf-16") result = json.loads(json_dumps_with_encoder(test_byte_array)) assert base64.b64decode(result) == test_byte_array + def test_dictionary_basic(json_dumps_with_encoder): test_obj = { "string": "myid", @@ -115,6 +130,7 @@ def test_dictionary_basic(json_dumps_with_encoder): assert json.dumps(test_obj) == complex_serialized assert json.loads(complex_serialized) == test_obj + def test_model_basic(json_dumps_with_encoder): class BasicModel(SerializerMixin): def __init__(self): @@ -126,7 +142,7 @@ def __init__(self): self.bytes_data = b"data as bytes" expected = BasicModel() - expected_bytes = "data as bytes" if sys.version_info.major == 2 else "ZGF0YSBhcyBieXRlcw==" # cspell:disable-line + expected_bytes = "data as bytes" if sys.version_info.major == 2 else "ZGF0YSBhcyBieXRlcw==" # cspell:disable-line expected_dict = { "string": "myid", "number": 42, @@ -137,46 +153,49 @@ def __init__(self): } assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict + def test_dictionary_datetime(json_dumps_with_encoder): test_obj = { "timedelta": timedelta(1), "date": date(2021, 5, 12), - "datetime": datetime.strptime('2012-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ"), - "time": time(11,12,13), + "datetime": datetime.strptime("2012-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ"), + "time": time(11, 12, 13), } expected = { "timedelta": "P1DT00H00M00S", "date": "2021-05-12", - "datetime": '2012-02-24T00:53:52.780000Z', - 'time': '11:12:13', + "datetime": "2012-02-24T00:53:52.780000Z", + "time": "11:12:13", } assert json.loads(json_dumps_with_encoder(test_obj)) == expected + def test_model_datetime(json_dumps_with_encoder): class DatetimeModel(SerializerMixin): def __init__(self): self.timedelta = timedelta(1) self.date = date(2021, 5, 12) - self.datetime = datetime.strptime('2012-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ") - self.time = time(11,12,13) + self.datetime = datetime.strptime("2012-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ") + self.time = time(11, 12, 13) expected = DatetimeModel() expected_dict = { "timedelta": "P1DT00H00M00S", "date": "2021-05-12", - "datetime": '2012-02-24T00:53:52.780000Z', - 'time': '11:12:13', + "datetime": "2012-02-24T00:53:52.780000Z", + "time": "11:12:13", } assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict + def test_model_key_vault(json_dumps_with_encoder): class Attributes(SerializerMixin): def __init__(self): self.enabled = True - self.not_before = datetime.strptime('2012-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ") - self.expires = datetime.strptime('2032-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ") - self.created = datetime.strptime('2020-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ") - self.updated = datetime.strptime('2021-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ") + self.not_before = datetime.strptime("2012-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ") + self.expires = datetime.strptime("2032-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ") + self.created = datetime.strptime("2020-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ") + self.updated = datetime.strptime("2021-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ") class ResourceId(SerializerMixin): def __init__(self): @@ -198,7 +217,9 @@ def __init__(self): self._tags = None expected = Properties() - expected_bytes = "thumbprint bytes" if sys.version_info.major == 2 else "dGh1bWJwcmludCBieXRlcw==" # cspell:disable-line + expected_bytes = ( + "thumbprint bytes" if sys.version_info.major == 2 else "dGh1bWJwcmludCBieXRlcw==" + ) # cspell:disable-line expected_dict = { "_attributes": { "enabled": True, @@ -221,14 +242,15 @@ def __init__(self): } assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict + def test_serialize_datetime(json_dumps_with_encoder): - date_obj = datetime.strptime('2015-01-01T00:00:00', "%Y-%m-%dT%H:%M:%S") + date_obj = datetime.strptime("2015-01-01T00:00:00", "%Y-%m-%dT%H:%M:%S") date_str = json_dumps_with_encoder(date_obj) assert date_str == '"2015-01-01T00:00:00Z"' - date_obj = datetime.strptime('1999-12-31T23:59:59', "%Y-%m-%dT%H:%M:%S").replace(tzinfo=NegativeUtcOffset()) + date_obj = datetime.strptime("1999-12-31T23:59:59", "%Y-%m-%dT%H:%M:%S").replace(tzinfo=NegativeUtcOffset()) date_str = json_dumps_with_encoder(date_obj) assert date_str == '"2000-01-01T11:59:59Z"' @@ -246,44 +268,49 @@ def test_serialize_datetime(json_dumps_with_encoder): date_str = json_dumps_with_encoder(date_obj) assert date_str == '"9999-12-31T23:59:59.999999Z"' - date_obj = datetime.strptime('2012-02-24T00:53:52.000001Z', "%Y-%m-%dT%H:%M:%S.%fZ") + date_obj = datetime.strptime("2012-02-24T00:53:52.000001Z", "%Y-%m-%dT%H:%M:%S.%fZ") date_str = json_dumps_with_encoder(date_obj) assert date_str == '"2012-02-24T00:53:52.000001Z"' - date_obj = datetime.strptime('2012-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ") + date_obj = datetime.strptime("2012-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ") date_str = json_dumps_with_encoder(date_obj) assert date_str == '"2012-02-24T00:53:52.780000Z"' + def test_serialize_datetime_subclass(json_dumps_with_encoder): - date_obj = DatetimeSubclass.strptime('2012-02-24T00:53:52.780Z', "%Y-%m-%dT%H:%M:%S.%fZ") + date_obj = DatetimeSubclass.strptime("2012-02-24T00:53:52.780Z", "%Y-%m-%dT%H:%M:%S.%fZ") date_str = json_dumps_with_encoder(date_obj) assert date_str == '"2012-02-24T00:53:52.780000Z"' + def test_serialize_time(json_dumps_with_encoder): - time_str = json_dumps_with_encoder(time(11,22,33)) + time_str = json_dumps_with_encoder(time(11, 22, 33)) assert time_str == '"11:22:33"' - time_str = json_dumps_with_encoder(time(11,22,33,444444)) + time_str = json_dumps_with_encoder(time(11, 22, 33, 444444)) assert time_str == '"11:22:33.444444"' + class BasicEnum(Enum): val = "Basic" + class StringEnum(str, Enum): val = "string" + class IntEnum(int, Enum): val = 1 + class FloatEnum(float, Enum): val = 1.5 + def test_dictionary_enum(json_dumps_with_encoder): - test_obj = { - "basic": BasicEnum.val - } + test_obj = {"basic": BasicEnum.val} with pytest.raises(TypeError): json_dumps_with_encoder(test_obj) @@ -291,18 +318,14 @@ def test_dictionary_enum(json_dumps_with_encoder): "basic": BasicEnum.val.value, "string": StringEnum.val.value, "int": IntEnum.val.value, - "float": FloatEnum.val.value - } - expected = { - "basic": "Basic", - "string": "string", - "int": 1, - "float": 1.5 + "float": FloatEnum.val.value, } + expected = {"basic": "Basic", "string": "string", "int": 1, "float": 1.5} serialized = json_dumps_with_encoder(test_obj) assert json.dumps(test_obj) == serialized assert json.loads(serialized) == expected + def test_model_enum(json_dumps_with_encoder): class BasicEnumModel: def __init__(self): @@ -319,21 +342,16 @@ def __init__(self): self.float = FloatEnum.val expected = EnumModel() - expected_dict = { - "basic": "Basic", - "string": "string", - "int": 1, - "float": 1.5 - } + expected_dict = {"basic": "Basic", "string": "string", "int": 1, "float": 1.5} assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict + def test_dictionary_none(json_dumps_with_encoder): assert json_dumps_with_encoder(None) == json.dumps(None) - test_obj = { - "entry": None - } + test_obj = {"entry": None} assert json.loads(json_dumps_with_encoder(test_obj)) == test_obj + def test_model_none(json_dumps_with_encoder): class NoneModel(SerializerMixin): def __init__(self): @@ -343,6 +361,7 @@ def __init__(self): expected_dict = {"entry": None} assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict + def test_dictionary_empty_collections(json_dumps_with_encoder): test_obj = { "dictionary": {}, @@ -352,6 +371,7 @@ def test_dictionary_empty_collections(json_dumps_with_encoder): assert json.dumps(test_obj) == json_dumps_with_encoder(test_obj) assert json.loads(json_dumps_with_encoder(test_obj)) == test_obj + def test_model_empty_collections(json_dumps_with_encoder): class EmptyCollectionsModel(SerializerMixin): def __init__(self): @@ -365,6 +385,7 @@ def __init__(self): } assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict + def test_model_inheritance(json_dumps_with_encoder): class ParentModel(SerializerMixin): def __init__(self): @@ -382,6 +403,7 @@ def __init__(self): } assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict + def test_model_recursion(json_dumps_with_encoder): class RecursiveModel(SerializerMixin): def __init__(self): @@ -404,7 +426,7 @@ def __init__(self): "list_of_me": None, "dict_of_me": None, "dict_of_list_of_me": None, - "list_of_dict_of_me": None + "list_of_dict_of_me": None, } ], "dict_of_me": { @@ -413,7 +435,7 @@ def __init__(self): "list_of_me": None, "dict_of_me": None, "dict_of_list_of_me": None, - "list_of_dict_of_me": None + "list_of_dict_of_me": None, } }, "dict_of_list_of_me": { @@ -423,19 +445,20 @@ def __init__(self): "list_of_me": None, "dict_of_me": None, "dict_of_list_of_me": None, - "list_of_dict_of_me": None + "list_of_dict_of_me": None, } ] }, "list_of_dict_of_me": [ - {"me": { + { + "me": { "name": "it's me!", "list_of_me": None, "dict_of_me": None, "dict_of_list_of_me": None, - "list_of_dict_of_me": None + "list_of_dict_of_me": None, } } - ] + ], } assert json.loads(json_dumps_with_encoder(expected.to_dict())) == expected_dict diff --git a/sdk/core/azure-core/tests/test_settings.py b/sdk/core/azure-core/tests/test_settings.py index fd228cbcae08..368094f3bc35 100644 --- a/sdk/core/azure-core/tests/test_settings.py +++ b/sdk/core/azure-core/tests/test_settings.py @@ -204,16 +204,12 @@ def test_config(self): def test_defaults(self): val = m.settings.defaults # assert isinstance(val, tuple) - defaults = m.settings.config( - log_level=20, tracing_enabled=False, tracing_implementation=None - ) + defaults = m.settings.config(log_level=20, tracing_enabled=False, tracing_implementation=None) assert val.log_level == defaults.log_level assert val.tracing_enabled == defaults.tracing_enabled assert val.tracing_implementation == defaults.tracing_implementation os.environ["AZURE_LOG_LEVEL"] = "debug" - defaults = m.settings.config( - log_level=20, tracing_enabled=False, tracing_implementation=None - ) + defaults = m.settings.config(log_level=20, tracing_enabled=False, tracing_implementation=None) assert val.log_level == defaults.log_level assert val.tracing_enabled == defaults.tracing_enabled assert val.tracing_implementation == defaults.tracing_implementation diff --git a/sdk/core/azure-core/tests/test_stream_generator.py b/sdk/core/azure-core/tests/test_stream_generator.py index d572a154d936..eeacb47f077c 100644 --- a/sdk/core/azure-core/tests/test_stream_generator.py +++ b/sdk/core/azure-core/tests/test_stream_generator.py @@ -9,12 +9,20 @@ ) from azure.core.pipeline import Pipeline, PipelineResponse from azure.core.pipeline.transport._requests_basic import StreamDownloadGenerator + try: from unittest import mock except ImportError: import mock import pytest -from utils import HTTP_RESPONSES, REQUESTS_TRANSPORT_RESPONSES, create_http_response, create_transport_response, request_and_responses_product +from utils import ( + HTTP_RESPONSES, + REQUESTS_TRANSPORT_RESPONSES, + create_http_response, + create_transport_response, + request_and_responses_product, +) + @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_connection_error_response(http_request, http_response): @@ -24,13 +32,15 @@ def __init__(self): def __exit__(self, exc_type, exc_val, exc_tb): pass + def close(self): pass + def open(self): pass def send(self, request, **kwargs): - request = http_request('GET', 'http://localhost/') + request = http_request("GET", "http://localhost/") response = create_http_response(http_response, request, None) response.status_code = 200 return response @@ -50,22 +60,23 @@ def stream(self, chunk_size, decode_content=False): while True: yield b"test" - class MockInternalResponse(): + class MockInternalResponse: def __init__(self): self.raw = MockTransport() def close(self): pass - http_request = http_request('GET', 'http://localhost/') + http_request = http_request("GET", "http://localhost/") pipeline = Pipeline(MockTransport()) http_response = create_http_response(http_response, http_request, None) http_response.internal_response = MockInternalResponse() stream = StreamDownloadGenerator(pipeline, http_response, decompress=False) - with mock.patch('time.sleep', return_value=None): + with mock.patch("time.sleep", return_value=None): with pytest.raises(requests.exceptions.ConnectionError): stream.__next__() + @pytest.mark.parametrize("http_response", REQUESTS_TRANSPORT_RESPONSES) def test_response_streaming_error_behavior(http_response): # Test to reproduce https://github.com/Azure/azure-sdk-for-python/issues/16723 diff --git a/sdk/core/azure-core/tests/test_streaming.py b/sdk/core/azure-core/tests/test_streaming.py index 25a08e1bf3b2..3ce3099fedda 100644 --- a/sdk/core/azure-core/tests/test_streaming.py +++ b/sdk/core/azure-core/tests/test_streaming.py @@ -30,6 +30,7 @@ from azure.core.pipeline.transport import RequestsTransport from utils import HTTP_REQUESTS + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decompress_plain_no_header(http_request): # expect plain text @@ -42,9 +43,10 @@ def test_decompress_plain_no_header(http_request): response = pipeline_response.http_response data = response.stream_download(client._pipeline, decompress=True) content = b"".join(list(data)) - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_compress_plain_no_header_offline(port, http_request): # cspell:disable-next-line @@ -56,9 +58,10 @@ def test_compress_plain_no_header_offline(port, http_request): response.raise_for_status() data = response.stream_download(sender, decompress=False) content = b"".join(list(data)) - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.live_test_only @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_compress_plain_no_header(http_request): @@ -72,9 +75,10 @@ def test_compress_plain_no_header(http_request): response = pipeline_response.http_response data = response.stream_download(client._pipeline, decompress=False) content = b"".join(list(data)) - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decompress_compressed_no_header(http_request): # expect compressed text @@ -88,11 +92,12 @@ def test_decompress_compressed_no_header(http_request): data = response.stream_download(client._pipeline, decompress=True) content = b"".join(list(data)) try: - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert False except UnicodeDecodeError: pass + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_compress_compressed_no_header_offline(port, http_request): # expect compressed text @@ -103,7 +108,8 @@ def test_compress_compressed_no_header_offline(port, http_request): data = response.stream_download(client._pipeline, decompress=False) content = b"".join(list(data)) with pytest.raises(UnicodeDecodeError): - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") + @pytest.mark.live_test_only @pytest.mark.parametrize("http_request", HTTP_REQUESTS) @@ -119,11 +125,12 @@ def test_compress_compressed_no_header(http_request): data = response.stream_download(client._pipeline, decompress=False) content = b"".join(list(data)) try: - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert False except UnicodeDecodeError: pass + @pytest.mark.live_test_only @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decompress_plain_header(http_request): @@ -139,6 +146,7 @@ def test_decompress_plain_header(http_request): with pytest.raises(DecodeError): list(data) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decompress_plain_header_offline(port, http_request): request = http_request(method="GET", url="http://localhost:{}/streams/compressed".format(port)) @@ -149,6 +157,7 @@ def test_decompress_plain_header_offline(port, http_request): with pytest.raises(DecodeError): list(data) + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_compress_plain_header(http_request): # expect plain text @@ -161,9 +170,10 @@ def test_compress_plain_header(http_request): response = pipeline_response.http_response data = response.stream_download(client._pipeline, decompress=False) content = b"".join(list(data)) - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.live_test_only @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decompress_compressed_header(http_request): @@ -177,9 +187,10 @@ def test_decompress_compressed_header(http_request): response = pipeline_response.http_response data = response.stream_download(client._pipeline, decompress=True) content = b"".join(list(data)) - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decompress_compressed_header_offline(port, http_request): client = PipelineClient("") @@ -189,9 +200,10 @@ def test_decompress_compressed_header_offline(port, http_request): response.raise_for_status() data = response.stream_download(sender, decompress=True) content = b"".join(list(data)) - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert decoded == "test" + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_compress_compressed_header(http_request): # expect compressed text @@ -205,7 +217,7 @@ def test_compress_compressed_header(http_request): data = response.stream_download(client._pipeline, decompress=False) content = b"".join(list(data)) try: - decoded = content.decode('utf-8') + decoded = content.decode("utf-8") assert False except UnicodeDecodeError: pass diff --git a/sdk/core/azure-core/tests/test_testserver.py b/sdk/core/azure-core/tests/test_testserver.py index 544778e32a79..507c08ae1156 100644 --- a/sdk/core/azure-core/tests/test_testserver.py +++ b/sdk/core/azure-core/tests/test_testserver.py @@ -26,8 +26,10 @@ from azure.core.pipeline.transport import RequestsTransport from utils import HTTP_REQUESTS import pytest + """This file does a simple call to the testserver to make sure we can use the testserver""" + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_smoke(port, http_request): request = http_request(method="GET", url="http://localhost:{}/basic/string".format(port)) diff --git a/sdk/core/azure-core/tests/test_tracing_decorator.py b/sdk/core/azure-core/tests/test_tracing_decorator.py index 5cabf2f247a4..4ee7ee621d96 100644 --- a/sdk/core/azure-core/tests/test_tracing_decorator.py +++ b/sdk/core/azure-core/tests/test_tracing_decorator.py @@ -21,6 +21,7 @@ from tracing_common import FakeSpan from utils import HTTP_REQUESTS + @pytest.fixture(scope="module") def fake_span(): settings.tracing_implementation.set_value(FakeSpan) @@ -53,7 +54,7 @@ def make_request(self, numb_times, **kwargs): return None response = self.pipeline.run(self.request, **kwargs) self.get_foo(merge_span=True) - kwargs['merge_span'] = True + kwargs["merge_span"] = True self.make_request(numb_times - 1, **kwargs) return response @@ -74,7 +75,7 @@ def get_foo(self): def check_name_is_different(self): time.sleep(0.001) - @distributed_trace(tracing_attributes={'foo': 'bar'}) + @distributed_trace(tracing_attributes={"foo": "bar"}) def tracing_attr(self): time.sleep(0.001) @@ -100,7 +101,6 @@ def test_get_function_and_class_name(http_request): @pytest.mark.usefixtures("fake_span") class TestDecorator(object): - @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decorator_tracing_attr(self, http_request): with FakeSpan(name="parent") as parent: @@ -111,7 +111,7 @@ def test_decorator_tracing_attr(self, http_request): assert parent.children[0].name == "MockClient.__init__" assert parent.children[1].name == "MockClient.tracing_attr" assert parent.children[1].kind == SpanKind.INTERNAL - assert parent.children[1].attributes == {'foo': 'bar'} + assert parent.children[1].attributes == {"foo": "bar"} @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_decorator_has_different_name(self, http_request): @@ -188,8 +188,7 @@ def test_span_complicated(self, http_request): @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_span_with_exception(self, http_request): - """Assert that if an exception is raised, the next sibling method is actually a sibling span. - """ + """Assert that if an exception is raised, the next sibling method is actually a sibling span.""" with FakeSpan(name="parent") as parent: client = MockClient(http_request) try: @@ -202,5 +201,5 @@ def test_span_with_exception(self, http_request): assert parent.children[0].name == "MockClient.__init__" assert parent.children[1].name == "MockClient.raising_exception" # Exception should propagate status for Opencensus - assert parent.children[1].status == 'Something went horribly wrong here' + assert parent.children[1].status == "Something went horribly wrong here" assert parent.children[2].name == "MockClient.get_foo" diff --git a/sdk/core/azure-core/tests/test_tracing_policy.py b/sdk/core/azure-core/tests/test_tracing_policy.py index b65dd893687f..4012b028be1a 100644 --- a/sdk/core/azure-core/tests/test_tracing_policy.py +++ b/sdk/core/azure-core/tests/test_tracing_policy.py @@ -37,7 +37,7 @@ def test_distributed_tracing_policy_solo(http_request, http_response): response.status_code = 202 response.headers["x-ms-request-id"] = "some request id" - assert request.headers.get("traceparent") == '123456789' + assert request.headers.get("traceparent") == "123456789" policy.on_response(pipeline_request, PipelineResponse(request, response, PipelineContext(None))) time.sleep(0.001) @@ -75,9 +75,7 @@ def test_distributed_tracing_policy_attributes(http_request, http_response): """Test policy with no other policy and happy path""" settings.tracing_implementation.set_value(FakeSpan) with FakeSpan(name="parent") as root_span: - policy = DistributedTracingPolicy(tracing_attributes={ - 'myattr': 'myvalue' - }) + policy = DistributedTracingPolicy(tracing_attributes={"myattr": "myvalue"}) request = http_request("GET", "http://localhost/temp?query=query") @@ -133,7 +131,7 @@ def test_distributed_tracing_policy_badurl(caplog, http_request, http_response): def test_distributed_tracing_policy_with_user_agent(http_request, http_response): """Test policy working with user agent.""" settings.tracing_implementation.set_value(FakeSpan) - with mock.patch.dict('os.environ', {"AZURE_HTTP_USER_AGENT": "mytools"}): + with mock.patch.dict("os.environ", {"AZURE_HTTP_USER_AGENT": "mytools"}): with FakeSpan(name="parent") as root_span: policy = DistributedTracingPolicy() @@ -152,7 +150,7 @@ def test_distributed_tracing_policy_with_user_agent(http_request, http_response) response.headers["x-ms-request-id"] = "some request id" pipeline_response = PipelineResponse(request, response, PipelineContext(None)) - assert request.headers.get("traceparent") == '123456789' + assert request.headers.get("traceparent") == "123456789" policy.on_response(pipeline_request, pipeline_response) @@ -185,7 +183,7 @@ def test_distributed_tracing_policy_with_user_agent(http_request, http_response) assert network_span.attributes.get("x-ms-request-id") is None assert network_span.attributes.get("http.status_code") == 504 # Exception should propagate status for Opencensus - assert network_span.status == 'Transport trouble' + assert network_span.status == "Transport trouble" @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) @@ -214,7 +212,7 @@ def operation_namer(http_request): assert http_request is request return "operation level name" - pipeline_request.context.options['network_span_namer'] = operation_namer + pipeline_request.context.options["network_span_namer"] = operation_namer policy.on_request(pipeline_request) diff --git a/sdk/core/azure-core/tests/test_universal_pipeline.py b/sdk/core/azure-core/tests/test_universal_pipeline.py index 14df6fcf6eb1..dfc3477afe24 100644 --- a/sdk/core/azure-core/tests/test_universal_pipeline.py +++ b/sdk/core/azure-core/tests/test_universal_pipeline.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -23,9 +23,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import logging import pickle + try: from unittest import mock except ImportError: @@ -35,12 +36,7 @@ import pytest from azure.core.exceptions import DecodeError, AzureError -from azure.core.pipeline import ( - Pipeline, - PipelineResponse, - PipelineRequest, - PipelineContext -) +from azure.core.pipeline import Pipeline, PipelineResponse, PipelineRequest, PipelineContext from azure.core.pipeline.policies import ( NetworkTraceLoggingPolicy, @@ -49,20 +45,26 @@ RetryPolicy, HTTPPolicy, ) -from utils import HTTP_REQUESTS, create_http_request, HTTP_RESPONSES, REQUESTS_TRANSPORT_RESPONSES, create_http_response, create_transport_response, request_and_responses_product +from utils import ( + HTTP_REQUESTS, + create_http_request, + HTTP_RESPONSES, + REQUESTS_TRANSPORT_RESPONSES, + create_http_response, + create_transport_response, + request_and_responses_product, +) from azure.core.pipeline._tools import is_rest + def test_pipeline_context(): - kwargs={ - 'stream':True, - 'cont_token':"bla" - } - context = PipelineContext('transport', **kwargs) - context['foo'] = 'bar' - context['xyz'] = '123' - context['deserialized_data'] = 'marvelous' - - assert context['foo'] == 'bar' + kwargs = {"stream": True, "cont_token": "bla"} + context = PipelineContext("transport", **kwargs) + context["foo"] = "bar" + context["xyz"] = "123" + context["deserialized_data"] = "marvelous" + + assert context["foo"] == "bar" assert context.options == kwargs with pytest.raises(TypeError): @@ -71,15 +73,15 @@ def test_pipeline_context(): with pytest.raises(TypeError): context.update({}) - assert context.pop('foo') == 'bar' - assert 'foo' not in context + assert context.pop("foo") == "bar" + assert "foo" not in context serialized = pickle.dumps(context) revived_context = pickle.loads(serialized) # nosec assert revived_context.options == kwargs assert revived_context.transport is None - assert 'deserialized_data' in revived_context + assert "deserialized_data" in revived_context assert len(revived_context) == 1 @@ -90,13 +92,14 @@ def __deepcopy__(self, memodict={}): raise ValueError() body = Non_deep_copyable() - request = create_http_request(http_request, 'GET', 'http://localhost/', {'user-agent': 'test_request_history'}) + request = create_http_request(http_request, "GET", "http://localhost/", {"user-agent": "test_request_history"}) request.body = body request_history = RequestHistory(request) assert request_history.http_request.headers == request.headers assert request_history.http_request.url == request.url assert request_history.http_request.method == request.method + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_request_history_type_error(http_request): class Non_deep_copyable(object): @@ -104,17 +107,18 @@ def __deepcopy__(self, memodict={}): raise TypeError() body = Non_deep_copyable() - request = create_http_request(http_request, 'GET', 'http://localhost/', {'user-agent': 'test_request_history'}) + request = create_http_request(http_request, "GET", "http://localhost/", {"user-agent": "test_request_history"}) request.body = body request_history = RequestHistory(request) assert request_history.http_request.headers == request.headers assert request_history.http_request.url == request.url assert request_history.http_request.method == request.method -@mock.patch('azure.core.pipeline.policies._universal._LOGGER') + +@mock.patch("azure.core.pipeline.policies._universal._LOGGER") @pytest.mark.parametrize("http_request,http_response", request_and_responses_product(HTTP_RESPONSES)) def test_no_log(mock_http_logger, http_request, http_response): - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") request = PipelineRequest(universal_request, PipelineContext(None)) http_logger = NetworkTraceLoggingPolicy() response = PipelineResponse(request, create_http_response(http_response, universal_request, None), request.context) @@ -127,20 +131,20 @@ def test_no_log(mock_http_logger, http_request, http_response): mock_http_logger.reset_mock() # I can enable it per request - request.context.options['logging_enable'] = True + request.context.options["logging_enable"] = True http_logger.on_request(request) assert mock_http_logger.debug.call_count >= 1 mock_http_logger.reset_mock() - request.context.options['logging_enable'] = True + request.context.options["logging_enable"] = True http_logger.on_response(request, response) assert mock_http_logger.debug.call_count >= 1 mock_http_logger.reset_mock() # I can enable it per request (bool value should be honored) - request.context.options['logging_enable'] = False + request.context.options["logging_enable"] = False http_logger.on_request(request) mock_http_logger.debug.assert_not_called() - request.context.options['logging_enable'] = False + request.context.options["logging_enable"] = False http_logger.on_response(request, response) mock_http_logger.debug.assert_not_called() mock_http_logger.reset_mock() @@ -156,16 +160,16 @@ def test_no_log(mock_http_logger, http_request, http_response): # I can enable it globally and override it locally http_logger.enable_http_logger = True - request.context.options['logging_enable'] = False + request.context.options["logging_enable"] = False http_logger.on_request(request) mock_http_logger.debug.assert_not_called() - response.context['logging_enable'] = False + response.context["logging_enable"] = False http_logger.on_response(request, response) mock_http_logger.debug.assert_not_called() mock_http_logger.reset_mock() # Let's make this request a failure, retried twice - request.context.options['logging_enable'] = True + request.context.options["logging_enable"] = True http_logger.on_request(request) http_logger.on_response(request, response) @@ -178,26 +182,32 @@ def test_no_log(mock_http_logger, http_request, http_response): second_count = mock_http_logger.debug.call_count assert second_count == first_count * 2 + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_retry_without_http_response(http_request): class NaughtyPolicy(HTTPPolicy): def send(*args): - raise AzureError('boo') + raise AzureError("boo") policies = [RetryPolicy(), NaughtyPolicy()] pipeline = Pipeline(policies=policies, transport=None) with pytest.raises(AzureError): - pipeline.run(http_request('GET', url='https://foo.bar')) + pipeline.run(http_request("GET", url="https://foo.bar")) + -@pytest.mark.parametrize("http_request,http_response,requests_transport_response", request_and_responses_product(HTTP_RESPONSES, REQUESTS_TRANSPORT_RESPONSES)) +@pytest.mark.parametrize( + "http_request,http_response,requests_transport_response", + request_and_responses_product(HTTP_RESPONSES, REQUESTS_TRANSPORT_RESPONSES), +) def test_raw_deserializer(http_request, http_response, requests_transport_response): raw_deserializer = ContentDecodePolicy() context = PipelineContext(None, stream=False) - universal_request = http_request('GET', 'http://localhost/') + universal_request = http_request("GET", "http://localhost/") request = PipelineRequest(universal_request, context) def build_response(body, content_type=None): if is_rest(http_response): + class MockResponse(http_response): def __init__(self, body, content_type): super(MockResponse, self).__init__( @@ -220,6 +230,7 @@ def read(self): return self.content else: + class MockResponse(http_response): def __init__(self, body, content_type): super(MockResponse, self).__init__(None, None) @@ -242,10 +253,10 @@ def body(self): assert result.tag == "utf8groot" # The basic deserializer works with unicode XML - response = build_response(u''.encode('utf-8'), content_type="application/xml") + response = build_response(''.encode("utf-8"), content_type="application/xml") raw_deserializer.on_response(request, response) result = response.context["deserialized_data"] - assert result.attrib["language"] == u"français" + assert result.attrib["language"] == "français" # Catch some weird situation where content_type is XML, but content is JSON response = build_response(b'{"ugly": true}', content_type="application/xml") @@ -254,12 +265,12 @@ def body(self): assert result["ugly"] is True # Be sure I catch the correct exception if it's neither XML nor JSON - response = build_response(b'gibberish', content_type="application/xml") + response = build_response(b"gibberish", content_type="application/xml") with pytest.raises(DecodeError) as err: raw_deserializer.on_response(request, response) assert err.value.response is response.http_response - response = build_response(b'{{gibberish}}', content_type="application/xml") + response = build_response(b"{{gibberish}}", content_type="application/xml") with pytest.raises(DecodeError) as err: raw_deserializer.on_response(request, response) assert err.value.response is response.http_response @@ -295,13 +306,13 @@ def body(self): assert result == "data" # Let text/plain let through - response = build_response(b'I am groot', content_type="text/plain") + response = build_response(b"I am groot", content_type="text/plain") raw_deserializer.on_response(request, response) result = response.context["deserialized_data"] assert result == "I am groot" # Let text/plain let through + BOM - response = build_response(b'\xef\xbb\xbfI am groot', content_type="text/plain") + response = build_response(b"\xef\xbb\xbfI am groot", content_type="text/plain") raw_deserializer.on_response(request, response) result = response.context["deserialized_data"] assert result == "I am groot" @@ -312,44 +323,52 @@ def body(self): req_response.headers["content-type"] = "application/json" req_response._content = b'{"success": true}' req_response._content_consumed = True - response = PipelineResponse(None, create_transport_response(requests_transport_response, None, req_response), PipelineContext(None, stream=False)) + response = PipelineResponse( + None, + create_transport_response(requests_transport_response, None, req_response), + PipelineContext(None, stream=False), + ) raw_deserializer.on_response(request, response) result = response.context["deserialized_data"] assert result["success"] is True # I can enable it per request - request.context.options['response_encoding'] = 'utf-8' - response = build_response(b'\xc3\xa9', content_type="text/plain") + request.context.options["response_encoding"] = "utf-8" + response = build_response(b"\xc3\xa9", content_type="text/plain") raw_deserializer.on_request(request) raw_deserializer.on_response(request, response) result = response.context["deserialized_data"] - assert result == u"é" + assert result == "é" assert response.context["response_encoding"] == "utf-8" - del request.context['response_encoding'] + del request.context["response_encoding"] # I can enable it globally raw_deserializer = ContentDecodePolicy(response_encoding="utf-8") - response = build_response(b'\xc3\xa9', content_type="text/plain") + response = build_response(b"\xc3\xa9", content_type="text/plain") raw_deserializer.on_request(request) raw_deserializer.on_response(request, response) result = response.context["deserialized_data"] - assert result == u"é" + assert result == "é" assert response.context["response_encoding"] == "utf-8" - del request.context['response_encoding'] + del request.context["response_encoding"] # Per request is more important - request.context.options['response_encoding'] = 'utf-8-sig' - response = build_response(b'\xc3\xa9', content_type="text/plain") + request.context.options["response_encoding"] = "utf-8-sig" + response = build_response(b"\xc3\xa9", content_type="text/plain") raw_deserializer.on_request(request) raw_deserializer.on_response(request, response) result = response.context["deserialized_data"] - assert result == u"é" + assert result == "é" assert response.context["response_encoding"] == "utf-8-sig" - del request.context['response_encoding'] + del request.context["response_encoding"] + def test_json_merge_patch(): - assert ContentDecodePolicy.deserialize_from_text('{"hello": "world"}', mime_type="application/merge-patch+json") == {"hello": "world"} + assert ContentDecodePolicy.deserialize_from_text( + '{"hello": "world"}', mime_type="application/merge-patch+json" + ) == {"hello": "world"} + def test_json_regex(): assert not ContentDecodePolicy.JSON_REGEXP.match("text/plain") diff --git a/sdk/core/azure-core/tests/test_user_agent_policy.py b/sdk/core/azure-core/tests/test_user_agent_policy.py index afed968f149f..f4121d7eeffa 100644 --- a/sdk/core/azure-core/tests/test_user_agent_policy.py +++ b/sdk/core/azure-core/tests/test_user_agent_policy.py @@ -5,6 +5,7 @@ """Tests for the user agent policy.""" from azure.core.pipeline.policies import UserAgentPolicy from azure.core.pipeline import PipelineRequest, PipelineContext + try: from unittest import mock except ImportError: @@ -12,32 +13,33 @@ import pytest from utils import HTTP_REQUESTS + @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_user_agent_policy(http_request): - user_agent = UserAgentPolicy(base_user_agent='foo') - assert user_agent._user_agent == 'foo' + user_agent = UserAgentPolicy(base_user_agent="foo") + assert user_agent._user_agent == "foo" - user_agent = UserAgentPolicy(sdk_moniker='foosdk/1.0.0') - assert user_agent._user_agent.startswith('azsdk-python-foosdk/1.0.0 Python') + user_agent = UserAgentPolicy(sdk_moniker="foosdk/1.0.0") + assert user_agent._user_agent.startswith("azsdk-python-foosdk/1.0.0 Python") - user_agent = UserAgentPolicy(base_user_agent='foo', user_agent='bar', user_agent_use_env=False) - assert user_agent._user_agent == 'bar foo' + user_agent = UserAgentPolicy(base_user_agent="foo", user_agent="bar", user_agent_use_env=False) + assert user_agent._user_agent == "bar foo" - request = http_request('GET', 'http://localhost/') + request = http_request("GET", "http://localhost/") pipeline_request = PipelineRequest(request, PipelineContext(None)) - pipeline_request.context.options['user_agent'] = 'xyz' + pipeline_request.context.options["user_agent"] = "xyz" user_agent.on_request(pipeline_request) - assert request.headers['User-Agent'] == 'xyz bar foo' + assert request.headers["User-Agent"] == "xyz bar foo" @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_user_agent_environ(http_request): - with mock.patch.dict('os.environ', {'AZURE_HTTP_USER_AGENT': "mytools"}): + with mock.patch.dict("os.environ", {"AZURE_HTTP_USER_AGENT": "mytools"}): policy = UserAgentPolicy(None) assert policy.user_agent.endswith("mytools") - request = http_request('GET', 'http://localhost/') + request = http_request("GET", "http://localhost/") policy.on_request(PipelineRequest(request, PipelineContext(None))) assert request.headers["user-agent"].endswith("mytools") diff --git a/sdk/core/azure-core/tests/test_utils.py b/sdk/core/azure-core/tests/test_utils.py index f7406e0f5488..55d2d485a10b 100644 --- a/sdk/core/azure-core/tests/test_utils.py +++ b/sdk/core/azure-core/tests/test_utils.py @@ -5,80 +5,94 @@ import pytest from azure.core.utils import case_insensitive_dict + @pytest.fixture() def accept_cases(): return ["accept", "Accept", "ACCEPT", "aCCePT"] + def test_case_insensitive_dict_basic(accept_cases): my_dict = case_insensitive_dict({"accept": "application/json"}) for accept_case in accept_cases: assert my_dict[accept_case] == "application/json" + def test_case_insensitive_dict_override(accept_cases): for accept_case in accept_cases: my_dict = case_insensitive_dict({accept_case: "should-not/be-me"}) my_dict["accept"] = "application/json" assert my_dict[accept_case] == my_dict["accept"] == "application/json" + def test_case_insensitive_dict_initialization(): - dict_response = { - "platformUpdateDomainCount": 5, - "platformFaultDomainCount": 3, - "virtualMachines": [] - } + dict_response = {"platformUpdateDomainCount": 5, "platformFaultDomainCount": 3, "virtualMachines": []} a = case_insensitive_dict(platformUpdateDomainCount=5, platformFaultDomainCount=3, virtualMachines=[]) - b = case_insensitive_dict(zip(['platformUpdateDomainCount', 'platformFaultDomainCount', 'virtualMachines'], [5, 3, []])) - c = case_insensitive_dict([('platformFaultDomainCount', 3), ('platformUpdateDomainCount', 5), ('virtualMachines', [])]) - d = case_insensitive_dict({'virtualMachines': [], 'platformFaultDomainCount': 3, 'platformUpdateDomainCount': 5}) - e = case_insensitive_dict({'platformFaultDomainCount': 3, 'virtualMachines': []}, platformUpdateDomainCount=5) + b = case_insensitive_dict( + zip(["platformUpdateDomainCount", "platformFaultDomainCount", "virtualMachines"], [5, 3, []]) + ) + c = case_insensitive_dict( + [("platformFaultDomainCount", 3), ("platformUpdateDomainCount", 5), ("virtualMachines", [])] + ) + d = case_insensitive_dict({"virtualMachines": [], "platformFaultDomainCount": 3, "platformUpdateDomainCount": 5}) + e = case_insensitive_dict({"platformFaultDomainCount": 3, "virtualMachines": []}, platformUpdateDomainCount=5) f = case_insensitive_dict(dict_response) g = case_insensitive_dict(**dict_response) assert a == b == c == d == e == f == g dicts = [a, b, c, d, e, f, g] for d in dicts: assert len(d) == 3 - assert d['platformUpdateDomainCount'] == d['platformupdatedomaincount'] == d['PLATFORMUPDATEDOMAINCOUNT'] == 5 - assert d['platformFaultDomainCount'] == d['platformfaultdomaincount'] == d['PLATFORMFAULTDOMAINCOUNT'] == 3 - assert d['virtualMachines'] == d['virtualmachines'] == d['VIRTUALMACHINES'] == [] + assert d["platformUpdateDomainCount"] == d["platformupdatedomaincount"] == d["PLATFORMUPDATEDOMAINCOUNT"] == 5 + assert d["platformFaultDomainCount"] == d["platformfaultdomaincount"] == d["PLATFORMFAULTDOMAINCOUNT"] == 3 + assert d["virtualMachines"] == d["virtualmachines"] == d["VIRTUALMACHINES"] == [] + def test_case_insensitive_dict_cant_compare(): my_dict = case_insensitive_dict({"accept": "application/json"}) assert my_dict != "accept" + def test_case_insensitive_dict_lowerkey_items(): my_dict = case_insensitive_dict({"accept": "application/json"}) - assert list(my_dict.lowerkey_items()) == [("accept","application/json")] + assert list(my_dict.lowerkey_items()) == [("accept", "application/json")] + -@pytest.mark.parametrize("other, expected", ( - ({"PLATFORMUPDATEDOMAINCOUNT": 5}, True), - ({}, False), - (None, False), -)) +@pytest.mark.parametrize( + "other, expected", + ( + ({"PLATFORMUPDATEDOMAINCOUNT": 5}, True), + ({}, False), + (None, False), + ), +) def test_case_insensitive_dict_equality(other, expected): my_dict = case_insensitive_dict({"platformUpdateDomainCount": 5}) result = my_dict == other assert result == expected + def test_case_insensitive_dict_keys(): keys = ["One", "TWO", "tHrEe", "four"] - my_dict = case_insensitive_dict({key:idx for idx, key in enumerate(keys,1)}) + my_dict = case_insensitive_dict({key: idx for idx, key in enumerate(keys, 1)}) dict_keys = list(my_dict.keys()) assert dict_keys == keys + def test_case_insensitive_copy(): keys = ["One", "TWO", "tHrEe", "four"] - my_dict = case_insensitive_dict({key:idx for idx, key in enumerate(keys, 1)}) + my_dict = case_insensitive_dict({key: idx for idx, key in enumerate(keys, 1)}) copy_my_dict = my_dict.copy() assert copy_my_dict is not my_dict assert copy_my_dict == my_dict + def test_case_insensitive_keys_present(accept_cases): my_dict = case_insensitive_dict({"accept": "application/json"}) for key in accept_cases: assert key in my_dict + def test_case_insensitive_keys_delete(accept_cases): my_dict = case_insensitive_dict({"accept": "application/json"}) @@ -87,9 +101,10 @@ def test_case_insensitive_keys_delete(accept_cases): assert key not in my_dict my_dict[key] = "application/json" + def test_case_iter(): keys = ["One", "TWO", "tHrEe", "four"] - my_dict = case_insensitive_dict({key:idx for idx, key in enumerate(keys, 1)}) - + my_dict = case_insensitive_dict({key: idx for idx, key in enumerate(keys, 1)}) + for key in my_dict: - assert key in keys \ No newline at end of file + assert key in keys diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/__init__.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/__init__.py index f34ff35d3f26..ccf09e38dbcb 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/__init__.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/__init__.py @@ -29,9 +29,11 @@ app.register_blueprint(xml_api, url_prefix="/xml") app.register_blueprint(headers_api, url_prefix="/headers") -@app.route('/health', methods=['GET']) + +@app.route("/health", methods=["GET"]) def latin_1_charset_utf8(): return Response(status=200) + if __name__ == "__main__": app.run(debug=True) diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/basic.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/basic.py index 86117c112810..02ab084b83d2 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/basic.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/basic.py @@ -12,61 +12,58 @@ ) from .helpers import jsonify, get_dict -basic_api = Blueprint('basic_api', __name__) +basic_api = Blueprint("basic_api", __name__) -@basic_api.route('/string', methods=['GET']) + +@basic_api.route("/string", methods=["GET"]) def string(): - return Response( - "Hello, world!", status=200, mimetype="text/plain" - ) + return Response("Hello, world!", status=200, mimetype="text/plain") -@basic_api.route('/lines', methods=['GET']) + +@basic_api.route("/lines", methods=["GET"]) def lines(): - return Response( - "Hello,\nworld!", status=200, mimetype="text/plain" - ) + return Response("Hello,\nworld!", status=200, mimetype="text/plain") + -@basic_api.route("/bytes", methods=['GET']) +@basic_api.route("/bytes", methods=["GET"]) def bytes(): - return Response( - "Hello, world!".encode(), status=200, mimetype="text/plain" - ) + return Response("Hello, world!".encode(), status=200, mimetype="text/plain") -@basic_api.route("/html", methods=['GET']) + +@basic_api.route("/html", methods=["GET"]) def html(): - return Response( - "Hello, world!", status=200, mimetype="text/html" - ) + return Response("Hello, world!", status=200, mimetype="text/html") -@basic_api.route("/json", methods=['GET']) + +@basic_api.route("/json", methods=["GET"]) def json(): - return Response( - '{"greeting": "hello", "recipient": "world"}', status=200, mimetype="application/json" - ) + return Response('{"greeting": "hello", "recipient": "world"}', status=200, mimetype="application/json") + -@basic_api.route("/complicated-json", methods=['POST']) +@basic_api.route("/complicated-json", methods=["POST"]) def complicated_json(): # thanks to Sean Kane for this test! - assert request.json['EmptyByte'] == '' - assert request.json['EmptyUnicode'] == '' - assert request.json['SpacesOnlyByte'] == ' ' - assert request.json['SpacesOnlyUnicode'] == ' ' - assert request.json['SpacesBeforeByte'] == ' Text' - assert request.json['SpacesBeforeUnicode'] == ' Text' - assert request.json['SpacesAfterByte'] == 'Text ' - assert request.json['SpacesAfterUnicode'] == 'Text ' - assert request.json['SpacesBeforeAndAfterByte'] == ' Text ' - assert request.json['SpacesBeforeAndAfterUnicode'] == ' Text ' - assert request.json[u'啊齄丂狛'] == u'ꀕ' - assert request.json['RowKey'] == 'test2' - assert request.json[u'啊齄丂狛狜'] == 'hello' + assert request.json["EmptyByte"] == "" + assert request.json["EmptyUnicode"] == "" + assert request.json["SpacesOnlyByte"] == " " + assert request.json["SpacesOnlyUnicode"] == " " + assert request.json["SpacesBeforeByte"] == " Text" + assert request.json["SpacesBeforeUnicode"] == " Text" + assert request.json["SpacesAfterByte"] == "Text " + assert request.json["SpacesAfterUnicode"] == "Text " + assert request.json["SpacesBeforeAndAfterByte"] == " Text " + assert request.json["SpacesBeforeAndAfterUnicode"] == " Text " + assert request.json["啊齄丂狛"] == "ꀕ" + assert request.json["RowKey"] == "test2" + assert request.json["啊齄丂狛狜"] == "hello" assert request.json["singlequote"] == "a''''b" assert request.json["doublequote"] == 'a""""b' assert request.json["None"] == None return Response(status=200) -@basic_api.route("/headers", methods=['GET']) + +@basic_api.route("/headers", methods=["GET"]) def headers(): return Response( status=200, @@ -74,9 +71,10 @@ def headers(): "lowercase-header": "lowercase", "ALLCAPS-HEADER": "ALLCAPS", "CamelCase-Header": "camelCase", - } + }, ) + @basic_api.route("/anything", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "TRACE"]) def anything(): return jsonify( diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/encoding.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/encoding.py index 1733cef3bf0f..d67eb2517149 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/encoding.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/encoding.py @@ -10,101 +10,92 @@ Blueprint, ) -encoding_api = Blueprint('encoding_api', __name__) +encoding_api = Blueprint("encoding_api", __name__) -@encoding_api.route('/latin-1', methods=['GET']) + +@encoding_api.route("/latin-1", methods=["GET"]) def latin_1(): - r = Response( - u"Latin 1: ÿ".encode("latin-1"), status=200 - ) + r = Response("Latin 1: ÿ".encode("latin-1"), status=200) r.headers["Content-Type"] = "text/plain; charset=latin-1" return r -@encoding_api.route('/latin-1-with-utf-8', methods=['GET']) + +@encoding_api.route("/latin-1-with-utf-8", methods=["GET"]) def latin_1_charset_utf8(): - r = Response( - u"Latin 1: ÿ".encode("latin-1"), status=200 - ) + r = Response("Latin 1: ÿ".encode("latin-1"), status=200) r.headers["Content-Type"] = "text/plain; charset=utf-8" return r -@encoding_api.route('/no-charset', methods=['GET']) + +@encoding_api.route("/no-charset", methods=["GET"]) def latin_1_no_charset(): - r = Response( - "Hello, world!", status=200 - ) + r = Response("Hello, world!", status=200) r.headers["Content-Type"] = "text/plain" return r -@encoding_api.route('/iso-8859-1', methods=['GET']) + +@encoding_api.route("/iso-8859-1", methods=["GET"]) def iso_8859_1(): - r = Response( - u"Accented: Österreich".encode("iso-8859-1"), status=200 # cspell:disable-line - ) + r = Response("Accented: Österreich".encode("iso-8859-1"), status=200) # cspell:disable-line r.headers["Content-Type"] = "text/plain" return r -@encoding_api.route('/emoji', methods=['GET']) + +@encoding_api.route("/emoji", methods=["GET"]) def emoji(): - r = Response( - u"👩", status=200 - ) + r = Response("👩", status=200) return r -@encoding_api.route('/emoji-family-skin-tone-modifier', methods=['GET']) + +@encoding_api.route("/emoji-family-skin-tone-modifier", methods=["GET"]) def emoji_family_skin_tone_modifier(): - r = Response( - u"👩🏻‍👩🏽‍👧🏾‍👦🏿 SSN: 859-98-0987", status=200 - ) + r = Response("👩🏻‍👩🏽‍👧🏾‍👦🏿 SSN: 859-98-0987", status=200) return r -@encoding_api.route('/korean', methods=['GET']) + +@encoding_api.route("/korean", methods=["GET"]) def korean(): - r = Response( - "아가", status=200 - ) + r = Response("아가", status=200) return r -@encoding_api.route('/json', methods=['GET']) + +@encoding_api.route("/json", methods=["GET"]) def json(): data = {"greeting": "hello", "recipient": "world"} content = dumps(data).encode("utf-16") - r = Response( - content, status=200 - ) + r = Response(content, status=200) r.headers["Content-Type"] = "application/json; charset=utf-16" return r -@encoding_api.route('/invalid-codec-name', methods=['GET']) + +@encoding_api.route("/invalid-codec-name", methods=["GET"]) def invalid_codec_name(): - r = Response( - "おはようございます。".encode("utf-8"), status=200 - ) + r = Response("おはようございます。".encode("utf-8"), status=200) r.headers["Content-Type"] = "text/plain; charset=invalid-codec-name" return r -@encoding_api.route('/no-charset', methods=['GET']) + +@encoding_api.route("/no-charset", methods=["GET"]) def no_charset(): - r = Response( - "Hello, world!", status=200 - ) + r = Response("Hello, world!", status=200) r.headers["Content-Type"] = "text/plain" return r -@encoding_api.route('/gzip', methods=['GET']) + +@encoding_api.route("/gzip", methods=["GET"]) def gzip_content_encoding(): r = Response( - b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\n\xcbH\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00\x85\x11J\r\x0b\x00\x00\x00', status=200 + b"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\n\xcbH\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00\x85\x11J\r\x0b\x00\x00\x00", + status=200, ) r.headers["Content-Type"] = "text/plain" - r.headers['Content-Encoding'] = "gzip" + r.headers["Content-Encoding"] = "gzip" return r -@encoding_api.route('/deflate', methods=['GET']) + +@encoding_api.route("/deflate", methods=["GET"]) def deflate_content_encoding(): - r = Response( - b'\xcb\xc8T(\xc9H-J\x05\x00', status=200 - ) + r = Response(b"\xcb\xc8T(\xc9H-J\x05\x00", status=200) r.headers["Content-Type"] = "text/plain" - r.headers['Content-Encoding'] = "deflate" + r.headers["Content-Encoding"] = "deflate" return r diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/errors.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/errors.py index 410157c98148..87b274e1f6b7 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/errors.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/errors.py @@ -9,55 +9,55 @@ Blueprint, ) -errors_api = Blueprint('errors_api', __name__) +errors_api = Blueprint("errors_api", __name__) -@errors_api.route('/403', methods=['GET']) + +@errors_api.route("/403", methods=["GET"]) def get_403(): return Response(status=403) -@errors_api.route('/500', methods=['GET']) + +@errors_api.route("/500", methods=["GET"]) def get_500(): return Response(status=500) -@errors_api.route('/stream', methods=['GET']) + +@errors_api.route("/stream", methods=["GET"]) def get_stream(): class StreamingBody: def __iter__(self): yield b"Hello, " yield b"world!" + return Response(StreamingBody(), status=500) -@errors_api.route('/short-data', methods=['GET']) + +@errors_api.route("/short-data", methods=["GET"]) def get_short_data(): response = Response(b"X" * 4, status=200) response.automatically_set_content_length = False response.headers["Content-Length"] = "8" return response -@errors_api.route('/non-odatav4-body', methods=['GET']) + +@errors_api.route("/non-odatav4-body", methods=["GET"]) def get_non_odata_v4_response_body(): - return Response( - '{"code": 400, "error": {"global": ["MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API"]}}', - status=400 - ) + return Response('{"code": 400, "error": {"global": ["MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API"]}}', status=400) -@errors_api.route('/malformed-json', methods=['GET']) + +@errors_api.route("/malformed-json", methods=["GET"]) def get_malformed_json(): - return Response( - '{"code": 400, "error": {"global": ["MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API"]', - status=400 - ) + return Response('{"code": 400, "error": {"global": ["MY-ERROR-MESSAGE-THAT-IS-COMING-FROM-THE-API"]', status=400) + -@errors_api.route('/text', methods=['GET']) +@errors_api.route("/text", methods=["GET"]) def get_text_body(): - return Response( - 'I am throwing an error', - status=400 - ) + return Response("I am throwing an error", status=400) + -@errors_api.route('/odatav4', methods=['GET']) +@errors_api.route("/odatav4", methods=["GET"]) def get_odatav4(): return Response( '{"error": {"code": "501", "message": "Unsupported functionality", "target": "query", "details": [{"code": "301", "target": "$search", "message": "$search query option not supported"}], "innererror": {"trace": [], "context": {}}}}', - status=400 + status=400, ) diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/headers.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/headers.py index ffb5232587b0..92679dd0d2ca 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/headers.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/headers.py @@ -5,15 +5,12 @@ # license information. # ------------------------------------------------------------------------- -from flask import ( - Response, - Blueprint, - request -) +from flask import Response, Blueprint, request -headers_api = Blueprint('headers_api', __name__) +headers_api = Blueprint("headers_api", __name__) -@headers_api.route("/case-insensitive", methods=['GET']) + +@headers_api.route("/case-insensitive", methods=["GET"]) def case_insensitive(): return Response( status=200, @@ -21,38 +18,33 @@ def case_insensitive(): "lowercase-header": "lowercase", "ALLCAPS-HEADER": "ALLCAPS", "CamelCase-Header": "camelCase", - } + }, ) -@headers_api.route("/empty", methods=['GET']) + +@headers_api.route("/empty", methods=["GET"]) def empty(): - return Response( - status=200, - headers={} - ) + return Response(status=200, headers={}) + -@headers_api.route("/duplicate/numbers", methods=['GET']) +@headers_api.route("/duplicate/numbers", methods=["GET"]) def duplicate_numbers(): - return Response( - status=200, - headers=[("a", "123"), ("a", "456"), ("b", "789")] - ) + return Response(status=200, headers=[("a", "123"), ("a", "456"), ("b", "789")]) + -@headers_api.route("/duplicate/case-insensitive", methods=['GET']) +@headers_api.route("/duplicate/case-insensitive", methods=["GET"]) def duplicate_case_insensitive(): return Response( - status=200, - headers=[("Duplicate-Header", "one"), ("Duplicate-Header", "two"), ("duplicate-header", "three")] + status=200, headers=[("Duplicate-Header", "one"), ("Duplicate-Header", "two"), ("duplicate-header", "three")] ) -@headers_api.route("/duplicate/commas", methods=['GET']) + +@headers_api.route("/duplicate/commas", methods=["GET"]) def duplicate_commas(): - return Response( - status=200, - headers=[("Set-Cookie", "a, b"), ("Set-Cookie", "c")] - ) + return Response(status=200, headers=[("Set-Cookie", "a, b"), ("Set-Cookie", "c")]) + -@headers_api.route("/ordered", methods=['GET']) +@headers_api.route("/ordered", methods=["GET"]) def ordered(): return Response( status=200, diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/helpers.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/helpers.py index 132fb6874b63..3421c5a97002 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/helpers.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/helpers.py @@ -12,57 +12,61 @@ import json ENV_HEADERS = ( - 'X-Varnish', - 'X-Request-Start', - 'X-Heroku-Queue-Depth', - 'X-Real-Ip', - 'X-Forwarded-Proto', - 'X-Forwarded-Protocol', - 'X-Forwarded-Ssl', - 'X-Heroku-Queue-Wait-Time', - 'X-Forwarded-For', - 'X-Heroku-Dynos-In-Use', - 'X-Forwarded-Protocol', - 'X-Forwarded-Port', - 'X-Request-Id', - 'Via', - 'Total-Route-Time', - 'Connect-Time' + "X-Varnish", + "X-Request-Start", + "X-Heroku-Queue-Depth", + "X-Real-Ip", + "X-Forwarded-Proto", + "X-Forwarded-Protocol", + "X-Forwarded-Ssl", + "X-Heroku-Queue-Wait-Time", + "X-Forwarded-For", + "X-Heroku-Dynos-In-Use", + "X-Forwarded-Protocol", + "X-Forwarded-Port", + "X-Request-Id", + "Via", + "Total-Route-Time", + "Connect-Time", ) + def assert_with_message(param_name, expected_value, actual_value): assert expected_value == actual_value, "Expected '{}' to be '{}', got '{}'".format( param_name, expected_value, actual_value ) + def jsonify(*args, **kwargs): response = flask_jsonify(*args, **kwargs) if not response.data.endswith(b"\n"): response.data += b"\n" return response + def get_url(request): """ Since we might be hosted behind a proxy, we need to check the X-Forwarded-Proto, X-Forwarded-Protocol, or X-Forwarded-SSL headers to find out what protocol was used to access us. """ - protocol = request.headers.get('X-Forwarded-Proto') or request.headers.get('X-Forwarded-Protocol') - if protocol is None and request.headers.get('X-Forwarded-Ssl') == 'on': - protocol = 'https' + protocol = request.headers.get("X-Forwarded-Proto") or request.headers.get("X-Forwarded-Protocol") + if protocol is None and request.headers.get("X-Forwarded-Ssl") == "on": + protocol = "https" if protocol is None: return request.url url = list(urlparse(request.url)) url[0] = protocol return urlunparse(url) + def get_files(): """Returns files dict from request context.""" files = dict() for k, v in request.files.items(): - content_type = request.files[k].content_type or 'application/octet-stream' + content_type = request.files[k].content_type or "application/octet-stream" val = json_safe(v.read(), content_type) if files.get(k): if not isinstance(files[k], list): @@ -73,12 +77,13 @@ def get_files(): return files + def get_headers(hide_env=True): """Returns headers dict from request context.""" headers = dict(request.headers.items()) - if hide_env and ('show_env' not in request.args): + if hide_env and ("show_env" not in request.args): for key in ENV_HEADERS: try: del headers[key] @@ -87,6 +92,7 @@ def get_headers(hide_env=True): return CaseInsensitiveDict(headers.items()) + def semiflatten(multi): """Convert a MultiDict into a regular dict. If there are more than one value for a key, the result will have a list of values for the key. Otherwise it @@ -100,7 +106,8 @@ def semiflatten(multi): else: return multi -def json_safe(string, content_type='application/octet-stream'): + +def json_safe(string, content_type="application/octet-stream"): """Returns JSON-safe version of `string`. If `string` is a Unicode string or a valid UTF-8, it is returned unmodified, @@ -112,28 +119,24 @@ def json_safe(string, content_type='application/octet-stream'): URL scheme was chosen for its simplicity. """ try: - string = string.decode('utf-8') + string = string.decode("utf-8") json.dumps(string) return string except (ValueError, TypeError): - return b''.join([ - b'data:', - content_type.encode('utf-8'), - b';base64,', - base64.b64encode(string) - ]).decode('utf-8') + return b"".join([b"data:", content_type.encode("utf-8"), b";base64,", base64.b64encode(string)]).decode("utf-8") + def get_dict(*keys, **extras): """Returns request dict of given keys.""" - _keys = ('url', 'args', 'form', 'data', 'origin', 'headers', 'files', 'json', 'method') + _keys = ("url", "args", "form", "data", "origin", "headers", "files", "json", "method") assert all(map(_keys.__contains__, keys)) data = request.data form = semiflatten(request.form) try: - _json = json.loads(data.decode('utf-8')) + _json = json.loads(data.decode("utf-8")) except (ValueError, TypeError): _json = None @@ -142,7 +145,7 @@ def get_dict(*keys, **extras): args=semiflatten(request.args), form=form, data=json_safe(data), - origin=request.headers.get('X-Forwarded-For', request.remote_addr), + origin=request.headers.get("X-Forwarded-For", request.remote_addr), headers=get_headers(), files=get_files(), json=_json, @@ -158,9 +161,9 @@ def get_dict(*keys, **extras): return out_d + def get_base_url(request): return "http://" + request.host -__all__ = ["assert_with_message", - "get_dict", - "jsonify"] \ No newline at end of file + +__all__ = ["assert_with_message", "get_dict", "jsonify"] diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/multipart.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/multipart.py index 9be44121d2d4..19bcf537db46 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/multipart.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/multipart.py @@ -12,7 +12,7 @@ ) from .helpers import assert_with_message -multipart_api = Blueprint('multipart_api', __name__) +multipart_api = Blueprint("multipart_api", __name__) multipart_header_start = "multipart/form-data; boundary=" @@ -20,23 +20,26 @@ # in requests, we see the file content through request.form # in aiohttp, we see the file through request.files -@multipart_api.route('/basic', methods=['POST']) + +@multipart_api.route("/basic", methods=["POST"]) def basic(): - assert_with_message("content type", multipart_header_start, request.content_type[:len(multipart_header_start)]) + assert_with_message("content type", multipart_header_start, request.content_type[: len(multipart_header_start)]) if request.files: # aiohttp assert_with_message("content length", 258, request.content_length) assert_with_message("num files", 1, len(request.files)) - assert_with_message("has file named fileContent", True, bool(request.files.get('fileContent'))) - file_content = request.files['fileContent'] + assert_with_message("has file named fileContent", True, bool(request.files.get("fileContent"))) + file_content = request.files["fileContent"] assert_with_message("file content type", "application/octet-stream", file_content.content_type) assert_with_message("file content length", 14, file_content.content_length) assert_with_message("filename", "fileContent", file_content.filename) - assert_with_message("has content disposition header", True, bool(file_content.headers.get("Content-Disposition"))) + assert_with_message( + "has content disposition header", True, bool(file_content.headers.get("Content-Disposition")) + ) assert_with_message( "content disposition", 'form-data; name="fileContent"; filename="fileContent"; filename*=utf-8\'\'fileContent', - file_content.headers["Content-Disposition"] + file_content.headers["Content-Disposition"], ) elif request.form: # requests @@ -46,31 +49,34 @@ def basic(): return Response(status=400) # should be either of these return Response(status=200) -@multipart_api.route('/data-and-files', methods=['POST']) + +@multipart_api.route("/data-and-files", methods=["POST"]) def data_and_files(): - assert_with_message("content type", multipart_header_start, request.content_type[:len(multipart_header_start)]) + assert_with_message("content type", multipart_header_start, request.content_type[: len(multipart_header_start)]) assert_with_message("message", "Hello, world!", request.form["message"]) assert_with_message("message", "", request.form["fileContent"]) return Response(status=200) -@multipart_api.route('/data-and-files-tuple', methods=['POST']) + +@multipart_api.route("/data-and-files-tuple", methods=["POST"]) def data_and_files_tuple(): - assert_with_message("content type", multipart_header_start, request.content_type[:len(multipart_header_start)]) + assert_with_message("content type", multipart_header_start, request.content_type[: len(multipart_header_start)]) assert_with_message("message", ["abc"], request.form["message"]) assert_with_message("message", [""], request.form["fileContent"]) return Response(status=200) -@multipart_api.route('/non-seekable-filelike', methods=['POST']) + +@multipart_api.route("/non-seekable-filelike", methods=["POST"]) def non_seekable_filelike(): - assert_with_message("content type", multipart_header_start, request.content_type[:len(multipart_header_start)]) + assert_with_message("content type", multipart_header_start, request.content_type[: len(multipart_header_start)]) if request.files: # aiohttp len_files = len(request.files) assert_with_message("num files", 1, len_files) # assert_with_message("content length", 258, request.content_length) assert_with_message("num files", 1, len(request.files)) - assert_with_message("has file named file", True, bool(request.files.get('file'))) - file = request.files['file'] + assert_with_message("has file named file", True, bool(request.files.get("file"))) + file = request.files["file"] assert_with_message("file content type", "application/octet-stream", file.content_type) assert_with_message("file content length", 14, file.content_length) assert_with_message("filename", "file", file.filename) @@ -78,7 +84,7 @@ def non_seekable_filelike(): assert_with_message( "content disposition", 'form-data; name="fileContent"; filename="fileContent"; filename*=utf-8\'\'fileContent', - file.headers["Content-Disposition"] + file.headers["Content-Disposition"], ) elif request.form: # requests @@ -87,7 +93,8 @@ def non_seekable_filelike(): return Response(status=400) return Response(status=200) -@multipart_api.route('/request', methods=["POST"]) + +@multipart_api.route("/request", methods=["POST"]) def multipart_request(): body_as_str = ( "--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed\r\n" @@ -115,5 +122,7 @@ def multipart_request(): "Time:2018-06-14T16:46:54.6040685Z\r\n" "--batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed--" ) - return Response(body_as_str.encode('ascii'), content_type="multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed") - + return Response( + body_as_str.encode("ascii"), + content_type="multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed", + ) diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/polling.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/polling.py index 326f2dce63dc..005867a38e35 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/polling.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/polling.py @@ -10,163 +10,162 @@ ) from .helpers import get_base_url, assert_with_message -polling_api = Blueprint('polling_api', __name__) +polling_api = Blueprint("polling_api", __name__) -@polling_api.route('/post/location-and-operation-location', methods=['POST']) +@polling_api.route("/post/location-and-operation-location", methods=["POST"]) def post_with_location_and_operation_location_initial(): base_url = get_base_url(request) return Response( '{"properties":{"provisioningState": "InProgress"}}', headers={ - 'location': '{}/polling/location-url'.format(base_url), - 'operation-location': '{}/polling/operation-location-url'.format(base_url), + "location": "{}/polling/location-url".format(base_url), + "operation-location": "{}/polling/operation-location-url".format(base_url), }, - status=202 + status=202, ) -@polling_api.route('/location-url', methods=['GET']) + +@polling_api.route("/location-url", methods=["GET"]) def location_url(): - return Response( - '{"location_result": true}', - status=200 - ) + return Response('{"location_result": true}', status=200) + -@polling_api.route('/location-no-body-url', methods=['GET']) +@polling_api.route("/location-no-body-url", methods=["GET"]) def location_no_body_url(): - return Response( - status=200 - ) + return Response(status=200) + -@polling_api.route('/operation-location-url', methods=['GET']) +@polling_api.route("/operation-location-url", methods=["GET"]) def operation_location_url(): - return Response( - '{"status": "Succeeded"}', - status=200 - ) + return Response('{"status": "Succeeded"}', status=200) -@polling_api.route('/post/location-and-operation-location-no-body', methods=['POST']) + +@polling_api.route("/post/location-and-operation-location-no-body", methods=["POST"]) def post_with_location_and_operation_location_initial_no_body(): base_url = get_base_url(request) return Response( '{"properties":{"provisioningState": "InProgress"}}', headers={ - 'location': '{}/polling/location-no-body-url'.format(base_url), - 'operation-location': '{}/polling/operation-location-url'.format(base_url), + "location": "{}/polling/location-no-body-url".format(base_url), + "operation-location": "{}/polling/operation-location-url".format(base_url), }, - status=202 + status=202, ) -@polling_api.route('/post/resource-location', methods=['POST']) + +@polling_api.route("/post/resource-location", methods=["POST"]) def resource_location(): base_url = get_base_url(request) return Response( - '', + "", status=202, headers={ - 'operation-location': '{}/polling/post/resource-location/operation-location-url'.format(base_url), - } + "operation-location": "{}/polling/post/resource-location/operation-location-url".format(base_url), + }, ) -@polling_api.route('/post/resource-location/operation-location-url', methods=['GET']) + +@polling_api.route("/post/resource-location/operation-location-url", methods=["GET"]) def resource_location_operation_location(): base_url = get_base_url(request) - resource_location = '{}/polling/location-url'.format(base_url) + resource_location = "{}/polling/location-url".format(base_url) return Response( '{"status": "Succeeded", "resourceLocation": "' + resource_location + '"}', status=200, ) -@polling_api.route('/no-polling', methods=['PUT']) + +@polling_api.route("/no-polling", methods=["PUT"]) def no_polling(): - return Response( - '{"properties":{"provisioningState": "Succeeded"}}', - status=201 - ) + return Response('{"properties":{"provisioningState": "Succeeded"}}', status=201) + -@polling_api.route('/operation-location', methods=["DELETE", "POST", "PUT", "PATCH", "GET"]) +@polling_api.route("/operation-location", methods=["DELETE", "POST", "PUT", "PATCH", "GET"]) def operation_location(): base_url = get_base_url(request) return Response( status=201, headers={ - 'operation-location': '{}/polling/operation-location-url'.format(base_url), - } + "operation-location": "{}/polling/operation-location-url".format(base_url), + }, ) -@polling_api.route('/bad-operation-location', methods=["PUT", "PATCH", "DELETE", "POST"]) + +@polling_api.route("/bad-operation-location", methods=["PUT", "PATCH", "DELETE", "POST"]) def bad_operation_location(): return Response( status=201, headers={ - 'operation-location': 'http://localhost:5000/does-not-exist', - } + "operation-location": "http://localhost:5000/does-not-exist", + }, ) -@polling_api.route('/location', methods=["PUT", "PATCH", "DELETE", "POST"]) + +@polling_api.route("/location", methods=["PUT", "PATCH", "DELETE", "POST"]) def location(): base_url = get_base_url(request) return Response( status=201, headers={ - 'location': '{}/polling/location-url'.format(base_url), - } + "location": "{}/polling/location-url".format(base_url), + }, ) -@polling_api.route('/bad-location', methods=["PUT", "PATCH", "DELETE", "POST"]) + +@polling_api.route("/bad-location", methods=["PUT", "PATCH", "DELETE", "POST"]) def bad_location(): return Response( status=201, headers={ - 'location': 'http://localhost:5000/does-not-exist', - } + "location": "http://localhost:5000/does-not-exist", + }, ) -@polling_api.route('/initial-body-invalid', methods=["PUT"]) + +@polling_api.route("/initial-body-invalid", methods=["PUT"]) def initial_body_invalid(): base_url = get_base_url(request) return Response( "", status=201, headers={ - 'location': '{}/polling/location-url'.format(base_url), - } + "location": "{}/polling/location-url".format(base_url), + }, ) -@polling_api.route('/request-id', methods=["POST"]) + +@polling_api.route("/request-id", methods=["POST"]) def request_id(): base_url = get_base_url(request) return Response( "", status=201, headers={ - 'location': '{}/polling/request-id-location'.format(base_url), - } + "location": "{}/polling/request-id-location".format(base_url), + }, ) -@polling_api.route('/request-id-location', methods=["GET"]) + +@polling_api.route("/request-id-location", methods=["GET"]) def request_id_location(): - assert_with_message("request id", request.headers['X-Ms-Client-Request-Id'], "123456789") - return Response( - '{"status": "Succeeded"}', - status=200 - ) + assert_with_message("request id", request.headers["X-Ms-Client-Request-Id"], "123456789") + return Response('{"status": "Succeeded"}', status=200) + -@polling_api.route('/polling-with-options', methods=["PUT"]) +@polling_api.route("/polling-with-options", methods=["PUT"]) def polling_with_options_first(): base_url = get_base_url(request) return Response( '{"properties":{"provisioningState": "InProgress"}}', headers={ - 'location': '{}/polling/final-get-with-location'.format(base_url), - 'operation-location': '{}/polling/post/resource-location/operation-location-url'.format(base_url), + "location": "{}/polling/final-get-with-location".format(base_url), + "operation-location": "{}/polling/post/resource-location/operation-location-url".format(base_url), }, - status=202 + status=202, ) -@polling_api.route('/final-get-with-location', methods=["GET"]) + +@polling_api.route("/final-get-with-location", methods=["GET"]) def polling_with_options_final_get_with_location(): - return Response( - '{"returnedFrom": "locationHeaderUrl"}', - status=200 - ) + return Response('{"returnedFrom": "locationHeaderUrl"}', status=200) diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/streams.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/streams.py index aeb20cae9e51..a8821b447956 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/streams.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/streams.py @@ -12,70 +12,82 @@ Blueprint, ) -streams_api = Blueprint('streams_api', __name__) +streams_api = Blueprint("streams_api", __name__) + class StreamingBody: def __iter__(self): yield b"Hello, " yield b"world!" + def streaming_body(): yield b"Hello, " yield b"world!" + def stream_json_error(): yield '{"error": {"code": "BadRequest", ' - yield' "message": "You made a bad request"}}' + yield ' "message": "You made a bad request"}}' + def streaming_test(): yield b"test" + def stream_compressed_header_error(): - yield b'test' + yield b"test" + def stream_compressed_no_header(): - with gzip.open('test.tar.gz', 'wb') as f: + with gzip.open("test.tar.gz", "wb") as f: f.write(b"test") - - with open(os.path.join(os.path.abspath('test.tar.gz')), "rb") as fd: + + with open(os.path.join(os.path.abspath("test.tar.gz")), "rb") as fd: yield fd.read() - + os.remove("test.tar.gz") - -@streams_api.route('/basic', methods=['GET']) + + +@streams_api.route("/basic", methods=["GET"]) def basic(): return Response(streaming_body(), status=200) -@streams_api.route('/iterable', methods=['GET']) + +@streams_api.route("/iterable", methods=["GET"]) def iterable(): return Response(StreamingBody(), status=200) -@streams_api.route('/error', methods=['GET']) + +@streams_api.route("/error", methods=["GET"]) def error(): return Response(stream_json_error(), status=400) -@streams_api.route('/string', methods=['GET']) + +@streams_api.route("/string", methods=["GET"]) def string(): - return Response( - streaming_test(), status=200, mimetype="text/plain" - ) + return Response(streaming_test(), status=200, mimetype="text/plain") + -@streams_api.route('/compressed_no_header', methods=['GET']) +@streams_api.route("/compressed_no_header", methods=["GET"]) def compressed_no_header(): return Response(stream_compressed_no_header(), status=300) -@streams_api.route('/compressed', methods=['GET']) + +@streams_api.route("/compressed", methods=["GET"]) def compressed(): return Response(stream_compressed_header_error(), status=300, headers={"Content-Encoding": "gzip"}) + def compressed_stream(): - with tempfile.TemporaryFile(mode='w+b') as f: - gzf = gzip.GzipFile(mode='w+b', fileobj=f) + with tempfile.TemporaryFile(mode="w+b") as f: + gzf = gzip.GzipFile(mode="w+b", fileobj=f) gzf.write(b"test") gzf.flush() f.seek(0) yield f.read() - -@streams_api.route('/decompress_header', methods=['GET']) + + +@streams_api.route("/decompress_header", methods=["GET"]) def decompress_header(): return Response(compressed_stream(), status=200, headers={"Content-Encoding": "gzip"}) diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/structures.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/structures.py index 1e443986cdf2..69ac916cc44f 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/structures.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/structures.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- + class CaseInsensitiveDict(dict): """Case-insensitive Dictionary for headers. diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/urlencoded.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/urlencoded.py index 4ea2bdd2795d..c9fb0167ce9c 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/urlencoded.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/urlencoded.py @@ -11,9 +11,10 @@ ) from .helpers import assert_with_message -urlencoded_api = Blueprint('urlencoded_api', __name__) +urlencoded_api = Blueprint("urlencoded_api", __name__) -@urlencoded_api.route('/pet/add/', methods=['POST']) + +@urlencoded_api.route("/pet/add/", methods=["POST"]) def basic(pet_id): assert_with_message("pet_id", "1", pet_id) assert_with_message("content type", "application/x-www-form-urlencoded", request.content_type) diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/xml_route.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/xml_route.py index c19aed97b6b5..a0ba8c25637c 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/xml_route.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/xml_route.py @@ -12,9 +12,10 @@ ) from .helpers import assert_with_message -xml_api = Blueprint('xml_api', __name__) +xml_api = Blueprint("xml_api", __name__) -@xml_api.route('/basic', methods=['GET', 'PUT']) + +@xml_api.route("/basic", methods=["GET", "PUT"]) def basic(): basic_body = """ """ - if request.method == 'GET': + if request.method == "GET": return Response(basic_body, status=200) - elif request.method == 'PUT': + elif request.method == "PUT": assert_with_message("content length", str(len(request.data)), request.headers["Content-Length"]) parsed_xml = ET.fromstring(request.data.decode("utf-8")) assert_with_message("tag", "slideshow", parsed_xml.tag) attributes = parsed_xml.attrib - assert_with_message("title attribute", "Sample Slide Show", attributes['title']) - assert_with_message("date attribute", "Date of publication", attributes['date']) - assert_with_message("author attribute", "Yours Truly", attributes['author']) + assert_with_message("title attribute", "Sample Slide Show", attributes["title"]) + assert_with_message("date attribute", "Date of publication", attributes["date"]) + assert_with_message("author attribute", "Yours Truly", attributes["author"]) return Response(status=200) return Response("You have passed in method '{}' that is not 'GET' or 'PUT'".format(request.method), status=400) diff --git a/sdk/core/azure-core/tests/testserver_tests/coretestserver/setup.py b/sdk/core/azure-core/tests/testserver_tests/coretestserver/setup.py index 63f51acde3f2..26366f2aa08f 100644 --- a/sdk/core/azure-core/tests/testserver_tests/coretestserver/setup.py +++ b/sdk/core/azure-core/tests/testserver_tests/coretestserver/setup.py @@ -13,25 +13,25 @@ name="coretestserver", version=version, include_package_data=True, - description='Testserver for Python Core', - long_description='Testserver for Python Core', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/iscai-msft/core.testserver', + description="Testserver for Python Core", + long_description="Testserver for Python Core", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/iscai-msft/core.testserver", classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", ], packages=find_packages(), install_requires=[ "flask==1.1.4", - ] + ], ) diff --git a/sdk/core/azure-core/tests/tracing_common.py b/sdk/core/azure-core/tests/tracing_common.py index 2a2c55fe987f..e7720aba8f6f 100644 --- a/sdk/core/azure-core/tests/tracing_common.py +++ b/sdk/core/azure-core/tests/tracing_common.py @@ -6,6 +6,7 @@ from contextlib import contextmanager from azure.core.tracing import HttpSpanMixin, SpanKind from typing import Union, Sequence, Optional, Dict + AttributeValue = Union[ str, bool, @@ -18,6 +19,7 @@ ] Attributes = Optional[Dict[str, AttributeValue]] + class FakeSpan(HttpSpanMixin, object): # Keep a fake context of the current one CONTEXT = [] @@ -74,7 +76,6 @@ def kind(self): """Get the span kind of this span.""" return self._kind - @kind.setter def kind(self, value): # type: (SpanKind) -> None @@ -107,7 +108,7 @@ def to_header(self): Returns a dictionary with the header labels and values. :return: A key value pair dictionary """ - return {'traceparent': '123456789'} + return {"traceparent": "123456789"} def add_attribute(self, key, value): # type: (str, Union[str, int]) -> None @@ -134,7 +135,7 @@ def get_trace_parent(self): :return: a traceparent string :rtype: str """ - return self.to_header()['traceparent'] + return self.to_header()["traceparent"] @classmethod def link(cls, traceparent, attributes=None): @@ -145,9 +146,7 @@ def link(cls, traceparent, attributes=None): :param traceparent: A complete traceparent :type traceparent: str """ - cls.link_from_headers({ - 'traceparent': traceparent - }) + cls.link_from_headers({"traceparent": traceparent}) @classmethod def link_from_headers(cls, headers, attributes=None): @@ -180,8 +179,7 @@ def get_current_tracer(cls): @contextmanager def change_context(cls, span): # type: (Span) -> ContextManager - """Change the context for the life of this context manager. - """ + """Change the context for the life of this context manager.""" try: cls.CONTEXT.append(span) yield @@ -191,8 +189,7 @@ def change_context(cls, span): @classmethod def set_current_span(cls, span): # type: (Span) -> None - """Not supported by OpenTelemetry. - """ + """Not supported by OpenTelemetry.""" raise NotImplementedError() @classmethod diff --git a/sdk/core/azure-core/tests/utils.py b/sdk/core/azure-core/tests/utils.py index a70c5db98243..e1807a85e6cd 100644 --- a/sdk/core/azure-core/tests/utils.py +++ b/sdk/core/azure-core/tests/utils.py @@ -5,15 +5,18 @@ # ------------------------------------------------------------------------- import pytest import types + ############################## LISTS USED TO PARAMETERIZE TESTS ############################## from azure.core.rest import HttpRequest as RestHttpRequest from azure.core.pipeline.transport import HttpRequest as PipelineTransportHttpRequest from azure.core.pipeline._tools import is_rest + HTTP_REQUESTS = [PipelineTransportHttpRequest, RestHttpRequest] REQUESTS_TRANSPORT_RESPONSES = [] from azure.core.pipeline.transport import HttpResponse as PipelineTransportHttpResponse from azure.core.rest._http_response_impl import HttpResponseImpl as RestHttpResponse + HTTP_RESPONSES = [PipelineTransportHttpResponse, RestHttpResponse] ASYNC_HTTP_RESPONSES = [] @@ -21,6 +24,7 @@ try: from azure.core.pipeline.transport import AsyncHttpResponse as PipelineTransportAsyncHttpResponse from azure.core.rest._http_response_impl_async import AsyncHttpResponseImpl as RestAsyncHttpResponse + ASYNC_HTTP_RESPONSES = [PipelineTransportAsyncHttpResponse, RestAsyncHttpResponse] except (ImportError, SyntaxError): pass @@ -28,20 +32,30 @@ try: from azure.core.pipeline.transport import RequestsTransportResponse as PipelineTransportRequestsTransportResponse from azure.core.rest._requests_basic import RestRequestsTransportResponse + REQUESTS_TRANSPORT_RESPONSES = [PipelineTransportRequestsTransportResponse, RestRequestsTransportResponse] except ImportError: pass -from azure.core.pipeline.transport._base import HttpClientTransportResponse as PipelineTransportHttpClientTransportResponse +from azure.core.pipeline.transport._base import ( + HttpClientTransportResponse as PipelineTransportHttpClientTransportResponse, +) from azure.core.rest._http_response_impl import RestHttpClientTransportResponse + HTTP_CLIENT_TRANSPORT_RESPONSES = [PipelineTransportHttpClientTransportResponse, RestHttpClientTransportResponse] ASYNCIO_REQUESTS_TRANSPORT_RESPONSES = [] try: - from azure.core.pipeline.transport import AsyncioRequestsTransportResponse as PipelineTransportAsyncioRequestsTransportResponse + from azure.core.pipeline.transport import ( + AsyncioRequestsTransportResponse as PipelineTransportAsyncioRequestsTransportResponse, + ) from azure.core.rest._requests_asyncio import RestAsyncioRequestsTransportResponse - ASYNCIO_REQUESTS_TRANSPORT_RESPONSES = [PipelineTransportAsyncioRequestsTransportResponse, RestAsyncioRequestsTransportResponse] + + ASYNCIO_REQUESTS_TRANSPORT_RESPONSES = [ + PipelineTransportAsyncioRequestsTransportResponse, + RestAsyncioRequestsTransportResponse, + ] except (ImportError, SyntaxError): pass @@ -50,17 +64,20 @@ try: from azure.core.pipeline.transport import AioHttpTransportResponse as PipelineTransportAioHttpTransportResponse from azure.core.rest._aiohttp import RestAioHttpTransportResponse + AIOHTTP_TRANSPORT_RESPONSES = [PipelineTransportAioHttpTransportResponse, RestAioHttpTransportResponse] except (ImportError, SyntaxError): pass ############################## HELPER FUNCTIONS ############################## + def request_and_responses_product(*args): pipeline_transport = tuple([PipelineTransportHttpRequest]) + tuple(arg[0] for arg in args) rest = tuple([RestHttpRequest]) + tuple(arg[1] for arg in args) return [pipeline_transport, rest] + def create_http_request(http_request, *args, **kwargs): if hasattr(http_request, "content"): method = args[0] @@ -77,29 +94,19 @@ def create_http_request(http_request, *args, **kwargs): data = args[4] except IndexError: data = None - return http_request( - method=method, - url=url, - headers=headers, - files=files, - data=data, - **kwargs - ) + return http_request(method=method, url=url, headers=headers, files=files, data=data, **kwargs) return http_request(*args, **kwargs) + def create_transport_response(http_response, *args, **kwargs): # this creates transport-specific responses, # like requests responses / aiohttp responses if is_rest(http_response): block_size = args[2] if len(args) > 2 else None - return http_response( - request=args[0], - internal_response=args[1], - block_size=block_size, - **kwargs - ) + return http_response(request=args[0], internal_response=args[1], block_size=block_size, **kwargs) return http_response(*args, **kwargs) + def create_http_response(http_response, *args, **kwargs): # since the actual http_response object is # an ABC for our new responses, it's a little more @@ -121,13 +128,14 @@ def create_http_response(http_response, *args, **kwargs): ) return http_response(*args, **kwargs) + def readonly_checks(response, old_response_class): # though we want these properties to be completely readonly, it doesn't work # for the backcompat properties assert isinstance(response.request, RestHttpRequest) assert isinstance(response.status_code, int) assert response.headers - assert response.content_type == 'text/html; charset=utf-8' + assert response.content_type == "text/html; charset=utf-8" assert response.is_closed with pytest.raises(AttributeError): @@ -152,7 +160,7 @@ def readonly_checks(response, old_response_class): old_response = old_response_class(response.request, response.internal_response, response.block_size) for attr in dir(response): - if attr[0] == '_': + if attr[0] == "_": # don't care about private variables continue if type(getattr(response, attr)) == types.MethodType: diff --git a/sdk/core/azure-mgmt-core/azure/__init__.py b/sdk/core/azure-mgmt-core/azure/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-mgmt-core/azure/__init__.py +++ b/sdk/core/azure-mgmt-core/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/__init__.py b/sdk/core/azure-mgmt-core/azure/mgmt/__init__.py index 0d1f7edf5dc6..d55ccad1f573 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/__init__.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/_async_pipeline_client.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/_async_pipeline_client.py index 289e82ea70a0..bc7bb190dabb 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/_async_pipeline_client.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/_async_pipeline_client.py @@ -46,18 +46,15 @@ class AsyncARMPipelineClient(AsyncPipelineClient): def __init__(self, base_url, **kwargs): if "policies" not in kwargs: if "config" not in kwargs: - raise ValueError( - "Current implementation requires to pass 'config' if you don't pass 'policies'" - ) - per_call_policies = kwargs.get('per_call_policies', []) + raise ValueError("Current implementation requires to pass 'config' if you don't pass 'policies'") + per_call_policies = kwargs.get("per_call_policies", []) if isinstance(per_call_policies, Iterable): per_call_policies.append(AsyncARMAutoResourceProviderRegistrationPolicy()) else: - per_call_policies = [per_call_policies, - AsyncARMAutoResourceProviderRegistrationPolicy()] + per_call_policies = [per_call_policies, AsyncARMAutoResourceProviderRegistrationPolicy()] kwargs["per_call_policies"] = per_call_policies - config = kwargs.get('config') + config = kwargs.get("config") if not config.http_logging_policy: - config.http_logging_policy = kwargs.get('http_logging_policy', ARMHttpLoggingPolicy(**kwargs)) + config.http_logging_policy = kwargs.get("http_logging_policy", ARMHttpLoggingPolicy(**kwargs)) kwargs["config"] = config super(AsyncARMPipelineClient, self).__init__(base_url, **kwargs) diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/_pipeline_client.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/_pipeline_client.py index 4e80070758aa..7cefbf347562 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/_pipeline_client.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/_pipeline_client.py @@ -44,18 +44,15 @@ class ARMPipelineClient(PipelineClient): def __init__(self, base_url, **kwargs): if "policies" not in kwargs: if "config" not in kwargs: - raise ValueError( - "Current implementation requires to pass 'config' if you don't pass 'policies'" - ) - per_call_policies = kwargs.get('per_call_policies', []) + raise ValueError("Current implementation requires to pass 'config' if you don't pass 'policies'") + per_call_policies = kwargs.get("per_call_policies", []) if isinstance(per_call_policies, Iterable): per_call_policies.append(ARMAutoResourceProviderRegistrationPolicy()) else: - per_call_policies = [per_call_policies, - ARMAutoResourceProviderRegistrationPolicy()] + per_call_policies = [per_call_policies, ARMAutoResourceProviderRegistrationPolicy()] kwargs["per_call_policies"] = per_call_policies - config = kwargs.get('config') + config = kwargs.get("config") if not config.http_logging_policy: - config.http_logging_policy = kwargs.get('http_logging_policy', ARMHttpLoggingPolicy(**kwargs)) + config.http_logging_policy = kwargs.get("http_logging_policy", ARMHttpLoggingPolicy(**kwargs)) kwargs["config"] = config super(ARMPipelineClient, self).__init__(base_url, **kwargs) diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/__init__.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/__init__.py index 7ec2459658ef..1d786eebc1cd 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/__init__.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/__init__.py @@ -30,24 +30,26 @@ from ._authentication_async import AsyncARMChallengeAuthenticationPolicy from ._base_async import AsyncARMAutoResourceProviderRegistrationPolicy + class ARMHttpLoggingPolicy(HttpLoggingPolicy): - """HttpLoggingPolicy with ARM specific safe headers fopr loggers. - """ + """HttpLoggingPolicy with ARM specific safe headers fopr loggers.""" - DEFAULT_HEADERS_ALLOWLIST = HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST | set([ - # https://docs.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling#remaining-requests - "x-ms-ratelimit-remaining-subscription-reads", - "x-ms-ratelimit-remaining-subscription-writes", - "x-ms-ratelimit-remaining-tenant-reads", - "x-ms-ratelimit-remaining-tenant-writes", - "x-ms-ratelimit-remaining-subscription-resource-requests", - "x-ms-ratelimit-remaining-subscription-resource-entities-read", - "x-ms-ratelimit-remaining-tenant-resource-requests", - "x-ms-ratelimit-remaining-tenant-resource-entities-read", - # https://docs.microsoft.com/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors#call-rate-informational-response-headers - "x-ms-ratelimit-remaining-resource", - "x-ms-request-charge", - ]) + DEFAULT_HEADERS_ALLOWLIST = HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST | set( + [ + # https://docs.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling#remaining-requests + "x-ms-ratelimit-remaining-subscription-reads", + "x-ms-ratelimit-remaining-subscription-writes", + "x-ms-ratelimit-remaining-tenant-reads", + "x-ms-ratelimit-remaining-tenant-writes", + "x-ms-ratelimit-remaining-subscription-resource-requests", + "x-ms-ratelimit-remaining-subscription-resource-entities-read", + "x-ms-ratelimit-remaining-tenant-resource-requests", + "x-ms-ratelimit-remaining-tenant-resource-entities-read", + # https://docs.microsoft.com/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors#call-rate-informational-response-headers + "x-ms-ratelimit-remaining-resource", + "x-ms-request-charge", + ] + ) __all__ = [ @@ -55,5 +57,5 @@ class ARMHttpLoggingPolicy(HttpLoggingPolicy): "ARMChallengeAuthenticationPolicy", "ARMHttpLoggingPolicy", "AsyncARMAutoResourceProviderRegistrationPolicy", - "AsyncARMChallengeAuthenticationPolicy" + "AsyncARMChallengeAuthenticationPolicy", ] diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base.py index dd19692432b7..8f00b976a566 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base.py @@ -38,8 +38,7 @@ class ARMAutoResourceProviderRegistrationPolicy(HTTPPolicy): - """Auto register an ARM resource provider if not done yet. - """ + """Auto register an ARM resource provider if not done yet.""" def send(self, request): # type: (PipelineRequest[HTTPRequestType], Any) -> PipelineResponse[HTTPRequestType, HTTPResponseType] @@ -82,9 +81,7 @@ def _extract_subscription_url(url): @staticmethod def _build_next_request(initial_request, method, url): request = HttpRequest(method, url) - context = PipelineContext( - initial_request.context.transport, **initial_request.context.options - ) + context = PipelineContext(initial_request.context.transport, **initial_request.context.options) return PipelineRequest(request, context) def _register_rp(self, initial_request, url_prefix, rp_name): @@ -92,27 +89,20 @@ def _register_rp(self, initial_request, url_prefix, rp_name): Return False if we have a reason to believe this didn't work """ - post_url = "{}providers/{}/register?api-version=2016-02-01".format( - url_prefix, rp_name - ) + post_url = "{}providers/{}/register?api-version=2016-02-01".format(url_prefix, rp_name) get_url = "{}providers/{}?api-version=2016-02-01".format(url_prefix, rp_name) _LOGGER.warning( - "Resource provider '%s' used by this operation is not " - "registered. We are registering for you.", + "Resource provider '%s' used by this operation is not " "registered. We are registering for you.", rp_name, ) - post_response = self.next.send( - self._build_next_request(initial_request, "POST", post_url) - ) + post_response = self.next.send(self._build_next_request(initial_request, "POST", post_url)) if post_response.http_response.status_code != 200: _LOGGER.warning("Registration failed. Please register manually.") return False while True: time.sleep(10) - get_response = self.next.send( - self._build_next_request(initial_request, "GET", get_url) - ) + get_response = self.next.send(self._build_next_request(initial_request, "GET", get_url)) rp_info = json.loads(get_response.http_response.text()) if rp_info["registrationState"] == "Registered": _LOGGER.warning("Registration succeeded.") diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py index ce6c58b27f0f..6208df12e5ff 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py @@ -36,11 +36,8 @@ _LOGGER = logging.getLogger(__name__) -class AsyncARMAutoResourceProviderRegistrationPolicy( - ARMAutoResourceProviderRegistrationPolicy, AsyncHTTPPolicy -): - """Auto register an ARM resource provider if not done yet. - """ +class AsyncARMAutoResourceProviderRegistrationPolicy(ARMAutoResourceProviderRegistrationPolicy, AsyncHTTPPolicy): + """Auto register an ARM resource provider if not done yet.""" async def send(self, request: PipelineRequest): # pylint: disable=invalid-overridden-method http_request = request.http_request @@ -49,9 +46,7 @@ async def send(self, request: PipelineRequest): # pylint: disable=invalid-overr rp_name = self._check_rp_not_registered_err(response) if rp_name: url_prefix = self._extract_subscription_url(http_request.url) - register_rp_status = await self._async_register_rp( - request, url_prefix, rp_name - ) + register_rp_status = await self._async_register_rp(request, url_prefix, rp_name) if not register_rp_status: return response # Change the 'x-ms-client-request-id' otherwise the Azure endpoint @@ -66,27 +61,20 @@ async def _async_register_rp(self, initial_request, url_prefix, rp_name): Return False if we have a reason to believe this didn't work """ - post_url = "{}providers/{}/register?api-version=2016-02-01".format( - url_prefix, rp_name - ) + post_url = "{}providers/{}/register?api-version=2016-02-01".format(url_prefix, rp_name) get_url = "{}providers/{}?api-version=2016-02-01".format(url_prefix, rp_name) _LOGGER.warning( - "Resource provider '%s' used by this operation is not " - "registered. We are registering for you.", + "Resource provider '%s' used by this operation is not " "registered. We are registering for you.", rp_name, ) - post_response = await self.next.send( - self._build_next_request(initial_request, "POST", post_url) - ) + post_response = await self.next.send(self._build_next_request(initial_request, "POST", post_url)) if post_response.http_response.status_code != 200: _LOGGER.warning("Registration failed. Please register manually.") return False while True: await asyncio.sleep(10) - get_response = await self.next.send( - self._build_next_request(initial_request, "GET", get_url) - ) + get_response = await self.next.send(self._build_next_request(initial_request, "GET", get_url)) rp_info = json.loads(get_response.http_response.text()) if rp_info["registrationState"] == "Registered": _LOGGER.warning("Registration succeeded.") diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/arm_polling.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/arm_polling.py index f450403e294e..0353a7d3d85c 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/arm_polling.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/arm_polling.py @@ -65,13 +65,10 @@ class _FinalStateViaOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): class AzureAsyncOperationPolling(OperationResourcePolling): - """Implements a operation resource polling, typically from Azure-AsyncOperation. - """ + """Implements a operation resource polling, typically from Azure-AsyncOperation.""" def __init__(self, lro_options=None): - super(AzureAsyncOperationPolling, self).__init__( - operation_location_header="azure-asyncoperation" - ) + super(AzureAsyncOperationPolling, self).__init__(operation_location_header="azure-asyncoperation") self._lro_options = lro_options or {} @@ -82,14 +79,11 @@ def get_final_get_url(self, pipeline_response): :rtype: str """ if ( - self._lro_options.get(_LroOption.FINAL_STATE_VIA) - == _FinalStateViaOption.AZURE_ASYNC_OPERATION_FINAL_STATE + self._lro_options.get(_LroOption.FINAL_STATE_VIA) == _FinalStateViaOption.AZURE_ASYNC_OPERATION_FINAL_STATE and self._request.method == "POST" ): return None - return super(AzureAsyncOperationPolling, self).get_final_get_url( - pipeline_response - ) + return super(AzureAsyncOperationPolling, self).get_final_get_url(pipeline_response) class BodyContentPolling(LongRunningOperation): @@ -103,15 +97,13 @@ def __init__(self): def can_poll(self, pipeline_response): # type: (PipelineResponseType) -> bool - """Answer if this polling method could be used. - """ + """Answer if this polling method could be used.""" response = pipeline_response.http_response return response.request.method in ["PUT", "PATCH"] def get_polling_url(self): # type: () -> str - """Return the polling URL. - """ + """Return the polling URL.""" return self._initial_response.http_response.request.url def get_final_get_url(self, pipeline_response): @@ -167,9 +159,7 @@ def get_status(self, pipeline_response): """ response = pipeline_response.http_response if _is_empty(response): - raise BadResponse( - "The response from long running operation does not contain a body." - ) + raise BadResponse("The response from long running operation does not contain a body.") status = self._get_provisioning_state(response) return status or "Succeeded" @@ -177,12 +167,7 @@ def get_status(self, pipeline_response): class ARMPolling(LROBasePolling): def __init__( - self, - timeout=30, - lro_algorithms=None, - lro_options=None, - path_format_arguments=None, - **operation_config + self, timeout=30, lro_algorithms=None, lro_options=None, path_format_arguments=None, **operation_config ): lro_algorithms = lro_algorithms or [ AzureAsyncOperationPolling(lro_options=lro_options), @@ -198,8 +183,9 @@ def __init__( **operation_config ) + __all__ = [ - 'AzureAsyncOperationPolling', - 'BodyContentPolling', - 'ARMPolling', + "AzureAsyncOperationPolling", + "BodyContentPolling", + "ARMPolling", ] diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/async_arm_polling.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/async_arm_polling.py index 211322450df1..c79ea88df49d 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/async_arm_polling.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/polling/async_arm_polling.py @@ -32,4 +32,5 @@ class AsyncARMPolling(ARMPolling, AsyncLROBasePolling): pass + __all__ = ["AsyncARMPolling"] diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py index c5d8de343e22..7cbcea51436a 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py @@ -34,10 +34,7 @@ "(/providers/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)(?P.*))?" ) -_CHILDREN_RE = re.compile( - "(?i)(/providers/(?P[^/]+))?/" - "(?P[^/]*)/(?P[^/]+)" -) +_CHILDREN_RE = re.compile("(?i)(/providers/(?P[^/]+))?/" "(?P[^/]*)/(?P[^/]+)") _ARMNAME_RE = re.compile("^[^<>%&:\\?/]{1,260}$") @@ -85,12 +82,7 @@ def parse_resource_id(rid): children = _CHILDREN_RE.finditer(result["children"] or "") count = None for count, child in enumerate(children): - result.update( - { - key + "_%d" % (count + 1): group - for key, group in child.groupdict().items() - } - ) + result.update({key + "_%d" % (count + 1): group for key, group in child.groupdict().items()}) result["last_child_num"] = count + 1 if isinstance(count, int) else None result = _populate_alternate_kwargs(result) else: @@ -99,17 +91,13 @@ def parse_resource_id(rid): def _populate_alternate_kwargs(kwargs): - """ Translates the parsed arguments into a format used by generic ARM commands + """Translates the parsed arguments into a format used by generic ARM commands such as the resource and lock commands. """ resource_namespace = kwargs["namespace"] - resource_type = ( - kwargs.get("child_type_{}".format(kwargs["last_child_num"])) or kwargs["type"] - ) - resource_name = ( - kwargs.get("child_name_{}".format(kwargs["last_child_num"])) or kwargs["name"] - ) + resource_type = kwargs.get("child_type_{}".format(kwargs["last_child_num"])) or kwargs["type"] + resource_name = kwargs.get("child_name_{}".format(kwargs["last_child_num"])) or kwargs["name"] _get_parents_from_parts(kwargs) kwargs["resource_namespace"] = resource_namespace @@ -119,8 +107,7 @@ def _populate_alternate_kwargs(kwargs): def _get_parents_from_parts(kwargs): - """ Get the parents given all the children parameters. - """ + """Get the parents given all the children parameters.""" parent_builder = [] if kwargs["last_child_num"] is not None: parent_builder.append("{type}/{name}/".format(**kwargs)) @@ -129,17 +116,11 @@ def _get_parents_from_parts(kwargs): if child_namespace is not None: parent_builder.append("providers/{}/".format(child_namespace)) kwargs["child_parent_{}".format(index)] = "".join(parent_builder) - parent_builder.append( - "{{child_type_{0}}}/{{child_name_{0}}}/".format(index).format(**kwargs) - ) - child_namespace = kwargs.get( - "child_namespace_{}".format(kwargs["last_child_num"]) - ) + parent_builder.append("{{child_type_{0}}}/{{child_name_{0}}}/".format(index).format(**kwargs)) + child_namespace = kwargs.get("child_namespace_{}".format(kwargs["last_child_num"])) if child_namespace is not None: parent_builder.append("providers/{}/".format(child_namespace)) - kwargs["child_parent_{}".format(kwargs["last_child_num"])] = "".join( - parent_builder - ) + kwargs["child_parent_{}".format(kwargs["last_child_num"])] = "".join(parent_builder) kwargs["resource_parent"] = "".join(parent_builder) if kwargs["name"] else None return kwargs @@ -178,14 +159,10 @@ def resource_id(**kwargs): count = 1 while True: try: - rid_builder.append( - "providers/{{child_namespace_{}}}".format(count).format(**kwargs) - ) + rid_builder.append("providers/{{child_namespace_{}}}".format(count).format(**kwargs)) except KeyError: pass - rid_builder.append( - "{{child_type_{0}}}/{{child_name_{0}}}".format(count).format(**kwargs) - ) + rid_builder.append("{{child_type_{0}}}/{{child_name_{0}}}".format(count).format(**kwargs)) count += 1 except KeyError: pass diff --git a/sdk/core/azure-mgmt-core/setup.py b/sdk/core/azure-mgmt-core/setup.py index 9cad2b62ccab..40b05bc62615 100644 --- a/sdk/core/azure-mgmt-core/setup.py +++ b/sdk/core/azure-mgmt-core/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,55 +16,56 @@ PACKAGE_PPRINT_NAME = "Management Core" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', # type: ignore - fd.read(), re.MULTILINE).group(1) +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) # type: ignore if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, include_package_data=True, - description='Microsoft Azure {} Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-mgmt-core', + description="Microsoft Azure {} Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-mgmt-core", classifiers=[ "Development Status :: 5 - Production/Stable", - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", ], zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, install_requires=[ "azure-core<2.0.0,>=1.26.2", diff --git a/sdk/core/azure-mgmt-core/tests/asynctests/test_async_arm_polling.py b/sdk/core/azure-mgmt-core/tests/asynctests/test_async_arm_polling.py index 74150fd7009f..4bf91ab6a78b 100644 --- a/sdk/core/azure-mgmt-core/tests/asynctests/test_async_arm_polling.py +++ b/sdk/core/azure-mgmt-core/tests/asynctests/test_async_arm_polling.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import base64 import json import pickle @@ -39,11 +39,7 @@ from azure.core.pipeline import PipelineResponse, AsyncPipeline from azure.core.pipeline.transport import AsyncioRequestsTransportResponse, AsyncHttpTransport -from azure.core.polling.base_polling import ( - LongRunningOperation, - BadStatus, - LocationPolling -) +from azure.core.polling.base_polling import LongRunningOperation, BadStatus, LocationPolling from azure.mgmt.core.polling.async_arm_polling import ( AsyncARMPolling, ) @@ -66,23 +62,29 @@ def __repr__(self): def __eq__(self, other): return self.__dict__ == other.__dict__ + class BadEndpointError(Exception): pass -TEST_NAME = 'foo' -RESPONSE_BODY = {'properties':{'provisioningState': 'InProgress'}} -ASYNC_BODY = json.dumps({ 'status': 'Succeeded' }) -ASYNC_URL = 'http://dummyurlFromAzureAsyncOPHeader_Return200' -LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) -LOCATION_URL = 'http://dummyurlurlFromLocationHeader_Return200' -RESOURCE_BODY = json.dumps({ 'name': TEST_NAME }) -RESOURCE_URL = 'http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1' -ERROR = 'http://dummyurl_ReturnError' + +TEST_NAME = "foo" +RESPONSE_BODY = {"properties": {"provisioningState": "InProgress"}} +ASYNC_BODY = json.dumps({"status": "Succeeded"}) +ASYNC_URL = "http://dummyurlFromAzureAsyncOPHeader_Return200" +LOCATION_BODY = json.dumps({"name": TEST_NAME}) +LOCATION_URL = "http://dummyurlurlFromLocationHeader_Return200" +RESOURCE_BODY = json.dumps({"name": TEST_NAME}) +RESOURCE_URL = "http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1" +ERROR = "http://dummyurl_ReturnError" POLLING_STATUS = 200 CLIENT = AsyncPipelineClient("http://example.org") + + async def mock_run(client_self, request, **kwargs): return TestArmPolling.mock_update(request.url) + + CLIENT._pipeline.run = types.MethodType(mock_run, CLIENT) @@ -92,21 +94,23 @@ def async_pipeline_client_builder(): send will receive "request" and kwargs as any transport layer """ + def create_client(send_cb): class TestHttpTransport(AsyncHttpTransport): - async def open(self): pass - async def close(self): pass - async def __aexit__(self, *args, **kwargs): pass + async def open(self): + pass + + async def close(self): + pass + + async def __aexit__(self, *args, **kwargs): + pass async def send(self, request, **kwargs): return await send_cb(request, **kwargs) - return AsyncPipelineClient( - 'http://example.org/', - pipeline=AsyncPipeline( - transport=TestHttpTransport() - ) - ) + return AsyncPipelineClient("http://example.org/", pipeline=AsyncPipeline(transport=TestHttpTransport())) + return create_client @@ -114,106 +118,84 @@ async def send(self, request, **kwargs): def deserialization_cb(): def cb(pipeline_response): return json.loads(pipeline_response.http_response.text()) + return cb @pytest.mark.asyncio async def test_post(async_pipeline_client_builder, deserialization_cb): - # Test POST LRO with both Location and Azure-AsyncOperation - - # The initial response contains both Location and Azure-AsyncOperation, a 202 and no Body - initial_response = TestArmPolling.mock_send( - 'POST', - 202, - { - 'location': 'http://example.org/location', - 'azure-asyncoperation': 'http://example.org/async_monitor', - }, - '' - ) + # Test POST LRO with both Location and Azure-AsyncOperation + + # The initial response contains both Location and Azure-AsyncOperation, a 202 and no Body + initial_response = TestArmPolling.mock_send( + "POST", + 202, + { + "location": "http://example.org/location", + "azure-asyncoperation": "http://example.org/async_monitor", + }, + "", + ) + + async def send(request, **kwargs): + assert request.method == "GET" - async def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/location': - return TestArmPolling.mock_send( - 'GET', - 200, - body={'location_result': True} - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestArmPolling.mock_send( - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") - - client = async_pipeline_client_builder(send) - - # Test 1, LRO options with Location final state - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncARMPolling(0, lro_options={"final-state-via": "location"})) - result = await poll - assert result['location_result'] == True - - # Test 2, LRO options with Azure-AsyncOperation final state - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncARMPolling(0, lro_options={"final-state-via": "azure-async-operation"})) - result = await poll - assert result['status'] == 'Succeeded' - - # Test 3, "do the right thing" and use Location by default - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncARMPolling(0)) - result = await poll - assert result['location_result'] == True - - # Test 4, location has no body - - async def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/location': - return TestArmPolling.mock_send( - 'GET', - 200, - body=None - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestArmPolling.mock_send( - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") - - client = async_pipeline_client_builder(send) - - poll = async_poller( - client, - initial_response, - deserialization_cb, - AsyncARMPolling(0, lro_options={"final-state-via": "location"})) - result = await poll - assert result is None + if request.url == "http://example.org/location": + return TestArmPolling.mock_send("GET", 200, body={"location_result": True}).http_response + elif request.url == "http://example.org/async_monitor": + return TestArmPolling.mock_send("GET", 200, body={"status": "Succeeded"}).http_response + else: + pytest.fail("No other query allowed") + + client = async_pipeline_client_builder(send) + + # Test 1, LRO options with Location final state + poll = async_poller( + client, initial_response, deserialization_cb, AsyncARMPolling(0, lro_options={"final-state-via": "location"}) + ) + result = await poll + assert result["location_result"] == True + + # Test 2, LRO options with Azure-AsyncOperation final state + poll = async_poller( + client, + initial_response, + deserialization_cb, + AsyncARMPolling(0, lro_options={"final-state-via": "azure-async-operation"}), + ) + result = await poll + assert result["status"] == "Succeeded" + + # Test 3, "do the right thing" and use Location by default + poll = async_poller(client, initial_response, deserialization_cb, AsyncARMPolling(0)) + result = await poll + assert result["location_result"] == True + + # Test 4, location has no body + + async def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/location": + return TestArmPolling.mock_send("GET", 200, body=None).http_response + elif request.url == "http://example.org/async_monitor": + return TestArmPolling.mock_send("GET", 200, body={"status": "Succeeded"}).http_response + else: + pytest.fail("No other query allowed") + + client = async_pipeline_client_builder(send) + + poll = async_poller( + client, initial_response, deserialization_cb, AsyncARMPolling(0, lro_options={"final-state-via": "location"}) + ) + result = await poll + assert result is None class TestArmPolling(object): - convert = re.compile('([a-z0-9])([A-Z])') + convert = re.compile("([a-z0-9])([A-Z])") @staticmethod def mock_send(method, status, headers=None, body=RESPONSE_BODY): @@ -221,13 +203,11 @@ def mock_send(method, status, headers=None, body=RESPONSE_BODY): headers = {} response = Response() response._content_consumed = True - response._content = json.dumps(body).encode('ascii') if body is not None else None + response._content = json.dumps(body).encode("ascii") if body is not None else None response.request = Request() response.request.method = method response.request.url = RESOURCE_URL - response.request.headers = { - 'x-ms-client-request-id': '67f4dd4e-6262-45e1-8bed-5c45cf23b6d9' - } + response.request.headers = {"x-ms-client-request-id": "67f4dd4e-6262-45e1-8bed-5c45cf23b6d9"} response.status_code = status response.headers = headers response.headers.update({"content-type": "application/json; charset=utf8"}) @@ -240,7 +220,7 @@ def mock_send(method, status, headers=None, body=RESPONSE_BODY): response.request.headers, body, None, # form_content - None # stream_content + None, # stream_content ) return PipelineResponse( @@ -249,7 +229,7 @@ def mock_send(method, status, headers=None, body=RESPONSE_BODY): request, response, ), - None # context + None, # context ) @staticmethod @@ -257,7 +237,7 @@ def mock_update(url, headers=None): response = Response() response._content_consumed = True response.request = mock.create_autospec(Request) - response.request.method = 'GET' + response.request.method = "GET" response.headers = headers or {} response.headers.update({"content-type": "application/json; charset=utf8"}) response.reason = "OK" @@ -265,13 +245,13 @@ def mock_update(url, headers=None): if url == ASYNC_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = ASYNC_BODY.encode('ascii') + response._content = ASYNC_BODY.encode("ascii") response.randomFieldFromPollAsyncOpHeader = None elif url == LOCATION_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = LOCATION_BODY.encode('ascii') + response._content = LOCATION_BODY.encode("ascii") response.randomFieldFromPollLocationHeader = None elif url == ERROR: @@ -280,19 +260,19 @@ def mock_update(url, headers=None): elif url == RESOURCE_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = RESOURCE_BODY.encode('ascii') + response._content = RESOURCE_BODY.encode("ascii") else: - raise Exception('URL does not match') + raise Exception("URL does not match") request = CLIENT._request( response.request.method, response.request.url, None, # params - {}, # request has no headers - None, # Request has no body + {}, # request has no headers + None, # Request has no body None, # form_content - None # stream_content + None, # stream_content ) return PipelineResponse( @@ -301,7 +281,7 @@ def mock_update(url, headers=None): request, response, ), - None # context + None, # context ) @staticmethod @@ -312,15 +292,13 @@ def mock_outputs(pipeline_response): except ValueError: raise DecodeError("Impossible to deserialize") - body = {TestArmPolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in body.items()} - properties = body.setdefault('properties', {}) - if 'name' in body: - properties['name'] = body['name'] + body = {TestArmPolling.convert.sub(r"\1_\2", k).lower(): v for k, v in body.items()} + properties = body.setdefault("properties", {}) + if "name" in body: + properties["name"] = body["name"] if properties: - properties = {TestArmPolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in properties.items()} - del body['properties'] + properties = {TestArmPolling.convert.sub(r"\1_\2", k).lower(): v for k, v in properties.items()} + del body["properties"] body.update(properties) resource = SimpleResource(**body) else: @@ -330,230 +308,162 @@ def mock_outputs(pipeline_response): @staticmethod def mock_deserialization_no_body(pipeline_response): - """Use this mock when you don't expect a return (last body irrelevant) - """ + """Use this mock when you don't expect a return (last body irrelevant)""" return None + @pytest.mark.asyncio async def test_long_running_put(): - #TODO: Test custom header field + # TODO: Test custom header field # Test throw on non LRO related status code - response = TestArmPolling.mock_send('PUT', 1000, {}) + response = TestArmPolling.mock_send("PUT", 1000, {}) with pytest.raises(HttpResponseError): - await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test with no polling necessary - response_body = { - 'properties':{'provisioningState': 'Succeeded'}, - 'name': TEST_NAME - } - response = TestArmPolling.mock_send( - 'PUT', 201, - {}, response_body - ) + response_body = {"properties": {"provisioningState": "Succeeded"}, "name": TEST_NAME} + response = TestArmPolling.mock_send("PUT", 201, {}, response_body) + def no_update_allowed(url, headers=None): raise ValueError("Should not try to update") + polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method - ) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'azure-asyncoperation': ASYNC_URL}) + response = TestArmPolling.mock_send("PUT", 201, {"azure-asyncoperation": ASYNC_URL}) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling location header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'location': LOCATION_URL}) + response = TestArmPolling.mock_send("PUT", 201, {"location": LOCATION_URL}) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test polling initial payload invalid (SQLDb) response_body = {} # Empty will raise - response = TestArmPolling.mock_send( - 'PUT', 201, - {'location': LOCATION_URL}, response_body) + response = TestArmPolling.mock_send("PUT", 201, {"location": LOCATION_URL}, response_body) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test fail to poll from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'azure-asyncoperation': ERROR}) + response = TestArmPolling.mock_send("PUT", 201, {"azure-asyncoperation": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test fail to poll from location header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'location': ERROR}) + response = TestArmPolling.mock_send("PUT", 201, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) + @pytest.mark.asyncio async def test_long_running_patch(): # Test polling from location header response = TestArmPolling.mock_send( - 'PATCH', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", 202, {"location": LOCATION_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'PATCH', 202, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", 202, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from location header response = TestArmPolling.mock_send( - 'PATCH', 200, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", 200, {"location": LOCATION_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'PATCH', 200, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "PATCH", 200, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME - assert not hasattr(polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test fail to poll from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'PATCH', 202, - {'azure-asyncoperation': ERROR}) + response = TestArmPolling.mock_send("PATCH", 202, {"azure-asyncoperation": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test fail to poll from location header - response = TestArmPolling.mock_send( - 'PATCH', 202, - {'location': ERROR}) + response = TestArmPolling.mock_send("PATCH", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) + @pytest.mark.asyncio async def test_long_running_delete(): # Test polling from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'DELETE', 202, - {'azure-asyncoperation': ASYNC_URL}, - body="" - ) + response = TestArmPolling.mock_send("DELETE", 202, {"azure-asyncoperation": ASYNC_URL}, body="") polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_deserialization_no_body, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_deserialization_no_body, polling_method) assert poll is None assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + @pytest.mark.asyncio async def test_long_running_post(): # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'POST', 201, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "POST", 201, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_deserialization_no_body, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_deserialization_no_body, polling_method) assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'POST', 202, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "POST", 202, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_deserialization_no_body, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_deserialization_no_body, polling_method) assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None # Test polling from location header response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) + "POST", 202, {"location": LOCATION_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) polling_method = AsyncARMPolling(0) - poll = await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - polling_method) + poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None # Test fail to poll from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'POST', 202, - {'azure-asyncoperation': ERROR}) + response = TestArmPolling.mock_send("POST", 202, {"azure-asyncoperation": ERROR}) with pytest.raises(BadEndpointError): - await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test fail to poll from location header - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': ERROR}) + response = TestArmPolling.mock_send("POST", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - await async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) + @pytest.mark.asyncio async def test_long_running_negative(): @@ -561,52 +471,37 @@ async def test_long_running_negative(): global POLLING_STATUS # Test LRO PUT throws for invalid json - LOCATION_BODY = '{' - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}) - poll = async_poller( - CLIENT, - response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0) - ) + LOCATION_BODY = "{" + response = TestArmPolling.mock_send("POST", 202, {"location": LOCATION_URL}) + poll = async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) with pytest.raises(DecodeError): await poll - LOCATION_BODY = '{\'"}' - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}) - poll = async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) + LOCATION_BODY = "{'\"}" + response = TestArmPolling.mock_send("POST", 202, {"location": LOCATION_URL}) + poll = async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) with pytest.raises(DecodeError): await poll - LOCATION_BODY = '{' + LOCATION_BODY = "{" POLLING_STATUS = 203 - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}) - poll = async_poller(CLIENT, response, - TestArmPolling.mock_outputs, - AsyncARMPolling(0)) - with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization + response = TestArmPolling.mock_send("POST", 202, {"location": LOCATION_URL}) + poll = async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) + with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization await poll - assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode('ascii') + assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode("ascii") - LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) + LOCATION_BODY = json.dumps({"name": TEST_NAME}) POLLING_STATUS = 200 + def test_polling_with_path_format_arguments(): - method = AsyncARMPolling( - timeout=0, - path_format_arguments={"host": "host:3000", "accountName": "local"} - ) + method = AsyncARMPolling(timeout=0, path_format_arguments={"host": "host:3000", "accountName": "local"}) client = AsyncPipelineClient(base_url="http://{accountName}{host}") method._operation = LocationPolling() method._operation._location_url = "/results/1" method._client = client - assert "http://localhost:3000/results/1" == method._client.format_url(method._operation.get_polling_url(), **method._path_format_arguments) \ No newline at end of file + assert "http://localhost:3000/results/1" == method._client.format_url( + method._operation.get_polling_url(), **method._path_format_arguments + ) diff --git a/sdk/core/azure-mgmt-core/tests/asynctests/test_policies_async.py b/sdk/core/azure-mgmt-core/tests/asynctests/test_policies_async.py index d922594dbf1a..e8ca1123c788 100644 --- a/sdk/core/azure-mgmt-core/tests/asynctests/test_policies_async.py +++ b/sdk/core/azure-mgmt-core/tests/asynctests/test_policies_async.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) @@ -21,26 +21,28 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import ARMHttpLoggingPolicy from azure.core.configuration import Configuration + def test_default_http_logging_policy(): config = Configuration() pipeline_client = AsyncARMPipelineClient(base_url="test", config=config) http_logging_policy = pipeline_client._pipeline._impl_policies[-1]._policy assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST + def test_pass_in_http_logging_policy(): config = Configuration() http_logging_policy = ARMHttpLoggingPolicy() - http_logging_policy.allowed_header_names.update( - {"x-ms-added-header"} - ) + http_logging_policy.allowed_header_names.update({"x-ms-added-header"}) config.http_logging_policy = http_logging_policy pipeline_client = AsyncARMPipelineClient(base_url="test", config=config) http_logging_policy = pipeline_client._pipeline._impl_policies[-1]._policy - assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union({"x-ms-added-header"}) \ No newline at end of file + assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union( + {"x-ms-added-header"} + ) diff --git a/sdk/core/azure-mgmt-core/tests/conftest.py b/sdk/core/azure-mgmt-core/tests/conftest.py index 0dc30804dae2..72916d0e7601 100644 --- a/sdk/core/azure-mgmt-core/tests/conftest.py +++ b/sdk/core/azure-mgmt-core/tests/conftest.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import json import os.path import sys @@ -31,9 +31,10 @@ CWD = os.path.dirname(__file__) + def pytest_addoption(parser): - parser.addoption("--runslow", action="store_true", - default=False, help="run slow tests") + parser.addoption("--runslow", action="store_true", default=False, help="run slow tests") + def pytest_collection_modifyitems(config, items): if config.getoption("--runslow"): @@ -52,6 +53,4 @@ def user_password(): with open(filepath, "r") as fd: userpass = json.load(fd)["userpass"] return userpass["user"], userpass["password"] - raise ValueError("Create a {} file with a 'userpass' key and two keys 'user' and 'password'".format( - filepath - )) + raise ValueError("Create a {} file with a 'userpass' key and two keys 'user' and 'password'".format(filepath)) diff --git a/sdk/core/azure-mgmt-core/tests/test_arm_polling.py b/sdk/core/azure-mgmt-core/tests/test_arm_polling.py index 6e12379c5b2a..d1c6b3cda64c 100644 --- a/sdk/core/azure-mgmt-core/tests/test_arm_polling.py +++ b/sdk/core/azure-mgmt-core/tests/test_arm_polling.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import base64 import json import pickle @@ -39,15 +39,12 @@ from azure.core.pipeline import PipelineResponse, Pipeline from azure.core.pipeline.transport import RequestsTransportResponse, HttpTransport -from azure.core.polling.base_polling import ( - LongRunningOperation, - BadStatus, - LocationPolling -) +from azure.core.polling.base_polling import LongRunningOperation, BadStatus, LocationPolling from azure.mgmt.core.polling.arm_polling import ( ARMPolling, ) + class SimpleResource: """An implementation of Python 3 SimpleNamespace. Used to deserialize resource objects from response bodies where @@ -65,23 +62,29 @@ def __repr__(self): def __eq__(self, other): return self.__dict__ == other.__dict__ + class BadEndpointError(Exception): pass -TEST_NAME = 'foo' -RESPONSE_BODY = {'properties':{'provisioningState': 'InProgress'}} -ASYNC_BODY = json.dumps({ 'status': 'Succeeded' }) -ASYNC_URL = 'http://dummyurlFromAzureAsyncOPHeader_Return200' -LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) -LOCATION_URL = 'http://dummyurlurlFromLocationHeader_Return200' -RESOURCE_BODY = json.dumps({ 'name': TEST_NAME }) -RESOURCE_URL = 'http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1' -ERROR = 'http://dummyurl_ReturnError' + +TEST_NAME = "foo" +RESPONSE_BODY = {"properties": {"provisioningState": "InProgress"}} +ASYNC_BODY = json.dumps({"status": "Succeeded"}) +ASYNC_URL = "http://dummyurlFromAzureAsyncOPHeader_Return200" +LOCATION_BODY = json.dumps({"name": TEST_NAME}) +LOCATION_URL = "http://dummyurlurlFromLocationHeader_Return200" +RESOURCE_BODY = json.dumps({"name": TEST_NAME}) +RESOURCE_URL = "http://subscriptions/sub1/resourcegroups/g1/resourcetype1/resource1" +ERROR = "http://dummyurl_ReturnError" POLLING_STATUS = 200 CLIENT = PipelineClient("http://example.org") + + def mock_run(client_self, request, **kwargs): return TestArmPolling.mock_update(request.url, request.headers) + + CLIENT._pipeline.run = types.MethodType(mock_run, CLIENT) @@ -91,21 +94,23 @@ def pipeline_client_builder(): send will receive "request" and kwargs as any transport layer """ + def create_client(send_cb): class TestHttpTransport(HttpTransport): - def open(self): pass - def close(self): pass - def __exit__(self, *args, **kwargs): pass + def open(self): + pass + + def close(self): + pass + + def __exit__(self, *args, **kwargs): + pass def send(self, request, **kwargs): return send_cb(request, **kwargs) - return PipelineClient( - 'http://example.org/', - pipeline=Pipeline( - transport=TestHttpTransport() - ) - ) + return PipelineClient("http://example.org/", pipeline=Pipeline(transport=TestHttpTransport())) + return create_client @@ -113,105 +118,83 @@ def send(self, request, **kwargs): def deserialization_cb(): def cb(pipeline_response): return json.loads(pipeline_response.http_response.text()) + return cb def test_post(pipeline_client_builder, deserialization_cb): - # Test POST LRO with both Location and Azure-AsyncOperation - - # The initial response contains both Location and Azure-AsyncOperation, a 202 and no Body - initial_response = TestArmPolling.mock_send( - 'POST', - 202, - { - 'location': 'http://example.org/location', - 'azure-asyncoperation': 'http://example.org/async_monitor', - }, - '' - ) + # Test POST LRO with both Location and Azure-AsyncOperation + + # The initial response contains both Location and Azure-AsyncOperation, a 202 and no Body + initial_response = TestArmPolling.mock_send( + "POST", + 202, + { + "location": "http://example.org/location", + "azure-asyncoperation": "http://example.org/async_monitor", + }, + "", + ) + + def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/location": + return TestArmPolling.mock_send("GET", 200, body={"location_result": True}).http_response + elif request.url == "http://example.org/async_monitor": + return TestArmPolling.mock_send("GET", 200, body={"status": "Succeeded"}).http_response + else: + pytest.fail("No other query allowed") + + client = pipeline_client_builder(send) + + # Test 1, LRO options with Location final state + poll = LROPoller( + client, initial_response, deserialization_cb, ARMPolling(0, lro_options={"final-state-via": "location"}) + ) + result = poll.result() + assert result["location_result"] == True + + # Test 2, LRO options with Azure-AsyncOperation final state + poll = LROPoller( + client, + initial_response, + deserialization_cb, + ARMPolling(0, lro_options={"final-state-via": "azure-async-operation"}), + ) + result = poll.result() + assert result["status"] == "Succeeded" + + # Test 3, "do the right thing" and use Location by default + poll = LROPoller(client, initial_response, deserialization_cb, ARMPolling(0)) + result = poll.result() + assert result["location_result"] == True + + # Test 4, location has no body + + def send(request, **kwargs): + assert request.method == "GET" + + if request.url == "http://example.org/location": + return TestArmPolling.mock_send("GET", 200, body=None).http_response + elif request.url == "http://example.org/async_monitor": + return TestArmPolling.mock_send("GET", 200, body={"status": "Succeeded"}).http_response + else: + pytest.fail("No other query allowed") + + client = pipeline_client_builder(send) - def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/location': - return TestArmPolling.mock_send( - 'GET', - 200, - body={'location_result': True} - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestArmPolling.mock_send( - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") - - client = pipeline_client_builder(send) - - # Test 1, LRO options with Location final state - poll = LROPoller( - client, - initial_response, - deserialization_cb, - ARMPolling(0, lro_options={"final-state-via": "location"})) - result = poll.result() - assert result['location_result'] == True - - # Test 2, LRO options with Azure-AsyncOperation final state - poll = LROPoller( - client, - initial_response, - deserialization_cb, - ARMPolling(0, lro_options={"final-state-via": "azure-async-operation"})) - result = poll.result() - assert result['status'] == 'Succeeded' - - # Test 3, "do the right thing" and use Location by default - poll = LROPoller( - client, - initial_response, - deserialization_cb, - ARMPolling(0)) - result = poll.result() - assert result['location_result'] == True - - # Test 4, location has no body - - def send(request, **kwargs): - assert request.method == 'GET' - - if request.url == 'http://example.org/location': - return TestArmPolling.mock_send( - 'GET', - 200, - body=None - ).http_response - elif request.url == 'http://example.org/async_monitor': - return TestArmPolling.mock_send( - 'GET', - 200, - body={'status': 'Succeeded'} - ).http_response - else: - pytest.fail("No other query allowed") - - client = pipeline_client_builder(send) - - poll = LROPoller( - client, - initial_response, - deserialization_cb, - ARMPolling(0, lro_options={"final-state-via": "location"})) - result = poll.result() - assert result is None + poll = LROPoller( + client, initial_response, deserialization_cb, ARMPolling(0, lro_options={"final-state-via": "location"}) + ) + result = poll.result() + assert result is None class TestArmPolling(object): - convert = re.compile('([a-z0-9])([A-Z])') + convert = re.compile("([a-z0-9])([A-Z])") @staticmethod def mock_send(method, status, headers=None, body=RESPONSE_BODY): @@ -219,13 +202,11 @@ def mock_send(method, status, headers=None, body=RESPONSE_BODY): headers = {} response = Response() response._content_consumed = True - response._content = json.dumps(body).encode('ascii') if body is not None else None + response._content = json.dumps(body).encode("ascii") if body is not None else None response.request = Request() response.request.method = method response.request.url = RESOURCE_URL - response.request.headers = { - 'x-ms-client-request-id': '67f4dd4e-6262-45e1-8bed-5c45cf23b6d9' - } + response.request.headers = {"x-ms-client-request-id": "67f4dd4e-6262-45e1-8bed-5c45cf23b6d9"} response.status_code = status response.headers = headers response.headers.update({"content-type": "application/json; charset=utf8"}) @@ -238,7 +219,7 @@ def mock_send(method, status, headers=None, body=RESPONSE_BODY): response.request.headers, body, None, # form_content - None # stream_content + None, # stream_content ) return PipelineResponse( @@ -247,7 +228,7 @@ def mock_send(method, status, headers=None, body=RESPONSE_BODY): request, response, ), - None # context + None, # context ) @staticmethod @@ -255,7 +236,7 @@ def mock_update(url, headers=None): response = Response() response._content_consumed = True response.request = mock.create_autospec(Request) - response.request.method = 'GET' + response.request.method = "GET" response.headers = headers or {} response.headers.update({"content-type": "application/json; charset=utf8"}) response.reason = "OK" @@ -263,13 +244,13 @@ def mock_update(url, headers=None): if url == ASYNC_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = ASYNC_BODY.encode('ascii') + response._content = ASYNC_BODY.encode("ascii") response.randomFieldFromPollAsyncOpHeader = None elif url == LOCATION_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = LOCATION_BODY.encode('ascii') + response._content = LOCATION_BODY.encode("ascii") response.randomFieldFromPollLocationHeader = None elif url == ERROR: @@ -278,19 +259,19 @@ def mock_update(url, headers=None): elif url == RESOURCE_URL: response.request.url = url response.status_code = POLLING_STATUS - response._content = RESOURCE_BODY.encode('ascii') + response._content = RESOURCE_BODY.encode("ascii") else: - raise Exception('URL does not match') + raise Exception("URL does not match") request = CLIENT._request( response.request.method, response.request.url, None, # params - {}, # request has no headers - None, # Request has no body + {}, # request has no headers + None, # Request has no body None, # form_content - None # stream_content + None, # stream_content ) return PipelineResponse( @@ -299,7 +280,7 @@ def mock_update(url, headers=None): request, response, ), - None # context + None, # context ) @staticmethod @@ -311,15 +292,13 @@ def mock_outputs(pipeline_response): raise DecodeError("Impossible to deserialize") body = json.loads(response.text()) - body = {TestArmPolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in body.items()} - properties = body.setdefault('properties', {}) - if 'name' in body: - properties['name'] = body['name'] + body = {TestArmPolling.convert.sub(r"\1_\2", k).lower(): v for k, v in body.items()} + properties = body.setdefault("properties", {}) + if "name" in body: + properties["name"] = body["name"] if properties: - properties = {TestArmPolling.convert.sub(r'\1_\2', k).lower(): v - for k, v in properties.items()} - del body['properties'] + properties = {TestArmPolling.convert.sub(r"\1_\2", k).lower(): v for k, v in properties.items()} + del body["properties"] body.update(properties) resource = SimpleResource(**body) else: @@ -329,270 +308,204 @@ def mock_outputs(pipeline_response): @staticmethod def mock_deserialization_no_body(pipeline_response): - """Use this mock when you don't expect a return (last body irrelevant) - """ + """Use this mock when you don't expect a return (last body irrelevant)""" return None def test_long_running_put(self): - #TODO: Test custom header field + # TODO: Test custom header field # Test throw on non LRO related status code - response = TestArmPolling.mock_send('PUT', 1000, {}) + response = TestArmPolling.mock_send("PUT", 1000, {}) with pytest.raises(HttpResponseError): - LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)).result() + LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)).result() # Test with no polling necessary - response_body = { - 'properties':{'provisioningState': 'Succeeded'}, - 'name': TEST_NAME - } - response = TestArmPolling.mock_send( - 'PUT', 201, - {}, response_body - ) + response_body = {"properties": {"provisioningState": "Succeeded"}, "name": TEST_NAME} + response = TestArmPolling.mock_send("PUT", 201, {}, response_body) + def no_update_allowed(url, headers=None): raise ValueError("Should not try to update") - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0) - ) + + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'azure-asyncoperation': ASYNC_URL}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + response = TestArmPolling.mock_send("PUT", 201, {"azure-asyncoperation": ASYNC_URL}) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling location header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'location': LOCATION_URL}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + response = TestArmPolling.mock_send("PUT", 201, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test polling initial payload invalid (SQLDb) response_body = {} # Empty will raise - response = TestArmPolling.mock_send( - 'PUT', 201, - {'location': LOCATION_URL}, response_body) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + response = TestArmPolling.mock_send("PUT", 201, {"location": LOCATION_URL}, response_body) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test fail to poll from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'azure-asyncoperation': ERROR}) + response = TestArmPolling.mock_send("PUT", 201, {"azure-asyncoperation": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)).result() + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)).result() # Test fail to poll from location header - response = TestArmPolling.mock_send( - 'PUT', 201, - {'location': ERROR}) + response = TestArmPolling.mock_send("PUT", 201, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)).result() + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)).result() def test_long_running_patch(self): # Test polling from location header response = TestArmPolling.mock_send( - 'PATCH', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + "PATCH", 202, {"location": LOCATION_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'PATCH', 202, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + "PATCH", 202, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test polling from location header response = TestArmPolling.mock_send( - 'PATCH', 200, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + "PATCH", 200, {"location": LOCATION_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'PATCH', 200, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + "PATCH", 200, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert not hasattr(poll._polling_method._pipeline_response, 'randomFieldFromPollAsyncOpHeader') + assert not hasattr(poll._polling_method._pipeline_response, "randomFieldFromPollAsyncOpHeader") # Test fail to poll from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'PATCH', 202, - {'azure-asyncoperation': ERROR}) + response = TestArmPolling.mock_send("PATCH", 202, {"azure-asyncoperation": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)).result() + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)).result() # Test fail to poll from location header - response = TestArmPolling.mock_send( - 'PATCH', 202, - {'location': ERROR}) + response = TestArmPolling.mock_send("PATCH", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)).result() + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)).result() def test_long_running_delete(self): # Test polling from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'DELETE', 202, - {'azure-asyncoperation': ASYNC_URL}, - body="" - ) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + response = TestArmPolling.mock_send("DELETE", 202, {"azure-asyncoperation": ASYNC_URL}, body="") + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) poll.wait() - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader + is None + ) def test_long_running_post_legacy(self): # Former oooooold tests to refactor one day to something more readble # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'POST', 201, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_deserialization_no_body, - ARMPolling(0)) + "POST", 201, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_deserialization_no_body, ARMPolling(0)) poll.wait() - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader + is None + ) # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( - 'POST', 202, - {'azure-asyncoperation': ASYNC_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_deserialization_no_body, - ARMPolling(0)) + "POST", 202, {"azure-asyncoperation": ASYNC_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_deserialization_no_body, ARMPolling(0)) poll.wait() - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollAsyncOpHeader + is None + ) # Test polling from location header response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}, - body={'properties':{'provisioningState': 'Succeeded'}}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + "POST", 202, {"location": LOCATION_URL}, body={"properties": {"provisioningState": "Succeeded"}} + ) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) assert poll.result().name == TEST_NAME - assert poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader is None + assert ( + poll._polling_method._pipeline_response.http_response.internal_response.randomFieldFromPollLocationHeader + is None + ) # Test fail to poll from azure-asyncoperation header - response = TestArmPolling.mock_send( - 'POST', 202, - {'azure-asyncoperation': ERROR}) + response = TestArmPolling.mock_send("POST", 202, {"azure-asyncoperation": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)).result() + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)).result() # Test fail to poll from location header - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': ERROR}) + response = TestArmPolling.mock_send("POST", 202, {"location": ERROR}) with pytest.raises(BadEndpointError): - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)).result() + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)).result() def test_long_running_negative(self): global LOCATION_BODY global POLLING_STATUS # Test LRO PUT throws for invalid json - LOCATION_BODY = '{' - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}) - poll = LROPoller( - CLIENT, - response, - TestArmPolling.mock_outputs, - ARMPolling(0) - ) + LOCATION_BODY = "{" + response = TestArmPolling.mock_send("POST", 202, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) with pytest.raises(DecodeError): poll.result() - LOCATION_BODY = '{\'"}' - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) + LOCATION_BODY = "{'\"}" + response = TestArmPolling.mock_send("POST", 202, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) with pytest.raises(DecodeError): poll.result() - LOCATION_BODY = '{' + LOCATION_BODY = "{" POLLING_STATUS = 203 - response = TestArmPolling.mock_send( - 'POST', 202, - {'location': LOCATION_URL}) - poll = LROPoller(CLIENT, response, - TestArmPolling.mock_outputs, - ARMPolling(0)) - with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization + response = TestArmPolling.mock_send("POST", 202, {"location": LOCATION_URL}) + poll = LROPoller(CLIENT, response, TestArmPolling.mock_outputs, ARMPolling(0)) + with pytest.raises(HttpResponseError) as error: # TODO: Node.js raises on deserialization poll.result() - assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode('ascii') + assert error.value.continuation_token == base64.b64encode(pickle.dumps(response)).decode("ascii") - LOCATION_BODY = json.dumps({ 'name': TEST_NAME }) + LOCATION_BODY = json.dumps({"name": TEST_NAME}) POLLING_STATUS = 200 def test_polling_with_path_format_arguments(self): - method = ARMPolling( - timeout=0, - path_format_arguments={"host": "host:3000", "accountName": "local"} - ) + method = ARMPolling(timeout=0, path_format_arguments={"host": "host:3000", "accountName": "local"}) client = PipelineClient(base_url="http://{accountName}{host}") method._operation = LocationPolling() method._operation._location_url = "/results/1" method._client = client - assert "http://localhost:3000/results/1" == method._client.format_url(method._operation.get_polling_url(), **method._path_format_arguments) - + assert "http://localhost:3000/results/1" == method._client.format_url( + method._operation.get_polling_url(), **method._path_format_arguments + ) diff --git a/sdk/core/azure-mgmt-core/tests/test_authentication.py b/sdk/core/azure-mgmt-core/tests/test_authentication.py index 7a4b5bfa1111..c1f3590e5050 100644 --- a/sdk/core/azure-mgmt-core/tests/test_authentication.py +++ b/sdk/core/azure-mgmt-core/tests/test_authentication.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import base64 import time diff --git a/sdk/core/azure-mgmt-core/tests/test_mgmt_exceptions.py b/sdk/core/azure-mgmt-core/tests/test_mgmt_exceptions.py index 8e1e40a1c3c8..457434917113 100644 --- a/sdk/core/azure-mgmt-core/tests/test_mgmt_exceptions.py +++ b/sdk/core/azure-mgmt-core/tests/test_mgmt_exceptions.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import functools import json @@ -34,12 +34,13 @@ ARMError = functools.partial(HttpResponseError, error_format=ARMErrorFormat) + def _build_response(json_body): class MockResponse(_HttpResponseBase): def __init__(self): super(MockResponse, self).__init__( request=None, - internal_response = None, + internal_response=None, ) self.status_code = 400 self.reason = "Bad Request" @@ -66,26 +67,17 @@ def test_arm_exception(): "message": "$search query option not supported", } ], - "innererror": { - "customKey": "customValue" - }, - "additionalInfo": [ - { - "type": "SomeErrorType", - "info": { - "customKey": "customValue" - } - } - ] + "innererror": {"customKey": "customValue"}, + "additionalInfo": [{"type": "SomeErrorType", "info": {"customKey": "customValue"}}], } } cloud_exp = ARMError(response=_build_response(json.dumps(message).encode("utf-8"))) - assert cloud_exp.error.target == 'query' - assert cloud_exp.error.details[0].target == '$search' - assert cloud_exp.error.innererror['customKey'] == 'customValue' - assert cloud_exp.error.additional_info[0].type == 'SomeErrorType' - assert cloud_exp.error.additional_info[0].info['customKey'] == 'customValue' - assert 'customValue' in str(cloud_exp) + assert cloud_exp.error.target == "query" + assert cloud_exp.error.details[0].target == "$search" + assert cloud_exp.error.innererror["customKey"] == "customValue" + assert cloud_exp.error.additional_info[0].type == "SomeErrorType" + assert cloud_exp.error.additional_info[0].info["customKey"] == "customValue" + assert "customValue" in str(cloud_exp) message = { "error": { @@ -102,60 +94,58 @@ def test_arm_exception(): "type": "PolicyViolation", "info": { "policyDefinitionDisplayName": "Allowed locations", - "policyAssignmentParameters": { - "listOfAllowedLocations": { - "value": [ - "westus" - ] - } - } - } + "policyAssignmentParameters": {"listOfAllowedLocations": {"value": ["westus"]}}, + }, } - ] + ], } ], - "additionalInfo": [ - { - "type": "SomeErrorType", - "info": { - "customKey": "customValue" - } - } - ] + "additionalInfo": [{"type": "SomeErrorType", "info": {"customKey": "customValue"}}], } } cloud_exp = ARMError(response=_build_response(json.dumps(message).encode("utf-8"))) - assert cloud_exp.error.target == 'query' - assert cloud_exp.error.details[0].target == '$search' - assert cloud_exp.error.additional_info[0].type == 'SomeErrorType' - assert cloud_exp.error.additional_info[0].info['customKey'] == 'customValue' - assert cloud_exp.error.details[0].additional_info[0].type == 'PolicyViolation' - assert cloud_exp.error.details[0].additional_info[0].info['policyDefinitionDisplayName'] == 'Allowed locations' - assert cloud_exp.error.details[0].additional_info[0].info['policyAssignmentParameters']['listOfAllowedLocations']['value'][0] == 'westus' - assert 'customValue' in str(cloud_exp) - + assert cloud_exp.error.target == "query" + assert cloud_exp.error.details[0].target == "$search" + assert cloud_exp.error.additional_info[0].type == "SomeErrorType" + assert cloud_exp.error.additional_info[0].info["customKey"] == "customValue" + assert cloud_exp.error.details[0].additional_info[0].type == "PolicyViolation" + assert cloud_exp.error.details[0].additional_info[0].info["policyDefinitionDisplayName"] == "Allowed locations" + assert ( + cloud_exp.error.details[0] + .additional_info[0] + .info["policyAssignmentParameters"]["listOfAllowedLocations"]["value"][0] + == "westus" + ) + assert "customValue" in str(cloud_exp) error = ARMError(response=_build_response(b"{{")) assert "Bad Request" in error.message - error = ARMError(response=_build_response(b'{"error":{"code":"Conflict","message":"The maximum number of Free ServerFarms allowed in a Subscription is 10.","target":null,"details":[{"message":"The maximum number of Free ServerFarms allowed in a Subscription is 10."},{"code":"Conflict"},{"errorentity":{"code":"Conflict","message":"The maximum number of Free ServerFarms allowed in a Subscription is 10.","extendedCode":"59301","messageTemplate":"The maximum number of {0} ServerFarms allowed in a Subscription is {1}.","parameters":["Free","10"],"innerErrors":null}}],"innererror":null}}')) - assert error.error.code == "Conflict" - - message = json.dumps({ - "error": { - "code": "BadArgument", - "message": "The provided database 'foo' has an invalid username.", - "target": "query", - "details": [ - { - "code": "301", - "target": "$search", - "message": "$search query option not supported", - } - ] - }}).encode('utf-8') + error = ARMError( + response=_build_response( + b'{"error":{"code":"Conflict","message":"The maximum number of Free ServerFarms allowed in a Subscription is 10.","target":null,"details":[{"message":"The maximum number of Free ServerFarms allowed in a Subscription is 10."},{"code":"Conflict"},{"errorentity":{"code":"Conflict","message":"The maximum number of Free ServerFarms allowed in a Subscription is 10.","extendedCode":"59301","messageTemplate":"The maximum number of {0} ServerFarms allowed in a Subscription is {1}.","parameters":["Free","10"],"innerErrors":null}}],"innererror":null}}' + ) + ) + assert error.error.code == "Conflict" + + message = json.dumps( + { + "error": { + "code": "BadArgument", + "message": "The provided database 'foo' has an invalid username.", + "target": "query", + "details": [ + { + "code": "301", + "target": "$search", + "message": "$search query option not supported", + } + ], + } + } + ).encode("utf-8") error = ARMError(response=_build_response(message)) - assert error.error.code == "BadArgument" + assert error.error.code == "BadArgument" # See https://github.com/Azure/msrestazure-for-python/issues/54 response_text = b'"{\\"error\\": {\\"code\\": \\"ResourceGroupNotFound\\", \\"message\\": \\"Resource group \'res_grp\' could not be found.\\"}}"' diff --git a/sdk/core/azure-mgmt-core/tests/test_policies.py b/sdk/core/azure-mgmt-core/tests/test_policies.py index 5a9b4b972448..b70897f0f403 100644 --- a/sdk/core/azure-mgmt-core/tests/test_policies.py +++ b/sdk/core/azure-mgmt-core/tests/test_policies.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) @@ -21,7 +21,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import json import time @@ -37,16 +37,15 @@ ) from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ( - ARMAutoResourceProviderRegistrationPolicy, - ARMHttpLoggingPolicy -) +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy, ARMHttpLoggingPolicy + @pytest.fixture def sleepless(monkeypatch): def sleep(_): pass - monkeypatch.setattr(time, 'sleep', sleep) + + monkeypatch.setattr(time, "sleep", sleep) @httpretty.activate @@ -59,51 +58,55 @@ def test_register_rp_policy(): - We call again the first endpoint and this time this succeed """ - provider_url = ("https://management.azure.com/" - "subscriptions/12345678-9abc-def0-0000-000000000000/" - "resourceGroups/clitest.rg000001/" - "providers/Microsoft.Sql/servers/ygserver123?api-version=2014-04-01") + provider_url = ( + "https://management.azure.com/" + "subscriptions/12345678-9abc-def0-0000-000000000000/" + "resourceGroups/clitest.rg000001/" + "providers/Microsoft.Sql/servers/ygserver123?api-version=2014-04-01" + ) - provider_error = ('{"error":{"code":"MissingSubscriptionRegistration", ' - '"message":"The subscription registration is in \'Unregistered\' state. ' - 'The subscription must be registered to use namespace \'Microsoft.Sql\'. ' - 'See https://aka.ms/rps-not-found for how to register subscriptions."}}') + provider_error = ( + '{"error":{"code":"MissingSubscriptionRegistration", ' + '"message":"The subscription registration is in \'Unregistered\' state. ' + "The subscription must be registered to use namespace 'Microsoft.Sql'. " + 'See https://aka.ms/rps-not-found for how to register subscriptions."}}' + ) provider_success = '{"success": true}' - httpretty.register_uri(httpretty.PUT, - provider_url, - responses=[ - httpretty.Response(body=provider_error, status=409), - httpretty.Response(body=provider_success), - ], - content_type="application/json") + httpretty.register_uri( + httpretty.PUT, + provider_url, + responses=[ + httpretty.Response(body=provider_error, status=409), + httpretty.Response(body=provider_success), + ], + content_type="application/json", + ) - register_post_url = ("https://management.azure.com/" - "subscriptions/12345678-9abc-def0-0000-000000000000/" - "providers/Microsoft.Sql/register?api-version=2016-02-01") + register_post_url = ( + "https://management.azure.com/" + "subscriptions/12345678-9abc-def0-0000-000000000000/" + "providers/Microsoft.Sql/register?api-version=2016-02-01" + ) - register_post_result = { - "registrationState":"Registering" - } + register_post_result = {"registrationState": "Registering"} - register_get_url = ("https://management.azure.com/" - "subscriptions/12345678-9abc-def0-0000-000000000000/" - "providers/Microsoft.Sql?api-version=2016-02-01") + register_get_url = ( + "https://management.azure.com/" + "subscriptions/12345678-9abc-def0-0000-000000000000/" + "providers/Microsoft.Sql?api-version=2016-02-01" + ) - register_get_result = { - "registrationState":"Registered" - } + register_get_result = {"registrationState": "Registered"} - httpretty.register_uri(httpretty.POST, - register_post_url, - body=json.dumps(register_post_result), - content_type="application/json") + httpretty.register_uri( + httpretty.POST, register_post_url, body=json.dumps(register_post_result), content_type="application/json" + ) - httpretty.register_uri(httpretty.GET, - register_get_url, - body=json.dumps(register_get_result), - content_type="application/json") + httpretty.register_uri( + httpretty.GET, register_get_url, body=json.dumps(register_get_result), content_type="application/json" + ) request = HttpRequest("PUT", provider_url) policies = [ @@ -112,7 +115,7 @@ def test_register_rp_policy(): with Pipeline(RequestsTransport(), policies=policies) as pipeline: response = pipeline.run(request) - assert json.loads(response.http_response.text())['success'] + assert json.loads(response.http_response.text())["success"] @httpretty.activate @@ -124,34 +127,39 @@ def test_register_failed_policy(): - This POST failed """ - provider_url = ("https://management.azure.com/" - "subscriptions/12345678-9abc-def0-0000-000000000000/" - "resourceGroups/clitest.rg000001/" - "providers/Microsoft.Sql/servers/ygserver123?api-version=2014-04-01") + provider_url = ( + "https://management.azure.com/" + "subscriptions/12345678-9abc-def0-0000-000000000000/" + "resourceGroups/clitest.rg000001/" + "providers/Microsoft.Sql/servers/ygserver123?api-version=2014-04-01" + ) - provider_error = ('{"error":{"code":"MissingSubscriptionRegistration", ' - '"message":"The subscription registration is in \'Unregistered\' state. ' - 'The subscription must be registered to use namespace \'Microsoft.Sql\'. ' - 'See https://aka.ms/rps-not-found for how to register subscriptions."}}') + provider_error = ( + '{"error":{"code":"MissingSubscriptionRegistration", ' + '"message":"The subscription registration is in \'Unregistered\' state. ' + "The subscription must be registered to use namespace 'Microsoft.Sql'. " + 'See https://aka.ms/rps-not-found for how to register subscriptions."}}' + ) provider_success = '{"success": true}' - httpretty.register_uri(httpretty.PUT, - provider_url, - responses=[ - httpretty.Response(body=provider_error, status=409), - httpretty.Response(body=provider_success), - ], - content_type="application/json") + httpretty.register_uri( + httpretty.PUT, + provider_url, + responses=[ + httpretty.Response(body=provider_error, status=409), + httpretty.Response(body=provider_success), + ], + content_type="application/json", + ) - register_post_url = ("https://management.azure.com/" - "subscriptions/12345678-9abc-def0-0000-000000000000/" - "providers/Microsoft.Sql/register?api-version=2016-02-01") + register_post_url = ( + "https://management.azure.com/" + "subscriptions/12345678-9abc-def0-0000-000000000000/" + "providers/Microsoft.Sql/register?api-version=2016-02-01" + ) - httpretty.register_uri(httpretty.POST, - register_post_url, - status=409, - content_type="application/json") + httpretty.register_uri(httpretty.POST, register_post_url, status=409, content_type="application/json") request = HttpRequest("PUT", provider_url) policies = [ @@ -162,6 +170,7 @@ def test_register_failed_policy(): assert response.http_response.status_code == 409 + def test_default_http_logging_policy(): config = Configuration() pipeline_client = ARMPipelineClient(base_url="test", config=config) @@ -169,15 +178,18 @@ def test_default_http_logging_policy(): assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST + def test_pass_in_http_logging_policy(): config = Configuration() http_logging_policy = ARMHttpLoggingPolicy() - http_logging_policy.allowed_header_names.update( - {"x-ms-added-header"} - ) + http_logging_policy.allowed_header_names.update({"x-ms-added-header"}) config.http_logging_policy = http_logging_policy pipeline_client = ARMPipelineClient(base_url="test", config=config) http_logging_policy = pipeline_client._pipeline._impl_policies[-1]._policy - assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union({"x-ms-added-header"}) - assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union({"x-ms-added-header"}) \ No newline at end of file + assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union( + {"x-ms-added-header"} + ) + assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union( + {"x-ms-added-header"} + ) diff --git a/sdk/core/azure-mgmt-core/tests/test_tools.py b/sdk/core/azure-mgmt-core/tests/test_tools.py index 831bf9b4835c..ba762da0066d 100644 --- a/sdk/core/azure-mgmt-core/tests/test_tools.py +++ b/sdk/core/azure-mgmt-core/tests/test_tools.py @@ -1,4 +1,4 @@ -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) @@ -21,351 +21,333 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import unittest from azure.mgmt.core.tools import parse_resource_id, is_valid_resource_id, resource_id, is_valid_resource_name -class TestTools(unittest.TestCase): +class TestTools(unittest.TestCase): def test_resource_parse(self): """ Tests resource id parsing, reforming, and validation. """ tests = [ { - 'resource_id': '/subscriptions/fakesub/resourcegroups/testgroup/providers' - '/Microsoft.Storage/storageAccounts/foo/providers' - '/Microsoft.Authorization/locks/bar', - 'expected': { - 'name': 'foo', - 'type': 'storageAccounts', - 'namespace': 'Microsoft.Storage', - 'child_name_1': 'bar', - 'child_namespace_1': 'Microsoft.Authorization', - 'child_type_1': 'locks', - 'child_parent_1': 'storageAccounts/foo/providers/Microsoft.Authorization/', - 'resource_group': 'testgroup', - 'subscription': 'fakesub', - } + "resource_id": "/subscriptions/fakesub/resourcegroups/testgroup/providers" + "/Microsoft.Storage/storageAccounts/foo/providers" + "/Microsoft.Authorization/locks/bar", + "expected": { + "name": "foo", + "type": "storageAccounts", + "namespace": "Microsoft.Storage", + "child_name_1": "bar", + "child_namespace_1": "Microsoft.Authorization", + "child_type_1": "locks", + "child_parent_1": "storageAccounts/foo/providers/Microsoft.Authorization/", + "resource_group": "testgroup", + "subscription": "fakesub", + }, }, { - 'resource_id': '/subscriptions/fakesub/resourcegroups/testgroup/providers' - '/Microsoft.Storage/storageAccounts/foo' - '/locks/bar', - 'expected': { - 'name': 'foo', - 'type': 'storageAccounts', - 'namespace': 'Microsoft.Storage', - 'child_name_1': 'bar', - 'child_type_1': 'locks', - 'child_parent_1': 'storageAccounts/foo/', - 'resource_group': 'testgroup', - 'subscription': 'fakesub', - } + "resource_id": "/subscriptions/fakesub/resourcegroups/testgroup/providers" + "/Microsoft.Storage/storageAccounts/foo" + "/locks/bar", + "expected": { + "name": "foo", + "type": "storageAccounts", + "namespace": "Microsoft.Storage", + "child_name_1": "bar", + "child_type_1": "locks", + "child_parent_1": "storageAccounts/foo/", + "resource_group": "testgroup", + "subscription": "fakesub", + }, }, { - 'resource_id': '/subscriptions/fakesub/resourcegroups/testgroup/providers' - '/Microsoft.Storage/storageAccounts/foo/providers' - '/Microsoft.Authorization/locks/bar/providers/Microsoft.Network/' - 'nets/gc', - 'expected': { - 'name': 'foo', - 'type': 'storageAccounts', - 'namespace': 'Microsoft.Storage', - 'child_name_1': 'bar', - 'child_namespace_1': 'Microsoft.Authorization', - 'child_type_1': 'locks', - 'child_parent_1': 'storageAccounts/foo/providers/Microsoft.Authorization/', - 'child_name_2': 'gc', - 'child_namespace_2': 'Microsoft.Network', - 'child_type_2': 'nets', - 'child_parent_2': 'storageAccounts/foo/providers/Microsoft.Authorization/' - 'locks/bar/providers/Microsoft.Network/', - 'resource_group': 'testgroup', - 'subscription': 'fakesub', - } + "resource_id": "/subscriptions/fakesub/resourcegroups/testgroup/providers" + "/Microsoft.Storage/storageAccounts/foo/providers" + "/Microsoft.Authorization/locks/bar/providers/Microsoft.Network/" + "nets/gc", + "expected": { + "name": "foo", + "type": "storageAccounts", + "namespace": "Microsoft.Storage", + "child_name_1": "bar", + "child_namespace_1": "Microsoft.Authorization", + "child_type_1": "locks", + "child_parent_1": "storageAccounts/foo/providers/Microsoft.Authorization/", + "child_name_2": "gc", + "child_namespace_2": "Microsoft.Network", + "child_type_2": "nets", + "child_parent_2": "storageAccounts/foo/providers/Microsoft.Authorization/" + "locks/bar/providers/Microsoft.Network/", + "resource_group": "testgroup", + "subscription": "fakesub", + }, }, { - 'resource_id': '/subscriptions/fakesub/resourcegroups/testgroup/providers' - '/Microsoft.Storage/storageAccounts/foo' - '/locks/bar/nets/gc', - 'expected': { - 'name': 'foo', - 'type': 'storageAccounts', - 'namespace': 'Microsoft.Storage', - 'child_name_1': 'bar', - 'child_type_1': 'locks', - 'child_parent_1': 'storageAccounts/foo/', - 'child_name_2': 'gc', - 'child_type_2': 'nets', - 'child_parent_2': 'storageAccounts/foo/locks/bar/', - 'resource_group': 'testgroup', - 'subscription': 'fakesub', - } + "resource_id": "/subscriptions/fakesub/resourcegroups/testgroup/providers" + "/Microsoft.Storage/storageAccounts/foo" + "/locks/bar/nets/gc", + "expected": { + "name": "foo", + "type": "storageAccounts", + "namespace": "Microsoft.Storage", + "child_name_1": "bar", + "child_type_1": "locks", + "child_parent_1": "storageAccounts/foo/", + "child_name_2": "gc", + "child_type_2": "nets", + "child_parent_2": "storageAccounts/foo/locks/bar/", + "resource_group": "testgroup", + "subscription": "fakesub", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg/providers/' - 'Microsoft.Provider1/resourceType1/name1', - 'expected': { - 'subscription': 'mySub', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.Provider1', - 'type': 'resourceType1', - 'name': 'name1', - 'resource_parent': '', - 'resource_namespace': 'Microsoft.Provider1', - 'resource_type': 'resourceType1', - 'resource_name': 'name1' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg/providers/" + "Microsoft.Provider1/resourceType1/name1", + "expected": { + "subscription": "mySub", + "resource_group": "myRg", + "namespace": "Microsoft.Provider1", + "type": "resourceType1", + "name": "name1", + "resource_parent": "", + "resource_namespace": "Microsoft.Provider1", + "resource_type": "resourceType1", + "resource_name": "name1", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg/providers/' - 'Microsoft.Provider1/resourceType1/name1/resourceType2/name2', - 'expected': { - 'subscription': 'mySub', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.Provider1', - 'type': 'resourceType1', - 'name': 'name1', - 'child_namespace_1': None, - 'child_type_1': 'resourceType2', - 'child_name_1': 'name2', - 'child_parent_1': 'resourceType1/name1/', - 'resource_parent': 'resourceType1/name1/', - 'resource_namespace': 'Microsoft.Provider1', - 'resource_type': 'resourceType2', - 'resource_name': 'name2' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg/providers/" + "Microsoft.Provider1/resourceType1/name1/resourceType2/name2", + "expected": { + "subscription": "mySub", + "resource_group": "myRg", + "namespace": "Microsoft.Provider1", + "type": "resourceType1", + "name": "name1", + "child_namespace_1": None, + "child_type_1": "resourceType2", + "child_name_1": "name2", + "child_parent_1": "resourceType1/name1/", + "resource_parent": "resourceType1/name1/", + "resource_namespace": "Microsoft.Provider1", + "resource_type": "resourceType2", + "resource_name": "name2", + }, }, { - 'resource_id': '/subscriptions/00000/resourceGroups/myRg/providers/' - 'Microsoft.RecoveryServices/vaults/vault_name/backupFabrics/' - 'fabric_name/protectionContainers/container_name/' - 'protectedItems/item_name/recoveryPoint/recovery_point_guid', - 'expected': { - 'subscription': '00000', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.RecoveryServices', - 'type': 'vaults', - 'name': 'vault_name', - 'child_type_1': 'backupFabrics', - 'child_name_1': 'fabric_name', - 'child_parent_1': 'vaults/vault_name/', - 'child_type_2': 'protectionContainers', - 'child_name_2': 'container_name', - 'child_parent_2': 'vaults/vault_name/backupFabrics/fabric_name/', - 'child_type_3': 'protectedItems', - 'child_name_3': 'item_name', - 'child_parent_3': 'vaults/vault_name/backupFabrics/fabric_name/' - 'protectionContainers/container_name/', - 'child_type_4': 'recoveryPoint', - 'child_name_4': 'recovery_point_guid', - 'child_parent_4': 'vaults/vault_name/backupFabrics/fabric_name/' - 'protectionContainers/container_name/protectedItems/' - 'item_name/', - 'resource_parent': 'vaults/vault_name/backupFabrics/fabric_name/' - 'protectionContainers/container_name/protectedItems/' - 'item_name/', - 'resource_namespace': 'Microsoft.RecoveryServices', - 'resource_type': 'recoveryPoint', - 'resource_name': 'recovery_point_guid' - } + "resource_id": "/subscriptions/00000/resourceGroups/myRg/providers/" + "Microsoft.RecoveryServices/vaults/vault_name/backupFabrics/" + "fabric_name/protectionContainers/container_name/" + "protectedItems/item_name/recoveryPoint/recovery_point_guid", + "expected": { + "subscription": "00000", + "resource_group": "myRg", + "namespace": "Microsoft.RecoveryServices", + "type": "vaults", + "name": "vault_name", + "child_type_1": "backupFabrics", + "child_name_1": "fabric_name", + "child_parent_1": "vaults/vault_name/", + "child_type_2": "protectionContainers", + "child_name_2": "container_name", + "child_parent_2": "vaults/vault_name/backupFabrics/fabric_name/", + "child_type_3": "protectedItems", + "child_name_3": "item_name", + "child_parent_3": "vaults/vault_name/backupFabrics/fabric_name/" + "protectionContainers/container_name/", + "child_type_4": "recoveryPoint", + "child_name_4": "recovery_point_guid", + "child_parent_4": "vaults/vault_name/backupFabrics/fabric_name/" + "protectionContainers/container_name/protectedItems/" + "item_name/", + "resource_parent": "vaults/vault_name/backupFabrics/fabric_name/" + "protectionContainers/container_name/protectedItems/" + "item_name/", + "resource_namespace": "Microsoft.RecoveryServices", + "resource_type": "recoveryPoint", + "resource_name": "recovery_point_guid", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg/providers/' - 'Microsoft.Provider1/resourceType1/name1/resourceType2/name2/' - 'providers/Microsoft.Provider3/resourceType3/name3', - 'expected': { - 'subscription': 'mySub', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.Provider1', - 'type': 'resourceType1', - 'name': 'name1', - 'child_namespace_1': None, - 'child_type_1': 'resourceType2', - 'child_name_1': 'name2', - 'child_parent_1' : 'resourceType1/name1/', - 'child_namespace_2': 'Microsoft.Provider3', - 'child_type_2': 'resourceType3', - 'child_name_2': 'name3', - 'child_parent_2': 'resourceType1/name1/resourceType2/name2/' - 'providers/Microsoft.Provider3/', - 'resource_parent': 'resourceType1/name1/resourceType2/name2/' - 'providers/Microsoft.Provider3/', - 'resource_namespace': 'Microsoft.Provider1', - 'resource_type': 'resourceType3', - 'resource_name': 'name3' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg/providers/" + "Microsoft.Provider1/resourceType1/name1/resourceType2/name2/" + "providers/Microsoft.Provider3/resourceType3/name3", + "expected": { + "subscription": "mySub", + "resource_group": "myRg", + "namespace": "Microsoft.Provider1", + "type": "resourceType1", + "name": "name1", + "child_namespace_1": None, + "child_type_1": "resourceType2", + "child_name_1": "name2", + "child_parent_1": "resourceType1/name1/", + "child_namespace_2": "Microsoft.Provider3", + "child_type_2": "resourceType3", + "child_name_2": "name3", + "child_parent_2": "resourceType1/name1/resourceType2/name2/" "providers/Microsoft.Provider3/", + "resource_parent": "resourceType1/name1/resourceType2/name2/" "providers/Microsoft.Provider3/", + "resource_namespace": "Microsoft.Provider1", + "resource_type": "resourceType3", + "resource_name": "name3", + }, }, { - 'resource_id': '/subscriptions/fakesub/providers/Microsoft.Authorization' - '/locks/foo', - 'expected': { - 'name': 'foo', - 'type': 'locks', - 'namespace': 'Microsoft.Authorization', - 'subscription': 'fakesub', - } + "resource_id": "/subscriptions/fakesub/providers/Microsoft.Authorization" "/locks/foo", + "expected": { + "name": "foo", + "type": "locks", + "namespace": "Microsoft.Authorization", + "subscription": "fakesub", + }, }, { - 'resource_id': '/Subscriptions/fakesub/providers/Microsoft.Authorization' - '/locks/foo', - 'expected': { - 'name': 'foo', - 'type': 'locks', - 'namespace': 'Microsoft.Authorization', - 'subscription': 'fakesub', - } + "resource_id": "/Subscriptions/fakesub/providers/Microsoft.Authorization" "/locks/foo", + "expected": { + "name": "foo", + "type": "locks", + "namespace": "Microsoft.Authorization", + "subscription": "fakesub", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg', - 'expected': { - 'subscription': 'mySub', - 'resource_group': 'myRg' - } - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg", + "expected": {"subscription": "mySub", "resource_group": "myRg"}, + }, ] for test in tests: - self.assertTrue(is_valid_resource_id(test['resource_id'])) - kwargs = parse_resource_id(test['resource_id']) - for key in test['expected']: + self.assertTrue(is_valid_resource_id(test["resource_id"])) + kwargs = parse_resource_id(test["resource_id"]) + for key in test["expected"]: try: - self.assertEqual(kwargs[key], test['expected'][key]) + self.assertEqual(kwargs[key], test["expected"][key]) except KeyError: - self.assertTrue(key not in kwargs and test['expected'][key] is None) + self.assertTrue(key not in kwargs and test["expected"][key] is None) invalid_ids = [ - '/subscriptions/fakesub/resourceGroups/myRg/type1/name1', - '/subscriptions/fakesub/resourceGroups/myRg/providers/Microsoft.Provider/foo', - '/subscriptions/fakesub/resourceGroups/myRg/providers/namespace/type/name/type1', - '/subscriptions/fakesub/resourceGroups/', - '/subscriptions//resourceGroups/' + "/subscriptions/fakesub/resourceGroups/myRg/type1/name1", + "/subscriptions/fakesub/resourceGroups/myRg/providers/Microsoft.Provider/foo", + "/subscriptions/fakesub/resourceGroups/myRg/providers/namespace/type/name/type1", + "/subscriptions/fakesub/resourceGroups/", + "/subscriptions//resourceGroups/", ] for invalid_id in invalid_ids: self.assertFalse(is_valid_resource_id(invalid_id)) tests = [ { - 'resource_id': '/subscriptions/fakesub/resourcegroups/testgroup/providers' - '/Microsoft.Storage/storageAccounts/foo/providers' - '/Microsoft.Authorization/locks/bar', - 'id_args': { - 'name': 'foo', - 'type': 'storageAccounts', - 'namespace': 'Microsoft.Storage', - 'child_name_1': 'bar', - 'child_namespace_1': 'Microsoft.Authorization', - 'child_type_1': 'locks', - 'resource_group': 'testgroup', - 'subscription': 'fakesub', - } + "resource_id": "/subscriptions/fakesub/resourcegroups/testgroup/providers" + "/Microsoft.Storage/storageAccounts/foo/providers" + "/Microsoft.Authorization/locks/bar", + "id_args": { + "name": "foo", + "type": "storageAccounts", + "namespace": "Microsoft.Storage", + "child_name_1": "bar", + "child_namespace_1": "Microsoft.Authorization", + "child_type_1": "locks", + "resource_group": "testgroup", + "subscription": "fakesub", + }, }, { - 'resource_id': '/subscriptions/fakesub/resourcegroups/testgroup/providers' - '/Microsoft.Storage/storageAccounts/foo' - '/locks/bar', - 'id_args': { - 'name': 'foo', - 'type': 'storageAccounts', - 'namespace': 'Microsoft.Storage', - 'child_name_1': 'bar', - 'child_type_1': 'locks', - 'resource_group': 'testgroup', - 'subscription': 'fakesub', - } + "resource_id": "/subscriptions/fakesub/resourcegroups/testgroup/providers" + "/Microsoft.Storage/storageAccounts/foo" + "/locks/bar", + "id_args": { + "name": "foo", + "type": "storageAccounts", + "namespace": "Microsoft.Storage", + "child_name_1": "bar", + "child_type_1": "locks", + "resource_group": "testgroup", + "subscription": "fakesub", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg/providers/' - 'Microsoft.Provider1/resourceType1/name1/resourceType2/name2/' - 'providers/Microsoft.Provider3/resourceType3/name3', - 'id_args': { - 'subscription': 'mySub', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.Provider1', - 'type': 'resourceType1', - 'name': 'name1', - 'child_type_1': 'resourceType2', - 'child_name_1': 'name2', - 'child_namespace_2': 'Microsoft.Provider3', - 'child_type_2': 'resourceType3', - 'child_name_2': 'name3' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg/providers/" + "Microsoft.Provider1/resourceType1/name1/resourceType2/name2/" + "providers/Microsoft.Provider3/resourceType3/name3", + "id_args": { + "subscription": "mySub", + "resource_group": "myRg", + "namespace": "Microsoft.Provider1", + "type": "resourceType1", + "name": "name1", + "child_type_1": "resourceType2", + "child_name_1": "name2", + "child_namespace_2": "Microsoft.Provider3", + "child_type_2": "resourceType3", + "child_name_2": "name3", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg/' - 'providers/Microsoft.Provider1', - 'id_args': { - 'subscription': 'mySub', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.Provider1' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg/" "providers/Microsoft.Provider1", + "id_args": {"subscription": "mySub", "resource_group": "myRg", "namespace": "Microsoft.Provider1"}, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg', - 'id_args': { - 'subscription': 'mySub', - 'resource_group': 'myRg' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg", + "id_args": {"subscription": "mySub", "resource_group": "myRg"}, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg/' - 'providers/Microsoft.Provider1/resourceType1/name1/resourceType2/' - 'name2/providers/Microsoft.Provider3', - 'id_args': { - 'subscription': 'mySub', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.Provider1', - 'type': 'resourceType1', - 'name': 'name1', - 'child_type_1': 'resourceType2', - 'child_name_1': 'name2', - 'child_namespace_2': 'Microsoft.Provider3' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg/" + "providers/Microsoft.Provider1/resourceType1/name1/resourceType2/" + "name2/providers/Microsoft.Provider3", + "id_args": { + "subscription": "mySub", + "resource_group": "myRg", + "namespace": "Microsoft.Provider1", + "type": "resourceType1", + "name": "name1", + "child_type_1": "resourceType2", + "child_name_1": "name2", + "child_namespace_2": "Microsoft.Provider3", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg/' - 'providers/Microsoft.Provider1/resourceType1/name1', - 'id_args': { - 'subscription': 'mySub', - 'resource_group': 'myRg', - 'namespace': 'Microsoft.Provider1', - 'type': 'resourceType1', - 'name': 'name1', - 'child_type_1': None, - 'child_name_1': 'name2', - 'child_namespace_2': 'Microsoft.Provider3' - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg/" + "providers/Microsoft.Provider1/resourceType1/name1", + "id_args": { + "subscription": "mySub", + "resource_group": "myRg", + "namespace": "Microsoft.Provider1", + "type": "resourceType1", + "name": "name1", + "child_type_1": None, + "child_name_1": "name2", + "child_namespace_2": "Microsoft.Provider3", + }, }, { - 'resource_id': '/subscriptions/mySub/resourceGroups/myRg', - 'id_args': { - 'subscription': 'mySub', - 'resource_group': 'myRg' - } - } + "resource_id": "/subscriptions/mySub/resourceGroups/myRg", + "id_args": {"subscription": "mySub", "resource_group": "myRg"}, + }, ] for test in tests: - rsrc_id = resource_id(**test['id_args']) - self.assertEqual(rsrc_id.lower(), test['resource_id'].lower()) + rsrc_id = resource_id(**test["id_args"]) + self.assertEqual(rsrc_id.lower(), test["resource_id"].lower()) def test_is_resource_name(self): invalid_names = [ - '', - 'knights/ni', - 'spam&eggs', - 'i<3you', - 'a' * 261, + "", + "knights/ni", + "spam&eggs", + "i<3you", + "a" * 261, ] for test in invalid_names: assert not is_valid_resource_name(test) valid_names = [ - 'abc-123', - ' ', # no one said it had to be a good resource name. - 'a' * 260, + "abc-123", + " ", # no one said it had to be a good resource name. + "a" * 260, ] for test in valid_names: diff --git a/sdk/cosmos/azure-cosmos/pyproject.toml b/sdk/cosmos/azure-cosmos/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md index 0be7678b3a54..c6e4132c8729 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md +++ b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 9.0.0 (2023-02-15) + +### Features Added + + - Added operation GremlinResourcesOperations.begin_retrieve_continuous_backup_information + - Added operation SqlResourcesOperations.begin_create_update_client_encryption_key + - Added operation SqlResourcesOperations.get_client_encryption_key + - Added operation SqlResourcesOperations.list_client_encryption_keys + - Added operation TableResourcesOperations.begin_retrieve_continuous_backup_information + - Added operation group RestorableGremlinDatabasesOperations + - Added operation group RestorableGremlinGraphsOperations + - Added operation group RestorableGremlinResourcesOperations + - Added operation group RestorableTableResourcesOperations + - Added operation group RestorableTablesOperations + - Model DatabaseAccountCreateUpdateParameters has a new parameter minimal_tls_version + - Model DatabaseAccountGetResults has a new parameter minimal_tls_version + - Model DatabaseAccountUpdateParameters has a new parameter minimal_tls_version + - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter client_encryption_policy + - Model RestoreParameters has a new parameter gremlin_databases_to_restore + - Model RestoreParameters has a new parameter tables_to_restore + - Model SqlContainerGetPropertiesResource has a new parameter client_encryption_policy + - Model SqlContainerResource has a new parameter client_encryption_policy + - Operation RestorableMongodbCollectionsOperations.list has a new optional parameter end_time + - Operation RestorableMongodbCollectionsOperations.list has a new optional parameter start_time + ## 9.0.0b2 (2022-10-26) ### Features Added diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/README.md b/sdk/cosmos/azure-mgmt-cosmosdb/README.md index 32c812599aed..8913bb4d602c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/README.md +++ b/sdk/cosmos/azure-mgmt-cosmosdb/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/cosmosdb) -Code samples for this package can be found at [Cosmos DB Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/cosmosdb) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-cosmosdb +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.cosmosdb import CosmosDBManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = CosmosDBManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Cosmos DB Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json b/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json index 884de3757c9a..c159b0a5e120 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json +++ b/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json @@ -1,11 +1,11 @@ { - "commit": "21426cf85836ec17aaa4f20f58324a8666925e34", + "commit": "33a7dbc1743fdacb8e2259011a035154a98cad66", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/cosmos-db/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/cosmos-db/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/cosmos-db/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py index de0ee92a4749..2ffb9868aed3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py index 9b21cb3f7fe5..224f3a558fa4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py @@ -35,14 +35,14 @@ class CosmosDBManagementClientConfiguration(Configuration): # pylint: disable=t :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-08-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-11-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(CosmosDBManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-08-15-preview") # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", "2022-11-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-cosmosdb/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py index 18bb993ec21a..49de534d4382 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import CosmosDBManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -23,11 +23,9 @@ CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, - DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, - GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, @@ -95,8 +93,6 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :ivar partition_key_range_id_region: PartitionKeyRangeIdRegionOperations operations :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.operations.PartitionKeyRangeIdRegionOperations - :ivar graph_resources: GraphResourcesOperations operations - :vartype graph_resources: azure.mgmt.cosmosdb.operations.GraphResourcesOperations :ivar sql_resources: SqlResourcesOperations operations :vartype sql_resources: azure.mgmt.cosmosdb.operations.SqlResourcesOperations :ivar mongo_db_resources: MongoDBResourcesOperations operations @@ -109,8 +105,6 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :vartype gremlin_resources: azure.mgmt.cosmosdb.operations.GremlinResourcesOperations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.cosmosdb.operations.LocationsOperations - :ivar data_transfer_jobs: DataTransferJobsOperations operations - :vartype data_transfer_jobs: azure.mgmt.cosmosdb.operations.DataTransferJobsOperations :ivar cassandra_clusters: CassandraClustersOperations operations :vartype cassandra_clusters: azure.mgmt.cosmosdb.operations.CassandraClustersOperations :ivar cassandra_data_centers: CassandraDataCentersOperations operations @@ -165,8 +159,8 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-08-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-11-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -184,7 +178,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -219,7 +213,6 @@ def __init__( self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations( self._client, self._config, self._serialize, self._deserialize ) - self.graph_resources = GraphResourcesOperations(self._client, self._config, self._serialize, self._deserialize) self.sql_resources = SqlResourcesOperations(self._client, self._config, self._serialize, self._deserialize) self.mongo_db_resources = MongoDBResourcesOperations( self._client, self._config, self._serialize, self._deserialize @@ -232,9 +225,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_transfer_jobs = DataTransferJobsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.cassandra_clusters = CassandraClustersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -310,15 +300,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> CosmosDBManagementClient + def __enter__(self) -> "CosmosDBManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py index 7c1dedb5133d..f17c068e833e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -606,13 +630,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_vendor.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_vendor.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py index e25f4fc7373b..b77ac9246082 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.0.0b2" +VERSION = "9.0.0" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py index ac5eb24b55c8..0ec156d96fb5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py index dc12448cd980..b8b3bc0c29ed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_configuration.py @@ -35,14 +35,14 @@ class CosmosDBManagementClientConfiguration(Configuration): # pylint: disable=t :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-08-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-11-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(CosmosDBManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-08-15-preview") # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", "2022-11-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py index 4fa2888ba9cb..270763e08ea4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_cosmos_db_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import CosmosDBManagementClientConfiguration from .operations import ( @@ -23,11 +23,9 @@ CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, - DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, - GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, @@ -96,8 +94,6 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :ivar partition_key_range_id_region: PartitionKeyRangeIdRegionOperations operations :vartype partition_key_range_id_region: azure.mgmt.cosmosdb.aio.operations.PartitionKeyRangeIdRegionOperations - :ivar graph_resources: GraphResourcesOperations operations - :vartype graph_resources: azure.mgmt.cosmosdb.aio.operations.GraphResourcesOperations :ivar sql_resources: SqlResourcesOperations operations :vartype sql_resources: azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations :ivar mongo_db_resources: MongoDBResourcesOperations operations @@ -110,8 +106,6 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :vartype gremlin_resources: azure.mgmt.cosmosdb.aio.operations.GremlinResourcesOperations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.cosmosdb.aio.operations.LocationsOperations - :ivar data_transfer_jobs: DataTransferJobsOperations operations - :vartype data_transfer_jobs: azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations :ivar cassandra_clusters: CassandraClustersOperations operations :vartype cassandra_clusters: azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations :ivar cassandra_data_centers: CassandraDataCentersOperations operations @@ -168,8 +162,8 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-08-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-11-15". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -187,7 +181,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -222,7 +216,6 @@ def __init__( self.partition_key_range_id_region = PartitionKeyRangeIdRegionOperations( self._client, self._config, self._serialize, self._deserialize ) - self.graph_resources = GraphResourcesOperations(self._client, self._config, self._serialize, self._deserialize) self.sql_resources = SqlResourcesOperations(self._client, self._config, self._serialize, self._deserialize) self.mongo_db_resources = MongoDBResourcesOperations( self._client, self._config, self._serialize, self._deserialize @@ -235,9 +228,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_transfer_jobs = DataTransferJobsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.cassandra_clusters = CassandraClustersOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py index b9aee75bbc64..0a347515778b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/__init__.py @@ -19,14 +19,12 @@ from ._collection_partition_operations import CollectionPartitionOperations from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations -from ._graph_resources_operations import GraphResourcesOperations from ._sql_resources_operations import SqlResourcesOperations from ._mongo_db_resources_operations import MongoDBResourcesOperations from ._table_resources_operations import TableResourcesOperations from ._cassandra_resources_operations import CassandraResourcesOperations from ._gremlin_resources_operations import GremlinResourcesOperations from ._locations_operations import LocationsOperations -from ._data_transfer_jobs_operations import DataTransferJobsOperations from ._cassandra_clusters_operations import CassandraClustersOperations from ._cassandra_data_centers_operations import CassandraDataCentersOperations from ._notebook_workspaces_operations import NotebookWorkspacesOperations @@ -47,7 +45,7 @@ from ._service_operations import ServiceOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -64,14 +62,12 @@ "CollectionPartitionOperations", "PartitionKeyRangeIdOperations", "PartitionKeyRangeIdRegionOperations", - "GraphResourcesOperations", "SqlResourcesOperations", "MongoDBResourcesOperations", "TableResourcesOperations", "CassandraResourcesOperations", "GremlinResourcesOperations", "LocationsOperations", - "DataTransferJobsOperations", "CassandraClustersOperations", "CassandraDataCentersOperations", "NotebookWorkspacesOperations", diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py index 1345e60701d6..68a5a4d56a08 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_clusters_operations.py @@ -35,10 +35,8 @@ build_create_update_request, build_deallocate_request, build_delete_request, - build_get_backup_request, build_get_request, build_invoke_command_request, - build_list_backups_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_start_request, @@ -85,10 +83,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ClusterR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListClusters] + ) + cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListClusters", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,7 +150,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters" + } @distributed_trace def list_by_resource_group( @@ -171,10 +171,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListClusters] + ) + cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +196,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +212,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +220,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListClusters", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +239,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters" + } @distributed_trace_async async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ClusterResource: @@ -266,10 +268,10 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] + ) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -281,9 +283,9 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -300,7 +302,9 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -316,10 +320,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -331,9 +335,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -346,7 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -372,13 +378,13 @@ async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -396,7 +402,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -408,9 +414,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } async def _create_update_initial( self, resource_group_name: str, cluster_name: str, body: Union[_models.ClusterResource, IO], **kwargs: Any @@ -426,11 +434,11 @@ async def _create_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -453,9 +461,9 @@ async def _create_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -472,11 +480,13 @@ async def _create_update_initial( deserialized = self._deserialize("ClusterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + _create_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } @overload async def begin_create_update( @@ -588,16 +598,16 @@ async def begin_create_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_initial( # type: ignore + raw_result = await self._create_update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, @@ -617,7 +627,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -629,9 +639,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + begin_create_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } async def _update_initial( self, resource_group_name: str, cluster_name: str, body: Union[_models.ClusterResource, IO], **kwargs: Any @@ -647,11 +659,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -674,9 +686,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -693,11 +705,13 @@ async def _update_initial( deserialized = self._deserialize("ClusterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } @overload async def begin_update( @@ -804,16 +818,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, @@ -833,7 +847,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -845,9 +859,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } async def _invoke_command_initial( self, resource_group_name: str, cluster_name: str, body: Union[_models.CommandPostBody, IO], **kwargs: Any @@ -863,11 +879,11 @@ async def _invoke_command_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CommandOutput] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -890,9 +906,9 @@ async def _invoke_command_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -909,7 +925,9 @@ async def _invoke_command_initial( return deserialized - _invoke_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand"} # type: ignore + _invoke_command_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand" + } @overload async def begin_invoke_command( @@ -1016,16 +1034,16 @@ async def begin_invoke_command( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CommandOutput] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandOutput] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._invoke_command_initial( # type: ignore + raw_result = await self._invoke_command_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, @@ -1045,7 +1063,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1057,165 +1075,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_invoke_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand"} # type: ignore - - @distributed_trace - def list_backups( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BackupResource"]: - """List the backups of this cluster that are available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.BackupResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBackups] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_backups_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_backups.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ListBackups", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_backups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups"} # type: ignore - - @distributed_trace_async - async def get_backup( - self, resource_group_name: str, cluster_name: str, backup_id: str, **kwargs: Any - ) -> _models.BackupResource: - """Get the properties of an individual backup of this cluster that is available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param backup_id: Id of a restorable backup of a Cassandra cluster. Required. - :type backup_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResource or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.BackupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResource] - - request = build_get_backup_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - backup_id=backup_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_backup.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BackupResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_backup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}"} # type: ignore + begin_invoke_command.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand" + } async def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -1231,10 +1095,10 @@ async def _deallocate_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_deallocate_request( resource_group_name=resource_group_name, @@ -1246,9 +1110,9 @@ async def _deallocate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1261,7 +1125,9 @@ async def _deallocate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate"} # type: ignore + _deallocate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate" + } @distributed_trace_async async def begin_deallocate( @@ -1291,13 +1157,13 @@ async def begin_deallocate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._deallocate_initial( # type: ignore resource_group_name=resource_group_name, @@ -1315,7 +1181,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1327,9 +1193,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_deallocate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate"} # type: ignore + begin_deallocate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate" + } async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -1345,10 +1213,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1360,9 +1228,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1375,7 +1243,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start" + } @distributed_trace_async async def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1403,13 +1273,13 @@ async def begin_start(self, resource_group_name: str, cluster_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1427,7 +1297,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1439,9 +1309,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start" + } @distributed_trace_async async def status( @@ -1470,10 +1342,10 @@ async def status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraClusterPublicStatus] + ) + cls: ClsType[_models.CassandraClusterPublicStatus] = kwargs.pop("cls", None) request = build_status_request( resource_group_name=resource_group_name, @@ -1485,9 +1357,9 @@ async def status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1504,4 +1376,6 @@ async def status( return deserialized - status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status"} # type: ignore + status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py index 1a98c919d8ad..51057c082d88 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_data_centers_operations.py @@ -85,10 +85,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListDataCenters] + ) + cls: ClsType[_models.ListDataCenters] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +127,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListDataCenters", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters" + } @distributed_trace_async async def get( @@ -185,10 +187,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] + ) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -201,9 +203,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -220,7 +222,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any @@ -236,10 +240,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -252,9 +256,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -267,7 +271,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } @distributed_trace_async async def begin_delete( @@ -297,13 +303,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -322,7 +328,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -334,9 +340,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } async def _create_update_initial( self, @@ -357,11 +365,11 @@ async def _create_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -385,9 +393,9 @@ async def _create_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -404,11 +412,13 @@ async def _create_update_initial( deserialized = self._deserialize("DataCenterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + _create_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } @overload async def begin_create_update( @@ -531,16 +541,16 @@ async def begin_create_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_initial( # type: ignore + raw_result = await self._create_update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -561,7 +571,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -573,9 +583,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + begin_create_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } async def _update_initial( self, @@ -596,11 +608,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -624,9 +636,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -643,11 +655,13 @@ async def _update_initial( deserialized = self._deserialize("DataCenterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } @overload async def begin_update( @@ -767,16 +781,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -797,7 +811,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -809,6 +823,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py index 3dcb19e46c16..d0545095a172 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_cassandra_resources_operations.py @@ -34,28 +34,20 @@ from ...operations._cassandra_resources_operations import ( build_create_update_cassandra_keyspace_request, build_create_update_cassandra_table_request, - build_create_update_cassandra_view_request, build_delete_cassandra_keyspace_request, build_delete_cassandra_table_request, - build_delete_cassandra_view_request, build_get_cassandra_keyspace_request, build_get_cassandra_keyspace_throughput_request, build_get_cassandra_table_request, build_get_cassandra_table_throughput_request, - build_get_cassandra_view_request, - build_get_cassandra_view_throughput_request, build_list_cassandra_keyspaces_request, build_list_cassandra_tables_request, - build_list_cassandra_views_request, build_migrate_cassandra_keyspace_to_autoscale_request, build_migrate_cassandra_keyspace_to_manual_throughput_request, build_migrate_cassandra_table_to_autoscale_request, build_migrate_cassandra_table_to_manual_throughput_request, - build_migrate_cassandra_view_to_autoscale_request, - build_migrate_cassandra_view_to_manual_throughput_request, build_update_cassandra_keyspace_throughput_request, build_update_cassandra_table_throughput_request, - build_update_cassandra_view_throughput_request, ) if sys.version_info >= (3, 8): @@ -106,10 +98,10 @@ def list_cassandra_keyspaces( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraKeyspaceListResult] + ) + cls: ClsType[_models.CassandraKeyspaceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,7 +124,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -148,7 +140,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -156,13 +148,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CassandraKeyspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -175,7 +167,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_cassandra_keyspaces.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces"} # type: ignore + list_cassandra_keyspaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces" + } @distributed_trace_async async def get_cassandra_keyspace( @@ -207,10 +201,10 @@ async def get_cassandra_keyspace( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraKeyspaceGetResults] + ) + cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) request = build_get_cassandra_keyspace_request( resource_group_name=resource_group_name, @@ -223,9 +217,9 @@ async def get_cassandra_keyspace( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -242,7 +236,9 @@ async def get_cassandra_keyspace( return deserialized - get_cassandra_keyspace.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore + get_cassandra_keyspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } async def _create_update_cassandra_keyspace_initial( self, @@ -263,11 +259,11 @@ async def _create_update_cassandra_keyspace_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CassandraKeyspaceGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -293,9 +289,9 @@ async def _create_update_cassandra_keyspace_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -306,15 +302,24 @@ async def _create_update_cassandra_keyspace_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_cassandra_keyspace_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore + _create_update_cassandra_keyspace_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } @overload async def begin_create_update_cassandra_keyspace( @@ -441,16 +446,16 @@ async def begin_create_update_cassandra_keyspace( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraKeyspaceGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_cassandra_keyspace_initial( # type: ignore + raw_result = await self._create_update_cassandra_keyspace_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -471,7 +476,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -483,9 +488,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_cassandra_keyspace.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore + begin_create_update_cassandra_keyspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } async def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any @@ -501,10 +508,10 @@ async def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-re _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_cassandra_keyspace_request( resource_group_name=resource_group_name, @@ -517,9 +524,9 @@ async def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-re params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -529,10 +536,19 @@ async def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-re map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_cassandra_keyspace_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore + _delete_cassandra_keyspace_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } @distributed_trace_async async def begin_delete_cassandra_keyspace( @@ -562,13 +578,13 @@ async def begin_delete_cassandra_keyspace( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_cassandra_keyspace_initial( # type: ignore resource_group_name=resource_group_name, @@ -587,7 +603,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -599,9 +615,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_cassandra_keyspace.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore + begin_delete_cassandra_keyspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } @distributed_trace_async async def get_cassandra_keyspace_throughput( @@ -633,10 +651,10 @@ async def get_cassandra_keyspace_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_cassandra_keyspace_throughput_request( resource_group_name=resource_group_name, @@ -649,9 +667,9 @@ async def get_cassandra_keyspace_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -668,7 +686,9 @@ async def get_cassandra_keyspace_throughput( return deserialized - get_cassandra_keyspace_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore + get_cassandra_keyspace_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + } async def _update_cassandra_keyspace_throughput_initial( self, @@ -689,11 +709,11 @@ async def _update_cassandra_keyspace_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -717,9 +737,9 @@ async def _update_cassandra_keyspace_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -730,15 +750,24 @@ async def _update_cassandra_keyspace_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_cassandra_keyspace_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore + _update_cassandra_keyspace_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + } @overload async def begin_update_cassandra_keyspace_throughput( @@ -865,16 +894,16 @@ async def begin_update_cassandra_keyspace_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_cassandra_keyspace_throughput_initial( # type: ignore + raw_result = await self._update_cassandra_keyspace_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -895,7 +924,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -907,9 +936,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_cassandra_keyspace_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore + begin_update_cassandra_keyspace_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + } async def _migrate_cassandra_keyspace_to_autoscale_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any @@ -925,10 +956,10 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_cassandra_keyspace_to_autoscale_request( resource_group_name=resource_group_name, @@ -941,9 +972,9 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -954,15 +985,24 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_keyspace_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_cassandra_keyspace_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_cassandra_keyspace_to_autoscale( @@ -994,15 +1034,15 @@ async def begin_migrate_cassandra_keyspace_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_cassandra_keyspace_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_cassandra_keyspace_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -1021,7 +1061,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1033,9 +1073,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_keyspace_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_cassandra_keyspace_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_cassandra_keyspace_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any @@ -1051,10 +1093,10 @@ async def _migrate_cassandra_keyspace_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_cassandra_keyspace_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -1067,9 +1109,9 @@ async def _migrate_cassandra_keyspace_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1080,15 +1122,24 @@ async def _migrate_cassandra_keyspace_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_keyspace_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_cassandra_keyspace_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def begin_migrate_cassandra_keyspace_to_manual_throughput( @@ -1120,15 +1171,15 @@ async def begin_migrate_cassandra_keyspace_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_cassandra_keyspace_to_manual_throughput_initial( # type: ignore + raw_result = await self._migrate_cassandra_keyspace_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -1147,7 +1198,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1159,9 +1210,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_keyspace_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_cassandra_keyspace_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def list_cassandra_tables( @@ -1186,10 +1239,10 @@ def list_cassandra_tables( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraTableListResult] + ) + cls: ClsType[_models.CassandraTableListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1213,7 +1266,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1229,7 +1282,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1237,13 +1290,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CassandraTableListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1256,7 +1309,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_cassandra_tables.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables"} # type: ignore + list_cassandra_tables.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables" + } @distributed_trace_async async def get_cassandra_table( @@ -1289,10 +1344,10 @@ async def get_cassandra_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraTableGetResults] + ) + cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) request = build_get_cassandra_table_request( resource_group_name=resource_group_name, @@ -1306,9 +1361,9 @@ async def get_cassandra_table( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1325,7 +1380,9 @@ async def get_cassandra_table( return deserialized - get_cassandra_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + get_cassandra_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } async def _create_update_cassandra_table_initial( self, @@ -1347,11 +1404,11 @@ async def _create_update_cassandra_table_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CassandraTableGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CassandraTableGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1378,9 +1435,9 @@ async def _create_update_cassandra_table_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1391,15 +1448,24 @@ async def _create_update_cassandra_table_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CassandraTableGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_cassandra_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + _create_update_cassandra_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } @overload async def begin_create_update_cassandra_table( @@ -1535,16 +1601,16 @@ async def begin_create_update_cassandra_table( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraTableGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_cassandra_table_initial( # type: ignore + raw_result = await self._create_update_cassandra_table_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -1566,7 +1632,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1578,9 +1644,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_cassandra_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + begin_create_update_cassandra_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } async def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any @@ -1596,10 +1664,10 @@ async def _delete_cassandra_table_initial( # pylint: disable=inconsistent-retur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_cassandra_table_request( resource_group_name=resource_group_name, @@ -1613,9 +1681,9 @@ async def _delete_cassandra_table_initial( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1625,10 +1693,19 @@ async def _delete_cassandra_table_initial( # pylint: disable=inconsistent-retur map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_cassandra_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + _delete_cassandra_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } @distributed_trace_async async def begin_delete_cassandra_table( @@ -1660,13 +1737,13 @@ async def begin_delete_cassandra_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_cassandra_table_initial( # type: ignore resource_group_name=resource_group_name, @@ -1686,7 +1763,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1698,9 +1775,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_cassandra_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + begin_delete_cassandra_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } @distributed_trace_async async def get_cassandra_table_throughput( @@ -1734,10 +1813,10 @@ async def get_cassandra_table_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_cassandra_table_throughput_request( resource_group_name=resource_group_name, @@ -1751,9 +1830,9 @@ async def get_cassandra_table_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1770,7 +1849,9 @@ async def get_cassandra_table_throughput( return deserialized - get_cassandra_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + get_cassandra_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default" + } async def _update_cassandra_table_throughput_initial( self, @@ -1792,11 +1873,11 @@ async def _update_cassandra_table_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1821,9 +1902,9 @@ async def _update_cassandra_table_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1834,15 +1915,24 @@ async def _update_cassandra_table_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_cassandra_table_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + _update_cassandra_table_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default" + } @overload async def begin_update_cassandra_table_throughput( @@ -1978,16 +2068,16 @@ async def begin_update_cassandra_table_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_cassandra_table_throughput_initial( # type: ignore + raw_result = await self._update_cassandra_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -2009,7 +2099,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2021,9 +2111,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_cassandra_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + begin_update_cassandra_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default" + } async def _migrate_cassandra_table_to_autoscale_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any @@ -2039,10 +2131,10 @@ async def _migrate_cassandra_table_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_cassandra_table_to_autoscale_request( resource_group_name=resource_group_name, @@ -2056,9 +2148,9 @@ async def _migrate_cassandra_table_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2069,15 +2161,24 @@ async def _migrate_cassandra_table_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_table_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_cassandra_table_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_cassandra_table_to_autoscale( @@ -2111,15 +2212,15 @@ async def begin_migrate_cassandra_table_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_cassandra_table_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_cassandra_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -2139,7 +2240,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2151,9 +2252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_table_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_cassandra_table_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_cassandra_table_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any @@ -2169,10 +2272,10 @@ async def _migrate_cassandra_table_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_cassandra_table_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -2186,9 +2289,9 @@ async def _migrate_cassandra_table_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2199,15 +2302,24 @@ async def _migrate_cassandra_table_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_table_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_cassandra_table_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def begin_migrate_cassandra_table_to_manual_throughput( @@ -2241,15 +2353,15 @@ async def begin_migrate_cassandra_table_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_cassandra_table_to_manual_throughput_initial( # type: ignore + raw_result = await self._migrate_cassandra_table_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, @@ -2269,1124 +2381,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_cassandra_table_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace - def list_cassandra_views( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CassandraViewGetResults"]: - """Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CassandraViewGetResults or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraViewListResult] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_cassandra_views_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_cassandra_views.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CassandraViewListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_cassandra_views.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views"} # type: ignore - - @distributed_trace_async - async def get_cassandra_view( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> _models.CassandraViewGetResults: - """Gets the Cassandra view under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CassandraViewGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraViewGetResults] - - request = build_get_cassandra_view_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_cassandra_view.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CassandraViewGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_view.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - async def _create_update_cassandra_view_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: Union[_models.CassandraViewCreateUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.CassandraViewGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CassandraViewGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_update_cassandra_view_parameters, (IO, bytes)): - _content = create_update_cassandra_view_parameters - else: - _json = self._serialize.body(create_update_cassandra_view_parameters, "CassandraViewCreateUpdateParameters") - - request = build_create_update_cassandra_view_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_update_cassandra_view_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CassandraViewGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_cassandra_view_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - @overload - async def begin_create_update_cassandra_view( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: _models.CassandraViewCreateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraViewGetResults]: - """Create or update an Azure Cosmos DB Cassandra View. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. Required. - :type create_update_cassandra_view_parameters: - ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CassandraViewGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_update_cassandra_view( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraViewGetResults]: - """Create or update an Azure Cosmos DB Cassandra View. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. Required. - :type create_update_cassandra_view_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CassandraViewGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_update_cassandra_view( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: Union[_models.CassandraViewCreateUpdateParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraViewGetResults]: - """Create or update an Azure Cosmos DB Cassandra View. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. Is either a model type or a IO type. Required. - :type create_update_cassandra_view_parameters: - ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CassandraViewGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraViewGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_update_cassandra_view_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - create_update_cassandra_view_parameters=create_update_cassandra_view_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CassandraViewGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_cassandra_view.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - async def _delete_cassandra_view_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_cassandra_view_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_cassandra_view_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_cassandra_view_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - @distributed_trace_async - async def begin_delete_cassandra_view( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra view. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_cassandra_view_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_cassandra_view.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore - - @distributed_trace_async - async def get_cassandra_view_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database - account with the provided name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - - request = build_get_cassandra_view_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_cassandra_view_throughput.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_view_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore - - async def _update_cassandra_view_throughput_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_throughput_parameters, (IO, bytes)): - _content = update_throughput_parameters - else: - _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - - request = build_update_cassandra_view_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_cassandra_view_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_cassandra_view_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore - - @overload - async def begin_update_cassandra_view_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_cassandra_view_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - update_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. Required. - :type update_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_cassandra_view_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - view_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. Is either a model type or a IO type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_cassandra_view_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_cassandra_view_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore - - async def _migrate_cassandra_view_to_autoscale_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_cassandra_view_to_autoscale_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_cassandra_view_to_autoscale_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_view_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - @distributed_trace_async - async def begin_migrate_cassandra_view_to_autoscale( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_cassandra_view_to_autoscale_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_cassandra_view_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - async def _migrate_cassandra_view_to_manual_throughput_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_cassandra_view_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_cassandra_view_to_manual_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_view_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace_async - async def begin_migrate_cassandra_view_to_manual_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_cassandra_view_to_manual_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - view_name=view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3398,6 +2393,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_view_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_cassandra_table_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py index 7c431c7d5954..467c43a6c1e2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_operations.py @@ -95,10 +95,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -124,7 +124,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -140,7 +140,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -148,13 +148,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -167,7 +167,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics" + } @distributed_trace def list_usages( @@ -202,10 +204,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesResult] + ) + cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -231,7 +233,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -247,7 +249,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -255,13 +257,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -274,7 +276,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages" + } @distributed_trace def list_metric_definitions( @@ -299,10 +303,10 @@ def list_metric_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricDefinitionsListResult] + ) + cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -327,7 +331,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -343,7 +347,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -351,13 +355,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -370,4 +374,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metric_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions"} # type: ignore + list_metric_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py index 8f260e154590..716d281eacab 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_operations.py @@ -91,10 +91,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,7 +120,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -136,7 +136,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -144,13 +144,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -163,7 +163,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics" + } @distributed_trace def list_usages( @@ -198,10 +200,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionUsagesResult] + ) + cls: ClsType[_models.PartitionUsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -227,7 +229,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -243,7 +245,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -251,13 +253,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PartitionUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -270,4 +272,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py index 6d4cbbab300c..26e44b3b2827 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_partition_region_operations.py @@ -94,10 +94,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -124,7 +124,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -140,7 +140,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -148,13 +148,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -167,4 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py index bf46f4e3f032..abbf43e26f95 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_collection_region_operations.py @@ -94,10 +94,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -124,7 +124,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -140,7 +140,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -148,13 +148,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -167,4 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py deleted file mode 100644 index 3954f90316b1..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py +++ /dev/null @@ -1,572 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._data_transfer_jobs_operations import ( - build_cancel_request, - build_create_request, - build_get_request, - build_list_by_database_account_request, - build_pause_request, - build_resume_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DataTransferJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`data_transfer_jobs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: _models.CreateJobRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :param job_create_parameters: Required. - :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :param job_create_parameters: Required. - :type job_create_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: Union[_models.CreateJobRequest, IO], - **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :param job_create_parameters: Is either a model type or a IO type. Required. - :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(job_create_parameters, (IO, bytes)): - _content = job_create_parameters - else: - _json = self._serialize.body(job_create_parameters, "CreateJobRequest") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Get a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - @distributed_trace_async - async def pause( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Pause a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_pause_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.pause.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - pause.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause"} # type: ignore - - @distributed_trace_async - async def resume( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Resumes a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_resume_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.resume.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - resume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume"} # type: ignore - - @distributed_trace_async - async def cancel( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Cancels a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_cancel_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.cancel.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel"} # type: ignore - - @distributed_trace - def list_by_database_account( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DataTransferJobGetResults"]: - """Get a list of Data Transfer jobs. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataTransferJobGetResults or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobFeedResults] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_database_account_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_database_account.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DataTransferJobFeedResults", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py index 5c8d85b1b799..ba393512b461 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_account_region_operations.py @@ -82,10 +82,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,4 +153,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py index db108e5f4d06..e380a167a8dc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_accounts_operations.py @@ -106,10 +106,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] + ) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -121,9 +121,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -140,7 +140,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } async def _update_initial( self, @@ -160,11 +162,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -187,9 +189,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -206,7 +208,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } @overload async def begin_update( @@ -320,16 +324,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, update_parameters=update_parameters, @@ -349,7 +353,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -361,9 +365,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } async def _create_or_update_initial( self, @@ -383,11 +389,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -410,9 +416,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,7 +435,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } @overload async def begin_create_or_update( @@ -550,16 +558,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, create_update_parameters=create_update_parameters, @@ -579,7 +587,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -591,9 +599,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -609,10 +619,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -624,9 +634,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -636,10 +646,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -665,13 +684,13 @@ async def begin_delete(self, resource_group_name: str, account_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -689,7 +708,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -701,9 +720,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } async def _failover_priority_change_initial( # pylint: disable=inconsistent-return-statements self, @@ -723,11 +744,11 @@ async def _failover_priority_change_initial( # pylint: disable=inconsistent-ret _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -750,9 +771,9 @@ async def _failover_priority_change_initial( # pylint: disable=inconsistent-ret params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -762,10 +783,19 @@ async def _failover_priority_change_initial( # pylint: disable=inconsistent-ret map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _failover_priority_change_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange"} # type: ignore + _failover_priority_change_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange" + } @overload async def begin_failover_priority_change( @@ -882,14 +912,14 @@ async def begin_failover_priority_change( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._failover_priority_change_initial( # type: ignore resource_group_name=resource_group_name, @@ -909,7 +939,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -921,9 +951,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_failover_priority_change.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange"} # type: ignore + begin_failover_priority_change.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange" + } @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DatabaseAccountGetResults"]: @@ -939,10 +971,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DatabaseAccountGetResult _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountsListResult] + ) + cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -963,7 +995,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -979,7 +1011,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -987,13 +1019,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1006,7 +1038,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts"} @distributed_trace def list_by_resource_group( @@ -1027,10 +1059,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountsListResult] + ) + cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1052,7 +1084,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1068,7 +1100,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1076,13 +1108,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1095,7 +1127,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts" + } @distributed_trace_async async def list_keys( @@ -1124,10 +1158,10 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListKeysResult] + ) + cls: ClsType[_models.DatabaseAccountListKeysResult] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -1139,9 +1173,9 @@ async def list_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1158,7 +1192,9 @@ async def list_keys( return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys" + } @distributed_trace_async async def list_connection_strings( @@ -1187,10 +1223,10 @@ async def list_connection_strings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListConnectionStringsResult] + ) + cls: ClsType[_models.DatabaseAccountListConnectionStringsResult] = kwargs.pop("cls", None) request = build_list_connection_strings_request( resource_group_name=resource_group_name, @@ -1202,9 +1238,9 @@ async def list_connection_strings( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1221,7 +1257,9 @@ async def list_connection_strings( return deserialized - list_connection_strings.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings"} # type: ignore + list_connection_strings.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings" + } async def _offline_region_initial( # pylint: disable=inconsistent-return-statements self, @@ -1241,11 +1279,11 @@ async def _offline_region_initial( # pylint: disable=inconsistent-return-statem _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1268,9 +1306,9 @@ async def _offline_region_initial( # pylint: disable=inconsistent-return-statem params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1281,10 +1319,19 @@ async def _offline_region_initial( # pylint: disable=inconsistent-return-statem error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _offline_region_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion"} # type: ignore + _offline_region_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion" + } @overload async def begin_offline_region( @@ -1394,14 +1441,14 @@ async def begin_offline_region( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._offline_region_initial( # type: ignore resource_group_name=resource_group_name, @@ -1421,7 +1468,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1433,9 +1480,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_offline_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion"} # type: ignore + begin_offline_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion" + } async def _online_region_initial( # pylint: disable=inconsistent-return-statements self, @@ -1455,11 +1504,11 @@ async def _online_region_initial( # pylint: disable=inconsistent-return-stateme _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1482,9 +1531,9 @@ async def _online_region_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1495,10 +1544,19 @@ async def _online_region_initial( # pylint: disable=inconsistent-return-stateme error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _online_region_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion"} # type: ignore + _online_region_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion" + } @overload async def begin_online_region( @@ -1608,14 +1666,14 @@ async def begin_online_region( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._online_region_initial( # type: ignore resource_group_name=resource_group_name, @@ -1635,7 +1693,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1647,9 +1705,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_online_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion"} # type: ignore + begin_online_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion" + } @distributed_trace_async async def get_read_only_keys( @@ -1678,10 +1738,10 @@ async def get_read_only_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] + ) + cls: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] = kwargs.pop("cls", None) request = build_get_read_only_keys_request( resource_group_name=resource_group_name, @@ -1693,9 +1753,9 @@ async def get_read_only_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1712,7 +1772,9 @@ async def get_read_only_keys( return deserialized - get_read_only_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys"} # type: ignore + get_read_only_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys" + } @distributed_trace_async async def list_read_only_keys( @@ -1741,10 +1803,10 @@ async def list_read_only_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] + ) + cls: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] = kwargs.pop("cls", None) request = build_list_read_only_keys_request( resource_group_name=resource_group_name, @@ -1756,9 +1818,9 @@ async def list_read_only_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1775,7 +1837,9 @@ async def list_read_only_keys( return deserialized - list_read_only_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys"} # type: ignore + list_read_only_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys" + } async def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements self, @@ -1795,11 +1859,11 @@ async def _regenerate_key_initial( # pylint: disable=inconsistent-return-statem _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1822,9 +1886,9 @@ async def _regenerate_key_initial( # pylint: disable=inconsistent-return-statem params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1834,10 +1898,19 @@ async def _regenerate_key_initial( # pylint: disable=inconsistent-return-statem map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _regenerate_key_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey"} # type: ignore + _regenerate_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey" + } @overload async def begin_regenerate_key( @@ -1946,14 +2019,14 @@ async def begin_regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._regenerate_key_initial( # type: ignore resource_group_name=resource_group_name, @@ -1973,7 +2046,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1985,9 +2058,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey"} # type: ignore + begin_regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey" + } @distributed_trace_async async def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: @@ -2013,10 +2088,10 @@ async def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_check_name_exists_request( account_name=account_name, @@ -2026,9 +2101,9 @@ async def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2042,7 +2117,7 @@ async def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_name_exists.metadata = {"url": "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}"} # type: ignore + check_name_exists.metadata = {"url": "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}"} @distributed_trace def list_metrics( @@ -2067,10 +2142,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2094,7 +2169,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2110,7 +2185,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2118,13 +2193,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2137,7 +2212,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics" + } @distributed_trace def list_usages( @@ -2162,10 +2239,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesResult] + ) + cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2189,7 +2266,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2205,7 +2282,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2213,13 +2290,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2232,7 +2309,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages" + } @distributed_trace def list_metric_definitions( @@ -2253,10 +2332,10 @@ def list_metric_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricDefinitionsListResult] + ) + cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2279,7 +2358,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2295,7 +2374,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2303,13 +2382,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2322,4 +2401,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metric_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions"} # type: ignore + list_metric_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py index 6cf8af613227..30b6ad92566b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_database_operations.py @@ -87,10 +87,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -131,7 +131,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -139,13 +139,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics" + } @distributed_trace def list_usages( @@ -190,10 +192,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesResult] + ) + cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -218,7 +220,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -234,7 +236,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -242,13 +244,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -261,7 +263,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages" + } @distributed_trace def list_metric_definitions( @@ -284,10 +288,10 @@ def list_metric_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricDefinitionsListResult] + ) + cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -311,7 +315,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -327,7 +331,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -335,13 +339,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -354,4 +358,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metric_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions"} # type: ignore + list_metric_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py deleted file mode 100644 index 6afe7dddb442..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py +++ /dev/null @@ -1,579 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._graph_resources_operations import ( - build_create_update_graph_request, - build_delete_graph_resource_request, - build_get_graph_request, - build_list_graphs_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GraphResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`graph_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_graphs( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GraphResourceGetResults"]: - """Lists the graphs under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GraphResourceGetResults or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GraphResourcesListResult] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_graphs_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_graphs.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GraphResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_graphs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs"} # type: ignore - - @distributed_trace_async - async def get_graph( - self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any - ) -> _models.GraphResourceGetResults: - """Gets the Graph resource under an existing Azure Cosmos DB database account with the provided - name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GraphResourceGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GraphResourceGetResults] - - request = build_get_graph_request( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_graph.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GraphResourceGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - async def _create_update_graph_initial( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.GraphResourceGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GraphResourceGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_update_graph_parameters, (IO, bytes)): - _content = create_update_graph_parameters - else: - _json = self._serialize.body(create_update_graph_parameters, "GraphResourceCreateUpdateParameters") - - request = build_create_update_graph_request( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_update_graph_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("GraphResourceGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_graph_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - @overload - async def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GraphResourceGetResults]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. - Required. - :type create_update_graph_parameters: - ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GraphResourceGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GraphResourceGetResults]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. - Required. - :type create_update_graph_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GraphResourceGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.GraphResourceGetResults]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. Is - either a model type or a IO type. Required. - :type create_update_graph_parameters: - ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GraphResourceGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GraphResourceGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_update_graph_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - create_update_graph_parameters=create_update_graph_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GraphResourceGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - async def _delete_graph_resource_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_graph_resource_request( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_graph_resource_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_graph_resource_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - @distributed_trace_async - async def begin_delete_graph_resource( - self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Graph Resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_graph_resource_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_graph_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py index e47a0615bd74..eeecb56fba90 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_gremlin_resources_operations.py @@ -99,10 +99,10 @@ def list_gremlin_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinDatabaseListResult] + ) + cls: ClsType[_models.GremlinDatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,7 +125,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -141,7 +141,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -149,13 +149,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GremlinDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -168,7 +168,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_gremlin_databases.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases"} # type: ignore + list_gremlin_databases.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases" + } @distributed_trace_async async def get_gremlin_database( @@ -200,10 +202,10 @@ async def get_gremlin_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinDatabaseGetResults] + ) + cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_database_request( resource_group_name=resource_group_name, @@ -216,9 +218,9 @@ async def get_gremlin_database( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,7 +237,9 @@ async def get_gremlin_database( return deserialized - get_gremlin_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + get_gremlin_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } async def _create_update_gremlin_database_initial( self, @@ -256,11 +260,11 @@ async def _create_update_gremlin_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GremlinDatabaseGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GremlinDatabaseGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -286,9 +290,9 @@ async def _create_update_gremlin_database_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -299,15 +303,24 @@ async def _create_update_gremlin_database_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_gremlin_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + _create_update_gremlin_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } @overload async def begin_create_update_gremlin_database( @@ -434,16 +447,16 @@ async def begin_create_update_gremlin_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinDatabaseGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_gremlin_database_initial( # type: ignore + raw_result = await self._create_update_gremlin_database_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -464,7 +477,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -476,9 +489,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_gremlin_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + begin_create_update_gremlin_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } async def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -494,10 +509,10 @@ async def _delete_gremlin_database_initial( # pylint: disable=inconsistent-retu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_gremlin_database_request( resource_group_name=resource_group_name, @@ -510,9 +525,9 @@ async def _delete_gremlin_database_initial( # pylint: disable=inconsistent-retu params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -522,10 +537,19 @@ async def _delete_gremlin_database_initial( # pylint: disable=inconsistent-retu map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_gremlin_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + _delete_gremlin_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } @distributed_trace_async async def begin_delete_gremlin_database( @@ -555,13 +579,13 @@ async def begin_delete_gremlin_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_gremlin_database_initial( # type: ignore resource_group_name=resource_group_name, @@ -580,7 +604,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -592,9 +616,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_gremlin_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + begin_delete_gremlin_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } @distributed_trace_async async def get_gremlin_database_throughput( @@ -626,10 +652,10 @@ async def get_gremlin_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_database_throughput_request( resource_group_name=resource_group_name, @@ -642,9 +668,9 @@ async def get_gremlin_database_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -661,7 +687,9 @@ async def get_gremlin_database_throughput( return deserialized - get_gremlin_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default"} # type: ignore + get_gremlin_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + } async def _update_gremlin_database_throughput_initial( self, @@ -682,11 +710,11 @@ async def _update_gremlin_database_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -710,9 +738,9 @@ async def _update_gremlin_database_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -723,15 +751,24 @@ async def _update_gremlin_database_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_gremlin_database_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default"} # type: ignore + _update_gremlin_database_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + } @overload async def begin_update_gremlin_database_throughput( @@ -858,16 +895,16 @@ async def begin_update_gremlin_database_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_gremlin_database_throughput_initial( # type: ignore + raw_result = await self._update_gremlin_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -888,7 +925,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -900,9 +937,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_gremlin_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default"} # type: ignore + begin_update_gremlin_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + } async def _migrate_gremlin_database_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -918,10 +957,10 @@ async def _migrate_gremlin_database_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_database_to_autoscale_request( resource_group_name=resource_group_name, @@ -934,9 +973,9 @@ async def _migrate_gremlin_database_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -947,15 +986,24 @@ async def _migrate_gremlin_database_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_database_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_gremlin_database_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_gremlin_database_to_autoscale( @@ -987,15 +1035,15 @@ async def begin_migrate_gremlin_database_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_gremlin_database_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_gremlin_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1014,7 +1062,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1026,9 +1074,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_database_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_gremlin_database_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_gremlin_database_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1044,10 +1094,10 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_database_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -1060,9 +1110,9 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1073,15 +1123,24 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_database_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_gremlin_database_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def begin_migrate_gremlin_database_to_manual_throughput( @@ -1113,15 +1172,15 @@ async def begin_migrate_gremlin_database_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_gremlin_database_to_manual_throughput_initial( # type: ignore + raw_result = await self._migrate_gremlin_database_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1140,7 +1199,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1152,9 +1211,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_database_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_gremlin_database_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def list_gremlin_graphs( @@ -1179,10 +1240,10 @@ def list_gremlin_graphs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinGraphListResult] + ) + cls: ClsType[_models.GremlinGraphListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1206,7 +1267,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1222,7 +1283,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1230,13 +1291,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GremlinGraphListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1249,7 +1310,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_gremlin_graphs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs"} # type: ignore + list_gremlin_graphs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs" + } @distributed_trace_async async def get_gremlin_graph( @@ -1282,10 +1345,10 @@ async def get_gremlin_graph( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinGraphGetResults] + ) + cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_graph_request( resource_group_name=resource_group_name, @@ -1299,9 +1362,9 @@ async def get_gremlin_graph( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1318,7 +1381,9 @@ async def get_gremlin_graph( return deserialized - get_gremlin_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + get_gremlin_graph.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } async def _create_update_gremlin_graph_initial( self, @@ -1340,11 +1405,11 @@ async def _create_update_gremlin_graph_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GremlinGraphGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GremlinGraphGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1369,9 +1434,9 @@ async def _create_update_gremlin_graph_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1382,15 +1447,24 @@ async def _create_update_gremlin_graph_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_gremlin_graph_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + _create_update_gremlin_graph_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } @overload async def begin_create_update_gremlin_graph( @@ -1523,16 +1597,16 @@ async def begin_create_update_gremlin_graph( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinGraphGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_gremlin_graph_initial( # type: ignore + raw_result = await self._create_update_gremlin_graph_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1554,7 +1628,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1566,9 +1640,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_gremlin_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + begin_create_update_gremlin_graph.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } async def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any @@ -1584,10 +1660,10 @@ async def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_gremlin_graph_request( resource_group_name=resource_group_name, @@ -1601,9 +1677,9 @@ async def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1613,10 +1689,19 @@ async def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return- map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_gremlin_graph_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + _delete_gremlin_graph_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } @distributed_trace_async async def begin_delete_gremlin_graph( @@ -1648,13 +1733,13 @@ async def begin_delete_gremlin_graph( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_gremlin_graph_initial( # type: ignore resource_group_name=resource_group_name, @@ -1674,7 +1759,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1686,9 +1771,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_gremlin_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + begin_delete_gremlin_graph.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } @distributed_trace_async async def get_gremlin_graph_throughput( @@ -1722,10 +1809,10 @@ async def get_gremlin_graph_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_graph_throughput_request( resource_group_name=resource_group_name, @@ -1739,9 +1826,9 @@ async def get_gremlin_graph_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1758,7 +1845,9 @@ async def get_gremlin_graph_throughput( return deserialized - get_gremlin_graph_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default"} # type: ignore + get_gremlin_graph_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default" + } async def _update_gremlin_graph_throughput_initial( self, @@ -1780,11 +1869,11 @@ async def _update_gremlin_graph_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1809,9 +1898,9 @@ async def _update_gremlin_graph_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1822,15 +1911,24 @@ async def _update_gremlin_graph_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_gremlin_graph_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default"} # type: ignore + _update_gremlin_graph_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default" + } @overload async def begin_update_gremlin_graph_throughput( @@ -1966,16 +2064,16 @@ async def begin_update_gremlin_graph_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_gremlin_graph_throughput_initial( # type: ignore + raw_result = await self._update_gremlin_graph_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1997,7 +2095,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2009,9 +2107,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_gremlin_graph_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default"} # type: ignore + begin_update_gremlin_graph_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default" + } async def _migrate_gremlin_graph_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any @@ -2027,10 +2127,10 @@ async def _migrate_gremlin_graph_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_graph_to_autoscale_request( resource_group_name=resource_group_name, @@ -2044,9 +2144,9 @@ async def _migrate_gremlin_graph_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2057,15 +2157,24 @@ async def _migrate_gremlin_graph_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_graph_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_gremlin_graph_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_gremlin_graph_to_autoscale( @@ -2099,15 +2208,15 @@ async def begin_migrate_gremlin_graph_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_gremlin_graph_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_gremlin_graph_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2127,7 +2236,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2139,9 +2248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_graph_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_gremlin_graph_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_gremlin_graph_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any @@ -2157,10 +2268,10 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_graph_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -2174,9 +2285,9 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2187,15 +2298,24 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_graph_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_gremlin_graph_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def begin_migrate_gremlin_graph_to_manual_throughput( @@ -2229,15 +2349,15 @@ async def begin_migrate_gremlin_graph_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_gremlin_graph_to_manual_throughput_initial( # type: ignore + raw_result = await self._migrate_gremlin_graph_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2257,7 +2377,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2269,9 +2389,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_graph_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_gremlin_graph_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput" + } async def _retrieve_continuous_backup_information_initial( self, @@ -2293,11 +2415,11 @@ async def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2322,9 +2444,9 @@ async def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2343,7 +2465,9 @@ async def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation" + } @overload async def begin_retrieve_continuous_backup_information( @@ -2472,16 +2596,16 @@ async def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = await self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2503,9 +2627,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2517,6 +2641,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py index 1eb27cfb8949..cc2501589fd8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_locations_operations.py @@ -70,10 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.LocationGetResult"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LocationListResult] + ) + cls: ClsType[_models.LocationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +94,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +110,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LocationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +137,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations"} @distributed_trace_async async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: @@ -162,10 +162,10 @@ async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LocationGetResult] + ) + cls: ClsType[_models.LocationGetResult] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -176,9 +176,9 @@ async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -195,4 +195,4 @@ async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}"} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py index 0c09b8e5333d..786b119130b3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_mongo_db_resources_operations.py @@ -46,7 +46,6 @@ build_get_mongo_db_database_throughput_request, build_get_mongo_role_definition_request, build_get_mongo_user_definition_request, - build_list_mongo_db_collection_partition_merge_request, build_list_mongo_db_collections_request, build_list_mongo_db_databases_request, build_list_mongo_role_definitions_request, @@ -55,10 +54,6 @@ build_migrate_mongo_db_collection_to_manual_throughput_request, build_migrate_mongo_db_database_to_autoscale_request, build_migrate_mongo_db_database_to_manual_throughput_request, - build_mongo_db_container_redistribute_throughput_request, - build_mongo_db_container_retrieve_throughput_distribution_request, - build_mongo_db_database_redistribute_throughput_request, - build_mongo_db_database_retrieve_throughput_distribution_request, build_retrieve_continuous_backup_information_request, build_update_mongo_db_collection_throughput_request, build_update_mongo_db_database_throughput_request, @@ -112,10 +107,10 @@ def list_mongo_db_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBDatabaseListResult] + ) + cls: ClsType[_models.MongoDBDatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -138,7 +133,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -154,7 +149,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -162,13 +157,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MongoDBDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -181,7 +176,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_mongo_db_databases.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases"} # type: ignore + list_mongo_db_databases.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases" + } @distributed_trace_async async def get_mongo_db_database( @@ -213,10 +210,10 @@ async def get_mongo_db_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBDatabaseGetResults] + ) + cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_database_request( resource_group_name=resource_group_name, @@ -229,9 +226,9 @@ async def get_mongo_db_database( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -248,7 +245,9 @@ async def get_mongo_db_database( return deserialized - get_mongo_db_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + get_mongo_db_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } async def _create_update_mongo_db_database_initial( self, @@ -269,11 +268,11 @@ async def _create_update_mongo_db_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoDBDatabaseGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoDBDatabaseGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -299,9 +298,9 @@ async def _create_update_mongo_db_database_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -312,15 +311,24 @@ async def _create_update_mongo_db_database_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("MongoDBDatabaseGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_mongo_db_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + _create_update_mongo_db_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } @overload async def begin_create_update_mongo_db_database( @@ -447,16 +455,16 @@ async def begin_create_update_mongo_db_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBDatabaseGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_mongo_db_database_initial( # type: ignore + raw_result = await self._create_update_mongo_db_database_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -477,7 +485,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -489,9 +497,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_db_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + begin_create_update_mongo_db_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } async def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -507,10 +517,10 @@ async def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-ret _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_db_database_request( resource_group_name=resource_group_name, @@ -523,9 +533,9 @@ async def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-ret params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -535,10 +545,19 @@ async def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-ret map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_mongo_db_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + _delete_mongo_db_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } @distributed_trace_async async def begin_delete_mongo_db_database( @@ -568,13 +587,13 @@ async def begin_delete_mongo_db_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_mongo_db_database_initial( # type: ignore resource_group_name=resource_group_name, @@ -593,7 +612,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -605,9 +624,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_mongo_db_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + begin_delete_mongo_db_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } @distributed_trace_async async def get_mongo_db_database_throughput( @@ -639,10 +660,10 @@ async def get_mongo_db_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_database_throughput_request( resource_group_name=resource_group_name, @@ -655,9 +676,9 @@ async def get_mongo_db_database_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -674,7 +695,9 @@ async def get_mongo_db_database_throughput( return deserialized - get_mongo_db_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default"} # type: ignore + get_mongo_db_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + } async def _update_mongo_db_database_throughput_initial( self, @@ -695,11 +718,11 @@ async def _update_mongo_db_database_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -723,9 +746,9 @@ async def _update_mongo_db_database_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -736,15 +759,24 @@ async def _update_mongo_db_database_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_mongo_db_database_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default"} # type: ignore + _update_mongo_db_database_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + } @overload async def begin_update_mongo_db_database_throughput( @@ -871,16 +903,16 @@ async def begin_update_mongo_db_database_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_mongo_db_database_throughput_initial( # type: ignore + raw_result = await self._update_mongo_db_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -901,7 +933,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -913,9 +945,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_mongo_db_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default"} # type: ignore + begin_update_mongo_db_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + } async def _migrate_mongo_db_database_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -931,10 +965,10 @@ async def _migrate_mongo_db_database_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_database_to_autoscale_request( resource_group_name=resource_group_name, @@ -947,9 +981,9 @@ async def _migrate_mongo_db_database_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -960,15 +994,24 @@ async def _migrate_mongo_db_database_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_mongo_db_database_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_mongo_db_database_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_mongo_db_database_to_autoscale( @@ -1000,15 +1043,15 @@ async def begin_migrate_mongo_db_database_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_mongo_db_database_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_mongo_db_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1027,7 +1070,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1039,9 +1082,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_mongo_db_database_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_mongo_db_database_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_mongo_db_database_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1057,10 +1102,10 @@ async def _migrate_mongo_db_database_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_database_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -1073,9 +1118,9 @@ async def _migrate_mongo_db_database_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1086,1000 +1131,30 @@ async def _migrate_mongo_db_database_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_mongo_db_database_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace_async - async def begin_migrate_mongo_db_database_to_manual_throughput( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_mongo_db_database_to_manual_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_mongo_db_database_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - async def _mongo_db_database_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_mongo_db_database_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_database_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _mongo_db_database_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - async def begin_mongo_db_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB database. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_mongo_db_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB database. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _migrate_mongo_db_database_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async - async def begin_mongo_db_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB database. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._mongo_db_database_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_database_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - async def _mongo_db_database_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters - else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - - request = build_mongo_db_database_redistribute_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_database_redistribute_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_database_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - @overload - async def begin_mongo_db_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB database. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_mongo_db_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB database. Required. - :type redistribute_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_mongo_db_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB database. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._mongo_db_database_redistribute_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_database_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - async def _mongo_db_container_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_mongo_db_container_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_container_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - async def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._mongo_db_container_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_container_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - async def _mongo_db_container_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters - else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - - request = build_mongo_db_container_redistribute_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_container_redistribute_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - @overload - async def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. Required. - :type redistribute_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. + async def begin_migrate_mongo_db_database_to_manual_throughput( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2088,15 +1163,6 @@ async def begin_mongo_db_container_redistribute_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -2105,32 +1171,28 @@ async def begin_mongo_db_container_redistribute_throughput( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._mongo_db_container_redistribute_throughput_initial( # type: ignore + raw_result = await self._migrate_mongo_db_database_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -2139,15 +1201,13 @@ async def begin_mongo_db_container_redistribute_throughput( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2159,9 +1219,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_mongo_db_container_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore + begin_migrate_mongo_db_database_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def list_mongo_db_collections( @@ -2186,10 +1248,10 @@ def list_mongo_db_collections( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBCollectionListResult] + ) + cls: ClsType[_models.MongoDBCollectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2213,7 +1275,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2229,7 +1291,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2237,13 +1299,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MongoDBCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2256,7 +1318,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_mongo_db_collections.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections"} # type: ignore + list_mongo_db_collections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections" + } @distributed_trace_async async def get_mongo_db_collection( @@ -2289,10 +1353,10 @@ async def get_mongo_db_collection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBCollectionGetResults] + ) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_collection_request( resource_group_name=resource_group_name, @@ -2306,9 +1370,9 @@ async def get_mongo_db_collection( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2325,7 +1389,9 @@ async def get_mongo_db_collection( return deserialized - get_mongo_db_collection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + get_mongo_db_collection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } async def _create_update_mongo_db_collection_initial( self, @@ -2347,11 +1413,11 @@ async def _create_update_mongo_db_collection_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoDBCollectionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoDBCollectionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2378,9 +1444,9 @@ async def _create_update_mongo_db_collection_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2391,15 +1457,24 @@ async def _create_update_mongo_db_collection_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_mongo_db_collection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + _create_update_mongo_db_collection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } @overload async def begin_create_update_mongo_db_collection( @@ -2535,16 +1610,16 @@ async def begin_create_update_mongo_db_collection( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBCollectionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_mongo_db_collection_initial( # type: ignore + raw_result = await self._create_update_mongo_db_collection_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2566,7 +1641,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2578,9 +1653,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_db_collection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + begin_create_update_mongo_db_collection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } async def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any @@ -2596,10 +1673,10 @@ async def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-r _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_db_collection_request( resource_group_name=resource_group_name, @@ -2613,9 +1690,9 @@ async def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-r params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2625,10 +1702,19 @@ async def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-r map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_mongo_db_collection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + _delete_mongo_db_collection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } @distributed_trace_async async def begin_delete_mongo_db_collection( @@ -2660,13 +1746,13 @@ async def begin_delete_mongo_db_collection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_mongo_db_collection_initial( # type: ignore resource_group_name=resource_group_name, @@ -2686,258 +1772,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_mongo_db_collection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore - - async def _list_mongo_db_collection_partition_merge_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionStorageInfoCollection]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionStorageInfoCollection]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(merge_parameters, (IO, bytes)): - _content = merge_parameters - else: - _json = self._serialize.body(merge_parameters, "MergeParameters") - - request = build_list_mongo_db_collection_partition_merge_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._list_mongo_db_collection_partition_merge_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _list_mongo_db_collection_partition_merge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore - - @overload - async def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: _models.MergeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionStorageInfoCollection or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionStorageInfoCollection or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. Is either a model type or a IO - type. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionStorageInfoCollection or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionStorageInfoCollection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._list_mongo_db_collection_partition_merge_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - merge_parameters=merge_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2949,9 +1784,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_list_mongo_db_collection_partition_merge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore + begin_delete_mongo_db_collection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } @distributed_trace_async async def get_mongo_db_collection_throughput( @@ -2985,10 +1822,10 @@ async def get_mongo_db_collection_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_collection_throughput_request( resource_group_name=resource_group_name, @@ -3002,9 +1839,9 @@ async def get_mongo_db_collection_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3021,7 +1858,9 @@ async def get_mongo_db_collection_throughput( return deserialized - get_mongo_db_collection_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default"} # type: ignore + get_mongo_db_collection_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default" + } async def _update_mongo_db_collection_throughput_initial( self, @@ -3043,11 +1882,11 @@ async def _update_mongo_db_collection_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3072,9 +1911,9 @@ async def _update_mongo_db_collection_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3085,15 +1924,24 @@ async def _update_mongo_db_collection_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_mongo_db_collection_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default"} # type: ignore + _update_mongo_db_collection_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default" + } @overload async def begin_update_mongo_db_collection_throughput( @@ -3229,16 +2077,16 @@ async def begin_update_mongo_db_collection_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_mongo_db_collection_throughput_initial( # type: ignore + raw_result = await self._update_mongo_db_collection_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3260,7 +2108,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3272,9 +2120,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_mongo_db_collection_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default"} # type: ignore + begin_update_mongo_db_collection_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default" + } async def _migrate_mongo_db_collection_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any @@ -3290,10 +2140,10 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_collection_to_autoscale_request( resource_group_name=resource_group_name, @@ -3307,9 +2157,9 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3320,15 +2170,24 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_mongo_db_collection_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_mongo_db_collection_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_mongo_db_collection_to_autoscale( @@ -3362,15 +2221,15 @@ async def begin_migrate_mongo_db_collection_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_mongo_db_collection_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_mongo_db_collection_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3390,7 +2249,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3402,9 +2261,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_mongo_db_collection_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_mongo_db_collection_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_mongo_db_collection_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any @@ -3420,10 +2281,10 @@ async def _migrate_mongo_db_collection_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_collection_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -3437,9 +2298,9 @@ async def _migrate_mongo_db_collection_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3450,15 +2311,24 @@ async def _migrate_mongo_db_collection_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_mongo_db_collection_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_mongo_db_collection_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def begin_migrate_mongo_db_collection_to_manual_throughput( @@ -3492,15 +2362,15 @@ async def begin_migrate_mongo_db_collection_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_mongo_db_collection_to_manual_throughput_initial( # type: ignore + raw_result = await self._migrate_mongo_db_collection_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3520,7 +2390,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3532,9 +2402,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_mongo_db_collection_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_mongo_db_collection_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def get_mongo_role_definition( @@ -3566,10 +2438,10 @@ async def get_mongo_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoRoleDefinitionGetResults] + ) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) request = build_get_mongo_role_definition_request( mongo_role_definition_id=mongo_role_definition_id, @@ -3582,9 +2454,9 @@ async def get_mongo_role_definition( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3601,7 +2473,9 @@ async def get_mongo_role_definition( return deserialized - get_mongo_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + get_mongo_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } async def _create_update_mongo_role_definition_initial( self, @@ -3622,11 +2496,11 @@ async def _create_update_mongo_role_definition_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoRoleDefinitionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoRoleDefinitionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3652,9 +2526,9 @@ async def _create_update_mongo_role_definition_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3673,7 +2547,9 @@ async def _create_update_mongo_role_definition_initial( return deserialized - _create_update_mongo_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + _create_update_mongo_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } @overload async def begin_create_update_mongo_role_definition( @@ -3800,16 +2676,16 @@ async def begin_create_update_mongo_role_definition( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoRoleDefinitionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_mongo_role_definition_initial( # type: ignore + raw_result = await self._create_update_mongo_role_definition_initial( mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -3830,7 +2706,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3842,9 +2718,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + begin_create_update_mongo_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } async def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent-return-statements self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -3860,10 +2738,10 @@ async def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_role_definition_request( mongo_role_definition_id=mongo_role_definition_id, @@ -3876,9 +2754,9 @@ async def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3891,7 +2769,9 @@ async def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent if cls: return cls(pipeline_response, None, {}) - _delete_mongo_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + _delete_mongo_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } @distributed_trace_async async def begin_delete_mongo_role_definition( @@ -3921,13 +2801,13 @@ async def begin_delete_mongo_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_mongo_role_definition_initial( # type: ignore mongo_role_definition_id=mongo_role_definition_id, @@ -3946,7 +2826,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3958,9 +2838,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_mongo_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + begin_delete_mongo_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } @distributed_trace def list_mongo_role_definitions( @@ -3983,10 +2865,10 @@ def list_mongo_role_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoRoleDefinitionListResult] + ) + cls: ClsType[_models.MongoRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -4009,7 +2891,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -4025,7 +2907,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -4033,13 +2915,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MongoRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -4052,7 +2934,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_mongo_role_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions"} # type: ignore + list_mongo_role_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions" + } @distributed_trace_async async def get_mongo_user_definition( @@ -4084,10 +2968,10 @@ async def get_mongo_user_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoUserDefinitionGetResults] + ) + cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) request = build_get_mongo_user_definition_request( mongo_user_definition_id=mongo_user_definition_id, @@ -4100,9 +2984,9 @@ async def get_mongo_user_definition( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4119,7 +3003,9 @@ async def get_mongo_user_definition( return deserialized - get_mongo_user_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + get_mongo_user_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } async def _create_update_mongo_user_definition_initial( self, @@ -4140,11 +3026,11 @@ async def _create_update_mongo_user_definition_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoUserDefinitionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoUserDefinitionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4170,9 +3056,9 @@ async def _create_update_mongo_user_definition_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4191,7 +3077,9 @@ async def _create_update_mongo_user_definition_initial( return deserialized - _create_update_mongo_user_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + _create_update_mongo_user_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } @overload async def begin_create_update_mongo_user_definition( @@ -4318,16 +3206,16 @@ async def begin_create_update_mongo_user_definition( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoUserDefinitionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_mongo_user_definition_initial( # type: ignore + raw_result = await self._create_update_mongo_user_definition_initial( mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -4348,7 +3236,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4360,9 +3248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_user_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + begin_create_update_mongo_user_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } async def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent-return-statements self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -4378,10 +3268,10 @@ async def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_user_definition_request( mongo_user_definition_id=mongo_user_definition_id, @@ -4394,9 +3284,9 @@ async def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4409,7 +3299,9 @@ async def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent if cls: return cls(pipeline_response, None, {}) - _delete_mongo_user_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + _delete_mongo_user_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } @distributed_trace_async async def begin_delete_mongo_user_definition( @@ -4439,13 +3331,13 @@ async def begin_delete_mongo_user_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_mongo_user_definition_initial( # type: ignore mongo_user_definition_id=mongo_user_definition_id, @@ -4464,7 +3356,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4476,9 +3368,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_mongo_user_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + begin_delete_mongo_user_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } @distributed_trace def list_mongo_user_definitions( @@ -4501,10 +3395,10 @@ def list_mongo_user_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoUserDefinitionListResult] + ) + cls: ClsType[_models.MongoUserDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -4527,7 +3421,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -4543,7 +3437,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -4551,13 +3445,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MongoUserDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -4570,7 +3464,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_mongo_user_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions"} # type: ignore + list_mongo_user_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions" + } async def _retrieve_continuous_backup_information_initial( self, @@ -4592,11 +3488,11 @@ async def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4621,9 +3517,9 @@ async def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4642,7 +3538,9 @@ async def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation" + } @overload async def begin_retrieve_continuous_backup_information( @@ -4771,16 +3669,16 @@ async def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = await self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4802,9 +3700,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4816,6 +3714,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py index 28205c6250ea..dda8a5e5707f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_notebook_workspaces_operations.py @@ -87,10 +87,10 @@ def list_by_database_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspaceListResult] + ) + cls: ClsType[_models.NotebookWorkspaceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,7 +113,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -129,7 +129,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,13 +137,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NotebookWorkspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,7 +157,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces"} # type: ignore + list_by_database_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces" + } @distributed_trace_async async def get( @@ -193,10 +195,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspace] + ) + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -209,9 +211,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -229,7 +231,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } async def _create_or_update_initial( self, @@ -250,11 +254,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspace] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -278,9 +282,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +302,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } @overload async def begin_create_or_update( @@ -425,16 +431,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspace] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, @@ -455,7 +461,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -467,9 +473,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -489,10 +497,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -505,9 +513,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -521,7 +529,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } @distributed_trace_async async def begin_delete( @@ -556,13 +566,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -581,7 +591,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -593,9 +603,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } @distributed_trace_async async def list_connection_info( @@ -631,10 +643,10 @@ async def list_connection_info( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspaceConnectionInfoResult] + ) + cls: ClsType[_models.NotebookWorkspaceConnectionInfoResult] = kwargs.pop("cls", None) request = build_list_connection_info_request( resource_group_name=resource_group_name, @@ -647,9 +659,9 @@ async def list_connection_info( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -667,7 +679,9 @@ async def list_connection_info( return deserialized - list_connection_info.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo"} # type: ignore + list_connection_info.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo" + } async def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-statements self, @@ -687,10 +701,10 @@ async def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_regenerate_auth_token_request( resource_group_name=resource_group_name, @@ -703,9 +717,9 @@ async def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -719,7 +733,9 @@ async def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _regenerate_auth_token_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken"} # type: ignore + _regenerate_auth_token_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken" + } @distributed_trace_async async def begin_regenerate_auth_token( @@ -754,13 +770,13 @@ async def begin_regenerate_auth_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._regenerate_auth_token_initial( # type: ignore resource_group_name=resource_group_name, @@ -779,7 +795,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -791,9 +807,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_regenerate_auth_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken"} # type: ignore + begin_regenerate_auth_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken" + } async def _start_initial( # pylint: disable=inconsistent-return-statements self, @@ -813,10 +831,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -829,9 +847,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -845,7 +863,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start" + } @distributed_trace_async async def begin_start( @@ -880,13 +900,13 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -905,7 +925,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -917,6 +937,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py index fc94e37006bf..9a772a662395 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_operations.py @@ -69,10 +69,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +92,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -108,7 +108,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +116,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -135,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.DocumentDB/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DocumentDB/operations"} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py index 163426b27448..eb2dd88655ec 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_operations.py @@ -93,10 +93,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -123,7 +123,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -139,7 +139,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -147,13 +147,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -166,4 +166,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py index 50a7915bb7b6..a817c010af28 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_partition_key_range_id_region_operations.py @@ -97,10 +97,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -128,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -144,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -152,13 +152,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -171,4 +171,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py index 97c4c2cefa9d..6cb0184b96ae 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_operations.py @@ -81,10 +81,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PercentileMetricListResult] + ) + cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +132,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PercentileMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,4 +151,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py index e7cc706de2a4..9c09ccc549df 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_source_target_operations.py @@ -93,10 +93,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PercentileMetricListResult] + ) + cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -122,7 +122,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -138,7 +138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +146,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PercentileMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -165,4 +165,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py index 39aa19a07c53..97215a259468 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_percentile_target_operations.py @@ -84,10 +84,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PercentileMetricListResult] + ) + cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -112,7 +112,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -128,7 +128,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -136,13 +136,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PercentileMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,4 +155,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py index d79bf1fc3e52..6a32e8f71b06 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_endpoint_connections_operations.py @@ -86,10 +86,10 @@ def list_by_database_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -112,7 +112,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -128,7 +128,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -136,13 +136,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,7 +155,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections"} # type: ignore + list_by_database_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -186,10 +188,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,9 +204,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -221,7 +223,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _create_or_update_initial( self, @@ -242,11 +246,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -270,9 +274,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -292,7 +296,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_create_or_update( @@ -414,16 +420,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -444,7 +450,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -456,9 +462,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -474,10 +482,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -490,9 +498,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -506,7 +514,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -536,13 +546,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -561,7 +571,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -573,6 +583,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py index 3f74aafee8de..7bf9c454d566 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_private_link_resources_operations.py @@ -78,10 +78,10 @@ def list_by_database_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + ) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +104,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +120,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +128,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,7 +147,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources"} # type: ignore + list_by_database_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -178,10 +180,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + ) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -194,9 +196,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -213,4 +215,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py index 42a6eb44655e..c6d238053a9d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_database_accounts_operations.py @@ -83,10 +83,10 @@ def list_by_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] + ) + cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +132,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableDatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,7 +151,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_location.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts"} # type: ignore + list_by_location.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts" + } @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.RestorableDatabaseAccountGetResult"]: @@ -168,10 +170,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.RestorableDatabaseAccoun _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] + ) + cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +194,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +210,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +218,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableDatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +237,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts"} @distributed_trace_async async def get_by_location( @@ -265,10 +267,10 @@ async def get_by_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableDatabaseAccountGetResult] + ) + cls: ClsType[_models.RestorableDatabaseAccountGetResult] = kwargs.pop("cls", None) request = build_get_by_location_request( location=location, @@ -280,9 +282,9 @@ async def get_by_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -299,4 +301,6 @@ async def get_by_location( return deserialized - get_by_location.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}"} # type: ignore + get_by_location.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_databases_operations.py index 9ffd2d6e7b6a..f9844209d3cd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_databases_operations.py @@ -81,10 +81,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableGremlinDatabasesListResult] + ) + cls: ClsType[_models.RestorableGremlinDatabasesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableGremlinDatabasesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -150,4 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_graphs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_graphs_operations.py index b11afe582572..dc8fd6af2d33 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_graphs_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_graphs_operations.py @@ -93,10 +93,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableGremlinGraphsListResult] + ) + cls: ClsType[_models.RestorableGremlinGraphsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -122,7 +122,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -138,7 +138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +146,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableGremlinGraphsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -165,4 +165,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_resources_operations.py index 4bd33c6dbdeb..18ef6d9faa45 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_gremlin_resources_operations.py @@ -92,10 +92,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableGremlinResourcesListResult] + ) + cls: ClsType[_models.RestorableGremlinResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,7 +120,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -136,7 +136,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -144,13 +144,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableGremlinResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -163,4 +163,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py index 7fe523e667fe..fa19102fc255 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_collections_operations.py @@ -93,10 +93,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableMongodbCollectionsListResult] + ) + cls: ClsType[_models.RestorableMongodbCollectionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -122,7 +122,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -138,7 +138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +146,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableMongodbCollectionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -165,4 +165,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py index 28977cd2b3eb..66413c808ce0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_databases_operations.py @@ -81,10 +81,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableMongodbDatabasesListResult] + ) + cls: ClsType[_models.RestorableMongodbDatabasesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableMongodbDatabasesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -150,4 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py index 4ee7e84fd2fb..a414b8c45c07 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_mongodb_resources_operations.py @@ -92,10 +92,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableMongodbResourcesListResult] + ) + cls: ClsType[_models.RestorableMongodbResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,7 +120,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -136,7 +136,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -144,13 +144,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableMongodbResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -163,4 +163,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py index 7b2c3af2f4d1..71721aa0376c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_containers_operations.py @@ -92,10 +92,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableSqlContainersListResult] + ) + cls: ClsType[_models.RestorableSqlContainersListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -121,7 +121,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -137,7 +137,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -145,13 +145,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableSqlContainersListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -164,4 +164,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py index d27cced217ae..3b5386d08240 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_databases_operations.py @@ -81,10 +81,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableSqlDatabasesListResult] + ) + cls: ClsType[_models.RestorableSqlDatabasesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableSqlDatabasesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -150,4 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py index 65124eaf723a..67461d6fd715 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_sql_resources_operations.py @@ -92,10 +92,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableSqlResourcesListResult] + ) + cls: ClsType[_models.RestorableSqlResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,7 +120,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -136,7 +136,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -144,13 +144,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableSqlResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -163,4 +163,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_table_resources_operations.py index c37e1426f095..d750843a26ae 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_table_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_table_resources_operations.py @@ -91,10 +91,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableTableResourcesListResult] + ) + cls: ClsType[_models.RestorableTableResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -119,7 +119,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -135,7 +135,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -143,13 +143,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableTableResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -162,4 +162,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_tables_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_tables_operations.py index 6d3cf445f193..bc30ed2c25af 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_tables_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_restorable_tables_operations.py @@ -89,10 +89,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableTablesListResult] + ) + cls: ClsType[_models.RestorableTablesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,7 +117,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -133,7 +133,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -141,13 +141,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RestorableTablesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -160,4 +160,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py index 51272509c629..b8dbdd0ecc39 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_service_operations.py @@ -84,10 +84,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceResourceListResult] + ) + cls: ClsType[_models.ServiceResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServiceResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services" + } async def _create_initial( self, @@ -174,11 +176,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ServiceResource]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -202,9 +204,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -215,15 +217,24 @@ async def _create_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } @overload async def begin_create( @@ -345,16 +356,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, service_name=service_name, @@ -375,7 +386,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -387,9 +398,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } @distributed_trace_async async def get( @@ -420,10 +433,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceResource] + ) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -436,9 +449,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -455,7 +468,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any @@ -471,10 +486,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -487,9 +502,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -499,10 +514,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } @distributed_trace_async async def begin_delete( @@ -532,13 +556,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -557,7 +581,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -569,6 +593,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py index 2f568d744fea..975e88c83e20 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_sql_resources_operations.py @@ -58,7 +58,6 @@ build_get_sql_trigger_request, build_get_sql_user_defined_function_request, build_list_client_encryption_keys_request, - build_list_sql_container_partition_merge_request, build_list_sql_containers_request, build_list_sql_databases_request, build_list_sql_role_assignments_request, @@ -71,10 +70,6 @@ build_migrate_sql_database_to_autoscale_request, build_migrate_sql_database_to_manual_throughput_request, build_retrieve_continuous_backup_information_request, - build_sql_container_redistribute_throughput_request, - build_sql_container_retrieve_throughput_distribution_request, - build_sql_database_redistribute_throughput_request, - build_sql_database_retrieve_throughput_distribution_request, build_update_sql_container_throughput_request, build_update_sql_database_throughput_request, ) @@ -127,10 +122,10 @@ def list_sql_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlDatabaseListResult] + ) + cls: ClsType[_models.SqlDatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -153,7 +148,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -169,7 +164,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -177,13 +172,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SqlDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -196,7 +191,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_sql_databases.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases"} # type: ignore + list_sql_databases.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases" + } @distributed_trace_async async def get_sql_database( @@ -228,10 +225,10 @@ async def get_sql_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlDatabaseGetResults] + ) + cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) request = build_get_sql_database_request( resource_group_name=resource_group_name, @@ -244,9 +241,9 @@ async def get_sql_database( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -263,7 +260,9 @@ async def get_sql_database( return deserialized - get_sql_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + get_sql_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } async def _create_update_sql_database_initial( self, @@ -284,11 +283,11 @@ async def _create_update_sql_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlDatabaseGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlDatabaseGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -312,9 +311,9 @@ async def _create_update_sql_database_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -325,15 +324,24 @@ async def _create_update_sql_database_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlDatabaseGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + _create_update_sql_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } @overload async def begin_create_update_sql_database( @@ -457,16 +465,16 @@ async def begin_create_update_sql_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlDatabaseGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_database_initial( # type: ignore + raw_result = await self._create_update_sql_database_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -487,7 +495,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -499,9 +507,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + begin_create_update_sql_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } async def _delete_sql_database_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -517,10 +527,10 @@ async def _delete_sql_database_initial( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_database_request( resource_group_name=resource_group_name, @@ -533,9 +543,9 @@ async def _delete_sql_database_initial( # pylint: disable=inconsistent-return-s params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -545,10 +555,19 @@ async def _delete_sql_database_initial( # pylint: disable=inconsistent-return-s map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + _delete_sql_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } @distributed_trace_async async def begin_delete_sql_database( @@ -578,13 +597,13 @@ async def begin_delete_sql_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_sql_database_initial( # type: ignore resource_group_name=resource_group_name, @@ -603,7 +622,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -615,9 +634,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + begin_delete_sql_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } @distributed_trace_async async def get_sql_database_throughput( @@ -649,10 +670,10 @@ async def get_sql_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_sql_database_throughput_request( resource_group_name=resource_group_name, @@ -665,9 +686,9 @@ async def get_sql_database_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -684,7 +705,9 @@ async def get_sql_database_throughput( return deserialized - get_sql_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default"} # type: ignore + get_sql_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + } async def _update_sql_database_throughput_initial( self, @@ -705,11 +728,11 @@ async def _update_sql_database_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -733,9 +756,9 @@ async def _update_sql_database_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -746,15 +769,24 @@ async def _update_sql_database_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_sql_database_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default"} # type: ignore + _update_sql_database_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + } @overload async def begin_update_sql_database_throughput( @@ -881,16 +913,16 @@ async def begin_update_sql_database_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_sql_database_throughput_initial( # type: ignore + raw_result = await self._update_sql_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -911,7 +943,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -923,9 +955,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_sql_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default"} # type: ignore + begin_update_sql_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + } async def _migrate_sql_database_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -941,10 +975,10 @@ async def _migrate_sql_database_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_sql_database_to_autoscale_request( resource_group_name=resource_group_name, @@ -957,9 +991,9 @@ async def _migrate_sql_database_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -970,15 +1004,24 @@ async def _migrate_sql_database_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_sql_database_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_sql_database_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_sql_database_to_autoscale( @@ -1010,15 +1053,15 @@ async def begin_migrate_sql_database_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_sql_database_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_sql_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1037,7 +1080,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1049,9 +1092,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_sql_database_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_sql_database_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_sql_database_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1067,10 +1112,10 @@ async def _migrate_sql_database_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_sql_database_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -1083,9 +1128,9 @@ async def _migrate_sql_database_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1096,15 +1141,24 @@ async def _migrate_sql_database_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_sql_database_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_sql_database_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def begin_migrate_sql_database_to_manual_throughput( @@ -1136,15 +1190,15 @@ async def begin_migrate_sql_database_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_sql_database_to_manual_throughput_initial( # type: ignore + raw_result = await self._migrate_sql_database_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1163,7 +1217,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1175,15 +1229,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_sql_database_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_sql_database_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace - def list_client_encryption_keys( + def list_sql_containers( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ClientEncryptionKeyGetResults"]: - """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. + ) -> AsyncIterable["_models.SqlContainerGetResults"]: + """Lists the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1193,19 +1249,19 @@ def list_client_encryption_keys( :param database_name: Cosmos DB database name. Required. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of + :return: An iterator like instance of either SqlContainerGetResults or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientEncryptionKeysListResult] + ) + cls: ClsType[_models.SqlContainerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1218,18 +1274,18 @@ def list_client_encryption_keys( def prepare_request(next_link=None): if not next_link: - request = build_list_client_encryption_keys_request( + request = build_list_sql_containers_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_client_encryption_keys.metadata["url"], + template_url=self.list_sql_containers.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1245,21 +1301,21 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) + deserialized = self._deserialize("SqlContainerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1272,18 +1328,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_client_encryption_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys"} # type: ignore + list_sql_containers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers" + } @distributed_trace_async - async def get_client_encryption_key( - self, - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - **kwargs: Any - ) -> _models.ClientEncryptionKeyGetResults: - """Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. + async def get_sql_container( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> _models.SqlContainerGetResults: + """Gets the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1292,11 +1345,11 @@ async def get_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ClientEncryptionKeyGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults + :return: SqlContainerGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1310,26 +1363,26 @@ async def get_client_encryption_key( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientEncryptionKeyGetResults] + ) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) - request = build_get_client_encryption_key_request( + request = build_get_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, + container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_client_encryption_key.metadata["url"], + template_url=self.get_sql_container.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1339,24 +1392,26 @@ async def get_client_encryption_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_client_encryption_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + get_sql_container.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } - async def _create_update_client_encryption_key_initial( + async def _create_update_sql_container_initial( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], + container_name: str, + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.ClientEncryptionKeyGetResults]: + ) -> Optional[_models.SqlContainerGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1368,40 +1423,38 @@ async def _create_update_client_encryption_key_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ClientEncryptionKeyGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlContainerGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_client_encryption_key_parameters, (IO, bytes)): - _content = create_update_client_encryption_key_parameters + if isinstance(create_update_sql_container_parameters, (IO, bytes)): + _content = create_update_sql_container_parameters else: - _json = self._serialize.body( - create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" - ) + _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") - request = build_create_update_client_encryption_key_request( + request = build_create_update_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, + container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_update_client_encryption_key_initial.metadata["url"], + template_url=self._create_update_sql_container_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1412,30 +1465,38 @@ async def _create_update_client_encryption_key_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_client_encryption_key_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + _create_update_sql_container_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } @overload - async def begin_create_update_client_encryption_key( + async def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, + container_name: str, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ClientEncryptionKeyGetResults]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). + ) -> AsyncLROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1444,12 +1505,12 @@ async def begin_create_update_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1461,27 +1522,25 @@ async def begin_create_update_client_encryption_key( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns either SqlContainerGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_client_encryption_key( + async def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO, + container_name: str, + create_update_sql_container_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ClientEncryptionKeyGetResults]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). + ) -> AsyncLROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1490,11 +1549,11 @@ async def begin_create_update_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: IO + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1506,25 +1565,23 @@ async def begin_create_update_client_encryption_key( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns either SqlContainerGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_client_encryption_key( + async def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], + container_name: str, + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.ClientEncryptionKeyGetResults]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). + ) -> AsyncLROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1533,12 +1590,12 @@ async def begin_create_update_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Is either a model type or a IO type. Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Is either a model type or a IO type. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -1550,30 +1607,29 @@ async def begin_create_update_client_encryption_key( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns either SqlContainerGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientEncryptionKeyGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_client_encryption_key_initial( # type: ignore + raw_result = await self._create_update_sql_container_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, - create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, + container_name=container_name, + create_update_sql_container_parameters=create_update_sql_container_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1584,13 +1640,13 @@ async def begin_create_update_client_encryption_key( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1602,38 +1658,15 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_client_encryption_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore - - @distributed_trace - def list_sql_containers( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SqlContainerGetResults"]: - """Lists the SQL container under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlContainerGetResults or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlContainerListResult] + begin_create_update_sql_container.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } + async def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1642,70 +1675,132 @@ def list_sql_containers( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_sql_containers_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_sql_containers.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + api_version: Literal["2022-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request + request = build_delete_sql_container_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_sql_container_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - async def extract_data(pipeline_response): - deserialized = self._deserialize("SqlContainerListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - async def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") ) - response = pipeline_response.http_response + response_headers["location"] = self._deserialize("str", response.headers.get("location")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if cls: + return cls(pipeline_response, None, response_headers) - return pipeline_response + _delete_sql_container_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } - return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async + async def begin_delete_sql_container( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_sql_container_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list_sql_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers"} # type: ignore + begin_delete_sql_container.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } @distributed_trace_async - async def get_sql_container( + async def get_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> _models.SqlContainerGetResults: - """Gets the SQL container under an existing Azure Cosmos DB database account. + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database + account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1717,8 +1812,8 @@ async def get_sql_container( :param container_name: Cosmos DB container name. Required. :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SqlContainerGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults + :return: ThroughputSettingsGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1732,26 +1827,26 @@ async def get_sql_container( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlContainerGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - request = build_get_sql_container_request( + request = build_get_sql_container_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_sql_container.metadata["url"], + template_url=self.get_sql_container_throughput.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1761,24 +1856,26 @@ async def get_sql_container( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sql_container.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + get_sql_container_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default" + } - async def _create_update_sql_container_initial( + async def _update_sql_container_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], + update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.SqlContainerGetResults]: + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1790,21 +1887,21 @@ async def _create_update_sql_container_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlContainerGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_sql_container_parameters, (IO, bytes)): - _content = create_update_sql_container_parameters + if isinstance(update_throughput_parameters, (IO, bytes)): + _content = update_throughput_parameters else: - _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") + _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - request = build_create_update_sql_container_request( + request = build_update_sql_container_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1814,14 +1911,14 @@ async def _create_update_sql_container_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_update_sql_container_initial.metadata["url"], + template_url=self._update_sql_container_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1832,29 +1929,38 @@ async def _create_update_sql_container_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_container_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + _update_sql_container_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default" + } @overload - async def begin_create_update_sql_container( + async def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1865,10 +1971,10 @@ async def begin_create_update_sql_container( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1880,25 +1986,26 @@ async def begin_create_update_sql_container( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SqlContainerGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_container( + async def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: IO, + update_throughput_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1909,9 +2016,9 @@ async def begin_create_update_sql_container( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: IO + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1923,23 +2030,24 @@ async def begin_create_update_sql_container( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SqlContainerGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_container( + async def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], + update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1950,10 +2058,10 @@ async def begin_create_update_sql_container( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Is either a model type or a IO type. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Is either a model type or a IO type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -1965,29 +2073,30 @@ async def begin_create_update_sql_container( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SqlContainerGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlContainerGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_container_initial( # type: ignore + raw_result = await self._update_sql_container_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - create_update_sql_container_parameters=create_update_sql_container_parameters, + update_throughput_parameters=update_throughput_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1998,13 +2107,13 @@ async def begin_create_update_sql_container( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2016,13 +2125,15 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_container.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + begin_update_sql_container_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default" + } - async def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statements + async def _migrate_sql_container_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> None: + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2034,45 +2145,60 @@ async def _delete_sql_container_initial( # pylint: disable=inconsistent-return- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_delete_sql_container_request( + request = build_migrate_sql_container_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_sql_container_initial.metadata["url"], + template_url=self._migrate_sql_container_to_autoscale_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) + + return deserialized - _delete_sql_container_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + _migrate_sql_container_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async - async def begin_delete_sql_container( + async def begin_migrate_sql_container_to_autoscale( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2091,22 +2217,24 @@ async def begin_delete_sql_container( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_sql_container_initial( # type: ignore + raw_result = await self._migrate_sql_container_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2119,12 +2247,14 @@ async def begin_delete_sql_container( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2136,19 +2266,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_container.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + begin_migrate_sql_container_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale" + } - async def _list_sql_container_partition_merge_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionStorageInfoCollection]: + async def _migrate_sql_container_to_manual_throughput_initial( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2157,41 +2283,29 @@ async def _list_sql_container_partition_merge_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionStorageInfoCollection]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(merge_parameters, (IO, bytes)): - _content = merge_parameters - else: - _json = self._serialize.body(merge_parameters, "MergeParameters") + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_list_sql_container_partition_merge_request( + request = build_migrate_sql_container_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._list_sql_container_partition_merge_initial.metadata["url"], + template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2202,113 +2316,30 @@ async def _list_sql_container_partition_merge_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _list_sql_container_partition_merge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore - - @overload - async def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: _models.MergeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a SQL Container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionStorageInfoCollection or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a SQL Container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionStorageInfoCollection or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _migrate_sql_container_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async - async def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a SQL Container. + async def begin_migrate_sql_container_to_manual_throughput( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2319,12 +2350,6 @@ async def begin_list_sql_container_partition_merge( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param merge_parameters: The parameters for the merge operation. Is either a model type or a IO - type. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -2333,32 +2358,29 @@ async def begin_list_sql_container_partition_merge( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionStorageInfoCollection or the result of cls(response) + :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionStorageInfoCollection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._list_sql_container_partition_merge_initial( # type: ignore + raw_result = await self._migrate_sql_container_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - merge_parameters=merge_parameters, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -2367,15 +2389,13 @@ async def begin_list_sql_container_partition_merge( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2387,16 +2407,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_list_sql_container_partition_merge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore + begin_migrate_sql_container_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput" + } - @distributed_trace_async - async def get_sql_container_throughput( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database - account. + @distributed_trace + def list_client_encryption_keys( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ClientEncryptionKeyGetResults"]: + """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2405,71 +2426,21 @@ async def get_sql_container_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - - request = build_get_sql_container_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_sql_container_throughput.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs ) + cls: ClsType[_models.ClientEncryptionKeysListResult] = kwargs.pop("cls", None) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_sql_container_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - async def _update_sql_container_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2478,1158 +2449,77 @@ async def _update_sql_container_throughput_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_throughput_parameters, (IO, bytes)): - _content = update_throughput_parameters - else: - _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - - request = build_update_sql_container_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_sql_container_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + def prepare_request(next_link=None): + if not next_link: - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) + request = build_list_client_encryption_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_client_encryption_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - response = pipeline_response.http_response + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + async def extract_data(pipeline_response): + deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + async def get_next(next_link=None): + request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, {}) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response - return deserialized - - _update_sql_container_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - @overload - async def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Is either a model type or a IO type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_sql_container_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_sql_container_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - async def _migrate_sql_container_to_autoscale_initial( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_sql_container_to_autoscale_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_sql_container_to_autoscale_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_sql_container_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - @distributed_trace_async - async def begin_migrate_sql_container_to_autoscale( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_sql_container_to_autoscale_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_sql_container_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - async def _migrate_sql_container_to_manual_throughput_initial( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_sql_container_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_sql_container_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace_async - async def begin_migrate_sql_container_to_manual_throughput( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_sql_container_to_manual_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_sql_container_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - async def _sql_database_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_sql_database_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._sql_database_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _sql_database_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - async def begin_sql_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL database. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_sql_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL database. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_sql_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL database. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._sql_database_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_sql_database_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - async def _sql_database_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters - else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - - request = build_sql_database_redistribute_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._sql_database_redistribute_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _sql_database_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - @overload - async def begin_sql_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL database. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_sql_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL database. Required. - :type redistribute_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_sql_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL database. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._sql_database_redistribute_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_sql_database_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - async def _sql_container_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_sql_container_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._sql_container_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _sql_container_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - async def begin_sql_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - @overload - async def begin_sql_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + return pipeline_response - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + return AsyncItemPaged(get_next, extract_data) + + list_client_encryption_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys" + } @distributed_trace_async - async def begin_sql_container_retrieve_throughput_distribution( + async def get_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], + client_encryption_key_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + ) -> _models.ClientEncryptionKeyGetResults: + """Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3638,90 +2528,73 @@ async def begin_sql_container_retrieve_throughput_distribution( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :return: ClientEncryptionKeyGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._sql_container_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + ) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + request = build_get_client_encryption_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + client_encryption_key_name=client_encryption_key_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_client_encryption_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - begin_sql_container_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) - async def _sql_container_redistribute_throughput_initial( + return deserialized + + get_client_encryption_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}" + } + + async def _create_update_client_encryption_key_initial( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: + ) -> Optional[_models.ClientEncryptionKeyGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3733,38 +2606,40 @@ async def _sql_container_redistribute_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ClientEncryptionKeyGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters + if isinstance(create_update_client_encryption_key_parameters, (IO, bytes)): + _content = create_update_client_encryption_key_parameters else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + _json = self._serialize.body( + create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" + ) - request = build_sql_container_redistribute_throughput_request( + request = build_create_update_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._sql_container_redistribute_throughput_initial.metadata["url"], + template_url=self._create_update_client_encryption_key_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3775,29 +2650,39 @@ async def _sql_container_redistribute_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _sql_container_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + _create_update_client_encryption_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}" + } @overload - async def begin_sql_container_redistribute_throughput( + async def begin_create_update_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ClientEncryptionKeyGetResults]: + """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the + Azure Powershell (instead of directly). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3806,12 +2691,12 @@ async def begin_sql_container_redistribute_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3823,26 +2708,27 @@ async def begin_sql_container_redistribute_throughput( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) + :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_sql_container_redistribute_throughput( + async def begin_create_update_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: IO, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ClientEncryptionKeyGetResults]: + """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the + Azure Powershell (instead of directly). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3851,11 +2737,11 @@ async def begin_sql_container_redistribute_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. Required. - :type redistribute_throughput_parameters: IO + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -3867,24 +2753,25 @@ async def begin_sql_container_redistribute_throughput( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) + :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_sql_container_redistribute_throughput( + async def begin_create_update_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ClientEncryptionKeyGetResults]: + """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the + Azure Powershell (instead of directly). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3893,12 +2780,12 @@ async def begin_sql_container_redistribute_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Is either a model type or a IO type. Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -3910,30 +2797,30 @@ async def begin_sql_container_redistribute_throughput( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - PhysicalPartitionThroughputInfoResult or the result of cls(response) + :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._sql_container_redistribute_throughput_initial( # type: ignore + raw_result = await self._create_update_client_encryption_key_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, + client_encryption_key_name=client_encryption_key_name, + create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3944,15 +2831,13 @@ async def begin_sql_container_redistribute_throughput( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3964,9 +2849,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_sql_container_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + begin_create_update_client_encryption_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}" + } @distributed_trace def list_sql_stored_procedures( @@ -3993,10 +2880,10 @@ def list_sql_stored_procedures( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlStoredProcedureListResult] + ) + cls: ClsType[_models.SqlStoredProcedureListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -4021,7 +2908,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -4037,7 +2924,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -4045,13 +2932,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SqlStoredProcedureListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -4064,7 +2951,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_sql_stored_procedures.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures"} # type: ignore + list_sql_stored_procedures.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures" + } @distributed_trace_async async def get_sql_stored_procedure( @@ -4105,10 +2994,10 @@ async def get_sql_stored_procedure( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlStoredProcedureGetResults] + ) + cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) request = build_get_sql_stored_procedure_request( resource_group_name=resource_group_name, @@ -4123,9 +3012,9 @@ async def get_sql_stored_procedure( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4142,7 +3031,9 @@ async def get_sql_stored_procedure( return deserialized - get_sql_stored_procedure.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + get_sql_stored_procedure.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } async def _create_update_sql_stored_procedure_initial( self, @@ -4165,11 +3056,11 @@ async def _create_update_sql_stored_procedure_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlStoredProcedureGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlStoredProcedureGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4197,9 +3088,9 @@ async def _create_update_sql_stored_procedure_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4210,15 +3101,24 @@ async def _create_update_sql_stored_procedure_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlStoredProcedureGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_stored_procedure_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + _create_update_sql_stored_procedure_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } @overload async def begin_create_update_sql_stored_procedure( @@ -4363,16 +3263,16 @@ async def begin_create_update_sql_stored_procedure( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlStoredProcedureGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_stored_procedure_initial( # type: ignore + raw_result = await self._create_update_sql_stored_procedure_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4395,7 +3295,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4407,9 +3307,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_stored_procedure.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + begin_create_update_sql_stored_procedure.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } async def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent-return-statements self, @@ -4431,10 +3333,10 @@ async def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_stored_procedure_request( resource_group_name=resource_group_name, @@ -4449,9 +3351,9 @@ async def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4461,10 +3363,19 @@ async def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent- map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_stored_procedure_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + _delete_sql_stored_procedure_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } @distributed_trace_async async def begin_delete_sql_stored_procedure( @@ -4504,13 +3415,13 @@ async def begin_delete_sql_stored_procedure( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_sql_stored_procedure_initial( # type: ignore resource_group_name=resource_group_name, @@ -4531,7 +3442,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4543,9 +3454,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_stored_procedure.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + begin_delete_sql_stored_procedure.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } @distributed_trace def list_sql_user_defined_functions( @@ -4572,10 +3485,10 @@ def list_sql_user_defined_functions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlUserDefinedFunctionListResult] + ) + cls: ClsType[_models.SqlUserDefinedFunctionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -4600,7 +3513,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -4616,7 +3529,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -4624,13 +3537,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SqlUserDefinedFunctionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -4643,7 +3556,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_sql_user_defined_functions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions"} # type: ignore + list_sql_user_defined_functions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions" + } @distributed_trace_async async def get_sql_user_defined_function( @@ -4684,10 +3599,10 @@ async def get_sql_user_defined_function( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] + ) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) request = build_get_sql_user_defined_function_request( resource_group_name=resource_group_name, @@ -4702,9 +3617,9 @@ async def get_sql_user_defined_function( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4721,7 +3636,9 @@ async def get_sql_user_defined_function( return deserialized - get_sql_user_defined_function.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + get_sql_user_defined_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } async def _create_update_sql_user_defined_function_initial( self, @@ -4746,11 +3663,11 @@ async def _create_update_sql_user_defined_function_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlUserDefinedFunctionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlUserDefinedFunctionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4778,9 +3695,9 @@ async def _create_update_sql_user_defined_function_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4791,15 +3708,24 @@ async def _create_update_sql_user_defined_function_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlUserDefinedFunctionGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_user_defined_function_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + _create_update_sql_user_defined_function_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } @overload async def begin_create_update_sql_user_defined_function( @@ -4946,16 +3872,16 @@ async def begin_create_update_sql_user_defined_function( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_user_defined_function_initial( # type: ignore + raw_result = await self._create_update_sql_user_defined_function_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4978,7 +3904,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4990,9 +3916,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_user_defined_function.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + begin_create_update_sql_user_defined_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } async def _delete_sql_user_defined_function_initial( # pylint: disable=inconsistent-return-statements self, @@ -5014,10 +3942,10 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=inconsis _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_user_defined_function_request( resource_group_name=resource_group_name, @@ -5032,9 +3960,9 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=inconsis params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5044,10 +3972,19 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=inconsis map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_user_defined_function_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + _delete_sql_user_defined_function_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } @distributed_trace_async async def begin_delete_sql_user_defined_function( @@ -5087,13 +4024,13 @@ async def begin_delete_sql_user_defined_function( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_sql_user_defined_function_initial( # type: ignore resource_group_name=resource_group_name, @@ -5114,7 +4051,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -5126,9 +4063,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_user_defined_function.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + begin_delete_sql_user_defined_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } @distributed_trace def list_sql_triggers( @@ -5155,10 +4094,10 @@ def list_sql_triggers( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlTriggerListResult] + ) + cls: ClsType[_models.SqlTriggerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5183,7 +4122,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -5199,7 +4138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -5207,13 +4146,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SqlTriggerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5226,7 +4165,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_sql_triggers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers"} # type: ignore + list_sql_triggers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + } @distributed_trace_async async def get_sql_trigger( @@ -5267,10 +4208,10 @@ async def get_sql_trigger( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlTriggerGetResults] + ) + cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) request = build_get_sql_trigger_request( resource_group_name=resource_group_name, @@ -5285,9 +4226,9 @@ async def get_sql_trigger( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5304,7 +4245,9 @@ async def get_sql_trigger( return deserialized - get_sql_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + get_sql_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } async def _create_update_sql_trigger_initial( self, @@ -5327,11 +4270,11 @@ async def _create_update_sql_trigger_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlTriggerGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlTriggerGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5357,9 +4300,9 @@ async def _create_update_sql_trigger_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5370,15 +4313,24 @@ async def _create_update_sql_trigger_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlTriggerGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + _create_update_sql_trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } @overload async def begin_create_update_sql_trigger( @@ -5520,16 +4472,16 @@ async def begin_create_update_sql_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlTriggerGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_trigger_initial( # type: ignore + raw_result = await self._create_update_sql_trigger_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -5552,7 +4504,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -5564,9 +4516,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + begin_create_update_sql_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } async def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-statements self, @@ -5588,10 +4542,10 @@ async def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_trigger_request( resource_group_name=resource_group_name, @@ -5606,9 +4560,9 @@ async def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5618,10 +4572,19 @@ async def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-st map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + _delete_sql_trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } @distributed_trace_async async def begin_delete_sql_trigger( @@ -5661,13 +4624,13 @@ async def begin_delete_sql_trigger( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_sql_trigger_initial( # type: ignore resource_group_name=resource_group_name, @@ -5688,7 +4651,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -5700,9 +4663,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + begin_delete_sql_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } @distributed_trace_async async def get_sql_role_definition( @@ -5733,10 +4698,10 @@ async def get_sql_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleDefinitionGetResults] + ) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) request = build_get_sql_role_definition_request( role_definition_id=role_definition_id, @@ -5749,9 +4714,9 @@ async def get_sql_role_definition( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5768,7 +4733,9 @@ async def get_sql_role_definition( return deserialized - get_sql_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + get_sql_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } async def _create_update_sql_role_definition_initial( self, @@ -5789,11 +4756,11 @@ async def _create_update_sql_role_definition_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlRoleDefinitionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlRoleDefinitionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5819,9 +4786,9 @@ async def _create_update_sql_role_definition_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5840,7 +4807,9 @@ async def _create_update_sql_role_definition_initial( return deserialized - _create_update_sql_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + _create_update_sql_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } @overload async def begin_create_update_sql_role_definition( @@ -5967,16 +4936,16 @@ async def begin_create_update_sql_role_definition( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleDefinitionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_role_definition_initial( # type: ignore + raw_result = await self._create_update_sql_role_definition_initial( role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -5997,7 +4966,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -6009,9 +4978,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + begin_create_update_sql_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } async def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-return-statements self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -6027,10 +4998,10 @@ async def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-r _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_role_definition_request( role_definition_id=role_definition_id, @@ -6043,9 +5014,9 @@ async def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-r params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6058,7 +5029,9 @@ async def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-r if cls: return cls(pipeline_response, None, {}) - _delete_sql_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + _delete_sql_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } @distributed_trace_async async def begin_delete_sql_role_definition( @@ -6088,13 +5061,13 @@ async def begin_delete_sql_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_sql_role_definition_initial( # type: ignore role_definition_id=role_definition_id, @@ -6113,7 +5086,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -6125,9 +5098,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + begin_delete_sql_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } @distributed_trace def list_sql_role_definitions( @@ -6150,10 +5125,10 @@ def list_sql_role_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleDefinitionListResult] + ) + cls: ClsType[_models.SqlRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -6176,7 +5151,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -6192,7 +5167,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -6200,13 +5175,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SqlRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -6219,7 +5194,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_sql_role_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions"} # type: ignore + list_sql_role_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions" + } @distributed_trace_async async def get_sql_role_assignment( @@ -6250,10 +5227,10 @@ async def get_sql_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleAssignmentGetResults] + ) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = kwargs.pop("cls", None) request = build_get_sql_role_assignment_request( role_assignment_id=role_assignment_id, @@ -6266,9 +5243,9 @@ async def get_sql_role_assignment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6285,7 +5262,9 @@ async def get_sql_role_assignment( return deserialized - get_sql_role_assignment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + get_sql_role_assignment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } async def _create_update_sql_role_assignment_initial( self, @@ -6306,11 +5285,11 @@ async def _create_update_sql_role_assignment_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlRoleAssignmentGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlRoleAssignmentGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6336,9 +5315,9 @@ async def _create_update_sql_role_assignment_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6357,7 +5336,9 @@ async def _create_update_sql_role_assignment_initial( return deserialized - _create_update_sql_role_assignment_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + _create_update_sql_role_assignment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } @overload async def begin_create_update_sql_role_assignment( @@ -6484,16 +5465,16 @@ async def begin_create_update_sql_role_assignment( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleAssignmentGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_role_assignment_initial( # type: ignore + raw_result = await self._create_update_sql_role_assignment_initial( role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, @@ -6514,7 +5495,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -6526,9 +5507,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_role_assignment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + begin_create_update_sql_role_assignment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } async def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-return-statements self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -6544,10 +5527,10 @@ async def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-r _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_role_assignment_request( role_assignment_id=role_assignment_id, @@ -6560,9 +5543,9 @@ async def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-r params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6575,7 +5558,9 @@ async def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-r if cls: return cls(pipeline_response, None, {}) - _delete_sql_role_assignment_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + _delete_sql_role_assignment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } @distributed_trace_async async def begin_delete_sql_role_assignment( @@ -6605,13 +5590,13 @@ async def begin_delete_sql_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_sql_role_assignment_initial( # type: ignore role_assignment_id=role_assignment_id, @@ -6630,7 +5615,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -6642,9 +5627,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_role_assignment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + begin_delete_sql_role_assignment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } @distributed_trace def list_sql_role_assignments( @@ -6667,10 +5654,10 @@ def list_sql_role_assignments( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleAssignmentListResult] + ) + cls: ClsType[_models.SqlRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -6693,7 +5680,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -6709,7 +5696,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -6717,13 +5704,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SqlRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -6736,7 +5723,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_sql_role_assignments.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments"} # type: ignore + list_sql_role_assignments.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments" + } async def _retrieve_continuous_backup_information_initial( self, @@ -6758,11 +5747,11 @@ async def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6787,9 +5776,9 @@ async def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6808,7 +5797,9 @@ async def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation" + } @overload async def begin_retrieve_continuous_backup_information( @@ -6937,16 +5928,16 @@ async def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = await self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -6968,9 +5959,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -6982,6 +5973,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py index 7fb87c8f5e24..6b6c1a91f76a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_table_resources_operations.py @@ -89,10 +89,10 @@ def list_tables( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TableListResult] + ) + cls: ClsType[_models.TableListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -131,7 +131,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -139,13 +139,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TableListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_tables.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables"} # type: ignore + list_tables.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables" + } @distributed_trace_async async def get_table( @@ -189,10 +191,10 @@ async def get_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TableGetResults] + ) + cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) request = build_get_table_request( resource_group_name=resource_group_name, @@ -205,9 +207,9 @@ async def get_table( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -224,7 +226,9 @@ async def get_table( return deserialized - get_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + get_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } async def _create_update_table_initial( self, @@ -245,11 +249,11 @@ async def _create_update_table_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.TableGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.TableGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -273,9 +277,9 @@ async def _create_update_table_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -286,15 +290,24 @@ async def _create_update_table_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("TableGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + _create_update_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } @overload async def begin_create_update_table( @@ -417,16 +430,16 @@ async def begin_create_update_table( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TableGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_table_initial( # type: ignore + raw_result = await self._create_update_table_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -447,7 +460,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -459,9 +472,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + begin_create_update_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } async def _delete_table_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any @@ -477,10 +492,10 @@ async def _delete_table_initial( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_table_request( resource_group_name=resource_group_name, @@ -493,9 +508,9 @@ async def _delete_table_initial( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,10 +520,19 @@ async def _delete_table_initial( # pylint: disable=inconsistent-return-statemen map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + _delete_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } @distributed_trace_async async def begin_delete_table( @@ -538,13 +562,13 @@ async def begin_delete_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_table_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,7 +587,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -575,9 +599,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + begin_delete_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } @distributed_trace_async async def get_table_throughput( @@ -609,10 +635,10 @@ async def get_table_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_table_throughput_request( resource_group_name=resource_group_name, @@ -625,9 +651,9 @@ async def get_table_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -644,7 +670,9 @@ async def get_table_throughput( return deserialized - get_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default"} # type: ignore + get_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + } async def _update_table_throughput_initial( self, @@ -665,11 +693,11 @@ async def _update_table_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -693,9 +721,9 @@ async def _update_table_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -706,15 +734,24 @@ async def _update_table_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_table_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default"} # type: ignore + _update_table_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + } @overload async def begin_update_table_throughput( @@ -841,16 +878,16 @@ async def begin_update_table_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_table_throughput_initial( # type: ignore + raw_result = await self._update_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -871,7 +908,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -883,9 +920,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default"} # type: ignore + begin_update_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + } async def _migrate_table_to_autoscale_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any @@ -901,10 +940,10 @@ async def _migrate_table_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_table_to_autoscale_request( resource_group_name=resource_group_name, @@ -917,9 +956,9 @@ async def _migrate_table_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -930,15 +969,24 @@ async def _migrate_table_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_table_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_table_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace_async async def begin_migrate_table_to_autoscale( @@ -970,15 +1018,15 @@ async def begin_migrate_table_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_table_to_autoscale_initial( # type: ignore + raw_result = await self._migrate_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -997,7 +1045,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1009,9 +1057,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_table_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_table_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } async def _migrate_table_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any @@ -1027,10 +1077,10 @@ async def _migrate_table_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_table_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -1043,9 +1093,9 @@ async def _migrate_table_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1056,15 +1106,24 @@ async def _migrate_table_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_table_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_table_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace_async async def begin_migrate_table_to_manual_throughput( @@ -1096,15 +1155,15 @@ async def begin_migrate_table_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_table_to_manual_throughput_initial( # type: ignore + raw_result = await self._migrate_table_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -1123,7 +1182,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1135,9 +1194,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_table_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_table_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } async def _retrieve_continuous_backup_information_initial( self, @@ -1158,11 +1219,11 @@ async def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1186,9 +1247,9 @@ async def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1207,7 +1268,9 @@ async def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation" + } @overload async def begin_retrieve_continuous_backup_information( @@ -1327,16 +1390,16 @@ async def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = await self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -1357,9 +1420,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1371,6 +1434,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py index b4f2e142fde6..312a0f07b69a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py @@ -11,16 +11,12 @@ from ._models_py3 import AccountKeyMetadata from ._models_py3 import AnalyticalStorageConfiguration from ._models_py3 import ApiProperties -from ._models_py3 import AuthenticationMethodLdapProperties from ._models_py3 import AutoUpgradePolicyResource from ._models_py3 import AutoscaleSettings from ._models_py3 import AutoscaleSettingsResource -from ._models_py3 import AzureBlobDataTransferDataSourceSink from ._models_py3 import BackupInformation from ._models_py3 import BackupPolicy from ._models_py3 import BackupPolicyMigrationState -from ._models_py3 import BackupResource -from ._models_py3 import BackupResourceProperties from ._models_py3 import Capability from ._models_py3 import Capacity from ._models_py3 import CassandraClusterDataCenterNodeItem @@ -40,12 +36,6 @@ from ._models_py3 import CassandraTableGetResults from ._models_py3 import CassandraTableListResult from ._models_py3 import CassandraTableResource -from ._models_py3 import CassandraViewCreateUpdateParameters -from ._models_py3 import CassandraViewGetPropertiesOptions -from ._models_py3 import CassandraViewGetPropertiesResource -from ._models_py3 import CassandraViewGetResults -from ._models_py3 import CassandraViewListResult -from ._models_py3 import CassandraViewResource from ._models_py3 import Certificate from ._models_py3 import ClientEncryptionIncludedPath from ._models_py3 import ClientEncryptionKeyCreateUpdateParameters @@ -68,19 +58,10 @@ from ._models_py3 import ContinuousBackupInformation from ._models_py3 import ContinuousBackupRestoreLocation from ._models_py3 import ContinuousModeBackupPolicy -from ._models_py3 import ContinuousModeProperties from ._models_py3 import CorsPolicy -from ._models_py3 import CosmosCassandraDataTransferDataSourceSink -from ._models_py3 import CosmosMongoDataTransferDataSourceSink -from ._models_py3 import CosmosSqlDataTransferDataSourceSink -from ._models_py3 import CreateJobRequest from ._models_py3 import CreateUpdateOptions from ._models_py3 import DataCenterResource from ._models_py3 import DataCenterResourceProperties -from ._models_py3 import DataTransferDataSourceSink -from ._models_py3 import DataTransferJobFeedResults -from ._models_py3 import DataTransferJobGetResults -from ._models_py3 import DataTransferJobProperties from ._models_py3 import DataTransferRegionalServiceResource from ._models_py3 import DataTransferServiceResource from ._models_py3 import DataTransferServiceResourceProperties @@ -95,7 +76,6 @@ from ._models_py3 import DatabaseAccountUpdateParameters from ._models_py3 import DatabaseAccountsListResult from ._models_py3 import DatabaseRestoreResource -from ._models_py3 import DiagnosticLogSettings from ._models_py3 import ErrorResponse from ._models_py3 import ExcludedPath from ._models_py3 import ExtendedResourceProperties @@ -104,12 +84,6 @@ from ._models_py3 import GraphAPIComputeRegionalServiceResource from ._models_py3 import GraphAPIComputeServiceResource from ._models_py3 import GraphAPIComputeServiceResourceProperties -from ._models_py3 import GraphResource -from ._models_py3 import GraphResourceCreateUpdateParameters -from ._models_py3 import GraphResourceGetPropertiesOptions -from ._models_py3 import GraphResourceGetPropertiesResource -from ._models_py3 import GraphResourceGetResults -from ._models_py3 import GraphResourcesListResult from ._models_py3 import GremlinDatabaseCreateUpdateParameters from ._models_py3 import GremlinDatabaseGetPropertiesOptions from ._models_py3 import GremlinDatabaseGetPropertiesResource @@ -128,7 +102,6 @@ from ._models_py3 import IndexingPolicy from ._models_py3 import IpAddressOrRange from ._models_py3 import KeyWrapMetadata -from ._models_py3 import ListBackups from ._models_py3 import ListClusters from ._models_py3 import ListDataCenters from ._models_py3 import Location @@ -143,7 +116,6 @@ from ._models_py3 import MaterializedViewsBuilderRegionalServiceResource from ._models_py3 import MaterializedViewsBuilderServiceResource from ._models_py3 import MaterializedViewsBuilderServiceResourceProperties -from ._models_py3 import MergeParameters from ._models_py3 import Metric from ._models_py3 import MetricAvailability from ._models_py3 import MetricDefinition @@ -190,13 +162,6 @@ from ._models_py3 import PeriodicModeBackupPolicy from ._models_py3 import PeriodicModeProperties from ._models_py3 import Permission -from ._models_py3 import PhysicalPartitionId -from ._models_py3 import PhysicalPartitionStorageInfo -from ._models_py3 import PhysicalPartitionStorageInfoCollection -from ._models_py3 import PhysicalPartitionThroughputInfoProperties -from ._models_py3 import PhysicalPartitionThroughputInfoResource -from ._models_py3 import PhysicalPartitionThroughputInfoResult -from ._models_py3 import PhysicalPartitionThroughputInfoResultPropertiesResource from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionListResult from ._models_py3 import PrivateEndpointProperty @@ -206,12 +171,9 @@ from ._models_py3 import Privilege from ._models_py3 import PrivilegeResource from ._models_py3 import ProxyResource -from ._models_py3 import RedistributeThroughputParameters -from ._models_py3 import RedistributeThroughputPropertiesResource from ._models_py3 import RegionForOnlineOffline from ._models_py3 import RegionalServiceResource from ._models_py3 import Resource -from ._models_py3 import ResourceRestoreParameters from ._models_py3 import RestorableDatabaseAccountGetResult from ._models_py3 import RestorableDatabaseAccountsListResult from ._models_py3 import RestorableGremlinDatabaseGetResult @@ -247,9 +209,6 @@ from ._models_py3 import RestorableTableResourcesListResult from ._models_py3 import RestorableTablesListResult from ._models_py3 import RestoreParameters -from ._models_py3 import RestoreParametersBase -from ._models_py3 import RetrieveThroughputParameters -from ._models_py3 import RetrieveThroughputPropertiesResource from ._models_py3 import Role from ._models_py3 import SeedNode from ._models_py3 import ServiceResource @@ -321,19 +280,17 @@ from ._cosmos_db_management_client_enums import ConflictResolutionMode from ._cosmos_db_management_client_enums import ConnectionState from ._cosmos_db_management_client_enums import ConnectorOffer -from ._cosmos_db_management_client_enums import ContinuousTier from ._cosmos_db_management_client_enums import CreateMode from ._cosmos_db_management_client_enums import CreatedByType -from ._cosmos_db_management_client_enums import DataTransferComponent from ._cosmos_db_management_client_enums import DataType from ._cosmos_db_management_client_enums import DatabaseAccountKind from ._cosmos_db_management_client_enums import DefaultConsistencyLevel -from ._cosmos_db_management_client_enums import EnableFullTextQuery from ._cosmos_db_management_client_enums import IndexKind from ._cosmos_db_management_client_enums import IndexingMode from ._cosmos_db_management_client_enums import KeyKind from ._cosmos_db_management_client_enums import ManagedCassandraProvisioningState from ._cosmos_db_management_client_enums import ManagedCassandraResourceIdentityType +from ._cosmos_db_management_client_enums import MinimalTlsVersion from ._cosmos_db_management_client_enums import MongoRoleDefinitionType from ._cosmos_db_management_client_enums import NetworkAclBypass from ._cosmos_db_management_client_enums import NodeState @@ -351,12 +308,11 @@ from ._cosmos_db_management_client_enums import ServiceStatus from ._cosmos_db_management_client_enums import ServiceType from ._cosmos_db_management_client_enums import SpatialType -from ._cosmos_db_management_client_enums import ThroughputPolicyType from ._cosmos_db_management_client_enums import TriggerOperation from ._cosmos_db_management_client_enums import TriggerType from ._cosmos_db_management_client_enums import UnitType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -365,16 +321,12 @@ "AccountKeyMetadata", "AnalyticalStorageConfiguration", "ApiProperties", - "AuthenticationMethodLdapProperties", "AutoUpgradePolicyResource", "AutoscaleSettings", "AutoscaleSettingsResource", - "AzureBlobDataTransferDataSourceSink", "BackupInformation", "BackupPolicy", "BackupPolicyMigrationState", - "BackupResource", - "BackupResourceProperties", "Capability", "Capacity", "CassandraClusterDataCenterNodeItem", @@ -394,12 +346,6 @@ "CassandraTableGetResults", "CassandraTableListResult", "CassandraTableResource", - "CassandraViewCreateUpdateParameters", - "CassandraViewGetPropertiesOptions", - "CassandraViewGetPropertiesResource", - "CassandraViewGetResults", - "CassandraViewListResult", - "CassandraViewResource", "Certificate", "ClientEncryptionIncludedPath", "ClientEncryptionKeyCreateUpdateParameters", @@ -422,19 +368,10 @@ "ContinuousBackupInformation", "ContinuousBackupRestoreLocation", "ContinuousModeBackupPolicy", - "ContinuousModeProperties", "CorsPolicy", - "CosmosCassandraDataTransferDataSourceSink", - "CosmosMongoDataTransferDataSourceSink", - "CosmosSqlDataTransferDataSourceSink", - "CreateJobRequest", "CreateUpdateOptions", "DataCenterResource", "DataCenterResourceProperties", - "DataTransferDataSourceSink", - "DataTransferJobFeedResults", - "DataTransferJobGetResults", - "DataTransferJobProperties", "DataTransferRegionalServiceResource", "DataTransferServiceResource", "DataTransferServiceResourceProperties", @@ -449,7 +386,6 @@ "DatabaseAccountUpdateParameters", "DatabaseAccountsListResult", "DatabaseRestoreResource", - "DiagnosticLogSettings", "ErrorResponse", "ExcludedPath", "ExtendedResourceProperties", @@ -458,12 +394,6 @@ "GraphAPIComputeRegionalServiceResource", "GraphAPIComputeServiceResource", "GraphAPIComputeServiceResourceProperties", - "GraphResource", - "GraphResourceCreateUpdateParameters", - "GraphResourceGetPropertiesOptions", - "GraphResourceGetPropertiesResource", - "GraphResourceGetResults", - "GraphResourcesListResult", "GremlinDatabaseCreateUpdateParameters", "GremlinDatabaseGetPropertiesOptions", "GremlinDatabaseGetPropertiesResource", @@ -482,7 +412,6 @@ "IndexingPolicy", "IpAddressOrRange", "KeyWrapMetadata", - "ListBackups", "ListClusters", "ListDataCenters", "Location", @@ -497,7 +426,6 @@ "MaterializedViewsBuilderRegionalServiceResource", "MaterializedViewsBuilderServiceResource", "MaterializedViewsBuilderServiceResourceProperties", - "MergeParameters", "Metric", "MetricAvailability", "MetricDefinition", @@ -544,13 +472,6 @@ "PeriodicModeBackupPolicy", "PeriodicModeProperties", "Permission", - "PhysicalPartitionId", - "PhysicalPartitionStorageInfo", - "PhysicalPartitionStorageInfoCollection", - "PhysicalPartitionThroughputInfoProperties", - "PhysicalPartitionThroughputInfoResource", - "PhysicalPartitionThroughputInfoResult", - "PhysicalPartitionThroughputInfoResultPropertiesResource", "PrivateEndpointConnection", "PrivateEndpointConnectionListResult", "PrivateEndpointProperty", @@ -560,12 +481,9 @@ "Privilege", "PrivilegeResource", "ProxyResource", - "RedistributeThroughputParameters", - "RedistributeThroughputPropertiesResource", "RegionForOnlineOffline", "RegionalServiceResource", "Resource", - "ResourceRestoreParameters", "RestorableDatabaseAccountGetResult", "RestorableDatabaseAccountsListResult", "RestorableGremlinDatabaseGetResult", @@ -601,9 +519,6 @@ "RestorableTableResourcesListResult", "RestorableTablesListResult", "RestoreParameters", - "RestoreParametersBase", - "RetrieveThroughputParameters", - "RetrieveThroughputPropertiesResource", "Role", "SeedNode", "ServiceResource", @@ -674,19 +589,17 @@ "ConflictResolutionMode", "ConnectionState", "ConnectorOffer", - "ContinuousTier", "CreateMode", "CreatedByType", - "DataTransferComponent", "DataType", "DatabaseAccountKind", "DefaultConsistencyLevel", - "EnableFullTextQuery", "IndexKind", "IndexingMode", "KeyKind", "ManagedCassandraProvisioningState", "ManagedCassandraResourceIdentityType", + "MinimalTlsVersion", "MongoRoleDefinitionType", "NetworkAclBypass", "NodeState", @@ -704,7 +617,6 @@ "ServiceStatus", "ServiceType", "SpatialType", - "ThroughputPolicyType", "TriggerOperation", "TriggerType", "UnitType", diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py index ac1f2e1659fd..5344cf1b9a3d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_cosmos_db_management_client_enums.py @@ -31,12 +31,11 @@ class ApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class AuthenticationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default - password based authentication. The default is 'Cassandra'. 'Ldap' is in preview. + password based authentication. The default is 'Cassandra'. """ NONE = "None" CASSANDRA = "Cassandra" - LDAP = "Ldap" class BackupPolicyMigrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -94,13 +93,6 @@ class ConnectorOffer(str, Enum, metaclass=CaseInsensitiveEnumMeta): SMALL = "Small" -class ContinuousTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum to indicate type of Continuous backup tier.""" - - CONTINUOUS7_DAYS = "Continuous7Days" - CONTINUOUS30_DAYS = "Continuous30Days" - - class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -125,15 +117,6 @@ class DatabaseAccountKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): PARSE = "Parse" -class DataTransferComponent(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """DataTransferComponent.""" - - COSMOS_DB_CASSANDRA = "CosmosDBCassandra" - COSMOS_DB_MONGO = "CosmosDBMongo" - COSMOS_DB_SQL = "CosmosDBSql" - AZURE_BLOB_STORAGE = "AzureBlobStorage" - - class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The datatype for which the indexing behavior is applied to.""" @@ -155,14 +138,6 @@ class DefaultConsistencyLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONSISTENT_PREFIX = "ConsistentPrefix" -class EnableFullTextQuery(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Describe the level of detail with which queries are to be logged.""" - - NONE = "None" - TRUE = "True" - FALSE = "False" - - class IndexingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the indexing mode.""" @@ -206,6 +181,16 @@ class ManagedCassandraResourceIdentityType(str, Enum, metaclass=CaseInsensitiveE NONE = "None" +class MinimalTlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and + Mongo API's, which only work with Tls 1.2. + """ + + TLS = "Tls" + TLS11 = "Tls11" + TLS12 = "Tls12" + + class MongoRoleDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether the Role Definition was built-in or user created.""" @@ -249,7 +234,6 @@ class OperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CREATE = "Create" REPLACE = "Replace" DELETE = "Delete" - RECREATE = "Recreate" SYSTEM_OPERATION = "SystemOperation" @@ -352,14 +336,6 @@ class SpatialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MULTI_POLYGON = "MultiPolygon" -class ThroughputPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ThroughputPolicy to apply for throughput redistribution.""" - - NONE = "none" - EQUAL = "equal" - CUSTOM = "custom" - - class TriggerOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation the trigger is associated with.""" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py index 5d97d53df9cc..d821e80b495e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py @@ -8,20 +8,13 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AccountKeyMetadata(_serialization.Model): @@ -43,7 +36,7 @@ class AccountKeyMetadata(_serialization.Model): "generation_time": {"key": "generationTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.generation_time = None @@ -61,7 +54,9 @@ class AnalyticalStorageConfiguration(_serialization.Model): "schema_type": {"key": "schemaType", "type": "str"}, } - def __init__(self, *, schema_type: Optional[Union[str, "_models.AnalyticalStorageSchemaType"]] = None, **kwargs): + def __init__( + self, *, schema_type: Optional[Union[str, "_models.AnalyticalStorageSchemaType"]] = None, **kwargs: Any + ) -> None: """ :keyword schema_type: Describes the types of schema for analytical storage. Known values are: "WellDefined" and "FullFidelity". @@ -83,7 +78,7 @@ class ApiProperties(_serialization.Model): "server_version": {"key": "serverVersion", "type": "str"}, } - def __init__(self, *, server_version: Optional[Union[str, "_models.ServerVersion"]] = None, **kwargs): + def __init__(self, *, server_version: Optional[Union[str, "_models.ServerVersion"]] = None, **kwargs: Any) -> None: """ :keyword server_version: Describes the ServerVersion of an a MongoDB account. Known values are: "3.2", "3.6", "4.0", and "4.2". @@ -94,7 +89,8 @@ def __init__(self, *, server_version: Optional[Union[str, "_models.ServerVersion class ARMProxyResource(_serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than + required location and tags. Variables are only populated by the server, and will be ignored when sending a request. @@ -118,7 +114,7 @@ class ARMProxyResource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -146,8 +142,6 @@ class ARMResourceProperties(_serialization.Model): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity """ _validation = { @@ -162,17 +156,9 @@ class ARMResourceProperties(_serialization.Model): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -183,8 +169,6 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity """ super().__init__(**kwargs) self.id = None @@ -192,80 +176,6 @@ def __init__( self.type = None self.location = location self.tags = tags - self.identity = identity - - -class AuthenticationMethodLdapProperties(_serialization.Model): - """Ldap authentication method properties. This feature is in preview. - - :ivar server_hostname: Hostname of the LDAP server. - :vartype server_hostname: str - :ivar server_port: Port of the LDAP server. - :vartype server_port: int - :ivar service_user_distinguished_name: Distinguished name of the look up user account, who can - look up user details on authentication. - :vartype service_user_distinguished_name: str - :ivar service_user_password: Password of the look up user. - :vartype service_user_password: str - :ivar search_base_distinguished_name: Distinguished name of the object to start the recursive - search of users from. - :vartype search_base_distinguished_name: str - :ivar search_filter_template: Template to use for searching. Defaults to (cn=%s) where %s will - be replaced by the username used to login. - :vartype search_filter_template: str - :ivar server_certificates: - :vartype server_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - """ - - _attribute_map = { - "server_hostname": {"key": "serverHostname", "type": "str"}, - "server_port": {"key": "serverPort", "type": "int"}, - "service_user_distinguished_name": {"key": "serviceUserDistinguishedName", "type": "str"}, - "service_user_password": {"key": "serviceUserPassword", "type": "str"}, - "search_base_distinguished_name": {"key": "searchBaseDistinguishedName", "type": "str"}, - "search_filter_template": {"key": "searchFilterTemplate", "type": "str"}, - "server_certificates": {"key": "serverCertificates", "type": "[Certificate]"}, - } - - def __init__( - self, - *, - server_hostname: Optional[str] = None, - server_port: Optional[int] = None, - service_user_distinguished_name: Optional[str] = None, - service_user_password: Optional[str] = None, - search_base_distinguished_name: Optional[str] = None, - search_filter_template: Optional[str] = None, - server_certificates: Optional[List["_models.Certificate"]] = None, - **kwargs - ): - """ - :keyword server_hostname: Hostname of the LDAP server. - :paramtype server_hostname: str - :keyword server_port: Port of the LDAP server. - :paramtype server_port: int - :keyword service_user_distinguished_name: Distinguished name of the look up user account, who - can look up user details on authentication. - :paramtype service_user_distinguished_name: str - :keyword service_user_password: Password of the look up user. - :paramtype service_user_password: str - :keyword search_base_distinguished_name: Distinguished name of the object to start the - recursive search of users from. - :paramtype search_base_distinguished_name: str - :keyword search_filter_template: Template to use for searching. Defaults to (cn=%s) where %s - will be replaced by the username used to login. - :paramtype search_filter_template: str - :keyword server_certificates: - :paramtype server_certificates: list[~azure.mgmt.cosmosdb.models.Certificate] - """ - super().__init__(**kwargs) - self.server_hostname = server_hostname - self.server_port = server_port - self.service_user_distinguished_name = service_user_distinguished_name - self.service_user_password = service_user_password - self.search_base_distinguished_name = search_base_distinguished_name - self.search_filter_template = search_filter_template - self.server_certificates = server_certificates class AutoscaleSettings(_serialization.Model): @@ -279,7 +189,7 @@ class AutoscaleSettings(_serialization.Model): "max_throughput": {"key": "maxThroughput", "type": "int"}, } - def __init__(self, *, max_throughput: Optional[int] = None, **kwargs): + def __init__(self, *, max_throughput: Optional[int] = None, **kwargs: Any) -> None: """ :keyword max_throughput: Represents maximum throughput, the resource can scale up to. :paramtype max_throughput: int @@ -320,8 +230,8 @@ def __init__( *, max_throughput: int, auto_upgrade_policy: Optional["_models.AutoUpgradePolicyResource"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_throughput: Represents maximum throughput container can scale up to. Required. :paramtype max_throughput: int @@ -346,7 +256,9 @@ class AutoUpgradePolicyResource(_serialization.Model): "throughput_policy": {"key": "throughputPolicy", "type": "ThroughputPolicyResource"}, } - def __init__(self, *, throughput_policy: Optional["_models.ThroughputPolicyResource"] = None, **kwargs): + def __init__( + self, *, throughput_policy: Optional["_models.ThroughputPolicyResource"] = None, **kwargs: Any + ) -> None: """ :keyword throughput_policy: Represents throughput policy which service must adhere to for auto-upgrade. @@ -356,81 +268,6 @@ def __init__(self, *, throughput_policy: Optional["_models.ThroughputPolicyResou self.throughput_policy = throughput_policy -class DataTransferDataSourceSink(_serialization.Model): - """Base class for all DataTransfer source/sink. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBlobDataTransferDataSourceSink, CosmosCassandraDataTransferDataSourceSink, - CosmosMongoDataTransferDataSourceSink, CosmosSqlDataTransferDataSourceSink - - All required parameters must be populated in order to send to Azure. - - :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBSql", and - "AzureBlobStorage". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - """ - - _validation = { - "component": {"required": True}, - } - - _attribute_map = { - "component": {"key": "component", "type": "str"}, - } - - _subtype_map = { - "component": { - "AzureBlobStorage": "AzureBlobDataTransferDataSourceSink", - "CosmosDBCassandra": "CosmosCassandraDataTransferDataSourceSink", - "CosmosDBMongo": "CosmosMongoDataTransferDataSourceSink", - "CosmosDBSql": "CosmosSqlDataTransferDataSourceSink", - } - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.component = None # type: Optional[str] - - -class AzureBlobDataTransferDataSourceSink(DataTransferDataSourceSink): - """An Azure Blob Storage data source/sink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBSql", and - "AzureBlobStorage". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - :ivar container_name: Required. - :vartype container_name: str - :ivar endpoint_url: - :vartype endpoint_url: str - """ - - _validation = { - "component": {"required": True}, - "container_name": {"required": True}, - } - - _attribute_map = { - "component": {"key": "component", "type": "str"}, - "container_name": {"key": "containerName", "type": "str"}, - "endpoint_url": {"key": "endpointUrl", "type": "str"}, - } - - def __init__(self, *, container_name: str, endpoint_url: Optional[str] = None, **kwargs): - """ - :keyword container_name: Required. - :paramtype container_name: str - :keyword endpoint_url: - :paramtype endpoint_url: str - """ - super().__init__(**kwargs) - self.component = "AzureBlobStorage" # type: str - self.container_name = container_name - self.endpoint_url = endpoint_url - - class BackupInformation(_serialization.Model): """Backup information of a resource. @@ -448,7 +285,7 @@ class BackupInformation(_serialization.Model): "continuous_backup_information": {"key": "continuousBackupInformation", "type": "ContinuousBackupInformation"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.continuous_backup_information = None @@ -481,14 +318,16 @@ class BackupPolicy(_serialization.Model): _subtype_map = {"type": {"Continuous": "ContinuousModeBackupPolicy", "Periodic": "PeriodicModeBackupPolicy"}} - def __init__(self, *, migration_state: Optional["_models.BackupPolicyMigrationState"] = None, **kwargs): + def __init__( + self, *, migration_state: Optional["_models.BackupPolicyMigrationState"] = None, **kwargs: Any + ) -> None: """ :keyword migration_state: The object representing the state of the migration between the backup policies. :paramtype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None self.migration_state = migration_state @@ -517,8 +356,8 @@ def __init__( status: Optional[Union[str, "_models.BackupPolicyMigrationStatus"]] = None, target_type: Optional[Union[str, "_models.BackupPolicyType"]] = None, start_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Describes the status of migration between backup policy types. Known values are: "Invalid", "InProgress", "Completed", and "Failed". @@ -535,63 +374,6 @@ def __init__( self.start_time = start_time -class BackupResource(ARMProxyResource): - """A restorable backup of a Cassandra cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar properties: - :vartype properties: ~azure.mgmt.cosmosdb.models.BackupResourceProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "BackupResourceProperties"}, - } - - def __init__(self, *, properties: Optional["_models.BackupResourceProperties"] = None, **kwargs): - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.cosmosdb.models.BackupResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BackupResourceProperties(_serialization.Model): - """BackupResourceProperties. - - :ivar timestamp: The time this backup was taken, formatted like 2021-01-21T17:35:21. - :vartype timestamp: ~datetime.datetime - """ - - _attribute_map = { - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - } - - def __init__(self, *, timestamp: Optional[datetime.datetime] = None, **kwargs): - """ - :keyword timestamp: The time this backup was taken, formatted like 2021-01-21T17:35:21. - :paramtype timestamp: ~datetime.datetime - """ - super().__init__(**kwargs) - self.timestamp = timestamp - - class Capability(_serialization.Model): """Cosmos DB capability object. @@ -604,7 +386,7 @@ class Capability(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". @@ -632,7 +414,7 @@ class Capacity(_serialization.Model): "total_throughput_limit": {"key": "totalThroughputLimit", "type": "int"}, } - def __init__(self, *, total_throughput_limit: Optional[int] = None, **kwargs): + def __init__(self, *, total_throughput_limit: Optional[int] = None, **kwargs: Any) -> None: """ :keyword total_throughput_limit: The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned @@ -666,7 +448,7 @@ class CassandraClusterDataCenterNodeItem(_serialization.Model): # pylint: disab :vartype host_id: str :ivar rack: The rack this node is part of. :vartype rack: str - :ivar timestamp: The timestamp at which that snapshot of these usage statistics were taken. + :ivar timestamp: The timestamp when these statistics were captured. :vartype timestamp: str :ivar disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. :vartype disk_used_kb: int @@ -723,8 +505,8 @@ def __init__( memory_free_kb: Optional[int] = None, memory_total_kb: Optional[int] = None, cpu_usage: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword address: The node's IP address. :paramtype address: str @@ -745,7 +527,7 @@ def __init__( :paramtype host_id: str :keyword rack: The rack this node is part of. :paramtype rack: str - :keyword timestamp: The timestamp at which that snapshot of these usage statistics were taken. + :keyword timestamp: The timestamp when these statistics were captured. :paramtype timestamp: str :keyword disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. :paramtype disk_used_kb: int @@ -813,8 +595,8 @@ def __init__( reaper_status: Optional["_models.ManagedCassandraReaperStatus"] = None, connection_errors: Optional[List["_models.ConnectionError"]] = None, data_centers: Optional[List["_models.CassandraClusterPublicStatusDataCentersItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: :paramtype e_tag: str @@ -857,8 +639,8 @@ def __init__( name: Optional[str] = None, seed_nodes: Optional[List[str]] = None, nodes: Optional[List["_models.CassandraClusterDataCenterNodeItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of this Datacenter. :paramtype name: str @@ -895,8 +677,6 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a Cassandra keyspace. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -917,7 +697,6 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "CassandraKeyspaceResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -928,10 +707,9 @@ def __init__( resource: "_models.CassandraKeyspaceResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -942,15 +720,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a Cassandra keyspace. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -975,8 +751,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -1009,8 +785,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -1022,7 +798,8 @@ def __init__( class ExtendedResourceProperties(_serialization.Model): - """The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin graphs. + """The system generated resource properties associated with SQL databases, SQL containers, Gremlin + databases and Gremlin graphs. Variables are only populated by the server, and will be ignored when sending a request. @@ -1047,7 +824,7 @@ class ExtendedResourceProperties(_serialization.Model): "etag": {"key": "_etag", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rid = None @@ -1072,7 +849,7 @@ class CassandraKeyspaceResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB Cassandra keyspace. Required. :paramtype id: str @@ -1113,7 +890,7 @@ class CassandraKeyspaceGetPropertiesResource(CassandraKeyspaceResource, Extended "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB Cassandra keyspace. Required. :paramtype id: str @@ -1145,8 +922,6 @@ class CassandraKeyspaceGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetPropertiesResource :ivar options: @@ -1165,7 +940,6 @@ class CassandraKeyspaceGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "CassandraKeyspaceGetPropertiesResource"}, "options": {"key": "properties.options", "type": "CassandraKeyspaceGetPropertiesOptions"}, } @@ -1175,11 +949,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.CassandraKeyspaceGetPropertiesResource"] = None, options: Optional["_models.CassandraKeyspaceGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -1190,14 +963,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -1219,7 +990,7 @@ class CassandraKeyspaceListResult(_serialization.Model): "value": {"key": "value", "type": "[CassandraKeyspaceGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1236,7 +1007,7 @@ class CassandraPartitionKey(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of the Cosmos DB Cassandra table partition key. :paramtype name: str @@ -1268,8 +1039,8 @@ def __init__( columns: Optional[List["_models.Column"]] = None, partition_keys: Optional[List["_models.CassandraPartitionKey"]] = None, cluster_keys: Optional[List["_models.ClusterKey"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword columns: List of Cassandra table columns. :paramtype columns: list[~azure.mgmt.cosmosdb.models.Column] @@ -1306,8 +1077,6 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a Cassandra table. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -1328,7 +1097,6 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "CassandraTableResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -1339,10 +1107,9 @@ def __init__( resource: "_models.CassandraTableResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -1353,15 +1120,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a Cassandra table. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -1386,8 +1151,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -1431,8 +1196,8 @@ def __init__( default_ttl: Optional[int] = None, schema: Optional["_models.CassandraSchema"] = None, analytical_storage_ttl: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB Cassandra table. Required. :paramtype id: str @@ -1498,8 +1263,8 @@ def __init__( default_ttl: Optional[int] = None, schema: Optional["_models.CassandraSchema"] = None, analytical_storage_ttl: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB Cassandra table. Required. :paramtype id: str @@ -1542,8 +1307,6 @@ class CassandraTableGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesResource :ivar options: @@ -1562,7 +1325,6 @@ class CassandraTableGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "CassandraTableGetPropertiesResource"}, "options": {"key": "properties.options", "type": "CassandraTableGetPropertiesOptions"}, } @@ -1572,11 +1334,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.CassandraTableGetPropertiesResource"] = None, options: Optional["_models.CassandraTableGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -1587,14 +1348,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -1616,392 +1375,100 @@ class CassandraTableListResult(_serialization.Model): "value": {"key": "value", "type": "[CassandraTableGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None -class CassandraViewCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Cassandra view. +class Certificate(_serialization.Model): + """Certificate. + + :ivar pem: PEM formatted public key. + :vartype pem: str + """ - Variables are only populated by the server, and will be ignored when sending a request. + _attribute_map = { + "pem": {"key": "pem", "type": "str"}, + } + + def __init__(self, *, pem: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword pem: PEM formatted public key. + :paramtype pem: str + """ + super().__init__(**kwargs) + self.pem = pem + + +class ClientEncryptionIncludedPath(_serialization.Model): + """. All required parameters must be populated in order to send to Azure. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: The standard JSON format of a Cassandra view. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraViewResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :ivar path: Path that needs to be encrypted. Required. + :vartype path: str + :ivar client_encryption_key_id: The identifier of the Client Encryption Key to be used to + encrypt the path. Required. + :vartype client_encryption_key_id: str + :ivar encryption_type: The type of encryption to be performed. Eg - Deterministic, Randomized. + Required. + :vartype encryption_type: str + :ivar encryption_algorithm: The encryption algorithm which will be used. Eg - + AEAD_AES_256_CBC_HMAC_SHA256. Required. + :vartype encryption_algorithm: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "resource": {"required": True}, + "path": {"required": True}, + "client_encryption_key_id": {"required": True}, + "encryption_type": {"required": True}, + "encryption_algorithm": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "resource": {"key": "properties.resource", "type": "CassandraViewResource"}, - "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, + "path": {"key": "path", "type": "str"}, + "client_encryption_key_id": {"key": "clientEncryptionKeyId", "type": "str"}, + "encryption_type": {"key": "encryptionType", "type": "str"}, + "encryption_algorithm": {"key": "encryptionAlgorithm", "type": "str"}, } def __init__( self, *, - resource: "_models.CassandraViewResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + path: str, + client_encryption_key_id: str, + encryption_type: str, + encryption_algorithm: str, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: The standard JSON format of a Cassandra view. Required. - :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraViewResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :keyword path: Path that needs to be encrypted. Required. + :paramtype path: str + :keyword client_encryption_key_id: The identifier of the Client Encryption Key to be used to + encrypt the path. Required. + :paramtype client_encryption_key_id: str + :keyword encryption_type: The type of encryption to be performed. Eg - Deterministic, + Randomized. Required. + :paramtype encryption_type: str + :keyword encryption_algorithm: The encryption algorithm which will be used. Eg - + AEAD_AES_256_CBC_HMAC_SHA256. Required. + :paramtype encryption_algorithm: str """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super().__init__(**kwargs) + self.path = path + self.client_encryption_key_id = client_encryption_key_id + self.encryption_type = encryption_type + self.encryption_algorithm = encryption_algorithm -class CassandraViewGetPropertiesOptions(OptionsResource): - """CassandraViewGetPropertiesOptions. +class ClientEncryptionKeyCreateUpdateParameters(_serialization.Model): + """Parameters to create and update ClientEncryptionKey. - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - - _attribute_map = { - "throughput": {"key": "throughput", "type": "int"}, - "autoscale_settings": {"key": "autoscaleSettings", "type": "AutoscaleSettings"}, - } - - def __init__( - self, - *, - throughput: Optional[int] = None, - autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): - """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - super().__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) - - -class CassandraViewResource(_serialization.Model): - """Cosmos DB Cassandra view resource object. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Name of the Cosmos DB Cassandra view. Required. - :vartype id: str - :ivar view_definition: View Definition of the Cosmos DB Cassandra view. Required. - :vartype view_definition: str - """ - - _validation = { - "id": {"required": True}, - "view_definition": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "view_definition": {"key": "viewDefinition", "type": "str"}, - } - - def __init__(self, *, id: str, view_definition: str, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: Name of the Cosmos DB Cassandra view. Required. - :paramtype id: str - :keyword view_definition: View Definition of the Cosmos DB Cassandra view. Required. - :paramtype view_definition: str - """ - super().__init__(**kwargs) - self.id = id - self.view_definition = view_definition - - -class CassandraViewGetPropertiesResource(CassandraViewResource, ExtendedResourceProperties): - """CassandraViewGetPropertiesResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str - :ivar id: Name of the Cosmos DB Cassandra view. Required. - :vartype id: str - :ivar view_definition: View Definition of the Cosmos DB Cassandra view. Required. - :vartype view_definition: str - """ - - _validation = { - "rid": {"readonly": True}, - "ts": {"readonly": True}, - "etag": {"readonly": True}, - "id": {"required": True}, - "view_definition": {"required": True}, - } - - _attribute_map = { - "rid": {"key": "_rid", "type": "str"}, - "ts": {"key": "_ts", "type": "float"}, - "etag": {"key": "_etag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "view_definition": {"key": "viewDefinition", "type": "str"}, - } - - def __init__(self, *, id: str, view_definition: str, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: Name of the Cosmos DB Cassandra view. Required. - :paramtype id: str - :keyword view_definition: View Definition of the Cosmos DB Cassandra view. Required. - :paramtype view_definition: str - """ - super().__init__(id=id, view_definition=view_definition, **kwargs) - self.rid = None - self.ts = None - self.etag = None - self.id = id - self.view_definition = view_definition - - -class CassandraViewGetResults(ARMResourceProperties): - """An Azure Cosmos DB Cassandra view. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "resource": {"key": "properties.resource", "type": "CassandraViewGetPropertiesResource"}, - "options": {"key": "properties.options", "type": "CassandraViewGetPropertiesOptions"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - resource: Optional["_models.CassandraViewGetPropertiesResource"] = None, - options: Optional["_models.CassandraViewGetPropertiesOptions"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions - """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - - -class CassandraViewListResult(_serialization.Model): - """The List operation response, that contains the Cassandra views and their properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Cassandra views and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[CassandraViewGetResults]"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.value = None - - -class Certificate(_serialization.Model): - """Certificate. - - :ivar pem: PEM formatted public key. - :vartype pem: str - """ - - _attribute_map = { - "pem": {"key": "pem", "type": "str"}, - } - - def __init__(self, *, pem: Optional[str] = None, **kwargs): - """ - :keyword pem: PEM formatted public key. - :paramtype pem: str - """ - super().__init__(**kwargs) - self.pem = pem - - -class ClientEncryptionIncludedPath(_serialization.Model): - """. - - All required parameters must be populated in order to send to Azure. - - :ivar path: Path that needs to be encrypted. Required. - :vartype path: str - :ivar client_encryption_key_id: The identifier of the Client Encryption Key to be used to - encrypt the path. Required. - :vartype client_encryption_key_id: str - :ivar encryption_type: The type of encryption to be performed. Eg - Deterministic, Randomized. - Required. - :vartype encryption_type: str - :ivar encryption_algorithm: The encryption algorithm which will be used. Eg - - AEAD_AES_256_CBC_HMAC_SHA256. Required. - :vartype encryption_algorithm: str - """ - - _validation = { - "path": {"required": True}, - "client_encryption_key_id": {"required": True}, - "encryption_type": {"required": True}, - "encryption_algorithm": {"required": True}, - } - - _attribute_map = { - "path": {"key": "path", "type": "str"}, - "client_encryption_key_id": {"key": "clientEncryptionKeyId", "type": "str"}, - "encryption_type": {"key": "encryptionType", "type": "str"}, - "encryption_algorithm": {"key": "encryptionAlgorithm", "type": "str"}, - } - - def __init__( - self, *, path: str, client_encryption_key_id: str, encryption_type: str, encryption_algorithm: str, **kwargs - ): - """ - :keyword path: Path that needs to be encrypted. Required. - :paramtype path: str - :keyword client_encryption_key_id: The identifier of the Client Encryption Key to be used to - encrypt the path. Required. - :paramtype client_encryption_key_id: str - :keyword encryption_type: The type of encryption to be performed. Eg - Deterministic, - Randomized. Required. - :paramtype encryption_type: str - :keyword encryption_algorithm: The encryption algorithm which will be used. Eg - - AEAD_AES_256_CBC_HMAC_SHA256. Required. - :paramtype encryption_algorithm: str - """ - super().__init__(**kwargs) - self.path = path - self.client_encryption_key_id = client_encryption_key_id - self.encryption_type = encryption_type - self.encryption_algorithm = encryption_algorithm - - -class ClientEncryptionKeyCreateUpdateParameters(_serialization.Model): - """Parameters to create and update ClientEncryptionKey. - - All required parameters must be populated in order to send to Azure. - - :ivar resource: The standard JSON format of a ClientEncryptionKey. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource + All required parameters must be populated in order to send to Azure. + + :ivar resource: The standard JSON format of a ClientEncryptionKey. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource """ _validation = { @@ -2012,7 +1479,7 @@ class ClientEncryptionKeyCreateUpdateParameters(_serialization.Model): "resource": {"key": "properties.resource", "type": "ClientEncryptionKeyResource"}, } - def __init__(self, *, resource: "_models.ClientEncryptionKeyResource", **kwargs): + def __init__(self, *, resource: "_models.ClientEncryptionKeyResource", **kwargs: Any) -> None: """ :keyword resource: The standard JSON format of a ClientEncryptionKey. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource @@ -2051,8 +1518,8 @@ def __init__( encryption_algorithm: Optional[str] = None, wrapped_data_encryption_key: Optional[bytes] = None, key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the ClientEncryptionKey. :paramtype id: str @@ -2121,8 +1588,8 @@ def __init__( encryption_algorithm: Optional[str] = None, wrapped_data_encryption_key: Optional[bytes] = None, key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the ClientEncryptionKey. :paramtype id: str @@ -2180,7 +1647,9 @@ class ClientEncryptionKeyGetResults(ARMProxyResource): "resource": {"key": "properties.resource", "type": "ClientEncryptionKeyGetPropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource @@ -2206,7 +1675,7 @@ class ClientEncryptionKeysListResult(_serialization.Model): "value": {"key": "value", "type": "[ClientEncryptionKeyGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2220,13 +1689,14 @@ class ClientEncryptionPolicy(_serialization.Model): :ivar included_paths: Paths of the item that need encryption along with path-specific settings. Required. :vartype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] - :ivar policy_format_version: Version of the client encryption policy definition. Please note, - user passed value is ignored. Default policy version is 1. + :ivar policy_format_version: Version of the client encryption policy definition. Supported + versions are 1 and 2. Version 2 supports id and partition key path encryption. Required. :vartype policy_format_version: int """ _validation = { "included_paths": {"required": True}, + "policy_format_version": {"required": True, "maximum": 2, "minimum": 1}, } _attribute_map = { @@ -2235,14 +1705,14 @@ class ClientEncryptionPolicy(_serialization.Model): } def __init__( - self, *, included_paths: List["_models.ClientEncryptionIncludedPath"], policy_format_version: int = 1, **kwargs - ): + self, *, included_paths: List["_models.ClientEncryptionIncludedPath"], policy_format_version: int, **kwargs: Any + ) -> None: """ :keyword included_paths: Paths of the item that need encryption along with path-specific settings. Required. :paramtype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] - :keyword policy_format_version: Version of the client encryption policy definition. Please - note, user passed value is ignored. Default policy version is 1. + :keyword policy_format_version: Version of the client encryption policy definition. Supported + versions are 1 and 2. Version 2 supports id and partition key path encryption. Required. :paramtype policy_format_version: int """ super().__init__(**kwargs) @@ -2265,7 +1735,7 @@ class ClusterKey(_serialization.Model): "order_by": {"key": "orderBy", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, order_by: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, order_by: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of the Cosmos DB Cassandra table cluster key. :paramtype name: str @@ -2323,8 +1793,8 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -2396,8 +1866,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, properties: Optional["_models.ClusterResourceProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -2444,8 +1914,8 @@ class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-ma :vartype cluster_name_override: str :ivar authentication_method: Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. - 'Cassandra' is the default password based authentication. The default is 'Cassandra'. 'Ldap' is - in preview. Known values are: "None", "Cassandra", and "Ldap". + 'Cassandra' is the default password based authentication. The default is 'Cassandra'. Known + values are: "None" and "Cassandra". :vartype authentication_method: str or ~azure.mgmt.cosmosdb.models.AuthenticationMethod :ivar initial_cassandra_admin_password: Initial password for clients connecting as admin to the cluster. Should be changed after cluster creation. Returns null on GET. This field only applies @@ -2478,7 +1948,8 @@ class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-ma :ivar seed_nodes: List of IP addresses of seed nodes in the managed data centers. These should be added to the seed node lists of all unmanaged nodes. :vartype seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] - :ivar hours_between_backups: Number of hours to wait between taking a backup of the cluster. + :ivar hours_between_backups: Number of hours to wait between taking a backup of the cluster. To + disable backups, set this property to 0. :vartype hours_between_backups: int :ivar deallocated: Whether the cluster and associated data centers has been deallocated. :vartype deallocated: bool @@ -2529,8 +2000,8 @@ def __init__( hours_between_backups: Optional[int] = None, deallocated: Optional[bool] = None, cassandra_audit_logging_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: The status of the resource at the time the operation was called. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". @@ -2555,7 +2026,7 @@ def __init__( :keyword authentication_method: Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default is - 'Cassandra'. 'Ldap' is in preview. Known values are: "None", "Cassandra", and "Ldap". + 'Cassandra'. Known values are: "None" and "Cassandra". :paramtype authentication_method: str or ~azure.mgmt.cosmosdb.models.AuthenticationMethod :keyword initial_cassandra_admin_password: Initial password for clients connecting as admin to the cluster. Should be changed after cluster creation. Returns null on GET. This field only @@ -2582,6 +2053,7 @@ def __init__( These will be added to the seed node lists of all managed nodes. :paramtype external_seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] :keyword hours_between_backups: Number of hours to wait between taking a backup of the cluster. + To disable backups, set this property to 0. :paramtype hours_between_backups: int :keyword deallocated: Whether the cluster and associated data centers has been deallocated. :paramtype deallocated: bool @@ -2622,7 +2094,7 @@ class Column(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of the Cosmos DB Cassandra table column. :paramtype name: str @@ -2645,7 +2117,7 @@ class CommandOutput(_serialization.Model): "command_output": {"key": "commandOutput", "type": "str"}, } - def __init__(self, *, command_output: Optional[str] = None, **kwargs): + def __init__(self, *, command_output: Optional[str] = None, **kwargs: Any) -> None: """ :keyword command_output: Output of the command. :paramtype command_output: str @@ -2694,8 +2166,8 @@ def __init__( arguments: Optional[Dict[str, str]] = None, cassandra_stop_start: Optional[bool] = None, readwrite: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword command: The command which should be run. Required. :paramtype command: str @@ -2738,8 +2210,8 @@ def __init__( *, path: Optional[str] = None, order: Optional[Union[str, "_models.CompositePathSortOrder"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). @@ -2778,8 +2250,8 @@ def __init__( mode: Union[str, "_models.ConflictResolutionMode"] = "LastWriterWins", conflict_resolution_path: Optional[str] = None, conflict_resolution_procedure: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins" and "Custom". @@ -2830,8 +2302,8 @@ def __init__( i_p_to: Optional[str] = None, port: Optional[int] = None, exception: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_state: The kind of connection error that occurred. Known values are: "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", @@ -2891,8 +2363,8 @@ def __init__( default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"], max_staleness_prefix: Optional[int] = None, max_interval_in_seconds: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_consistency_level: The default consistency level and configuration settings of the Cosmos DB account. Required. Known values are: "Eventual", "Session", "BoundedStaleness", @@ -2915,7 +2387,8 @@ def __init__( class ContainerPartitionKey(_serialization.Model): - """The configuration of the partition key to be used for partitioning data into multiple partitions. + """The configuration of the partition key to be used for partitioning data into multiple + partitions. Variables are only populated by the server, and will be ignored when sending a request. @@ -2949,8 +2422,8 @@ def __init__( paths: Optional[List[str]] = None, kind: Union[str, "_models.PartitionKind"] = "Hash", version: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword paths: List of paths using which data within the container can be partitioned. :paramtype paths: list[str] @@ -2979,7 +2452,7 @@ class ContinuousBackupInformation(_serialization.Model): "latest_restorable_timestamp": {"key": "latestRestorableTimestamp", "type": "str"}, } - def __init__(self, *, latest_restorable_timestamp: Optional[str] = None, **kwargs): + def __init__(self, *, latest_restorable_timestamp: Optional[str] = None, **kwargs: Any) -> None: """ :keyword latest_restorable_timestamp: The latest restorable timestamp for a resource. :paramtype latest_restorable_timestamp: str @@ -2999,7 +2472,7 @@ class ContinuousBackupRestoreLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: The name of the continuous backup restore location. :paramtype location: str @@ -3019,8 +2492,6 @@ class ContinuousModeBackupPolicy(BackupPolicy): :ivar migration_state: The object representing the state of the migration between the backup policies. :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :ivar continuous_mode_properties: Configuration values for continuous mode backup. - :vartype continuous_mode_properties: ~azure.mgmt.cosmosdb.models.ContinuousModeProperties """ _validation = { @@ -3030,48 +2501,18 @@ class ContinuousModeBackupPolicy(BackupPolicy): _attribute_map = { "type": {"key": "type", "type": "str"}, "migration_state": {"key": "migrationState", "type": "BackupPolicyMigrationState"}, - "continuous_mode_properties": {"key": "continuousModeProperties", "type": "ContinuousModeProperties"}, } def __init__( - self, - *, - migration_state: Optional["_models.BackupPolicyMigrationState"] = None, - continuous_mode_properties: Optional["_models.ContinuousModeProperties"] = None, - **kwargs - ): + self, *, migration_state: Optional["_models.BackupPolicyMigrationState"] = None, **kwargs: Any + ) -> None: """ :keyword migration_state: The object representing the state of the migration between the backup policies. :paramtype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :keyword continuous_mode_properties: Configuration values for continuous mode backup. - :paramtype continuous_mode_properties: ~azure.mgmt.cosmosdb.models.ContinuousModeProperties """ super().__init__(migration_state=migration_state, **kwargs) - self.type = "Continuous" # type: str - self.continuous_mode_properties = continuous_mode_properties - - -class ContinuousModeProperties(_serialization.Model): - """Configuration values for periodic mode backup. - - :ivar tier: Enum to indicate type of Continuos backup mode. Known values are: "Continuous7Days" - and "Continuous30Days". - :vartype tier: str or ~azure.mgmt.cosmosdb.models.ContinuousTier - """ - - _attribute_map = { - "tier": {"key": "tier", "type": "str"}, - } - - def __init__(self, *, tier: Optional[Union[str, "_models.ContinuousTier"]] = None, **kwargs): - """ - :keyword tier: Enum to indicate type of Continuos backup mode. Known values are: - "Continuous7Days" and "Continuous30Days". - :paramtype tier: str or ~azure.mgmt.cosmosdb.models.ContinuousTier - """ - super().__init__(**kwargs) - self.tier = tier + self.type: str = "Continuous" class CorsPolicy(_serialization.Model): @@ -3117,8 +2558,8 @@ def __init__( allowed_headers: Optional[str] = None, exposed_headers: Optional[str] = None, max_age_in_seconds: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword allowed_origins: The origin domains that are permitted to make a request against the service via CORS. Required. @@ -3144,165 +2585,9 @@ def __init__( self.max_age_in_seconds = max_age_in_seconds -class CosmosCassandraDataTransferDataSourceSink(DataTransferDataSourceSink): - """A CosmosDB Cassandra API data source/sink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBSql", and - "AzureBlobStorage". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - :ivar keyspace_name: Required. - :vartype keyspace_name: str - :ivar table_name: Required. - :vartype table_name: str - """ - - _validation = { - "component": {"required": True}, - "keyspace_name": {"required": True}, - "table_name": {"required": True}, - } - - _attribute_map = { - "component": {"key": "component", "type": "str"}, - "keyspace_name": {"key": "keyspaceName", "type": "str"}, - "table_name": {"key": "tableName", "type": "str"}, - } - - def __init__(self, *, keyspace_name: str, table_name: str, **kwargs): - """ - :keyword keyspace_name: Required. - :paramtype keyspace_name: str - :keyword table_name: Required. - :paramtype table_name: str - """ - super().__init__(**kwargs) - self.component = "CosmosDBCassandra" # type: str - self.keyspace_name = keyspace_name - self.table_name = table_name - - -class CosmosMongoDataTransferDataSourceSink(DataTransferDataSourceSink): - """A CosmosDB Cassandra API data source/sink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBSql", and - "AzureBlobStorage". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - :ivar database_name: Required. - :vartype database_name: str - :ivar collection_name: Required. - :vartype collection_name: str - """ - - _validation = { - "component": {"required": True}, - "database_name": {"required": True}, - "collection_name": {"required": True}, - } - - _attribute_map = { - "component": {"key": "component", "type": "str"}, - "database_name": {"key": "databaseName", "type": "str"}, - "collection_name": {"key": "collectionName", "type": "str"}, - } - - def __init__(self, *, database_name: str, collection_name: str, **kwargs): - """ - :keyword database_name: Required. - :paramtype database_name: str - :keyword collection_name: Required. - :paramtype collection_name: str - """ - super().__init__(**kwargs) - self.component = "CosmosDBMongo" # type: str - self.database_name = database_name - self.collection_name = collection_name - - -class CosmosSqlDataTransferDataSourceSink(DataTransferDataSourceSink): - """A CosmosDB Cassandra API data source/sink. - - All required parameters must be populated in order to send to Azure. - - :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBSql", and - "AzureBlobStorage". - :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent - :ivar database_name: Required. - :vartype database_name: str - :ivar container_name: Required. - :vartype container_name: str - """ - - _validation = { - "component": {"required": True}, - "database_name": {"required": True}, - "container_name": {"required": True}, - } - - _attribute_map = { - "component": {"key": "component", "type": "str"}, - "database_name": {"key": "databaseName", "type": "str"}, - "container_name": {"key": "containerName", "type": "str"}, - } - - def __init__(self, *, database_name: str, container_name: str, **kwargs): - """ - :keyword database_name: Required. - :paramtype database_name: str - :keyword container_name: Required. - :paramtype container_name: str - """ - super().__init__(**kwargs) - self.component = "CosmosDBSql" # type: str - self.database_name = database_name - self.container_name = container_name - - -class CreateJobRequest(ARMProxyResource): - """Parameters to create Data Transfer Job. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar properties: Data Transfer Create Job Properties. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.DataTransferJobProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "properties": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "DataTransferJobProperties"}, - } - - def __init__(self, *, properties: "_models.DataTransferJobProperties", **kwargs): - """ - :keyword properties: Data Transfer Create Job Properties. Required. - :paramtype properties: ~azure.mgmt.cosmosdb.models.DataTransferJobProperties - """ - super().__init__(**kwargs) - self.properties = properties - - class CreateUpdateOptions(_serialization.Model): - """CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput". + """CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys + are "If-Match", "If-None-Match", "Session-Token" and "Throughput". :ivar throughput: Request Units per second. For example, "throughput": 10000. :vartype throughput: int @@ -3320,8 +2605,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Request Units per second. For example, "throughput": 10000. :paramtype throughput: int @@ -3354,7 +2639,7 @@ class DatabaseAccountConnectionString(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.connection_string = None @@ -3383,11 +2668,11 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar kind: Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar consistency_policy: The consistency policy for the Cosmos DB account. :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB @@ -3452,9 +2737,6 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. :vartype network_acl_bypass_resource_ids: list[str] - :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. :vartype disable_local_auth: bool @@ -3463,9 +2745,6 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d :ivar capacity: The object that represents all properties related to capacity enforcement on an account. :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :vartype enable_materialized_views: bool :ivar keys_metadata: This property is ignored during the update/create operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. @@ -3473,6 +2752,10 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :vartype enable_partition_merge: bool + :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls 1.0, + except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", + "Tls11", and "Tls12". + :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion """ _validation = { @@ -3490,8 +2773,8 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "consistency_policy": {"key": "properties.consistencyPolicy", "type": "ConsistencyPolicy"}, "locations": {"key": "properties.locations", "type": "[Location]"}, "database_account_offer_type": {"key": "properties.databaseAccountOfferType", "type": "str"}, @@ -3522,13 +2805,12 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d "cors": {"key": "properties.cors", "type": "[CorsPolicy]"}, "network_acl_bypass": {"key": "properties.networkAclBypass", "type": "str"}, "network_acl_bypass_resource_ids": {"key": "properties.networkAclBypassResourceIds", "type": "[str]"}, - "diagnostic_log_settings": {"key": "properties.diagnosticLogSettings", "type": "DiagnosticLogSettings"}, "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, "restore_parameters": {"key": "properties.restoreParameters", "type": "RestoreParameters"}, "capacity": {"key": "properties.capacity", "type": "Capacity"}, - "enable_materialized_views": {"key": "properties.enableMaterializedViews", "type": "bool"}, "keys_metadata": {"key": "properties.keysMetadata", "type": "DatabaseAccountKeysMetadata"}, "enable_partition_merge": {"key": "properties.enablePartitionMerge", "type": "bool"}, + "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, } database_account_offer_type = "Standard" @@ -3539,8 +2821,8 @@ def __init__( # pylint: disable=too-many-locals locations: List["_models.Location"], location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, consistency_policy: Optional["_models.ConsistencyPolicy"] = None, ip_rules: Optional[List["_models.IpAddressOrRange"]] = None, is_virtual_network_filter_enabled: Optional[bool] = None, @@ -3563,14 +2845,13 @@ def __init__( # pylint: disable=too-many-locals cors: Optional[List["_models.CorsPolicy"]] = None, network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, network_acl_bypass_resource_ids: Optional[List[str]] = None, - diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = None, disable_local_auth: Optional[bool] = None, restore_parameters: Optional["_models.RestoreParameters"] = None, capacity: Optional["_models.Capacity"] = None, - enable_materialized_views: Optional[bool] = None, enable_partition_merge: Optional[bool] = None, - **kwargs - ): + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -3581,11 +2862,11 @@ def __init__( # pylint: disable=too-many-locals with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword kind: Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword consistency_policy: The consistency policy for the Cosmos DB account. :paramtype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy :keyword locations: An array that contains the georeplication locations enabled for the Cosmos @@ -3648,9 +2929,6 @@ def __init__( # pylint: disable=too-many-locals :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. :paramtype network_acl_bypass_resource_ids: list[str] - :keyword diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :paramtype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. :paramtype disable_local_auth: bool @@ -3659,15 +2937,17 @@ def __init__( # pylint: disable=too-many-locals :keyword capacity: The object that represents all properties related to capacity enforcement on an account. :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :paramtype enable_materialized_views: bool :keyword enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :paramtype enable_partition_merge: bool + :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls + 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: + "Tls", "Tls11", and "Tls12". + :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kind = kind + self.identity = identity self.consistency_policy = consistency_policy self.locations = locations self.ip_rules = ip_rules @@ -3691,13 +2971,12 @@ def __init__( # pylint: disable=too-many-locals self.cors = cors self.network_acl_bypass = network_acl_bypass self.network_acl_bypass_resource_ids = network_acl_bypass_resource_ids - self.diagnostic_log_settings = diagnostic_log_settings self.disable_local_auth = disable_local_auth self.restore_parameters = restore_parameters self.capacity = capacity - self.enable_materialized_views = enable_materialized_views self.keys_metadata = None self.enable_partition_merge = enable_partition_merge + self.minimal_tls_version = minimal_tls_version class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-many-instance-attributes @@ -3720,11 +2999,11 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar kind: Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData :ivar provisioning_state: The status of the Cosmos DB account at the time the operation was @@ -3816,24 +3095,22 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. :vartype network_acl_bypass_resource_ids: list[str] - :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. :vartype disable_local_auth: bool :ivar capacity: The object that represents all properties related to capacity enforcement on an account. :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :vartype enable_materialized_views: bool :ivar keys_metadata: The object that represents the metadata for the Account Keys of the Cosmos DB account. :vartype keys_metadata: ~azure.mgmt.cosmosdb.models.DatabaseAccountKeysMetadata :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :vartype enable_partition_merge: bool + :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls 1.0, + except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", + "Tls11", and "Tls12". + :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion """ _validation = { @@ -3859,8 +3136,8 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "system_data": {"key": "systemData", "type": "SystemData"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "document_endpoint": {"key": "properties.documentEndpoint", "type": "str"}, @@ -3903,12 +3180,11 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m "cors": {"key": "properties.cors", "type": "[CorsPolicy]"}, "network_acl_bypass": {"key": "properties.networkAclBypass", "type": "str"}, "network_acl_bypass_resource_ids": {"key": "properties.networkAclBypassResourceIds", "type": "[str]"}, - "diagnostic_log_settings": {"key": "properties.diagnosticLogSettings", "type": "DiagnosticLogSettings"}, "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, "capacity": {"key": "properties.capacity", "type": "Capacity"}, - "enable_materialized_views": {"key": "properties.enableMaterializedViews", "type": "bool"}, "keys_metadata": {"key": "properties.keysMetadata", "type": "DatabaseAccountKeysMetadata"}, "enable_partition_merge": {"key": "properties.enablePartitionMerge", "type": "bool"}, + "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -3916,8 +3192,8 @@ def __init__( # pylint: disable=too-many-locals *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ip_rules: Optional[List["_models.IpAddressOrRange"]] = None, is_virtual_network_filter_enabled: Optional[bool] = None, enable_automatic_failover: Optional[bool] = None, @@ -3941,13 +3217,12 @@ def __init__( # pylint: disable=too-many-locals cors: Optional[List["_models.CorsPolicy"]] = None, network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, network_acl_bypass_resource_ids: Optional[List[str]] = None, - diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = None, disable_local_auth: Optional[bool] = None, capacity: Optional["_models.Capacity"] = None, - enable_materialized_views: Optional[bool] = None, enable_partition_merge: Optional[bool] = None, - **kwargs - ): + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -3958,11 +3233,11 @@ def __init__( # pylint: disable=too-many-locals with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword kind: Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword ip_rules: List of IpRules. :paramtype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] :keyword is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual @@ -4024,24 +3299,23 @@ def __init__( # pylint: disable=too-many-locals :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. :paramtype network_acl_bypass_resource_ids: list[str] - :keyword diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :paramtype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. :paramtype disable_local_auth: bool :keyword capacity: The object that represents all properties related to capacity enforcement on an account. :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :paramtype enable_materialized_views: bool :keyword enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :paramtype enable_partition_merge: bool + :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls + 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: + "Tls", "Tls11", and "Tls12". + :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kind = kind + self.identity = identity self.system_data = None self.provisioning_state = None self.document_endpoint = None @@ -4075,12 +3349,11 @@ def __init__( # pylint: disable=too-many-locals self.cors = cors self.network_acl_bypass = network_acl_bypass self.network_acl_bypass_resource_ids = network_acl_bypass_resource_ids - self.diagnostic_log_settings = diagnostic_log_settings self.disable_local_auth = disable_local_auth self.capacity = capacity - self.enable_materialized_views = enable_materialized_views self.keys_metadata = None self.enable_partition_merge = enable_partition_merge + self.minimal_tls_version = minimal_tls_version class DatabaseAccountKeysMetadata(_serialization.Model): @@ -4116,7 +3389,7 @@ class DatabaseAccountKeysMetadata(_serialization.Model): "secondary_readonly_master_key": {"key": "secondaryReadonlyMasterKey", "type": "AccountKeyMetadata"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.primary_master_key = None @@ -4138,8 +3411,8 @@ class DatabaseAccountListConnectionStringsResult(_serialization.Model): } def __init__( - self, *, connection_strings: Optional[List["_models.DatabaseAccountConnectionString"]] = None, **kwargs - ): + self, *, connection_strings: Optional[List["_models.DatabaseAccountConnectionString"]] = None, **kwargs: Any + ) -> None: """ :keyword connection_strings: An array that contains the connection strings for the Cosmos DB account. @@ -4171,7 +3444,7 @@ class DatabaseAccountListReadOnlyKeysResult(_serialization.Model): "secondary_readonly_master_key": {"key": "secondaryReadonlyMasterKey", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.primary_readonly_master_key = None @@ -4207,7 +3480,7 @@ class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): "secondary_master_key": {"key": "secondaryMasterKey", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.primary_master_key = None @@ -4232,7 +3505,7 @@ class DatabaseAccountRegenerateKeyParameters(_serialization.Model): "key_kind": {"key": "keyKind", "type": "str"}, } - def __init__(self, *, key_kind: Union[str, "_models.KeyKind"], **kwargs): + def __init__(self, *, key_kind: Union[str, "_models.KeyKind"], **kwargs: Any) -> None: """ :keyword key_kind: The access key to regenerate. Required. Known values are: "primary", "secondary", "primaryReadonly", and "secondaryReadonly". @@ -4259,7 +3532,7 @@ class DatabaseAccountsListResult(_serialization.Model): "value": {"key": "value", "type": "[DatabaseAccountGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -4339,24 +3612,22 @@ class DatabaseAccountUpdateParameters(_serialization.Model): # pylint: disable= :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. :vartype network_acl_bypass_resource_ids: list[str] - :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. :vartype disable_local_auth: bool :ivar capacity: The object that represents all properties related to capacity enforcement on an account. :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :vartype enable_materialized_views: bool :ivar keys_metadata: This property is ignored during the update operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. :vartype keys_metadata: ~azure.mgmt.cosmosdb.models.DatabaseAccountKeysMetadata :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :vartype enable_partition_merge: bool + :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls 1.0, + except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", + "Tls11", and "Tls12". + :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion """ _validation = { @@ -4395,12 +3666,11 @@ class DatabaseAccountUpdateParameters(_serialization.Model): # pylint: disable= "cors": {"key": "properties.cors", "type": "[CorsPolicy]"}, "network_acl_bypass": {"key": "properties.networkAclBypass", "type": "str"}, "network_acl_bypass_resource_ids": {"key": "properties.networkAclBypassResourceIds", "type": "[str]"}, - "diagnostic_log_settings": {"key": "properties.diagnosticLogSettings", "type": "DiagnosticLogSettings"}, "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, "capacity": {"key": "properties.capacity", "type": "Capacity"}, - "enable_materialized_views": {"key": "properties.enableMaterializedViews", "type": "bool"}, "keys_metadata": {"key": "properties.keysMetadata", "type": "DatabaseAccountKeysMetadata"}, "enable_partition_merge": {"key": "properties.enablePartitionMerge", "type": "bool"}, + "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -4431,13 +3701,12 @@ def __init__( # pylint: disable=too-many-locals cors: Optional[List["_models.CorsPolicy"]] = None, network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, network_acl_bypass_resource_ids: Optional[List[str]] = None, - diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = None, disable_local_auth: Optional[bool] = None, capacity: Optional["_models.Capacity"] = None, - enable_materialized_views: Optional[bool] = None, enable_partition_merge: Optional[bool] = None, - **kwargs - ): + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can @@ -4509,21 +3778,19 @@ def __init__( # pylint: disable=too-many-locals :keyword network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. :paramtype network_acl_bypass_resource_ids: list[str] - :keyword diagnostic_log_settings: The Object representing the different Diagnostic log settings - for the Cosmos DB Account. - :paramtype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. :paramtype disable_local_auth: bool :keyword capacity: The object that represents all properties related to capacity enforcement on an account. :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the - Cosmos DB account. - :paramtype enable_materialized_views: bool :keyword enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :paramtype enable_partition_merge: bool + :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls + 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: + "Tls", "Tls11", and "Tls12". + :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion """ super().__init__(**kwargs) self.tags = tags @@ -4551,12 +3818,11 @@ def __init__( # pylint: disable=too-many-locals self.cors = cors self.network_acl_bypass = network_acl_bypass self.network_acl_bypass_resource_ids = network_acl_bypass_resource_ids - self.diagnostic_log_settings = diagnostic_log_settings self.disable_local_auth = disable_local_auth self.capacity = capacity - self.enable_materialized_views = enable_materialized_views self.keys_metadata = None self.enable_partition_merge = enable_partition_merge + self.minimal_tls_version = minimal_tls_version class DatabaseRestoreResource(_serialization.Model): @@ -4573,7 +3839,9 @@ class DatabaseRestoreResource(_serialization.Model): "collection_names": {"key": "collectionNames", "type": "[str]"}, } - def __init__(self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword database_name: The name of the database available for restore. :paramtype database_name: str @@ -4613,7 +3881,7 @@ class DataCenterResource(ARMProxyResource): "properties": {"key": "properties", "type": "DataCenterResourceProperties"}, } - def __init__(self, *, properties: Optional["_models.DataCenterResourceProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DataCenterResourceProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of a managed Cassandra data center. :paramtype properties: ~azure.mgmt.cosmosdb.models.DataCenterResourceProperties @@ -4666,13 +3934,9 @@ class DataCenterResourceProperties(_serialization.Model): # pylint: disable=too :vartype disk_sku: str :ivar disk_capacity: Number of disk used for data centers. Default value is 4. :vartype disk_capacity: int - :ivar availability_zone: If the data center has Availability Zone feature, apply it to the - Virtual Machine ScaleSet that host the cassandra data center virtual machines. + :ivar availability_zone: If the azure data center has Availability Zone support, apply it to + the Virtual Machine ScaleSet that host the cassandra data center virtual machines. :vartype availability_zone: bool - :ivar authentication_method_ldap_properties: Ldap authentication method properties. This - feature is in preview. - :vartype authentication_method_ldap_properties: - ~azure.mgmt.cosmosdb.models.AuthenticationMethodLdapProperties """ _validation = { @@ -4692,10 +3956,6 @@ class DataCenterResourceProperties(_serialization.Model): # pylint: disable=too "disk_sku": {"key": "diskSku", "type": "str"}, "disk_capacity": {"key": "diskCapacity", "type": "int"}, "availability_zone": {"key": "availabilityZone", "type": "bool"}, - "authentication_method_ldap_properties": { - "key": "authenticationMethodLdapProperties", - "type": "AuthenticationMethodLdapProperties", - }, } def __init__( @@ -4712,9 +3972,8 @@ def __init__( disk_sku: Optional[str] = None, disk_capacity: Optional[int] = None, availability_zone: Optional[bool] = None, - authentication_method_ldap_properties: Optional["_models.AuthenticationMethodLdapProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: The status of the resource at the time the operation was called. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". @@ -4751,13 +4010,9 @@ def __init__( :paramtype disk_sku: str :keyword disk_capacity: Number of disk used for data centers. Default value is 4. :paramtype disk_capacity: int - :keyword availability_zone: If the data center has Availability Zone feature, apply it to the - Virtual Machine ScaleSet that host the cassandra data center virtual machines. + :keyword availability_zone: If the azure data center has Availability Zone support, apply it to + the Virtual Machine ScaleSet that host the cassandra data center virtual machines. :paramtype availability_zone: bool - :keyword authentication_method_ldap_properties: Ldap authentication method properties. This - feature is in preview. - :paramtype authentication_method_ldap_properties: - ~azure.mgmt.cosmosdb.models.AuthenticationMethodLdapProperties """ super().__init__(**kwargs) self.provisioning_state = provisioning_state @@ -4772,201 +4027,6 @@ def __init__( self.disk_sku = disk_sku self.disk_capacity = disk_capacity self.availability_zone = availability_zone - self.authentication_method_ldap_properties = authentication_method_ldap_properties - - -class DataTransferJobFeedResults(_serialization.Model): - """The List operation response, that contains the Data Transfer jobs and their properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Data Transfer jobs and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] - :ivar next_link: URL to get the next set of Data Transfer job list results if there are any. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DataTransferJobGetResults]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataTransferJobGetResults(ARMProxyResource): # pylint: disable=too-many-instance-attributes - """A Cosmos DB Data Transfer Job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the database account. - :vartype id: str - :ivar name: The name of the database account. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar job_name: Job Name. - :vartype job_name: str - :ivar source: Source DataStore details. - :vartype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar destination: Destination DataStore details. - :vartype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar status: Job Status. - :vartype status: str - :ivar processed_count: Processed Count. - :vartype processed_count: int - :ivar total_count: Total Count. - :vartype total_count: int - :ivar last_updated_utc_time: Last Updated Time (ISO-8601 format). - :vartype last_updated_utc_time: ~datetime.datetime - :ivar worker_count: Worker count. - :vartype worker_count: int - :ivar error: Error response for Faulted job. - :vartype error: ~azure.mgmt.cosmosdb.models.ErrorResponse - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "job_name": {"readonly": True}, - "status": {"readonly": True}, - "processed_count": {"readonly": True}, - "total_count": {"readonly": True}, - "last_updated_utc_time": {"readonly": True}, - "worker_count": {"minimum": 0}, - "error": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "job_name": {"key": "properties.jobName", "type": "str"}, - "source": {"key": "properties.source", "type": "DataTransferDataSourceSink"}, - "destination": {"key": "properties.destination", "type": "DataTransferDataSourceSink"}, - "status": {"key": "properties.status", "type": "str"}, - "processed_count": {"key": "properties.processedCount", "type": "int"}, - "total_count": {"key": "properties.totalCount", "type": "int"}, - "last_updated_utc_time": {"key": "properties.lastUpdatedUtcTime", "type": "iso-8601"}, - "worker_count": {"key": "properties.workerCount", "type": "int"}, - "error": {"key": "properties.error", "type": "ErrorResponse"}, - } - - def __init__( - self, - *, - source: Optional["_models.DataTransferDataSourceSink"] = None, - destination: Optional["_models.DataTransferDataSourceSink"] = None, - worker_count: Optional[int] = None, - **kwargs - ): - """ - :keyword source: Source DataStore details. - :paramtype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword destination: Destination DataStore details. - :paramtype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword worker_count: Worker count. - :paramtype worker_count: int - """ - super().__init__(**kwargs) - self.job_name = None - self.source = source - self.destination = destination - self.status = None - self.processed_count = None - self.total_count = None - self.last_updated_utc_time = None - self.worker_count = worker_count - self.error = None - - -class DataTransferJobProperties(_serialization.Model): - """The properties of a DataTransfer Job. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar job_name: Job Name. - :vartype job_name: str - :ivar source: Source DataStore details. Required. - :vartype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar destination: Destination DataStore details. Required. - :vartype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :ivar status: Job Status. - :vartype status: str - :ivar processed_count: Processed Count. - :vartype processed_count: int - :ivar total_count: Total Count. - :vartype total_count: int - :ivar last_updated_utc_time: Last Updated Time (ISO-8601 format). - :vartype last_updated_utc_time: ~datetime.datetime - :ivar worker_count: Worker count. - :vartype worker_count: int - :ivar error: Error response for Faulted job. - :vartype error: ~azure.mgmt.cosmosdb.models.ErrorResponse - """ - - _validation = { - "job_name": {"readonly": True}, - "source": {"required": True}, - "destination": {"required": True}, - "status": {"readonly": True}, - "processed_count": {"readonly": True}, - "total_count": {"readonly": True}, - "last_updated_utc_time": {"readonly": True}, - "worker_count": {"minimum": 0}, - "error": {"readonly": True}, - } - - _attribute_map = { - "job_name": {"key": "jobName", "type": "str"}, - "source": {"key": "source", "type": "DataTransferDataSourceSink"}, - "destination": {"key": "destination", "type": "DataTransferDataSourceSink"}, - "status": {"key": "status", "type": "str"}, - "processed_count": {"key": "processedCount", "type": "int"}, - "total_count": {"key": "totalCount", "type": "int"}, - "last_updated_utc_time": {"key": "lastUpdatedUtcTime", "type": "iso-8601"}, - "worker_count": {"key": "workerCount", "type": "int"}, - "error": {"key": "error", "type": "ErrorResponse"}, - } - - def __init__( - self, - *, - source: "_models.DataTransferDataSourceSink", - destination: "_models.DataTransferDataSourceSink", - worker_count: Optional[int] = None, - **kwargs - ): - """ - :keyword source: Source DataStore details. Required. - :paramtype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword destination: Destination DataStore details. Required. - :paramtype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink - :keyword worker_count: Worker count. - :paramtype worker_count: int - """ - super().__init__(**kwargs) - self.job_name = None - self.source = source - self.destination = destination - self.status = None - self.processed_count = None - self.total_count = None - self.last_updated_utc_time = None - self.worker_count = worker_count - self.error = None class RegionalServiceResource(_serialization.Model): @@ -4995,7 +4055,7 @@ class RegionalServiceResource(_serialization.Model): "status": {"key": "status", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -5029,7 +4089,7 @@ class DataTransferRegionalServiceResource(RegionalServiceResource): "status": {"key": "status", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -5045,7 +4105,9 @@ class DataTransferServiceResource(_serialization.Model): "properties": {"key": "properties", "type": "DataTransferServiceResourceProperties"}, } - def __init__(self, *, properties: Optional["_models.DataTransferServiceResourceProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.DataTransferServiceResourceProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Properties for DataTransferServiceResource. :paramtype properties: ~azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties @@ -5067,7 +4129,7 @@ class ServiceResourceProperties(_serialization.Model): :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :vartype additional_properties: dict[str, JSON] + :vartype additional_properties: dict[str, any] :ivar creation_time: Time of the last state change (ISO-8601 format). :vartype creation_time: ~datetime.datetime :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", @@ -5111,15 +4173,15 @@ class ServiceResourceProperties(_serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. - :paramtype additional_properties: dict[str, JSON] + :paramtype additional_properties: dict[str, any] :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize @@ -5131,7 +4193,7 @@ def __init__( self.creation_time = None self.instance_size = instance_size self.instance_count = instance_count - self.service_type = None # type: Optional[str] + self.service_type: Optional[str] = None self.status = None @@ -5144,7 +4206,7 @@ class DataTransferServiceResourceProperties(ServiceResourceProperties): :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :vartype additional_properties: dict[str, JSON] + :vartype additional_properties: dict[str, any] :ivar creation_time: Time of the last state change (ISO-8601 format). :vartype creation_time: ~datetime.datetime :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", @@ -5183,15 +4245,15 @@ class DataTransferServiceResourceProperties(ServiceResourceProperties): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. - :paramtype additional_properties: dict[str, JSON] + :paramtype additional_properties: dict[str, any] :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize @@ -5204,32 +4266,10 @@ def __init__( instance_count=instance_count, **kwargs ) - self.service_type = "DataTransfer" # type: str + self.service_type: str = "DataTransfer" self.locations = None -class DiagnosticLogSettings(_serialization.Model): - """Indicates what diagnostic log settings are to be enabled. - - :ivar enable_full_text_query: Describe the level of detail with which queries are to be logged. - Known values are: "None", "True", and "False". - :vartype enable_full_text_query: str or ~azure.mgmt.cosmosdb.models.EnableFullTextQuery - """ - - _attribute_map = { - "enable_full_text_query": {"key": "enableFullTextQuery", "type": "str"}, - } - - def __init__(self, *, enable_full_text_query: Optional[Union[str, "_models.EnableFullTextQuery"]] = None, **kwargs): - """ - :keyword enable_full_text_query: Describe the level of detail with which queries are to be - logged. Known values are: "None", "True", and "False". - :paramtype enable_full_text_query: str or ~azure.mgmt.cosmosdb.models.EnableFullTextQuery - """ - super().__init__(**kwargs) - self.enable_full_text_query = enable_full_text_query - - class ErrorResponse(_serialization.Model): """Error Response. @@ -5244,7 +4284,7 @@ class ErrorResponse(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code. :paramtype code: str @@ -5268,7 +4308,7 @@ class ExcludedPath(_serialization.Model): "path": {"key": "path", "type": "str"}, } - def __init__(self, *, path: Optional[str] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, **kwargs: Any) -> None: """ :keyword path: The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). @@ -5295,7 +4335,7 @@ class FailoverPolicies(_serialization.Model): "failover_policies": {"key": "failoverPolicies", "type": "[FailoverPolicy]"}, } - def __init__(self, *, failover_policies: List["_models.FailoverPolicy"], **kwargs): + def __init__(self, *, failover_policies: List["_models.FailoverPolicy"], **kwargs: Any) -> None: """ :keyword failover_policies: List of failover policies. Required. :paramtype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] @@ -5307,446 +4347,185 @@ def __init__(self, *, failover_policies: List["_models.FailoverPolicy"], **kwarg class FailoverPolicy(_serialization.Model): """The failover policy for a given region of a database account. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique identifier of the region in which the database account replicates to. - Example: <accountName>-<locationName>. - :vartype id: str - :ivar location_name: The name of the region in which the database account exists. - :vartype location_name: str - :ivar failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :vartype failover_priority: int - """ - - _validation = { - "id": {"readonly": True}, - "failover_priority": {"minimum": 0}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "location_name": {"key": "locationName", "type": "str"}, - "failover_priority": {"key": "failoverPriority", "type": "int"}, - } - - def __init__(self, *, location_name: Optional[str] = None, failover_priority: Optional[int] = None, **kwargs): - """ - :keyword location_name: The name of the region in which the database account exists. - :paramtype location_name: str - :keyword failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :paramtype failover_priority: int - """ - super().__init__(**kwargs) - self.id = None - self.location_name = location_name - self.failover_priority = failover_priority - - -class GraphAPIComputeRegionalServiceResource(RegionalServiceResource): - """Resource for a regional service location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The regional service name. - :vartype name: str - :ivar location: The location name. - :vartype location: str - :ivar status: Describes the status of a service. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - :ivar graph_api_compute_endpoint: The regional endpoint for GraphAPICompute. - :vartype graph_api_compute_endpoint: str - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - "status": {"readonly": True}, - "graph_api_compute_endpoint": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "graph_api_compute_endpoint": {"key": "graphApiComputeEndpoint", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.graph_api_compute_endpoint = None - - -class GraphAPIComputeServiceResource(_serialization.Model): - """Describes the service response property for GraphAPICompute. - - :ivar properties: Properties for GraphAPIComputeServiceResource. - :vartype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "GraphAPIComputeServiceResourceProperties"}, - } - - def __init__(self, *, properties: Optional["_models.GraphAPIComputeServiceResourceProperties"] = None, **kwargs): - """ - :keyword properties: Properties for GraphAPIComputeServiceResource. - :paramtype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GraphAPIComputeServiceResourceProperties(ServiceResourceProperties): - """Properties for GraphAPIComputeServiceResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: ~datetime.datetime - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar service_type: ServiceType for the service. Required. Known values are: - "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder". - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType - :ivar status: Describes the status of a service. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "Stopped". - :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus - :ivar graph_api_compute_endpoint: GraphAPICompute endpoint for the service. - :vartype graph_api_compute_endpoint: str - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list[~azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource] - """ - - _validation = { - "creation_time": {"readonly": True}, - "instance_count": {"minimum": 0}, - "service_type": {"required": True}, - "status": {"readonly": True}, - "locations": {"readonly": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "instance_size": {"key": "instanceSize", "type": "str"}, - "instance_count": {"key": "instanceCount", "type": "int"}, - "service_type": {"key": "serviceType", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "graph_api_compute_endpoint": {"key": "graphApiComputeEndpoint", "type": "str"}, - "locations": {"key": "locations", "type": "[GraphAPIComputeRegionalServiceResource]"}, - } - - def __init__( - self, - *, - additional_properties: Optional[Dict[str, JSON]] = None, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, - graph_api_compute_endpoint: Optional[str] = None, - **kwargs - ): - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "Cosmos.D16s". - :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize - :keyword instance_count: Instance count for the service. - :paramtype instance_count: int - :keyword graph_api_compute_endpoint: GraphAPICompute endpoint for the service. - :paramtype graph_api_compute_endpoint: str - """ - super().__init__( - additional_properties=additional_properties, - instance_size=instance_size, - instance_count=instance_count, - **kwargs - ) - self.service_type = "GraphAPICompute" # type: str - self.graph_api_compute_endpoint = graph_api_compute_endpoint - self.locations = None - - -class GraphResource(_serialization.Model): - """Cosmos DB Graph resource object. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Name of the Cosmos DB Graph. Required. - :vartype id: str - """ - - _validation = { - "id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: Name of the Cosmos DB Graph. Required. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class GraphResourceCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Graph resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: The standard JSON format of a Graph resource. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.GraphResource - :ivar options: A key-value pair of options to be applied for the request. This corresponds to - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "resource": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "resource": {"key": "properties.resource", "type": "GraphResource"}, - "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, - } - - def __init__( - self, - *, - resource: "_models.GraphResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: The standard JSON format of a Graph resource. Required. - :paramtype resource: ~azure.mgmt.cosmosdb.models.GraphResource - :keyword options: A key-value pair of options to be applied for the request. This corresponds - to the headers sent with the request. - :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions - """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options - - -class GraphResourceGetPropertiesOptions(OptionsResource): - """GraphResourceGetPropertiesOptions. - - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - - _attribute_map = { - "throughput": {"key": "throughput", "type": "int"}, - "autoscale_settings": {"key": "autoscaleSettings", "type": "AutoscaleSettings"}, - } - - def __init__( - self, - *, - throughput: Optional[int] = None, - autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): - """ - :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :paramtype throughput: int - :keyword autoscale_settings: Specifies the Autoscale settings. - :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings - """ - super().__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) - - -class GraphResourceGetPropertiesResource(GraphResource): - """GraphResourceGetPropertiesResource. - - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Name of the Cosmos DB Graph. Required. + :ivar id: The unique identifier of the region in which the database account replicates to. + Example: <accountName>-<locationName>. :vartype id: str + :ivar location_name: The name of the region in which the database account exists. + :vartype location_name: str + :ivar failover_priority: The failover priority of the region. A failover priority of 0 + indicates a write region. The maximum value for a failover priority = (total number of regions + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :vartype failover_priority: int """ _validation = { - "id": {"required": True}, + "id": {"readonly": True}, + "failover_priority": {"minimum": 0}, } _attribute_map = { "id": {"key": "id", "type": "str"}, + "location_name": {"key": "locationName", "type": "str"}, + "failover_priority": {"key": "failoverPriority", "type": "int"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, *, location_name: Optional[str] = None, failover_priority: Optional[int] = None, **kwargs: Any + ) -> None: """ - :keyword id: Name of the Cosmos DB Graph. Required. - :paramtype id: str + :keyword location_name: The name of the region in which the database account exists. + :paramtype location_name: str + :keyword failover_priority: The failover priority of the region. A failover priority of 0 + indicates a write region. The maximum value for a failover priority = (total number of regions + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :paramtype failover_priority: int """ - super().__init__(id=id, **kwargs) + super().__init__(**kwargs) + self.id = None + self.location_name = location_name + self.failover_priority = failover_priority -class GraphResourceGetResults(ARMResourceProperties): - """An Azure Cosmos DB Graph resource. +class GraphAPIComputeRegionalServiceResource(RegionalServiceResource): + """Resource for a regional service location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. + :ivar name: The regional service name. :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. + :ivar location: The location name. :vartype location: str - :ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesOptions + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", and "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus + :ivar graph_api_compute_endpoint: The regional endpoint for GraphAPICompute. + :vartype graph_api_compute_endpoint: str """ _validation = { - "id": {"readonly": True}, "name": {"readonly": True}, - "type": {"readonly": True}, + "location": {"readonly": True}, + "status": {"readonly": True}, + "graph_api_compute_endpoint": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "resource": {"key": "properties.resource", "type": "GraphResourceGetPropertiesResource"}, - "options": {"key": "properties.options", "type": "GraphResourceGetPropertiesOptions"}, + "status": {"key": "status", "type": "str"}, + "graph_api_compute_endpoint": {"key": "graphApiComputeEndpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.graph_api_compute_endpoint = None + + +class GraphAPIComputeServiceResource(_serialization.Model): + """Describes the service response property for GraphAPICompute. + + :ivar properties: Properties for GraphAPIComputeServiceResource. + :vartype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "GraphAPIComputeServiceResourceProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - resource: Optional["_models.GraphResourceGetPropertiesResource"] = None, - options: Optional["_models.GraphResourceGetPropertiesOptions"] = None, - **kwargs - ): + self, *, properties: Optional["_models.GraphAPIComputeServiceResourceProperties"] = None, **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesOptions + :keyword properties: Properties for GraphAPIComputeServiceResource. + :paramtype properties: ~azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - self.options = options + super().__init__(**kwargs) + self.properties = properties -class GraphResourcesListResult(_serialization.Model): - """The List operation response, that contains the Graph resource and their properties. +class GraphAPIComputeServiceResourceProperties(ServiceResourceProperties): + """Properties for GraphAPIComputeServiceResource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Graph resource and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar creation_time: Time of the last state change (ISO-8601 format). + :vartype creation_time: ~datetime.datetime + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", and "Cosmos.D16s". + :vartype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :ivar instance_count: Instance count for the service. + :vartype instance_count: int + :ivar service_type: ServiceType for the service. Required. Known values are: + "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder". + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType + :ivar status: Describes the status of a service. Known values are: "Creating", "Running", + "Updating", "Deleting", "Error", and "Stopped". + :vartype status: str or ~azure.mgmt.cosmosdb.models.ServiceStatus + :ivar graph_api_compute_endpoint: GraphAPICompute endpoint for the service. + :vartype graph_api_compute_endpoint: str + :ivar locations: An array that contains all of the locations for the service. + :vartype locations: list[~azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource] """ _validation = { - "value": {"readonly": True}, + "creation_time": {"readonly": True}, + "instance_count": {"minimum": 0}, + "service_type": {"required": True}, + "status": {"readonly": True}, + "locations": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[GraphResourceGetResults]"}, + "additional_properties": {"key": "", "type": "{object}"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + "instance_size": {"key": "instanceSize", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + "service_type": {"key": "serviceType", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "graph_api_compute_endpoint": {"key": "graphApiComputeEndpoint", "type": "str"}, + "locations": {"key": "locations", "type": "[GraphAPIComputeRegionalServiceResource]"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.value = None + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + graph_api_compute_endpoint: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", and "Cosmos.D16s". + :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize + :keyword instance_count: Instance count for the service. + :paramtype instance_count: int + :keyword graph_api_compute_endpoint: GraphAPICompute endpoint for the service. + :paramtype graph_api_compute_endpoint: str + """ + super().__init__( + additional_properties=additional_properties, + instance_size=instance_size, + instance_count=instance_count, + **kwargs + ) + self.service_type: str = "GraphAPICompute" + self.graph_api_compute_endpoint = graph_api_compute_endpoint + self.locations = None class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): @@ -5771,8 +4550,6 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a Gremlin database. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -5793,7 +4570,6 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "GremlinDatabaseResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -5804,10 +4580,9 @@ def __init__( resource: "_models.GremlinDatabaseResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -5818,15 +4593,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a Gremlin database. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -5851,8 +4624,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -5880,7 +4653,7 @@ class GremlinDatabaseResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB Gremlin database. Required. :paramtype id: str @@ -5921,7 +4694,7 @@ class GremlinDatabaseGetPropertiesResource(GremlinDatabaseResource, ExtendedReso "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB Gremlin database. Required. :paramtype id: str @@ -5953,8 +4726,6 @@ class GremlinDatabaseGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource :ivar options: @@ -5973,7 +4744,6 @@ class GremlinDatabaseGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "GremlinDatabaseGetPropertiesResource"}, "options": {"key": "properties.options", "type": "GremlinDatabaseGetPropertiesOptions"}, } @@ -5983,11 +4753,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.GremlinDatabaseGetPropertiesResource"] = None, options: Optional["_models.GremlinDatabaseGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -5998,14 +4767,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -6027,7 +4794,7 @@ class GremlinDatabaseListResult(_serialization.Model): "value": {"key": "value", "type": "[GremlinDatabaseGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -6047,7 +4814,9 @@ class GremlinDatabaseRestoreResource(_serialization.Model): "graph_names": {"key": "graphNames", "type": "[str]"}, } - def __init__(self, *, database_name: Optional[str] = None, graph_names: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, database_name: Optional[str] = None, graph_names: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword database_name: The name of the gremlin database available for restore. :paramtype database_name: str @@ -6081,8 +4850,6 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a Gremlin graph. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -6103,7 +4870,6 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "GremlinGraphResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -6114,10 +4880,9 @@ def __init__( resource: "_models.GremlinGraphResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -6128,15 +4893,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a Gremlin graph. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -6161,8 +4924,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -6221,8 +4984,8 @@ def __init__( unique_key_policy: Optional["_models.UniqueKeyPolicy"] = None, conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB Gremlin graph. Required. :paramtype id: str @@ -6315,8 +5078,8 @@ def __init__( unique_key_policy: Optional["_models.UniqueKeyPolicy"] = None, conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB Gremlin graph. Required. :paramtype id: str @@ -6378,8 +5141,6 @@ class GremlinGraphGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource :ivar options: @@ -6398,7 +5159,6 @@ class GremlinGraphGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "GremlinGraphGetPropertiesResource"}, "options": {"key": "properties.options", "type": "GremlinGraphGetPropertiesOptions"}, } @@ -6408,11 +5168,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.GremlinGraphGetPropertiesResource"] = None, options: Optional["_models.GremlinGraphGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -6423,14 +5182,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -6452,7 +5209,7 @@ class GremlinGraphListResult(_serialization.Model): "value": {"key": "value", "type": "[GremlinGraphGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -6473,7 +5230,9 @@ class IncludedPath(_serialization.Model): "indexes": {"key": "indexes", "type": "[Indexes]"}, } - def __init__(self, *, path: Optional[str] = None, indexes: Optional[List["_models.Indexes"]] = None, **kwargs): + def __init__( + self, *, path: Optional[str] = None, indexes: Optional[List["_models.Indexes"]] = None, **kwargs: Any + ) -> None: """ :keyword path: The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). @@ -6510,8 +5269,8 @@ def __init__( data_type: Union[str, "_models.DataType"] = "String", precision: Optional[int] = None, kind: Union[str, "_models.IndexKind"] = "Hash", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data_type: The datatype for which the indexing behavior is applied to. Known values are: "String", "Number", "Point", "Polygon", "LineString", and "MultiPolygon". @@ -6563,8 +5322,8 @@ def __init__( excluded_paths: Optional[List["_models.ExcludedPath"]] = None, composite_indexes: Optional[List[List["_models.CompositePath"]]] = None, spatial_indexes: Optional[List["_models.SpatialSpec"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword automatic: Indicates if the indexing policy is automatic. :paramtype automatic: bool @@ -6603,7 +5362,7 @@ class IpAddressOrRange(_serialization.Model): "ip_address_or_range": {"key": "ipAddressOrRange", "type": "str"}, } - def __init__(self, *, ip_address_or_range: Optional[str] = None, **kwargs): + def __init__(self, *, ip_address_or_range: Optional[str] = None, **kwargs: Any) -> None: """ :keyword ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following @@ -6617,7 +5376,8 @@ def __init__(self, *, ip_address_or_range: Optional[str] = None, **kwargs): class KeyWrapMetadata(_serialization.Model): - """Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key. + """Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client + encryption key. :ivar name: The name of associated KeyEncryptionKey (aka CustomerManagedKey). :vartype name: str @@ -6643,8 +5403,8 @@ def __init__( type: Optional[str] = None, value: Optional[str] = None, algorithm: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of associated KeyEncryptionKey (aka CustomerManagedKey). :paramtype name: str @@ -6662,29 +5422,6 @@ def __init__( self.algorithm = algorithm -class ListBackups(_serialization.Model): - """List of restorable backups for a Cassandra cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Container for array of backups. - :vartype value: list[~azure.mgmt.cosmosdb.models.BackupResource] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[BackupResource]"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.value = None - - class ListClusters(_serialization.Model): """List of managed Cassandra clusters. @@ -6696,7 +5433,7 @@ class ListClusters(_serialization.Model): "value": {"key": "value", "type": "[ClusterResource]"}, } - def __init__(self, *, value: Optional[List["_models.ClusterResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ClusterResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Container for the array of clusters. :paramtype value: list[~azure.mgmt.cosmosdb.models.ClusterResource] @@ -6722,7 +5459,7 @@ class ListDataCenters(_serialization.Model): "value": {"key": "value", "type": "[DataCenterResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -6781,8 +5518,8 @@ def __init__( location_name: Optional[str] = None, failover_priority: Optional[int] = None, is_zone_redundant: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location_name: The name of the region. :paramtype location_name: str @@ -6832,7 +5569,7 @@ class LocationGetResult(ARMProxyResource): "properties": {"key": "properties", "type": "LocationProperties"}, } - def __init__(self, *, properties: Optional["_models.LocationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.LocationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Cosmos DB location metadata. :paramtype properties: ~azure.mgmt.cosmosdb.models.LocationProperties @@ -6858,7 +5595,7 @@ class LocationListResult(_serialization.Model): "value": {"key": "value", "type": "[LocationGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -6869,8 +5606,6 @@ class LocationProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar status: The current status of location in Azure. - :vartype status: str :ivar supports_availability_zone: Flag indicating whether the location supports availability zones or not. :vartype supports_availability_zone: bool @@ -6882,23 +5617,20 @@ class LocationProperties(_serialization.Model): """ _validation = { - "status": {"readonly": True}, "supports_availability_zone": {"readonly": True}, "is_residency_restricted": {"readonly": True}, "backup_storage_redundancies": {"readonly": True}, } _attribute_map = { - "status": {"key": "status", "type": "str"}, "supports_availability_zone": {"key": "supportsAvailabilityZone", "type": "bool"}, "is_residency_restricted": {"key": "isResidencyRestricted", "type": "bool"}, "backup_storage_redundancies": {"key": "backupStorageRedundancies", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None self.supports_availability_zone = None self.is_residency_restricted = None self.backup_storage_redundancies = None @@ -6928,7 +5660,9 @@ class ManagedCassandraManagedServiceIdentity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ManagedCassandraResourceIdentityType"]] = None, **kwargs): + def __init__( + self, *, type: Optional[Union[str, "_models.ManagedCassandraResourceIdentityType"]] = None, **kwargs: Any + ) -> None: """ :keyword type: The type of the resource. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType @@ -6962,8 +5696,8 @@ def __init__( healthy: Optional[bool] = None, repair_run_ids: Optional[Dict[str, str]] = None, repair_schedules: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword healthy: :paramtype healthy: bool @@ -7021,8 +5755,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user @@ -7063,7 +5797,7 @@ class ManagedServiceIdentityUserAssignedIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -7096,7 +5830,7 @@ class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): "status": {"key": "status", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -7114,8 +5848,8 @@ class MaterializedViewsBuilderServiceResource(_serialization.Model): } def __init__( - self, *, properties: Optional["_models.MaterializedViewsBuilderServiceResourceProperties"] = None, **kwargs - ): + self, *, properties: Optional["_models.MaterializedViewsBuilderServiceResourceProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Properties for MaterializedViewsBuilderServiceResource. :paramtype properties: @@ -7134,7 +5868,7 @@ class MaterializedViewsBuilderServiceResourceProperties(ServiceResourcePropertie :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :vartype additional_properties: dict[str, JSON] + :vartype additional_properties: dict[str, any] :ivar creation_time: Time of the last state change (ISO-8601 format). :vartype creation_time: ~datetime.datetime :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", @@ -7174,15 +5908,15 @@ class MaterializedViewsBuilderServiceResourceProperties(ServiceResourcePropertie def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. - :paramtype additional_properties: dict[str, JSON] + :paramtype additional_properties: dict[str, any] :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize @@ -7195,30 +5929,10 @@ def __init__( instance_count=instance_count, **kwargs ) - self.service_type = "MaterializedViewsBuilder" # type: str + self.service_type: str = "MaterializedViewsBuilder" self.locations = None -class MergeParameters(_serialization.Model): - """The properties of an Azure Cosmos DB merge operations. - - :ivar is_dry_run: Specifies whether the operation is a real merge operation or a simulation. - :vartype is_dry_run: bool - """ - - _attribute_map = { - "is_dry_run": {"key": "isDryRun", "type": "bool"}, - } - - def __init__(self, *, is_dry_run: Optional[bool] = None, **kwargs): - """ - :keyword is_dry_run: Specifies whether the operation is a real merge operation or a simulation. - :paramtype is_dry_run: bool - """ - super().__init__(**kwargs) - self.is_dry_run = is_dry_run - - class Metric(_serialization.Model): """Metric data. @@ -7257,7 +5971,7 @@ class Metric(_serialization.Model): "metric_values": {"key": "metricValues", "type": "[MetricValue]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.start_time = None @@ -7289,7 +6003,7 @@ class MetricAvailability(_serialization.Model): "retention": {"key": "retention", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.time_grain = None @@ -7331,7 +6045,7 @@ class MetricDefinition(_serialization.Model): "name": {"key": "name", "type": "MetricName"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.metric_availabilities = None @@ -7358,7 +6072,7 @@ class MetricDefinitionsListResult(_serialization.Model): "value": {"key": "value", "type": "[MetricDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -7381,7 +6095,7 @@ class MetricListResult(_serialization.Model): "value": {"key": "value", "type": "[Metric]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -7408,7 +6122,7 @@ class MetricName(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -7452,7 +6166,7 @@ class MetricValue(_serialization.Model): "total": {"key": "total", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.count = None @@ -7485,8 +6199,6 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a MongoDB collection. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -7507,7 +6219,6 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "MongoDBCollectionResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -7518,10 +6229,9 @@ def __init__( resource: "_models.MongoDBCollectionResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -7532,15 +6242,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a MongoDB collection. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -7565,8 +6273,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -7590,11 +6298,6 @@ class MongoDBCollectionResource(_serialization.Model): :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] :ivar analytical_storage_ttl: Analytical TTL. :vartype analytical_storage_ttl: int - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -7606,8 +6309,6 @@ class MongoDBCollectionResource(_serialization.Model): "shard_key": {"key": "shardKey", "type": "{str}"}, "indexes": {"key": "indexes", "type": "[MongoIndex]"}, "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, } def __init__( @@ -7617,10 +6318,8 @@ def __init__( shard_key: Optional[Dict[str, str]] = None, indexes: Optional[List["_models.MongoIndex"]] = None, analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB MongoDB collection. Required. :paramtype id: str @@ -7630,19 +6329,12 @@ def __init__( :paramtype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: int - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__(**kwargs) self.id = id self.shard_key = shard_key self.indexes = indexes self.analytical_storage_ttl = analytical_storage_ttl - self.restore_parameters = restore_parameters - self.create_mode = create_mode class MongoDBCollectionGetPropertiesResource(MongoDBCollectionResource, ExtendedResourceProperties): @@ -7665,13 +6357,8 @@ class MongoDBCollectionGetPropertiesResource(MongoDBCollectionResource, Extended :vartype shard_key: dict[str, str] :ivar indexes: List of index keys. :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: int - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: int """ _validation = { @@ -7689,8 +6376,6 @@ class MongoDBCollectionGetPropertiesResource(MongoDBCollectionResource, Extended "shard_key": {"key": "shardKey", "type": "{str}"}, "indexes": {"key": "indexes", "type": "[MongoIndex]"}, "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, } def __init__( @@ -7700,10 +6385,8 @@ def __init__( shard_key: Optional[Dict[str, str]] = None, indexes: Optional[List["_models.MongoIndex"]] = None, analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB MongoDB collection. Required. :paramtype id: str @@ -7713,20 +6396,9 @@ def __init__( :paramtype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: int - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__( - id=id, - shard_key=shard_key, - indexes=indexes, - analytical_storage_ttl=analytical_storage_ttl, - restore_parameters=restore_parameters, - create_mode=create_mode, - **kwargs + id=id, shard_key=shard_key, indexes=indexes, analytical_storage_ttl=analytical_storage_ttl, **kwargs ) self.rid = None self.ts = None @@ -7735,8 +6407,6 @@ def __init__( self.shard_key = shard_key self.indexes = indexes self.analytical_storage_ttl = analytical_storage_ttl - self.restore_parameters = restore_parameters - self.create_mode = create_mode class MongoDBCollectionGetResults(ARMResourceProperties): @@ -7759,8 +6429,6 @@ class MongoDBCollectionGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource :ivar options: @@ -7779,7 +6447,6 @@ class MongoDBCollectionGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "MongoDBCollectionGetPropertiesResource"}, "options": {"key": "properties.options", "type": "MongoDBCollectionGetPropertiesOptions"}, } @@ -7789,11 +6456,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.MongoDBCollectionGetPropertiesResource"] = None, options: Optional["_models.MongoDBCollectionGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -7804,14 +6470,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -7833,7 +6497,7 @@ class MongoDBCollectionListResult(_serialization.Model): "value": {"key": "value", "type": "[MongoDBCollectionGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -7861,8 +6525,6 @@ class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a MongoDB database. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -7883,7 +6545,6 @@ class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "MongoDBDatabaseResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -7894,10 +6555,9 @@ def __init__( resource: "_models.MongoDBDatabaseResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -7908,15 +6568,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a MongoDB database. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -7941,8 +6599,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -7960,11 +6618,6 @@ class MongoDBDatabaseResource(_serialization.Model): :ivar id: Name of the Cosmos DB MongoDB database. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -7973,31 +6626,15 @@ class MongoDBDatabaseResource(_serialization.Model): _attribute_map = { "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, } - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB MongoDB database. Required. :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__(**kwargs) self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode class MongoDBDatabaseGetPropertiesResource(MongoDBDatabaseResource, ExtendedResourceProperties): @@ -8016,11 +6653,6 @@ class MongoDBDatabaseGetPropertiesResource(MongoDBDatabaseResource, ExtendedReso :vartype etag: str :ivar id: Name of the Cosmos DB MongoDB database. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -8035,34 +6667,18 @@ class MongoDBDatabaseGetPropertiesResource(MongoDBDatabaseResource, ExtendedReso "ts": {"key": "_ts", "type": "float"}, "etag": {"key": "_etag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, } - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB MongoDB database. Required. :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ - super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) + super().__init__(id=id, **kwargs) self.rid = None self.ts = None self.etag = None self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode class MongoDBDatabaseGetResults(ARMResourceProperties): @@ -8085,8 +6701,6 @@ class MongoDBDatabaseGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource :ivar options: @@ -8105,7 +6719,6 @@ class MongoDBDatabaseGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "MongoDBDatabaseGetPropertiesResource"}, "options": {"key": "properties.options", "type": "MongoDBDatabaseGetPropertiesOptions"}, } @@ -8115,11 +6728,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.MongoDBDatabaseGetPropertiesResource"] = None, options: Optional["_models.MongoDBDatabaseGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -8130,14 +6742,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -8159,7 +6769,7 @@ class MongoDBDatabaseListResult(_serialization.Model): "value": {"key": "value", "type": "[MongoDBDatabaseGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -8184,8 +6794,8 @@ def __init__( *, key: Optional["_models.MongoIndexKeys"] = None, options: Optional["_models.MongoIndexOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key: Cosmos DB MongoDB collection index keys. :paramtype key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys @@ -8208,7 +6818,7 @@ class MongoIndexKeys(_serialization.Model): "keys": {"key": "keys", "type": "[str]"}, } - def __init__(self, *, keys: Optional[List[str]] = None, **kwargs): + def __init__(self, *, keys: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword keys: List of keys for each MongoDB collection in the Azure Cosmos DB service. :paramtype keys: list[str] @@ -8231,7 +6841,9 @@ class MongoIndexOptions(_serialization.Model): "unique": {"key": "unique", "type": "bool"}, } - def __init__(self, *, expire_after_seconds: Optional[int] = None, unique: Optional[bool] = None, **kwargs): + def __init__( + self, *, expire_after_seconds: Optional[int] = None, unique: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword expire_after_seconds: Expire after seconds. :paramtype expire_after_seconds: int @@ -8279,8 +6891,8 @@ def __init__( database_name: Optional[str] = None, privileges: Optional[List["_models.Privilege"]] = None, roles: Optional[List["_models.Role"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_name: A user-friendly name for the Role Definition. Must be unique for the database account. @@ -8359,8 +6971,8 @@ def __init__( database_name: Optional[str] = None, privileges: Optional[List["_models.Privilege"]] = None, roles: Optional[List["_models.Role"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_name: A user-friendly name for the Role Definition. Must be unique for the database account. @@ -8403,7 +7015,7 @@ class MongoRoleDefinitionListResult(_serialization.Model): "value": {"key": "value", "type": "[MongoRoleDefinitionGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -8446,8 +7058,8 @@ def __init__( custom_data: Optional[str] = None, roles: Optional[List["_models.Role"]] = None, mechanisms: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_name: The user name for User Definition. :paramtype user_name: str @@ -8527,8 +7139,8 @@ def __init__( custom_data: Optional[str] = None, roles: Optional[List["_models.Role"]] = None, mechanisms: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_name: The user name for User Definition. :paramtype user_name: str @@ -8571,7 +7183,7 @@ class MongoUserDefinitionListResult(_serialization.Model): "value": {"key": "value", "type": "[MongoUserDefinitionGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -8611,7 +7223,7 @@ class NotebookWorkspace(ARMProxyResource): "status": {"key": "properties.status", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.notebook_server_endpoint = None @@ -8640,7 +7252,7 @@ class NotebookWorkspaceConnectionInfoResult(_serialization.Model): "notebook_server_endpoint": {"key": "notebookServerEndpoint", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.auth_token = None @@ -8672,7 +7284,7 @@ class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -8688,7 +7300,7 @@ class NotebookWorkspaceListResult(_serialization.Model): "value": {"key": "value", "type": "[NotebookWorkspace]"}, } - def __init__(self, *, value: Optional[List["_models.NotebookWorkspace"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.NotebookWorkspace"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of notebook workspace resources. :paramtype value: list[~azure.mgmt.cosmosdb.models.NotebookWorkspace] @@ -8711,7 +7323,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -8750,8 +7364,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.ResourceProvider. :paramtype provider: str @@ -8770,7 +7384,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Resource Provider operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of operations supported by the Resource Provider. :vartype value: list[~azure.mgmt.cosmosdb.models.Operation] @@ -8783,7 +7398,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the Resource Provider. :paramtype value: list[~azure.mgmt.cosmosdb.models.Operation] @@ -8842,7 +7459,7 @@ class PartitionMetric(Metric): "partition_key_range_id": {"key": "partitionKeyRangeId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.partition_id = None @@ -8866,7 +7483,7 @@ class PartitionMetricListResult(_serialization.Model): "value": {"key": "value", "type": "[PartitionMetric]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -8906,7 +7523,7 @@ class Usage(_serialization.Model): "current_value": {"key": "currentValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.unit = None @@ -8958,7 +7575,7 @@ class PartitionUsage(Usage): "partition_key_range_id": {"key": "partitionKeyRangeId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.partition_id = None @@ -8983,7 +7600,7 @@ class PartitionUsagesResult(_serialization.Model): "value": {"key": "value", "type": "[PartitionUsage]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -9027,7 +7644,7 @@ class PercentileMetric(_serialization.Model): "metric_values": {"key": "metricValues", "type": "[PercentileMetricValue]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.start_time = None @@ -9055,7 +7672,7 @@ class PercentileMetricListResult(_serialization.Model): "value": {"key": "value", "type": "[PercentileMetric]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -9126,7 +7743,7 @@ class PercentileMetricValue(MetricValue): # pylint: disable=too-many-instance-a "p99": {"key": "P99", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.p10 = None @@ -9168,344 +7785,97 @@ def __init__( *, migration_state: Optional["_models.BackupPolicyMigrationState"] = None, periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword migration_state: The object representing the state of the migration between the backup policies. :paramtype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState :keyword periodic_mode_properties: Configuration values for periodic mode backup. - :paramtype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties - """ - super().__init__(migration_state=migration_state, **kwargs) - self.type = "Periodic" # type: str - self.periodic_mode_properties = periodic_mode_properties - - -class PeriodicModeProperties(_serialization.Model): - """Configuration values for periodic mode backup. - - :ivar backup_interval_in_minutes: An integer representing the interval in minutes between two - backups. - :vartype backup_interval_in_minutes: int - :ivar backup_retention_interval_in_hours: An integer representing the time (in hours) that each - backup is retained. - :vartype backup_retention_interval_in_hours: int - :ivar backup_storage_redundancy: Enum to indicate type of backup residency. Known values are: - "Geo", "Local", and "Zone". - :vartype backup_storage_redundancy: str or ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy - """ - - _validation = { - "backup_interval_in_minutes": {"minimum": 0}, - "backup_retention_interval_in_hours": {"minimum": 0}, - } - - _attribute_map = { - "backup_interval_in_minutes": {"key": "backupIntervalInMinutes", "type": "int"}, - "backup_retention_interval_in_hours": {"key": "backupRetentionIntervalInHours", "type": "int"}, - "backup_storage_redundancy": {"key": "backupStorageRedundancy", "type": "str"}, - } - - def __init__( - self, - *, - backup_interval_in_minutes: Optional[int] = None, - backup_retention_interval_in_hours: Optional[int] = None, - backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None, - **kwargs - ): - """ - :keyword backup_interval_in_minutes: An integer representing the interval in minutes between - two backups. - :paramtype backup_interval_in_minutes: int - :keyword backup_retention_interval_in_hours: An integer representing the time (in hours) that - each backup is retained. - :paramtype backup_retention_interval_in_hours: int - :keyword backup_storage_redundancy: Enum to indicate type of backup residency. Known values - are: "Geo", "Local", and "Zone". - :paramtype backup_storage_redundancy: str or - ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy - """ - super().__init__(**kwargs) - self.backup_interval_in_minutes = backup_interval_in_minutes - self.backup_retention_interval_in_hours = backup_retention_interval_in_hours - self.backup_storage_redundancy = backup_storage_redundancy - - -class Permission(_serialization.Model): - """The set of data plane operations permitted through this Role Definition. - - :ivar data_actions: An array of data actions that are allowed. - :vartype data_actions: list[str] - :ivar not_data_actions: An array of data actions that are denied. - :vartype not_data_actions: list[str] - """ - - _attribute_map = { - "data_actions": {"key": "dataActions", "type": "[str]"}, - "not_data_actions": {"key": "notDataActions", "type": "[str]"}, - } - - def __init__( - self, *, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, **kwargs - ): - """ - :keyword data_actions: An array of data actions that are allowed. - :paramtype data_actions: list[str] - :keyword not_data_actions: An array of data actions that are denied. - :paramtype not_data_actions: list[str] - """ - super().__init__(**kwargs) - self.data_actions = data_actions - self.not_data_actions = not_data_actions - - -class PhysicalPartitionId(_serialization.Model): - """PhysicalPartitionId object. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Id of a physical partition. Required. - :vartype id: str - """ - - _validation = { - "id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: Id of a physical partition. Required. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class PhysicalPartitionStorageInfo(_serialization.Model): - """The storage of a physical partition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique identifier of the partition. - :vartype id: str - :ivar storage_in_kb: The storage in KB for the physical partition. - :vartype storage_in_kb: float - """ - - _validation = { - "id": {"readonly": True}, - "storage_in_kb": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "storage_in_kb": {"key": "storageInKB", "type": "float"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - self.storage_in_kb = None - - -class PhysicalPartitionStorageInfoCollection(_serialization.Model): - """List of physical partitions and their properties returned by a merge operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar physical_partition_storage_info_collection: List of physical partitions and their - properties. - :vartype physical_partition_storage_info_collection: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfo] - """ - - _validation = { - "physical_partition_storage_info_collection": {"readonly": True}, - } - - _attribute_map = { - "physical_partition_storage_info_collection": { - "key": "physicalPartitionStorageInfoCollection", - "type": "[PhysicalPartitionStorageInfo]", - }, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.physical_partition_storage_info_collection = None - - -class PhysicalPartitionThroughputInfoProperties(_serialization.Model): - """The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoProperties object. - - :ivar physical_partition_throughput_info: Array of physical partition throughput info objects. - :vartype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - """ - - _attribute_map = { - "physical_partition_throughput_info": { - "key": "physicalPartitionThroughputInfo", - "type": "[PhysicalPartitionThroughputInfoResource]", - }, - } - - def __init__( - self, - *, - physical_partition_throughput_info: Optional[List["_models.PhysicalPartitionThroughputInfoResource"]] = None, - **kwargs - ): - """ - :keyword physical_partition_throughput_info: Array of physical partition throughput info - objects. - :paramtype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - """ - super().__init__(**kwargs) - self.physical_partition_throughput_info = physical_partition_throughput_info - - -class PhysicalPartitionThroughputInfoResource(_serialization.Model): - """PhysicalPartitionThroughputInfo object. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Id of a physical partition. Required. - :vartype id: str - :ivar throughput: Throughput of a physical partition. - :vartype throughput: float - """ - - _validation = { - "id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "throughput": {"key": "throughput", "type": "float"}, - } - - def __init__(self, *, id: str, throughput: Optional[float] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: Id of a physical partition. Required. - :paramtype id: str - :keyword throughput: Throughput of a physical partition. - :paramtype throughput: float - """ - super().__init__(**kwargs) - self.id = id - self.throughput = throughput - - -class PhysicalPartitionThroughputInfoResult(ARMResourceProperties): - """An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: properties of physical partition throughput info. - :vartype resource: - ~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultPropertiesResource + :paramtype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties + """ + super().__init__(migration_state=migration_state, **kwargs) + self.type: str = "Periodic" + self.periodic_mode_properties = periodic_mode_properties + + +class PeriodicModeProperties(_serialization.Model): + """Configuration values for periodic mode backup. + + :ivar backup_interval_in_minutes: An integer representing the interval in minutes between two + backups. + :vartype backup_interval_in_minutes: int + :ivar backup_retention_interval_in_hours: An integer representing the time (in hours) that each + backup is retained. + :vartype backup_retention_interval_in_hours: int + :ivar backup_storage_redundancy: Enum to indicate type of backup residency. Known values are: + "Geo", "Local", and "Zone". + :vartype backup_storage_redundancy: str or ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "backup_interval_in_minutes": {"minimum": 0}, + "backup_retention_interval_in_hours": {"minimum": 0}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "resource": {"key": "properties.resource", "type": "PhysicalPartitionThroughputInfoResultPropertiesResource"}, + "backup_interval_in_minutes": {"key": "backupIntervalInMinutes", "type": "int"}, + "backup_retention_interval_in_hours": {"key": "backupRetentionIntervalInHours", "type": "int"}, + "backup_storage_redundancy": {"key": "backupStorageRedundancy", "type": "str"}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - resource: Optional["_models.PhysicalPartitionThroughputInfoResultPropertiesResource"] = None, - **kwargs - ): + backup_interval_in_minutes: Optional[int] = None, + backup_retention_interval_in_hours: Optional[int] = None, + backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: properties of physical partition throughput info. - :paramtype resource: - ~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultPropertiesResource + :keyword backup_interval_in_minutes: An integer representing the interval in minutes between + two backups. + :paramtype backup_interval_in_minutes: int + :keyword backup_retention_interval_in_hours: An integer representing the time (in hours) that + each backup is retained. + :paramtype backup_retention_interval_in_hours: int + :keyword backup_storage_redundancy: Enum to indicate type of backup residency. Known values + are: "Geo", "Local", and "Zone". + :paramtype backup_storage_redundancy: str or + ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource + super().__init__(**kwargs) + self.backup_interval_in_minutes = backup_interval_in_minutes + self.backup_retention_interval_in_hours = backup_retention_interval_in_hours + self.backup_storage_redundancy = backup_storage_redundancy -class PhysicalPartitionThroughputInfoResultPropertiesResource(PhysicalPartitionThroughputInfoProperties): - """properties of physical partition throughput info. +class Permission(_serialization.Model): + """The set of data plane operations permitted through this Role Definition. - :ivar physical_partition_throughput_info: Array of physical partition throughput info objects. - :vartype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :ivar data_actions: An array of data actions that are allowed. + :vartype data_actions: list[str] + :ivar not_data_actions: An array of data actions that are denied. + :vartype not_data_actions: list[str] """ _attribute_map = { - "physical_partition_throughput_info": { - "key": "physicalPartitionThroughputInfo", - "type": "[PhysicalPartitionThroughputInfoResource]", - }, + "data_actions": {"key": "dataActions", "type": "[str]"}, + "not_data_actions": {"key": "notDataActions", "type": "[str]"}, } def __init__( - self, - *, - physical_partition_throughput_info: Optional[List["_models.PhysicalPartitionThroughputInfoResource"]] = None, - **kwargs - ): + self, *, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ - :keyword physical_partition_throughput_info: Array of physical partition throughput info - objects. - :paramtype physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :keyword data_actions: An array of data actions that are allowed. + :paramtype data_actions: list[str] + :keyword not_data_actions: An array of data actions that are denied. + :paramtype not_data_actions: list[str] """ - super().__init__(physical_partition_throughput_info=physical_partition_throughput_info, **kwargs) + super().__init__(**kwargs) + self.data_actions = data_actions + self.not_data_actions = not_data_actions class Resource(_serialization.Model): @@ -9535,7 +7905,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -9544,7 +7914,8 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -9570,7 +7941,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -9626,8 +7997,8 @@ def __init__( private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, group_id: Optional[str] = None, provisioning_state: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: Private endpoint which the connection belongs to. :paramtype private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty @@ -9658,7 +8029,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private endpoint connections. :paramtype value: list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] @@ -9678,7 +8049,7 @@ class PrivateEndpointProperty(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource id of the private endpoint. :paramtype id: str @@ -9724,7 +8095,7 @@ class PrivateLinkResource(ARMProxyResource): "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.group_id = None @@ -9743,7 +8114,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private link resources. :paramtype value: list[~azure.mgmt.cosmosdb.models.PrivateLinkResource] @@ -9776,7 +8147,7 @@ class PrivateLinkServiceConnectionStateProperty(_serialization.Model): "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword status: The private link service connection status. :paramtype status: str @@ -9804,8 +8175,12 @@ class Privilege(_serialization.Model): } def __init__( - self, *, resource: Optional["_models.PrivilegeResource"] = None, actions: Optional[List[str]] = None, **kwargs - ): + self, + *, + resource: Optional["_models.PrivilegeResource"] = None, + actions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ :keyword resource: An Azure Cosmos DB Mongo DB Resource. :paramtype resource: ~azure.mgmt.cosmosdb.models.PrivilegeResource @@ -9831,7 +8206,7 @@ class PrivilegeResource(_serialization.Model): "collection": {"key": "collection", "type": "str"}, } - def __init__(self, *, db: Optional[str] = None, collection: Optional[str] = None, **kwargs): + def __init__(self, *, db: Optional[str] = None, collection: Optional[str] = None, **kwargs: Any) -> None: """ :keyword db: The database name the role is applied. :paramtype db: str @@ -9843,142 +8218,6 @@ def __init__(self, *, db: Optional[str] = None, collection: Optional[str] = None self.collection = collection -class RedistributeThroughputParameters(ARMResourceProperties): - """Cosmos DB redistribute throughput parameters object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: The standard JSON format of a resource throughput. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "resource": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "resource": {"key": "properties.resource", "type": "RedistributeThroughputPropertiesResource"}, - } - - def __init__( - self, - *, - resource: "_models.RedistributeThroughputPropertiesResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: The standard JSON format of a resource throughput. Required. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource - """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - - -class RedistributeThroughputPropertiesResource(_serialization.Model): - """Resource to redistribute throughput for Azure Cosmos DB resource. - - All required parameters must be populated in order to send to Azure. - - :ivar throughput_policy: ThroughputPolicy to apply for throughput redistribution. Required. - Known values are: "none", "equal", and "custom". - :vartype throughput_policy: str or ~azure.mgmt.cosmosdb.models.ThroughputPolicyType - :ivar target_physical_partition_throughput_info: Array of - PhysicalPartitionThroughputInfoResource objects. Required. - :vartype target_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - :ivar source_physical_partition_throughput_info: Array of - PhysicalPartitionThroughputInfoResource objects. Required. - :vartype source_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - """ - - _validation = { - "throughput_policy": {"required": True}, - "target_physical_partition_throughput_info": {"required": True}, - "source_physical_partition_throughput_info": {"required": True}, - } - - _attribute_map = { - "throughput_policy": {"key": "throughputPolicy", "type": "str"}, - "target_physical_partition_throughput_info": { - "key": "targetPhysicalPartitionThroughputInfo", - "type": "[PhysicalPartitionThroughputInfoResource]", - }, - "source_physical_partition_throughput_info": { - "key": "sourcePhysicalPartitionThroughputInfo", - "type": "[PhysicalPartitionThroughputInfoResource]", - }, - } - - def __init__( - self, - *, - throughput_policy: Union[str, "_models.ThroughputPolicyType"], - target_physical_partition_throughput_info: List["_models.PhysicalPartitionThroughputInfoResource"], - source_physical_partition_throughput_info: List["_models.PhysicalPartitionThroughputInfoResource"], - **kwargs - ): - """ - :keyword throughput_policy: ThroughputPolicy to apply for throughput redistribution. Required. - Known values are: "none", "equal", and "custom". - :paramtype throughput_policy: str or ~azure.mgmt.cosmosdb.models.ThroughputPolicyType - :keyword target_physical_partition_throughput_info: Array of - PhysicalPartitionThroughputInfoResource objects. Required. - :paramtype target_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - :keyword source_physical_partition_throughput_info: Array of - PhysicalPartitionThroughputInfoResource objects. Required. - :paramtype source_physical_partition_throughput_info: - list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] - """ - super().__init__(**kwargs) - self.throughput_policy = throughput_policy - self.target_physical_partition_throughput_info = target_physical_partition_throughput_info - self.source_physical_partition_throughput_info = source_physical_partition_throughput_info - - class RegionForOnlineOffline(_serialization.Model): """Cosmos DB region to online or offline. @@ -9996,7 +8235,7 @@ class RegionForOnlineOffline(_serialization.Model): "region": {"key": "region", "type": "str"}, } - def __init__(self, *, region: str, **kwargs): + def __init__(self, *, region: str, **kwargs: Any) -> None: """ :keyword region: Cosmos DB region, with spaces between words and each word capitalized. Required. @@ -10006,78 +8245,6 @@ def __init__(self, *, region: str, **kwargs): self.region = region -class RestoreParametersBase(_serialization.Model): - """Parameters to indicate the information about the restore. - - :ivar restore_source: The id of the restorable database account from which the restore has to - be initiated. For example: - /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. - :vartype restore_source: str - :ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format). - :vartype restore_timestamp_in_utc: ~datetime.datetime - """ - - _attribute_map = { - "restore_source": {"key": "restoreSource", "type": "str"}, - "restore_timestamp_in_utc": {"key": "restoreTimestampInUtc", "type": "iso-8601"}, - } - - def __init__( - self, - *, - restore_source: Optional[str] = None, - restore_timestamp_in_utc: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword restore_source: The id of the restorable database account from which the restore has - to be initiated. For example: - /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. - :paramtype restore_source: str - :keyword restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 - format). - :paramtype restore_timestamp_in_utc: ~datetime.datetime - """ - super().__init__(**kwargs) - self.restore_source = restore_source - self.restore_timestamp_in_utc = restore_timestamp_in_utc - - -class ResourceRestoreParameters(RestoreParametersBase): - """Parameters to indicate the information about the restore. - - :ivar restore_source: The id of the restorable database account from which the restore has to - be initiated. For example: - /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. - :vartype restore_source: str - :ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format). - :vartype restore_timestamp_in_utc: ~datetime.datetime - """ - - _attribute_map = { - "restore_source": {"key": "restoreSource", "type": "str"}, - "restore_timestamp_in_utc": {"key": "restoreTimestampInUtc", "type": "iso-8601"}, - } - - def __init__( - self, - *, - restore_source: Optional[str] = None, - restore_timestamp_in_utc: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword restore_source: The id of the restorable database account from which the restore has - to be initiated. For example: - /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. - :paramtype restore_source: str - :keyword restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 - format). - :paramtype restore_timestamp_in_utc: ~datetime.datetime - """ - super().__init__(restore_source=restore_source, restore_timestamp_in_utc=restore_timestamp_in_utc, **kwargs) - - class RestorableDatabaseAccountGetResult(_serialization.Model): """A Azure Cosmos DB restorable database account. @@ -10095,9 +8262,6 @@ class RestorableDatabaseAccountGetResult(_serialization.Model): :vartype account_name: str :ivar creation_time: The creation time of the restorable database account (ISO-8601 format). :vartype creation_time: ~datetime.datetime - :ivar oldest_restorable_time: The least recent time at which the database account can be - restored to (ISO-8601 format). - :vartype oldest_restorable_time: ~datetime.datetime :ivar deletion_time: The time at which the restorable database account has been deleted (ISO-8601 format). :vartype deletion_time: ~datetime.datetime @@ -10124,7 +8288,6 @@ class RestorableDatabaseAccountGetResult(_serialization.Model): "location": {"key": "location", "type": "str"}, "account_name": {"key": "properties.accountName", "type": "str"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "oldest_restorable_time": {"key": "properties.oldestRestorableTime", "type": "iso-8601"}, "deletion_time": {"key": "properties.deletionTime", "type": "iso-8601"}, "api_type": {"key": "properties.apiType", "type": "str"}, "restorable_locations": {"key": "properties.restorableLocations", "type": "[RestorableLocationResource]"}, @@ -10136,10 +8299,9 @@ def __init__( location: Optional[str] = None, account_name: Optional[str] = None, creation_time: Optional[datetime.datetime] = None, - oldest_restorable_time: Optional[datetime.datetime] = None, deletion_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -10147,9 +8309,6 @@ def __init__( :paramtype account_name: str :keyword creation_time: The creation time of the restorable database account (ISO-8601 format). :paramtype creation_time: ~datetime.datetime - :keyword oldest_restorable_time: The least recent time at which the database account can be - restored to (ISO-8601 format). - :paramtype oldest_restorable_time: ~datetime.datetime :keyword deletion_time: The time at which the restorable database account has been deleted (ISO-8601 format). :paramtype deletion_time: ~datetime.datetime @@ -10161,14 +8320,14 @@ def __init__( self.location = location self.account_name = account_name self.creation_time = creation_time - self.oldest_restorable_time = oldest_restorable_time self.deletion_time = deletion_time self.api_type = None self.restorable_locations = None class RestorableDatabaseAccountsListResult(_serialization.Model): - """The List operation response, that contains the restorable database accounts and their properties. + """The List operation response, that contains the restorable database accounts and their + properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -10184,7 +8343,7 @@ class RestorableDatabaseAccountsListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableDatabaseAccountGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10218,7 +8377,9 @@ class RestorableGremlinDatabaseGetResult(_serialization.Model): "resource": {"key": "properties.resource", "type": "RestorableGremlinDatabasePropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: The resource of an Azure Cosmos DB Gremlin database event. :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource @@ -10238,7 +8399,7 @@ class RestorableGremlinDatabasePropertiesResource(_serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str :ivar operation_type: The operation type of this database event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". + "Replace", "Delete", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str @@ -10264,7 +8425,7 @@ class RestorableGremlinDatabasePropertiesResource(_serialization.Model): "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rid = None @@ -10291,7 +8452,7 @@ class RestorableGremlinDatabasesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableGremlinDatabaseGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10325,7 +8486,9 @@ class RestorableGremlinGraphGetResult(_serialization.Model): "resource": {"key": "properties.resource", "type": "RestorableGremlinGraphPropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: The resource of an Azure Cosmos DB Gremlin graph event. :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource @@ -10345,7 +8508,7 @@ class RestorableGremlinGraphPropertiesResource(_serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str :ivar operation_type: The operation type of this graph event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". + "Replace", "Delete", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this graph event happened. :vartype event_timestamp: str @@ -10371,7 +8534,7 @@ class RestorableGremlinGraphPropertiesResource(_serialization.Model): "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rid = None @@ -10398,7 +8561,7 @@ class RestorableGremlinGraphsListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableGremlinGraphGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10435,7 +8598,9 @@ class RestorableGremlinResourcesGetResult(_serialization.Model): "graph_names": {"key": "graphNames", "type": "[str]"}, } - def __init__(self, *, database_name: Optional[str] = None, graph_names: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, database_name: Optional[str] = None, graph_names: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword database_name: The name of the gremlin database available for restore. :paramtype database_name: str @@ -10468,7 +8633,7 @@ class RestorableGremlinResourcesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableGremlinResourcesGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10506,7 +8671,7 @@ class RestorableLocationResource(_serialization.Model): "deletion_time": {"key": "deletionTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location_name = None @@ -10543,7 +8708,9 @@ class RestorableMongodbCollectionGetResult(_serialization.Model): "resource": {"key": "properties.resource", "type": "RestorableMongodbCollectionPropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: The resource of an Azure Cosmos DB MongoDB collection event. :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionPropertiesResource @@ -10563,7 +8730,7 @@ class RestorableMongodbCollectionPropertiesResource(_serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str :ivar operation_type: The operation type of this collection event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". + "Replace", "Delete", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this collection event happened. :vartype event_timestamp: str @@ -10589,7 +8756,7 @@ class RestorableMongodbCollectionPropertiesResource(_serialization.Model): "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rid = None @@ -10616,7 +8783,7 @@ class RestorableMongodbCollectionsListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableMongodbCollectionGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10650,7 +8817,9 @@ class RestorableMongodbDatabaseGetResult(_serialization.Model): "resource": {"key": "properties.resource", "type": "RestorableMongodbDatabasePropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: The resource of an Azure Cosmos DB MongoDB database event. :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasePropertiesResource @@ -10670,7 +8839,7 @@ class RestorableMongodbDatabasePropertiesResource(_serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str :ivar operation_type: The operation type of this database event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". + "Replace", "Delete", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str @@ -10696,7 +8865,7 @@ class RestorableMongodbDatabasePropertiesResource(_serialization.Model): "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rid = None @@ -10723,7 +8892,7 @@ class RestorableMongodbDatabasesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableMongodbDatabaseGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10760,7 +8929,9 @@ class RestorableMongodbResourcesGetResult(_serialization.Model): "collection_names": {"key": "collectionNames", "type": "[str]"}, } - def __init__(self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword database_name: The name of the database available for restore. :paramtype database_name: str @@ -10792,7 +8963,7 @@ class RestorableMongodbResourcesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableMongodbResourcesGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10826,7 +8997,9 @@ class RestorableSqlContainerGetResult(_serialization.Model): "resource": {"key": "properties.resource", "type": "RestorableSqlContainerPropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: The resource of an Azure Cosmos DB SQL container event. :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResource @@ -10846,7 +9019,7 @@ class RestorableSqlContainerPropertiesResource(_serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str :ivar operation_type: The operation type of this container event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". + "Replace", "Delete", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The when this container event happened. :vartype event_timestamp: str @@ -10877,8 +9050,8 @@ class RestorableSqlContainerPropertiesResource(_serialization.Model): } def __init__( - self, *, container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = None, **kwargs - ): + self, *, container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = None, **kwargs: Any + ) -> None: """ :keyword container: Cosmos DB SQL container resource object. :paramtype container: @@ -10917,11 +9090,6 @@ class SqlContainerResource(_serialization.Model): :vartype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :ivar analytical_storage_ttl: Analytical TTL. :vartype analytical_storage_ttl: int - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -10937,8 +9105,6 @@ class SqlContainerResource(_serialization.Model): "conflict_resolution_policy": {"key": "conflictResolutionPolicy", "type": "ConflictResolutionPolicy"}, "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, } def __init__( @@ -10952,10 +9118,8 @@ def __init__( conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB SQL container. Required. :paramtype id: str @@ -10976,11 +9140,6 @@ def __init__( :paramtype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: int - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__(**kwargs) self.id = id @@ -10991,8 +9150,6 @@ def __init__( self.conflict_resolution_policy = conflict_resolution_policy self.client_encryption_policy = client_encryption_policy self.analytical_storage_ttl = analytical_storage_ttl - self.restore_parameters = restore_parameters - self.create_mode = create_mode class RestorableSqlContainerPropertiesResourceContainer( @@ -11030,11 +9187,6 @@ class RestorableSqlContainerPropertiesResourceContainer( :vartype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :ivar analytical_storage_ttl: Analytical TTL. :vartype analytical_storage_ttl: int - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode :ivar self_property: A system generated property that specifies the addressable path of the container resource. :vartype self_property: str @@ -11060,8 +9212,6 @@ class RestorableSqlContainerPropertiesResourceContainer( "conflict_resolution_policy": {"key": "conflictResolutionPolicy", "type": "ConflictResolutionPolicy"}, "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, "self_property": {"key": "_self", "type": "str"}, } @@ -11076,10 +9226,8 @@ def __init__( conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB SQL container. Required. :paramtype id: str @@ -11100,11 +9248,6 @@ def __init__( :paramtype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: int - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__( id=id, @@ -11115,8 +9258,6 @@ def __init__( conflict_resolution_policy=conflict_resolution_policy, client_encryption_policy=client_encryption_policy, analytical_storage_ttl=analytical_storage_ttl, - restore_parameters=restore_parameters, - create_mode=create_mode, **kwargs ) self.rid = None @@ -11131,8 +9272,6 @@ def __init__( self.conflict_resolution_policy = conflict_resolution_policy self.client_encryption_policy = client_encryption_policy self.analytical_storage_ttl = analytical_storage_ttl - self.restore_parameters = restore_parameters - self.create_mode = create_mode class RestorableSqlContainersListResult(_serialization.Model): @@ -11152,7 +9291,7 @@ class RestorableSqlContainersListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableSqlContainerGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11186,7 +9325,9 @@ class RestorableSqlDatabaseGetResult(_serialization.Model): "resource": {"key": "properties.resource", "type": "RestorableSqlDatabasePropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: The resource of an Azure Cosmos DB SQL database event. :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResource @@ -11206,7 +9347,7 @@ class RestorableSqlDatabasePropertiesResource(_serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str :ivar operation_type: The operation type of this database event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". + "Replace", "Delete", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str @@ -11236,8 +9377,8 @@ class RestorableSqlDatabasePropertiesResource(_serialization.Model): } def __init__( - self, *, database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = None, **kwargs - ): + self, *, database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = None, **kwargs: Any + ) -> None: """ :keyword database: Cosmos DB SQL database resource object. :paramtype database: @@ -11259,11 +9400,6 @@ class SqlDatabaseResource(_serialization.Model): :ivar id: Name of the Cosmos DB SQL database. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -11272,31 +9408,15 @@ class SqlDatabaseResource(_serialization.Model): _attribute_map = { "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, } - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB SQL database. Required. :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__(**kwargs) self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode class RestorableSqlDatabasePropertiesResourceDatabase(SqlDatabaseResource, ExtendedResourceProperties): @@ -11315,11 +9435,6 @@ class RestorableSqlDatabasePropertiesResourceDatabase(SqlDatabaseResource, Exten :vartype etag: str :ivar id: Name of the Cosmos DB SQL database. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode :ivar colls: A system generated property that specified the addressable path of the collections resource. :vartype colls: str @@ -11346,31 +9461,17 @@ class RestorableSqlDatabasePropertiesResourceDatabase(SqlDatabaseResource, Exten "ts": {"key": "_ts", "type": "float"}, "etag": {"key": "_etag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, "colls": {"key": "_colls", "type": "str"}, "users": {"key": "_users", "type": "str"}, "self_property": {"key": "_self", "type": "str"}, } - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB SQL database. Required. :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ - super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) + super().__init__(id=id, **kwargs) self.rid = None self.ts = None self.etag = None @@ -11378,8 +9479,6 @@ def __init__( self.users = None self.self_property = None self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode class RestorableSqlDatabasesListResult(_serialization.Model): @@ -11399,7 +9498,7 @@ class RestorableSqlDatabasesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableSqlDatabaseGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11436,7 +9535,9 @@ class RestorableSqlResourcesGetResult(_serialization.Model): "collection_names": {"key": "collectionNames", "type": "[str]"}, } - def __init__(self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword database_name: The name of the database available for restore. :paramtype database_name: str @@ -11468,7 +9569,7 @@ class RestorableSqlResourcesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableSqlResourcesGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11502,7 +9603,9 @@ class RestorableTableGetResult(_serialization.Model): "resource": {"key": "properties.resource", "type": "RestorableTablePropertiesResource"}, } - def __init__(self, *, resource: Optional["_models.RestorableTablePropertiesResource"] = None, **kwargs): + def __init__( + self, *, resource: Optional["_models.RestorableTablePropertiesResource"] = None, **kwargs: Any + ) -> None: """ :keyword resource: The resource of an Azure Cosmos DB Table event. :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource @@ -11522,7 +9625,7 @@ class RestorableTablePropertiesResource(_serialization.Model): :ivar rid: A system generated property. A unique identifier. :vartype rid: str :ivar operation_type: The operation type of this table event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". + "Replace", "Delete", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType :ivar event_timestamp: The time when this table event happened. :vartype event_timestamp: str @@ -11548,7 +9651,7 @@ class RestorableTablePropertiesResource(_serialization.Model): "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rid = None @@ -11583,7 +9686,7 @@ class RestorableTableResourcesGetResult(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -11608,7 +9711,7 @@ class RestorableTableResourcesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableTableResourcesGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11631,23 +9734,23 @@ class RestorableTablesListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableTableGetResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None -class RestoreParameters(RestoreParametersBase): +class RestoreParameters(_serialization.Model): """Parameters to indicate the information about the restore. + :ivar restore_mode: Describes the mode of the restore. "PointInTime" + :vartype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode :ivar restore_source: The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. :vartype restore_source: str :ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format). :vartype restore_timestamp_in_utc: ~datetime.datetime - :ivar restore_mode: Describes the mode of the restore. "PointInTime" - :vartype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode :ivar databases_to_restore: List of specific databases available for restore. :vartype databases_to_restore: list[~azure.mgmt.cosmosdb.models.DatabaseRestoreResource] :ivar gremlin_databases_to_restore: List of specific gremlin databases available for restore. @@ -11658,9 +9761,9 @@ class RestoreParameters(RestoreParametersBase): """ _attribute_map = { + "restore_mode": {"key": "restoreMode", "type": "str"}, "restore_source": {"key": "restoreSource", "type": "str"}, "restore_timestamp_in_utc": {"key": "restoreTimestampInUtc", "type": "iso-8601"}, - "restore_mode": {"key": "restoreMode", "type": "str"}, "databases_to_restore": {"key": "databasesToRestore", "type": "[DatabaseRestoreResource]"}, "gremlin_databases_to_restore": { "key": "gremlinDatabasesToRestore", @@ -11672,15 +9775,17 @@ class RestoreParameters(RestoreParametersBase): def __init__( self, *, + restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None, restore_source: Optional[str] = None, restore_timestamp_in_utc: Optional[datetime.datetime] = None, - restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None, databases_to_restore: Optional[List["_models.DatabaseRestoreResource"]] = None, gremlin_databases_to_restore: Optional[List["_models.GremlinDatabaseRestoreResource"]] = None, tables_to_restore: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword restore_mode: Describes the mode of the restore. "PointInTime" + :paramtype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode :keyword restore_source: The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. @@ -11688,8 +9793,6 @@ def __init__( :keyword restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format). :paramtype restore_timestamp_in_utc: ~datetime.datetime - :keyword restore_mode: Describes the mode of the restore. "PointInTime" - :paramtype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode :keyword databases_to_restore: List of specific databases available for restore. :paramtype databases_to_restore: list[~azure.mgmt.cosmosdb.models.DatabaseRestoreResource] :keyword gremlin_databases_to_restore: List of specific gremlin databases available for @@ -11699,112 +9802,15 @@ def __init__( :keyword tables_to_restore: List of specific tables available for restore. :paramtype tables_to_restore: list[str] """ - super().__init__(restore_source=restore_source, restore_timestamp_in_utc=restore_timestamp_in_utc, **kwargs) + super().__init__(**kwargs) self.restore_mode = restore_mode + self.restore_source = restore_source + self.restore_timestamp_in_utc = restore_timestamp_in_utc self.databases_to_restore = databases_to_restore self.gremlin_databases_to_restore = gremlin_databases_to_restore self.tables_to_restore = tables_to_restore -class RetrieveThroughputParameters(ARMResourceProperties): - """Cosmos DB retrieve throughput parameters object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar resource: The standard JSON format of a resource throughput. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "resource": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "resource": {"key": "properties.resource", "type": "RetrieveThroughputPropertiesResource"}, - } - - def __init__( - self, - *, - resource: "_models.RetrieveThroughputPropertiesResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword tags: Tags are a list of key-value pairs that describe the resource. These tags can be - used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater than 128 characters and value - no greater than 256 characters. For example, the default experience for a template type is set - with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", - "Graph", "DocumentDB", and "MongoDB". - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :keyword resource: The standard JSON format of a resource throughput. Required. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource - """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.resource = resource - - -class RetrieveThroughputPropertiesResource(_serialization.Model): - """Resource to retrieve throughput information for Cosmos DB resource. - - All required parameters must be populated in order to send to Azure. - - :ivar physical_partition_ids: Array of PhysicalPartitionId objects. Required. - :vartype physical_partition_ids: list[~azure.mgmt.cosmosdb.models.PhysicalPartitionId] - """ - - _validation = { - "physical_partition_ids": {"required": True}, - } - - _attribute_map = { - "physical_partition_ids": {"key": "physicalPartitionIds", "type": "[PhysicalPartitionId]"}, - } - - def __init__(self, *, physical_partition_ids: List["_models.PhysicalPartitionId"], **kwargs): - """ - :keyword physical_partition_ids: Array of PhysicalPartitionId objects. Required. - :paramtype physical_partition_ids: list[~azure.mgmt.cosmosdb.models.PhysicalPartitionId] - """ - super().__init__(**kwargs) - self.physical_partition_ids = physical_partition_ids - - class Role(_serialization.Model): """The set of roles permitted through this Role Definition. @@ -11819,7 +9825,7 @@ class Role(_serialization.Model): "role": {"key": "role", "type": "str"}, } - def __init__(self, *, db: Optional[str] = None, role: Optional[str] = None, **kwargs): + def __init__(self, *, db: Optional[str] = None, role: Optional[str] = None, **kwargs: Any) -> None: """ :keyword db: The database name the role is applied. :paramtype db: str @@ -11842,7 +9848,7 @@ class SeedNode(_serialization.Model): "ip_address": {"key": "ipAddress", "type": "str"}, } - def __init__(self, *, ip_address: Optional[str] = None, **kwargs): + def __init__(self, *, ip_address: Optional[str] = None, **kwargs: Any) -> None: """ :keyword ip_address: IP address of this seed node. :paramtype ip_address: str @@ -11879,7 +9885,7 @@ class ServiceResource(ARMProxyResource): "properties": {"key": "properties", "type": "ServiceResourceProperties"}, } - def __init__(self, *, properties: Optional["_models.ServiceResourceProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ServiceResourceProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Services response resource. :paramtype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceProperties @@ -11917,8 +9923,8 @@ def __init__( instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, service_type: Optional[Union[str, "_models.ServiceType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". @@ -11952,7 +9958,7 @@ class ServiceResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[ServiceResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11974,8 +9980,12 @@ class SpatialSpec(_serialization.Model): } def __init__( - self, *, path: Optional[str] = None, types: Optional[List[Union[str, "_models.SpatialType"]]] = None, **kwargs - ): + self, + *, + path: Optional[str] = None, + types: Optional[List[Union[str, "_models.SpatialType"]]] = None, + **kwargs: Any + ) -> None: """ :keyword path: The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). @@ -12010,8 +10020,6 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a container. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlContainerResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -12032,7 +10040,6 @@ class SqlContainerCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlContainerResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -12043,10 +10050,9 @@ def __init__( resource: "_models.SqlContainerResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -12057,15 +10063,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a container. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlContainerResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12090,8 +10094,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -12137,11 +10141,6 @@ class SqlContainerGetPropertiesResource( :vartype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :ivar analytical_storage_ttl: Analytical TTL. :vartype analytical_storage_ttl: int - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -12163,8 +10162,6 @@ class SqlContainerGetPropertiesResource( "conflict_resolution_policy": {"key": "conflictResolutionPolicy", "type": "ConflictResolutionPolicy"}, "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, } def __init__( @@ -12178,10 +10175,8 @@ def __init__( conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = None, client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB SQL container. Required. :paramtype id: str @@ -12202,11 +10197,6 @@ def __init__( :paramtype client_encryption_policy: ~azure.mgmt.cosmosdb.models.ClientEncryptionPolicy :keyword analytical_storage_ttl: Analytical TTL. :paramtype analytical_storage_ttl: int - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__( id=id, @@ -12217,8 +10207,6 @@ def __init__( conflict_resolution_policy=conflict_resolution_policy, client_encryption_policy=client_encryption_policy, analytical_storage_ttl=analytical_storage_ttl, - restore_parameters=restore_parameters, - create_mode=create_mode, **kwargs ) self.rid = None @@ -12232,8 +10220,6 @@ def __init__( self.conflict_resolution_policy = conflict_resolution_policy self.client_encryption_policy = client_encryption_policy self.analytical_storage_ttl = analytical_storage_ttl - self.restore_parameters = restore_parameters - self.create_mode = create_mode class SqlContainerGetResults(ARMResourceProperties): @@ -12256,8 +10242,6 @@ class SqlContainerGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesResource :ivar options: @@ -12276,7 +10260,6 @@ class SqlContainerGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlContainerGetPropertiesResource"}, "options": {"key": "properties.options", "type": "SqlContainerGetPropertiesOptions"}, } @@ -12286,11 +10269,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.SqlContainerGetPropertiesResource"] = None, options: Optional["_models.SqlContainerGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -12301,14 +10283,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12330,7 +10310,7 @@ class SqlContainerListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlContainerGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -12358,8 +10338,6 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a SQL database. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -12380,7 +10358,6 @@ class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlDatabaseResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -12391,10 +10368,9 @@ def __init__( resource: "_models.SqlDatabaseResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -12405,15 +10381,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a SQL database. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12438,8 +10412,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -12466,11 +10440,6 @@ class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProp :vartype etag: str :ivar id: Name of the Cosmos DB SQL database. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode :ivar colls: A system generated property that specified the addressable path of the collections resource. :vartype colls: str @@ -12491,8 +10460,6 @@ class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProp "ts": {"key": "_ts", "type": "float"}, "etag": {"key": "_etag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, "colls": {"key": "_colls", "type": "str"}, "users": {"key": "_users", "type": "str"}, } @@ -12501,20 +10468,13 @@ def __init__( self, *, id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", colls: Optional[str] = None, users: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB SQL database. Required. :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode :keyword colls: A system generated property that specified the addressable path of the collections resource. :paramtype colls: str @@ -12522,15 +10482,13 @@ def __init__( resource. :paramtype users: str """ - super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) + super().__init__(id=id, **kwargs) self.rid = None self.ts = None self.etag = None self.colls = colls self.users = users self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode class SqlDatabaseGetResults(ARMResourceProperties): @@ -12553,8 +10511,6 @@ class SqlDatabaseGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource :ivar options: @@ -12573,7 +10529,6 @@ class SqlDatabaseGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlDatabaseGetPropertiesResource"}, "options": {"key": "properties.options", "type": "SqlDatabaseGetPropertiesOptions"}, } @@ -12583,11 +10538,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.SqlDatabaseGetPropertiesResource"] = None, options: Optional["_models.SqlDatabaseGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -12598,14 +10552,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -12627,7 +10579,7 @@ class SqlDatabaseListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlDatabaseGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -12663,7 +10615,7 @@ class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): "sql_dedicated_gateway_endpoint": {"key": "sqlDedicatedGatewayEndpoint", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.sql_dedicated_gateway_endpoint = None @@ -12681,8 +10633,8 @@ class SqlDedicatedGatewayServiceResource(_serialization.Model): } def __init__( - self, *, properties: Optional["_models.SqlDedicatedGatewayServiceResourceProperties"] = None, **kwargs - ): + self, *, properties: Optional["_models.SqlDedicatedGatewayServiceResourceProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Properties for SqlDedicatedGatewayServiceResource. :paramtype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties @@ -12700,7 +10652,7 @@ class SqlDedicatedGatewayServiceResourceProperties(ServiceResourceProperties): :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :vartype additional_properties: dict[str, JSON] + :vartype additional_properties: dict[str, any] :ivar creation_time: Time of the last state change (ISO-8601 format). :vartype creation_time: ~datetime.datetime :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", @@ -12743,16 +10695,16 @@ class SqlDedicatedGatewayServiceResourceProperties(ServiceResourceProperties): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, instance_count: Optional[int] = None, sql_dedicated_gateway_endpoint: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. - :paramtype additional_properties: dict[str, JSON] + :paramtype additional_properties: dict[str, any] :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". :paramtype instance_size: str or ~azure.mgmt.cosmosdb.models.ServiceSize @@ -12767,7 +10719,7 @@ def __init__( instance_count=instance_count, **kwargs ) - self.service_type = "SqlDedicatedGateway" # type: str + self.service_type: str = "SqlDedicatedGateway" self.sql_dedicated_gateway_endpoint = sql_dedicated_gateway_endpoint self.locations = None @@ -12798,8 +10750,8 @@ def __init__( role_definition_id: Optional[str] = None, scope: Optional[str] = None, principal_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The unique identifier for the associated Role Definition. :paramtype role_definition_id: str @@ -12860,8 +10812,8 @@ def __init__( role_definition_id: Optional[str] = None, scope: Optional[str] = None, principal_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_definition_id: The unique identifier for the associated Role Definition. :paramtype role_definition_id: str @@ -12896,7 +10848,7 @@ class SqlRoleAssignmentListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlRoleAssignmentGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -12935,8 +10887,8 @@ def __init__( type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, assignable_scopes: Optional[List[str]] = None, permissions: Optional[List["_models.Permission"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_name: A user-friendly name for the Role Definition. Must be unique for the database account. @@ -13010,8 +10962,8 @@ def __init__( type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, assignable_scopes: Optional[List[str]] = None, permissions: Optional[List["_models.Permission"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role_name: A user-friendly name for the Role Definition. Must be unique for the database account. @@ -13052,7 +11004,7 @@ class SqlRoleDefinitionListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlRoleDefinitionGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -13080,8 +11032,6 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a storedProcedure. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -13102,7 +11052,6 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlStoredProcedureResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -13113,10 +11062,9 @@ def __init__( resource: "_models.SqlStoredProcedureResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -13127,15 +11075,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a storedProcedure. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -13160,7 +11106,9 @@ class SqlStoredProcedureResource(_serialization.Model): "body": {"key": "body", "type": "str"}, } - def __init__(self, *, id: str, body: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: """ :keyword id: Name of the Cosmos DB SQL storedProcedure. Required. :paramtype id: str @@ -13207,7 +11155,9 @@ class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource, Extend "body": {"key": "body", "type": "str"}, } - def __init__(self, *, id: str, body: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: """ :keyword id: Name of the Cosmos DB SQL storedProcedure. Required. :paramtype id: str @@ -13242,8 +11192,6 @@ class SqlStoredProcedureGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource """ @@ -13260,7 +11208,6 @@ class SqlStoredProcedureGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlStoredProcedureGetPropertiesResource"}, } @@ -13269,10 +11216,9 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.SqlStoredProcedureGetPropertiesResource"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -13283,12 +11229,10 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetPropertiesResource """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -13309,7 +11253,7 @@ class SqlStoredProcedureListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlStoredProcedureGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -13337,8 +11281,6 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a trigger. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -13359,7 +11301,6 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlTriggerResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -13370,10 +11311,9 @@ def __init__( resource: "_models.SqlTriggerResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -13384,15 +11324,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a trigger. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -13431,8 +11369,8 @@ def __init__( body: Optional[str] = None, trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB SQL trigger. Required. :paramtype id: str @@ -13500,8 +11438,8 @@ def __init__( body: Optional[str] = None, trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Name of the Cosmos DB SQL trigger. Required. :paramtype id: str @@ -13543,8 +11481,6 @@ class SqlTriggerGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource """ @@ -13561,7 +11497,6 @@ class SqlTriggerGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlTriggerGetPropertiesResource"}, } @@ -13570,10 +11505,9 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.SqlTriggerGetPropertiesResource"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -13584,12 +11518,10 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerGetPropertiesResource """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -13610,7 +11542,7 @@ class SqlTriggerListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlTriggerGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -13638,8 +11570,6 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a userDefinedFunction. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -13660,7 +11590,6 @@ class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlUserDefinedFunctionResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -13671,10 +11600,9 @@ def __init__( resource: "_models.SqlUserDefinedFunctionResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -13685,15 +11613,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a userDefinedFunction. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -13718,7 +11644,9 @@ class SqlUserDefinedFunctionResource(_serialization.Model): "body": {"key": "body", "type": "str"}, } - def __init__(self, *, id: str, body: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: """ :keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required. :paramtype id: str @@ -13765,7 +11693,9 @@ class SqlUserDefinedFunctionGetPropertiesResource(SqlUserDefinedFunctionResource "body": {"key": "body", "type": "str"}, } - def __init__(self, *, id: str, body: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: """ :keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required. :paramtype id: str @@ -13800,8 +11730,6 @@ class SqlUserDefinedFunctionGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetPropertiesResource """ @@ -13818,7 +11746,6 @@ class SqlUserDefinedFunctionGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "SqlUserDefinedFunctionGetPropertiesResource"}, } @@ -13827,10 +11754,9 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.SqlUserDefinedFunctionGetPropertiesResource"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -13841,12 +11767,10 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetPropertiesResource """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -13867,7 +11791,7 @@ class SqlUserDefinedFunctionListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlUserDefinedFunctionGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -13910,8 +11834,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -13959,8 +11883,6 @@ class TableCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a Table. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.TableResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -13981,7 +11903,6 @@ class TableCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "TableResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -13992,10 +11913,9 @@ def __init__( resource: "_models.TableResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -14006,15 +11926,13 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a Table. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.TableResource :keyword options: A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. :paramtype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -14039,8 +11957,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -14068,7 +11986,7 @@ class TableResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB table. Required. :paramtype id: str @@ -14109,7 +12027,7 @@ class TableGetPropertiesResource(TableResource, ExtendedResourceProperties): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Name of the Cosmos DB table. Required. :paramtype id: str @@ -14141,8 +12059,6 @@ class TableGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource :ivar options: @@ -14161,7 +12077,6 @@ class TableGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "TableGetPropertiesResource"}, "options": {"key": "properties.options", "type": "TableGetPropertiesOptions"}, } @@ -14171,11 +12086,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.TableGetPropertiesResource"] = None, options: Optional["_models.TableGetPropertiesOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -14186,14 +12100,12 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource self.options = options @@ -14215,7 +12127,7 @@ class TableListResult(_serialization.Model): "value": {"key": "value", "type": "[TableGetResults]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -14236,7 +12148,9 @@ class ThroughputPolicyResource(_serialization.Model): "increment_percent": {"key": "incrementPercent", "type": "int"}, } - def __init__(self, *, is_enabled: Optional[bool] = None, increment_percent: Optional[int] = None, **kwargs): + def __init__( + self, *, is_enabled: Optional[bool] = None, increment_percent: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword is_enabled: Determines whether the ThroughputPolicy is active or not. :paramtype is_enabled: bool @@ -14250,7 +12164,8 @@ def __init__(self, *, is_enabled: Optional[bool] = None, increment_percent: Opti class ThroughputSettingsResource(_serialization.Model): - """Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. + """Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is + required, but not both. Variables are only populated by the server, and will be ignored when sending a request. @@ -14283,8 +12198,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. @@ -14347,8 +12262,8 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword throughput: Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. @@ -14387,8 +12302,6 @@ class ThroughputSettingsGetResults(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: :vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource """ @@ -14405,7 +12318,6 @@ class ThroughputSettingsGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "ThroughputSettingsGetPropertiesResource"}, } @@ -14414,10 +12326,9 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.ThroughputSettingsGetPropertiesResource"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -14428,12 +12339,10 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: :paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource @@ -14459,8 +12368,6 @@ class ThroughputSettingsUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :ivar resource: The standard JSON format of a resource throughput. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ @@ -14478,7 +12385,6 @@ class ThroughputSettingsUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource": {"key": "properties.resource", "type": "ThroughputSettingsResource"}, } @@ -14488,9 +12394,8 @@ def __init__( resource: "_models.ThroughputSettingsResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -14501,17 +12406,16 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :keyword resource: The standard JSON format of a resource throughput. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.resource = resource class UniqueKey(_serialization.Model): - """The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + """The unique key on that enforces uniqueness constraint on documents in the collection in the + Azure Cosmos DB service. :ivar paths: List of paths must be unique for each document in the Azure Cosmos DB service. :vartype paths: list[str] @@ -14521,7 +12425,7 @@ class UniqueKey(_serialization.Model): "paths": {"key": "paths", "type": "[str]"}, } - def __init__(self, *, paths: Optional[List[str]] = None, **kwargs): + def __init__(self, *, paths: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword paths: List of paths must be unique for each document in the Azure Cosmos DB service. :paramtype paths: list[str] @@ -14531,7 +12435,8 @@ def __init__(self, *, paths: Optional[List[str]] = None, **kwargs): class UniqueKeyPolicy(_serialization.Model): - """The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + """The unique key policy configuration for specifying uniqueness constraints on documents in the + collection in the Azure Cosmos DB service. :ivar unique_keys: List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. @@ -14542,7 +12447,7 @@ class UniqueKeyPolicy(_serialization.Model): "unique_keys": {"key": "uniqueKeys", "type": "[UniqueKey]"}, } - def __init__(self, *, unique_keys: Optional[List["_models.UniqueKey"]] = None, **kwargs): + def __init__(self, *, unique_keys: Optional[List["_models.UniqueKey"]] = None, **kwargs: Any) -> None: """ :keyword unique_keys: List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. @@ -14569,7 +12474,7 @@ class UsagesResult(_serialization.Model): "value": {"key": "value", "type": "[Usage]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -14596,8 +12501,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin ignore_missing_v_net_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py index b9aee75bbc64..0a347515778b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py @@ -19,14 +19,12 @@ from ._collection_partition_operations import CollectionPartitionOperations from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations -from ._graph_resources_operations import GraphResourcesOperations from ._sql_resources_operations import SqlResourcesOperations from ._mongo_db_resources_operations import MongoDBResourcesOperations from ._table_resources_operations import TableResourcesOperations from ._cassandra_resources_operations import CassandraResourcesOperations from ._gremlin_resources_operations import GremlinResourcesOperations from ._locations_operations import LocationsOperations -from ._data_transfer_jobs_operations import DataTransferJobsOperations from ._cassandra_clusters_operations import CassandraClustersOperations from ._cassandra_data_centers_operations import CassandraDataCentersOperations from ._notebook_workspaces_operations import NotebookWorkspacesOperations @@ -47,7 +45,7 @@ from ._service_operations import ServiceOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -64,14 +62,12 @@ "CollectionPartitionOperations", "PartitionKeyRangeIdOperations", "PartitionKeyRangeIdRegionOperations", - "GraphResourcesOperations", "SqlResourcesOperations", "MongoDBResourcesOperations", "TableResourcesOperations", "CassandraResourcesOperations", "GremlinResourcesOperations", "LocationsOperations", - "DataTransferJobsOperations", "CassandraClustersOperations", "CassandraDataCentersOperations", "NotebookWorkspacesOperations", diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py index 6e172e7d1fd4..00064e964337 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_clusters_operations.py @@ -47,9 +47,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +58,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,9 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,9 +103,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +121,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,9 +138,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +156,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,10 +173,8 @@ def build_create_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +192,7 @@ def build_create_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -221,10 +211,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +230,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,10 +249,8 @@ def build_invoke_command_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -282,7 +268,7 @@ def build_invoke_command_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -295,90 +281,13 @@ def build_invoke_command_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_backups_request( - resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", max_length=100, min_length=1, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_backup_request( - resource_group_name: str, cluster_name: str, backup_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", max_length=100, min_length=1, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$" - ), - "backupId": _SERIALIZER.url("backup_id", backup_id, "str", max_length=15, min_length=1, pattern=r"^[0-9]+$"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - def build_deallocate_request( resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -396,7 +305,7 @@ def build_deallocate_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -413,9 +322,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -433,7 +340,7 @@ def build_start_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -450,9 +357,7 @@ def build_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -470,7 +375,7 @@ def build_status_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -512,10 +417,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ClusterResour _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListClusters] + ) + cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -536,7 +441,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -552,7 +457,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -560,13 +465,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListClusters", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -579,7 +484,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ClusterResource"]: @@ -596,10 +503,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListClusters] + ) + cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -621,7 +528,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -637,7 +544,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -645,13 +552,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListClusters", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -664,7 +571,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters" + } @distributed_trace def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ClusterResource: @@ -691,10 +600,10 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] + ) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -706,9 +615,9 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -725,7 +634,9 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -741,10 +652,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -756,9 +667,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -771,7 +682,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: @@ -797,13 +710,13 @@ def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -821,7 +734,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -833,9 +746,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } def _create_update_initial( self, resource_group_name: str, cluster_name: str, body: Union[_models.ClusterResource, IO], **kwargs: Any @@ -851,11 +766,11 @@ def _create_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -878,9 +793,9 @@ def _create_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -897,11 +812,13 @@ def _create_update_initial( deserialized = self._deserialize("ClusterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + _create_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } @overload def begin_create_update( @@ -1013,16 +930,16 @@ def begin_create_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_initial( # type: ignore + raw_result = self._create_update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, @@ -1042,7 +959,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1054,9 +971,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + begin_create_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } def _update_initial( self, resource_group_name: str, cluster_name: str, body: Union[_models.ClusterResource, IO], **kwargs: Any @@ -1072,11 +991,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1099,9 +1018,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1118,11 +1037,13 @@ def _update_initial( deserialized = self._deserialize("ClusterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } @overload def begin_update( @@ -1229,16 +1150,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClusterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, @@ -1258,7 +1179,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1270,9 +1191,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" + } def _invoke_command_initial( self, resource_group_name: str, cluster_name: str, body: Union[_models.CommandPostBody, IO], **kwargs: Any @@ -1288,11 +1211,11 @@ def _invoke_command_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CommandOutput] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1315,9 +1238,9 @@ def _invoke_command_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1334,7 +1257,9 @@ def _invoke_command_initial( return deserialized - _invoke_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand"} # type: ignore + _invoke_command_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand" + } @overload def begin_invoke_command( @@ -1441,16 +1366,16 @@ def begin_invoke_command( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CommandOutput] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandOutput] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._invoke_command_initial( # type: ignore + raw_result = self._invoke_command_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, body=body, @@ -1470,7 +1395,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1482,165 +1407,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_invoke_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand"} # type: ignore - - @distributed_trace - def list_backups( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.BackupResource"]: - """List the backups of this cluster that are available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.BackupResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBackups] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_backups_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_backups.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ListBackups", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_backups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups"} # type: ignore - - @distributed_trace - def get_backup( - self, resource_group_name: str, cluster_name: str, backup_id: str, **kwargs: Any - ) -> _models.BackupResource: - """Get the properties of an individual backup of this cluster that is available to restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param backup_id: Id of a restorable backup of a Cassandra cluster. Required. - :type backup_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResource or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.BackupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResource] - - request = build_get_backup_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - backup_id=backup_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_backup.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BackupResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_backup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}"} # type: ignore + begin_invoke_command.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand" + } def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -1656,10 +1427,10 @@ def _deallocate_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_deallocate_request( resource_group_name=resource_group_name, @@ -1671,9 +1442,9 @@ def _deallocate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1686,7 +1457,9 @@ def _deallocate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate"} # type: ignore + _deallocate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate" + } @distributed_trace def begin_deallocate(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1714,13 +1487,13 @@ def begin_deallocate(self, resource_group_name: str, cluster_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._deallocate_initial( # type: ignore resource_group_name=resource_group_name, @@ -1738,7 +1511,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1750,9 +1523,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_deallocate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate"} # type: ignore + begin_deallocate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate" + } def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -1768,10 +1543,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1783,9 +1558,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1798,7 +1573,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start" + } @distributed_trace def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1826,13 +1603,13 @@ def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1850,7 +1627,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1862,9 +1639,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start" + } @distributed_trace def status( @@ -1893,10 +1672,10 @@ def status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraClusterPublicStatus] + ) + cls: ClsType[_models.CassandraClusterPublicStatus] = kwargs.pop("cls", None) request = build_status_request( resource_group_name=resource_group_name, @@ -1908,9 +1687,9 @@ def status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1927,4 +1706,6 @@ def status( return deserialized - status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status"} # type: ignore + status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py index 001712256b7d..b7dfcb0d419e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py @@ -47,9 +47,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +65,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +108,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -129,9 +125,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +151,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,10 +168,8 @@ def build_create_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +195,7 @@ def build_create_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,10 +214,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +241,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -302,10 +292,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListDataCenters] + ) + cls: ClsType[_models.ListDataCenters] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -328,7 +318,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -344,7 +334,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -352,13 +342,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListDataCenters", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -371,7 +361,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters" + } @distributed_trace def get( @@ -402,10 +394,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] + ) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -418,9 +410,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -437,7 +429,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any @@ -453,10 +447,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -469,9 +463,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -484,7 +478,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } @distributed_trace def begin_delete( @@ -514,13 +510,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -539,7 +535,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -551,9 +547,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } def _create_update_initial( self, @@ -574,11 +572,11 @@ def _create_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -602,9 +600,9 @@ def _create_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -621,11 +619,13 @@ def _create_update_initial( deserialized = self._deserialize("DataCenterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + _create_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } @overload def begin_create_update( @@ -748,16 +748,16 @@ def begin_create_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_initial( # type: ignore + raw_result = self._create_update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -778,7 +778,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -790,9 +790,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + begin_create_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } def _update_initial( self, @@ -813,11 +815,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -841,9 +843,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -860,11 +862,13 @@ def _update_initial( deserialized = self._deserialize("DataCenterResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } @overload def begin_update( @@ -984,16 +988,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataCenterResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, data_center_name=data_center_name, @@ -1014,7 +1018,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1026,6 +1030,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_resources_operations.py index 4d7e794c82ba..d74864de2a12 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_resources_operations.py @@ -49,9 +49,7 @@ def build_list_cassandra_keyspaces_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_cassandra_keyspaces_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,9 +84,7 @@ def build_get_cassandra_keyspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_get_cassandra_keyspace_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,10 +120,8 @@ def build_create_update_cassandra_keyspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +140,7 @@ def build_create_update_cassandra_keyspace_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,9 +158,7 @@ def build_delete_cassandra_keyspace_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -183,7 +175,7 @@ def build_delete_cassandra_keyspace_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,9 +189,7 @@ def build_get_cassandra_keyspace_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +208,7 @@ def build_get_cassandra_keyspace_throughput_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,10 +225,8 @@ def build_update_cassandra_keyspace_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +245,7 @@ def build_update_cassandra_keyspace_throughput_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,9 +264,7 @@ def build_migrate_cassandra_keyspace_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +283,7 @@ def build_migrate_cassandra_keyspace_to_autoscale_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,9 +300,7 @@ def build_migrate_cassandra_keyspace_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,7 +319,7 @@ def build_migrate_cassandra_keyspace_to_manual_throughput_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -352,9 +336,7 @@ def build_list_cassandra_tables_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -373,7 +355,7 @@ def build_list_cassandra_tables_request( "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -395,9 +377,7 @@ def build_get_cassandra_table_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -417,7 +397,7 @@ def build_get_cassandra_table_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -439,10 +419,8 @@ def build_create_update_cassandra_table_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -462,7 +440,7 @@ def build_create_update_cassandra_table_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -485,9 +463,7 @@ def build_delete_cassandra_table_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -505,7 +481,7 @@ def build_delete_cassandra_table_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -524,9 +500,7 @@ def build_get_cassandra_table_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -546,7 +520,7 @@ def build_get_cassandra_table_throughput_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -568,10 +542,8 @@ def build_update_cassandra_table_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -591,7 +563,7 @@ def build_update_cassandra_table_throughput_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -615,9 +587,7 @@ def build_migrate_cassandra_table_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -637,7 +607,7 @@ def build_migrate_cassandra_table_to_autoscale_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -659,9 +629,7 @@ def build_migrate_cassandra_table_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -681,7 +649,7 @@ def build_migrate_cassandra_table_to_manual_throughput_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -692,1431 +660,49 @@ def build_migrate_cassandra_table_to_manual_throughput_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_cassandra_views_request( - resource_group_name: str, account_name: str, keyspace_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_cassandra_view_request( - resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - "viewName": _SERIALIZER.url("view_name", view_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_update_cassandra_view_request( - resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - "viewName": _SERIALIZER.url("view_name", view_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_cassandra_view_request( - resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - "viewName": _SERIALIZER.url("view_name", view_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_get_cassandra_view_throughput_request( - resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - "viewName": _SERIALIZER.url("view_name", view_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_cassandra_view_throughput_request( - resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - "viewName": _SERIALIZER.url("view_name", view_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_migrate_cassandra_view_to_autoscale_request( - resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - "viewName": _SERIALIZER.url("view_name", view_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_migrate_cassandra_view_to_manual_throughput_request( - resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "keyspaceName": _SERIALIZER.url("keyspace_name", keyspace_name, "str"), - "viewName": _SERIALIZER.url("view_name", view_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CassandraResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`cassandra_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_cassandra_keyspaces( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.CassandraKeyspaceGetResults"]: - """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CassandraKeyspaceGetResults or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraKeyspaceListResult] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_cassandra_keyspaces_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_cassandra_keyspaces.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CassandraKeyspaceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_cassandra_keyspaces.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces"} # type: ignore - - @distributed_trace - def get_cassandra_keyspace( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> _models.CassandraKeyspaceGetResults: - """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the - provided name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CassandraKeyspaceGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraKeyspaceGetResults] - - request = build_get_cassandra_keyspace_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_cassandra_keyspace.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_keyspace.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - def _create_update_cassandra_keyspace_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.CassandraKeyspaceGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CassandraKeyspaceGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_update_cassandra_keyspace_parameters, (IO, bytes)): - _content = create_update_cassandra_keyspace_parameters - else: - _json = self._serialize.body( - create_update_cassandra_keyspace_parameters, "CassandraKeyspaceCreateUpdateParameters" - ) - - request = build_create_update_cassandra_keyspace_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_update_cassandra_keyspace_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_cassandra_keyspace_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - @overload - def begin_create_update_cassandra_keyspace( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_update_cassandra_keyspace( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_update_cassandra_keyspace( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Is either a model type or a IO type. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraKeyspaceGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_update_cassandra_keyspace_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_cassandra_keyspace.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_cassandra_keyspace_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_cassandra_keyspace_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_cassandra_keyspace_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - @distributed_trace - def begin_delete_cassandra_keyspace( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_cassandra_keyspace_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_cassandra_keyspace.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"} # type: ignore - - @distributed_trace - def get_cassandra_keyspace_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database - account with the provided name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - - request = build_get_cassandra_keyspace_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_cassandra_keyspace_throughput.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_cassandra_keyspace_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - - def _update_cassandra_keyspace_throughput_initial( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_throughput_parameters, (IO, bytes)): - _content = update_throughput_parameters - else: - _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - - request = build_update_cassandra_keyspace_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_cassandra_keyspace_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_cassandra_keyspace_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - - @overload - def begin_update_cassandra_keyspace_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_cassandra_keyspace_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - update_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_cassandra_keyspace_throughput( - self, - resource_group_name: str, - account_name: str, - keyspace_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Is either a model type or a IO type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_cassandra_keyspace_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_cassandra_keyspace_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"} # type: ignore - - def _migrate_cassandra_keyspace_to_autoscale_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_cassandra_keyspace_to_autoscale_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_cassandra_keyspace_to_autoscale_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_keyspace_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - @distributed_trace - def begin_migrate_cassandra_keyspace_to_autoscale( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._migrate_cassandra_keyspace_to_autoscale_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_cassandra_keyspace_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - def _migrate_cassandra_keyspace_to_manual_throughput_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_cassandra_keyspace_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_cassandra_keyspace_to_manual_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_cassandra_keyspace_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace - def begin_migrate_cassandra_keyspace_to_manual_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._migrate_cassandra_keyspace_to_manual_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) +class CassandraResourcesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`cassandra_resources` attribute. + """ - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + models = _models - begin_migrate_cassandra_keyspace_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_cassandra_tables( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> Iterable["_models.CassandraTableGetResults"]: - """Lists the Cassandra table under an existing Azure Cosmos DB database account. + def list_cassandra_keyspaces( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.CassandraKeyspaceGetResults"]: + """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CassandraTableGetResults or the result of + :return: An iterator like instance of either CassandraKeyspaceGetResults or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraTableListResult] + ) + cls: ClsType[_models.CassandraKeyspaceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2129,18 +715,17 @@ def list_cassandra_tables( def prepare_request(next_link=None): if not next_link: - request = build_list_cassandra_tables_request( + request = build_list_cassandra_keyspaces_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cassandra_tables.metadata["url"], + template_url=self.list_cassandra_keyspaces.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2156,21 +741,21 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize("CassandraTableListResult", pipeline_response) + deserialized = self._deserialize("CassandraKeyspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2183,13 +768,16 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_cassandra_tables.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables"} # type: ignore + list_cassandra_keyspaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces" + } @distributed_trace - def get_cassandra_table( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> _models.CassandraTableGetResults: - """Gets the Cassandra table under an existing Azure Cosmos DB database account. + def get_cassandra_keyspace( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> _models.CassandraKeyspaceGetResults: + """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the + provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2198,11 +786,9 @@ def get_cassandra_table( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CassandraTableGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults + :return: CassandraKeyspaceGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -2216,26 +802,25 @@ def get_cassandra_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraTableGetResults] + ) + cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) - request = build_get_cassandra_table_request( + request = build_get_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_cassandra_table.metadata["url"], + template_url=self.get_cassandra_keyspace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2245,24 +830,25 @@ def get_cassandra_table( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CassandraTableGetResults", pipeline_response) + deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_cassandra_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + get_cassandra_keyspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } - def _create_update_cassandra_table_initial( + def _create_update_cassandra_keyspace_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO], + create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.CassandraTableGetResults]: + ) -> Optional[_models.CassandraKeyspaceGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2274,40 +860,39 @@ def _create_update_cassandra_table_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CassandraTableGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_cassandra_table_parameters, (IO, bytes)): - _content = create_update_cassandra_table_parameters + if isinstance(create_update_cassandra_keyspace_parameters, (IO, bytes)): + _content = create_update_cassandra_keyspace_parameters else: _json = self._serialize.body( - create_update_cassandra_table_parameters, "CassandraTableCreateUpdateParameters" + create_update_cassandra_keyspace_parameters, "CassandraKeyspaceCreateUpdateParameters" ) - request = build_create_update_cassandra_table_request( + request = build_create_update_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_update_cassandra_table_initial.metadata["url"], + template_url=self._create_update_cassandra_keyspace_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2318,29 +903,37 @@ def _create_update_cassandra_table_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("CassandraTableGetResults", pipeline_response) + deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_cassandra_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + _create_update_cassandra_keyspace_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } @overload - def begin_create_update_cassandra_table( + def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, + create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> LROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2349,12 +942,10 @@ def begin_create_update_cassandra_table( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2366,25 +957,24 @@ def begin_create_update_cassandra_table( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraTableGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_table( + def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: IO, + create_update_cassandra_keyspace_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> LROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2393,11 +983,9 @@ def begin_create_update_cassandra_table( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: IO + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -2409,23 +997,22 @@ def begin_create_update_cassandra_table( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraTableGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_cassandra_table( + def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO], + create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO], **kwargs: Any - ) -> LROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> LROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2434,12 +1021,10 @@ def begin_create_update_cassandra_table( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Is either a model type or a IO type. Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or IO + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Is either a model type or a IO type. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -2451,29 +1036,28 @@ def begin_create_update_cassandra_table( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraTableGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :return: An instance of LROPoller that returns either CassandraKeyspaceGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraTableGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_cassandra_table_initial( # type: ignore + raw_result = self._create_update_cassandra_keyspace_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, - create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, + create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2484,13 +1068,13 @@ def begin_create_update_cassandra_table( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CassandraTableGetResults", pipeline_response) + deserialized = self._deserialize("CassandraKeyspaceGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2502,12 +1086,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_cassandra_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + begin_create_update_cassandra_keyspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } - def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def _delete_cassandra_keyspace_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -2520,26 +1106,25 @@ def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_cassandra_table_request( + request = build_delete_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_cassandra_table_initial.metadata["url"], + template_url=self._delete_cassandra_keyspace_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2549,16 +1134,25 @@ def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-stat map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_cassandra_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + _delete_cassandra_keyspace_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } @distributed_trace - def begin_delete_cassandra_table( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def begin_delete_cassandra_keyspace( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra table. + """Deletes an existing Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2567,8 +1161,6 @@ def begin_delete_cassandra_table( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2584,19 +1176,18 @@ def begin_delete_cassandra_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_cassandra_table_initial( # type: ignore + raw_result = self._delete_cassandra_keyspace_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -2610,7 +1201,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2622,15 +1213,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_cassandra_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"} # type: ignore + begin_delete_cassandra_keyspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" + } @distributed_trace - def get_cassandra_table_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def get_cassandra_keyspace_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database + """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2640,8 +1233,6 @@ def get_cassandra_table_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ThroughputSettingsGetResults or the result of cls(response) :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults @@ -2658,26 +1249,25 @@ def get_cassandra_table_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - request = build_get_cassandra_table_throughput_request( + request = build_get_cassandra_keyspace_throughput_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_cassandra_table_throughput.metadata["url"], + template_url=self.get_cassandra_keyspace_throughput.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2694,14 +1284,15 @@ def get_cassandra_table_throughput( return deserialized - get_cassandra_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + get_cassandra_keyspace_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + } - def _update_cassandra_table_throughput_initial( + def _update_cassandra_keyspace_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.ThroughputSettingsGetResults]: @@ -2716,11 +1307,11 @@ def _update_cassandra_table_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2730,24 +1321,23 @@ def _update_cassandra_table_throughput_initial( else: _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - request = build_update_cassandra_table_throughput_request( + request = build_update_cassandra_keyspace_throughput_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_cassandra_table_throughput_initial.metadata["url"], + template_url=self._update_cassandra_keyspace_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2758,29 +1348,37 @@ def _update_cassandra_table_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_cassandra_table_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + _update_cassandra_keyspace_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + } @overload - def begin_update_cassandra_table_throughput( + def begin_update_cassandra_keyspace_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2789,10 +1387,8 @@ def begin_update_cassandra_table_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. + current Cassandra Keyspace. Required. :type update_throughput_parameters: ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -2813,18 +1409,17 @@ def begin_update_cassandra_table_throughput( """ @overload - def begin_update_cassandra_table_throughput( + def begin_update_cassandra_keyspace_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, update_throughput_parameters: IO, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2833,10 +1428,8 @@ def begin_update_cassandra_table_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. + current Cassandra Keyspace. Required. :type update_throughput_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -2856,16 +1449,15 @@ def begin_update_cassandra_table_throughput( """ @distributed_trace - def begin_update_cassandra_table_throughput( + def begin_update_cassandra_keyspace_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - table_name: str, update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2874,10 +1466,8 @@ def begin_update_cassandra_table_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Is either a model type or a IO type. Required. + current Cassandra Keyspace. Is either a model type or a IO type. Required. :type update_throughput_parameters: ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2899,20 +1489,19 @@ def begin_update_cassandra_table_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_cassandra_table_throughput_initial( # type: ignore + raw_result = self._update_cassandra_keyspace_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, update_throughput_parameters=update_throughput_parameters, api_version=api_version, content_type=content_type, @@ -2930,7 +1519,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2942,12 +1531,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_cassandra_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"} # type: ignore + begin_update_cassandra_keyspace_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + } - def _migrate_cassandra_table_to_autoscale_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def _migrate_cassandra_keyspace_to_autoscale_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, @@ -2960,26 +1551,25 @@ def _migrate_cassandra_table_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_migrate_cassandra_table_to_autoscale_request( + request = build_migrate_cassandra_keyspace_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._migrate_cassandra_table_to_autoscale_initial.metadata["url"], + template_url=self._migrate_cassandra_keyspace_to_autoscale_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2990,21 +1580,30 @@ def _migrate_cassandra_table_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_table_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_cassandra_keyspace_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace - def begin_migrate_cassandra_table_to_autoscale( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def begin_migrate_cassandra_keyspace_to_autoscale( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3013,8 +1612,6 @@ def begin_migrate_cassandra_table_to_autoscale( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -3031,19 +1628,18 @@ def begin_migrate_cassandra_table_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_cassandra_table_to_autoscale_initial( # type: ignore + raw_result = self._migrate_cassandra_keyspace_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -3059,7 +1655,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3071,12 +1667,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_table_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_cassandra_keyspace_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale" + } - def _migrate_cassandra_table_to_manual_throughput_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def _migrate_cassandra_keyspace_to_manual_throughput_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, @@ -3089,26 +1687,25 @@ def _migrate_cassandra_table_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_migrate_cassandra_table_to_manual_throughput_request( + request = build_migrate_cassandra_keyspace_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._migrate_cassandra_table_to_manual_throughput_initial.metadata["url"], + template_url=self._migrate_cassandra_keyspace_to_manual_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3119,21 +1716,30 @@ def _migrate_cassandra_table_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_table_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_cassandra_keyspace_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace - def begin_migrate_cassandra_table_to_manual_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def begin_migrate_cassandra_keyspace_to_manual_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3142,8 +1748,6 @@ def begin_migrate_cassandra_table_to_manual_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -3160,19 +1764,18 @@ def begin_migrate_cassandra_table_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_cassandra_table_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_cassandra_keyspace_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - table_name=table_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -3188,7 +1791,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3200,15 +1803,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_table_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_cassandra_keyspace_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace - def list_cassandra_views( + def list_cassandra_tables( self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> Iterable["_models.CassandraViewGetResults"]: - """Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. + ) -> Iterable["_models.CassandraTableGetResults"]: + """Lists the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3218,18 +1823,18 @@ def list_cassandra_views( :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CassandraViewGetResults or the result of + :return: An iterator like instance of either CassandraTableGetResults or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraViewListResult] + ) + cls: ClsType[_models.CassandraTableListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -3242,18 +1847,18 @@ def list_cassandra_views( def prepare_request(next_link=None): if not next_link: - request = build_list_cassandra_views_request( + request = build_list_cassandra_tables_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cassandra_views.metadata["url"], + template_url=self.list_cassandra_tables.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -3269,21 +1874,21 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize("CassandraViewListResult", pipeline_response) + deserialized = self._deserialize("CassandraTableListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -3296,13 +1901,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_cassandra_views.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views"} # type: ignore + list_cassandra_tables.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables" + } @distributed_trace - def get_cassandra_view( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any - ) -> _models.CassandraViewGetResults: - """Gets the Cassandra view under an existing Azure Cosmos DB database account. + def get_cassandra_table( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> _models.CassandraTableGetResults: + """Gets the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3311,11 +1918,11 @@ def get_cassandra_view( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CassandraViewGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults + :return: CassandraTableGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3329,26 +1936,26 @@ def get_cassandra_view( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraViewGetResults] + ) + cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) - request = build_get_cassandra_view_request( + request = build_get_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_cassandra_view.metadata["url"], + template_url=self.get_cassandra_table.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3358,24 +1965,26 @@ def get_cassandra_view( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CassandraViewGetResults", pipeline_response) + deserialized = self._deserialize("CassandraTableGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_cassandra_view.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + get_cassandra_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } - def _create_update_cassandra_view_initial( + def _create_update_cassandra_table_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: Union[_models.CassandraViewCreateUpdateParameters, IO], + table_name: str, + create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.CassandraViewGetResults]: + ) -> Optional[_models.CassandraTableGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3387,38 +1996,40 @@ def _create_update_cassandra_view_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CassandraViewGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CassandraTableGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_cassandra_view_parameters, (IO, bytes)): - _content = create_update_cassandra_view_parameters + if isinstance(create_update_cassandra_table_parameters, (IO, bytes)): + _content = create_update_cassandra_table_parameters else: - _json = self._serialize.body(create_update_cassandra_view_parameters, "CassandraViewCreateUpdateParameters") + _json = self._serialize.body( + create_update_cassandra_table_parameters, "CassandraTableCreateUpdateParameters" + ) - request = build_create_update_cassandra_view_request( + request = build_create_update_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_update_cassandra_view_initial.metadata["url"], + template_url=self._create_update_cassandra_table_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3429,29 +2040,38 @@ def _create_update_cassandra_view_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("CassandraViewGetResults", pipeline_response) + deserialized = self._deserialize("CassandraTableGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_cassandra_view_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + _create_update_cassandra_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } @overload - def begin_create_update_cassandra_view( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: _models.CassandraViewCreateUpdateParameters, + table_name: str, + create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraViewGetResults]: - """Create or update an Azure Cosmos DB Cassandra View. + ) -> LROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3460,12 +2080,12 @@ def begin_create_update_cassandra_view( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. Required. - :type create_update_cassandra_view_parameters: - ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3477,25 +2097,25 @@ def begin_create_update_cassandra_view( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraViewGetResults or the result of + :return: An instance of LROPoller that returns either CassandraTableGetResults or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_view( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: IO, + table_name: str, + create_update_cassandra_table_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraViewGetResults]: - """Create or update an Azure Cosmos DB Cassandra View. + ) -> LROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3504,11 +2124,11 @@ def begin_create_update_cassandra_view( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. Required. - :type create_update_cassandra_view_parameters: IO + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -3520,23 +2140,23 @@ def begin_create_update_cassandra_view( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraViewGetResults or the result of + :return: An instance of LROPoller that returns either CassandraTableGetResults or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_cassandra_view( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, - create_update_cassandra_view_parameters: Union[_models.CassandraViewCreateUpdateParameters, IO], + table_name: str, + create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO], **kwargs: Any - ) -> LROPoller[_models.CassandraViewGetResults]: - """Create or update an Azure Cosmos DB Cassandra View. + ) -> LROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3545,12 +2165,12 @@ def begin_create_update_cassandra_view( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str - :param create_update_cassandra_view_parameters: The parameters to provide for the current - Cassandra View. Is either a model type or a IO type. Required. - :type create_update_cassandra_view_parameters: - ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or IO + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Is either a model type or a IO type. Required. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -3562,29 +2182,29 @@ def begin_create_update_cassandra_view( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CassandraViewGetResults or the result of + :return: An instance of LROPoller that returns either CassandraTableGetResults or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CassandraViewGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_cassandra_view_initial( # type: ignore + raw_result = self._create_update_cassandra_table_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, - create_update_cassandra_view_parameters=create_update_cassandra_view_parameters, + table_name=table_name, + create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3595,13 +2215,13 @@ def begin_create_update_cassandra_view( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CassandraViewGetResults", pipeline_response) + deserialized = self._deserialize("CassandraTableGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3613,12 +2233,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_cassandra_view.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + begin_create_update_cassandra_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } - def _delete_cassandra_view_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + def _delete_cassandra_table_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -3631,45 +2253,54 @@ def _delete_cassandra_view_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_cassandra_view_request( + request = build_delete_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_cassandra_view_initial.metadata["url"], + template_url=self._delete_cassandra_table_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_cassandra_view_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + _delete_cassandra_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } @distributed_trace - def begin_delete_cassandra_view( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + def begin_delete_cassandra_table( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra view. + """Deletes an existing Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3678,8 +2309,8 @@ def begin_delete_cassandra_view( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -3695,19 +2326,19 @@ def begin_delete_cassandra_view( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_cassandra_view_initial( # type: ignore + raw_result = self._delete_cassandra_table_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -3721,7 +2352,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3733,15 +2364,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_cassandra_view.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"} # type: ignore + begin_delete_cassandra_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + } @distributed_trace - def get_cassandra_view_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + def get_cassandra_table_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database + """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3751,8 +2384,8 @@ def get_cassandra_view_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ThroughputSettingsGetResults or the result of cls(response) :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults @@ -3769,26 +2402,26 @@ def get_cassandra_view_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - request = build_get_cassandra_view_throughput_request( + request = build_get_cassandra_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_cassandra_view_throughput.metadata["url"], + template_url=self.get_cassandra_table_throughput.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3805,14 +2438,16 @@ def get_cassandra_view_throughput( return deserialized - get_cassandra_view_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore + get_cassandra_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default" + } - def _update_cassandra_view_throughput_initial( + def _update_cassandra_table_throughput_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.ThroughputSettingsGetResults]: @@ -3827,11 +2462,11 @@ def _update_cassandra_view_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3841,24 +2476,24 @@ def _update_cassandra_view_throughput_initial( else: _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - request = build_update_cassandra_view_throughput_request( + request = build_update_cassandra_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_cassandra_view_throughput_initial.metadata["url"], + template_url=self._update_cassandra_table_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3869,29 +2504,38 @@ def _update_cassandra_view_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_cassandra_view_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore + _update_cassandra_table_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default" + } @overload - def begin_update_cassandra_view_throughput( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3900,10 +2544,10 @@ def begin_update_cassandra_view_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. Required. + current Cassandra table. Required. :type update_throughput_parameters: ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -3924,18 +2568,18 @@ def begin_update_cassandra_view_throughput( """ @overload - def begin_update_cassandra_view_throughput( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, update_throughput_parameters: IO, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3944,10 +2588,10 @@ def begin_update_cassandra_view_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. Required. + current Cassandra table. Required. :type update_throughput_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -3967,16 +2611,16 @@ def begin_update_cassandra_view_throughput( """ @distributed_trace - def begin_update_cassandra_view_throughput( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, - view_name: str, + table_name: str, update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra view. + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3985,10 +2629,10 @@ def begin_update_cassandra_view_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra view. Is either a model type or a IO type. Required. + current Cassandra table. Is either a model type or a IO type. Required. :type update_throughput_parameters: ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -4010,20 +2654,20 @@ def begin_update_cassandra_view_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_cassandra_view_throughput_initial( # type: ignore + raw_result = self._update_cassandra_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, update_throughput_parameters=update_throughput_parameters, api_version=api_version, content_type=content_type, @@ -4041,7 +2685,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4053,12 +2697,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_cassandra_view_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"} # type: ignore + begin_update_cassandra_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default" + } - def _migrate_cassandra_view_to_autoscale_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + def _migrate_cassandra_table_to_autoscale_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, @@ -4071,26 +2717,26 @@ def _migrate_cassandra_view_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_migrate_cassandra_view_to_autoscale_request( + request = build_migrate_cassandra_table_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._migrate_cassandra_view_to_autoscale_initial.metadata["url"], + template_url=self._migrate_cassandra_table_to_autoscale_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4101,21 +2747,30 @@ def _migrate_cassandra_view_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_view_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_cassandra_table_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace - def begin_migrate_cassandra_view_to_autoscale( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + def begin_migrate_cassandra_table_to_autoscale( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. + """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4124,8 +2779,8 @@ def begin_migrate_cassandra_view_to_autoscale( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -4142,19 +2797,19 @@ def begin_migrate_cassandra_view_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_cassandra_view_to_autoscale_initial( # type: ignore + raw_result = self._migrate_cassandra_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -4170,7 +2825,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4182,12 +2837,14 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_view_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_cassandra_table_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } - def _migrate_cassandra_view_to_manual_throughput_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + def _migrate_cassandra_table_to_manual_throughput_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, @@ -4200,26 +2857,26 @@ def _migrate_cassandra_view_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_migrate_cassandra_view_to_manual_throughput_request( + request = build_migrate_cassandra_table_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._migrate_cassandra_view_to_manual_throughput_initial.metadata["url"], + template_url=self._migrate_cassandra_table_to_manual_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4230,21 +2887,30 @@ def _migrate_cassandra_view_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_cassandra_view_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_cassandra_table_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace - def begin_migrate_cassandra_view_to_manual_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + def begin_migrate_cassandra_table_to_manual_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. + """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4253,8 +2919,8 @@ def begin_migrate_cassandra_view_to_manual_throughput( :type account_name: str :param keyspace_name: Cosmos DB keyspace name. Required. :type keyspace_name: str - :param view_name: Cosmos DB view name. Required. - :type view_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -4271,19 +2937,19 @@ def begin_migrate_cassandra_view_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_cassandra_view_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_cassandra_table_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, keyspace_name=keyspace_name, - view_name=view_name, + table_name=table_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -4299,7 +2965,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4311,6 +2977,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_cassandra_view_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_cassandra_table_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_operations.py index 3fea3bea493f..4a965a9c45bc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_operations.py @@ -54,9 +54,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +74,7 @@ def build_list_metrics_request( "collectionRid": _SERIALIZER.url("collection_rid", collection_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,9 +99,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_list_usages_request( "collectionRid": _SERIALIZER.url("collection_rid", collection_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,9 +143,7 @@ def build_list_metric_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +163,7 @@ def build_list_metric_definitions_request( "collectionRid": _SERIALIZER.url("collection_rid", collection_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,10 +227,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -262,7 +256,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -278,7 +272,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -286,13 +280,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -305,7 +299,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics" + } @distributed_trace def list_usages( @@ -340,10 +336,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesResult] + ) + cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -369,7 +365,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -385,7 +381,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -393,13 +389,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -412,7 +408,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages" + } @distributed_trace def list_metric_definitions( @@ -437,10 +435,10 @@ def list_metric_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricDefinitionsListResult] + ) + cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -465,7 +463,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -481,7 +479,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -489,13 +487,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -508,4 +506,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metric_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions"} # type: ignore + list_metric_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py index b45407cae8e8..d9ea46beae03 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_operations.py @@ -54,9 +54,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +74,7 @@ def build_list_metrics_request( "collectionRid": _SERIALIZER.url("collection_rid", collection_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,9 +99,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_list_usages_request( "collectionRid": _SERIALIZER.url("collection_rid", collection_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,10 +185,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -218,7 +214,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -234,7 +230,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -242,13 +238,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -261,7 +257,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics" + } @distributed_trace def list_usages( @@ -296,10 +294,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionUsagesResult] + ) + cls: ClsType[_models.PartitionUsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -325,7 +323,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -341,7 +339,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -349,13 +347,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PartitionUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -368,4 +366,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py index ebd6415611bc..6078e5d80b5d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_partition_region_operations.py @@ -55,9 +55,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +76,7 @@ def build_list_metrics_request( "collectionRid": _SERIALIZER.url("collection_rid", collection_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +144,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -176,7 +174,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -192,7 +190,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -200,13 +198,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -219,4 +217,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py index 9e7ec0632f8f..a28528e22e22 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_collection_region_operations.py @@ -55,9 +55,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +76,7 @@ def build_list_metrics_request( "collectionRid": _SERIALIZER.url("collection_rid", collection_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +144,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -176,7 +174,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -192,7 +190,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -200,13 +198,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -219,4 +217,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py deleted file mode 100644 index 749e671f409c..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py +++ /dev/null @@ -1,796 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_pause_request( - resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_resume_request( - resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_cancel_request( - resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_database_account_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DataTransferJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`data_transfer_jobs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: _models.CreateJobRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :param job_create_parameters: Required. - :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :param job_create_parameters: Required. - :type job_create_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - account_name: str, - job_name: str, - job_create_parameters: Union[_models.CreateJobRequest, IO], - **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Creates a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :param job_create_parameters: Is either a model type or a IO type. Required. - :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(job_create_parameters, (IO, bytes)): - _content = job_create_parameters - else: - _json = self._serialize.body(job_create_parameters, "CreateJobRequest") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Get a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"} # type: ignore - - @distributed_trace - def pause( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Pause a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_pause_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.pause.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - pause.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause"} # type: ignore - - @distributed_trace - def resume( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Resumes a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_resume_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.resume.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - resume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume"} # type: ignore - - @distributed_trace - def cancel( - self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any - ) -> _models.DataTransferJobGetResults: - """Cancels a Data Transfer Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param job_name: Name of the Data Transfer Job. Required. - :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataTransferJobGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobGetResults] - - request = build_cancel_request( - resource_group_name=resource_group_name, - account_name=account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.cancel.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DataTransferJobGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel"} # type: ignore - - @distributed_trace - def list_by_database_account( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.DataTransferJobGetResults"]: - """Get a list of Data Transfer jobs. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataTransferJobGetResults or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DataTransferJobFeedResults] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_database_account_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_database_account.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DataTransferJobFeedResults", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py index e510756f32c2..245824b2963c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_account_region_operations.py @@ -47,9 +47,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +66,7 @@ def build_list_metrics_request( "region": _SERIALIZER.url("region", region, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,10 +122,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,7 +150,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -168,7 +166,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +174,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,4 +193,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py index 12cd0459afeb..f8d0f487fd64 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_accounts_operations.py @@ -47,9 +47,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +65,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,10 +82,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +101,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,10 +120,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +139,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,9 +157,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -181,7 +173,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,10 +187,8 @@ def build_failover_priority_change_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -214,7 +204,7 @@ def build_failover_priority_change_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,9 +220,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,7 +229,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,9 +244,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +259,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,9 +276,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +294,7 @@ def build_list_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -327,9 +311,7 @@ def build_list_connection_strings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -347,7 +329,7 @@ def build_list_connection_strings_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -364,10 +346,8 @@ def build_offline_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -385,7 +365,7 @@ def build_offline_region_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -404,10 +384,8 @@ def build_online_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -425,7 +403,7 @@ def build_online_region_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -444,9 +422,7 @@ def build_get_read_only_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -464,7 +440,7 @@ def build_get_read_only_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -481,9 +457,7 @@ def build_list_read_only_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -501,7 +475,7 @@ def build_list_read_only_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -518,10 +492,8 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -537,7 +509,7 @@ def build_regenerate_key_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -552,9 +524,7 @@ def build_regenerate_key_request( def build_check_name_exists_request(account_name: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}") path_format_arguments = { @@ -563,7 +533,7 @@ def build_check_name_exists_request(account_name: str, **kwargs: Any) -> HttpReq ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -577,9 +547,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -597,7 +565,7 @@ def build_list_metrics_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -615,9 +583,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -635,7 +601,7 @@ def build_list_usages_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -654,9 +620,7 @@ def build_list_metric_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -674,7 +638,7 @@ def build_list_metric_definitions_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -729,10 +693,10 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] + ) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -744,9 +708,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -763,7 +727,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } def _update_initial( self, @@ -783,11 +749,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -810,9 +776,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -829,7 +795,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } @overload def begin_update( @@ -940,16 +908,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, update_parameters=update_parameters, @@ -969,7 +937,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -981,9 +949,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } def _create_or_update_initial( self, @@ -1003,11 +973,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1030,9 +1000,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1049,7 +1019,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } @overload def begin_create_or_update( @@ -1167,16 +1139,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatabaseAccountGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, create_update_parameters=create_update_parameters, @@ -1196,7 +1168,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1208,9 +1180,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -1226,10 +1200,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1241,9 +1215,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1253,10 +1227,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1282,13 +1265,13 @@ def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1306,7 +1289,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1318,9 +1301,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" + } def _failover_priority_change_initial( # pylint: disable=inconsistent-return-statements self, @@ -1340,11 +1325,11 @@ def _failover_priority_change_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1367,9 +1352,9 @@ def _failover_priority_change_initial( # pylint: disable=inconsistent-return-st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1379,10 +1364,19 @@ def _failover_priority_change_initial( # pylint: disable=inconsistent-return-st map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _failover_priority_change_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange"} # type: ignore + _failover_priority_change_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange" + } @overload def begin_failover_priority_change( @@ -1499,14 +1493,14 @@ def begin_failover_priority_change( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._failover_priority_change_initial( # type: ignore resource_group_name=resource_group_name, @@ -1526,7 +1520,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1538,9 +1532,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_failover_priority_change.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange"} # type: ignore + begin_failover_priority_change.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange" + } @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DatabaseAccountGetResults"]: @@ -1555,10 +1551,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.DatabaseAccountGetResults"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountsListResult] + ) + cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1579,7 +1575,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1595,7 +1591,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1603,13 +1599,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1622,7 +1618,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts"} @distributed_trace def list_by_resource_group( @@ -1642,10 +1638,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountsListResult] + ) + cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1667,7 +1663,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1683,7 +1679,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1691,13 +1687,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1710,7 +1706,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts" + } @distributed_trace def list_keys( @@ -1739,10 +1737,10 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListKeysResult] + ) + cls: ClsType[_models.DatabaseAccountListKeysResult] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -1754,9 +1752,9 @@ def list_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1773,7 +1771,9 @@ def list_keys( return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys" + } @distributed_trace def list_connection_strings( @@ -1802,10 +1802,10 @@ def list_connection_strings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListConnectionStringsResult] + ) + cls: ClsType[_models.DatabaseAccountListConnectionStringsResult] = kwargs.pop("cls", None) request = build_list_connection_strings_request( resource_group_name=resource_group_name, @@ -1817,9 +1817,9 @@ def list_connection_strings( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1836,7 +1836,9 @@ def list_connection_strings( return deserialized - list_connection_strings.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings"} # type: ignore + list_connection_strings.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings" + } def _offline_region_initial( # pylint: disable=inconsistent-return-statements self, @@ -1856,11 +1858,11 @@ def _offline_region_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1883,9 +1885,9 @@ def _offline_region_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1896,10 +1898,19 @@ def _offline_region_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _offline_region_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion"} # type: ignore + _offline_region_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion" + } @overload def begin_offline_region( @@ -2009,14 +2020,14 @@ def begin_offline_region( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._offline_region_initial( # type: ignore resource_group_name=resource_group_name, @@ -2036,7 +2047,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2048,9 +2059,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_offline_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion"} # type: ignore + begin_offline_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion" + } def _online_region_initial( # pylint: disable=inconsistent-return-statements self, @@ -2070,11 +2083,11 @@ def _online_region_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2097,9 +2110,9 @@ def _online_region_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2110,10 +2123,19 @@ def _online_region_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _online_region_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion"} # type: ignore + _online_region_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion" + } @overload def begin_online_region( @@ -2223,14 +2245,14 @@ def begin_online_region( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._online_region_initial( # type: ignore resource_group_name=resource_group_name, @@ -2250,7 +2272,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2262,9 +2284,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_online_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion"} # type: ignore + begin_online_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion" + } @distributed_trace def get_read_only_keys( @@ -2293,10 +2317,10 @@ def get_read_only_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] + ) + cls: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] = kwargs.pop("cls", None) request = build_get_read_only_keys_request( resource_group_name=resource_group_name, @@ -2308,9 +2332,9 @@ def get_read_only_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2327,7 +2351,9 @@ def get_read_only_keys( return deserialized - get_read_only_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys"} # type: ignore + get_read_only_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys" + } @distributed_trace def list_read_only_keys( @@ -2356,10 +2382,10 @@ def list_read_only_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] + ) + cls: ClsType[_models.DatabaseAccountListReadOnlyKeysResult] = kwargs.pop("cls", None) request = build_list_read_only_keys_request( resource_group_name=resource_group_name, @@ -2371,9 +2397,9 @@ def list_read_only_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2390,7 +2416,9 @@ def list_read_only_keys( return deserialized - list_read_only_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys"} # type: ignore + list_read_only_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys" + } def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements self, @@ -2410,11 +2438,11 @@ def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2437,9 +2465,9 @@ def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2449,10 +2477,19 @@ def _regenerate_key_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _regenerate_key_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey"} # type: ignore + _regenerate_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey" + } @overload def begin_regenerate_key( @@ -2561,14 +2598,14 @@ def begin_regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._regenerate_key_initial( # type: ignore resource_group_name=resource_group_name, @@ -2588,7 +2625,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2600,9 +2637,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey"} # type: ignore + begin_regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey" + } @distributed_trace def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: @@ -2628,10 +2667,10 @@ def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_check_name_exists_request( account_name=account_name, @@ -2641,9 +2680,9 @@ def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2657,7 +2696,7 @@ def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - check_name_exists.metadata = {"url": "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}"} # type: ignore + check_name_exists.metadata = {"url": "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}"} @distributed_trace def list_metrics( @@ -2682,10 +2721,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2709,7 +2748,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2725,7 +2764,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2733,13 +2772,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2752,7 +2791,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics" + } @distributed_trace def list_usages( @@ -2777,10 +2818,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesResult] + ) + cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2804,7 +2845,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2820,7 +2861,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2828,13 +2869,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2847,7 +2888,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages" + } @distributed_trace def list_metric_definitions( @@ -2868,10 +2911,10 @@ def list_metric_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricDefinitionsListResult] + ) + cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2894,7 +2937,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2910,7 +2953,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2918,13 +2961,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2937,4 +2980,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metric_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions"} # type: ignore + list_metric_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_operations.py index f8f8ec9050ea..a71cff92e0c1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_database_operations.py @@ -47,9 +47,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +66,7 @@ def build_list_metrics_request( "databaseRid": _SERIALIZER.url("database_rid", database_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,9 +90,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +109,7 @@ def build_list_usages_request( "databaseRid": _SERIALIZER.url("database_rid", database_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,9 +128,7 @@ def build_list_metric_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +147,7 @@ def build_list_metric_definitions_request( "databaseRid": _SERIALIZER.url("database_rid", database_rid, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,10 +203,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricListResult] + ) + cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -237,7 +231,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -253,7 +247,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -261,13 +255,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -280,7 +274,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics" + } @distributed_trace def list_usages( @@ -312,10 +308,10 @@ def list_usages( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesResult] + ) + cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -340,7 +336,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -356,7 +352,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -364,13 +360,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -383,7 +379,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_usages.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages"} # type: ignore + list_usages.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages" + } @distributed_trace def list_metric_definitions( @@ -406,10 +404,10 @@ def list_metric_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricDefinitionsListResult] + ) + cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -433,7 +431,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -449,7 +447,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -457,13 +455,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetricDefinitionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -476,4 +474,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metric_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions"} # type: ignore + list_metric_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py deleted file mode 100644 index 3ab016a9e089..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py +++ /dev/null @@ -1,723 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_graphs_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_graph_request( - resource_group_name: str, account_name: str, graph_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_update_graph_request( - resource_group_name: str, account_name: str, graph_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_graph_resource_request( - resource_group_name: str, account_name: str, graph_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -class GraphResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`graph_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_graphs( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterable["_models.GraphResourceGetResults"]: - """Lists the graphs under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GraphResourceGetResults or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GraphResourcesListResult] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_graphs_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_graphs.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GraphResourcesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_graphs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs"} # type: ignore - - @distributed_trace - def get_graph( - self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any - ) -> _models.GraphResourceGetResults: - """Gets the Graph resource under an existing Azure Cosmos DB database account with the provided - name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GraphResourceGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GraphResourceGetResults] - - request = build_get_graph_request( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_graph.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GraphResourceGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - def _create_update_graph_initial( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.GraphResourceGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GraphResourceGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_update_graph_parameters, (IO, bytes)): - _content = create_update_graph_parameters - else: - _json = self._serialize.body(create_update_graph_parameters, "GraphResourceCreateUpdateParameters") - - request = build_create_update_graph_request( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_update_graph_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("GraphResourceGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_update_graph_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - @overload - def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GraphResourceGetResults]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. - Required. - :type create_update_graph_parameters: - ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GraphResourceGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GraphResourceGetResults]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. - Required. - :type create_update_graph_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GraphResourceGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_update_graph( - self, - resource_group_name: str, - account_name: str, - graph_name: str, - create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.GraphResourceGetResults]: - """Create or update an Azure Cosmos DB Graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :param create_update_graph_parameters: The parameters to provide for the current graph. Is - either a model type or a IO type. Required. - :type create_update_graph_parameters: - ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GraphResourceGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GraphResourceGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_update_graph_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - create_update_graph_parameters=create_update_graph_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GraphResourceGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_update_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - def _delete_graph_resource_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_graph_resource_request( - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_graph_resource_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_graph_resource_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore - - @distributed_trace - def begin_delete_graph_resource( - self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Graph Resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param graph_name: Cosmos DB graph resource name. Required. - :type graph_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_graph_resource_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - graph_name=graph_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_graph_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"} # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py index 0c494fe1708a..2da7f7ba4bea 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py @@ -49,9 +49,7 @@ def build_list_gremlin_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_gremlin_databases_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,9 +84,7 @@ def build_get_gremlin_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_get_gremlin_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,10 +120,8 @@ def build_create_update_gremlin_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +140,7 @@ def build_create_update_gremlin_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,9 +158,7 @@ def build_delete_gremlin_database_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -183,7 +175,7 @@ def build_delete_gremlin_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,9 +189,7 @@ def build_get_gremlin_database_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +208,7 @@ def build_get_gremlin_database_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,10 +225,8 @@ def build_update_gremlin_database_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +245,7 @@ def build_update_gremlin_database_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,9 +264,7 @@ def build_migrate_gremlin_database_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +283,7 @@ def build_migrate_gremlin_database_to_autoscale_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,9 +300,7 @@ def build_migrate_gremlin_database_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,7 +319,7 @@ def build_migrate_gremlin_database_to_manual_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -352,9 +336,7 @@ def build_list_gremlin_graphs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -373,7 +355,7 @@ def build_list_gremlin_graphs_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -395,9 +377,7 @@ def build_get_gremlin_graph_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -417,7 +397,7 @@ def build_get_gremlin_graph_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -439,10 +419,8 @@ def build_create_update_gremlin_graph_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -462,7 +440,7 @@ def build_create_update_gremlin_graph_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -485,9 +463,7 @@ def build_delete_gremlin_graph_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -505,7 +481,7 @@ def build_delete_gremlin_graph_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -524,9 +500,7 @@ def build_get_gremlin_graph_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -546,7 +520,7 @@ def build_get_gremlin_graph_throughput_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -568,10 +542,8 @@ def build_update_gremlin_graph_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -591,7 +563,7 @@ def build_update_gremlin_graph_throughput_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -615,9 +587,7 @@ def build_migrate_gremlin_graph_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -637,7 +607,7 @@ def build_migrate_gremlin_graph_to_autoscale_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -659,9 +629,7 @@ def build_migrate_gremlin_graph_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -681,7 +649,7 @@ def build_migrate_gremlin_graph_to_manual_throughput_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -703,10 +671,8 @@ def build_retrieve_continuous_backup_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -726,7 +692,7 @@ def build_retrieve_continuous_backup_information_request( "graphName": _SERIALIZER.url("graph_name", graph_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -778,10 +744,10 @@ def list_gremlin_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinDatabaseListResult] + ) + cls: ClsType[_models.GremlinDatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -804,7 +770,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -820,7 +786,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -828,13 +794,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GremlinDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -847,7 +813,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_gremlin_databases.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases"} # type: ignore + list_gremlin_databases.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases" + } @distributed_trace def get_gremlin_database( @@ -879,10 +847,10 @@ def get_gremlin_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinDatabaseGetResults] + ) + cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_database_request( resource_group_name=resource_group_name, @@ -895,9 +863,9 @@ def get_gremlin_database( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -914,7 +882,9 @@ def get_gremlin_database( return deserialized - get_gremlin_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + get_gremlin_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } def _create_update_gremlin_database_initial( self, @@ -935,11 +905,11 @@ def _create_update_gremlin_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GremlinDatabaseGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GremlinDatabaseGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -965,9 +935,9 @@ def _create_update_gremlin_database_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -978,15 +948,24 @@ def _create_update_gremlin_database_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("GremlinDatabaseGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_gremlin_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + _create_update_gremlin_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } @overload def begin_create_update_gremlin_database( @@ -1110,16 +1089,16 @@ def begin_create_update_gremlin_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinDatabaseGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_gremlin_database_initial( # type: ignore + raw_result = self._create_update_gremlin_database_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1140,7 +1119,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1152,9 +1131,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_gremlin_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + begin_create_update_gremlin_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1170,10 +1151,10 @@ def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-sta _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_gremlin_database_request( resource_group_name=resource_group_name, @@ -1186,9 +1167,9 @@ def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-sta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1198,10 +1179,19 @@ def _delete_gremlin_database_initial( # pylint: disable=inconsistent-return-sta map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_gremlin_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + _delete_gremlin_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } @distributed_trace def begin_delete_gremlin_database( @@ -1231,13 +1221,13 @@ def begin_delete_gremlin_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_gremlin_database_initial( # type: ignore resource_group_name=resource_group_name, @@ -1256,7 +1246,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1268,9 +1258,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_gremlin_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"} # type: ignore + begin_delete_gremlin_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" + } @distributed_trace def get_gremlin_database_throughput( @@ -1302,10 +1294,10 @@ def get_gremlin_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_database_throughput_request( resource_group_name=resource_group_name, @@ -1318,9 +1310,9 @@ def get_gremlin_database_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1337,7 +1329,9 @@ def get_gremlin_database_throughput( return deserialized - get_gremlin_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default"} # type: ignore + get_gremlin_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + } def _update_gremlin_database_throughput_initial( self, @@ -1358,11 +1352,11 @@ def _update_gremlin_database_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1386,9 +1380,9 @@ def _update_gremlin_database_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1399,15 +1393,24 @@ def _update_gremlin_database_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_gremlin_database_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default"} # type: ignore + _update_gremlin_database_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + } @overload def begin_update_gremlin_database_throughput( @@ -1531,16 +1534,16 @@ def begin_update_gremlin_database_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_gremlin_database_throughput_initial( # type: ignore + raw_result = self._update_gremlin_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1561,7 +1564,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1573,9 +1576,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_gremlin_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default"} # type: ignore + begin_update_gremlin_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + } def _migrate_gremlin_database_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1591,10 +1596,10 @@ def _migrate_gremlin_database_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_database_to_autoscale_request( resource_group_name=resource_group_name, @@ -1607,9 +1612,9 @@ def _migrate_gremlin_database_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1620,15 +1625,24 @@ def _migrate_gremlin_database_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_database_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_gremlin_database_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace def begin_migrate_gremlin_database_to_autoscale( @@ -1659,15 +1673,15 @@ def begin_migrate_gremlin_database_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_gremlin_database_to_autoscale_initial( # type: ignore + raw_result = self._migrate_gremlin_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1686,7 +1700,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1698,9 +1712,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_database_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_gremlin_database_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } def _migrate_gremlin_database_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1716,10 +1732,10 @@ def _migrate_gremlin_database_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_database_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -1732,9 +1748,9 @@ def _migrate_gremlin_database_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1745,15 +1761,24 @@ def _migrate_gremlin_database_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_database_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_gremlin_database_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def begin_migrate_gremlin_database_to_manual_throughput( @@ -1784,15 +1809,15 @@ def begin_migrate_gremlin_database_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_gremlin_database_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_gremlin_database_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1811,7 +1836,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1823,9 +1848,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_database_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_gremlin_database_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def list_gremlin_graphs( @@ -1849,10 +1876,10 @@ def list_gremlin_graphs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinGraphListResult] + ) + cls: ClsType[_models.GremlinGraphListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1876,7 +1903,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1892,7 +1919,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1900,13 +1927,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GremlinGraphListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1919,7 +1946,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_gremlin_graphs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs"} # type: ignore + list_gremlin_graphs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs" + } @distributed_trace def get_gremlin_graph( @@ -1952,10 +1981,10 @@ def get_gremlin_graph( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinGraphGetResults] + ) + cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_graph_request( resource_group_name=resource_group_name, @@ -1969,9 +1998,9 @@ def get_gremlin_graph( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1988,7 +2017,9 @@ def get_gremlin_graph( return deserialized - get_gremlin_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + get_gremlin_graph.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } def _create_update_gremlin_graph_initial( self, @@ -2010,11 +2041,11 @@ def _create_update_gremlin_graph_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GremlinGraphGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GremlinGraphGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2039,9 +2070,9 @@ def _create_update_gremlin_graph_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2052,15 +2083,24 @@ def _create_update_gremlin_graph_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("GremlinGraphGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_gremlin_graph_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + _create_update_gremlin_graph_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } @overload def begin_create_update_gremlin_graph( @@ -2193,16 +2233,16 @@ def begin_create_update_gremlin_graph( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GremlinGraphGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_gremlin_graph_initial( # type: ignore + raw_result = self._create_update_gremlin_graph_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2224,7 +2264,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2236,9 +2276,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_gremlin_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + begin_create_update_gremlin_graph.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any @@ -2254,10 +2296,10 @@ def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_gremlin_graph_request( resource_group_name=resource_group_name, @@ -2271,9 +2313,9 @@ def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statem params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2283,10 +2325,19 @@ def _delete_gremlin_graph_initial( # pylint: disable=inconsistent-return-statem map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_gremlin_graph_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + _delete_gremlin_graph_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } @distributed_trace def begin_delete_gremlin_graph( @@ -2318,13 +2369,13 @@ def begin_delete_gremlin_graph( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_gremlin_graph_initial( # type: ignore resource_group_name=resource_group_name, @@ -2344,7 +2395,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2356,9 +2407,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_gremlin_graph.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"} # type: ignore + begin_delete_gremlin_graph.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + } @distributed_trace def get_gremlin_graph_throughput( @@ -2392,10 +2445,10 @@ def get_gremlin_graph_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_gremlin_graph_throughput_request( resource_group_name=resource_group_name, @@ -2409,9 +2462,9 @@ def get_gremlin_graph_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2428,7 +2481,9 @@ def get_gremlin_graph_throughput( return deserialized - get_gremlin_graph_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default"} # type: ignore + get_gremlin_graph_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default" + } def _update_gremlin_graph_throughput_initial( self, @@ -2450,11 +2505,11 @@ def _update_gremlin_graph_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2479,9 +2534,9 @@ def _update_gremlin_graph_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2492,15 +2547,24 @@ def _update_gremlin_graph_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_gremlin_graph_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default"} # type: ignore + _update_gremlin_graph_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default" + } @overload def begin_update_gremlin_graph_throughput( @@ -2633,16 +2697,16 @@ def begin_update_gremlin_graph_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_gremlin_graph_throughput_initial( # type: ignore + raw_result = self._update_gremlin_graph_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2664,7 +2728,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2676,9 +2740,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_gremlin_graph_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default"} # type: ignore + begin_update_gremlin_graph_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default" + } def _migrate_gremlin_graph_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any @@ -2694,10 +2760,10 @@ def _migrate_gremlin_graph_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_graph_to_autoscale_request( resource_group_name=resource_group_name, @@ -2711,9 +2777,9 @@ def _migrate_gremlin_graph_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2724,15 +2790,24 @@ def _migrate_gremlin_graph_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_graph_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_gremlin_graph_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace def begin_migrate_gremlin_graph_to_autoscale( @@ -2765,15 +2840,15 @@ def begin_migrate_gremlin_graph_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_gremlin_graph_to_autoscale_initial( # type: ignore + raw_result = self._migrate_gremlin_graph_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2793,7 +2868,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2805,9 +2880,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_graph_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_gremlin_graph_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale" + } def _migrate_gremlin_graph_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any @@ -2823,10 +2900,10 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_gremlin_graph_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -2840,9 +2917,9 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2853,15 +2930,24 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_gremlin_graph_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_gremlin_graph_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def begin_migrate_gremlin_graph_to_manual_throughput( @@ -2894,15 +2980,15 @@ def begin_migrate_gremlin_graph_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_gremlin_graph_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_gremlin_graph_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2922,7 +3008,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2934,9 +3020,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_gremlin_graph_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_gremlin_graph_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput" + } def _retrieve_continuous_backup_information_initial( self, @@ -2958,11 +3046,11 @@ def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2987,9 +3075,9 @@ def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3008,7 +3096,9 @@ def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation" + } @overload def begin_retrieve_continuous_backup_information( @@ -3137,16 +3227,16 @@ def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3168,9 +3258,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3182,6 +3272,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py index 6749f3590daa..aefebe0b0c02 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_locations_operations.py @@ -45,9 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +69,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +81,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,10 +123,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.LocationGetResult"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LocationListResult] + ) + cls: ClsType[_models.LocationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -151,7 +147,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -167,7 +163,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -175,13 +171,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LocationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -194,7 +190,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations"} @distributed_trace def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: @@ -219,10 +215,10 @@ def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LocationGetResult] + ) + cls: ClsType[_models.LocationGetResult] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -233,9 +229,9 @@ def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -252,4 +248,4 @@ def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}"} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_mongo_db_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_mongo_db_resources_operations.py index 311c5218fa83..be2ff97cb019 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_mongo_db_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_mongo_db_resources_operations.py @@ -49,9 +49,7 @@ def build_list_mongo_db_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_mongo_db_databases_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,9 +84,7 @@ def build_get_mongo_db_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_get_mongo_db_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,10 +120,8 @@ def build_create_update_mongo_db_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +140,7 @@ def build_create_update_mongo_db_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,9 +158,7 @@ def build_delete_mongo_db_database_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -183,7 +175,7 @@ def build_delete_mongo_db_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,9 +189,7 @@ def build_get_mongo_db_database_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +208,7 @@ def build_get_mongo_db_database_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,10 +225,8 @@ def build_update_mongo_db_database_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +245,7 @@ def build_update_mongo_db_database_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,9 +264,7 @@ def build_migrate_mongo_db_database_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +283,7 @@ def build_migrate_mongo_db_database_to_autoscale_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,9 +300,7 @@ def build_migrate_mongo_db_database_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,7 +319,7 @@ def build_migrate_mongo_db_database_to_manual_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -346,191 +330,13 @@ def build_migrate_mongo_db_database_to_manual_throughput_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_mongo_db_database_retrieve_throughput_distribution_request( - resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_mongo_db_database_redistribute_throughput_request( - resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_mongo_db_container_retrieve_throughput_distribution_request( - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_mongo_db_container_redistribute_throughput_request( - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - def build_list_mongo_db_collections_request( resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -549,7 +355,7 @@ def build_list_mongo_db_collections_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -571,9 +377,7 @@ def build_get_mongo_db_collection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -593,7 +397,7 @@ def build_get_mongo_db_collection_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -615,10 +419,8 @@ def build_create_update_mongo_db_collection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -638,7 +440,7 @@ def build_create_update_mongo_db_collection_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -661,9 +463,7 @@ def build_delete_mongo_db_collection_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -681,7 +481,7 @@ def build_delete_mongo_db_collection_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -689,53 +489,6 @@ def build_delete_mongo_db_collection_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_list_mongo_db_collection_partition_merge_request( - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - def build_get_mongo_db_collection_throughput_request( resource_group_name: str, account_name: str, @@ -747,9 +500,7 @@ def build_get_mongo_db_collection_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -769,7 +520,7 @@ def build_get_mongo_db_collection_throughput_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -791,10 +542,8 @@ def build_update_mongo_db_collection_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -814,7 +563,7 @@ def build_update_mongo_db_collection_throughput_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -838,9 +587,7 @@ def build_migrate_mongo_db_collection_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -860,7 +607,7 @@ def build_migrate_mongo_db_collection_to_autoscale_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -882,9 +629,7 @@ def build_migrate_mongo_db_collection_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -904,7 +649,7 @@ def build_migrate_mongo_db_collection_to_manual_throughput_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -921,9 +666,7 @@ def build_get_mongo_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -942,7 +685,7 @@ def build_get_mongo_role_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -959,10 +702,8 @@ def build_create_update_mongo_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -981,7 +722,7 @@ def build_create_update_mongo_role_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1000,9 +741,7 @@ def build_delete_mongo_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1021,7 +760,7 @@ def build_delete_mongo_role_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1038,9 +777,7 @@ def build_list_mongo_role_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1058,7 +795,7 @@ def build_list_mongo_role_definitions_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1075,9 +812,7 @@ def build_get_mongo_user_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1096,7 +831,7 @@ def build_get_mongo_user_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1113,10 +848,8 @@ def build_create_update_mongo_user_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1135,7 +868,7 @@ def build_create_update_mongo_user_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1154,9 +887,7 @@ def build_delete_mongo_user_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1175,7 +906,7 @@ def build_delete_mongo_user_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1192,9 +923,7 @@ def build_list_mongo_user_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1212,7 +941,7 @@ def build_list_mongo_user_definitions_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1234,10 +963,8 @@ def build_retrieve_continuous_backup_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1257,7 +984,7 @@ def build_retrieve_continuous_backup_information_request( "collectionName": _SERIALIZER.url("collection_name", collection_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1309,10 +1036,10 @@ def list_mongo_db_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBDatabaseListResult] + ) + cls: ClsType[_models.MongoDBDatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1335,7 +1062,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1351,7 +1078,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1359,13 +1086,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MongoDBDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1378,7 +1105,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_mongo_db_databases.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases"} # type: ignore + list_mongo_db_databases.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases" + } @distributed_trace def get_mongo_db_database( @@ -1410,10 +1139,10 @@ def get_mongo_db_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBDatabaseGetResults] + ) + cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_database_request( resource_group_name=resource_group_name, @@ -1426,9 +1155,9 @@ def get_mongo_db_database( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1445,7 +1174,9 @@ def get_mongo_db_database( return deserialized - get_mongo_db_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + get_mongo_db_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } def _create_update_mongo_db_database_initial( self, @@ -1466,11 +1197,11 @@ def _create_update_mongo_db_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoDBDatabaseGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoDBDatabaseGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1496,9 +1227,9 @@ def _create_update_mongo_db_database_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1509,15 +1240,24 @@ def _create_update_mongo_db_database_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("MongoDBDatabaseGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_mongo_db_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + _create_update_mongo_db_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } @overload def begin_create_update_mongo_db_database( @@ -1641,16 +1381,16 @@ def begin_create_update_mongo_db_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBDatabaseGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_mongo_db_database_initial( # type: ignore + raw_result = self._create_update_mongo_db_database_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1671,7 +1411,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1683,9 +1423,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_db_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + begin_create_update_mongo_db_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1701,10 +1443,10 @@ def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_db_database_request( resource_group_name=resource_group_name, @@ -1717,9 +1459,9 @@ def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-return-st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1729,10 +1471,19 @@ def _delete_mongo_db_database_initial( # pylint: disable=inconsistent-return-st map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_mongo_db_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + _delete_mongo_db_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } @distributed_trace def begin_delete_mongo_db_database( @@ -1762,13 +1513,13 @@ def begin_delete_mongo_db_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_mongo_db_database_initial( # type: ignore resource_group_name=resource_group_name, @@ -1787,7 +1538,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1799,9 +1550,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_mongo_db_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"} # type: ignore + begin_delete_mongo_db_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" + } @distributed_trace def get_mongo_db_database_throughput( @@ -1833,10 +1586,10 @@ def get_mongo_db_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_database_throughput_request( resource_group_name=resource_group_name, @@ -1849,9 +1602,9 @@ def get_mongo_db_database_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1868,7 +1621,9 @@ def get_mongo_db_database_throughput( return deserialized - get_mongo_db_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default"} # type: ignore + get_mongo_db_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + } def _update_mongo_db_database_throughput_initial( self, @@ -1889,11 +1644,11 @@ def _update_mongo_db_database_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1917,9 +1672,9 @@ def _update_mongo_db_database_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1930,15 +1685,24 @@ def _update_mongo_db_database_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_mongo_db_database_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default"} # type: ignore + _update_mongo_db_database_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + } @overload def begin_update_mongo_db_database_throughput( @@ -2062,16 +1826,16 @@ def begin_update_mongo_db_database_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_mongo_db_database_throughput_initial( # type: ignore + raw_result = self._update_mongo_db_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2092,7 +1856,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2104,9 +1868,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_mongo_db_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default"} # type: ignore + begin_update_mongo_db_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + } def _migrate_mongo_db_database_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -2122,10 +1888,10 @@ def _migrate_mongo_db_database_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_database_to_autoscale_request( resource_group_name=resource_group_name, @@ -2138,9 +1904,9 @@ def _migrate_mongo_db_database_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2151,15 +1917,24 @@ def _migrate_mongo_db_database_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_mongo_db_database_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_mongo_db_database_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace def begin_migrate_mongo_db_database_to_autoscale( @@ -2190,15 +1965,15 @@ def begin_migrate_mongo_db_database_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_mongo_db_database_to_autoscale_initial( # type: ignore + raw_result = self._migrate_mongo_db_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2217,7 +1992,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2229,9 +2004,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_mongo_db_database_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_mongo_db_database_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } def _migrate_mongo_db_database_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -2247,10 +2024,10 @@ def _migrate_mongo_db_database_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_database_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -2263,9 +2040,9 @@ def _migrate_mongo_db_database_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2276,15 +2053,24 @@ def _migrate_mongo_db_database_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_mongo_db_database_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_mongo_db_database_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def begin_migrate_mongo_db_database_to_manual_throughput( @@ -2315,15 +2101,15 @@ def begin_migrate_mongo_db_database_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_mongo_db_database_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_mongo_db_database_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2342,7 +2128,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2354,1009 +2140,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_mongo_db_database_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - def _mongo_db_database_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] + begin_migrate_mongo_db_database_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_mongo_db_database_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_database_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_database_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - def begin_mongo_db_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB database. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_mongo_db_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB database. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_mongo_db_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB database. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._mongo_db_database_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_database_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - def _mongo_db_database_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters - else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - - request = build_mongo_db_database_redistribute_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_database_redistribute_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_database_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - @overload - def begin_mongo_db_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB database. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_mongo_db_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB database. Required. - :type redistribute_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_mongo_db_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB database. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._mongo_db_database_redistribute_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_database_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - def _mongo_db_container_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_mongo_db_container_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_container_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_mongo_db_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current MongoDB container. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._mongo_db_container_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_container_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - def _mongo_db_container_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters - else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - - request = build_mongo_db_container_redistribute_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._mongo_db_container_redistribute_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _mongo_db_container_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - @overload - def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. Required. - :type redistribute_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_mongo_db_container_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB MongoDB container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current MongoDB container. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._mongo_db_container_redistribute_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_mongo_db_container_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - @distributed_trace - def list_mongo_db_collections( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.MongoDBCollectionGetResults"]: - """Lists the MongoDB collection under an existing Azure Cosmos DB database account. + @distributed_trace + def list_mongo_db_collections( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> Iterable["_models.MongoDBCollectionGetResults"]: + """Lists the MongoDB collection under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3374,10 +2168,10 @@ def list_mongo_db_collections( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBCollectionListResult] + ) + cls: ClsType[_models.MongoDBCollectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -3401,7 +2195,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -3417,7 +2211,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -3425,13 +2219,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MongoDBCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -3444,7 +2238,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_mongo_db_collections.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections"} # type: ignore + list_mongo_db_collections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections" + } @distributed_trace def get_mongo_db_collection( @@ -3477,10 +2273,10 @@ def get_mongo_db_collection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBCollectionGetResults] + ) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_collection_request( resource_group_name=resource_group_name, @@ -3494,9 +2290,9 @@ def get_mongo_db_collection( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3513,7 +2309,9 @@ def get_mongo_db_collection( return deserialized - get_mongo_db_collection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + get_mongo_db_collection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } def _create_update_mongo_db_collection_initial( self, @@ -3535,11 +2333,11 @@ def _create_update_mongo_db_collection_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoDBCollectionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoDBCollectionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3566,9 +2364,9 @@ def _create_update_mongo_db_collection_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3579,15 +2377,24 @@ def _create_update_mongo_db_collection_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_mongo_db_collection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + _create_update_mongo_db_collection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } @overload def begin_create_update_mongo_db_collection( @@ -3720,16 +2527,16 @@ def begin_create_update_mongo_db_collection( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoDBCollectionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_mongo_db_collection_initial( # type: ignore + raw_result = self._create_update_mongo_db_collection_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3751,7 +2558,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3763,9 +2570,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_db_collection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + begin_create_update_mongo_db_collection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any @@ -3781,10 +2590,10 @@ def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-return- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_db_collection_request( resource_group_name=resource_group_name, @@ -3798,9 +2607,9 @@ def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-return- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3810,10 +2619,19 @@ def _delete_mongo_db_collection_initial( # pylint: disable=inconsistent-return- map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_mongo_db_collection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore + _delete_mongo_db_collection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } @distributed_trace def begin_delete_mongo_db_collection( @@ -3845,13 +2663,13 @@ def begin_delete_mongo_db_collection( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_mongo_db_collection_initial( # type: ignore resource_group_name=resource_group_name, @@ -3871,258 +2689,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete_mongo_db_collection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"} # type: ignore - - def _list_mongo_db_collection_partition_merge_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionStorageInfoCollection]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionStorageInfoCollection]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(merge_parameters, (IO, bytes)): - _content = merge_parameters - else: - _json = self._serialize.body(merge_parameters, "MergeParameters") - - request = build_list_mongo_db_collection_partition_merge_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._list_mongo_db_collection_partition_merge_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _list_mongo_db_collection_partition_merge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore - - @overload - def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: _models.MergeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_list_mongo_db_collection_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a MongoDB Collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param merge_parameters: The parameters for the merge operation. Is either a model type or a IO - type. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionStorageInfoCollection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._list_mongo_db_collection_partition_merge_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - merge_parameters=merge_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4134,9 +2701,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_list_mongo_db_collection_partition_merge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge"} # type: ignore + begin_delete_mongo_db_collection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + } @distributed_trace def get_mongo_db_collection_throughput( @@ -4170,10 +2739,10 @@ def get_mongo_db_collection_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_mongo_db_collection_throughput_request( resource_group_name=resource_group_name, @@ -4187,9 +2756,9 @@ def get_mongo_db_collection_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4206,7 +2775,9 @@ def get_mongo_db_collection_throughput( return deserialized - get_mongo_db_collection_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default"} # type: ignore + get_mongo_db_collection_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default" + } def _update_mongo_db_collection_throughput_initial( self, @@ -4228,11 +2799,11 @@ def _update_mongo_db_collection_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4257,9 +2828,9 @@ def _update_mongo_db_collection_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4270,15 +2841,24 @@ def _update_mongo_db_collection_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_mongo_db_collection_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default"} # type: ignore + _update_mongo_db_collection_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default" + } @overload def begin_update_mongo_db_collection_throughput( @@ -4411,16 +2991,16 @@ def begin_update_mongo_db_collection_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_mongo_db_collection_throughput_initial( # type: ignore + raw_result = self._update_mongo_db_collection_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4442,7 +3022,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4454,9 +3034,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_mongo_db_collection_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default"} # type: ignore + begin_update_mongo_db_collection_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default" + } def _migrate_mongo_db_collection_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any @@ -4472,10 +3054,10 @@ def _migrate_mongo_db_collection_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_collection_to_autoscale_request( resource_group_name=resource_group_name, @@ -4489,9 +3071,9 @@ def _migrate_mongo_db_collection_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4502,15 +3084,24 @@ def _migrate_mongo_db_collection_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_mongo_db_collection_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_mongo_db_collection_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace def begin_migrate_mongo_db_collection_to_autoscale( @@ -4543,15 +3134,15 @@ def begin_migrate_mongo_db_collection_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_mongo_db_collection_to_autoscale_initial( # type: ignore + raw_result = self._migrate_mongo_db_collection_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4571,7 +3162,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4583,9 +3174,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_mongo_db_collection_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_mongo_db_collection_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale" + } def _migrate_mongo_db_collection_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any @@ -4601,10 +3194,10 @@ def _migrate_mongo_db_collection_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_mongo_db_collection_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -4618,9 +3211,9 @@ def _migrate_mongo_db_collection_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4631,15 +3224,24 @@ def _migrate_mongo_db_collection_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_mongo_db_collection_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_mongo_db_collection_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def begin_migrate_mongo_db_collection_to_manual_throughput( @@ -4672,15 +3274,15 @@ def begin_migrate_mongo_db_collection_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_mongo_db_collection_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_mongo_db_collection_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -4700,7 +3302,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4712,9 +3314,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_mongo_db_collection_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_mongo_db_collection_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def get_mongo_role_definition( @@ -4746,10 +3350,10 @@ def get_mongo_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoRoleDefinitionGetResults] + ) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) request = build_get_mongo_role_definition_request( mongo_role_definition_id=mongo_role_definition_id, @@ -4762,9 +3366,9 @@ def get_mongo_role_definition( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4781,7 +3385,9 @@ def get_mongo_role_definition( return deserialized - get_mongo_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + get_mongo_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } def _create_update_mongo_role_definition_initial( self, @@ -4802,11 +3408,11 @@ def _create_update_mongo_role_definition_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoRoleDefinitionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoRoleDefinitionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4832,9 +3438,9 @@ def _create_update_mongo_role_definition_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4853,7 +3459,9 @@ def _create_update_mongo_role_definition_initial( return deserialized - _create_update_mongo_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + _create_update_mongo_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } @overload def begin_create_update_mongo_role_definition( @@ -4980,16 +3588,16 @@ def begin_create_update_mongo_role_definition( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoRoleDefinitionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_mongo_role_definition_initial( # type: ignore + raw_result = self._create_update_mongo_role_definition_initial( mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -5010,7 +3618,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -5022,9 +3630,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + begin_create_update_mongo_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent-return-statements self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -5040,10 +3650,10 @@ def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent-retur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_role_definition_request( mongo_role_definition_id=mongo_role_definition_id, @@ -5056,9 +3666,9 @@ def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5071,7 +3681,9 @@ def _delete_mongo_role_definition_initial( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - _delete_mongo_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + _delete_mongo_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } @distributed_trace def begin_delete_mongo_role_definition( @@ -5101,13 +3713,13 @@ def begin_delete_mongo_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_mongo_role_definition_initial( # type: ignore mongo_role_definition_id=mongo_role_definition_id, @@ -5126,7 +3738,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -5138,9 +3750,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_mongo_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"} # type: ignore + begin_delete_mongo_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" + } @distributed_trace def list_mongo_role_definitions( @@ -5162,10 +3776,10 @@ def list_mongo_role_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoRoleDefinitionListResult] + ) + cls: ClsType[_models.MongoRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5188,7 +3802,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -5204,7 +3818,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -5212,13 +3826,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MongoRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5231,7 +3845,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_mongo_role_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions"} # type: ignore + list_mongo_role_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions" + } @distributed_trace def get_mongo_user_definition( @@ -5263,10 +3879,10 @@ def get_mongo_user_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoUserDefinitionGetResults] + ) + cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) request = build_get_mongo_user_definition_request( mongo_user_definition_id=mongo_user_definition_id, @@ -5279,9 +3895,9 @@ def get_mongo_user_definition( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5298,7 +3914,9 @@ def get_mongo_user_definition( return deserialized - get_mongo_user_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + get_mongo_user_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } def _create_update_mongo_user_definition_initial( self, @@ -5319,11 +3937,11 @@ def _create_update_mongo_user_definition_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MongoUserDefinitionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MongoUserDefinitionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5349,9 +3967,9 @@ def _create_update_mongo_user_definition_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5370,7 +3988,9 @@ def _create_update_mongo_user_definition_initial( return deserialized - _create_update_mongo_user_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + _create_update_mongo_user_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } @overload def begin_create_update_mongo_user_definition( @@ -5497,16 +4117,16 @@ def begin_create_update_mongo_user_definition( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoUserDefinitionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_mongo_user_definition_initial( # type: ignore + raw_result = self._create_update_mongo_user_definition_initial( mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -5527,7 +4147,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -5539,9 +4159,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_mongo_user_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + begin_create_update_mongo_user_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent-return-statements self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -5557,10 +4179,10 @@ def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent-retur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_mongo_user_definition_request( mongo_user_definition_id=mongo_user_definition_id, @@ -5573,9 +4195,9 @@ def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5588,7 +4210,9 @@ def _delete_mongo_user_definition_initial( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - _delete_mongo_user_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + _delete_mongo_user_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } @distributed_trace def begin_delete_mongo_user_definition( @@ -5618,13 +4242,13 @@ def begin_delete_mongo_user_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_mongo_user_definition_initial( # type: ignore mongo_user_definition_id=mongo_user_definition_id, @@ -5643,7 +4267,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -5655,9 +4279,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_mongo_user_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"} # type: ignore + begin_delete_mongo_user_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" + } @distributed_trace def list_mongo_user_definitions( @@ -5679,10 +4305,10 @@ def list_mongo_user_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MongoUserDefinitionListResult] + ) + cls: ClsType[_models.MongoUserDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5705,7 +4331,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -5721,7 +4347,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -5729,13 +4355,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MongoUserDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5748,7 +4374,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_mongo_user_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions"} # type: ignore + list_mongo_user_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions" + } def _retrieve_continuous_backup_information_initial( self, @@ -5770,11 +4398,11 @@ def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5799,9 +4427,9 @@ def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5820,7 +4448,9 @@ def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation" + } @overload def begin_retrieve_continuous_backup_information( @@ -5949,16 +4579,16 @@ def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -5980,9 +4610,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -5994,6 +4624,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py index 93f6c5e537aa..94aabda40f69 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py @@ -49,9 +49,7 @@ def build_list_by_database_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_by_database_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,9 +88,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +107,7 @@ def build_get_request( "notebookWorkspaceName": _SERIALIZER.url("notebook_workspace_name", notebook_workspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,10 +128,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +148,7 @@ def build_create_or_update_request( "notebookWorkspaceName": _SERIALIZER.url("notebook_workspace_name", notebook_workspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,9 +171,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +190,7 @@ def build_delete_request( "notebookWorkspaceName": _SERIALIZER.url("notebook_workspace_name", notebook_workspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,9 +211,7 @@ def build_list_connection_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +230,7 @@ def build_list_connection_info_request( "notebookWorkspaceName": _SERIALIZER.url("notebook_workspace_name", notebook_workspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,9 +251,7 @@ def build_regenerate_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -282,7 +270,7 @@ def build_regenerate_auth_token_request( "notebookWorkspaceName": _SERIALIZER.url("notebook_workspace_name", notebook_workspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -303,9 +291,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +310,7 @@ def build_start_request( "notebookWorkspaceName": _SERIALIZER.url("notebook_workspace_name", notebook_workspace_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -373,10 +359,10 @@ def list_by_database_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspaceListResult] + ) + cls: ClsType[_models.NotebookWorkspaceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -399,7 +385,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -415,7 +401,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -423,13 +409,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NotebookWorkspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -443,7 +429,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces"} # type: ignore + list_by_database_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces" + } @distributed_trace def get( @@ -479,10 +467,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspace] + ) + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -495,9 +483,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -515,7 +503,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } def _create_or_update_initial( self, @@ -536,11 +526,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspace] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -564,9 +554,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -584,7 +574,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } @overload def begin_create_or_update( @@ -711,16 +703,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspace] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, notebook_workspace_name=notebook_workspace_name, @@ -741,7 +733,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -753,9 +745,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -775,10 +769,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -791,9 +785,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -807,7 +801,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } @distributed_trace def begin_delete( @@ -842,13 +838,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -867,7 +863,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -879,9 +875,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" + } @distributed_trace def list_connection_info( @@ -917,10 +915,10 @@ def list_connection_info( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotebookWorkspaceConnectionInfoResult] + ) + cls: ClsType[_models.NotebookWorkspaceConnectionInfoResult] = kwargs.pop("cls", None) request = build_list_connection_info_request( resource_group_name=resource_group_name, @@ -933,9 +931,9 @@ def list_connection_info( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -953,7 +951,9 @@ def list_connection_info( return deserialized - list_connection_info.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo"} # type: ignore + list_connection_info.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo" + } def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-statements self, @@ -973,10 +973,10 @@ def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_regenerate_auth_token_request( resource_group_name=resource_group_name, @@ -989,9 +989,9 @@ def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1005,7 +1005,9 @@ def _regenerate_auth_token_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _regenerate_auth_token_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken"} # type: ignore + _regenerate_auth_token_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken" + } @distributed_trace def begin_regenerate_auth_token( @@ -1040,13 +1042,13 @@ def begin_regenerate_auth_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._regenerate_auth_token_initial( # type: ignore resource_group_name=resource_group_name, @@ -1065,7 +1067,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1077,9 +1079,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_regenerate_auth_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken"} # type: ignore + begin_regenerate_auth_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken" + } def _start_initial( # pylint: disable=inconsistent-return-statements self, @@ -1099,10 +1103,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1115,9 +1119,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1131,7 +1135,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start" + } @distributed_trace def begin_start( @@ -1166,13 +1172,13 @@ def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1191,7 +1197,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1203,6 +1209,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_operations.py index 2fbc8b7deb6c..bb5a565089fa 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_operations.py @@ -45,9 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +91,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +130,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,13 +138,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -159,4 +157,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.DocumentDB/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DocumentDB/operations"} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py index db390f0e246d..a3bf13c9a05c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_operations.py @@ -55,9 +55,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +76,7 @@ def build_list_metrics_request( "partitionKeyRangeId": _SERIALIZER.url("partition_key_range_id", partition_key_range_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,10 +143,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -175,7 +173,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -191,7 +189,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -199,13 +197,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -218,4 +216,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py index db837aefe5ef..4e97bfb7407d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_partition_key_range_id_region_operations.py @@ -56,9 +56,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +78,7 @@ def build_list_metrics_request( "partitionKeyRangeId": _SERIALIZER.url("partition_key_range_id", partition_key_range_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,10 +149,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PartitionMetricListResult] + ) + cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -182,7 +180,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -198,7 +196,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -206,13 +204,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PartitionMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -225,4 +223,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py index a9c47c6ff1ad..04aa1121816e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_operations.py @@ -47,9 +47,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +65,7 @@ def build_list_metrics_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,10 +120,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PercentileMetricListResult] + ) + cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -149,7 +147,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -165,7 +163,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -173,13 +171,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PercentileMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -192,4 +190,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py index 1c7697c6c969..718f790418d1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_source_target_operations.py @@ -54,9 +54,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +74,7 @@ def build_list_metrics_request( "targetRegion": _SERIALIZER.url("target_region", target_region, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,10 +141,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PercentileMetricListResult] + ) + cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -172,7 +170,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -188,7 +186,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -196,13 +194,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PercentileMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -215,4 +213,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py index 276f2c7c4089..709071f885ac 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_percentile_target_operations.py @@ -47,9 +47,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +66,7 @@ def build_list_metrics_request( "targetRegion": _SERIALIZER.url("target_region", target_region, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,10 +124,10 @@ def list_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PercentileMetricListResult] + ) + cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -154,7 +152,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -170,7 +168,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +176,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PercentileMetricListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,4 +195,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics"} # type: ignore + list_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py index 35c730832763..73907fbd6cc0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_endpoint_connections_operations.py @@ -49,9 +49,7 @@ def build_list_by_database_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_by_database_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,9 +88,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +109,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,10 +130,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +152,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,9 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +196,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,10 +246,10 @@ def list_by_database_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -280,7 +272,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -296,7 +288,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -304,13 +296,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -323,7 +315,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections"} # type: ignore + list_by_database_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections" + } @distributed_trace def get( @@ -354,10 +348,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -370,9 +364,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,7 +383,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _create_or_update_initial( self, @@ -410,11 +406,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -438,9 +434,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -460,7 +456,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_create_or_update( @@ -579,16 +577,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -609,7 +607,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -621,9 +619,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -639,10 +639,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -655,9 +655,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -671,7 +671,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -701,13 +703,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -726,7 +728,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -738,6 +740,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py index 45dc003f19d8..d7cafc6adb58 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_private_link_resources_operations.py @@ -47,9 +47,7 @@ def build_list_by_database_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +65,7 @@ def build_list_by_database_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +101,7 @@ def build_get_request( "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,10 +150,10 @@ def list_by_database_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + ) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -180,7 +176,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -196,7 +192,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -204,13 +200,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -223,7 +219,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_database_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources"} # type: ignore + list_by_database_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources" + } @distributed_trace def get( @@ -254,10 +252,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + ) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -270,9 +268,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -289,4 +287,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py index d427dee29773..c03f3f9fe3c1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_database_accounts_operations.py @@ -45,9 +45,7 @@ def build_list_by_location_request(location: str, subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +58,7 @@ def build_list_by_location_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,9 +73,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +84,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,9 +99,7 @@ def build_get_by_location_request(location: str, instance_id: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +113,7 @@ def build_get_by_location_request(location: str, instance_id: str, subscription_ "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,10 +162,10 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Re _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] + ) + cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -193,7 +187,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -209,7 +203,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -217,13 +211,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableDatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -236,7 +230,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_location.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts"} # type: ignore + list_by_location.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts" + } @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.RestorableDatabaseAccountGetResult"]: @@ -253,10 +249,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.RestorableDatabaseAccountGetR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableDatabaseAccountsListResult] + ) + cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -277,7 +273,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -293,7 +289,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -301,13 +297,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableDatabaseAccountsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -320,7 +316,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts"} @distributed_trace def get_by_location( @@ -350,10 +346,10 @@ def get_by_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableDatabaseAccountGetResult] + ) + cls: ClsType[_models.RestorableDatabaseAccountGetResult] = kwargs.pop("cls", None) request = build_get_by_location_request( location=location, @@ -365,9 +361,9 @@ def get_by_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -384,4 +380,6 @@ def get_by_location( return deserialized - get_by_location.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}"} # type: ignore + get_by_location.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_databases_operations.py index 2a0410095b85..ad48942b54ed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_databases_operations.py @@ -45,9 +45,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +59,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,10 +113,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableGremlinDatabasesListResult] + ) + cls: ClsType[_models.RestorableGremlinDatabasesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -141,7 +139,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -157,7 +155,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -165,13 +163,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableGremlinDatabasesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -184,4 +182,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinDatabases" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_graphs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_graphs_operations.py index c73dc751971f..daad851adb55 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_graphs_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_graphs_operations.py @@ -54,9 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +68,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,10 +142,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableGremlinGraphsListResult] + ) + cls: ClsType[_models.RestorableGremlinGraphsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -173,7 +171,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -189,7 +187,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -197,13 +195,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableGremlinGraphsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -216,4 +214,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_resources_operations.py index 0e852217cdea..1a9f9305d529 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_gremlin_resources_operations.py @@ -53,9 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,10 +138,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableGremlinResourcesListResult] + ) + cls: ClsType[_models.RestorableGremlinResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -168,7 +166,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -184,7 +182,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -192,13 +190,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableGremlinResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,4 +209,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGremlinResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py index fef5e5618042..8e66347b6dd8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_collections_operations.py @@ -54,9 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +68,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,10 +142,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableMongodbCollectionsListResult] + ) + cls: ClsType[_models.RestorableMongodbCollectionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -173,7 +171,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -189,7 +187,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -197,13 +195,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableMongodbCollectionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -216,4 +214,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py index ff117c7068be..d174eb447d4e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_databases_operations.py @@ -45,9 +45,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +59,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,10 +113,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableMongodbDatabasesListResult] + ) + cls: ClsType[_models.RestorableMongodbDatabasesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -141,7 +139,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -157,7 +155,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -165,13 +163,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableMongodbDatabasesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -184,4 +182,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py index 8028af9f27e2..98c0c4b2dc3e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_mongodb_resources_operations.py @@ -53,9 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,10 +138,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableMongodbResourcesListResult] + ) + cls: ClsType[_models.RestorableMongodbResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -168,7 +166,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -184,7 +182,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -192,13 +190,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableMongodbResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,4 +209,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py index 8f0b9244cb88..ea4cab481c19 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_containers_operations.py @@ -54,9 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +68,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,10 +141,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableSqlContainersListResult] + ) + cls: ClsType[_models.RestorableSqlContainersListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -172,7 +170,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -188,7 +186,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -196,13 +194,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableSqlContainersListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -215,4 +213,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py index d87fd6a1ecb9..a2b0db7eafae 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_databases_operations.py @@ -45,9 +45,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +59,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,10 +113,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableSqlDatabasesListResult] + ) + cls: ClsType[_models.RestorableSqlDatabasesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -141,7 +139,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -157,7 +155,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -165,13 +163,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableSqlDatabasesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -184,4 +182,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py index 299968b5dac9..04cc57be4c7e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_sql_resources_operations.py @@ -53,9 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,10 +138,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableSqlResourcesListResult] + ) + cls: ClsType[_models.RestorableSqlResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -168,7 +166,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -184,7 +182,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -192,13 +190,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableSqlResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,4 +209,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_table_resources_operations.py index 33b684d69fa6..aa22ce5129a0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_table_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_table_resources_operations.py @@ -53,9 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,10 +137,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableTableResourcesListResult] + ) + cls: ClsType[_models.RestorableTableResourcesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -167,7 +165,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -183,7 +181,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -191,13 +189,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableTableResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -210,4 +208,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTableResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_tables_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_tables_operations.py index 631848b04df2..df1ef5167c2c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_tables_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_restorable_tables_operations.py @@ -53,9 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,10 +132,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestorableTablesListResult] + ) + cls: ClsType[_models.RestorableTablesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -162,7 +160,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -178,7 +176,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -186,13 +184,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RestorableTablesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,4 +203,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableTables" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py index d8999828d165..fb4af9f3e979 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_service_operations.py @@ -47,9 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +65,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,10 +82,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +102,7 @@ def build_create_request( "serviceName": _SERIALIZER.url("service_name", service_name, "str", max_length=50, min_length=3), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,9 +121,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +140,7 @@ def build_get_request( "serviceName": _SERIALIZER.url("service_name", service_name, "str", max_length=50, min_length=3), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,9 +157,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +176,7 @@ def build_delete_request( "serviceName": _SERIALIZER.url("service_name", service_name, "str", max_length=50, min_length=3), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -231,10 +223,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceResourceListResult] + ) + cls: ClsType[_models.ServiceResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -257,7 +249,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -273,7 +265,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -281,13 +273,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServiceResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -300,7 +292,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services" + } def _create_initial( self, @@ -321,11 +315,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ServiceResource]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ServiceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -349,9 +343,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -362,15 +356,24 @@ def _create_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ServiceResource", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } @overload def begin_create( @@ -492,16 +495,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, service_name=service_name, @@ -522,7 +525,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -534,9 +537,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } @distributed_trace def get( @@ -567,10 +572,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceResource] + ) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -583,9 +588,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -602,7 +607,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any @@ -618,10 +625,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -634,9 +641,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -646,10 +653,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } @distributed_trace def begin_delete( @@ -679,13 +695,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -704,7 +720,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -716,6 +732,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_sql_resources_operations.py index 3bf700b9605e..17dd0e326e81 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_sql_resources_operations.py @@ -49,9 +49,7 @@ def build_list_sql_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_sql_databases_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,9 +84,7 @@ def build_get_sql_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_get_sql_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,10 +120,8 @@ def build_create_update_sql_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +140,7 @@ def build_create_update_sql_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,9 +158,7 @@ def build_delete_sql_database_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -183,7 +175,7 @@ def build_delete_sql_database_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,9 +189,7 @@ def build_get_sql_database_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +208,7 @@ def build_get_sql_database_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,10 +225,8 @@ def build_update_sql_database_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +245,7 @@ def build_update_sql_database_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,9 +264,7 @@ def build_migrate_sql_database_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +283,7 @@ def build_migrate_sql_database_to_autoscale_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,9 +300,7 @@ def build_migrate_sql_database_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,7 +319,7 @@ def build_migrate_sql_database_to_manual_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -346,144 +330,13 @@ def build_migrate_sql_database_to_manual_throughput_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_client_encryption_keys_request( - resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_client_encryption_key_request( - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "clientEncryptionKeyName": _SERIALIZER.url("client_encryption_key_name", client_encryption_key_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_update_client_encryption_key_request( - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "clientEncryptionKeyName": _SERIALIZER.url("client_encryption_key_name", client_encryption_key_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - def build_list_sql_containers_request( resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -502,7 +355,7 @@ def build_list_sql_containers_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -524,9 +377,7 @@ def build_get_sql_container_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -546,7 +397,7 @@ def build_get_sql_container_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -568,10 +419,8 @@ def build_create_update_sql_container_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -591,7 +440,7 @@ def build_create_update_sql_container_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -614,9 +463,7 @@ def build_delete_sql_container_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -634,7 +481,7 @@ def build_delete_sql_container_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -642,53 +489,6 @@ def build_delete_sql_container_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_list_sql_container_partition_merge_request( - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "containerName": _SERIALIZER.url("container_name", container_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - def build_get_sql_container_throughput_request( resource_group_name: str, account_name: str, @@ -700,9 +500,7 @@ def build_get_sql_container_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -722,7 +520,7 @@ def build_get_sql_container_throughput_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -744,10 +542,8 @@ def build_update_sql_container_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -767,7 +563,7 @@ def build_update_sql_container_throughput_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -791,9 +587,7 @@ def build_migrate_sql_container_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -813,7 +607,7 @@ def build_migrate_sql_container_to_autoscale_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -835,9 +629,7 @@ def build_migrate_sql_container_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -857,74 +649,30 @@ def build_migrate_sql_container_to_manual_throughput_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_sql_database_retrieve_throughput_distribution_request( - resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" - ), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_sql_database_redistribute_throughput_request( +def build_list_client_encryption_keys_request( resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -937,40 +685,35 @@ def build_sql_database_redistribute_throughput_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_sql_container_retrieve_throughput_distribution_request( +def build_get_client_encryption_key_request( resource_group_name: str, account_name: str, database_name: str, - container_name: str, + client_encryption_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -981,43 +724,39 @@ def build_sql_container_retrieve_throughput_distribution_request( "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" ), "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "clientEncryptionKeyName": _SERIALIZER.url("client_encryption_key_name", client_encryption_key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_sql_container_redistribute_throughput_request( +def build_create_update_client_encryption_key_request( resource_group_name: str, account_name: str, database_name: str, - container_name: str, + client_encryption_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -1028,10 +767,10 @@ def build_sql_container_redistribute_throughput_request( "account_name", account_name, "str", max_length=50, min_length=3, pattern=r"^[a-z0-9]+(-[a-z0-9]+)*" ), "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "clientEncryptionKeyName": _SERIALIZER.url("client_encryption_key_name", client_encryption_key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1041,7 +780,7 @@ def build_sql_container_redistribute_throughput_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_list_sql_stored_procedures_request( @@ -1055,9 +794,7 @@ def build_list_sql_stored_procedures_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1077,7 +814,7 @@ def build_list_sql_stored_procedures_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1100,9 +837,7 @@ def build_get_sql_stored_procedure_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1123,7 +858,7 @@ def build_get_sql_stored_procedure_request( "storedProcedureName": _SERIALIZER.url("stored_procedure_name", stored_procedure_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1146,10 +881,8 @@ def build_create_update_sql_stored_procedure_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1170,7 +903,7 @@ def build_create_update_sql_stored_procedure_request( "storedProcedureName": _SERIALIZER.url("stored_procedure_name", stored_procedure_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1194,9 +927,7 @@ def build_delete_sql_stored_procedure_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -1215,7 +946,7 @@ def build_delete_sql_stored_procedure_request( "storedProcedureName": _SERIALIZER.url("stored_procedure_name", stored_procedure_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1234,9 +965,7 @@ def build_list_sql_user_defined_functions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1256,7 +985,7 @@ def build_list_sql_user_defined_functions_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1279,9 +1008,7 @@ def build_get_sql_user_defined_function_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1302,7 +1029,7 @@ def build_get_sql_user_defined_function_request( "userDefinedFunctionName": _SERIALIZER.url("user_defined_function_name", user_defined_function_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1325,10 +1052,8 @@ def build_create_update_sql_user_defined_function_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1349,7 +1074,7 @@ def build_create_update_sql_user_defined_function_request( "userDefinedFunctionName": _SERIALIZER.url("user_defined_function_name", user_defined_function_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1373,9 +1098,7 @@ def build_delete_sql_user_defined_function_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -1394,7 +1117,7 @@ def build_delete_sql_user_defined_function_request( "userDefinedFunctionName": _SERIALIZER.url("user_defined_function_name", user_defined_function_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1413,9 +1136,7 @@ def build_list_sql_triggers_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1435,7 +1156,7 @@ def build_list_sql_triggers_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1458,9 +1179,7 @@ def build_get_sql_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1481,7 +1200,7 @@ def build_get_sql_trigger_request( "triggerName": _SERIALIZER.url("trigger_name", trigger_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1504,10 +1223,8 @@ def build_create_update_sql_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1528,7 +1245,7 @@ def build_create_update_sql_trigger_request( "triggerName": _SERIALIZER.url("trigger_name", trigger_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1552,9 +1269,7 @@ def build_delete_sql_trigger_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -1573,7 +1288,7 @@ def build_delete_sql_trigger_request( "triggerName": _SERIALIZER.url("trigger_name", trigger_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1587,9 +1302,7 @@ def build_get_sql_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1608,7 +1321,7 @@ def build_get_sql_role_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1625,10 +1338,8 @@ def build_create_update_sql_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1647,7 +1358,7 @@ def build_create_update_sql_role_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1666,9 +1377,7 @@ def build_delete_sql_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1687,7 +1396,7 @@ def build_delete_sql_role_definition_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1704,9 +1413,7 @@ def build_list_sql_role_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1724,7 +1431,7 @@ def build_list_sql_role_definitions_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1741,9 +1448,7 @@ def build_get_sql_role_assignment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1762,7 +1467,7 @@ def build_get_sql_role_assignment_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1779,10 +1484,8 @@ def build_create_update_sql_role_assignment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1801,7 +1504,7 @@ def build_create_update_sql_role_assignment_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1820,9 +1523,7 @@ def build_delete_sql_role_assignment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1841,7 +1542,7 @@ def build_delete_sql_role_assignment_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1858,9 +1559,7 @@ def build_list_sql_role_assignments_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1878,7 +1577,7 @@ def build_list_sql_role_assignments_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1900,10 +1599,8 @@ def build_retrieve_continuous_backup_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1923,7 +1620,7 @@ def build_retrieve_continuous_backup_information_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1975,10 +1672,10 @@ def list_sql_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlDatabaseListResult] + ) + cls: ClsType[_models.SqlDatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2001,7 +1698,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2017,7 +1714,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2025,13 +1722,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SqlDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2044,7 +1741,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_sql_databases.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases"} # type: ignore + list_sql_databases.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases" + } @distributed_trace def get_sql_database( @@ -2076,10 +1775,10 @@ def get_sql_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlDatabaseGetResults] + ) + cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) request = build_get_sql_database_request( resource_group_name=resource_group_name, @@ -2092,9 +1791,9 @@ def get_sql_database( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2111,7 +1810,9 @@ def get_sql_database( return deserialized - get_sql_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + get_sql_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } def _create_update_sql_database_initial( self, @@ -2132,11 +1833,11 @@ def _create_update_sql_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlDatabaseGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlDatabaseGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2160,9 +1861,9 @@ def _create_update_sql_database_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2173,15 +1874,24 @@ def _create_update_sql_database_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlDatabaseGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + _create_update_sql_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } @overload def begin_create_update_sql_database( @@ -2305,16 +2015,16 @@ def begin_create_update_sql_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlDatabaseGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_database_initial( # type: ignore + raw_result = self._create_update_sql_database_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2335,7 +2045,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2347,9 +2057,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + begin_create_update_sql_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } def _delete_sql_database_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -2365,10 +2077,10 @@ def _delete_sql_database_initial( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_database_request( resource_group_name=resource_group_name, @@ -2381,9 +2093,9 @@ def _delete_sql_database_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2393,10 +2105,19 @@ def _delete_sql_database_initial( # pylint: disable=inconsistent-return-stateme map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_database_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + _delete_sql_database_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } @distributed_trace def begin_delete_sql_database( @@ -2426,13 +2147,13 @@ def begin_delete_sql_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_sql_database_initial( # type: ignore resource_group_name=resource_group_name, @@ -2451,7 +2172,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2463,9 +2184,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_database.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"} # type: ignore + begin_delete_sql_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" + } @distributed_trace def get_sql_database_throughput( @@ -2497,10 +2220,10 @@ def get_sql_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_sql_database_throughput_request( resource_group_name=resource_group_name, @@ -2513,9 +2236,9 @@ def get_sql_database_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2532,7 +2255,9 @@ def get_sql_database_throughput( return deserialized - get_sql_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default"} # type: ignore + get_sql_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + } def _update_sql_database_throughput_initial( self, @@ -2553,11 +2278,11 @@ def _update_sql_database_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2581,9 +2306,9 @@ def _update_sql_database_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2594,15 +2319,24 @@ def _update_sql_database_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_sql_database_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default"} # type: ignore + _update_sql_database_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + } @overload def begin_update_sql_database_throughput( @@ -2726,16 +2460,16 @@ def begin_update_sql_database_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_sql_database_throughput_initial( # type: ignore + raw_result = self._update_sql_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2756,7 +2490,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2768,9 +2502,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_sql_database_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default"} # type: ignore + begin_update_sql_database_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + } def _migrate_sql_database_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -2786,10 +2522,10 @@ def _migrate_sql_database_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_sql_database_to_autoscale_request( resource_group_name=resource_group_name, @@ -2802,9 +2538,9 @@ def _migrate_sql_database_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2815,15 +2551,24 @@ def _migrate_sql_database_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_sql_database_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_sql_database_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace def begin_migrate_sql_database_to_autoscale( @@ -2854,15 +2599,15 @@ def begin_migrate_sql_database_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_sql_database_to_autoscale_initial( # type: ignore + raw_result = self._migrate_sql_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2881,7 +2626,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2893,9 +2638,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_sql_database_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_sql_database_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale" + } def _migrate_sql_database_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -2911,10 +2658,10 @@ def _migrate_sql_database_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_sql_database_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -2927,9 +2674,9 @@ def _migrate_sql_database_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2940,15 +2687,24 @@ def _migrate_sql_database_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_sql_database_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_sql_database_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def begin_migrate_sql_database_to_manual_throughput( @@ -2979,15 +2735,15 @@ def begin_migrate_sql_database_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_sql_database_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_sql_database_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3006,7 +2762,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3018,15 +2774,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_sql_database_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_sql_database_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace - def list_client_encryption_keys( + def list_sql_containers( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.ClientEncryptionKeyGetResults"]: - """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. + ) -> Iterable["_models.SqlContainerGetResults"]: + """Lists the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3036,18 +2794,18 @@ def list_client_encryption_keys( :param database_name: Cosmos DB database name. Required. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of + :return: An iterator like instance of either SqlContainerGetResults or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientEncryptionKeysListResult] + ) + cls: ClsType[_models.SqlContainerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -3060,18 +2818,18 @@ def list_client_encryption_keys( def prepare_request(next_link=None): if not next_link: - request = build_list_client_encryption_keys_request( + request = build_list_sql_containers_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_client_encryption_keys.metadata["url"], + template_url=self.list_sql_containers.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -3087,21 +2845,21 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) + deserialized = self._deserialize("SqlContainerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -3114,18 +2872,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_client_encryption_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys"} # type: ignore + list_sql_containers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers" + } @distributed_trace - def get_client_encryption_key( - self, - resource_group_name: str, - account_name: str, - database_name: str, - client_encryption_key_name: str, - **kwargs: Any - ) -> _models.ClientEncryptionKeyGetResults: - """Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. + def get_sql_container( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> _models.SqlContainerGetResults: + """Gets the SQL container under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3134,11 +2889,11 @@ def get_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ClientEncryptionKeyGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults + :return: SqlContainerGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3152,26 +2907,26 @@ def get_client_encryption_key( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientEncryptionKeyGetResults] + ) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) - request = build_get_client_encryption_key_request( + request = build_get_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, + container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_client_encryption_key.metadata["url"], + template_url=self.get_sql_container.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3181,24 +2936,26 @@ def get_client_encryption_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_client_encryption_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + get_sql_container.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } - def _create_update_client_encryption_key_initial( + def _create_update_sql_container_initial( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], + container_name: str, + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.ClientEncryptionKeyGetResults]: + ) -> Optional[_models.SqlContainerGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3210,40 +2967,38 @@ def _create_update_client_encryption_key_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ClientEncryptionKeyGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlContainerGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_client_encryption_key_parameters, (IO, bytes)): - _content = create_update_client_encryption_key_parameters + if isinstance(create_update_sql_container_parameters, (IO, bytes)): + _content = create_update_sql_container_parameters else: - _json = self._serialize.body( - create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" - ) + _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") - request = build_create_update_client_encryption_key_request( + request = build_create_update_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, + container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_update_client_encryption_key_initial.metadata["url"], + template_url=self._create_update_sql_container_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3254,30 +3009,38 @@ def _create_update_client_encryption_key_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_client_encryption_key_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + _create_update_sql_container_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } @overload - def begin_create_update_client_encryption_key( + def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, + container_name: str, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ClientEncryptionKeyGetResults]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). + ) -> LROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3286,12 +3049,12 @@ def begin_create_update_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3303,27 +3066,25 @@ def begin_create_update_client_encryption_key( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_client_encryption_key( + def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO, + container_name: str, + create_update_sql_container_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ClientEncryptionKeyGetResults]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). + ) -> LROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3332,11 +3093,11 @@ def begin_create_update_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: IO + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -3348,25 +3109,23 @@ def begin_create_update_client_encryption_key( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_client_encryption_key( + def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], + container_name: str, + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], **kwargs: Any - ) -> LROPoller[_models.ClientEncryptionKeyGetResults]: - """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the - Azure Powershell (instead of directly). + ) -> LROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3375,12 +3134,12 @@ def begin_create_update_client_encryption_key( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Is either a model type or a IO type. Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Is either a model type or a IO type. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -3392,30 +3151,29 @@ def begin_create_update_client_encryption_key( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientEncryptionKeyGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_client_encryption_key_initial( # type: ignore + raw_result = self._create_update_sql_container_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - client_encryption_key_name=client_encryption_key_name, - create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, + container_name=container_name, + create_update_sql_container_parameters=create_update_sql_container_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3426,13 +3184,13 @@ def begin_create_update_client_encryption_key( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3444,15 +3202,74 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_update_sql_container.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } + + def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_sql_container_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_sql_container_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) - begin_create_update_client_encryption_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"} # type: ignore + _delete_sql_container_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } @distributed_trace - def list_sql_containers( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.SqlContainerGetResults"]: - """Lists the SQL container under an existing Azure Cosmos DB database account. + def begin_delete_sql_container( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3461,92 +3278,73 @@ def list_sql_containers( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlContainerGetResults or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlContainerListResult] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_sql_container_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_sql_containers_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_sql_containers.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SqlContainerListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) + return cls(pipeline_response, None, {}) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list_sql_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers"} # type: ignore + begin_delete_sql_container.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + } @distributed_trace - def get_sql_container( + def get_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> _models.SqlContainerGetResults: - """Gets the SQL container under an existing Azure Cosmos DB database account. + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database + account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3558,8 +3356,8 @@ def get_sql_container( :param container_name: Cosmos DB container name. Required. :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SqlContainerGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults + :return: ThroughputSettingsGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3573,26 +3371,26 @@ def get_sql_container( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlContainerGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - request = build_get_sql_container_request( + request = build_get_sql_container_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_sql_container.metadata["url"], + template_url=self.get_sql_container_throughput.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3602,24 +3400,26 @@ def get_sql_container( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sql_container.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + get_sql_container_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default" + } - def _create_update_sql_container_initial( + def _update_sql_container_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], + update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.SqlContainerGetResults]: + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3631,21 +3431,21 @@ def _create_update_sql_container_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlContainerGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_sql_container_parameters, (IO, bytes)): - _content = create_update_sql_container_parameters + if isinstance(update_throughput_parameters, (IO, bytes)): + _content = update_throughput_parameters else: - _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") + _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - request = build_create_update_sql_container_request( + request = build_update_sql_container_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3655,14 +3455,14 @@ def _create_update_sql_container_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_update_sql_container_initial.metadata["url"], + template_url=self._update_sql_container_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3673,29 +3473,38 @@ def _create_update_sql_container_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_container_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + _update_sql_container_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default" + } @overload - def begin_create_update_sql_container( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3706,10 +3515,10 @@ def begin_create_update_sql_container( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3721,25 +3530,25 @@ def begin_create_update_sql_container( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_container( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: IO, + update_throughput_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3750,9 +3559,9 @@ def begin_create_update_sql_container( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: IO + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -3764,23 +3573,23 @@ def begin_create_update_sql_container( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_container( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO], + update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3791,10 +3600,10 @@ def begin_create_update_sql_container( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Is either a model type or a IO type. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Is either a model type or a IO type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -3806,29 +3615,29 @@ def begin_create_update_sql_container( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlContainerGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_container_initial( # type: ignore + raw_result = self._update_sql_container_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - create_update_sql_container_parameters=create_update_sql_container_parameters, + update_throughput_parameters=update_throughput_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3839,13 +3648,13 @@ def begin_create_update_sql_container( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3857,13 +3666,15 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_container.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + begin_update_sql_container_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default" + } - def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statements + def _migrate_sql_container_to_autoscale_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> None: + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3875,45 +3686,60 @@ def _delete_sql_container_initial( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_delete_sql_container_request( + request = build_migrate_sql_container_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_sql_container_initial.metadata["url"], + template_url=self._migrate_sql_container_to_autoscale_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) - _delete_sql_container_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + return deserialized + + _migrate_sql_container_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace - def begin_delete_sql_container( + def begin_migrate_sql_container_to_autoscale( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL container. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3932,22 +3758,23 @@ def begin_delete_sql_container( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_sql_container_initial( # type: ignore + raw_result = self._migrate_sql_container_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3960,12 +3787,14 @@ def begin_delete_sql_container( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3977,19 +3806,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_container.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"} # type: ignore + begin_migrate_sql_container_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale" + } - def _list_sql_container_partition_merge_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionStorageInfoCollection]: + def _migrate_sql_container_to_manual_throughput_initial( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3998,41 +3823,29 @@ def _list_sql_container_partition_merge_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionStorageInfoCollection]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(merge_parameters, (IO, bytes)): - _content = merge_parameters - else: - _json = self._serialize.body(merge_parameters, "MergeParameters") + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) - request = build_list_sql_container_partition_merge_request( + request = build_migrate_sql_container_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._list_sql_container_partition_merge_initial.metadata["url"], + template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4043,113 +3856,30 @@ def _list_sql_container_partition_merge_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _list_sql_container_partition_merge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore - - @overload - def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: _models.MergeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a SQL Container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a SQL Container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param merge_parameters: The parameters for the merge operation. Required. - :type merge_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _migrate_sql_container_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace - def begin_list_sql_container_partition_merge( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - merge_parameters: Union[_models.MergeParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: - """Merges the partitions of a SQL Container. + def begin_migrate_sql_container_to_manual_throughput( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4160,12 +3890,6 @@ def begin_list_sql_container_partition_merge( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param merge_parameters: The parameters for the merge operation. Is either a model type or a IO - type. Required. - :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -4174,32 +3898,28 @@ def begin_list_sql_container_partition_merge( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionStorageInfoCollection or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] + :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionStorageInfoCollection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._list_sql_container_partition_merge_initial( # type: ignore + raw_result = self._migrate_sql_container_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - merge_parameters=merge_parameters, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -4208,15 +3928,13 @@ def begin_list_sql_container_partition_merge( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response) + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4228,16 +3946,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_list_sql_container_partition_merge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge"} # type: ignore + begin_migrate_sql_container_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace - def get_sql_container_throughput( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database - account. + def list_client_encryption_keys( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> Iterable["_models.ClientEncryptionKeyGetResults"]: + """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4246,71 +3965,20 @@ def get_sql_container_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ThroughputSettingsGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - - request = build_get_sql_container_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_sql_container_throughput.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs ) + cls: ClsType[_models.ClientEncryptionKeysListResult] = kwargs.pop("cls", None) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_sql_container_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - def _update_sql_container_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4319,1153 +3987,77 @@ def _update_sql_container_throughput_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_throughput_parameters, (IO, bytes)): - _content = update_throughput_parameters - else: - _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") - - request = build_update_sql_container_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_sql_container_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + def prepare_request(next_link=None): + if not next_link: - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) + request = build_list_client_encryption_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_client_encryption_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - response = pipeline_response.http_response + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + def extract_data(pipeline_response): + deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + def get_next(next_link=None): + request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, {}) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response - return deserialized + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - _update_sql_container_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore + return pipeline_response - @overload - def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + return ItemPaged(get_next, extract_data) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_sql_container_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Is either a model type or a IO type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_sql_container_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - update_throughput_parameters=update_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_sql_container_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"} # type: ignore - - def _migrate_sql_container_to_autoscale_initial( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_sql_container_to_autoscale_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_sql_container_to_autoscale_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_sql_container_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - @distributed_trace - def begin_migrate_sql_container_to_autoscale( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._migrate_sql_container_to_autoscale_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_sql_container_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale"} # type: ignore - - def _migrate_sql_container_to_manual_throughput_initial( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> Optional[_models.ThroughputSettingsGetResults]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] - - request = build_migrate_sql_container_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._migrate_sql_container_to_manual_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _migrate_sql_container_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - @distributed_trace - def begin_migrate_sql_container_to_manual_throughput( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._migrate_sql_container_to_manual_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_migrate_sql_container_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore - - def _sql_database_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_sql_database_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._sql_database_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _sql_database_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - def begin_sql_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL database. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_sql_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL database. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_sql_database_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL database. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._sql_database_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_sql_database_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - def _sql_database_redistribute_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters - else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - - request = build_sql_database_redistribute_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._sql_database_redistribute_throughput_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _sql_database_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - @overload - def begin_sql_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL database. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_sql_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL database. Required. - :type redistribute_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_sql_database_redistribute_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL database. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._sql_database_redistribute_throughput_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_sql_database_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput"} # type: ignore - - def _sql_container_retrieve_throughput_distribution_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], - **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(retrieve_throughput_parameters, (IO, bytes)): - _content = retrieve_throughput_parameters - else: - _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") - - request = build_sql_container_retrieve_throughput_distribution_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._sql_container_retrieve_throughput_distribution_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _sql_container_retrieve_throughput_distribution_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore - - @overload - def begin_sql_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - retrieve_throughput_parameters: _models.RetrieveThroughputParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_sql_container_retrieve_throughput_distribution( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - retrieve_throughput_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. Required. - :type retrieve_throughput_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + list_client_encryption_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys" + } @distributed_trace - def begin_sql_container_retrieve_throughput_distribution( + def get_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO], + client_encryption_key_name: str, **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + ) -> _models.ClientEncryptionKeyGetResults: + """Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5474,90 +4066,73 @@ def begin_sql_container_retrieve_throughput_distribution( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput - distribution for the current SQL container. Is either a model type or a IO type. Required. - :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :return: ClientEncryptionKeyGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._sql_container_retrieve_throughput_distribution_initial( # type: ignore - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - retrieve_throughput_parameters=retrieve_throughput_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + ) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + request = build_get_client_encryption_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + client_encryption_key_name=client_encryption_key_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_client_encryption_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized - begin_sql_container_retrieve_throughput_distribution.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution"} # type: ignore + get_client_encryption_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}" + } - def _sql_container_redistribute_throughput_initial( + def _create_update_client_encryption_key_initial( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], **kwargs: Any - ) -> Optional[_models.PhysicalPartitionThroughputInfoResult]: + ) -> Optional[_models.ClientEncryptionKeyGetResults]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5569,38 +4144,40 @@ def _sql_container_redistribute_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PhysicalPartitionThroughputInfoResult]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ClientEncryptionKeyGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(redistribute_throughput_parameters, (IO, bytes)): - _content = redistribute_throughput_parameters + if isinstance(create_update_client_encryption_key_parameters, (IO, bytes)): + _content = create_update_client_encryption_key_parameters else: - _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + _json = self._serialize.body( + create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" + ) - request = build_sql_container_redistribute_throughput_request( + request = build_create_update_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._sql_container_redistribute_throughput_initial.metadata["url"], + template_url=self._create_update_client_encryption_key_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5611,29 +4188,39 @@ def _sql_container_redistribute_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) + + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _sql_container_redistribute_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + _create_update_client_encryption_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}" + } @overload - def begin_sql_container_redistribute_throughput( + def begin_create_update_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.ClientEncryptionKeyGetResults]: + """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the + Azure Powershell (instead of directly). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5642,12 +4229,12 @@ def begin_sql_container_redistribute_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5659,26 +4246,27 @@ def begin_sql_container_redistribute_throughput( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) + :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_sql_container_redistribute_throughput( + def begin_create_update_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: IO, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.ClientEncryptionKeyGetResults]: + """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the + Azure Powershell (instead of directly). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5687,11 +4275,11 @@ def begin_sql_container_redistribute_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. Required. - :type redistribute_throughput_parameters: IO + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -5703,24 +4291,25 @@ def begin_sql_container_redistribute_throughput( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) + :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_sql_container_redistribute_throughput( + def begin_create_update_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[_models.ClientEncryptionKeyCreateUpdateParameters, IO], **kwargs: Any - ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: - """Redistribute throughput for an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.ClientEncryptionKeyGetResults]: + """Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the + Azure Powershell (instead of directly). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5729,12 +4318,12 @@ def begin_sql_container_redistribute_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param redistribute_throughput_parameters: The parameters to provide for redistributing - throughput for the current SQL container. Is either a model type or a IO type. Required. - :type redistribute_throughput_parameters: - ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Is either a model type or a IO type. Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -5746,30 +4335,30 @@ def begin_sql_container_redistribute_throughput( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or - the result of cls(response) + :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PhysicalPartitionThroughputInfoResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._sql_container_redistribute_throughput_initial( # type: ignore + raw_result = self._create_update_client_encryption_key_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - redistribute_throughput_parameters=redistribute_throughput_parameters, + client_encryption_key_name=client_encryption_key_name, + create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -5780,15 +4369,13 @@ def begin_sql_container_redistribute_throughput( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -5800,9 +4387,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_sql_container_redistribute_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput"} # type: ignore + begin_create_update_client_encryption_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}" + } @distributed_trace def list_sql_stored_procedures( @@ -5828,10 +4417,10 @@ def list_sql_stored_procedures( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlStoredProcedureListResult] + ) + cls: ClsType[_models.SqlStoredProcedureListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5856,7 +4445,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -5872,7 +4461,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -5880,13 +4469,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SqlStoredProcedureListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5899,7 +4488,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_sql_stored_procedures.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures"} # type: ignore + list_sql_stored_procedures.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures" + } @distributed_trace def get_sql_stored_procedure( @@ -5940,10 +4531,10 @@ def get_sql_stored_procedure( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlStoredProcedureGetResults] + ) + cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) request = build_get_sql_stored_procedure_request( resource_group_name=resource_group_name, @@ -5958,9 +4549,9 @@ def get_sql_stored_procedure( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5977,7 +4568,9 @@ def get_sql_stored_procedure( return deserialized - get_sql_stored_procedure.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + get_sql_stored_procedure.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } def _create_update_sql_stored_procedure_initial( self, @@ -6000,11 +4593,11 @@ def _create_update_sql_stored_procedure_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlStoredProcedureGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlStoredProcedureGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6032,9 +4625,9 @@ def _create_update_sql_stored_procedure_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6045,15 +4638,24 @@ def _create_update_sql_stored_procedure_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlStoredProcedureGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_stored_procedure_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + _create_update_sql_stored_procedure_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } @overload def begin_create_update_sql_stored_procedure( @@ -6195,16 +4797,16 @@ def begin_create_update_sql_stored_procedure( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlStoredProcedureGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_stored_procedure_initial( # type: ignore + raw_result = self._create_update_sql_stored_procedure_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -6227,7 +4829,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -6239,9 +4841,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_stored_procedure.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + begin_create_update_sql_stored_procedure.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent-return-statements self, @@ -6263,10 +4867,10 @@ def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent-return _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_stored_procedure_request( resource_group_name=resource_group_name, @@ -6281,9 +4885,9 @@ def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6293,10 +4897,19 @@ def _delete_sql_stored_procedure_initial( # pylint: disable=inconsistent-return map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_stored_procedure_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + _delete_sql_stored_procedure_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } @distributed_trace def begin_delete_sql_stored_procedure( @@ -6336,13 +4949,13 @@ def begin_delete_sql_stored_procedure( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_sql_stored_procedure_initial( # type: ignore resource_group_name=resource_group_name, @@ -6363,7 +4976,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -6375,9 +4988,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_stored_procedure.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"} # type: ignore + begin_delete_sql_stored_procedure.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" + } @distributed_trace def list_sql_user_defined_functions( @@ -6404,10 +5019,10 @@ def list_sql_user_defined_functions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlUserDefinedFunctionListResult] + ) + cls: ClsType[_models.SqlUserDefinedFunctionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -6432,7 +5047,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -6448,7 +5063,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -6456,13 +5071,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SqlUserDefinedFunctionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -6475,7 +5090,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_sql_user_defined_functions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions"} # type: ignore + list_sql_user_defined_functions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions" + } @distributed_trace def get_sql_user_defined_function( @@ -6516,10 +5133,10 @@ def get_sql_user_defined_function( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] + ) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) request = build_get_sql_user_defined_function_request( resource_group_name=resource_group_name, @@ -6534,9 +5151,9 @@ def get_sql_user_defined_function( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6553,7 +5170,9 @@ def get_sql_user_defined_function( return deserialized - get_sql_user_defined_function.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + get_sql_user_defined_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } def _create_update_sql_user_defined_function_initial( self, @@ -6578,11 +5197,11 @@ def _create_update_sql_user_defined_function_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlUserDefinedFunctionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlUserDefinedFunctionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6610,9 +5229,9 @@ def _create_update_sql_user_defined_function_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6623,15 +5242,24 @@ def _create_update_sql_user_defined_function_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlUserDefinedFunctionGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_user_defined_function_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + _create_update_sql_user_defined_function_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } @overload def begin_create_update_sql_user_defined_function( @@ -6778,16 +5406,16 @@ def begin_create_update_sql_user_defined_function( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlUserDefinedFunctionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_user_defined_function_initial( # type: ignore + raw_result = self._create_update_sql_user_defined_function_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -6810,7 +5438,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -6822,9 +5450,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_user_defined_function.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + begin_create_update_sql_user_defined_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } def _delete_sql_user_defined_function_initial( # pylint: disable=inconsistent-return-statements self, @@ -6846,10 +5476,10 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=inconsistent-r _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_user_defined_function_request( resource_group_name=resource_group_name, @@ -6864,9 +5494,9 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=inconsistent-r params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6876,10 +5506,19 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=inconsistent-r map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_user_defined_function_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + _delete_sql_user_defined_function_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } @distributed_trace def begin_delete_sql_user_defined_function( @@ -6919,13 +5558,13 @@ def begin_delete_sql_user_defined_function( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_sql_user_defined_function_initial( # type: ignore resource_group_name=resource_group_name, @@ -6946,7 +5585,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -6958,9 +5597,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_user_defined_function.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"} # type: ignore + begin_delete_sql_user_defined_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" + } @distributed_trace def list_sql_triggers( @@ -6986,10 +5627,10 @@ def list_sql_triggers( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlTriggerListResult] + ) + cls: ClsType[_models.SqlTriggerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -7014,7 +5655,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -7030,7 +5671,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -7038,13 +5679,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SqlTriggerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -7057,7 +5698,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_sql_triggers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers"} # type: ignore + list_sql_triggers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + } @distributed_trace def get_sql_trigger( @@ -7098,10 +5741,10 @@ def get_sql_trigger( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlTriggerGetResults] + ) + cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) request = build_get_sql_trigger_request( resource_group_name=resource_group_name, @@ -7116,9 +5759,9 @@ def get_sql_trigger( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -7135,7 +5778,9 @@ def get_sql_trigger( return deserialized - get_sql_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + get_sql_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } def _create_update_sql_trigger_initial( self, @@ -7158,11 +5803,11 @@ def _create_update_sql_trigger_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlTriggerGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlTriggerGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7188,9 +5833,9 @@ def _create_update_sql_trigger_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -7201,15 +5846,24 @@ def _create_update_sql_trigger_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SqlTriggerGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_sql_trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + _create_update_sql_trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } @overload def begin_create_update_sql_trigger( @@ -7351,16 +6005,16 @@ def begin_create_update_sql_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlTriggerGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_trigger_initial( # type: ignore + raw_result = self._create_update_sql_trigger_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -7383,7 +6037,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -7395,9 +6049,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + begin_create_update_sql_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-statements self, @@ -7419,10 +6075,10 @@ def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_trigger_request( resource_group_name=resource_group_name, @@ -7437,9 +6093,9 @@ def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -7449,10 +6105,19 @@ def _delete_sql_trigger_initial( # pylint: disable=inconsistent-return-statemen map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_sql_trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + _delete_sql_trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } @distributed_trace def begin_delete_sql_trigger( @@ -7492,13 +6157,13 @@ def begin_delete_sql_trigger( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_sql_trigger_initial( # type: ignore resource_group_name=resource_group_name, @@ -7519,7 +6184,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -7531,9 +6196,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"} # type: ignore + begin_delete_sql_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" + } @distributed_trace def get_sql_role_definition( @@ -7564,10 +6231,10 @@ def get_sql_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleDefinitionGetResults] + ) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) request = build_get_sql_role_definition_request( role_definition_id=role_definition_id, @@ -7580,9 +6247,9 @@ def get_sql_role_definition( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -7599,7 +6266,9 @@ def get_sql_role_definition( return deserialized - get_sql_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + get_sql_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } def _create_update_sql_role_definition_initial( self, @@ -7620,11 +6289,11 @@ def _create_update_sql_role_definition_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlRoleDefinitionGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlRoleDefinitionGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7650,9 +6319,9 @@ def _create_update_sql_role_definition_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -7671,7 +6340,9 @@ def _create_update_sql_role_definition_initial( return deserialized - _create_update_sql_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + _create_update_sql_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } @overload def begin_create_update_sql_role_definition( @@ -7795,16 +6466,16 @@ def begin_create_update_sql_role_definition( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleDefinitionGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_role_definition_initial( # type: ignore + raw_result = self._create_update_sql_role_definition_initial( role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, @@ -7825,7 +6496,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -7837,9 +6508,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + begin_create_update_sql_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-return-statements self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -7855,10 +6528,10 @@ def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-return- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_role_definition_request( role_definition_id=role_definition_id, @@ -7871,9 +6544,9 @@ def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-return- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -7886,7 +6559,9 @@ def _delete_sql_role_definition_initial( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) - _delete_sql_role_definition_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + _delete_sql_role_definition_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } @distributed_trace def begin_delete_sql_role_definition( @@ -7916,13 +6591,13 @@ def begin_delete_sql_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_sql_role_definition_initial( # type: ignore role_definition_id=role_definition_id, @@ -7941,7 +6616,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -7953,9 +6628,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_role_definition.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"} # type: ignore + begin_delete_sql_role_definition.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" + } @distributed_trace def list_sql_role_definitions( @@ -7977,10 +6654,10 @@ def list_sql_role_definitions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleDefinitionListResult] + ) + cls: ClsType[_models.SqlRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -8003,7 +6680,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -8019,7 +6696,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -8027,13 +6704,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SqlRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -8046,7 +6723,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_sql_role_definitions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions"} # type: ignore + list_sql_role_definitions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions" + } @distributed_trace def get_sql_role_assignment( @@ -8077,10 +6756,10 @@ def get_sql_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleAssignmentGetResults] + ) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = kwargs.pop("cls", None) request = build_get_sql_role_assignment_request( role_assignment_id=role_assignment_id, @@ -8093,9 +6772,9 @@ def get_sql_role_assignment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -8112,7 +6791,9 @@ def get_sql_role_assignment( return deserialized - get_sql_role_assignment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + get_sql_role_assignment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } def _create_update_sql_role_assignment_initial( self, @@ -8133,11 +6814,11 @@ def _create_update_sql_role_assignment_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SqlRoleAssignmentGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SqlRoleAssignmentGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8163,9 +6844,9 @@ def _create_update_sql_role_assignment_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -8184,7 +6865,9 @@ def _create_update_sql_role_assignment_initial( return deserialized - _create_update_sql_role_assignment_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + _create_update_sql_role_assignment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } @overload def begin_create_update_sql_role_assignment( @@ -8308,16 +6991,16 @@ def begin_create_update_sql_role_assignment( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleAssignmentGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_role_assignment_initial( # type: ignore + raw_result = self._create_update_sql_role_assignment_initial( role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, @@ -8338,7 +7021,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -8350,9 +7033,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_sql_role_assignment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + begin_create_update_sql_role_assignment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-return-statements self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any @@ -8368,10 +7053,10 @@ def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-return- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_sql_role_assignment_request( role_assignment_id=role_assignment_id, @@ -8384,9 +7069,9 @@ def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-return- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -8399,7 +7084,9 @@ def _delete_sql_role_assignment_initial( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) - _delete_sql_role_assignment_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + _delete_sql_role_assignment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } @distributed_trace def begin_delete_sql_role_assignment( @@ -8429,13 +7116,13 @@ def begin_delete_sql_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_sql_role_assignment_initial( # type: ignore role_assignment_id=role_assignment_id, @@ -8454,7 +7141,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -8466,9 +7153,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_sql_role_assignment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"} # type: ignore + begin_delete_sql_role_assignment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" + } @distributed_trace def list_sql_role_assignments( @@ -8490,10 +7179,10 @@ def list_sql_role_assignments( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SqlRoleAssignmentListResult] + ) + cls: ClsType[_models.SqlRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -8516,7 +7205,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -8532,7 +7221,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -8540,13 +7229,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SqlRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -8559,7 +7248,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_sql_role_assignments.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments"} # type: ignore + list_sql_role_assignments.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments" + } def _retrieve_continuous_backup_information_initial( self, @@ -8581,11 +7272,11 @@ def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8610,9 +7301,9 @@ def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -8631,7 +7322,9 @@ def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation" + } @overload def begin_retrieve_continuous_backup_information( @@ -8760,16 +7453,16 @@ def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -8791,9 +7484,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -8805,6 +7498,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_table_resources_operations.py index f6f4efd13987..ffd8545e48e9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_table_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_table_resources_operations.py @@ -49,9 +49,7 @@ def build_list_tables_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +67,7 @@ def build_list_tables_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,9 +84,7 @@ def build_get_table_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_get_table_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,10 +120,8 @@ def build_create_update_table_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +140,7 @@ def build_create_update_table_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,9 +158,7 @@ def build_delete_table_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -183,7 +175,7 @@ def build_delete_table_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,9 +189,7 @@ def build_get_table_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +208,7 @@ def build_get_table_throughput_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,10 +225,8 @@ def build_update_table_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +245,7 @@ def build_update_table_throughput_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,9 +264,7 @@ def build_migrate_table_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +283,7 @@ def build_migrate_table_to_autoscale_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,9 +300,7 @@ def build_migrate_table_to_manual_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,7 +319,7 @@ def build_migrate_table_to_manual_throughput_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -352,10 +336,8 @@ def build_retrieve_continuous_backup_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-15-preview") - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -374,7 +356,7 @@ def build_retrieve_continuous_backup_information_request( "tableName": _SERIALIZER.url("table_name", table_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -425,10 +407,10 @@ def list_tables( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TableListResult] + ) + cls: ClsType[_models.TableListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -451,7 +433,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -467,7 +449,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -475,13 +457,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TableListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -494,7 +476,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_tables.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables"} # type: ignore + list_tables.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables" + } @distributed_trace def get_table( @@ -525,10 +509,10 @@ def get_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TableGetResults] + ) + cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) request = build_get_table_request( resource_group_name=resource_group_name, @@ -541,9 +525,9 @@ def get_table( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -560,7 +544,9 @@ def get_table( return deserialized - get_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + get_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } def _create_update_table_initial( self, @@ -581,11 +567,11 @@ def _create_update_table_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.TableGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.TableGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -609,9 +595,9 @@ def _create_update_table_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -622,15 +608,24 @@ def _create_update_table_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("TableGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_update_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + _create_update_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } @overload def begin_create_update_table( @@ -753,16 +748,16 @@ def begin_create_update_table( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TableGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_table_initial( # type: ignore + raw_result = self._create_update_table_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -783,7 +778,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -795,9 +790,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_update_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + begin_create_update_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } def _delete_table_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any @@ -813,10 +810,10 @@ def _delete_table_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_table_request( resource_group_name=resource_group_name, @@ -829,9 +826,9 @@ def _delete_table_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -841,10 +838,19 @@ def _delete_table_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_table_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + _delete_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } @distributed_trace def begin_delete_table( @@ -874,13 +880,13 @@ def begin_delete_table( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_table_initial( # type: ignore resource_group_name=resource_group_name, @@ -899,7 +905,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -911,9 +917,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_table.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"} # type: ignore + begin_delete_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" + } @distributed_trace def get_table_throughput( @@ -945,10 +953,10 @@ def get_table_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) request = build_get_table_throughput_request( resource_group_name=resource_group_name, @@ -961,9 +969,9 @@ def get_table_throughput( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -980,7 +988,9 @@ def get_table_throughput( return deserialized - get_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default"} # type: ignore + get_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + } def _update_table_throughput_initial( self, @@ -1001,11 +1011,11 @@ def _update_table_throughput_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1029,9 +1039,9 @@ def _update_table_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1042,15 +1052,24 @@ def _update_table_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _update_table_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default"} # type: ignore + _update_table_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + } @overload def begin_update_table_throughput( @@ -1174,16 +1193,16 @@ def begin_update_table_throughput( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_table_throughput_initial( # type: ignore + raw_result = self._update_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -1204,7 +1223,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1216,9 +1235,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_table_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default"} # type: ignore + begin_update_table_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + } def _migrate_table_to_autoscale_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any @@ -1234,10 +1255,10 @@ def _migrate_table_to_autoscale_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_table_to_autoscale_request( resource_group_name=resource_group_name, @@ -1250,9 +1271,9 @@ def _migrate_table_to_autoscale_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1263,15 +1284,24 @@ def _migrate_table_to_autoscale_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_table_to_autoscale_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + _migrate_table_to_autoscale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } @distributed_trace def begin_migrate_table_to_autoscale( @@ -1302,15 +1332,15 @@ def begin_migrate_table_to_autoscale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_table_to_autoscale_initial( # type: ignore + raw_result = self._migrate_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -1329,7 +1359,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1341,9 +1371,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_table_to_autoscale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale"} # type: ignore + begin_migrate_table_to_autoscale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale" + } def _migrate_table_to_manual_throughput_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any @@ -1359,10 +1391,10 @@ def _migrate_table_to_manual_throughput_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ThroughputSettingsGetResults]] + ) + cls: ClsType[Optional[_models.ThroughputSettingsGetResults]] = kwargs.pop("cls", None) request = build_migrate_table_to_manual_throughput_request( resource_group_name=resource_group_name, @@ -1375,9 +1407,9 @@ def _migrate_table_to_manual_throughput_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1388,15 +1420,24 @@ def _migrate_table_to_manual_throughput_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response) + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _migrate_table_to_manual_throughput_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + _migrate_table_to_manual_throughput_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } @distributed_trace def begin_migrate_table_to_manual_throughput( @@ -1427,15 +1468,15 @@ def begin_migrate_table_to_manual_throughput( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ThroughputSettingsGetResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_table_to_manual_throughput_initial( # type: ignore + raw_result = self._migrate_table_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -1454,7 +1495,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1466,9 +1507,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_migrate_table_to_manual_throughput.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput"} # type: ignore + begin_migrate_table_to_manual_throughput.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput" + } def _retrieve_continuous_backup_information_initial( self, @@ -1489,11 +1532,11 @@ def _retrieve_continuous_backup_information_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupInformation]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupInformation]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1517,9 +1560,9 @@ def _retrieve_continuous_backup_information_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1538,7 +1581,9 @@ def _retrieve_continuous_backup_information_initial( return deserialized - _retrieve_continuous_backup_information_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore + _retrieve_continuous_backup_information_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation" + } @overload def begin_retrieve_continuous_backup_information( @@ -1658,16 +1703,16 @@ def begin_retrieve_continuous_backup_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-11-15"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-08-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupInformation] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._retrieve_continuous_backup_information_initial( # type: ignore + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, table_name=table_name, @@ -1688,9 +1733,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1702,6 +1747,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retrieve_continuous_backup_information.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation"} # type: ignore + begin_retrieve_continuous_backup_information.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py index 5049dc6363f6..a030f97e6a0a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py index 2c2faa10c25d..d797d4f45b2b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py index 48b49c509f5c..62c7f789d3c3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py index 1c60ac488cca..a1780ccf4fb5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py index 3fa579326f02..24daed48164f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py index edb565f49744..b743e0cbc81e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py index 9b433fd6972e..750b85651e79 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py index 66c4b4cebfe6..2b45450c103c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py index 487261df8fa6..4a9946cec95a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py @@ -39,7 +39,6 @@ def main(): "properties": { "options": {}, "resource": { - "analyticalStorageTtl": 500, "defaultTtl": 100, "id": "tableName", "schema": { @@ -55,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py index 2179c35b1715..fa718687eb2a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py index 23e8929a25a1..14c52ed53753 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py index 593ad835a554..515f125cf6e5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py index 130d8dcea114..644625becaa6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py index d1b01ad4b179..1a93214a1993 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py index 1efabd83fb8a..4738fce5891d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py index f8d064398e8f..4f3c3876095a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraTableThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCassandraTableThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py index b8c2185375cc..a53317820e35 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCollectionGetMetricDefinitions.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCollectionGetMetricDefinitions.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py index 6edcc8c2d283..1cadd9d21129 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCollectionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCollectionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py index 89c3da2709e8..b83b0e3e1dcd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCollectionGetUsages.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCollectionGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_metrics.py new file mode 100644 index 000000000000..5c52246a1227 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_metrics.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_collection_partition_get_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.collection_partition.list_metrics( + resource_group_name="rg1", + account_name="ddb1", + database_rid="databaseRid", + collection_rid="collectionRid", + filter="$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCollectionPartitionGetMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_feed.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_usages.py similarity index 83% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_feed.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_usages.py index 2a362aa11fa2..731029d3f6a9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_feed.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_usages.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_data_transfer_job_feed.py + python cosmos_db_collection_partition_get_usages.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,14 +29,16 @@ def main(): subscription_id="subid", ) - response = client.data_transfer_jobs.list_by_database_account( + response = client.collection_partition.list_usages( resource_group_name="rg1", account_name="ddb1", + database_rid="databaseRid", + collection_rid="collectionRid", ) for item in response: print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobFeed.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCollectionPartitionGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_region_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_region_get_metrics.py new file mode 100644 index 000000000000..74963ad40506 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_region_get_metrics.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_collection_partition_region_get_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.collection_partition_region.list_metrics( + resource_group_name="rg1", + account_name="ddb1", + region="North Europe", + database_rid="databaseRid", + collection_rid="collectionRid", + filter="$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBCollectionPartitionRegionGetMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_create.py similarity index 92% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_create.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_create.py index ec9473f00721..06e9ad385162 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python data_transfer_service_create.py + python cosmos_db_data_transfer_service_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDataTransferServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDataTransferServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_delete.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_delete.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_delete.py index 1d0c93cc79b0..43ca9aecf947 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python data_transfer_service_delete.py + python cosmos_db_data_transfer_service_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDataTransferServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDataTransferServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_get.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_get.py index 9effb49d7e09..ced69e3aab9d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/data_transfer_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python data_transfer_service_get.py + python cosmos_db_data_transfer_service_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDataTransferServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDataTransferServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py index bbb34e785a12..2861806e5497 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountCheckNameExists.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountCheckNameExists.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py index 0199e0d3c613..6b86db827c48 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py @@ -64,7 +64,6 @@ def main(): "defaultIdentity": "FirstPartyIdentity", "enableAnalyticalStorage": True, "enableFreeTier": False, - "enableMaterializedViews": False, "ipRules": [{"ipAddressOrRange": "23.43.230.120"}, {"ipAddressOrRange": "110.12.240.0/12"}], "isVirtualNetworkFilterEnabled": True, "keyVaultKeyUri": "https://myKeyVault.vault.azure.net", @@ -72,6 +71,7 @@ def main(): {"failoverPriority": 0, "isZoneRedundant": False, "locationName": "southcentralus"}, {"failoverPriority": 1, "isZoneRedundant": False, "locationName": "eastus"}, ], + "minimalTlsVersion": "Tls12", "networkAclBypass": "AzureServices", "networkAclBypassResourceIds": [ "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName" @@ -90,6 +90,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountCreateMax.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountCreateMax.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py index c229ddce40ff..79b60848e5cb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountCreateMin.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountCreateMin.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py index b27514d38133..454db1f76889 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py index 9a30100a86ed..099312dfa737 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py index 766936972666..bc4c9afea2b3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py index a438667d24ca..d6fde45e1cd3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py index 87f5d4daa216..c0daa67ec491 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py index a9de499c33c5..13a859e3f05f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountGetUsages.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py index b93a111c66ac..c937202fd29d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py index 449cc788063f..6332ed56d938 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountListByResourceGroup.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py index 6909bb5b54e8..9413d9ca65c5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountListConnectionStrings.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountListConnectionStrings.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py index 9e4bfa630500..054e4a9f5ee9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py index 626a31cbf760..0cf7fe688af1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountListKeys.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountListKeys.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py index 10f830dfd54f..c5f1afc50cad 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py index 3cb270a8fb77..9064ed8a51c3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountOfflineRegion.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountOfflineRegion.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py index 173357ccd562..c55930159fca 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountOnlineRegion.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountOnlineRegion.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py index 66797a3621f3..9f5347a19f5f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py @@ -46,7 +46,7 @@ def main(): "periodicModeProperties": { "backupIntervalInMinutes": 240, "backupRetentionIntervalInHours": 720, - "backupStorageRedundancy": "Geo", + "backupStorageRedundancy": "Local", }, "type": "Periodic", }, @@ -57,12 +57,12 @@ def main(): "maxStalenessPrefix": 200, }, "defaultIdentity": "FirstPartyIdentity", - "diagnosticLogSettings": {"enableFullTextQuery": "True"}, "enableAnalyticalStorage": True, "enableFreeTier": False, "enablePartitionMerge": True, "ipRules": [{"ipAddressOrRange": "23.43.230.120"}, {"ipAddressOrRange": "110.12.240.0/12"}], "isVirtualNetworkFilterEnabled": True, + "minimalTlsVersion": "Tls", "networkAclBypass": "AzureServices", "networkAclBypassResourceIds": [ "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName" @@ -80,6 +80,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountPatch.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountPatch.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py index 0ed9ce68f280..414fe0f339fd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountRegenerateKey.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountRegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py index b4516d6827a2..2c0ac74e3603 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseAccountRegionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseAccountRegionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py index 025e20a7d40f..fc04e34f8c14 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseGetMetricDefinitions.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseGetMetricDefinitions.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py index 756a8b660f23..0f2f28eabb34 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py index 21a726ea3444..d5fc469d027d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBDatabaseGetUsages.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBDatabaseGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_create.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_create.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_create.py index c3565bf74065..b95dd5241814 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python graph_api_compute_service_create.py + python cosmos_db_graph_api_compute_service_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGraphAPIComputeServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_delete.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_delete.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_delete.py index 804281a9e8a1..6a109e4a8152 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python graph_api_compute_service_delete.py + python cosmos_db_graph_api_compute_service_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGraphAPIComputeServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGraphAPIComputeServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_get.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_get.py index db1974971dd1..254b6ca91346 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/graph_api_compute_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python graph_api_compute_service_get.py + python cosmos_db_graph_api_compute_service_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGraphAPIComputeServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py index bdf3168cb97e..17dea86af832 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py index d28bb6381127..92e18922829c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py index 26d04a11c6c8..9180b486a939 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py index 0204ce3c1ab7..2ee6384fac35 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py index 6ff6e198c1fd..0095588d9679 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py index 4b48eb4fd42b..4e25265a0e9c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py index 5f0e92e8e35d..df2dbb22cc1b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py index c00e7005f43a..fb17684cac7f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinDatabaseThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinDatabaseThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py index 4b626cb008d7..cd23208ee7c1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py index e8718bad43b6..8faccdc9b4ae 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py @@ -66,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py index 128d58de9cf6..1e252fb8b953 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py index 00bb5ae50678..4cbc6474283e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py index 3f58f1b55d2d..fadb93a6a67d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py index 0487c91b2841..42c78217b12a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py index cddf819e1cd4..2df5264bb6ed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py index 1af1cfa6f8f6..04e2b8777d1c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py index e9ea71f596aa..92956dc06499 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGremlinGraphThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBGremlinGraphThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py index 5c98b01059cd..2fe3193be844 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBLocationGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBLocationGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py index c04a6b03802a..77648099f2f9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBLocationList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBLocationList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py index 881d5f2d6f81..c09202363ad7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py index 23cb98825a38..087841432367 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterDeallocate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterDeallocate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py index 28437f0febd0..ffb605434e51 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_clusters.begin_delete( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py index 57541a09e5f8..aca86765abd3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_clusters.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py index 8bb3e83c7b23..2620084c1422 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_clusters.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py index c71680887cb9..bf500fce5e69 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_clusters.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterListBySubscription.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py index ae13aef18625..5ebf4eb6e3b9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterPatch.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterPatch.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py index 22d715993866..823544da12a0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.cassandra_clusters.begin_start( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraClusterStart.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraClusterStart.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py index 577cb1d36442..856cce1bb409 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py @@ -26,17 +26,17 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.cassandra_clusters.begin_invoke_command( resource_group_name="cassandra-prod-rg", cluster_name="cassandra-prod", - body={"arguments": {"status": ""}, "command": "nodetool", "host": "10.0.1.12"}, + body={"command": "nodetool status", "host": "10.0.1.12"}, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraCommand.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraCommand.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py index 541216f03ee8..1eab7e0f03d5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_data_centers.begin_create_update( @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraDataCenterCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraDataCenterCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py index 717401028c2d..565f00ea9a55 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_data_centers.begin_delete( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraDataCenterDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraDataCenterDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py index c0af16e556fb..78959994d939 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_data_centers.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraDataCenterGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py index cc2be45795f4..36a0572cf95c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py @@ -26,7 +26,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_data_centers.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraDataCenterList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraDataCenterList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_patch.py similarity index 92% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_update.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_patch.py index d75c7881eacb..a5a77f837df5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_patch.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_managed_cassandra_data_center_update.py + python cosmos_db_managed_cassandra_data_center_patch.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraDataCenterPatch.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraDataCenterPatch.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py index 9dc83208769f..a21313e786e4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraStatus.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBManagedCassandraStatus.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_create.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_create.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_create.py index 142418d13f45..a638d0362299 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python materialized_views_builder_service_create.py + python cosmos_db_materialized_views_builder_service_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_delete.py similarity index 89% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_delete.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_delete.py index 90c2982b5477..4f23a6bc72a3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python materialized_views_builder_service_delete.py + python cosmos_db_materialized_views_builder_service_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMaterializedViewsBuilderServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_get.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_get.py index ca0edbf69722..fc6cf82ef6f2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/materialized_views_builder_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python materialized_views_builder_service_get.py + python cosmos_db_materialized_views_builder_service_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMaterializedViewsBuilderServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py index fdc10625f5d0..2042a1af6dc8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py index 3ec2c6f32522..ff6ef8ebb005 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py index 714d9ee57d40..56441e573800 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py index 6a284eb791c9..ca719b010a8e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py index 4c851a29e82e..07147b416e17 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py index b5dbc816b495..2e8725c7e37c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py index 6be2e7b416a8..8f3916d0a787 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py index 665bd1799453..36ad1b06e709 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBCollectionThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py index 648baf9d53a3..fec41d2432a7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBDatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py index 6592b3271f39..0f1a080eadbe 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBDatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py index 9b649bb126b0..73cff0f8f01e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py index a82f6959a837..a2ad647bd535 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py index b6d504fac13e..b39628c737e8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_redistribute_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_redistribute_throughput.py deleted file mode 100644 index 5ec7e2cc9179..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_redistribute_throughput.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-cosmosdb -# USAGE - python cosmos_db_mongo_db_database_redistribute_throughput.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = CosmosDBManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.mongo_db_resources.begin_mongo_db_database_redistribute_throughput( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - redistribute_throughput_parameters={ - "properties": { - "resource": { - "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], - "targetPhysicalPartitionThroughputInfo": [ - {"id": "0", "throughput": 5000}, - {"id": "1", "throughput": 5000}, - ], - "throughputPolicy": "custom", - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseRedistributeThroughput.json -if __name__ == "__main__": - main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py index bcdecc7e9c2b..34e594808b5d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBDatabaseThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py index d1cd4235dd24..4d36be622200 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py index 2c827e1157c9..26d7fc41a6b9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py index d1cd956896f3..214f00ff65c4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBRoleDefinitionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_get.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_role_definition_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_get.py index 7d3e03a7b38c..c9c196cb5015 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_mongo_role_definition_get.py + python cosmos_db_mongo_db_role_definition_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py index c3c46817b496..089cf5d91019 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBRoleDefinitionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBRoleDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py index 7594fbc390f3..7ad7393804db 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py index 6c908b48c04c..c8d43943b40e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBUserDefinitionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBUserDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py index fc42a5dc3052..a53d8feeb00b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBUserDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py index e15a54d77527..2677ac127a94 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBUserDefinitionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBMongoDBUserDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py index a8eaa4395b70..26c96e73ad7b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBNotebookWorkspaceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBNotebookWorkspaceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py index 091289c0221f..cf45683e4385 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBNotebookWorkspaceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBNotebookWorkspaceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py index 5b619fcaa06e..48d5e89595fa 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBNotebookWorkspaceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBNotebookWorkspaceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py index a47185013597..f8c48738532e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py index 46037ff47d46..4f80a96b8d88 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py index a98801a32b86..9e3cf96a2515 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBNotebookWorkspaceStart.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBNotebookWorkspaceStart.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py index 2898c2a5aa17..e002520f2503 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBOperationsList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBOperationsList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_get_metrics.py similarity index 76% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_get_metrics.py index 25aab6119622..023a83dba5b6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_get_metrics.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_cassandra_view_get.py + python cosmos_db_percentile_get_metrics.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,15 +29,15 @@ def main(): subscription_id="subid", ) - response = client.cassandra_resources.get_cassandra_view( + response = client.percentile.list_metrics( resource_group_name="rg1", account_name="ddb1", - keyspace_name="keyspacename", - view_name="viewname", + filter="$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", ) - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPercentileGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_source_target_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_source_target_get_metrics.py new file mode 100644 index 000000000000..9d5f375dcc69 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_source_target_get_metrics.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_percentile_source_target_get_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.percentile_source_target.list_metrics( + resource_group_name="rg1", + account_name="ddb1", + source_region="West Central US", + target_region="East US", + filter="$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPercentileSourceTargetGetMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_target_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_target_get_metrics.py new file mode 100644 index 000000000000..d88da31003f7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_target_get_metrics.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_percentile_target_get_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.percentile_target.list_metrics( + resource_group_name="rg1", + account_name="ddb1", + target_region="East US", + filter="$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPercentileTargetGetMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/deletes_a_private_endpoint_connection_with_a_given_name..py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_delete.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/deletes_a_private_endpoint_connection_with_a_given_name..py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_delete.py index 6449b6a607fa..4b50329ed0e2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/deletes_a_private_endpoint_connection_with_a_given_name..py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python deletes_a_private_endpoint_connection_with_a_given_name..py + python cosmos_db_private_endpoint_connection_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBPrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPrivateEndpointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_get.py similarity index 79% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_get.py index 29387d15f5d5..005cb50be1bd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_cassandra_view_throughput_get.py + python cosmos_db_private_endpoint_connection_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,18 +26,17 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.cassandra_resources.get_cassandra_view_throughput( + response = client.private_endpoint_connections.get( resource_group_name="rg1", account_name="ddb1", - keyspace_name="keyspacename", - view_name="viewname", + private_endpoint_connection_name="privateEndpointConnectionName", ) print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPrivateEndpointConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/gets_private_endpoint_connection..py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_list_get.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/gets_private_endpoint_connection..py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_list_get.py index 25833f8e030a..9c8f1ef0238b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/gets_private_endpoint_connection..py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_list_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python gets_private_endpoint_connection..py + python cosmos_db_private_endpoint_connection_list_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBPrivateEndpointConnectionListGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPrivateEndpointConnectionListGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/approve_or_reject_a_private_endpoint_connection_with_a_given_name..py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_update.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/approve_or_reject_a_private_endpoint_connection_with_a_given_name..py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_update.py index 7e91c1b11e3d..faf46a050250 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/approve_or_reject_a_private_endpoint_connection_with_a_given_name..py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python approve_or_reject_a_private_endpoint_connection_with_a_given_name..py + python cosmos_db_private_endpoint_connection_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPrivateEndpointConnectionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_pause.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_get.py similarity index 83% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_pause.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_get.py index ee65fc402d52..3c584051b710 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_pause.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_data_transfer_job_pause.py + python cosmos_db_private_link_resource_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,17 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.data_transfer_jobs.pause( + response = client.private_link_resources.get( resource_group_name="rg1", account_name="ddb1", - job_name="j1", + group_name="sql", ) print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobPause.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_list_get.py similarity index 80% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_list.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_list_get.py index 3958bb04cb03..93402ffa2811 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_list_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_cassandra_view_list.py + python cosmos_db_private_link_resource_list_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,18 +26,17 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.cassandra_resources.list_cassandra_views( - resource_group_name="rgName", + response = client.private_link_resources.list_by_database_account( + resource_group_name="rg1", account_name="ddb1", - keyspace_name="keyspacename", ) for item in response: print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPrivateLinkResourceListGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py index 64cff2846fc9..438978df94be 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py @@ -41,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRegionCollectionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRegionCollectionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py index c8717b1563a0..76c7f21435f5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableDatabaseAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py index dcda84e1aa87..247a1affe0e3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableDatabaseAccountList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableDatabaseAccountList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py index b168e54dfa16..a7aee9b23e7a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py index b3d4269723b3..3b867b127c3b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableGremlinDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableGremlinDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py index cd4c82d3d0bf..b232b282e08d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableGremlinGraphList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableGremlinGraphList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py index ca331435d932..fa4ce412dbe2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableGremlinResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableGremlinResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py index 8d1834f2288b..f0685c178d30 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableMongodbCollectionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableMongodbCollectionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py index 83af80146ddb..51696fc50ff1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableMongodbDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableMongodbDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py index 1c067d3bd3bb..8297035ab867 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableMongodbResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableMongodbResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py index 53acc41a5cb9..951a0c0d4714 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableSqlContainerList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableSqlContainerList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py index 46fb5dbe27ef..5126627ca92b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableSqlDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableSqlDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py index 1a9a16b7b498..b7847b20d862 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableSqlResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableSqlResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py index 5efcfd312739..cc28b318d057 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableTableList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableTableList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py index ecd7570485ad..1d512f75914d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestorableTableResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestorableTableResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.json.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.py similarity index 89% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.json.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.py index 1d23fffaac60..120548a260c1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.json.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_restore_database_account_create_update.json.py + python cosmos_db_restore_database_account_create_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,7 +37,7 @@ def main(): "location": "westus", "properties": { "apiProperties": {"serverVersion": "3.2"}, - "backupPolicy": {"continuousModeProperties": {"tier": "Continuous30Days"}, "type": "Continuous"}, + "backupPolicy": {"type": "Continuous"}, "consistencyPolicy": { "defaultConsistencyLevel": "BoundedStaleness", "maxIntervalInSeconds": 10, @@ -47,9 +47,9 @@ def main(): "databaseAccountOfferType": "Standard", "enableAnalyticalStorage": True, "enableFreeTier": False, - "enableMaterializedViews": False, "keyVaultKeyUri": "https://myKeyVault.vault.azure.net", "locations": [{"failoverPriority": 0, "isZoneRedundant": False, "locationName": "southcentralus"}], + "minimalTlsVersion": "Tls", "restoreParameters": { "databasesToRestore": [ {"collectionNames": ["collection1", "collection2"], "databaseName": "db1"}, @@ -66,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py index f6c4ce325a05..d7374e614f9a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBServicesList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBServicesList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_key_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_create_update.py similarity index 86% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_key_create_update.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_create_update.py index ed0095e21141..40b0ec225048 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_key_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_create_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_client_encryption_key_create_update.py + python cosmos_db_sql_client_encryption_key_create_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -45,7 +45,7 @@ def main(): "type": "AzureKeyVault", "value": "AzureKeyVault Key URL", }, - "wrappedDataEncryptionKey": "This is actually an array of bytes. This request/response is being presented as a string for readability in the example", + "wrappedDataEncryptionKey": "U3dhZ2dlciByb2Nrcw==", } } }, @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_key_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_get.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_key_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_get.py index 214a3698462e..c297b02cc819 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_key_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_client_encryption_key_get.py + python cosmos_db_sql_client_encryption_key_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlClientEncryptionKeyGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_keys_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_keys_list.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_keys_list.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_keys_list.py index 3797a7474be0..c6333cb7ee72 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_client_encryption_keys_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_keys_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_client_encryption_keys_list.py + python cosmos_db_sql_client_encryption_keys_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlClientEncryptionKeysList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlClientEncryptionKeysList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py index e3b259b6092a..ab9de6de2846 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py index 933ad6cbe8c7..22d39616270b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py @@ -47,7 +47,8 @@ def main(): "encryptionType": "Deterministic", "path": "/path", } - ] + ], + "policyFormatVersion": 2, }, "conflictResolutionPolicy": {"conflictResolutionPath": "/path", "mode": "LastWriterWins"}, "defaultTtl": 100, @@ -76,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py index bd49c792b268..93baf6c126e4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py index 50edc08d2c6d..1d88180fe05b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py index 6965f91c95b8..33a7f4bd9fb7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py index 83356d1e26c8..896f3061c881 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py index 3e8ed45524df..e132441ae32c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_redistribute_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_redistribute_throughput.py deleted file mode 100644 index 6ab57e1b75b0..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_redistribute_throughput.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-cosmosdb -# USAGE - python cosmos_db_sql_container_redistribute_throughput.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = CosmosDBManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.sql_resources.begin_sql_container_redistribute_throughput( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - container_name="containerName", - redistribute_throughput_parameters={ - "properties": { - "resource": { - "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], - "targetPhysicalPartitionThroughputInfo": [ - {"id": "0", "throughput": 5000}, - {"id": "1", "throughput": 5000}, - ], - "throughputPolicy": "custom", - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerRedistributeThroughput.json -if __name__ == "__main__": - main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py deleted file mode 100644 index fb9454996829..000000000000 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-cosmosdb -# USAGE - python cosmos_db_sql_container_restore.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = CosmosDBManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.sql_resources.begin_create_update_sql_container( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - container_name="containerName", - create_update_sql_container_parameters={ - "location": "West US", - "properties": { - "options": {}, - "resource": { - "createMode": "Restore", - "id": "containerName", - "restoreParameters": { - "restoreSource": "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", - "restoreTimestampInUtc": "2022-07-20T18:28:00Z", - }, - }, - }, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerRestore.json -if __name__ == "__main__": - main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py index f6e9e446e6b4..1bcb597bb537 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py index 2d348c3dd303..ca8331a56b05 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlContainerThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py index 7fbd64d31c49..4b6e031394b7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py index c07825ee2405..d47cf7c9c3f3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py @@ -29,14 +29,14 @@ def main(): subscription_id="subid", ) - response = client.graph_resources.begin_delete_graph_resource( + response = client.sql_resources.begin_delete_sql_database( resource_group_name="rg1", account_name="ddb1", - graph_name="graphName", + database_name="databaseName", ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGraphResourceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py index f97c2b8f16b4..63ec0941da9b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py @@ -29,14 +29,14 @@ def main(): subscription_id="subid", ) - response = client.graph_resources.get_graph( + response = client.sql_resources.get_sql_database( resource_group_name="rg1", account_name="ddb1", - graph_name="graphName", + database_name="databaseName", ) print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGraphResourceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py index 8d282d994847..f995f24d72d8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.graph_resources.list_graphs( + response = client.sql_resources.list_sql_databases( resource_group_name="rgName", account_name="ddb1", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGraphResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py index ce97d4f7fce7..aab37057d15b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py index 0cb09511e9a9..071990a08e2e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py index de5d752b434f..691fd11b98ee 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py index b7fec03f48fb..9a0dc97bf069 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDatabaseThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_create.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_create.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_create.py index c84ac27f8fec..11b06a792bcd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python sql_dedicated_gateway_service_create.py + python cosmos_db_sql_dedicated_gateway_service_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_delete.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_delete.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_delete.py index 402f5d9e452a..d8fac3feb907 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python sql_dedicated_gateway_service_delete.py + python cosmos_db_sql_dedicated_gateway_service_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_get.py similarity index 90% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_get.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_get.py index 6fe8b6e12f94..896c00591f58 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/sql_dedicated_gateway_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python sql_dedicated_gateway_service_get.py + python cosmos_db_sql_dedicated_gateway_service_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlDedicatedGatewayServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py index 2ee81090c20d..88c5e5bdcb3c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py index d2c7c1e3dad5..2eb9b8709403 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleAssignmentDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleAssignmentDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py index 1937a5ae8e67..fa469420dba3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleAssignmentGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py index be07b3f4517d..e8d5b77e0cd9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleAssignmentList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleAssignmentList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py index 819d0dd174e5..2f10ee7cdf92 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py index 2b6acbd0e1af..a46b0ee95134 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleDefinitionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py index 9b240ad3c8c2..cdf0cee6d25a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py index bee9e0444493..288cb35a75ea 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlRoleDefinitionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlRoleDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py index 0b40a12acd10..32da43b3174a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlStoredProcedureCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py index ef32462a697c..9e0646d23c08 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlStoredProcedureDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlStoredProcedureDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py index e060a1fad014..af11c0dee97b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlStoredProcedureGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlStoredProcedureGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py index 8877befe879d..99f2759134b5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlStoredProcedureList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlStoredProcedureList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py index fbf745c3d79b..d7ffedf4b5d5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlTriggerCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlTriggerCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py index e369f99a62cb..16e689d62143 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlTriggerDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlTriggerDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py index 1656e9353a79..172fd140d3f2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlTriggerGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlTriggerGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py index 8fbacc07d4a3..0b72fd41c38c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlTriggerList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlTriggerList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py index a19e1b51b097..57ad38598ab1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py index 138d5e1fe71c..9b59caffb870 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlUserDefinedFunctionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlUserDefinedFunctionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py index 44e8b3ca453a..f9dbf7c7427a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlUserDefinedFunctionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py index 7cfb10330069..4d4fdda982de 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlUserDefinedFunctionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBSqlUserDefinedFunctionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_collection_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_backup_information.py similarity index 91% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_collection_backup_information.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_backup_information.py index a6ed8773ba78..80f91ebd2b64 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_collection_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_backup_information.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_table_collection_backup_information.py + python cosmos_db_table_backup_information.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_replace.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_create_update.py similarity index 93% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_replace.py rename to sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_create_update.py index 5f409dea1b25..a8acc7f711c6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_replace.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_create_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE - python cosmos_db_table_replace.py + python cosmos_db_table_create_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py index 5f536f7447bd..7fc6da635d9d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py index ffc1a2ec8e4c..bb5becc6a744 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py index 54dfc2742582..ad1fbea8e97a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py index 5f32d06ff0af..76a211ac0fdf 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py index 6c6a2e352e70..889c1b6a579b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py index ef5cfd067f46..f29e7843b800 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py index b6b171903299..7d6b1fab918f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBTableThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBTableThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_get_metrics.py new file mode 100644 index 000000000000..18d06cdf0281 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_get_metrics.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_dbp_key_range_id_get_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.partition_key_range_id.list_metrics( + resource_group_name="rg1", + account_name="ddb1", + database_rid="databaseRid", + collection_rid="collectionRid", + partition_key_range_id="0", + filter="$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPKeyRangeIdGetMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_region_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_region_get_metrics.py new file mode 100644 index 000000000000..d4597c43c527 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_region_get_metrics.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_dbp_key_range_id_region_get_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.partition_key_range_id_region.list_metrics( + resource_group_name="rg1", + account_name="ddb1", + region="West US", + database_rid="databaseRid", + collection_rid="collectionRid", + partition_key_range_id="0", + filter="$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-11-15/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/setup.py b/sdk/cosmos/azure-mgmt-cosmosdb/setup.py index 16c6bd37e389..47c90e4de163 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/setup.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, diff --git a/sdk/datalake/azure-mgmt-datalake-store/CHANGELOG.md b/sdk/datalake/azure-mgmt-datalake-store/CHANGELOG.md index 1aecf5116a6f..60f16e20aec2 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/CHANGELOG.md +++ b/sdk/datalake/azure-mgmt-datalake-store/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.1.0b1 (2023-02-16) + +### Features Added + + - Added model CheckNameAvailabilityParametersType + ## 1.0.0 (2020-12-21) **Breaking changes** diff --git a/sdk/datalake/azure-mgmt-datalake-store/MANIFEST.in b/sdk/datalake/azure-mgmt-datalake-store/MANIFEST.in index 619c2afce242..9f4c95472061 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/MANIFEST.in +++ b/sdk/datalake/azure-mgmt-datalake-store/MANIFEST.in @@ -1,5 +1,6 @@ include _meta.json recursive-include tests *.py *.json +recursive-include samples *.py *.md include *.md include azure/__init__.py include azure/mgmt/__init__.py diff --git a/sdk/datalake/azure-mgmt-datalake-store/README.md b/sdk/datalake/azure-mgmt-datalake-store/README.md index 16e3c05eeec3..1b12170fd9db 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/README.md +++ b/sdk/datalake/azure-mgmt-datalake-store/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/data-lake-store) -Code samples for this package can be found at [Data Lake Store Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/datalakestore) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-datalake-store +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = DataLakeStoreAccountManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Data Lake Store Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/datalake/azure-mgmt-datalake-store/_meta.json b/sdk/datalake/azure-mgmt-datalake-store/_meta.json new file mode 100644 index 000000000000..72cfbe386afb --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b64c34315bed61363cd4032f1bff1a0b246da490", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", + "use": [ + "@autorest/python@6.4.0", + "@autorest/modelerfour@4.24.3" + ], + "autorest_command": "autorest specification/datalake-store/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "readme": "specification/datalake-store/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/__init__.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/__init__.py index 37a96e4b89ff..64c0cb2ef6e3 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/__init__.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/__init__.py @@ -10,10 +10,17 @@ from ._version import VERSION __version__ = VERSION -__all__ = ['DataLakeStoreAccountManagementClient'] try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataLakeStoreAccountManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_configuration.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_configuration.py index a9e709eb0251..5f2f6a94d8d9 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_configuration.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_configuration.py @@ -6,66 +6,68 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import sys +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class DataLakeStoreAccountManagementClientConfiguration(Configuration): +class DataLakeStoreAccountManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DataLakeStoreAccountManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2016-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(DataLakeStoreAccountManagementClientConfiguration, self).__init__(**kwargs) + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", "2016-11-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataLakeStoreAccountManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-11-01" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-datalake-store/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-datalake-store/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_data_lake_store_account_management_client.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_data_lake_store_account_management_client.py index 934e59bc9590..0e22526ad7eb 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_data_lake_store_account_management_client.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_data_lake_store_account_management_client.py @@ -6,28 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer + +from . import models as _models +from ._configuration import DataLakeStoreAccountManagementClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + AccountsOperations, + FirewallRulesOperations, + LocationsOperations, + Operations, + TrustedIdProvidersOperations, + VirtualNetworkRulesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import DataLakeStoreAccountManagementClientConfiguration -from .operations import AccountsOperations -from .operations import FirewallRulesOperations -from .operations import VirtualNetworkRulesOperations -from .operations import TrustedIdProvidersOperations -from .operations import Operations -from .operations import LocationsOperations -from . import models - -class DataLakeStoreAccountManagementClient(object): +class DataLakeStoreAccountManagementClient: # pylint: disable=client-accepts-api-version-keyword """Creates an Azure Data Lake Store account management client. :ivar accounts: AccountsOperations operations @@ -35,61 +37,84 @@ class DataLakeStoreAccountManagementClient(object): :ivar firewall_rules: FirewallRulesOperations operations :vartype firewall_rules: azure.mgmt.datalake.store.operations.FirewallRulesOperations :ivar virtual_network_rules: VirtualNetworkRulesOperations operations - :vartype virtual_network_rules: azure.mgmt.datalake.store.operations.VirtualNetworkRulesOperations + :vartype virtual_network_rules: + azure.mgmt.datalake.store.operations.VirtualNetworkRulesOperations :ivar trusted_id_providers: TrustedIdProvidersOperations operations - :vartype trusted_id_providers: azure.mgmt.datalake.store.operations.TrustedIdProvidersOperations + :vartype trusted_id_providers: + azure.mgmt.datalake.store.operations.TrustedIdProvidersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.datalake.store.operations.Operations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.datalake.store.operations.LocationsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2016-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataLakeStoreAccountManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataLakeStoreAccountManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.accounts = AccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.firewall_rules = FirewallRulesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._serialize.client_side_validation = False + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.trusted_id_providers = TrustedIdProvidersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> DataLakeStoreAccountManagementClient + def __enter__(self) -> "DataLakeStoreAccountManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_patch.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_patch.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_patch.py rename to sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_patch.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_serialization.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_serialization.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_serialization.py rename to sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_serialization.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_vendor.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_vendor.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_vendor.py rename to sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_vendor.py diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_version.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_version.py index c47f66669f1b..653b73a4a199 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_version.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0b1" diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/__init__.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/__init__.py index bcc73f33ddbb..4e17276d41d4 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/__init__.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/__init__.py @@ -7,4 +7,17 @@ # -------------------------------------------------------------------------- from ._data_lake_store_account_management_client import DataLakeStoreAccountManagementClient -__all__ = ['DataLakeStoreAccountManagementClient'] + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataLakeStoreAccountManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_configuration.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_configuration.py index 881f1fcfe1f2..c07cdff76a19 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_configuration.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_configuration.py @@ -6,62 +6,68 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class DataLakeStoreAccountManagementClientConfiguration(Configuration): +class DataLakeStoreAccountManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DataLakeStoreAccountManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2016-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(DataLakeStoreAccountManagementClientConfiguration, self).__init__(**kwargs) + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", "2016-11-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataLakeStoreAccountManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-11-01" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-datalake-store/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-datalake-store/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_data_lake_store_account_management_client.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_data_lake_store_account_management_client.py index 36e16b7000ac..dd6dd8467e7e 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_data_lake_store_account_management_client.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_data_lake_store_account_management_client.py @@ -6,26 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import DataLakeStoreAccountManagementClientConfiguration +from .operations import ( + AccountsOperations, + FirewallRulesOperations, + LocationsOperations, + Operations, + TrustedIdProvidersOperations, + VirtualNetworkRulesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataLakeStoreAccountManagementClientConfiguration -from .operations import AccountsOperations -from .operations import FirewallRulesOperations -from .operations import VirtualNetworkRulesOperations -from .operations import TrustedIdProvidersOperations -from .operations import Operations -from .operations import LocationsOperations -from .. import models - -class DataLakeStoreAccountManagementClient(object): +class DataLakeStoreAccountManagementClient: # pylint: disable=client-accepts-api-version-keyword """Creates an Azure Data Lake Store account management client. :ivar accounts: AccountsOperations operations @@ -33,50 +37,77 @@ class DataLakeStoreAccountManagementClient(object): :ivar firewall_rules: FirewallRulesOperations operations :vartype firewall_rules: azure.mgmt.datalake.store.aio.operations.FirewallRulesOperations :ivar virtual_network_rules: VirtualNetworkRulesOperations operations - :vartype virtual_network_rules: azure.mgmt.datalake.store.aio.operations.VirtualNetworkRulesOperations + :vartype virtual_network_rules: + azure.mgmt.datalake.store.aio.operations.VirtualNetworkRulesOperations :ivar trusted_id_providers: TrustedIdProvidersOperations operations - :vartype trusted_id_providers: azure.mgmt.datalake.store.aio.operations.TrustedIdProvidersOperations + :vartype trusted_id_providers: + azure.mgmt.datalake.store.aio.operations.TrustedIdProvidersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.datalake.store.aio.operations.Operations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.datalake.store.aio.operations.LocationsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2016-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataLakeStoreAccountManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataLakeStoreAccountManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.accounts = AccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.firewall_rules = FirewallRulesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._serialize.client_side_validation = False + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.trusted_id_providers = TrustedIdProvidersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() @@ -85,5 +116,5 @@ async def __aenter__(self) -> "DataLakeStoreAccountManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_patch.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_patch.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_patch.py rename to sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/_patch.py diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/__init__.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/__init__.py index ad9f979648cf..1189bb013e90 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/__init__.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/__init__.py @@ -13,11 +13,17 @@ from ._operations import Operations from ._locations_operations import LocationsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccountsOperations', - 'FirewallRulesOperations', - 'VirtualNetworkRulesOperations', - 'TrustedIdProvidersOperations', - 'Operations', - 'LocationsOperations', + "AccountsOperations", + "FirewallRulesOperations", + "VirtualNetworkRulesOperations", + "TrustedIdProvidersOperations", + "Operations", + "LocationsOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_accounts_operations.py index 9ad51dca6a24..6b2060f5806e 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_accounts_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_accounts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,44 +6,70 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._accounts_operations import ( + build_check_name_availability_request, + build_create_request, + build_delete_request, + build_enable_key_vault_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AccountsOperations: - """AccountsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.aio.DataLakeStoreAccountManagementClient`'s + :attr:`accounts` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, filter: Optional[str] = None, @@ -51,86 +78,102 @@ def list( select: Optional[str] = None, orderby: Optional[str] = None, count: Optional[bool] = None, - **kwargs - ) -> AsyncIterable["_models.DataLakeStoreAccountListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.DataLakeStoreAccountBasic"]: """Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. - :param filter: OData filter. Optional. + :param filter: OData filter. Optional. Default value is None. :type filter: str - :param top: The number of items to return. Optional. + :param top: The number of items to return. Optional. Default value is None. :type top: int - :param skip: The number of items to skip over before returning elements. Optional. + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. :type skip: int :param select: OData Select statement. Limits the properties on each entry to just those - requested, e.g. Categories?$select=CategoryName,Description. Optional. + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. :type select: str :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. - Categories?$orderby=CategoryName desc. Optional. + Categories?$orderby=CategoryName desc. Optional. Default value is None. :type orderby: str :param count: The Boolean value of true or false to request a count of the matching resources - included with the resources in the response, e.g. Categories?$count=true. Optional. + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. :type count: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataLakeStoreAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DataLakeStoreAccountBasic or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountBasic] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccountListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DataLakeStoreAccountListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=1) - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - if count is not None: - query_parameters['$count'] = self._serialize.query("count", count, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccountListResult', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -139,11 +182,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts"} + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -153,89 +196,105 @@ def list_by_resource_group( select: Optional[str] = None, orderby: Optional[str] = None, count: Optional[bool] = None, - **kwargs - ) -> AsyncIterable["_models.DataLakeStoreAccountListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.DataLakeStoreAccountBasic"]: """Lists the Data Lake Store accounts within a specific resource group. The response includes a link to the next page of results, if any. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param filter: OData filter. Optional. + :param filter: OData filter. Optional. Default value is None. :type filter: str - :param top: The number of items to return. Optional. + :param top: The number of items to return. Optional. Default value is None. :type top: int - :param skip: The number of items to skip over before returning elements. Optional. + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. :type skip: int :param select: OData Select statement. Limits the properties on each entry to just those - requested, e.g. Categories?$select=CategoryName,Description. Optional. + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. :type select: str :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. - Categories?$orderby=CategoryName desc. Optional. + Categories?$orderby=CategoryName desc. Optional. Default value is None. :type orderby: str :param count: A Boolean value of true or false to request a count of the matching resources - included with the resources in the response, e.g. Categories?$count=true. Optional. + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. :type count: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataLakeStoreAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DataLakeStoreAccountBasic or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountBasic] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccountListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DataLakeStoreAccountListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=1) - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - if count is not None: - query_parameters['$count'] = self._serialize.query("count", count, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccountListResult', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -244,50 +303,63 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts" + } async def _create_initial( self, resource_group_name: str, account_name: str, - parameters: "_models.CreateDataLakeStoreAccountParameters", - **kwargs - ) -> "_models.DataLakeStoreAccount": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] + parameters: Union[_models.CreateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> _models.DataLakeStoreAccount: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateDataLakeStoreAccountParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateDataLakeStoreAccountParameters") + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -295,185 +367,289 @@ async def _create_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + @overload async def begin_create( self, resource_group_name: str, account_name: str, - parameters: "_models.CreateDataLakeStoreAccountParameters", - **kwargs - ) -> AsyncLROPoller["_models.DataLakeStoreAccount"]: + parameters: _models.CreateDataLakeStoreAccountParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeStoreAccount]: """Creates the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param parameters: Parameters supplied to create the Data Lake Store account. + :param parameters: Parameters supplied to create the Data Lake Store account. Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateDataLakeStoreAccountParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeStoreAccount]: + """Creates the specified Data Lake Store account. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to create the Data Lake Store account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: Union[_models.CreateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeStoreAccount]: + """Creates the specified Data Lake Store account. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to create the Data Lake Store account. Is either a + CreateDataLakeStoreAccountParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateDataLakeStoreAccountParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) - + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def get( - self, - resource_group_name: str, - account_name: str, - **kwargs - ) -> "_models.DataLakeStoreAccount": + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.DataLakeStoreAccount: """Gets the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataLakeStoreAccount, or the result of cls(response) + :return: DataLakeStoreAccount or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.DataLakeStoreAccount - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } async def _update_initial( self, resource_group_name: str, account_name: str, - parameters: "_models.UpdateDataLakeStoreAccountParameters", - **kwargs - ) -> "_models.DataLakeStoreAccount": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] + parameters: Union[_models.UpdateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> _models.DataLakeStoreAccount: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UpdateDataLakeStoreAccountParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UpdateDataLakeStoreAccountParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -481,122 +657,214 @@ async def _update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return deserialized # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + @overload async def begin_update( self, resource_group_name: str, account_name: str, - parameters: "_models.UpdateDataLakeStoreAccountParameters", - **kwargs - ) -> AsyncLROPoller["_models.DataLakeStoreAccount"]: + parameters: _models.UpdateDataLakeStoreAccountParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeStoreAccount]: """Updates the specified Data Lake Store account information. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param parameters: Parameters supplied to update the Data Lake Store account. + :param parameters: Parameters supplied to update the Data Lake Store account. Required. :type parameters: ~azure.mgmt.datalake.store.models.UpdateDataLakeStoreAccountParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeStoreAccount]: + """Updates the specified Data Lake Store account information. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to update the Data Lake Store account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + account_name: str, + parameters: Union[_models.UpdateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeStoreAccount]: + """Updates the specified Data Lake Store account information. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to update the Data Lake Store account. Is either a + UpdateDataLakeStoreAccountParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateDataLakeStoreAccountParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeStoreAccount or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) - + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - account_name: str, - **kwargs + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -606,115 +874,123 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } - async def begin_delete( - self, - resource_group_name: str, - account_name: str, - **kwargs - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def enable_key_vault( - self, - resource_group_name: str, - account_name: str, - **kwargs + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + @distributed_trace_async + async def enable_key_vault( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, **kwargs: Any ) -> None: """Attempts to enable a user managed Key Vault for encryption of the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.enable_key_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_enable_key_vault_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.enable_key_vault.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -724,66 +1000,130 @@ async def enable_key_vault( if cls: return cls(pipeline_response, None, {}) - enable_key_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault'} # type: ignore + enable_key_vault.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault" + } + @overload async def check_name_availability( self, location: str, - parameters: "_models.CheckNameAvailabilityParameters", - **kwargs - ) -> "_models.NameAvailabilityInformation": + parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityInformation: """Checks whether the specified account name is available or taken. - :param location: The resource location without whitespace. + :param location: The resource location without whitespace. Required. :type location: str :param parameters: Parameters supplied to check the Data Lake Store account name availability. + Required. :type parameters: ~azure.mgmt.datalake.store.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityInformation, or the result of cls(response) + :return: NameAvailabilityInformation or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.NameAvailabilityInformation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityInformation: + """Checks whether the specified account name is available or taken. + + :param location: The resource location without whitespace. Required. + :type location: str + :param parameters: Parameters supplied to check the Data Lake Store account name availability. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInformation or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.NameAvailabilityInformation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, location: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailabilityInformation: + """Checks whether the specified account name is available or taken. + + :param location: The resource location without whitespace. Required. + :type location: str + :param parameters: Parameters supplied to check the Data Lake Store account name availability. + Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInformation or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.NameAvailabilityInformation + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityInformation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityInformation] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") + + request = build_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityInformation', pipeline_response) + deserialized = self._deserialize("NameAvailabilityInformation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability'} # type: ignore + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_firewall_rules_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_firewall_rules_operations.py index 4ef2a8c20692..c495eb470c68 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_firewall_rules_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_firewall_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,103 +6,141 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._firewall_rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_account_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class FirewallRulesOperations: - """FirewallRulesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class FirewallRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.aio.DataLakeStoreAccountManagementClient`'s + :attr:`firewall_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_account( - self, - resource_group_name: str, - account_name: str, - **kwargs - ) -> AsyncIterable["_models.FirewallRuleListResult"]: + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FirewallRule"]: """Lists the Data Lake Store firewall rules within the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FirewallRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.FirewallRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either FirewallRule or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.FirewallRule] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FirewallRuleListResult', pipeline_response) + deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,263 +149,435 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + list_by_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules" + } + + @overload async def create_or_update( self, resource_group_name: str, account_name: str, firewall_rule_name: str, - parameters: "_models.CreateOrUpdateFirewallRuleParameters", - **kwargs - ) -> "_models.FirewallRule": + parameters: _models.CreateOrUpdateFirewallRuleParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: """Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to create or update. + :param firewall_rule_name: The name of the firewall rule to create or update. Required. :type firewall_rule_name: str - :param parameters: Parameters supplied to create or update the firewall rule. + :param parameters: Parameters supplied to create or update the firewall rule. Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateFirewallRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: + """Creates or updates the specified firewall rule. During update, the firewall rule with the + specified name will be replaced with this new firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to create or update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to create or update the firewall rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Union[_models.CreateOrUpdateFirewallRuleParameters, IO], + **kwargs: Any + ) -> _models.FirewallRule: + """Creates or updates the specified firewall rule. During update, the firewall rule with the + specified name will be replaced with this new firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to create or update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to create or update the firewall rule. Is either a + CreateOrUpdateFirewallRuleParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateFirewallRuleParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallRule, or the result of cls(response) + :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateOrUpdateFirewallRuleParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateOrUpdateFirewallRuleParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('FirewallRule', pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } + + @distributed_trace_async async def get( - self, - resource_group_name: str, - account_name: str, - firewall_rule_name: str, - **kwargs - ) -> "_models.FirewallRule": + self, resource_group_name: str, account_name: str, firewall_rule_name: str, **kwargs: Any + ) -> _models.FirewallRule: """Gets the specified Data Lake Store firewall rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to retrieve. + :param firewall_rule_name: The name of the firewall rule to retrieve. Required. :type firewall_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallRule, or the result of cls(response) + :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('FirewallRule', pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } + + @overload async def update( self, resource_group_name: str, account_name: str, firewall_rule_name: str, - parameters: Optional["_models.UpdateFirewallRuleParameters"] = None, - **kwargs - ) -> "_models.FirewallRule": + parameters: Optional[_models.UpdateFirewallRuleParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: """Updates the specified firewall rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to update. + :param firewall_rule_name: The name of the firewall rule to update. Required. :type firewall_rule_name: str - :param parameters: Parameters supplied to update the firewall rule. + :param parameters: Parameters supplied to update the firewall rule. Default value is None. :type parameters: ~azure.mgmt.datalake.store.models.UpdateFirewallRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: + """Updates the specified firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to update the firewall rule. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallRule, or the result of cls(response) + :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Optional[Union[_models.UpdateFirewallRuleParameters, IO]] = None, + **kwargs: Any + ) -> _models.FirewallRule: + """Updates the specified firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to update the firewall rule. Is either a + UpdateFirewallRuleParameters type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateFirewallRuleParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateFirewallRuleParameters') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateFirewallRuleParameters") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('FirewallRule', pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore - async def delete( - self, - resource_group_name: str, - account_name: str, - firewall_rule_name: str, - **kwargs + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, firewall_rule_name: str, **kwargs: Any ) -> None: """Deletes the specified firewall rule from the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to delete. + :param firewall_rule_name: The name of the firewall rule to delete. Required. :type firewall_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -376,4 +587,6 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_locations_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_locations_operations.py index 6344204350ce..7af28a572a71 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_locations_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_locations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,83 +6,101 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._locations_operations import build_get_capability_request, build_get_usage_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LocationsOperations: - """LocationsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class LocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.aio.DataLakeStoreAccountManagementClient`'s + :attr:`locations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get_capability( - self, - location: str, - **kwargs - ) -> Optional["_models.CapabilityInformation"]: + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_capability(self, location: str, **kwargs: Any) -> Optional[_models.CapabilityInformation]: """Gets subscription-level properties and limits for Data Lake Store specified by resource location. - :param location: The resource location without whitespace. + :param location: The resource location without whitespace. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CapabilityInformation, or the result of cls(response) + :return: CapabilityInformation or None or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.CapabilityInformation or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CapabilityInformation"]] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get_capability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.CapabilityInformation]] = kwargs.pop("cls", None) + + request = build_get_capability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_capability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -90,72 +109,90 @@ async def get_capability( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('CapabilityInformation', pipeline_response) + deserialized = self._deserialize("CapabilityInformation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_capability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability'} # type: ignore - def get_usage( - self, - location: str, - **kwargs - ) -> AsyncIterable["_models.UsageListResult"]: + get_capability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability" + } + + @distributed_trace + def get_usage(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: """Gets the current usage count and the limit for the resources of the location under the subscription. - :param location: The resource location without whitespace. + :param location: The resource location without whitespace. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.UsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_usage_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_usage.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -164,7 +201,8 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - get_usage.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + get_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_operations.py index 0252f15cbccf..efd91a316f1b 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,83 +6,104 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class Operations: - """Operations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.aio.DataLakeStoreAccountManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def list( - self, - **kwargs - ) -> "_models.OperationListResult": + @distributed_trace_async + async def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists all of the available Data Lake Store REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult, or the result of cls(response) + :return: OperationListResult or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.OperationListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct URL - url = self.list.metadata['url'] # type: ignore + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/providers/Microsoft.DataLakeStore/operations'} # type: ignore + + list.metadata = {"url": "/providers/Microsoft.DataLakeStore/operations"} diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_patch.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_patch.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_patch.py rename to sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_patch.py diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_trusted_id_providers_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_trusted_id_providers_operations.py index 2579c72572c1..2d644c8c7a9b 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_trusted_id_providers_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_trusted_id_providers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,104 +6,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._trusted_id_providers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_account_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class TrustedIdProvidersOperations: - """TrustedIdProvidersOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TrustedIdProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.aio.DataLakeStoreAccountManagementClient`'s + :attr:`trusted_id_providers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_account( - self, - resource_group_name: str, - account_name: str, - **kwargs - ) -> AsyncIterable["_models.TrustedIdProviderListResult"]: + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TrustedIdProvider"]: """Lists the Data Lake Store trusted identity providers within the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedIdProviderListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.TrustedIdProviderListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either TrustedIdProvider or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.TrustedIdProvider] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProviderListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.TrustedIdProviderListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TrustedIdProviderListResult', pipeline_response) + deserialized = self._deserialize("TrustedIdProviderListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,265 +151,447 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders" + } + @overload async def create_or_update( self, resource_group_name: str, account_name: str, trusted_id_provider_name: str, - parameters: "_models.CreateOrUpdateTrustedIdProviderParameters", - **kwargs - ) -> "_models.TrustedIdProvider": + parameters: _models.CreateOrUpdateTrustedIdProviderParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: """Creates or updates the specified trusted identity provider. During update, the trusted identity provider with the specified name will be replaced with this new provider. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param trusted_id_provider_name: The name of the trusted identity provider. This is used for - differentiation of providers in the account. + differentiation of providers in the account. Required. :type trusted_id_provider_name: str :param parameters: Parameters supplied to create or replace the trusted identity provider. + Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateTrustedIdProviderParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedIdProvider, or the result of cls(response) + :return: TrustedIdProvider or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Creates or updates the specified trusted identity provider. During update, the trusted identity + provider with the specified name will be replaced with this new provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to create or replace the trusted identity provider. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: Union[_models.CreateOrUpdateTrustedIdProviderParameters, IO], + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Creates or updates the specified trusted identity provider. During update, the trusted identity + provider with the specified name will be replaced with this new provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to create or replace the trusted identity provider. Is + either a CreateOrUpdateTrustedIdProviderParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateTrustedIdProviderParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateOrUpdateTrustedIdProviderParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedIdProvider] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateOrUpdateTrustedIdProviderParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedIdProvider', pipeline_response) + deserialized = self._deserialize("TrustedIdProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } + + @distributed_trace_async async def get( - self, - resource_group_name: str, - account_name: str, - trusted_id_provider_name: str, - **kwargs - ) -> "_models.TrustedIdProvider": + self, resource_group_name: str, account_name: str, trusted_id_provider_name: str, **kwargs: Any + ) -> _models.TrustedIdProvider: """Gets the specified Data Lake Store trusted identity provider. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param trusted_id_provider_name: The name of the trusted identity provider to retrieve. + Required. :type trusted_id_provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedIdProvider, or the result of cls(response) + :return: TrustedIdProvider or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.TrustedIdProvider] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedIdProvider', pipeline_response) + deserialized = self._deserialize("TrustedIdProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } + + @overload async def update( self, resource_group_name: str, account_name: str, trusted_id_provider_name: str, - parameters: Optional["_models.UpdateTrustedIdProviderParameters"] = None, - **kwargs - ) -> "_models.TrustedIdProvider": + parameters: Optional[_models.UpdateTrustedIdProviderParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: """Updates the specified trusted identity provider. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param trusted_id_provider_name: The name of the trusted identity provider. This is used for - differentiation of providers in the account. + differentiation of providers in the account. Required. :type trusted_id_provider_name: str - :param parameters: Parameters supplied to update the trusted identity provider. + :param parameters: Parameters supplied to update the trusted identity provider. Default value + is None. :type parameters: ~azure.mgmt.datalake.store.models.UpdateTrustedIdProviderParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Updates the specified trusted identity provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to update the trusted identity provider. Default value + is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: Optional[Union[_models.UpdateTrustedIdProviderParameters, IO]] = None, + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Updates the specified trusted identity provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to update the trusted identity provider. Is either a + UpdateTrustedIdProviderParameters type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateTrustedIdProviderParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedIdProvider, or the result of cls(response) + :return: TrustedIdProvider or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateTrustedIdProviderParameters') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedIdProvider] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateTrustedIdProviderParameters") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedIdProvider', pipeline_response) + deserialized = self._deserialize("TrustedIdProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore - async def delete( - self, - resource_group_name: str, - account_name: str, - trusted_id_provider_name: str, - **kwargs + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, trusted_id_provider_name: str, **kwargs: Any ) -> None: """Deletes the specified trusted identity provider from the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param trusted_id_provider_name: The name of the trusted identity provider to delete. + :param trusted_id_provider_name: The name of the trusted identity provider to delete. Required. :type trusted_id_provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -379,4 +601,6 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_virtual_network_rules_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_virtual_network_rules_operations.py index fa1adf3d443e..caf690972899 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_virtual_network_rules_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/aio/operations/_virtual_network_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,103 +6,142 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._virtual_network_rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_account_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class VirtualNetworkRulesOperations: - """VirtualNetworkRulesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VirtualNetworkRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.aio.DataLakeStoreAccountManagementClient`'s + :attr:`virtual_network_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_account( - self, - resource_group_name: str, - account_name: str, - **kwargs - ) -> AsyncIterable["_models.VirtualNetworkRuleListResult"]: + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkRule"]: """Lists the Data Lake Store virtual network rules within the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.VirtualNetworkRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.VirtualNetworkRule] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualNetworkRuleListResult', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,263 +150,441 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules" + } + @overload async def create_or_update( self, resource_group_name: str, account_name: str, virtual_network_rule_name: str, - parameters: "_models.CreateOrUpdateVirtualNetworkRuleParameters", - **kwargs - ) -> "_models.VirtualNetworkRule": + parameters: _models.CreateOrUpdateVirtualNetworkRuleParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: """Creates or updates the specified virtual network rule. During update, the virtual network rule with the specified name will be replaced with this new virtual network rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param virtual_network_rule_name: The name of the virtual network rule to create or update. + Required. :type virtual_network_rule_name: str - :param parameters: Parameters supplied to create or update the virtual network rule. + :param parameters: Parameters supplied to create or update the virtual network rule. Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateVirtualNetworkRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates the specified virtual network rule. During update, the virtual network rule + with the specified name will be replaced with this new virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to create or update. + Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to create or update the virtual network rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: Union[_models.CreateOrUpdateVirtualNetworkRuleParameters, IO], + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates the specified virtual network rule. During update, the virtual network rule + with the specified name will be replaced with this new virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to create or update. + Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to create or update the virtual network rule. Is either + a CreateOrUpdateVirtualNetworkRuleParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateVirtualNetworkRuleParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateOrUpdateVirtualNetworkRuleParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateOrUpdateVirtualNetworkRuleParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } + + @distributed_trace_async async def get( - self, - resource_group_name: str, - account_name: str, - virtual_network_rule_name: str, - **kwargs - ) -> "_models.VirtualNetworkRule": + self, resource_group_name: str, account_name: str, virtual_network_rule_name: str, **kwargs: Any + ) -> _models.VirtualNetworkRule: """Gets the specified Data Lake Store virtual network rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param virtual_network_rule_name: The name of the virtual network rule to retrieve. + :param virtual_network_rule_name: The name of the virtual network rule to retrieve. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } + + @overload async def update( self, resource_group_name: str, account_name: str, virtual_network_rule_name: str, - parameters: Optional["_models.UpdateVirtualNetworkRuleParameters"] = None, - **kwargs - ) -> "_models.VirtualNetworkRule": + parameters: Optional[_models.UpdateVirtualNetworkRuleParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: """Updates the specified virtual network rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param virtual_network_rule_name: The name of the virtual network rule to update. + :param virtual_network_rule_name: The name of the virtual network rule to update. Required. :type virtual_network_rule_name: str - :param parameters: Parameters supplied to update the virtual network rule. + :param parameters: Parameters supplied to update the virtual network rule. Default value is + None. :type parameters: ~azure.mgmt.datalake.store.models.UpdateVirtualNetworkRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Updates the specified virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to update. Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to update the virtual network rule. Default value is + None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: Optional[Union[_models.UpdateVirtualNetworkRuleParameters, IO]] = None, + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Updates the specified virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to update. Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to update the virtual network rule. Is either a + UpdateVirtualNetworkRuleParameters type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateVirtualNetworkRuleParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateVirtualNetworkRuleParameters') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateVirtualNetworkRuleParameters") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore - async def delete( - self, - resource_group_name: str, - account_name: str, - virtual_network_rule_name: str, - **kwargs + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, virtual_network_rule_name: str, **kwargs: Any ) -> None: """Deletes the specified virtual network rule from the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param virtual_network_rule_name: The name of the virtual network rule to delete. + :param virtual_network_rule_name: The name of the virtual network rule to delete. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -376,4 +594,6 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/__init__.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/__init__.py index 91f2b0a2e465..a3c3a3770ed9 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/__init__.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/__init__.py @@ -6,158 +6,120 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CapabilityInformation - from ._models_py3 import CheckNameAvailabilityParameters - from ._models_py3 import CreateDataLakeStoreAccountParameters - from ._models_py3 import CreateFirewallRuleWithAccountParameters - from ._models_py3 import CreateOrUpdateFirewallRuleParameters - from ._models_py3 import CreateOrUpdateTrustedIdProviderParameters - from ._models_py3 import CreateOrUpdateVirtualNetworkRuleParameters - from ._models_py3 import CreateTrustedIdProviderWithAccountParameters - from ._models_py3 import CreateVirtualNetworkRuleWithAccountParameters - from ._models_py3 import DataLakeStoreAccount - from ._models_py3 import DataLakeStoreAccountBasic - from ._models_py3 import DataLakeStoreAccountListResult - from ._models_py3 import DataLakeStoreAccountProperties - from ._models_py3 import DataLakeStoreAccountPropertiesBasic - from ._models_py3 import EncryptionConfig - from ._models_py3 import EncryptionIdentity - from ._models_py3 import FirewallRule - from ._models_py3 import FirewallRuleListResult - from ._models_py3 import KeyVaultMetaInfo - from ._models_py3 import NameAvailabilityInformation - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import SubResource - from ._models_py3 import TrustedIdProvider - from ._models_py3 import TrustedIdProviderListResult - from ._models_py3 import UpdateDataLakeStoreAccountParameters - from ._models_py3 import UpdateEncryptionConfig - from ._models_py3 import UpdateFirewallRuleParameters - from ._models_py3 import UpdateFirewallRuleWithAccountParameters - from ._models_py3 import UpdateKeyVaultMetaInfo - from ._models_py3 import UpdateTrustedIdProviderParameters - from ._models_py3 import UpdateTrustedIdProviderWithAccountParameters - from ._models_py3 import UpdateVirtualNetworkRuleParameters - from ._models_py3 import UpdateVirtualNetworkRuleWithAccountParameters - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule - from ._models_py3 import VirtualNetworkRuleListResult -except (SyntaxError, ImportError): - from ._models import CapabilityInformation # type: ignore - from ._models import CheckNameAvailabilityParameters # type: ignore - from ._models import CreateDataLakeStoreAccountParameters # type: ignore - from ._models import CreateFirewallRuleWithAccountParameters # type: ignore - from ._models import CreateOrUpdateFirewallRuleParameters # type: ignore - from ._models import CreateOrUpdateTrustedIdProviderParameters # type: ignore - from ._models import CreateOrUpdateVirtualNetworkRuleParameters # type: ignore - from ._models import CreateTrustedIdProviderWithAccountParameters # type: ignore - from ._models import CreateVirtualNetworkRuleWithAccountParameters # type: ignore - from ._models import DataLakeStoreAccount # type: ignore - from ._models import DataLakeStoreAccountBasic # type: ignore - from ._models import DataLakeStoreAccountListResult # type: ignore - from ._models import DataLakeStoreAccountProperties # type: ignore - from ._models import DataLakeStoreAccountPropertiesBasic # type: ignore - from ._models import EncryptionConfig # type: ignore - from ._models import EncryptionIdentity # type: ignore - from ._models import FirewallRule # type: ignore - from ._models import FirewallRuleListResult # type: ignore - from ._models import KeyVaultMetaInfo # type: ignore - from ._models import NameAvailabilityInformation # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import SubResource # type: ignore - from ._models import TrustedIdProvider # type: ignore - from ._models import TrustedIdProviderListResult # type: ignore - from ._models import UpdateDataLakeStoreAccountParameters # type: ignore - from ._models import UpdateEncryptionConfig # type: ignore - from ._models import UpdateFirewallRuleParameters # type: ignore - from ._models import UpdateFirewallRuleWithAccountParameters # type: ignore - from ._models import UpdateKeyVaultMetaInfo # type: ignore - from ._models import UpdateTrustedIdProviderParameters # type: ignore - from ._models import UpdateTrustedIdProviderWithAccountParameters # type: ignore - from ._models import UpdateVirtualNetworkRuleParameters # type: ignore - from ._models import UpdateVirtualNetworkRuleWithAccountParameters # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore - from ._models import VirtualNetworkRuleListResult # type: ignore +from ._models_py3 import CapabilityInformation +from ._models_py3 import CheckNameAvailabilityParameters +from ._models_py3 import CreateDataLakeStoreAccountParameters +from ._models_py3 import CreateFirewallRuleWithAccountParameters +from ._models_py3 import CreateOrUpdateFirewallRuleParameters +from ._models_py3 import CreateOrUpdateTrustedIdProviderParameters +from ._models_py3 import CreateOrUpdateVirtualNetworkRuleParameters +from ._models_py3 import CreateTrustedIdProviderWithAccountParameters +from ._models_py3 import CreateVirtualNetworkRuleWithAccountParameters +from ._models_py3 import DataLakeStoreAccount +from ._models_py3 import DataLakeStoreAccountBasic +from ._models_py3 import DataLakeStoreAccountListResult +from ._models_py3 import DataLakeStoreAccountProperties +from ._models_py3 import DataLakeStoreAccountPropertiesBasic +from ._models_py3 import EncryptionConfig +from ._models_py3 import EncryptionIdentity +from ._models_py3 import FirewallRule +from ._models_py3 import FirewallRuleListResult +from ._models_py3 import KeyVaultMetaInfo +from ._models_py3 import NameAvailabilityInformation +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import SubResource +from ._models_py3 import TrustedIdProvider +from ._models_py3 import TrustedIdProviderListResult +from ._models_py3 import UpdateDataLakeStoreAccountParameters +from ._models_py3 import UpdateEncryptionConfig +from ._models_py3 import UpdateFirewallRuleParameters +from ._models_py3 import UpdateFirewallRuleWithAccountParameters +from ._models_py3 import UpdateKeyVaultMetaInfo +from ._models_py3 import UpdateTrustedIdProviderParameters +from ._models_py3 import UpdateTrustedIdProviderWithAccountParameters +from ._models_py3 import UpdateVirtualNetworkRuleParameters +from ._models_py3 import UpdateVirtualNetworkRuleWithAccountParameters +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import VirtualNetworkRuleListResult -from ._data_lake_store_account_management_client_enums import ( - DataLakeStoreAccountState, - DataLakeStoreAccountStatus, - EncryptionConfigType, - EncryptionProvisioningState, - EncryptionState, - FirewallAllowAzureIpsState, - FirewallState, - OperationOrigin, - SubscriptionState, - TierType, - TrustedIdProviderState, - UsageUnit, -) +from ._data_lake_store_account_management_client_enums import CheckNameAvailabilityParametersType +from ._data_lake_store_account_management_client_enums import DataLakeStoreAccountState +from ._data_lake_store_account_management_client_enums import DataLakeStoreAccountStatus +from ._data_lake_store_account_management_client_enums import EncryptionConfigType +from ._data_lake_store_account_management_client_enums import EncryptionProvisioningState +from ._data_lake_store_account_management_client_enums import EncryptionState +from ._data_lake_store_account_management_client_enums import FirewallAllowAzureIpsState +from ._data_lake_store_account_management_client_enums import FirewallState +from ._data_lake_store_account_management_client_enums import OperationOrigin +from ._data_lake_store_account_management_client_enums import SubscriptionState +from ._data_lake_store_account_management_client_enums import TierType +from ._data_lake_store_account_management_client_enums import TrustedIdProviderState +from ._data_lake_store_account_management_client_enums import UsageUnit +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'CapabilityInformation', - 'CheckNameAvailabilityParameters', - 'CreateDataLakeStoreAccountParameters', - 'CreateFirewallRuleWithAccountParameters', - 'CreateOrUpdateFirewallRuleParameters', - 'CreateOrUpdateTrustedIdProviderParameters', - 'CreateOrUpdateVirtualNetworkRuleParameters', - 'CreateTrustedIdProviderWithAccountParameters', - 'CreateVirtualNetworkRuleWithAccountParameters', - 'DataLakeStoreAccount', - 'DataLakeStoreAccountBasic', - 'DataLakeStoreAccountListResult', - 'DataLakeStoreAccountProperties', - 'DataLakeStoreAccountPropertiesBasic', - 'EncryptionConfig', - 'EncryptionIdentity', - 'FirewallRule', - 'FirewallRuleListResult', - 'KeyVaultMetaInfo', - 'NameAvailabilityInformation', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'Resource', - 'SubResource', - 'TrustedIdProvider', - 'TrustedIdProviderListResult', - 'UpdateDataLakeStoreAccountParameters', - 'UpdateEncryptionConfig', - 'UpdateFirewallRuleParameters', - 'UpdateFirewallRuleWithAccountParameters', - 'UpdateKeyVaultMetaInfo', - 'UpdateTrustedIdProviderParameters', - 'UpdateTrustedIdProviderWithAccountParameters', - 'UpdateVirtualNetworkRuleParameters', - 'UpdateVirtualNetworkRuleWithAccountParameters', - 'Usage', - 'UsageListResult', - 'UsageName', - 'VirtualNetworkRule', - 'VirtualNetworkRuleListResult', - 'DataLakeStoreAccountState', - 'DataLakeStoreAccountStatus', - 'EncryptionConfigType', - 'EncryptionProvisioningState', - 'EncryptionState', - 'FirewallAllowAzureIpsState', - 'FirewallState', - 'OperationOrigin', - 'SubscriptionState', - 'TierType', - 'TrustedIdProviderState', - 'UsageUnit', + "CapabilityInformation", + "CheckNameAvailabilityParameters", + "CreateDataLakeStoreAccountParameters", + "CreateFirewallRuleWithAccountParameters", + "CreateOrUpdateFirewallRuleParameters", + "CreateOrUpdateTrustedIdProviderParameters", + "CreateOrUpdateVirtualNetworkRuleParameters", + "CreateTrustedIdProviderWithAccountParameters", + "CreateVirtualNetworkRuleWithAccountParameters", + "DataLakeStoreAccount", + "DataLakeStoreAccountBasic", + "DataLakeStoreAccountListResult", + "DataLakeStoreAccountProperties", + "DataLakeStoreAccountPropertiesBasic", + "EncryptionConfig", + "EncryptionIdentity", + "FirewallRule", + "FirewallRuleListResult", + "KeyVaultMetaInfo", + "NameAvailabilityInformation", + "Operation", + "OperationDisplay", + "OperationListResult", + "Resource", + "SubResource", + "TrustedIdProvider", + "TrustedIdProviderListResult", + "UpdateDataLakeStoreAccountParameters", + "UpdateEncryptionConfig", + "UpdateFirewallRuleParameters", + "UpdateFirewallRuleWithAccountParameters", + "UpdateKeyVaultMetaInfo", + "UpdateTrustedIdProviderParameters", + "UpdateTrustedIdProviderWithAccountParameters", + "UpdateVirtualNetworkRuleParameters", + "UpdateVirtualNetworkRuleWithAccountParameters", + "Usage", + "UsageListResult", + "UsageName", + "VirtualNetworkRule", + "VirtualNetworkRuleListResult", + "CheckNameAvailabilityParametersType", + "DataLakeStoreAccountState", + "DataLakeStoreAccountStatus", + "EncryptionConfigType", + "EncryptionProvisioningState", + "EncryptionState", + "FirewallAllowAzureIpsState", + "FirewallState", + "OperationOrigin", + "SubscriptionState", + "TierType", + "TrustedIdProviderState", + "UsageUnit", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_data_lake_store_account_management_client_enums.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_data_lake_store_account_management_client_enums.py index cf54bcdedb73..eea78254f8a3 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_data_lake_store_account_management_client_enums.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_data_lake_store_account_management_client_enums.py @@ -6,36 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class DataLakeStoreAccountState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The state of the Data Lake Store account. +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class CheckNameAvailabilityParametersType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource type. Note: This should not be set by the user, as the constant value is + Microsoft.DataLakeStore/accounts. """ + MICROSOFT_DATA_LAKE_STORE_ACCOUNTS = "Microsoft.DataLakeStore/accounts" + + +class DataLakeStoreAccountState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of the Data Lake Store account.""" + ACTIVE = "Active" SUSPENDED = "Suspended" -class DataLakeStoreAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The provisioning status of the Data Lake Store account. - """ + +class DataLakeStoreAccountStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning status of the Data Lake Store account.""" FAILED = "Failed" CREATING = "Creating" @@ -49,7 +40,8 @@ class DataLakeStoreAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, E UNDELETING = "Undeleting" CANCELED = "Canceled" -class EncryptionConfigType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class EncryptionConfigType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of encryption configuration being used. Currently the only supported types are 'UserManaged' and 'ServiceManaged'. """ @@ -57,21 +49,22 @@ class EncryptionConfigType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_MANAGED = "UserManaged" SERVICE_MANAGED = "ServiceManaged" -class EncryptionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The current state of encryption provisioning for this Data Lake Store account. - """ + +class EncryptionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of encryption provisioning for this Data Lake Store account.""" CREATING = "Creating" SUCCEEDED = "Succeeded" -class EncryptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The current state of encryption for this Data Lake Store account. - """ + +class EncryptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of encryption for this Data Lake Store account.""" ENABLED = "Enabled" DISABLED = "Disabled" -class FirewallAllowAzureIpsState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class FirewallAllowAzureIpsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current state of allowing or disallowing IPs originating within Azure through the firewall. If the firewall is disabled, this is not enforced. """ @@ -79,24 +72,24 @@ class FirewallAllowAzureIpsState(with_metaclass(_CaseInsensitiveEnumMeta, str, E ENABLED = "Enabled" DISABLED = "Disabled" -class FirewallState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The current state of the IP address firewall for this Data Lake Store account. - """ + +class FirewallState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the IP address firewall for this Data Lake Store account.""" ENABLED = "Enabled" DISABLED = "Disabled" -class OperationOrigin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The intended executor of the operation. - """ + +class OperationOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation.""" USER = "user" SYSTEM = "system" USER_SYSTEM = "user,system" -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The subscription state. - """ + +class SubscriptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The subscription state.""" REGISTERED = "Registered" SUSPENDED = "Suspended" @@ -104,9 +97,9 @@ class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNREGISTERED = "Unregistered" WARNED = "Warned" -class TierType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The commitment tier to use for next month. - """ + +class TierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The commitment tier to use for next month.""" CONSUMPTION = "Consumption" COMMITMENT1_TB = "Commitment_1TB" @@ -116,16 +109,16 @@ class TierType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMMITMENT1_PB = "Commitment_1PB" COMMITMENT5_PB = "Commitment_5PB" -class TrustedIdProviderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The current state of the trusted identity provider feature for this Data Lake Store account. - """ + +class TrustedIdProviderState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the trusted identity provider feature for this Data Lake Store account.""" ENABLED = "Enabled" DISABLED = "Disabled" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Gets the unit of measurement. - """ + +class UsageUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets the unit of measurement.""" COUNT = "Count" BYTES = "Bytes" diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_models.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_models.py deleted file mode 100644 index d27e5d49e658..000000000000 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_models.py +++ /dev/null @@ -1,1695 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class CapabilityInformation(msrest.serialization.Model): - """Subscription-level properties and limits for Data Lake Store. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar subscription_id: The subscription credentials that uniquely identifies the subscription. - :vartype subscription_id: str - :ivar state: The subscription state. Possible values include: "Registered", "Suspended", - "Deleted", "Unregistered", "Warned". - :vartype state: str or ~azure.mgmt.datalake.store.models.SubscriptionState - :ivar max_account_count: The maximum supported number of accounts under this subscription. - :vartype max_account_count: int - :ivar account_count: The current number of accounts under this subscription. - :vartype account_count: int - :ivar migration_state: The Boolean value of true or false to indicate the maintenance state. - :vartype migration_state: bool - """ - - _validation = { - 'subscription_id': {'readonly': True}, - 'state': {'readonly': True}, - 'max_account_count': {'readonly': True}, - 'account_count': {'readonly': True}, - 'migration_state': {'readonly': True}, - } - - _attribute_map = { - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'max_account_count': {'key': 'maxAccountCount', 'type': 'int'}, - 'account_count': {'key': 'accountCount', 'type': 'int'}, - 'migration_state': {'key': 'migrationState', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CapabilityInformation, self).__init__(**kwargs) - self.subscription_id = None - self.state = None - self.max_account_count = None - self.account_count = None - self.migration_state = None - - -class CheckNameAvailabilityParameters(msrest.serialization.Model): - """Data Lake Store account name availability check parameters. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The Data Lake Store name to check availability for. - :type name: str - :ivar type: Required. The resource type. Note: This should not be set by the user, as the - constant value is Microsoft.DataLakeStore/accounts. Default value: - "Microsoft.DataLakeStore/accounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.DataLakeStore/accounts" - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class CreateDataLakeStoreAccountParameters(msrest.serialization.Model): - """CreateDataLakeStoreAccountParameters. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param identity: The Key Vault encryption identity, if any. - :type identity: ~azure.mgmt.datalake.store.models.EncryptionIdentity - :param default_group: The default owner group for all new folders and files created in the Data - Lake Store account. - :type default_group: str - :param encryption_config: The Key Vault encryption configuration. - :type encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig - :param encryption_state: The current state of encryption for this Data Lake Store account. - Possible values include: "Enabled", "Disabled". - :type encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState - :param firewall_rules: The list of firewall rules associated with this Data Lake Store account. - :type firewall_rules: - list[~azure.mgmt.datalake.store.models.CreateFirewallRuleWithAccountParameters] - :param virtual_network_rules: The list of virtual network rules associated with this Data Lake - Store account. - :type virtual_network_rules: - list[~azure.mgmt.datalake.store.models.CreateVirtualNetworkRuleWithAccountParameters] - :param firewall_state: The current state of the IP address firewall for this Data Lake Store - account. Possible values include: "Enabled", "Disabled". - :type firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState - :param firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". - :type firewall_allow_azure_ips: str or - ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState - :param trusted_id_providers: The list of trusted identity providers associated with this Data - Lake Store account. - :type trusted_id_providers: - list[~azure.mgmt.datalake.store.models.CreateTrustedIdProviderWithAccountParameters] - :param trusted_id_provider_state: The current state of the trusted identity provider feature - for this Data Lake Store account. Possible values include: "Enabled", "Disabled". - :type trusted_id_provider_state: str or - ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :param new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :type new_tier: str or ~azure.mgmt.datalake.store.models.TierType - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - 'default_group': {'key': 'properties.defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'properties.encryptionConfig', 'type': 'EncryptionConfig'}, - 'encryption_state': {'key': 'properties.encryptionState', 'type': 'str'}, - 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[CreateFirewallRuleWithAccountParameters]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[CreateVirtualNetworkRuleWithAccountParameters]'}, - 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'properties.trustedIdProviders', 'type': '[CreateTrustedIdProviderWithAccountParameters]'}, - 'trusted_id_provider_state': {'key': 'properties.trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateDataLakeStoreAccountParameters, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.default_group = kwargs.get('default_group', None) - self.encryption_config = kwargs.get('encryption_config', None) - self.encryption_state = kwargs.get('encryption_state', None) - self.firewall_rules = kwargs.get('firewall_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.firewall_state = kwargs.get('firewall_state', None) - self.firewall_allow_azure_ips = kwargs.get('firewall_allow_azure_ips', None) - self.trusted_id_providers = kwargs.get('trusted_id_providers', None) - self.trusted_id_provider_state = kwargs.get('trusted_id_provider_state', None) - self.new_tier = kwargs.get('new_tier', None) - - -class CreateFirewallRuleWithAccountParameters(msrest.serialization.Model): - """The parameters used to create a new firewall rule while creating a new Data Lake Store account. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The unique name of the firewall rule to create. - :type name: str - :param start_ip_address: Required. The start IP address for the firewall rule. This can be - either ipv4 or ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: Required. The end IP address for the firewall rule. This can be either - ipv4 or ipv6. Start and End should be in the same protocol. - :type end_ip_address: str - """ - - _validation = { - 'name': {'required': True}, - 'start_ip_address': {'required': True}, - 'end_ip_address': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateFirewallRuleWithAccountParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.start_ip_address = kwargs['start_ip_address'] - self.end_ip_address = kwargs['end_ip_address'] - - -class CreateOrUpdateFirewallRuleParameters(msrest.serialization.Model): - """The parameters used to create a new firewall rule. - - All required parameters must be populated in order to send to Azure. - - :param start_ip_address: Required. The start IP address for the firewall rule. This can be - either ipv4 or ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: Required. The end IP address for the firewall rule. This can be either - ipv4 or ipv6. Start and End should be in the same protocol. - :type end_ip_address: str - """ - - _validation = { - 'start_ip_address': {'required': True}, - 'end_ip_address': {'required': True}, - } - - _attribute_map = { - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateOrUpdateFirewallRuleParameters, self).__init__(**kwargs) - self.start_ip_address = kwargs['start_ip_address'] - self.end_ip_address = kwargs['end_ip_address'] - - -class CreateOrUpdateTrustedIdProviderParameters(msrest.serialization.Model): - """The parameters used to create a new trusted identity provider. - - All required parameters must be populated in order to send to Azure. - - :param id_provider: Required. The URL of this trusted identity provider. - :type id_provider: str - """ - - _validation = { - 'id_provider': {'required': True}, - } - - _attribute_map = { - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateOrUpdateTrustedIdProviderParameters, self).__init__(**kwargs) - self.id_provider = kwargs['id_provider'] - - -class CreateOrUpdateVirtualNetworkRuleParameters(msrest.serialization.Model): - """The parameters used to create a new virtual network rule. - - All required parameters must be populated in order to send to Azure. - - :param subnet_id: Required. The resource identifier for the subnet. - :type subnet_id: str - """ - - _validation = { - 'subnet_id': {'required': True}, - } - - _attribute_map = { - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateOrUpdateVirtualNetworkRuleParameters, self).__init__(**kwargs) - self.subnet_id = kwargs['subnet_id'] - - -class CreateTrustedIdProviderWithAccountParameters(msrest.serialization.Model): - """The parameters used to create a new trusted identity provider while creating a new Data Lake Store account. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The unique name of the trusted identity provider to create. - :type name: str - :param id_provider: Required. The URL of this trusted identity provider. - :type id_provider: str - """ - - _validation = { - 'name': {'required': True}, - 'id_provider': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateTrustedIdProviderWithAccountParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.id_provider = kwargs['id_provider'] - - -class CreateVirtualNetworkRuleWithAccountParameters(msrest.serialization.Model): - """The parameters used to create a new virtual network rule while creating a new Data Lake Store account. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The unique name of the virtual network rule to create. - :type name: str - :param subnet_id: Required. The resource identifier for the subnet. - :type subnet_id: str - """ - - _validation = { - 'name': {'required': True}, - 'subnet_id': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateVirtualNetworkRuleWithAccountParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.subnet_id = kwargs['subnet_id'] - - -class Resource(msrest.serialization.Model): - """The resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar location: The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - -class DataLakeStoreAccount(Resource): - """Data Lake Store account information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar location: The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar identity: The Key Vault encryption identity, if any. - :vartype identity: ~azure.mgmt.datalake.store.models.EncryptionIdentity - :ivar account_id: The unique identifier associated with this Data Lake Store account. - :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", - "Suspended". - :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState - :ivar creation_time: The account creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: The account last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar endpoint: The full CName endpoint for this account. - :vartype endpoint: str - :ivar default_group: The default owner group for all new folders and files created in the Data - Lake Store account. - :vartype default_group: str - :ivar encryption_config: The Key Vault encryption configuration. - :vartype encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig - :ivar encryption_state: The current state of encryption for this Data Lake Store account. - Possible values include: "Enabled", "Disabled". - :vartype encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState - :ivar encryption_provisioning_state: The current state of encryption provisioning for this Data - Lake Store account. Possible values include: "Creating", "Succeeded". - :vartype encryption_provisioning_state: str or - ~azure.mgmt.datalake.store.models.EncryptionProvisioningState - :ivar firewall_rules: The list of firewall rules associated with this Data Lake Store account. - :vartype firewall_rules: list[~azure.mgmt.datalake.store.models.FirewallRule] - :ivar virtual_network_rules: The list of virtual network rules associated with this Data Lake - Store account. - :vartype virtual_network_rules: list[~azure.mgmt.datalake.store.models.VirtualNetworkRule] - :ivar firewall_state: The current state of the IP address firewall for this Data Lake Store - account. Possible values include: "Enabled", "Disabled". - :vartype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState - :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". - :vartype firewall_allow_azure_ips: str or - ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState - :ivar trusted_id_providers: The list of trusted identity providers associated with this Data - Lake Store account. - :vartype trusted_id_providers: list[~azure.mgmt.datalake.store.models.TrustedIdProvider] - :ivar trusted_id_provider_state: The current state of the trusted identity provider feature for - this Data Lake Store account. Possible values include: "Enabled", "Disabled". - :vartype trusted_id_provider_state: str or - ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :ivar new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :vartype new_tier: str or ~azure.mgmt.datalake.store.models.TierType - :ivar current_tier: The commitment tier in use for the current month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :vartype current_tier: str or ~azure.mgmt.datalake.store.models.TierType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'identity': {'readonly': True}, - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'default_group': {'readonly': True}, - 'encryption_config': {'readonly': True}, - 'encryption_state': {'readonly': True}, - 'encryption_provisioning_state': {'readonly': True}, - 'firewall_rules': {'readonly': True}, - 'virtual_network_rules': {'readonly': True}, - 'firewall_state': {'readonly': True}, - 'firewall_allow_azure_ips': {'readonly': True}, - 'trusted_id_providers': {'readonly': True}, - 'trusted_id_provider_state': {'readonly': True}, - 'new_tier': {'readonly': True}, - 'current_tier': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - 'account_id': {'key': 'properties.accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'default_group': {'key': 'properties.defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'properties.encryptionConfig', 'type': 'EncryptionConfig'}, - 'encryption_state': {'key': 'properties.encryptionState', 'type': 'str'}, - 'encryption_provisioning_state': {'key': 'properties.encryptionProvisioningState', 'type': 'str'}, - 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'properties.trustedIdProviders', 'type': '[TrustedIdProvider]'}, - 'trusted_id_provider_state': {'key': 'properties.trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, - 'current_tier': {'key': 'properties.currentTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccount, self).__init__(**kwargs) - self.identity = None - self.account_id = None - self.provisioning_state = None - self.state = None - self.creation_time = None - self.last_modified_time = None - self.endpoint = None - self.default_group = None - self.encryption_config = None - self.encryption_state = None - self.encryption_provisioning_state = None - self.firewall_rules = None - self.virtual_network_rules = None - self.firewall_state = None - self.firewall_allow_azure_ips = None - self.trusted_id_providers = None - self.trusted_id_provider_state = None - self.new_tier = None - self.current_tier = None - - -class DataLakeStoreAccountBasic(Resource): - """Basic Data Lake Store account information, returned on list calls. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar location: The resource location. - :vartype location: str - :ivar tags: A set of tags. The resource tags. - :vartype tags: dict[str, str] - :ivar account_id: The unique identifier associated with this Data Lake Store account. - :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", - "Suspended". - :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState - :ivar creation_time: The account creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: The account last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar endpoint: The full CName endpoint for this account. - :vartype endpoint: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_id': {'key': 'properties.accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountBasic, self).__init__(**kwargs) - self.account_id = None - self.provisioning_state = None - self.state = None - self.creation_time = None - self.last_modified_time = None - self.endpoint = None - - -class DataLakeStoreAccountListResult(msrest.serialization.Model): - """Data Lake Store account list information response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The results of the list operation. - :vartype value: list[~azure.mgmt.datalake.store.models.DataLakeStoreAccountBasic] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataLakeStoreAccountBasic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataLakeStoreAccountPropertiesBasic(msrest.serialization.Model): - """The basic account specific properties that are associated with an underlying Data Lake Store account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_id: The unique identifier associated with this Data Lake Store account. - :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", - "Suspended". - :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState - :ivar creation_time: The account creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: The account last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar endpoint: The full CName endpoint for this account. - :vartype endpoint: str - """ - - _validation = { - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, - } - - _attribute_map = { - 'account_id': {'key': 'accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountPropertiesBasic, self).__init__(**kwargs) - self.account_id = None - self.provisioning_state = None - self.state = None - self.creation_time = None - self.last_modified_time = None - self.endpoint = None - - -class DataLakeStoreAccountProperties(DataLakeStoreAccountPropertiesBasic): - """Data Lake Store account properties information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_id: The unique identifier associated with this Data Lake Store account. - :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", - "Suspended". - :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState - :ivar creation_time: The account creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: The account last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar endpoint: The full CName endpoint for this account. - :vartype endpoint: str - :ivar default_group: The default owner group for all new folders and files created in the Data - Lake Store account. - :vartype default_group: str - :ivar encryption_config: The Key Vault encryption configuration. - :vartype encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig - :ivar encryption_state: The current state of encryption for this Data Lake Store account. - Possible values include: "Enabled", "Disabled". - :vartype encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState - :ivar encryption_provisioning_state: The current state of encryption provisioning for this Data - Lake Store account. Possible values include: "Creating", "Succeeded". - :vartype encryption_provisioning_state: str or - ~azure.mgmt.datalake.store.models.EncryptionProvisioningState - :ivar firewall_rules: The list of firewall rules associated with this Data Lake Store account. - :vartype firewall_rules: list[~azure.mgmt.datalake.store.models.FirewallRule] - :ivar virtual_network_rules: The list of virtual network rules associated with this Data Lake - Store account. - :vartype virtual_network_rules: list[~azure.mgmt.datalake.store.models.VirtualNetworkRule] - :ivar firewall_state: The current state of the IP address firewall for this Data Lake Store - account. Possible values include: "Enabled", "Disabled". - :vartype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState - :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". - :vartype firewall_allow_azure_ips: str or - ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState - :ivar trusted_id_providers: The list of trusted identity providers associated with this Data - Lake Store account. - :vartype trusted_id_providers: list[~azure.mgmt.datalake.store.models.TrustedIdProvider] - :ivar trusted_id_provider_state: The current state of the trusted identity provider feature for - this Data Lake Store account. Possible values include: "Enabled", "Disabled". - :vartype trusted_id_provider_state: str or - ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :ivar new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :vartype new_tier: str or ~azure.mgmt.datalake.store.models.TierType - :ivar current_tier: The commitment tier in use for the current month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :vartype current_tier: str or ~azure.mgmt.datalake.store.models.TierType - """ - - _validation = { - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'default_group': {'readonly': True}, - 'encryption_config': {'readonly': True}, - 'encryption_state': {'readonly': True}, - 'encryption_provisioning_state': {'readonly': True}, - 'firewall_rules': {'readonly': True}, - 'virtual_network_rules': {'readonly': True}, - 'firewall_state': {'readonly': True}, - 'firewall_allow_azure_ips': {'readonly': True}, - 'trusted_id_providers': {'readonly': True}, - 'trusted_id_provider_state': {'readonly': True}, - 'new_tier': {'readonly': True}, - 'current_tier': {'readonly': True}, - } - - _attribute_map = { - 'account_id': {'key': 'accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'default_group': {'key': 'defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'encryptionConfig', 'type': 'EncryptionConfig'}, - 'encryption_state': {'key': 'encryptionState', 'type': 'str'}, - 'encryption_provisioning_state': {'key': 'encryptionProvisioningState', 'type': 'str'}, - 'firewall_rules': {'key': 'firewallRules', 'type': '[FirewallRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'firewall_state': {'key': 'firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'trustedIdProviders', 'type': '[TrustedIdProvider]'}, - 'trusted_id_provider_state': {'key': 'trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'newTier', 'type': 'str'}, - 'current_tier': {'key': 'currentTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountProperties, self).__init__(**kwargs) - self.default_group = None - self.encryption_config = None - self.encryption_state = None - self.encryption_provisioning_state = None - self.firewall_rules = None - self.virtual_network_rules = None - self.firewall_state = None - self.firewall_allow_azure_ips = None - self.trusted_id_providers = None - self.trusted_id_provider_state = None - self.new_tier = None - self.current_tier = None - - -class EncryptionConfig(msrest.serialization.Model): - """The encryption configuration for the account. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of encryption configuration being used. Currently the only - supported types are 'UserManaged' and 'ServiceManaged'. Possible values include: "UserManaged", - "ServiceManaged". - :type type: str or ~azure.mgmt.datalake.store.models.EncryptionConfigType - :param key_vault_meta_info: The Key Vault information for connecting to user managed encryption - keys. - :type key_vault_meta_info: ~azure.mgmt.datalake.store.models.KeyVaultMetaInfo - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'key_vault_meta_info': {'key': 'keyVaultMetaInfo', 'type': 'KeyVaultMetaInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionConfig, self).__init__(**kwargs) - self.type = kwargs['type'] - self.key_vault_meta_info = kwargs.get('key_vault_meta_info', None) - - -class EncryptionIdentity(msrest.serialization.Model): - """The encryption identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of encryption being used. Currently the only supported type is - 'SystemAssigned'. Default value: "SystemAssigned". - :vartype type: str - :ivar principal_id: The principal identifier associated with the encryption. - :vartype principal_id: str - :ivar tenant_id: The tenant identifier associated with the encryption. - :vartype tenant_id: str - """ - - _validation = { - 'type': {'required': True, 'constant': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(EncryptionIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class SubResource(msrest.serialization.Model): - """The resource model definition for a nested resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class FirewallRule(SubResource): - """Data Lake Store firewall rule information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or - ipv6. Start and End should be in the same protocol. - :vartype start_ip_address: str - :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or - ipv6. Start and End should be in the same protocol. - :vartype end_ip_address: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start_ip_address': {'readonly': True}, - 'end_ip_address': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FirewallRule, self).__init__(**kwargs) - self.start_ip_address = None - self.end_ip_address = None - - -class FirewallRuleListResult(msrest.serialization.Model): - """Data Lake Store firewall rule list information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The results of the list operation. - :vartype value: list[~azure.mgmt.datalake.store.models.FirewallRule] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FirewallRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FirewallRuleListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class KeyVaultMetaInfo(msrest.serialization.Model): - """Metadata information used by account encryption. - - All required parameters must be populated in order to send to Azure. - - :param key_vault_resource_id: Required. The resource identifier for the user managed Key Vault - being used to encrypt. - :type key_vault_resource_id: str - :param encryption_key_name: Required. The name of the user managed encryption key. - :type encryption_key_name: str - :param encryption_key_version: Required. The version of the user managed encryption key. - :type encryption_key_version: str - """ - - _validation = { - 'key_vault_resource_id': {'required': True}, - 'encryption_key_name': {'required': True}, - 'encryption_key_version': {'required': True}, - } - - _attribute_map = { - 'key_vault_resource_id': {'key': 'keyVaultResourceId', 'type': 'str'}, - 'encryption_key_name': {'key': 'encryptionKeyName', 'type': 'str'}, - 'encryption_key_version': {'key': 'encryptionKeyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultMetaInfo, self).__init__(**kwargs) - self.key_vault_resource_id = kwargs['key_vault_resource_id'] - self.encryption_key_name = kwargs['encryption_key_name'] - self.encryption_key_version = kwargs['encryption_key_version'] - - -class NameAvailabilityInformation(msrest.serialization.Model): - """Data Lake Store account name availability result information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: The Boolean value of true or false to indicate whether the Data Lake - Store account name is available or not. - :vartype name_available: bool - :ivar reason: The reason why the Data Lake Store account name is not available, if - nameAvailable is false. - :vartype reason: str - :ivar message: The message describing why the Data Lake Store account name is not available, if - nameAvailable is false. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailabilityInformation, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class Operation(msrest.serialization.Model): - """An available operation for Data Lake Store. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation. - :vartype name: str - :param display: The display information for the operation. - :type display: ~azure.mgmt.datalake.store.models.OperationDisplay - :ivar origin: The intended executor of the operation. Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~azure.mgmt.datalake.store.models.OperationOrigin - """ - - _validation = { - 'name': {'readonly': True}, - 'origin': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = kwargs.get('display', None) - self.origin = None - - -class OperationDisplay(msrest.serialization.Model): - """The display information for a particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The resource provider of the operation. - :vartype provider: str - :ivar resource: The resource type of the operation. - :vartype resource: str - :ivar operation: A friendly name of the operation. - :vartype operation: str - :ivar description: A friendly description of the operation. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(msrest.serialization.Model): - """The list of available operations for Data Lake Store. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The results of the list operation. - :vartype value: list[~azure.mgmt.datalake.store.models.Operation] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class TrustedIdProvider(SubResource): - """Data Lake Store trusted identity provider information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar id_provider: The URL of this trusted identity provider. - :vartype id_provider: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'id_provider': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustedIdProvider, self).__init__(**kwargs) - self.id_provider = None - - -class TrustedIdProviderListResult(msrest.serialization.Model): - """Data Lake Store trusted identity provider list information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The results of the list operation. - :vartype value: list[~azure.mgmt.datalake.store.models.TrustedIdProvider] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedIdProvider]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustedIdProviderListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDataLakeStoreAccountParameters(msrest.serialization.Model): - """Data Lake Store account information to update. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param default_group: The default owner group for all new folders and files created in the Data - Lake Store account. - :type default_group: str - :param encryption_config: Used for rotation of user managed Key Vault keys. Can only be used to - rotate a user managed encryption Key Vault key. - :type encryption_config: ~azure.mgmt.datalake.store.models.UpdateEncryptionConfig - :param firewall_rules: The list of firewall rules associated with this Data Lake Store account. - :type firewall_rules: - list[~azure.mgmt.datalake.store.models.UpdateFirewallRuleWithAccountParameters] - :param virtual_network_rules: The list of virtual network rules associated with this Data Lake - Store account. - :type virtual_network_rules: - list[~azure.mgmt.datalake.store.models.UpdateVirtualNetworkRuleWithAccountParameters] - :param firewall_state: The current state of the IP address firewall for this Data Lake Store - account. Disabling the firewall does not remove existing rules, they will just be ignored until - the firewall is re-enabled. Possible values include: "Enabled", "Disabled". - :type firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState - :param firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". - :type firewall_allow_azure_ips: str or - ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState - :param trusted_id_providers: The list of trusted identity providers associated with this Data - Lake Store account. - :type trusted_id_providers: - list[~azure.mgmt.datalake.store.models.UpdateTrustedIdProviderWithAccountParameters] - :param trusted_id_provider_state: The current state of the trusted identity provider feature - for this Data Lake Store account. Disabling trusted identity provider functionality does not - remove the providers, they will just be ignored until this feature is re-enabled. Possible - values include: "Enabled", "Disabled". - :type trusted_id_provider_state: str or - ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :param new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :type new_tier: str or ~azure.mgmt.datalake.store.models.TierType - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'default_group': {'key': 'properties.defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'properties.encryptionConfig', 'type': 'UpdateEncryptionConfig'}, - 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[UpdateFirewallRuleWithAccountParameters]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[UpdateVirtualNetworkRuleWithAccountParameters]'}, - 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'properties.trustedIdProviders', 'type': '[UpdateTrustedIdProviderWithAccountParameters]'}, - 'trusted_id_provider_state': {'key': 'properties.trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDataLakeStoreAccountParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.default_group = kwargs.get('default_group', None) - self.encryption_config = kwargs.get('encryption_config', None) - self.firewall_rules = kwargs.get('firewall_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.firewall_state = kwargs.get('firewall_state', None) - self.firewall_allow_azure_ips = kwargs.get('firewall_allow_azure_ips', None) - self.trusted_id_providers = kwargs.get('trusted_id_providers', None) - self.trusted_id_provider_state = kwargs.get('trusted_id_provider_state', None) - self.new_tier = kwargs.get('new_tier', None) - - -class UpdateEncryptionConfig(msrest.serialization.Model): - """The encryption configuration used to update a user managed Key Vault key. - - :param key_vault_meta_info: The updated Key Vault key to use in user managed key rotation. - :type key_vault_meta_info: ~azure.mgmt.datalake.store.models.UpdateKeyVaultMetaInfo - """ - - _attribute_map = { - 'key_vault_meta_info': {'key': 'keyVaultMetaInfo', 'type': 'UpdateKeyVaultMetaInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateEncryptionConfig, self).__init__(**kwargs) - self.key_vault_meta_info = kwargs.get('key_vault_meta_info', None) - - -class UpdateFirewallRuleParameters(msrest.serialization.Model): - """The parameters used to update a firewall rule. - - :param start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or - ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or - ipv6. Start and End should be in the same protocol. - :type end_ip_address: str - """ - - _attribute_map = { - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateFirewallRuleParameters, self).__init__(**kwargs) - self.start_ip_address = kwargs.get('start_ip_address', None) - self.end_ip_address = kwargs.get('end_ip_address', None) - - -class UpdateFirewallRuleWithAccountParameters(msrest.serialization.Model): - """The parameters used to update a firewall rule while updating a Data Lake Store account. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The unique name of the firewall rule to update. - :type name: str - :param start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or - ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or - ipv6. Start and End should be in the same protocol. - :type end_ip_address: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateFirewallRuleWithAccountParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.start_ip_address = kwargs.get('start_ip_address', None) - self.end_ip_address = kwargs.get('end_ip_address', None) - - -class UpdateKeyVaultMetaInfo(msrest.serialization.Model): - """The Key Vault update information used for user managed key rotation. - - :param encryption_key_version: The version of the user managed encryption key to update through - a key rotation. - :type encryption_key_version: str - """ - - _attribute_map = { - 'encryption_key_version': {'key': 'encryptionKeyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateKeyVaultMetaInfo, self).__init__(**kwargs) - self.encryption_key_version = kwargs.get('encryption_key_version', None) - - -class UpdateTrustedIdProviderParameters(msrest.serialization.Model): - """The parameters used to update a trusted identity provider. - - :param id_provider: The URL of this trusted identity provider. - :type id_provider: str - """ - - _attribute_map = { - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateTrustedIdProviderParameters, self).__init__(**kwargs) - self.id_provider = kwargs.get('id_provider', None) - - -class UpdateTrustedIdProviderWithAccountParameters(msrest.serialization.Model): - """The parameters used to update a trusted identity provider while updating a Data Lake Store account. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The unique name of the trusted identity provider to update. - :type name: str - :param id_provider: The URL of this trusted identity provider. - :type id_provider: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateTrustedIdProviderWithAccountParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.id_provider = kwargs.get('id_provider', None) - - -class UpdateVirtualNetworkRuleParameters(msrest.serialization.Model): - """The parameters used to update a virtual network rule. - - :param subnet_id: The resource identifier for the subnet. - :type subnet_id: str - """ - - _attribute_map = { - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateVirtualNetworkRuleParameters, self).__init__(**kwargs) - self.subnet_id = kwargs.get('subnet_id', None) - - -class UpdateVirtualNetworkRuleWithAccountParameters(msrest.serialization.Model): - """The parameters used to update a virtual network rule while updating a Data Lake Store account. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The unique name of the virtual network rule to update. - :type name: str - :param subnet_id: The resource identifier for the subnet. - :type subnet_id: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateVirtualNetworkRuleWithAccountParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.subnet_id = kwargs.get('subnet_id', None) - - -class Usage(msrest.serialization.Model): - """Describes the Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.datalake.store.models.UsageUnit - :ivar id: Resource identifier. - :vartype id: str - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.datalake.store.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'id': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.id = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.datalake.store.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(SubResource): - """Data Lake Store virtual network rule information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar subnet_id: The resource identifier for the subnet. - :vartype subnet_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'subnet_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.subnet_id = None - - -class VirtualNetworkRuleListResult(msrest.serialization.Model): - """Data Lake Store virtual network rule list information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The results of the list operation. - :vartype value: list[~azure.mgmt.datalake.store.models.VirtualNetworkRule] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualNetworkRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRuleListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_models_py3.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_models_py3.py index 9b9fc06e4199..5830a6dae565 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_models_py3.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -6,22 +7,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from .. import _serialization -from ._data_lake_store_account_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class CapabilityInformation(msrest.serialization.Model): +class CapabilityInformation(_serialization.Model): """Subscription-level properties and limits for Data Lake Store. Variables are only populated by the server, and will be ignored when sending a request. :ivar subscription_id: The subscription credentials that uniquely identifies the subscription. :vartype subscription_id: str - :ivar state: The subscription state. Possible values include: "Registered", "Suspended", - "Deleted", "Unregistered", "Warned". + :ivar state: The subscription state. Known values are: "Registered", "Suspended", "Deleted", + "Unregistered", and "Warned". :vartype state: str or ~azure.mgmt.datalake.store.models.SubscriptionState :ivar max_account_count: The maximum supported number of accounts under this subscription. :vartype max_account_count: int @@ -32,26 +35,24 @@ class CapabilityInformation(msrest.serialization.Model): """ _validation = { - 'subscription_id': {'readonly': True}, - 'state': {'readonly': True}, - 'max_account_count': {'readonly': True}, - 'account_count': {'readonly': True}, - 'migration_state': {'readonly': True}, + "subscription_id": {"readonly": True}, + "state": {"readonly": True}, + "max_account_count": {"readonly": True}, + "account_count": {"readonly": True}, + "migration_state": {"readonly": True}, } _attribute_map = { - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'max_account_count': {'key': 'maxAccountCount', 'type': 'int'}, - 'account_count': {'key': 'accountCount', 'type': 'int'}, - 'migration_state': {'key': 'migrationState', 'type': 'bool'}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "max_account_count": {"key": "maxAccountCount", "type": "int"}, + "account_count": {"key": "accountCount", "type": "int"}, + "migration_state": {"key": "migrationState", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - super(CapabilityInformation, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.subscription_id = None self.state = None self.max_account_count = None @@ -59,109 +60,115 @@ def __init__( self.migration_state = None -class CheckNameAvailabilityParameters(msrest.serialization.Model): +class CheckNameAvailabilityParameters(_serialization.Model): """Data Lake Store account name availability check parameters. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param name: Required. The Data Lake Store name to check availability for. - :type name: str - :ivar type: Required. The resource type. Note: This should not be set by the user, as the - constant value is Microsoft.DataLakeStore/accounts. Default value: - "Microsoft.DataLakeStore/accounts". - :vartype type: str + :ivar name: The Data Lake Store name to check availability for. Required. + :vartype name: str + :ivar type: The resource type. Note: This should not be set by the user, as the constant value + is Microsoft.DataLakeStore/accounts. Required. "Microsoft.DataLakeStore/accounts" + :vartype type: str or ~azure.mgmt.datalake.store.models.CheckNameAvailabilityParametersType """ _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, + "name": {"required": True}, + "type": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - type = "Microsoft.DataLakeStore/accounts" - def __init__( - self, - *, - name: str, - **kwargs - ): - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) + self, *, name: str, type: Union[str, "_models.CheckNameAvailabilityParametersType"], **kwargs: Any + ) -> None: + """ + :keyword name: The Data Lake Store name to check availability for. Required. + :paramtype name: str + :keyword type: The resource type. Note: This should not be set by the user, as the constant + value is Microsoft.DataLakeStore/accounts. Required. "Microsoft.DataLakeStore/accounts" + :paramtype type: str or ~azure.mgmt.datalake.store.models.CheckNameAvailabilityParametersType + """ + super().__init__(**kwargs) self.name = name + self.type = type -class CreateDataLakeStoreAccountParameters(msrest.serialization.Model): +class CreateDataLakeStoreAccountParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """CreateDataLakeStoreAccountParameters. All required parameters must be populated in order to send to Azure. - :param location: Required. The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param identity: The Key Vault encryption identity, if any. - :type identity: ~azure.mgmt.datalake.store.models.EncryptionIdentity - :param default_group: The default owner group for all new folders and files created in the Data + :ivar location: The resource location. Required. + :vartype location: str + :ivar tags: The resource tags. + :vartype tags: dict[str, str] + :ivar identity: The Key Vault encryption identity, if any. + :vartype identity: ~azure.mgmt.datalake.store.models.EncryptionIdentity + :ivar default_group: The default owner group for all new folders and files created in the Data Lake Store account. - :type default_group: str - :param encryption_config: The Key Vault encryption configuration. - :type encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig - :param encryption_state: The current state of encryption for this Data Lake Store account. - Possible values include: "Enabled", "Disabled". - :type encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState - :param firewall_rules: The list of firewall rules associated with this Data Lake Store account. - :type firewall_rules: + :vartype default_group: str + :ivar encryption_config: The Key Vault encryption configuration. + :vartype encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig + :ivar encryption_state: The current state of encryption for this Data Lake Store account. Known + values are: "Enabled" and "Disabled". + :vartype encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState + :ivar firewall_rules: The list of firewall rules associated with this Data Lake Store account. + :vartype firewall_rules: list[~azure.mgmt.datalake.store.models.CreateFirewallRuleWithAccountParameters] - :param virtual_network_rules: The list of virtual network rules associated with this Data Lake + :ivar virtual_network_rules: The list of virtual network rules associated with this Data Lake Store account. - :type virtual_network_rules: + :vartype virtual_network_rules: list[~azure.mgmt.datalake.store.models.CreateVirtualNetworkRuleWithAccountParameters] - :param firewall_state: The current state of the IP address firewall for this Data Lake Store - account. Possible values include: "Enabled", "Disabled". - :type firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState - :param firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". - :type firewall_allow_azure_ips: str or + :ivar firewall_state: The current state of the IP address firewall for this Data Lake Store + account. Known values are: "Enabled" and "Disabled". + :vartype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState + :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled" and "Disabled". + :vartype firewall_allow_azure_ips: str or ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState - :param trusted_id_providers: The list of trusted identity providers associated with this Data + :ivar trusted_id_providers: The list of trusted identity providers associated with this Data Lake Store account. - :type trusted_id_providers: + :vartype trusted_id_providers: list[~azure.mgmt.datalake.store.models.CreateTrustedIdProviderWithAccountParameters] - :param trusted_id_provider_state: The current state of the trusted identity provider feature - for this Data Lake Store account. Possible values include: "Enabled", "Disabled". - :type trusted_id_provider_state: str or + :ivar trusted_id_provider_state: The current state of the trusted identity provider feature for + this Data Lake Store account. Known values are: "Enabled" and "Disabled". + :vartype trusted_id_provider_state: str or ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :param new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :type new_tier: str or ~azure.mgmt.datalake.store.models.TierType + :ivar new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", "Commitment_1PB", + and "Commitment_5PB". + :vartype new_tier: str or ~azure.mgmt.datalake.store.models.TierType """ _validation = { - 'location': {'required': True}, + "location": {"required": True}, } _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - 'default_group': {'key': 'properties.defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'properties.encryptionConfig', 'type': 'EncryptionConfig'}, - 'encryption_state': {'key': 'properties.encryptionState', 'type': 'str'}, - 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[CreateFirewallRuleWithAccountParameters]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[CreateVirtualNetworkRuleWithAccountParameters]'}, - 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'properties.trustedIdProviders', 'type': '[CreateTrustedIdProviderWithAccountParameters]'}, - 'trusted_id_provider_state': {'key': 'properties.trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "EncryptionIdentity"}, + "default_group": {"key": "properties.defaultGroup", "type": "str"}, + "encryption_config": {"key": "properties.encryptionConfig", "type": "EncryptionConfig"}, + "encryption_state": {"key": "properties.encryptionState", "type": "str"}, + "firewall_rules": {"key": "properties.firewallRules", "type": "[CreateFirewallRuleWithAccountParameters]"}, + "virtual_network_rules": { + "key": "properties.virtualNetworkRules", + "type": "[CreateVirtualNetworkRuleWithAccountParameters]", + }, + "firewall_state": {"key": "properties.firewallState", "type": "str"}, + "firewall_allow_azure_ips": {"key": "properties.firewallAllowAzureIps", "type": "str"}, + "trusted_id_providers": { + "key": "properties.trustedIdProviders", + "type": "[CreateTrustedIdProviderWithAccountParameters]", + }, + "trusted_id_provider_state": {"key": "properties.trustedIdProviderState", "type": "str"}, + "new_tier": {"key": "properties.newTier", "type": "str"}, } def __init__( @@ -169,20 +176,64 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["EncryptionIdentity"] = None, + identity: Optional["_models.EncryptionIdentity"] = None, default_group: Optional[str] = None, - encryption_config: Optional["EncryptionConfig"] = None, - encryption_state: Optional[Union[str, "EncryptionState"]] = None, - firewall_rules: Optional[List["CreateFirewallRuleWithAccountParameters"]] = None, - virtual_network_rules: Optional[List["CreateVirtualNetworkRuleWithAccountParameters"]] = None, - firewall_state: Optional[Union[str, "FirewallState"]] = None, - firewall_allow_azure_ips: Optional[Union[str, "FirewallAllowAzureIpsState"]] = None, - trusted_id_providers: Optional[List["CreateTrustedIdProviderWithAccountParameters"]] = None, - trusted_id_provider_state: Optional[Union[str, "TrustedIdProviderState"]] = None, - new_tier: Optional[Union[str, "TierType"]] = None, - **kwargs - ): - super(CreateDataLakeStoreAccountParameters, self).__init__(**kwargs) + encryption_config: Optional["_models.EncryptionConfig"] = None, + encryption_state: Optional[Union[str, "_models.EncryptionState"]] = None, + firewall_rules: Optional[List["_models.CreateFirewallRuleWithAccountParameters"]] = None, + virtual_network_rules: Optional[List["_models.CreateVirtualNetworkRuleWithAccountParameters"]] = None, + firewall_state: Optional[Union[str, "_models.FirewallState"]] = None, + firewall_allow_azure_ips: Optional[Union[str, "_models.FirewallAllowAzureIpsState"]] = None, + trusted_id_providers: Optional[List["_models.CreateTrustedIdProviderWithAccountParameters"]] = None, + trusted_id_provider_state: Optional[Union[str, "_models.TrustedIdProviderState"]] = None, + new_tier: Optional[Union[str, "_models.TierType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The resource location. Required. + :paramtype location: str + :keyword tags: The resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The Key Vault encryption identity, if any. + :paramtype identity: ~azure.mgmt.datalake.store.models.EncryptionIdentity + :keyword default_group: The default owner group for all new folders and files created in the + Data Lake Store account. + :paramtype default_group: str + :keyword encryption_config: The Key Vault encryption configuration. + :paramtype encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig + :keyword encryption_state: The current state of encryption for this Data Lake Store account. + Known values are: "Enabled" and "Disabled". + :paramtype encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState + :keyword firewall_rules: The list of firewall rules associated with this Data Lake Store + account. + :paramtype firewall_rules: + list[~azure.mgmt.datalake.store.models.CreateFirewallRuleWithAccountParameters] + :keyword virtual_network_rules: The list of virtual network rules associated with this Data + Lake Store account. + :paramtype virtual_network_rules: + list[~azure.mgmt.datalake.store.models.CreateVirtualNetworkRuleWithAccountParameters] + :keyword firewall_state: The current state of the IP address firewall for this Data Lake Store + account. Known values are: "Enabled" and "Disabled". + :paramtype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState + :keyword firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled" and "Disabled". + :paramtype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState + :keyword trusted_id_providers: The list of trusted identity providers associated with this Data + Lake Store account. + :paramtype trusted_id_providers: + list[~azure.mgmt.datalake.store.models.CreateTrustedIdProviderWithAccountParameters] + :keyword trusted_id_provider_state: The current state of the trusted identity provider feature + for this Data Lake Store account. Known values are: "Enabled" and "Disabled". + :paramtype trusted_id_provider_state: str or + ~azure.mgmt.datalake.store.models.TrustedIdProviderState + :keyword new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", "Commitment_1PB", + and "Commitment_5PB". + :paramtype new_tier: str or ~azure.mgmt.datalake.store.models.TierType + """ + super().__init__(**kwargs) self.location = location self.tags = tags self.identity = identity @@ -198,203 +249,208 @@ def __init__( self.new_tier = new_tier -class CreateFirewallRuleWithAccountParameters(msrest.serialization.Model): +class CreateFirewallRuleWithAccountParameters(_serialization.Model): """The parameters used to create a new firewall rule while creating a new Data Lake Store account. All required parameters must be populated in order to send to Azure. - :param name: Required. The unique name of the firewall rule to create. - :type name: str - :param start_ip_address: Required. The start IP address for the firewall rule. This can be - either ipv4 or ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: Required. The end IP address for the firewall rule. This can be either - ipv4 or ipv6. Start and End should be in the same protocol. - :type end_ip_address: str + :ivar name: The unique name of the firewall rule to create. Required. + :vartype name: str + :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. Required. + :vartype start_ip_address: str + :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. Required. + :vartype end_ip_address: str """ _validation = { - 'name': {'required': True}, - 'start_ip_address': {'required': True}, - 'end_ip_address': {'required': True}, + "name": {"required": True}, + "start_ip_address": {"required": True}, + "end_ip_address": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - start_ip_address: str, - end_ip_address: str, - **kwargs - ): - super(CreateFirewallRuleWithAccountParameters, self).__init__(**kwargs) + "name": {"key": "name", "type": "str"}, + "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, + "end_ip_address": {"key": "properties.endIpAddress", "type": "str"}, + } + + def __init__(self, *, name: str, start_ip_address: str, end_ip_address: str, **kwargs: Any) -> None: + """ + :keyword name: The unique name of the firewall rule to create. Required. + :paramtype name: str + :keyword start_ip_address: The start IP address for the firewall rule. This can be either ipv4 + or ipv6. Start and End should be in the same protocol. Required. + :paramtype start_ip_address: str + :keyword end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. Required. + :paramtype end_ip_address: str + """ + super().__init__(**kwargs) self.name = name self.start_ip_address = start_ip_address self.end_ip_address = end_ip_address -class CreateOrUpdateFirewallRuleParameters(msrest.serialization.Model): +class CreateOrUpdateFirewallRuleParameters(_serialization.Model): """The parameters used to create a new firewall rule. All required parameters must be populated in order to send to Azure. - :param start_ip_address: Required. The start IP address for the firewall rule. This can be - either ipv4 or ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: Required. The end IP address for the firewall rule. This can be either - ipv4 or ipv6. Start and End should be in the same protocol. - :type end_ip_address: str + :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. Required. + :vartype start_ip_address: str + :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. Required. + :vartype end_ip_address: str """ _validation = { - 'start_ip_address': {'required': True}, - 'end_ip_address': {'required': True}, + "start_ip_address": {"required": True}, + "end_ip_address": {"required": True}, } _attribute_map = { - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - } - - def __init__( - self, - *, - start_ip_address: str, - end_ip_address: str, - **kwargs - ): - super(CreateOrUpdateFirewallRuleParameters, self).__init__(**kwargs) + "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, + "end_ip_address": {"key": "properties.endIpAddress", "type": "str"}, + } + + def __init__(self, *, start_ip_address: str, end_ip_address: str, **kwargs: Any) -> None: + """ + :keyword start_ip_address: The start IP address for the firewall rule. This can be either ipv4 + or ipv6. Start and End should be in the same protocol. Required. + :paramtype start_ip_address: str + :keyword end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. Required. + :paramtype end_ip_address: str + """ + super().__init__(**kwargs) self.start_ip_address = start_ip_address self.end_ip_address = end_ip_address -class CreateOrUpdateTrustedIdProviderParameters(msrest.serialization.Model): +class CreateOrUpdateTrustedIdProviderParameters(_serialization.Model): """The parameters used to create a new trusted identity provider. All required parameters must be populated in order to send to Azure. - :param id_provider: Required. The URL of this trusted identity provider. - :type id_provider: str + :ivar id_provider: The URL of this trusted identity provider. Required. + :vartype id_provider: str """ _validation = { - 'id_provider': {'required': True}, + "id_provider": {"required": True}, } _attribute_map = { - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, + "id_provider": {"key": "properties.idProvider", "type": "str"}, } - def __init__( - self, - *, - id_provider: str, - **kwargs - ): - super(CreateOrUpdateTrustedIdProviderParameters, self).__init__(**kwargs) + def __init__(self, *, id_provider: str, **kwargs: Any) -> None: + """ + :keyword id_provider: The URL of this trusted identity provider. Required. + :paramtype id_provider: str + """ + super().__init__(**kwargs) self.id_provider = id_provider -class CreateOrUpdateVirtualNetworkRuleParameters(msrest.serialization.Model): +class CreateOrUpdateVirtualNetworkRuleParameters(_serialization.Model): """The parameters used to create a new virtual network rule. All required parameters must be populated in order to send to Azure. - :param subnet_id: Required. The resource identifier for the subnet. - :type subnet_id: str + :ivar subnet_id: The resource identifier for the subnet. Required. + :vartype subnet_id: str """ _validation = { - 'subnet_id': {'required': True}, + "subnet_id": {"required": True}, } _attribute_map = { - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + "subnet_id": {"key": "properties.subnetId", "type": "str"}, } - def __init__( - self, - *, - subnet_id: str, - **kwargs - ): - super(CreateOrUpdateVirtualNetworkRuleParameters, self).__init__(**kwargs) + def __init__(self, *, subnet_id: str, **kwargs: Any) -> None: + """ + :keyword subnet_id: The resource identifier for the subnet. Required. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) self.subnet_id = subnet_id -class CreateTrustedIdProviderWithAccountParameters(msrest.serialization.Model): - """The parameters used to create a new trusted identity provider while creating a new Data Lake Store account. +class CreateTrustedIdProviderWithAccountParameters(_serialization.Model): + """The parameters used to create a new trusted identity provider while creating a new Data Lake + Store account. All required parameters must be populated in order to send to Azure. - :param name: Required. The unique name of the trusted identity provider to create. - :type name: str - :param id_provider: Required. The URL of this trusted identity provider. - :type id_provider: str + :ivar name: The unique name of the trusted identity provider to create. Required. + :vartype name: str + :ivar id_provider: The URL of this trusted identity provider. Required. + :vartype id_provider: str """ _validation = { - 'name': {'required': True}, - 'id_provider': {'required': True}, + "name": {"required": True}, + "id_provider": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - id_provider: str, - **kwargs - ): - super(CreateTrustedIdProviderWithAccountParameters, self).__init__(**kwargs) + "name": {"key": "name", "type": "str"}, + "id_provider": {"key": "properties.idProvider", "type": "str"}, + } + + def __init__(self, *, name: str, id_provider: str, **kwargs: Any) -> None: + """ + :keyword name: The unique name of the trusted identity provider to create. Required. + :paramtype name: str + :keyword id_provider: The URL of this trusted identity provider. Required. + :paramtype id_provider: str + """ + super().__init__(**kwargs) self.name = name self.id_provider = id_provider -class CreateVirtualNetworkRuleWithAccountParameters(msrest.serialization.Model): - """The parameters used to create a new virtual network rule while creating a new Data Lake Store account. +class CreateVirtualNetworkRuleWithAccountParameters(_serialization.Model): + """The parameters used to create a new virtual network rule while creating a new Data Lake Store + account. All required parameters must be populated in order to send to Azure. - :param name: Required. The unique name of the virtual network rule to create. - :type name: str - :param subnet_id: Required. The resource identifier for the subnet. - :type subnet_id: str + :ivar name: The unique name of the virtual network rule to create. Required. + :vartype name: str + :ivar subnet_id: The resource identifier for the subnet. Required. + :vartype subnet_id: str """ _validation = { - 'name': {'required': True}, - 'subnet_id': {'required': True}, + "name": {"required": True}, + "subnet_id": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - subnet_id: str, - **kwargs - ): - super(CreateVirtualNetworkRuleWithAccountParameters, self).__init__(**kwargs) + "name": {"key": "name", "type": "str"}, + "subnet_id": {"key": "properties.subnetId", "type": "str"}, + } + + def __init__(self, *, name: str, subnet_id: str, **kwargs: Any) -> None: + """ + :keyword name: The unique name of the virtual network rule to create. Required. + :paramtype name: str + :keyword subnet_id: The resource identifier for the subnet. Required. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) self.name = name self.subnet_id = subnet_id -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -407,31 +463,29 @@ class Resource(msrest.serialization.Model): :vartype type: str :ivar location: The resource location. :vartype location: str - :ivar tags: A set of tags. The resource tags. + :ivar tags: The resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "tags": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -439,7 +493,7 @@ def __init__( self.tags = None -class DataLakeStoreAccount(Resource): +class DataLakeStoreAccount(Resource): # pylint: disable=too-many-instance-attributes """Data Lake Store account information. Variables are only populated by the server, and will be ignored when sending a request. @@ -452,18 +506,18 @@ class DataLakeStoreAccount(Resource): :vartype type: str :ivar location: The resource location. :vartype location: str - :ivar tags: A set of tags. The resource tags. + :ivar tags: The resource tags. :vartype tags: dict[str, str] :ivar identity: The Key Vault encryption identity, if any. :vartype identity: ~azure.mgmt.datalake.store.models.EncryptionIdentity :ivar account_id: The unique identifier associated with this Data Lake Store account. :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". + :ivar provisioning_state: The provisioning status of the Data Lake Store account. Known values + are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", + :ivar state: The state of the Data Lake Store account. Known values are: "Active" and "Suspended". :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState :ivar creation_time: The account creation time. @@ -477,11 +531,11 @@ class DataLakeStoreAccount(Resource): :vartype default_group: str :ivar encryption_config: The Key Vault encryption configuration. :vartype encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig - :ivar encryption_state: The current state of encryption for this Data Lake Store account. - Possible values include: "Enabled", "Disabled". + :ivar encryption_state: The current state of encryption for this Data Lake Store account. Known + values are: "Enabled" and "Disabled". :vartype encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState :ivar encryption_provisioning_state: The current state of encryption provisioning for this Data - Lake Store account. Possible values include: "Creating", "Succeeded". + Lake Store account. Known values are: "Creating" and "Succeeded". :vartype encryption_provisioning_state: str or ~azure.mgmt.datalake.store.models.EncryptionProvisioningState :ivar firewall_rules: The list of firewall rules associated with this Data Lake Store account. @@ -490,89 +544,87 @@ class DataLakeStoreAccount(Resource): Store account. :vartype virtual_network_rules: list[~azure.mgmt.datalake.store.models.VirtualNetworkRule] :ivar firewall_state: The current state of the IP address firewall for this Data Lake Store - account. Possible values include: "Enabled", "Disabled". + account. Known values are: "Enabled" and "Disabled". :vartype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled" and "Disabled". :vartype firewall_allow_azure_ips: str or ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState :ivar trusted_id_providers: The list of trusted identity providers associated with this Data Lake Store account. :vartype trusted_id_providers: list[~azure.mgmt.datalake.store.models.TrustedIdProvider] :ivar trusted_id_provider_state: The current state of the trusted identity provider feature for - this Data Lake Store account. Possible values include: "Enabled", "Disabled". + this Data Lake Store account. Known values are: "Enabled" and "Disabled". :vartype trusted_id_provider_state: str or ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :ivar new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". + :ivar new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", "Commitment_1PB", + and "Commitment_5PB". :vartype new_tier: str or ~azure.mgmt.datalake.store.models.TierType - :ivar current_tier: The commitment tier in use for the current month. Possible values include: + :ivar current_tier: The commitment tier in use for the current month. Known values are: "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". + "Commitment_1PB", and "Commitment_5PB". :vartype current_tier: str or ~azure.mgmt.datalake.store.models.TierType """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'identity': {'readonly': True}, - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'default_group': {'readonly': True}, - 'encryption_config': {'readonly': True}, - 'encryption_state': {'readonly': True}, - 'encryption_provisioning_state': {'readonly': True}, - 'firewall_rules': {'readonly': True}, - 'virtual_network_rules': {'readonly': True}, - 'firewall_state': {'readonly': True}, - 'firewall_allow_azure_ips': {'readonly': True}, - 'trusted_id_providers': {'readonly': True}, - 'trusted_id_provider_state': {'readonly': True}, - 'new_tier': {'readonly': True}, - 'current_tier': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "tags": {"readonly": True}, + "identity": {"readonly": True}, + "account_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "state": {"readonly": True}, + "creation_time": {"readonly": True}, + "last_modified_time": {"readonly": True}, + "endpoint": {"readonly": True}, + "default_group": {"readonly": True}, + "encryption_config": {"readonly": True}, + "encryption_state": {"readonly": True}, + "encryption_provisioning_state": {"readonly": True}, + "firewall_rules": {"readonly": True}, + "virtual_network_rules": {"readonly": True}, + "firewall_state": {"readonly": True}, + "firewall_allow_azure_ips": {"readonly": True}, + "trusted_id_providers": {"readonly": True}, + "trusted_id_provider_state": {"readonly": True}, + "new_tier": {"readonly": True}, + "current_tier": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - 'account_id': {'key': 'properties.accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'default_group': {'key': 'properties.defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'properties.encryptionConfig', 'type': 'EncryptionConfig'}, - 'encryption_state': {'key': 'properties.encryptionState', 'type': 'str'}, - 'encryption_provisioning_state': {'key': 'properties.encryptionProvisioningState', 'type': 'str'}, - 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'properties.trustedIdProviders', 'type': '[TrustedIdProvider]'}, - 'trusted_id_provider_state': {'key': 'properties.trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, - 'current_tier': {'key': 'properties.currentTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccount, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "EncryptionIdentity"}, + "account_id": {"key": "properties.accountId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, + "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, + "endpoint": {"key": "properties.endpoint", "type": "str"}, + "default_group": {"key": "properties.defaultGroup", "type": "str"}, + "encryption_config": {"key": "properties.encryptionConfig", "type": "EncryptionConfig"}, + "encryption_state": {"key": "properties.encryptionState", "type": "str"}, + "encryption_provisioning_state": {"key": "properties.encryptionProvisioningState", "type": "str"}, + "firewall_rules": {"key": "properties.firewallRules", "type": "[FirewallRule]"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[VirtualNetworkRule]"}, + "firewall_state": {"key": "properties.firewallState", "type": "str"}, + "firewall_allow_azure_ips": {"key": "properties.firewallAllowAzureIps", "type": "str"}, + "trusted_id_providers": {"key": "properties.trustedIdProviders", "type": "[TrustedIdProvider]"}, + "trusted_id_provider_state": {"key": "properties.trustedIdProviderState", "type": "str"}, + "new_tier": {"key": "properties.newTier", "type": "str"}, + "current_tier": {"key": "properties.currentTier", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals + """ """ + super().__init__(**kwargs) self.identity = None self.account_id = None self.provisioning_state = None @@ -594,7 +646,7 @@ def __init__( self.current_tier = None -class DataLakeStoreAccountBasic(Resource): +class DataLakeStoreAccountBasic(Resource): # pylint: disable=too-many-instance-attributes """Basic Data Lake Store account information, returned on list calls. Variables are only populated by the server, and will be ignored when sending a request. @@ -607,16 +659,16 @@ class DataLakeStoreAccountBasic(Resource): :vartype type: str :ivar location: The resource location. :vartype location: str - :ivar tags: A set of tags. The resource tags. + :ivar tags: The resource tags. :vartype tags: dict[str, str] :ivar account_id: The unique identifier associated with this Data Lake Store account. :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". + :ivar provisioning_state: The provisioning status of the Data Lake Store account. Known values + are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", + :ivar state: The state of the Data Lake Store account. Known values are: "Active" and "Suspended". :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState :ivar creation_time: The account creation time. @@ -628,38 +680,36 @@ class DataLakeStoreAccountBasic(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "tags": {"readonly": True}, + "account_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "state": {"readonly": True}, + "creation_time": {"readonly": True}, + "last_modified_time": {"readonly": True}, + "endpoint": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_id': {'key': 'properties.accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountBasic, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "account_id": {"key": "properties.accountId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, + "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, + "endpoint": {"key": "properties.endpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.account_id = None self.provisioning_state = None self.state = None @@ -668,7 +718,7 @@ def __init__( self.endpoint = None -class DataLakeStoreAccountListResult(msrest.serialization.Model): +class DataLakeStoreAccountListResult(_serialization.Model): """Data Lake Store account list information response. Variables are only populated by the server, and will be ignored when sending a request. @@ -680,37 +730,36 @@ class DataLakeStoreAccountListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DataLakeStoreAccountBasic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DataLakeStoreAccountBasic]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class DataLakeStoreAccountPropertiesBasic(msrest.serialization.Model): - """The basic account specific properties that are associated with an underlying Data Lake Store account. +class DataLakeStoreAccountPropertiesBasic(_serialization.Model): + """The basic account specific properties that are associated with an underlying Data Lake Store + account. Variables are only populated by the server, and will be ignored when sending a request. :ivar account_id: The unique identifier associated with this Data Lake Store account. :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". + :ivar provisioning_state: The provisioning status of the Data Lake Store account. Known values + are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", + :ivar state: The state of the Data Lake Store account. Known values are: "Active" and "Suspended". :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState :ivar creation_time: The account creation time. @@ -722,28 +771,26 @@ class DataLakeStoreAccountPropertiesBasic(msrest.serialization.Model): """ _validation = { - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, + "account_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "state": {"readonly": True}, + "creation_time": {"readonly": True}, + "last_modified_time": {"readonly": True}, + "endpoint": {"readonly": True}, } _attribute_map = { - 'account_id': {'key': 'accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, + "account_id": {"key": "accountId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, + "endpoint": {"key": "endpoint", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountPropertiesBasic, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.account_id = None self.provisioning_state = None self.state = None @@ -752,19 +799,21 @@ def __init__( self.endpoint = None -class DataLakeStoreAccountProperties(DataLakeStoreAccountPropertiesBasic): +class DataLakeStoreAccountProperties( + DataLakeStoreAccountPropertiesBasic +): # pylint: disable=too-many-instance-attributes """Data Lake Store account properties information. Variables are only populated by the server, and will be ignored when sending a request. :ivar account_id: The unique identifier associated with this Data Lake Store account. :vartype account_id: str - :ivar provisioning_state: The provisioning status of the Data Lake Store account. Possible - values include: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", - "Resuming", "Deleting", "Deleted", "Undeleting", "Canceled". + :ivar provisioning_state: The provisioning status of the Data Lake Store account. Known values + are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus - :ivar state: The state of the Data Lake Store account. Possible values include: "Active", + :ivar state: The state of the Data Lake Store account. Known values are: "Active" and "Suspended". :vartype state: str or ~azure.mgmt.datalake.store.models.DataLakeStoreAccountState :ivar creation_time: The account creation time. @@ -778,11 +827,11 @@ class DataLakeStoreAccountProperties(DataLakeStoreAccountPropertiesBasic): :vartype default_group: str :ivar encryption_config: The Key Vault encryption configuration. :vartype encryption_config: ~azure.mgmt.datalake.store.models.EncryptionConfig - :ivar encryption_state: The current state of encryption for this Data Lake Store account. - Possible values include: "Enabled", "Disabled". + :ivar encryption_state: The current state of encryption for this Data Lake Store account. Known + values are: "Enabled" and "Disabled". :vartype encryption_state: str or ~azure.mgmt.datalake.store.models.EncryptionState :ivar encryption_provisioning_state: The current state of encryption provisioning for this Data - Lake Store account. Possible values include: "Creating", "Succeeded". + Lake Store account. Known values are: "Creating" and "Succeeded". :vartype encryption_provisioning_state: str or ~azure.mgmt.datalake.store.models.EncryptionProvisioningState :ivar firewall_rules: The list of firewall rules associated with this Data Lake Store account. @@ -791,77 +840,75 @@ class DataLakeStoreAccountProperties(DataLakeStoreAccountPropertiesBasic): Store account. :vartype virtual_network_rules: list[~azure.mgmt.datalake.store.models.VirtualNetworkRule] :ivar firewall_state: The current state of the IP address firewall for this Data Lake Store - account. Possible values include: "Enabled", "Disabled". + account. Known values are: "Enabled" and "Disabled". :vartype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled" and "Disabled". :vartype firewall_allow_azure_ips: str or ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState :ivar trusted_id_providers: The list of trusted identity providers associated with this Data Lake Store account. :vartype trusted_id_providers: list[~azure.mgmt.datalake.store.models.TrustedIdProvider] :ivar trusted_id_provider_state: The current state of the trusted identity provider feature for - this Data Lake Store account. Possible values include: "Enabled", "Disabled". + this Data Lake Store account. Known values are: "Enabled" and "Disabled". :vartype trusted_id_provider_state: str or ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :ivar new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". + :ivar new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", "Commitment_1PB", + and "Commitment_5PB". :vartype new_tier: str or ~azure.mgmt.datalake.store.models.TierType - :ivar current_tier: The commitment tier in use for the current month. Possible values include: + :ivar current_tier: The commitment tier in use for the current month. Known values are: "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". + "Commitment_1PB", and "Commitment_5PB". :vartype current_tier: str or ~azure.mgmt.datalake.store.models.TierType """ _validation = { - 'account_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'default_group': {'readonly': True}, - 'encryption_config': {'readonly': True}, - 'encryption_state': {'readonly': True}, - 'encryption_provisioning_state': {'readonly': True}, - 'firewall_rules': {'readonly': True}, - 'virtual_network_rules': {'readonly': True}, - 'firewall_state': {'readonly': True}, - 'firewall_allow_azure_ips': {'readonly': True}, - 'trusted_id_providers': {'readonly': True}, - 'trusted_id_provider_state': {'readonly': True}, - 'new_tier': {'readonly': True}, - 'current_tier': {'readonly': True}, + "account_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "state": {"readonly": True}, + "creation_time": {"readonly": True}, + "last_modified_time": {"readonly": True}, + "endpoint": {"readonly": True}, + "default_group": {"readonly": True}, + "encryption_config": {"readonly": True}, + "encryption_state": {"readonly": True}, + "encryption_provisioning_state": {"readonly": True}, + "firewall_rules": {"readonly": True}, + "virtual_network_rules": {"readonly": True}, + "firewall_state": {"readonly": True}, + "firewall_allow_azure_ips": {"readonly": True}, + "trusted_id_providers": {"readonly": True}, + "trusted_id_provider_state": {"readonly": True}, + "new_tier": {"readonly": True}, + "current_tier": {"readonly": True}, } _attribute_map = { - 'account_id': {'key': 'accountId', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'default_group': {'key': 'defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'encryptionConfig', 'type': 'EncryptionConfig'}, - 'encryption_state': {'key': 'encryptionState', 'type': 'str'}, - 'encryption_provisioning_state': {'key': 'encryptionProvisioningState', 'type': 'str'}, - 'firewall_rules': {'key': 'firewallRules', 'type': '[FirewallRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'firewall_state': {'key': 'firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'trustedIdProviders', 'type': '[TrustedIdProvider]'}, - 'trusted_id_provider_state': {'key': 'trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'newTier', 'type': 'str'}, - 'current_tier': {'key': 'currentTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStoreAccountProperties, self).__init__(**kwargs) + "account_id": {"key": "accountId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, + "endpoint": {"key": "endpoint", "type": "str"}, + "default_group": {"key": "defaultGroup", "type": "str"}, + "encryption_config": {"key": "encryptionConfig", "type": "EncryptionConfig"}, + "encryption_state": {"key": "encryptionState", "type": "str"}, + "encryption_provisioning_state": {"key": "encryptionProvisioningState", "type": "str"}, + "firewall_rules": {"key": "firewallRules", "type": "[FirewallRule]"}, + "virtual_network_rules": {"key": "virtualNetworkRules", "type": "[VirtualNetworkRule]"}, + "firewall_state": {"key": "firewallState", "type": "str"}, + "firewall_allow_azure_ips": {"key": "firewallAllowAzureIps", "type": "str"}, + "trusted_id_providers": {"key": "trustedIdProviders", "type": "[TrustedIdProvider]"}, + "trusted_id_provider_state": {"key": "trustedIdProviderState", "type": "str"}, + "new_tier": {"key": "newTier", "type": "str"}, + "current_tier": {"key": "currentTier", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.default_group = None self.encryption_config = None self.encryption_state = None @@ -876,50 +923,59 @@ def __init__( self.current_tier = None -class EncryptionConfig(msrest.serialization.Model): +class EncryptionConfig(_serialization.Model): """The encryption configuration for the account. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of encryption configuration being used. Currently the only - supported types are 'UserManaged' and 'ServiceManaged'. Possible values include: "UserManaged", + :ivar type: The type of encryption configuration being used. Currently the only supported types + are 'UserManaged' and 'ServiceManaged'. Required. Known values are: "UserManaged" and "ServiceManaged". - :type type: str or ~azure.mgmt.datalake.store.models.EncryptionConfigType - :param key_vault_meta_info: The Key Vault information for connecting to user managed encryption + :vartype type: str or ~azure.mgmt.datalake.store.models.EncryptionConfigType + :ivar key_vault_meta_info: The Key Vault information for connecting to user managed encryption keys. - :type key_vault_meta_info: ~azure.mgmt.datalake.store.models.KeyVaultMetaInfo + :vartype key_vault_meta_info: ~azure.mgmt.datalake.store.models.KeyVaultMetaInfo """ _validation = { - 'type': {'required': True}, + "type": {"required": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'key_vault_meta_info': {'key': 'keyVaultMetaInfo', 'type': 'KeyVaultMetaInfo'}, + "type": {"key": "type", "type": "str"}, + "key_vault_meta_info": {"key": "keyVaultMetaInfo", "type": "KeyVaultMetaInfo"}, } def __init__( self, *, - type: Union[str, "EncryptionConfigType"], - key_vault_meta_info: Optional["KeyVaultMetaInfo"] = None, - **kwargs - ): - super(EncryptionConfig, self).__init__(**kwargs) + type: Union[str, "_models.EncryptionConfigType"], + key_vault_meta_info: Optional["_models.KeyVaultMetaInfo"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of encryption configuration being used. Currently the only supported + types are 'UserManaged' and 'ServiceManaged'. Required. Known values are: "UserManaged" and + "ServiceManaged". + :paramtype type: str or ~azure.mgmt.datalake.store.models.EncryptionConfigType + :keyword key_vault_meta_info: The Key Vault information for connecting to user managed + encryption keys. + :paramtype key_vault_meta_info: ~azure.mgmt.datalake.store.models.KeyVaultMetaInfo + """ + super().__init__(**kwargs) self.type = type self.key_vault_meta_info = key_vault_meta_info -class EncryptionIdentity(msrest.serialization.Model): +class EncryptionIdentity(_serialization.Model): """The encryption identity properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of encryption being used. Currently the only supported type is - 'SystemAssigned'. Default value: "SystemAssigned". + :ivar type: The type of encryption being used. Currently the only supported type is + 'SystemAssigned'. Required. Default value is "SystemAssigned". :vartype type: str :ivar principal_id: The principal identifier associated with the encryption. :vartype principal_id: str @@ -928,29 +984,27 @@ class EncryptionIdentity(msrest.serialization.Model): """ _validation = { - 'type': {'required': True, 'constant': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "type": {"required": True, "constant": True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } type = "SystemAssigned" - def __init__( - self, - **kwargs - ): - super(EncryptionIdentity, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """The resource model definition for a nested resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -964,22 +1018,20 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1005,31 +1057,29 @@ class FirewallRule(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start_ip_address': {'readonly': True}, - 'end_ip_address': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "start_ip_address": {"readonly": True}, + "end_ip_address": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, + "end_ip_address": {"key": "properties.endIpAddress", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(FirewallRule, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.start_ip_address = None self.end_ip_address = None -class FirewallRuleListResult(msrest.serialization.Model): +class FirewallRuleListResult(_serialization.Model): """Data Lake Store firewall rule list information. Variables are only populated by the server, and will be ignored when sending a request. @@ -1041,65 +1091,67 @@ class FirewallRuleListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[FirewallRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[FirewallRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(FirewallRuleListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyVaultMetaInfo(msrest.serialization.Model): +class KeyVaultMetaInfo(_serialization.Model): """Metadata information used by account encryption. All required parameters must be populated in order to send to Azure. - :param key_vault_resource_id: Required. The resource identifier for the user managed Key Vault - being used to encrypt. - :type key_vault_resource_id: str - :param encryption_key_name: Required. The name of the user managed encryption key. - :type encryption_key_name: str - :param encryption_key_version: Required. The version of the user managed encryption key. - :type encryption_key_version: str + :ivar key_vault_resource_id: The resource identifier for the user managed Key Vault being used + to encrypt. Required. + :vartype key_vault_resource_id: str + :ivar encryption_key_name: The name of the user managed encryption key. Required. + :vartype encryption_key_name: str + :ivar encryption_key_version: The version of the user managed encryption key. Required. + :vartype encryption_key_version: str """ _validation = { - 'key_vault_resource_id': {'required': True}, - 'encryption_key_name': {'required': True}, - 'encryption_key_version': {'required': True}, + "key_vault_resource_id": {"required": True}, + "encryption_key_name": {"required": True}, + "encryption_key_version": {"required": True}, } _attribute_map = { - 'key_vault_resource_id': {'key': 'keyVaultResourceId', 'type': 'str'}, - 'encryption_key_name': {'key': 'encryptionKeyName', 'type': 'str'}, - 'encryption_key_version': {'key': 'encryptionKeyVersion', 'type': 'str'}, + "key_vault_resource_id": {"key": "keyVaultResourceId", "type": "str"}, + "encryption_key_name": {"key": "encryptionKeyName", "type": "str"}, + "encryption_key_version": {"key": "encryptionKeyVersion", "type": "str"}, } def __init__( - self, - *, - key_vault_resource_id: str, - encryption_key_name: str, - encryption_key_version: str, - **kwargs - ): - super(KeyVaultMetaInfo, self).__init__(**kwargs) + self, *, key_vault_resource_id: str, encryption_key_name: str, encryption_key_version: str, **kwargs: Any + ) -> None: + """ + :keyword key_vault_resource_id: The resource identifier for the user managed Key Vault being + used to encrypt. Required. + :paramtype key_vault_resource_id: str + :keyword encryption_key_name: The name of the user managed encryption key. Required. + :paramtype encryption_key_name: str + :keyword encryption_key_version: The version of the user managed encryption key. Required. + :paramtype encryption_key_version: str + """ + super().__init__(**kwargs) self.key_vault_resource_id = key_vault_resource_id self.encryption_key_name = encryption_key_name self.encryption_key_version = encryption_key_version -class NameAvailabilityInformation(msrest.serialization.Model): +class NameAvailabilityInformation(_serialization.Model): """Data Lake Store account name availability result information. Variables are only populated by the server, and will be ignored when sending a request. @@ -1116,65 +1168,62 @@ class NameAvailabilityInformation(msrest.serialization.Model): """ _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, + "name_available": {"readonly": True}, + "reason": {"readonly": True}, + "message": {"readonly": True}, } _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(NameAvailabilityInformation, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """An available operation for Data Lake Store. Variables are only populated by the server, and will be ignored when sending a request. :ivar name: The name of the operation. :vartype name: str - :param display: The display information for the operation. - :type display: ~azure.mgmt.datalake.store.models.OperationDisplay - :ivar origin: The intended executor of the operation. Possible values include: "user", - "system", "user,system". + :ivar display: The display information for the operation. + :vartype display: ~azure.mgmt.datalake.store.models.OperationDisplay + :ivar origin: The intended executor of the operation. Known values are: "user", "system", and + "user,system". :vartype origin: str or ~azure.mgmt.datalake.store.models.OperationOrigin """ _validation = { - 'name': {'readonly': True}, - 'origin': {'readonly': True}, + "name": {"readonly": True}, + "origin": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, } - def __init__( - self, - *, - display: Optional["OperationDisplay"] = None, - **kwargs - ): - super(Operation, self).__init__(**kwargs) + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: The display information for the operation. + :paramtype display: ~azure.mgmt.datalake.store.models.OperationDisplay + """ + super().__init__(**kwargs) self.name = None self.display = display self.origin = None -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """The display information for a particular operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1190,31 +1239,29 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None self.description = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The list of available operations for Data Lake Store. Variables are only populated by the server, and will be ignored when sending a request. @@ -1226,20 +1273,18 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None @@ -1260,28 +1305,26 @@ class TrustedIdProvider(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'id_provider': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "id_provider": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "id_provider": {"key": "properties.idProvider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(TrustedIdProvider, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id_provider = None -class TrustedIdProviderListResult(msrest.serialization.Model): +class TrustedIdProviderListResult(_serialization.Model): """Data Lake Store trusted identity provider list information. Variables are only populated by the server, and will be ignored when sending a request. @@ -1293,78 +1336,82 @@ class TrustedIdProviderListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedIdProvider]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TrustedIdProvider]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(TrustedIdProviderListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class UpdateDataLakeStoreAccountParameters(msrest.serialization.Model): +class UpdateDataLakeStoreAccountParameters(_serialization.Model): """Data Lake Store account information to update. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param default_group: The default owner group for all new folders and files created in the Data + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar default_group: The default owner group for all new folders and files created in the Data Lake Store account. - :type default_group: str - :param encryption_config: Used for rotation of user managed Key Vault keys. Can only be used to + :vartype default_group: str + :ivar encryption_config: Used for rotation of user managed Key Vault keys. Can only be used to rotate a user managed encryption Key Vault key. - :type encryption_config: ~azure.mgmt.datalake.store.models.UpdateEncryptionConfig - :param firewall_rules: The list of firewall rules associated with this Data Lake Store account. - :type firewall_rules: + :vartype encryption_config: ~azure.mgmt.datalake.store.models.UpdateEncryptionConfig + :ivar firewall_rules: The list of firewall rules associated with this Data Lake Store account. + :vartype firewall_rules: list[~azure.mgmt.datalake.store.models.UpdateFirewallRuleWithAccountParameters] - :param virtual_network_rules: The list of virtual network rules associated with this Data Lake + :ivar virtual_network_rules: The list of virtual network rules associated with this Data Lake Store account. - :type virtual_network_rules: + :vartype virtual_network_rules: list[~azure.mgmt.datalake.store.models.UpdateVirtualNetworkRuleWithAccountParameters] - :param firewall_state: The current state of the IP address firewall for this Data Lake Store + :ivar firewall_state: The current state of the IP address firewall for this Data Lake Store account. Disabling the firewall does not remove existing rules, they will just be ignored until - the firewall is re-enabled. Possible values include: "Enabled", "Disabled". - :type firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState - :param firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating - within Azure through the firewall. If the firewall is disabled, this is not enforced. Possible - values include: "Enabled", "Disabled". - :type firewall_allow_azure_ips: str or + the firewall is re-enabled. Known values are: "Enabled" and "Disabled". + :vartype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState + :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled" and "Disabled". + :vartype firewall_allow_azure_ips: str or ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState - :param trusted_id_providers: The list of trusted identity providers associated with this Data + :ivar trusted_id_providers: The list of trusted identity providers associated with this Data Lake Store account. - :type trusted_id_providers: + :vartype trusted_id_providers: list[~azure.mgmt.datalake.store.models.UpdateTrustedIdProviderWithAccountParameters] - :param trusted_id_provider_state: The current state of the trusted identity provider feature - for this Data Lake Store account. Disabling trusted identity provider functionality does not - remove the providers, they will just be ignored until this feature is re-enabled. Possible - values include: "Enabled", "Disabled". - :type trusted_id_provider_state: str or + :ivar trusted_id_provider_state: The current state of the trusted identity provider feature for + this Data Lake Store account. Disabling trusted identity provider functionality does not remove + the providers, they will just be ignored until this feature is re-enabled. Known values are: + "Enabled" and "Disabled". + :vartype trusted_id_provider_state: str or ~azure.mgmt.datalake.store.models.TrustedIdProviderState - :param new_tier: The commitment tier to use for next month. Possible values include: - "Consumption", "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", - "Commitment_1PB", "Commitment_5PB". - :type new_tier: str or ~azure.mgmt.datalake.store.models.TierType + :ivar new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", "Commitment_1PB", + and "Commitment_5PB". + :vartype new_tier: str or ~azure.mgmt.datalake.store.models.TierType """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'default_group': {'key': 'properties.defaultGroup', 'type': 'str'}, - 'encryption_config': {'key': 'properties.encryptionConfig', 'type': 'UpdateEncryptionConfig'}, - 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[UpdateFirewallRuleWithAccountParameters]'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[UpdateVirtualNetworkRuleWithAccountParameters]'}, - 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, - 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, - 'trusted_id_providers': {'key': 'properties.trustedIdProviders', 'type': '[UpdateTrustedIdProviderWithAccountParameters]'}, - 'trusted_id_provider_state': {'key': 'properties.trustedIdProviderState', 'type': 'str'}, - 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, + "tags": {"key": "tags", "type": "{str}"}, + "default_group": {"key": "properties.defaultGroup", "type": "str"}, + "encryption_config": {"key": "properties.encryptionConfig", "type": "UpdateEncryptionConfig"}, + "firewall_rules": {"key": "properties.firewallRules", "type": "[UpdateFirewallRuleWithAccountParameters]"}, + "virtual_network_rules": { + "key": "properties.virtualNetworkRules", + "type": "[UpdateVirtualNetworkRuleWithAccountParameters]", + }, + "firewall_state": {"key": "properties.firewallState", "type": "str"}, + "firewall_allow_azure_ips": {"key": "properties.firewallAllowAzureIps", "type": "str"}, + "trusted_id_providers": { + "key": "properties.trustedIdProviders", + "type": "[UpdateTrustedIdProviderWithAccountParameters]", + }, + "trusted_id_provider_state": {"key": "properties.trustedIdProviderState", "type": "str"}, + "new_tier": {"key": "properties.newTier", "type": "str"}, } def __init__( @@ -1372,17 +1419,58 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, default_group: Optional[str] = None, - encryption_config: Optional["UpdateEncryptionConfig"] = None, - firewall_rules: Optional[List["UpdateFirewallRuleWithAccountParameters"]] = None, - virtual_network_rules: Optional[List["UpdateVirtualNetworkRuleWithAccountParameters"]] = None, - firewall_state: Optional[Union[str, "FirewallState"]] = None, - firewall_allow_azure_ips: Optional[Union[str, "FirewallAllowAzureIpsState"]] = None, - trusted_id_providers: Optional[List["UpdateTrustedIdProviderWithAccountParameters"]] = None, - trusted_id_provider_state: Optional[Union[str, "TrustedIdProviderState"]] = None, - new_tier: Optional[Union[str, "TierType"]] = None, - **kwargs - ): - super(UpdateDataLakeStoreAccountParameters, self).__init__(**kwargs) + encryption_config: Optional["_models.UpdateEncryptionConfig"] = None, + firewall_rules: Optional[List["_models.UpdateFirewallRuleWithAccountParameters"]] = None, + virtual_network_rules: Optional[List["_models.UpdateVirtualNetworkRuleWithAccountParameters"]] = None, + firewall_state: Optional[Union[str, "_models.FirewallState"]] = None, + firewall_allow_azure_ips: Optional[Union[str, "_models.FirewallAllowAzureIpsState"]] = None, + trusted_id_providers: Optional[List["_models.UpdateTrustedIdProviderWithAccountParameters"]] = None, + trusted_id_provider_state: Optional[Union[str, "_models.TrustedIdProviderState"]] = None, + new_tier: Optional[Union[str, "_models.TierType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword default_group: The default owner group for all new folders and files created in the + Data Lake Store account. + :paramtype default_group: str + :keyword encryption_config: Used for rotation of user managed Key Vault keys. Can only be used + to rotate a user managed encryption Key Vault key. + :paramtype encryption_config: ~azure.mgmt.datalake.store.models.UpdateEncryptionConfig + :keyword firewall_rules: The list of firewall rules associated with this Data Lake Store + account. + :paramtype firewall_rules: + list[~azure.mgmt.datalake.store.models.UpdateFirewallRuleWithAccountParameters] + :keyword virtual_network_rules: The list of virtual network rules associated with this Data + Lake Store account. + :paramtype virtual_network_rules: + list[~azure.mgmt.datalake.store.models.UpdateVirtualNetworkRuleWithAccountParameters] + :keyword firewall_state: The current state of the IP address firewall for this Data Lake Store + account. Disabling the firewall does not remove existing rules, they will just be ignored until + the firewall is re-enabled. Known values are: "Enabled" and "Disabled". + :paramtype firewall_state: str or ~azure.mgmt.datalake.store.models.FirewallState + :keyword firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled" and "Disabled". + :paramtype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.store.models.FirewallAllowAzureIpsState + :keyword trusted_id_providers: The list of trusted identity providers associated with this Data + Lake Store account. + :paramtype trusted_id_providers: + list[~azure.mgmt.datalake.store.models.UpdateTrustedIdProviderWithAccountParameters] + :keyword trusted_id_provider_state: The current state of the trusted identity provider feature + for this Data Lake Store account. Disabling trusted identity provider functionality does not + remove the providers, they will just be ignored until this feature is re-enabled. Known values + are: "Enabled" and "Disabled". + :paramtype trusted_id_provider_state: str or + ~azure.mgmt.datalake.store.models.TrustedIdProviderState + :keyword new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_1TB", "Commitment_10TB", "Commitment_100TB", "Commitment_500TB", "Commitment_1PB", + and "Commitment_5PB". + :paramtype new_tier: str or ~azure.mgmt.datalake.store.models.TierType + """ + super().__init__(**kwargs) self.tags = tags self.default_group = default_group self.encryption_config = encryption_config @@ -1395,229 +1483,238 @@ def __init__( self.new_tier = new_tier -class UpdateEncryptionConfig(msrest.serialization.Model): +class UpdateEncryptionConfig(_serialization.Model): """The encryption configuration used to update a user managed Key Vault key. - :param key_vault_meta_info: The updated Key Vault key to use in user managed key rotation. - :type key_vault_meta_info: ~azure.mgmt.datalake.store.models.UpdateKeyVaultMetaInfo + :ivar key_vault_meta_info: The updated Key Vault key to use in user managed key rotation. + :vartype key_vault_meta_info: ~azure.mgmt.datalake.store.models.UpdateKeyVaultMetaInfo """ _attribute_map = { - 'key_vault_meta_info': {'key': 'keyVaultMetaInfo', 'type': 'UpdateKeyVaultMetaInfo'}, + "key_vault_meta_info": {"key": "keyVaultMetaInfo", "type": "UpdateKeyVaultMetaInfo"}, } def __init__( - self, - *, - key_vault_meta_info: Optional["UpdateKeyVaultMetaInfo"] = None, - **kwargs - ): - super(UpdateEncryptionConfig, self).__init__(**kwargs) + self, *, key_vault_meta_info: Optional["_models.UpdateKeyVaultMetaInfo"] = None, **kwargs: Any + ) -> None: + """ + :keyword key_vault_meta_info: The updated Key Vault key to use in user managed key rotation. + :paramtype key_vault_meta_info: ~azure.mgmt.datalake.store.models.UpdateKeyVaultMetaInfo + """ + super().__init__(**kwargs) self.key_vault_meta_info = key_vault_meta_info -class UpdateFirewallRuleParameters(msrest.serialization.Model): +class UpdateFirewallRuleParameters(_serialization.Model): """The parameters used to update a firewall rule. - :param start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or + :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + :vartype start_ip_address: str + :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or ipv6. Start and End should be in the same protocol. - :type end_ip_address: str + :vartype end_ip_address: str """ _attribute_map = { - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, + "end_ip_address": {"key": "properties.endIpAddress", "type": "str"}, } def __init__( - self, - *, - start_ip_address: Optional[str] = None, - end_ip_address: Optional[str] = None, - **kwargs - ): - super(UpdateFirewallRuleParameters, self).__init__(**kwargs) + self, *, start_ip_address: Optional[str] = None, end_ip_address: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword start_ip_address: The start IP address for the firewall rule. This can be either ipv4 + or ipv6. Start and End should be in the same protocol. + :paramtype start_ip_address: str + :keyword end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :paramtype end_ip_address: str + """ + super().__init__(**kwargs) self.start_ip_address = start_ip_address self.end_ip_address = end_ip_address -class UpdateFirewallRuleWithAccountParameters(msrest.serialization.Model): +class UpdateFirewallRuleWithAccountParameters(_serialization.Model): """The parameters used to update a firewall rule while updating a Data Lake Store account. All required parameters must be populated in order to send to Azure. - :param name: Required. The unique name of the firewall rule to update. - :type name: str - :param start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or + :ivar name: The unique name of the firewall rule to update. Required. + :vartype name: str + :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or ipv6. Start and End should be in the same protocol. - :type start_ip_address: str - :param end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + :vartype start_ip_address: str + :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or ipv6. Start and End should be in the same protocol. - :type end_ip_address: str + :vartype end_ip_address: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, + "end_ip_address": {"key": "properties.endIpAddress", "type": "str"}, } def __init__( - self, - *, - name: str, - start_ip_address: Optional[str] = None, - end_ip_address: Optional[str] = None, - **kwargs - ): - super(UpdateFirewallRuleWithAccountParameters, self).__init__(**kwargs) + self, *, name: str, start_ip_address: Optional[str] = None, end_ip_address: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword name: The unique name of the firewall rule to update. Required. + :paramtype name: str + :keyword start_ip_address: The start IP address for the firewall rule. This can be either ipv4 + or ipv6. Start and End should be in the same protocol. + :paramtype start_ip_address: str + :keyword end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :paramtype end_ip_address: str + """ + super().__init__(**kwargs) self.name = name self.start_ip_address = start_ip_address self.end_ip_address = end_ip_address -class UpdateKeyVaultMetaInfo(msrest.serialization.Model): +class UpdateKeyVaultMetaInfo(_serialization.Model): """The Key Vault update information used for user managed key rotation. - :param encryption_key_version: The version of the user managed encryption key to update through + :ivar encryption_key_version: The version of the user managed encryption key to update through a key rotation. - :type encryption_key_version: str + :vartype encryption_key_version: str """ _attribute_map = { - 'encryption_key_version': {'key': 'encryptionKeyVersion', 'type': 'str'}, + "encryption_key_version": {"key": "encryptionKeyVersion", "type": "str"}, } - def __init__( - self, - *, - encryption_key_version: Optional[str] = None, - **kwargs - ): - super(UpdateKeyVaultMetaInfo, self).__init__(**kwargs) + def __init__(self, *, encryption_key_version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword encryption_key_version: The version of the user managed encryption key to update + through a key rotation. + :paramtype encryption_key_version: str + """ + super().__init__(**kwargs) self.encryption_key_version = encryption_key_version -class UpdateTrustedIdProviderParameters(msrest.serialization.Model): +class UpdateTrustedIdProviderParameters(_serialization.Model): """The parameters used to update a trusted identity provider. - :param id_provider: The URL of this trusted identity provider. - :type id_provider: str + :ivar id_provider: The URL of this trusted identity provider. + :vartype id_provider: str """ _attribute_map = { - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, + "id_provider": {"key": "properties.idProvider", "type": "str"}, } - def __init__( - self, - *, - id_provider: Optional[str] = None, - **kwargs - ): - super(UpdateTrustedIdProviderParameters, self).__init__(**kwargs) + def __init__(self, *, id_provider: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword id_provider: The URL of this trusted identity provider. + :paramtype id_provider: str + """ + super().__init__(**kwargs) self.id_provider = id_provider -class UpdateTrustedIdProviderWithAccountParameters(msrest.serialization.Model): - """The parameters used to update a trusted identity provider while updating a Data Lake Store account. +class UpdateTrustedIdProviderWithAccountParameters(_serialization.Model): + """The parameters used to update a trusted identity provider while updating a Data Lake Store + account. All required parameters must be populated in order to send to Azure. - :param name: Required. The unique name of the trusted identity provider to update. - :type name: str - :param id_provider: The URL of this trusted identity provider. - :type id_provider: str + :ivar name: The unique name of the trusted identity provider to update. Required. + :vartype name: str + :ivar id_provider: The URL of this trusted identity provider. + :vartype id_provider: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id_provider': {'key': 'properties.idProvider', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - id_provider: Optional[str] = None, - **kwargs - ): - super(UpdateTrustedIdProviderWithAccountParameters, self).__init__(**kwargs) + "name": {"key": "name", "type": "str"}, + "id_provider": {"key": "properties.idProvider", "type": "str"}, + } + + def __init__(self, *, name: str, id_provider: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The unique name of the trusted identity provider to update. Required. + :paramtype name: str + :keyword id_provider: The URL of this trusted identity provider. + :paramtype id_provider: str + """ + super().__init__(**kwargs) self.name = name self.id_provider = id_provider -class UpdateVirtualNetworkRuleParameters(msrest.serialization.Model): +class UpdateVirtualNetworkRuleParameters(_serialization.Model): """The parameters used to update a virtual network rule. - :param subnet_id: The resource identifier for the subnet. - :type subnet_id: str + :ivar subnet_id: The resource identifier for the subnet. + :vartype subnet_id: str """ _attribute_map = { - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + "subnet_id": {"key": "properties.subnetId", "type": "str"}, } - def __init__( - self, - *, - subnet_id: Optional[str] = None, - **kwargs - ): - super(UpdateVirtualNetworkRuleParameters, self).__init__(**kwargs) + def __init__(self, *, subnet_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword subnet_id: The resource identifier for the subnet. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) self.subnet_id = subnet_id -class UpdateVirtualNetworkRuleWithAccountParameters(msrest.serialization.Model): +class UpdateVirtualNetworkRuleWithAccountParameters(_serialization.Model): """The parameters used to update a virtual network rule while updating a Data Lake Store account. All required parameters must be populated in order to send to Azure. - :param name: Required. The unique name of the virtual network rule to update. - :type name: str - :param subnet_id: The resource identifier for the subnet. - :type subnet_id: str + :ivar name: The unique name of the virtual network rule to update. Required. + :vartype name: str + :ivar subnet_id: The resource identifier for the subnet. + :vartype subnet_id: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - subnet_id: Optional[str] = None, - **kwargs - ): - super(UpdateVirtualNetworkRuleWithAccountParameters, self).__init__(**kwargs) + "name": {"key": "name", "type": "str"}, + "subnet_id": {"key": "properties.subnetId", "type": "str"}, + } + + def __init__(self, *, name: str, subnet_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The unique name of the virtual network rule to update. Required. + :paramtype name: str + :keyword subnet_id: The resource identifier for the subnet. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) self.name = name self.subnet_id = subnet_id -class Usage(msrest.serialization.Model): +class Usage(_serialization.Model): """Describes the Resource Usage. Variables are only populated by the server, and will be ignored when sending a request. - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". + :ivar unit: Gets the unit of measurement. Known values are: "Count", "Bytes", "Seconds", + "Percent", "CountsPerSecond", and "BytesPerSecond". :vartype unit: str or ~azure.mgmt.datalake.store.models.UsageUnit :ivar id: Resource identifier. :vartype id: str @@ -1630,26 +1727,24 @@ class Usage(msrest.serialization.Model): """ _validation = { - 'unit': {'readonly': True}, - 'id': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, + "unit": {"readonly": True}, + "id": {"readonly": True}, + "current_value": {"readonly": True}, + "limit": {"readonly": True}, + "name": {"readonly": True}, } _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, + "unit": {"key": "unit", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "current_value": {"key": "currentValue", "type": "int"}, + "limit": {"key": "limit", "type": "int"}, + "name": {"key": "name", "type": "UsageName"}, } - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.unit = None self.id = None self.current_value = None @@ -1657,28 +1752,27 @@ def __init__( self.name = None -class UsageListResult(msrest.serialization.Model): +class UsageListResult(_serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.datalake.store.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.datalake.store.models.Usage] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, + "value": {"key": "value", "type": "[Usage]"}, } - def __init__( - self, - *, - value: Optional[List["Usage"]] = None, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.datalake.store.models.Usage] + """ + super().__init__(**kwargs) self.value = value -class UsageName(msrest.serialization.Model): +class UsageName(_serialization.Model): """The usage names that can be used. Variables are only populated by the server, and will be ignored when sending a request. @@ -1690,20 +1784,18 @@ class UsageName(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, + "value": {"readonly": True}, + "localized_value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.localized_value = None @@ -1724,28 +1816,26 @@ class VirtualNetworkRule(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'subnet_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "subnet_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "subnet_id": {"key": "properties.subnetId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.subnet_id = None -class VirtualNetworkRuleListResult(msrest.serialization.Model): +class VirtualNetworkRuleListResult(_serialization.Model): """Data Lake Store virtual network rule list information. Variables are only populated by the server, and will be ignored when sending a request. @@ -1757,19 +1847,17 @@ class VirtualNetworkRuleListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualNetworkRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[VirtualNetworkRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRuleListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_patch.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_patch.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_patch.py rename to sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/_patch.py diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/__init__.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/__init__.py index ad9f979648cf..1189bb013e90 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/__init__.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/__init__.py @@ -13,11 +13,17 @@ from ._operations import Operations from ._locations_operations import LocationsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccountsOperations', - 'FirewallRulesOperations', - 'VirtualNetworkRulesOperations', - 'TrustedIdProvidersOperations', - 'Operations', - 'LocationsOperations', + "AccountsOperations", + "FirewallRulesOperations", + "VirtualNetworkRulesOperations", + "TrustedIdProvidersOperations", + "Operations", + "LocationsOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_accounts_operations.py index 6a2d9e73c5ad..3090b580fdfe 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_accounts_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_accounts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,137 +6,442 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=1) + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1) + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=1) + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_enable_key_vault_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") -class AccountsOperations(object): - """AccountsOperations operations. + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. +def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient`'s + :attr:`accounts` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - select=None, # type: Optional[str] - orderby=None, # type: Optional[str] - count=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataLakeStoreAccountListResult"] + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DataLakeStoreAccountBasic"]: """Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. - :param filter: OData filter. Optional. + :param filter: OData filter. Optional. Default value is None. :type filter: str - :param top: The number of items to return. Optional. + :param top: The number of items to return. Optional. Default value is None. :type top: int - :param skip: The number of items to skip over before returning elements. Optional. + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. :type skip: int :param select: OData Select statement. Limits the properties on each entry to just those - requested, e.g. Categories?$select=CategoryName,Description. Optional. + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. :type select: str :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. - Categories?$orderby=CategoryName desc. Optional. + Categories?$orderby=CategoryName desc. Optional. Default value is None. :type orderby: str :param count: The Boolean value of true or false to request a count of the matching resources - included with the resources in the response, e.g. Categories?$count=true. Optional. + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. :type count: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataLakeStoreAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DataLakeStoreAccountBasic or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountBasic] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccountListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DataLakeStoreAccountListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=1) - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - if count is not None: - query_parameters['$count'] = self._serialize.query("count", count, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccountListResult', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -144,104 +450,119 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts"} + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - select=None, # type: Optional[str] - orderby=None, # type: Optional[str] - count=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataLakeStoreAccountListResult"] + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DataLakeStoreAccountBasic"]: """Lists the Data Lake Store accounts within a specific resource group. The response includes a link to the next page of results, if any. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param filter: OData filter. Optional. + :param filter: OData filter. Optional. Default value is None. :type filter: str - :param top: The number of items to return. Optional. + :param top: The number of items to return. Optional. Default value is None. :type top: int - :param skip: The number of items to skip over before returning elements. Optional. + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. :type skip: int :param select: OData Select statement. Limits the properties on each entry to just those - requested, e.g. Categories?$select=CategoryName,Description. Optional. + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. :type select: str :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. - Categories?$orderby=CategoryName desc. Optional. + Categories?$orderby=CategoryName desc. Optional. Default value is None. :type orderby: str :param count: A Boolean value of true or false to request a count of the matching resources - included with the resources in the response, e.g. Categories?$count=true. Optional. + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. :type count: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataLakeStoreAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DataLakeStoreAccountBasic or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountBasic] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccountListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DataLakeStoreAccountListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=1) - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - if count is not None: - query_parameters['$count'] = self._serialize.query("count", count, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccountListResult', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -250,51 +571,63 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts'} # type: ignore + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts" + } def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.CreateDataLakeStoreAccountParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataLakeStoreAccount" - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] + resource_group_name: str, + account_name: str, + parameters: Union[_models.CreateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> _models.DataLakeStoreAccount: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateDataLakeStoreAccountParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateDataLakeStoreAccountParameters") + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -302,188 +635,286 @@ def _create_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + @overload def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.CreateDataLakeStoreAccountParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataLakeStoreAccount"] + resource_group_name: str, + account_name: str, + parameters: _models.CreateDataLakeStoreAccountParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataLakeStoreAccount]: """Creates the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param parameters: Parameters supplied to create the Data Lake Store account. + :param parameters: Parameters supplied to create the Data Lake Store account. Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateDataLakeStoreAccountParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataLakeStoreAccount]: + """Creates the specified Data Lake Store account. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to create the Data Lake Store account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: Union[_models.CreateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.DataLakeStoreAccount]: + """Creates the specified Data Lake Store account. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to create the Data Lake Store account. Is either a + CreateDataLakeStoreAccountParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateDataLakeStoreAccountParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) - + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def get( - self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataLakeStoreAccount" + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + @distributed_trace + def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.DataLakeStoreAccount: """Gets the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataLakeStoreAccount, or the result of cls(response) + :return: DataLakeStoreAccount or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.DataLakeStoreAccount - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.UpdateDataLakeStoreAccountParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataLakeStoreAccount" - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] + resource_group_name: str, + account_name: str, + parameters: Union[_models.UpdateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> _models.DataLakeStoreAccount: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UpdateDataLakeStoreAccountParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UpdateDataLakeStoreAccountParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -491,124 +922,211 @@ def _update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return deserialized # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + @overload def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.UpdateDataLakeStoreAccountParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataLakeStoreAccount"] + resource_group_name: str, + account_name: str, + parameters: _models.UpdateDataLakeStoreAccountParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataLakeStoreAccount]: """Updates the specified Data Lake Store account information. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param parameters: Parameters supplied to update the Data Lake Store account. + :param parameters: Parameters supplied to update the Data Lake Store account. Required. :type parameters: ~azure.mgmt.datalake.store.models.UpdateDataLakeStoreAccountParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataLakeStoreAccount]: + """Updates the specified Data Lake Store account information. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to update the Data Lake Store account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + parameters: Union[_models.UpdateDataLakeStoreAccountParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.DataLakeStoreAccount]: + """Updates the specified Data Lake Store account information. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param parameters: Parameters supplied to update the Data Lake Store account. Is either a + UpdateDataLakeStoreAccountParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateDataLakeStoreAccountParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeStoreAccount or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.datalake.store.models.DataLakeStoreAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataLakeStoreAccount] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataLakeStoreAccount', pipeline_response) - + deserialized = self._deserialize("DataLakeStoreAccount", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -618,117 +1136,123 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } - def begin_delete( - self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, account_name=account_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def enable_key_vault( - self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}" + } + + @distributed_trace + def enable_key_vault( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> None: """Attempts to enable a user managed Key Vault for encryption of the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.enable_key_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_enable_key_vault_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.enable_key_vault.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -738,67 +1262,130 @@ def enable_key_vault( if cls: return cls(pipeline_response, None, {}) - enable_key_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault'} # type: ignore + enable_key_vault.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault" + } + @overload def check_name_availability( self, - location, # type: str - parameters, # type: "_models.CheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailabilityInformation" + location: str, + parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityInformation: """Checks whether the specified account name is available or taken. - :param location: The resource location without whitespace. + :param location: The resource location without whitespace. Required. :type location: str :param parameters: Parameters supplied to check the Data Lake Store account name availability. + Required. :type parameters: ~azure.mgmt.datalake.store.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailabilityInformation, or the result of cls(response) + :return: NameAvailabilityInformation or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.NameAvailabilityInformation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityInformation: + """Checks whether the specified account name is available or taken. + + :param location: The resource location without whitespace. Required. + :type location: str + :param parameters: Parameters supplied to check the Data Lake Store account name availability. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInformation or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.NameAvailabilityInformation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, location: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailabilityInformation: + """Checks whether the specified account name is available or taken. + + :param location: The resource location without whitespace. Required. + :type location: str + :param parameters: Parameters supplied to check the Data Lake Store account name availability. + Is either a CheckNameAvailabilityParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CheckNameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInformation or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.NameAvailabilityInformation + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityInformation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityInformation] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") + + request = build_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('NameAvailabilityInformation', pipeline_response) + deserialized = self._deserialize("NameAvailabilityInformation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability'} # type: ignore + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_firewall_rules_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_firewall_rules_operations.py index e0c429462009..bbe50f3b96fa 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_firewall_rules_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_firewall_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,108 +6,296 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_account_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, account_name: str, firewall_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, firewall_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, account_name: str, firewall_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") -class FirewallRulesOperations(object): - """FirewallRulesOperations operations. + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, account_name: str, firewall_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, "str"), + } - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class FirewallRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient`'s + :attr:`firewall_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_account( - self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FirewallRuleListResult"] + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.FirewallRule"]: """Lists the Data Lake Store firewall rules within the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FirewallRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.FirewallRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either FirewallRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.FirewallRule] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FirewallRuleListResult', pipeline_response) + deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,267 +304,435 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules'} # type: ignore + return ItemPaged(get_next, extract_data) + + list_by_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules" + } + @overload def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - firewall_rule_name, # type: str - parameters, # type: "_models.CreateOrUpdateFirewallRuleParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.FirewallRule" + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: _models.CreateOrUpdateFirewallRuleParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: """Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to create or update. + :param firewall_rule_name: The name of the firewall rule to create or update. Required. :type firewall_rule_name: str - :param parameters: Parameters supplied to create or update the firewall rule. + :param parameters: Parameters supplied to create or update the firewall rule. Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateFirewallRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: + """Creates or updates the specified firewall rule. During update, the firewall rule with the + specified name will be replaced with this new firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to create or update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to create or update the firewall rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallRule, or the result of cls(response) + :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Union[_models.CreateOrUpdateFirewallRuleParameters, IO], + **kwargs: Any + ) -> _models.FirewallRule: + """Creates or updates the specified firewall rule. During update, the firewall rule with the + specified name will be replaced with this new firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to create or update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to create or update the firewall rule. Is either a + CreateOrUpdateFirewallRuleParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateFirewallRuleParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateOrUpdateFirewallRuleParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateOrUpdateFirewallRuleParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('FirewallRule', pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } + + @distributed_trace def get( - self, - resource_group_name, # type: str - account_name, # type: str - firewall_rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FirewallRule" + self, resource_group_name: str, account_name: str, firewall_rule_name: str, **kwargs: Any + ) -> _models.FirewallRule: """Gets the specified Data Lake Store firewall rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to retrieve. + :param firewall_rule_name: The name of the firewall rule to retrieve. Required. :type firewall_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallRule, or the result of cls(response) + :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('FirewallRule', pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } + + @overload def update( self, - resource_group_name, # type: str - account_name, # type: str - firewall_rule_name, # type: str - parameters=None, # type: Optional["_models.UpdateFirewallRuleParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.FirewallRule" + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Optional[_models.UpdateFirewallRuleParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: """Updates the specified firewall rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to update. + :param firewall_rule_name: The name of the firewall rule to update. Required. :type firewall_rule_name: str - :param parameters: Parameters supplied to update the firewall rule. + :param parameters: Parameters supplied to update the firewall rule. Default value is None. :type parameters: ~azure.mgmt.datalake.store.models.UpdateFirewallRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirewallRule, or the result of cls(response) + :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallRule: + """Updates the specified firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to update the firewall rule. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Optional[Union[_models.UpdateFirewallRuleParameters, IO]] = None, + **kwargs: Any + ) -> _models.FirewallRule: + """Updates the specified firewall rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to update. Required. + :type firewall_rule_name: str + :param parameters: Parameters supplied to update the firewall rule. Is either a + UpdateFirewallRuleParameters type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateFirewallRuleParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.FirewallRule + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateFirewallRuleParameters') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateFirewallRuleParameters") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('FirewallRule', pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore - def delete( - self, - resource_group_name, # type: str - account_name, # type: str - firewall_rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, firewall_rule_name: str, **kwargs: Any + ) -> None: """Deletes the specified firewall rule from the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param firewall_rule_name: The name of the firewall rule to delete. + :param firewall_rule_name: The name of the firewall rule to delete. Required. :type firewall_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'firewallRuleName': self._serialize.url("firewall_rule_name", firewall_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -385,4 +742,6 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}'} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_locations_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_locations_operations.py index 4a1679b8c521..1778b7aba36d 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_locations_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_locations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,88 +6,158 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +import sys +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False -class LocationsOperations(object): - """LocationsOperations operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +def build_get_capability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_usage_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class LocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient`'s + :attr:`locations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get_capability( - self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CapabilityInformation"] + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_capability(self, location: str, **kwargs: Any) -> Optional[_models.CapabilityInformation]: """Gets subscription-level properties and limits for Data Lake Store specified by resource location. - :param location: The resource location without whitespace. + :param location: The resource location without whitespace. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CapabilityInformation, or the result of cls(response) + :return: CapabilityInformation or None or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.CapabilityInformation or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CapabilityInformation"]] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get_capability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.CapabilityInformation]] = kwargs.pop("cls", None) + + request = build_get_capability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_capability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -95,73 +166,90 @@ def get_capability( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('CapabilityInformation', pipeline_response) + deserialized = self._deserialize("CapabilityInformation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_capability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability'} # type: ignore - - def get_usage( - self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + + get_capability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability" + } + + @distributed_trace + def get_usage(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: """Gets the current usage count and the limit for the resources of the location under the subscription. - :param location: The resource location without whitespace. + :param location: The resource location without whitespace. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.UsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.get_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_get_usage_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_usage.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -170,7 +258,8 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - get_usage.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages'} # type: ignore + return ItemPaged(get_next, extract_data) + + get_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_operations.py index 525307da8bba..4eaedbf31306 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,88 +6,126 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DataLakeStore/operations") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") -class Operations(object): - """Operations operations. + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationListResult" + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists all of the available Data Lake Store REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult, or the result of cls(response) + :return: OperationListResult or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.OperationListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct URL - url = self.list.metadata['url'] # type: ignore + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/providers/Microsoft.DataLakeStore/operations'} # type: ignore + + list.metadata = {"url": "/providers/Microsoft.DataLakeStore/operations"} diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_patch.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_patch.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_patch.py rename to sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_patch.py diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_trusted_id_providers_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_trusted_id_providers_operations.py index c2f933549325..413b3f7988e9 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_trusted_id_providers_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_trusted_id_providers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,109 +6,297 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_account_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, account_name: str, trusted_id_provider_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "trustedIdProviderName": _SERIALIZER.url("trusted_id_provider_name", trusted_id_provider_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, trusted_id_provider_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "trustedIdProviderName": _SERIALIZER.url("trusted_id_provider_name", trusted_id_provider_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, account_name: str, trusted_id_provider_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "trustedIdProviderName": _SERIALIZER.url("trusted_id_provider_name", trusted_id_provider_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") -class TrustedIdProvidersOperations(object): - """TrustedIdProvidersOperations operations. + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, account_name: str, trusted_id_provider_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "trustedIdProviderName": _SERIALIZER.url("trusted_id_provider_name", trusted_id_provider_name, "str"), + } - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class TrustedIdProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient`'s + :attr:`trusted_id_providers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_account( - self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TrustedIdProviderListResult"] + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.TrustedIdProvider"]: """Lists the Data Lake Store trusted identity providers within the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedIdProviderListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.TrustedIdProviderListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either TrustedIdProvider or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.TrustedIdProvider] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProviderListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.TrustedIdProviderListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TrustedIdProviderListResult', pipeline_response) + deserialized = self._deserialize("TrustedIdProviderListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -116,269 +305,447 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders'} # type: ignore + return ItemPaged(get_next, extract_data) + + list_by_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders" + } + @overload def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - trusted_id_provider_name, # type: str - parameters, # type: "_models.CreateOrUpdateTrustedIdProviderParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.TrustedIdProvider" + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: _models.CreateOrUpdateTrustedIdProviderParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: """Creates or updates the specified trusted identity provider. During update, the trusted identity provider with the specified name will be replaced with this new provider. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param trusted_id_provider_name: The name of the trusted identity provider. This is used for - differentiation of providers in the account. + differentiation of providers in the account. Required. :type trusted_id_provider_name: str :param parameters: Parameters supplied to create or replace the trusted identity provider. + Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateTrustedIdProviderParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedIdProvider, or the result of cls(response) + :return: TrustedIdProvider or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Creates or updates the specified trusted identity provider. During update, the trusted identity + provider with the specified name will be replaced with this new provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to create or replace the trusted identity provider. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: Union[_models.CreateOrUpdateTrustedIdProviderParameters, IO], + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Creates or updates the specified trusted identity provider. During update, the trusted identity + provider with the specified name will be replaced with this new provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to create or replace the trusted identity provider. Is + either a CreateOrUpdateTrustedIdProviderParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateTrustedIdProviderParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateOrUpdateTrustedIdProviderParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedIdProvider] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateOrUpdateTrustedIdProviderParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedIdProvider', pipeline_response) + deserialized = self._deserialize("TrustedIdProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } + + @distributed_trace def get( - self, - resource_group_name, # type: str - account_name, # type: str - trusted_id_provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TrustedIdProvider" + self, resource_group_name: str, account_name: str, trusted_id_provider_name: str, **kwargs: Any + ) -> _models.TrustedIdProvider: """Gets the specified Data Lake Store trusted identity provider. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param trusted_id_provider_name: The name of the trusted identity provider to retrieve. + Required. :type trusted_id_provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedIdProvider, or the result of cls(response) + :return: TrustedIdProvider or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.TrustedIdProvider] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedIdProvider', pipeline_response) + deserialized = self._deserialize("TrustedIdProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } + + @overload def update( self, - resource_group_name, # type: str - account_name, # type: str - trusted_id_provider_name, # type: str - parameters=None, # type: Optional["_models.UpdateTrustedIdProviderParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.TrustedIdProvider" + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: Optional[_models.UpdateTrustedIdProviderParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: """Updates the specified trusted identity provider. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param trusted_id_provider_name: The name of the trusted identity provider. This is used for - differentiation of providers in the account. + differentiation of providers in the account. Required. :type trusted_id_provider_name: str - :param parameters: Parameters supplied to update the trusted identity provider. + :param parameters: Parameters supplied to update the trusted identity provider. Default value + is None. :type parameters: ~azure.mgmt.datalake.store.models.UpdateTrustedIdProviderParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Updates the specified trusted identity provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to update the trusted identity provider. Default value + is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedIdProvider or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + trusted_id_provider_name: str, + parameters: Optional[Union[_models.UpdateTrustedIdProviderParameters, IO]] = None, + **kwargs: Any + ) -> _models.TrustedIdProvider: + """Updates the specified trusted identity provider. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param trusted_id_provider_name: The name of the trusted identity provider. This is used for + differentiation of providers in the account. Required. + :type trusted_id_provider_name: str + :param parameters: Parameters supplied to update the trusted identity provider. Is either a + UpdateTrustedIdProviderParameters type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateTrustedIdProviderParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedIdProvider, or the result of cls(response) + :return: TrustedIdProvider or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.TrustedIdProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedIdProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateTrustedIdProviderParameters') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedIdProvider] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateTrustedIdProviderParameters") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedIdProvider', pipeline_response) + deserialized = self._deserialize("TrustedIdProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore - def delete( - self, - resource_group_name, # type: str - account_name, # type: str - trusted_id_provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, trusted_id_provider_name: str, **kwargs: Any + ) -> None: """Deletes the specified trusted identity provider from the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param trusted_id_provider_name: The name of the trusted identity provider to delete. + :param trusted_id_provider_name: The name of the trusted identity provider to delete. Required. :type trusted_id_provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'trustedIdProviderName': self._serialize.url("trusted_id_provider_name", trusted_id_provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + trusted_id_provider_name=trusted_id_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -388,4 +755,6 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}'} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_virtual_network_rules_operations.py b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_virtual_network_rules_operations.py index 7d69985d66ac..3225a0f0d8fa 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_virtual_network_rules_operations.py +++ b/sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/operations/_virtual_network_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,108 +6,296 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_account_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, account_name: str, virtual_network_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, virtual_network_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, account_name: str, virtual_network_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") -class VirtualNetworkRulesOperations(object): - """VirtualNetworkRulesOperations operations. + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, account_name: str, virtual_network_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2016-11-01")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, "str"), + } - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.datalake.store.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class VirtualNetworkRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient`'s + :attr:`virtual_network_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_account( - self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualNetworkRuleListResult"] + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualNetworkRule"]: """Lists the Data Lake Store virtual network rules within the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.VirtualNetworkRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.store.models.VirtualNetworkRule] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VirtualNetworkRuleListResult', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,267 +304,441 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules'} # type: ignore + return ItemPaged(get_next, extract_data) + list_by_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules" + } + + @overload def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - virtual_network_rule_name, # type: str - parameters, # type: "_models.CreateOrUpdateVirtualNetworkRuleParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualNetworkRule" + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: _models.CreateOrUpdateVirtualNetworkRuleParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: """Creates or updates the specified virtual network rule. During update, the virtual network rule with the specified name will be replaced with this new virtual network rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str :param virtual_network_rule_name: The name of the virtual network rule to create or update. + Required. :type virtual_network_rule_name: str - :param parameters: Parameters supplied to create or update the virtual network rule. + :param parameters: Parameters supplied to create or update the virtual network rule. Required. :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateVirtualNetworkRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates the specified virtual network rule. During update, the virtual network rule + with the specified name will be replaced with this new virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to create or update. + Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to create or update the virtual network rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: Union[_models.CreateOrUpdateVirtualNetworkRuleParameters, IO], + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates the specified virtual network rule. During update, the virtual network rule + with the specified name will be replaced with this new virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to create or update. + Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to create or update the virtual network rule. Is either + a CreateOrUpdateVirtualNetworkRuleParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.datalake.store.models.CreateOrUpdateVirtualNetworkRuleParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateOrUpdateVirtualNetworkRuleParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CreateOrUpdateVirtualNetworkRuleParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } + + @distributed_trace def get( - self, - resource_group_name, # type: str - account_name, # type: str - virtual_network_rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualNetworkRule" + self, resource_group_name: str, account_name: str, virtual_network_rule_name: str, **kwargs: Any + ) -> _models.VirtualNetworkRule: """Gets the specified Data Lake Store virtual network rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param virtual_network_rule_name: The name of the virtual network rule to retrieve. + :param virtual_network_rule_name: The name of the virtual network rule to retrieve. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } + + @overload def update( self, - resource_group_name, # type: str - account_name, # type: str - virtual_network_rule_name, # type: str - parameters=None, # type: Optional["_models.UpdateVirtualNetworkRuleParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualNetworkRule" + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: Optional[_models.UpdateVirtualNetworkRuleParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: """Updates the specified virtual network rule. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param virtual_network_rule_name: The name of the virtual network rule to update. + :param virtual_network_rule_name: The name of the virtual network rule to update. Required. :type virtual_network_rule_name: str - :param parameters: Parameters supplied to update the virtual network rule. + :param parameters: Parameters supplied to update the virtual network rule. Default value is + None. :type parameters: ~azure.mgmt.datalake.store.models.UpdateVirtualNetworkRuleParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Updates the specified virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to update. Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to update the virtual network rule. Default value is + None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + virtual_network_rule_name: str, + parameters: Optional[Union[_models.UpdateVirtualNetworkRuleParameters, IO]] = None, + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Updates the specified virtual network rule. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param account_name: The name of the Data Lake Store account. Required. + :type account_name: str + :param virtual_network_rule_name: The name of the virtual network rule to update. Required. + :type virtual_network_rule_name: str + :param parameters: Parameters supplied to update the virtual network rule. Is either a + UpdateVirtualNetworkRuleParameters type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.datalake.store.models.UpdateVirtualNetworkRuleParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.datalake.store.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'UpdateVirtualNetworkRuleParameters') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateVirtualNetworkRuleParameters") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore - def delete( - self, - resource_group_name, # type: str - account_name, # type: str - virtual_network_rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, virtual_network_rule_name: str, **kwargs: Any + ) -> None: """Deletes the specified virtual network rule from the specified Data Lake Store account. - :param resource_group_name: The name of the Azure resource group. + :param resource_group_name: The name of the Azure resource group. Required. :type resource_group_name: str - :param account_name: The name of the Data Lake Store account. + :param account_name: The name of the Data Lake Store account. Required. :type account_name: str - :param virtual_network_rule_name: The name of the virtual network rule to delete. + :param virtual_network_rule_name: The name of the virtual network rule to delete. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version: Literal["2016-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + virtual_network_rule_name=virtual_network_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -385,4 +748,6 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}'} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}" + } diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_check_name_availability.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_check_name_availability.py new file mode 100644 index 000000000000..36a66f396e45 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_check_name_availability.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_check_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.check_name_availability( + location="EastUS2", + parameters={"name": "contosoadla", "type": "Microsoft.DataLakeStore/accounts"}, + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_CheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_create.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_create.py new file mode 100644 index 000000000000..87ae55332181 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_create.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.begin_create( + resource_group_name="contosorg", + account_name="contosoadla", + parameters={ + "identity": {"type": "SystemAssigned"}, + "location": "eastus2", + "properties": { + "defaultGroup": "test_default_group", + "encryptionConfig": { + "keyVaultMetaInfo": { + "encryptionKeyName": "test_encryption_key_name", + "encryptionKeyVersion": "encryption_key_version", + "keyVaultResourceId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + }, + "type": "UserManaged", + }, + "encryptionState": "Enabled", + "firewallAllowAzureIps": "Enabled", + "firewallRules": [ + {"name": "test_rule", "properties": {"endIpAddress": "2.2.2.2", "startIpAddress": "1.1.1.1"}} + ], + "firewallState": "Enabled", + "newTier": "Consumption", + "trustedIdProviderState": "Enabled", + "trustedIdProviders": [ + { + "name": "test_trusted_id_provider_name", + "properties": {"idProvider": "https://sts.windows.net/ea9ec534-a3e3-4e45-ad36-3afc5bb291c1"}, + } + ], + }, + "tags": {"test_key": "test_value"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_delete.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_delete.py new file mode 100644 index 000000000000..ba57e67aeca1 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.begin_delete( + resource_group_name="contosorg", + account_name="contosoadla", + ).result() + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_enable_key_vault.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_enable_key_vault.py new file mode 100644 index 000000000000..3d1471978bc5 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_enable_key_vault.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_enable_key_vault.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.enable_key_vault( + resource_group_name="contosorg", + account_name="contosoadla", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_EnableKeyVault.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_get.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_get.py new file mode 100644 index 000000000000..7380eae00a03 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.get( + resource_group_name="contosorg", + account_name="contosoadla", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_list.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_list.py new file mode 100644 index 000000000000..70c2f18ffd4d --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_List.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_list_by_resource_group.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_list_by_resource_group.py new file mode 100644 index 000000000000..ad043afa1b3f --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.list_by_resource_group( + resource_group_name="contosorg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_update.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_update.py new file mode 100644 index 000000000000..693ff0ef200f --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/accounts_update.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python accounts_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.accounts.begin_update( + resource_group_name="contosorg", + account_name="contosoadla", + parameters={ + "properties": { + "defaultGroup": "test_default_group", + "encryptionConfig": {"keyVaultMetaInfo": {"encryptionKeyVersion": "encryption_key_version"}}, + "firewallAllowAzureIps": "Enabled", + "firewallState": "Enabled", + "newTier": "Consumption", + "trustedIdProviderState": "Enabled", + }, + "tags": {"test_key": "test_value"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_create_or_update.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_create_or_update.py new file mode 100644 index 000000000000..92d68deeb7d8 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_create_or_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python firewall_rules_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.firewall_rules.create_or_update( + resource_group_name="contosorg", + account_name="contosoadla", + firewall_rule_name="test_rule", + parameters={"properties": {"endIpAddress": "2.2.2.2", "startIpAddress": "1.1.1.1"}}, + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/FirewallRules_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_delete.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_delete.py new file mode 100644 index 000000000000..c1873b37f7df --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python firewall_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.firewall_rules.delete( + resource_group_name="contosorg", + account_name="contosoadla", + firewall_rule_name="test_rule", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/FirewallRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_get.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_get.py new file mode 100644 index 000000000000..6da8491436da --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python firewall_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.firewall_rules.get( + resource_group_name="contosorg", + account_name="contosoadla", + firewall_rule_name="test_rule", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/FirewallRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_list_by_account.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_list_by_account.py new file mode 100644 index 000000000000..2f51c4e876d6 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_list_by_account.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python firewall_rules_list_by_account.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.firewall_rules.list_by_account( + resource_group_name="contosorg", + account_name="contosoadla", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/FirewallRules_ListByAccount.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_update.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_update.py new file mode 100644 index 000000000000..6a4ce2878bed --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/firewall_rules_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python firewall_rules_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.firewall_rules.update( + resource_group_name="contosorg", + account_name="contosoadla", + firewall_rule_name="test_rule", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/FirewallRules_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/locations_get_capability.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/locations_get_capability.py new file mode 100644 index 000000000000..3e9e83f271f6 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/locations_get_capability.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python locations_get_capability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.locations.get_capability( + location="EastUS2", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Locations_GetCapability.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/locations_get_usage.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/locations_get_usage.py new file mode 100644 index 000000000000..5ea3baef2308 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/locations_get_usage.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python locations_get_usage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.locations.get_usage( + location="WestUS", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Locations_GetUsage.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/operations_list.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/operations_list.py new file mode 100644 index 000000000000..dcabd7c974e8 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/operations_list.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_create_or_update.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_create_or_update.py new file mode 100644 index 000000000000..b400398714db --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_create_or_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python trusted_id_providers_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.trusted_id_providers.create_or_update( + resource_group_name="contosorg", + account_name="contosoadla", + trusted_id_provider_name="test_trusted_id_provider_name", + parameters={"properties": {"idProvider": "https://sts.windows.net/ea9ec534-a3e3-4e45-ad36-3afc5bb291c1"}}, + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/TrustedIdProviders_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_delete.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_delete.py new file mode 100644 index 000000000000..c3175d0a28d8 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python trusted_id_providers_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.trusted_id_providers.delete( + resource_group_name="contosorg", + account_name="contosoadla", + trusted_id_provider_name="test_trusted_id_provider_name", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/TrustedIdProviders_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_get.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_get.py new file mode 100644 index 000000000000..86bb522bf0e3 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python trusted_id_providers_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.trusted_id_providers.get( + resource_group_name="contosorg", + account_name="contosoadla", + trusted_id_provider_name="test_trusted_id_provider_name", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/TrustedIdProviders_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_list_by_account.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_list_by_account.py new file mode 100644 index 000000000000..4549742b043c --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_list_by_account.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python trusted_id_providers_list_by_account.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.trusted_id_providers.list_by_account( + resource_group_name="contosorg", + account_name="contosoadla", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/TrustedIdProviders_ListByAccount.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_update.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_update.py new file mode 100644 index 000000000000..1fda5357e6ed --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/trusted_id_providers_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python trusted_id_providers_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.trusted_id_providers.update( + resource_group_name="contosorg", + account_name="contosoadla", + trusted_id_provider_name="test_trusted_id_provider_name", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/TrustedIdProviders_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_create_or_update.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_create_or_update.py new file mode 100644 index 000000000000..b2dc7f7bbb50 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_create_or_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python virtual_network_rules_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.virtual_network_rules.create_or_update( + resource_group_name="contosorg", + account_name="contosoadla", + virtual_network_rule_name="test_virtual_network_rules_name", + parameters={"properties": {"subnetId": "test_subnetId"}}, + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/VirtualNetworkRules_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_delete.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_delete.py new file mode 100644 index 000000000000..0485c5280b3d --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python virtual_network_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.virtual_network_rules.delete( + resource_group_name="contosorg", + account_name="contosoadla", + virtual_network_rule_name="test_virtual_network_rules_name", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/VirtualNetworkRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_get.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_get.py new file mode 100644 index 000000000000..2f3ba1f2c207 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python virtual_network_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.virtual_network_rules.get( + resource_group_name="contosorg", + account_name="contosoadla", + virtual_network_rule_name="test_virtual_network_rules_name", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/VirtualNetworkRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_list_by_account.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_list_by_account.py new file mode 100644 index 000000000000..a542d1913ab5 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_list_by_account.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python virtual_network_rules_list_by_account.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.virtual_network_rules.list_by_account( + resource_group_name="contosorg", + account_name="contosoadla", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/VirtualNetworkRules_ListByAccount.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_update.py b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_update.py new file mode 100644 index 000000000000..b5b46090a0a7 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/generated_samples/virtual_network_rules_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datalake-store +# USAGE + python virtual_network_rules_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataLakeStoreAccountManagementClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.virtual_network_rules.update( + resource_group_name="contosorg", + account_name="contosoadla", + virtual_network_rule_name="test_virtual_network_rules_name", + ) + print(response) + + +# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/VirtualNetworkRules_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/datalake/azure-mgmt-datalake-store/setup.py b/sdk/datalake/azure-mgmt-datalake-store/setup.py index f92f80361f11..27f92d4cc064 100644 --- a/sdk/datalake/azure-mgmt-datalake-store/setup.py +++ b/sdk/datalake/azure-mgmt-datalake-store/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -70,9 +71,10 @@ 'pytyped': ['py.typed'], }, install_requires=[ - 'msrest>=0.7.1', - 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.2,<2.0.0', + "msrest>=0.7.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", ], python_requires=">=3.7" ) diff --git a/sdk/devcenter/azure-developer-devcenter/pyproject.toml b/sdk/devcenter/azure-developer-devcenter/pyproject.toml new file mode 100644 index 000000000000..45f4a483fc06 --- /dev/null +++ b/sdk/devcenter/azure-developer-devcenter/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/deviceupdate/azure-iot-deviceupdate/pyproject.toml b/sdk/deviceupdate/azure-iot-deviceupdate/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/deviceupdate/azure-iot-deviceupdate/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/digitaltwins/azure-digitaltwins-core/pyproject.toml b/sdk/digitaltwins/azure-digitaltwins-core/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/digitaltwins/azure-digitaltwins-core/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md b/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md index 824aabd943e5..20d2175feb7a 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 6.4.0b1 (2023-02-16) + +### Other Changes + + - Added generated samples in github repo + - Drop support for python<3.7.0 + ## 6.3.0 (2022-12-15) ### Features Added diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/README.md b/sdk/digitaltwins/azure-mgmt-digitaltwins/README.md index 0dda7f37e4ec..ce0c5ca212fc 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/README.md +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Digital Twins Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-digitaltwins +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = AzureDigitalTwinsManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Digital Twins Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/_meta.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/_meta.json index e16855b5e34c..67148f41650d 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/_meta.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/_meta.json @@ -1,11 +1,11 @@ { - "commit": "2f2e48923cebd95f7d184608a29bcd06d9cb3653", + "commit": "51d4c24a011e300b9713179e0515fef35bf3f678", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/digitaltwins/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/digitaltwins/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/digitaltwins/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_serialization.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_serialization.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_version.py index 7215cbbeb976..a33a2c9a173f 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "6.3.0" +VERSION = "6.4.0b1" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py index 7be0cc594bb1..27973d5538ac 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py @@ -97,5 +97,5 @@ def __enter__(self) -> "AzureDigitalTwinsManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_metadata.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_metadata.json index 44f92e7c1c11..31bc748f4816 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_metadata.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_vendor.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_vendor.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_version.py index f519b2e2f369..9b88116a69e6 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.3.0" +VERSION = "6.4.0b1" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/_azure_digital_twins_management_client.py index a560dd0313f3..f73b6d5bc06d 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/_azure_digital_twins_management_client.py @@ -97,5 +97,5 @@ async def __aenter__(self) -> "AzureDigitalTwinsManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_endpoint_operations.py index f10f6650296d..f22bfa6f7623 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_endpoint_operations.py @@ -406,7 +406,7 @@ async def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -536,7 +536,7 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, endpoint_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.DigitalTwinsEndpointResource]: """Delete a DigitalTwinsInstance endpoint. :param resource_group_name: The name of the resource group that contains the diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_operations.py index 880be3a75e37..f18fe62bb183 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/aio/operations/_digital_twins_operations.py @@ -301,8 +301,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -536,7 +536,7 @@ async def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -662,7 +662,9 @@ async def _delete_initial( } @distributed_trace_async - async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.DigitalTwinsDescription]: """Delete a DigitalTwinsInstance. :param resource_group_name: The name of the resource group that contains the @@ -970,7 +972,7 @@ async def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models_py3.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models_py3.py index ffb0bfad9769..05deaf500057 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models_py3.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -42,7 +42,7 @@ class CheckNameRequest(_serialization.Model): type = "Microsoft.DigitalTwins/digitalTwinsInstances" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -80,8 +80,8 @@ def __init__( name: Optional[str] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -144,8 +144,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.DigitalTwinsSkuInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -224,8 +224,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.DigitalTwinsSkuInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -261,8 +261,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsDescription"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -300,7 +300,7 @@ class ExternalResource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -337,7 +337,9 @@ class DigitalTwinsEndpointResource(ExternalResource): "properties": {"key": "properties", "type": "DigitalTwinsEndpointResourceProperties"}, } - def __init__(self, *, properties: Optional["_models.DigitalTwinsEndpointResourceProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.DigitalTwinsEndpointResourceProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: DigitalTwinsInstance endpoint resource properties. :paramtype properties: @@ -367,8 +369,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsEndpointResource"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwinsInstance Endpoints. :paramtype next_link: str @@ -419,7 +421,7 @@ class DigitalTwinsEndpointResourceProperties(_serialization.Model): _subtype_map = {"endpoint_type": {"EventGrid": "EventGrid", "EventHub": "EventHub", "ServiceBus": "ServiceBus"}} - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] @@ -442,7 +444,7 @@ class DigitalTwinsPatchDescription(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Instance tags. :paramtype tags: dict[str, str] @@ -468,7 +470,7 @@ class DigitalTwinsSkuInfo(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Union[str, "_models.DigitalTwinsSku"], **kwargs): + def __init__(self, *, name: Union[str, "_models.DigitalTwinsSku"], **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. "F1" :paramtype name: str or ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.DigitalTwinsSku @@ -502,7 +504,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -521,7 +523,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: Error description. :paramtype error: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.ErrorDefinition @@ -581,8 +583,8 @@ def __init__( access_key2: str, tags: Optional[Dict[str, str]] = None, topic_endpoint: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] @@ -649,8 +651,8 @@ def __init__( connection_string_primary_key: str, connection_string_secondary_key: str, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] @@ -687,7 +689,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Operation properties display. :paramtype display: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.OperationDisplay @@ -726,7 +728,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -736,7 +738,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results. + """A list of DigitalTwins service operations. It contains a list of operations and a URL link to + get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -756,7 +759,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -815,8 +818,8 @@ def __init__( primary_connection_string: str, secondary_connection_string: str, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_endpoint_operations.py index 3a817262064f..d26ff10113c2 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_endpoint_operations.py @@ -555,7 +555,7 @@ def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -685,7 +685,7 @@ def _delete_initial( @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, endpoint_name: str, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.DigitalTwinsEndpointResource]: """Delete a DigitalTwinsInstance endpoint. :param resource_group_name: The name of the resource group that contains the diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_operations.py index 22b5357290c9..4ca69fe011d2 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_operations.py @@ -532,8 +532,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -767,7 +767,7 @@ def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -893,7 +893,9 @@ def _delete_initial( } @distributed_trace - def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: + def begin_delete( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> LROPoller[_models.DigitalTwinsDescription]: """Delete a DigitalTwinsInstance. :param resource_group_name: The name of the resource group that contains the @@ -1201,7 +1203,7 @@ def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2020_03_01_preview.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py index 1243aafd13fd..e9f0e1eacbcf 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py @@ -96,5 +96,5 @@ def __enter__(self) -> "AzureDigitalTwinsManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_metadata.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_metadata.json index f50be20b5938..c123e457a11d 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_metadata.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_vendor.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_vendor.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_version.py index f519b2e2f369..9b88116a69e6 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.3.0" +VERSION = "6.4.0b1" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/_azure_digital_twins_management_client.py index 9b3de706f75c..6f1622f54a9d 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/_azure_digital_twins_management_client.py @@ -97,5 +97,5 @@ async def __aenter__(self) -> "AzureDigitalTwinsManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_endpoint_operations.py index 621fd541a461..84c8cbaafacf 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_endpoint_operations.py @@ -400,7 +400,7 @@ async def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2020_10_31.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_operations.py index 0e09d4527a84..c2597b3b2224 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/aio/operations/_digital_twins_operations.py @@ -296,8 +296,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2020_10_31.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -440,7 +440,7 @@ async def update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2020_10_31.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -872,7 +872,7 @@ async def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2020_10_31.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models_py3.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models_py3.py index f60b9ab60385..65f45b8b7fb8 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models_py3.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -42,7 +42,7 @@ class CheckNameRequest(_serialization.Model): type = "Microsoft.DigitalTwins/digitalTwinsInstances" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -76,8 +76,8 @@ def __init__( name_available: Optional[bool] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -128,7 +128,7 @@ class DigitalTwinsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -196,7 +196,7 @@ class DigitalTwinsDescription(DigitalTwinsResource): "host_name": {"key": "properties.hostName", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -229,8 +229,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsDescription"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -267,7 +267,7 @@ class ExternalResource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -307,7 +307,7 @@ class DigitalTwinsEndpointResource(ExternalResource): "properties": {"key": "properties", "type": "DigitalTwinsEndpointResourceProperties"}, } - def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs): + def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs: Any) -> None: """ :keyword properties: DigitalTwinsInstance endpoint resource properties. Required. :paramtype properties: @@ -336,8 +336,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsEndpointResource"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwinsInstance Endpoints. :paramtype next_link: str @@ -389,7 +389,7 @@ class DigitalTwinsEndpointResourceProperties(_serialization.Model): _subtype_map = {"endpoint_type": {"EventGrid": "EventGrid", "EventHub": "EventHub", "ServiceBus": "ServiceBus"}} - def __init__(self, *, dead_letter_secret: Optional[str] = None, **kwargs): + def __init__(self, *, dead_letter_secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword dead_letter_secret: Dead letter storage secret. Will be obfuscated during read. :paramtype dead_letter_secret: str @@ -412,7 +412,7 @@ class DigitalTwinsPatchDescription(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Instance tags. :paramtype tags: dict[str, str] @@ -446,7 +446,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -465,7 +465,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: Error description. :paramtype error: ~azure.mgmt.digitaltwins.v2020_10_31.models.ErrorDefinition @@ -526,8 +526,8 @@ def __init__( access_key1: str, dead_letter_secret: Optional[str] = None, access_key2: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword dead_letter_secret: Dead letter storage secret. Will be obfuscated during read. :paramtype dead_letter_secret: str @@ -594,8 +594,8 @@ def __init__( connection_string_primary_key: str, dead_letter_secret: Optional[str] = None, connection_string_secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword dead_letter_secret: Dead letter storage secret. Will be obfuscated during read. :paramtype dead_letter_secret: str @@ -640,7 +640,7 @@ class Operation(_serialization.Model): "is_data_action": {"key": "isDataAction", "type": "bool"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Operation properties display. :paramtype display: ~azure.mgmt.digitaltwins.v2020_10_31.models.OperationDisplay @@ -681,7 +681,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -691,7 +691,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results. + """A list of DigitalTwins service operations. It contains a list of operations and a URL link to + get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -711,7 +712,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -770,8 +771,8 @@ def __init__( primary_connection_string: str, dead_letter_secret: Optional[str] = None, secondary_connection_string: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword dead_letter_secret: Dead letter storage secret. Will be obfuscated during read. :paramtype dead_letter_secret: str diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py index 3d674fdc7304..34bfb0822f41 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py @@ -584,7 +584,7 @@ def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2020_10_31.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py index 9487dcafebeb..0507006b2376 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py @@ -541,8 +541,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2020_10_31.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -685,7 +685,7 @@ def update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2020_10_31.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1117,7 +1117,7 @@ def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2020_10_31.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_azure_digital_twins_management_client.py index 35c3888efbcb..5f9c9b215f69 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_azure_digital_twins_management_client.py @@ -114,5 +114,5 @@ def __enter__(self) -> "AzureDigitalTwinsManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_metadata.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_metadata.json index f132fd93270d..6010d3c25e68 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_metadata.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_vendor.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_vendor.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_version.py index f519b2e2f369..9b88116a69e6 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.3.0" +VERSION = "6.4.0b1" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/_azure_digital_twins_management_client.py index 66eb765512f3..ce15018f6ec3 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/_azure_digital_twins_management_client.py @@ -115,5 +115,5 @@ async def __aenter__(self) -> "AzureDigitalTwinsManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_endpoint_operations.py index 9a0d95bf9fe2..b1a6763be1fe 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_endpoint_operations.py @@ -400,7 +400,7 @@ async def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2020_12_01.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_operations.py index f2c4983f87ee..92016863f703 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_digital_twins_operations.py @@ -296,8 +296,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2020_12_01.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -529,7 +529,7 @@ async def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2020_12_01.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -958,7 +958,7 @@ async def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2020_12_01.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py index e5a1ccb1f386..fafff8cd72e4 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py @@ -485,7 +485,7 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2020_12_01.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/models/_models_py3.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/models/_models_py3.py index e9a778c9e063..7664adc7ef66 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/models/_models_py3.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -42,7 +42,7 @@ class CheckNameRequest(_serialization.Model): type = "Microsoft.DigitalTwins/digitalTwinsInstances" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -76,8 +76,8 @@ def __init__( name_available: Optional[bool] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -135,8 +135,8 @@ def __init__( private_link_service_connection_state: Optional[ "_models.ConnectionPropertiesPrivateLinkServiceConnectionState" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: :paramtype private_endpoint: @@ -171,7 +171,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -194,7 +194,7 @@ class ConnectionPropertiesPrivateEndpoint(PrivateEndpoint): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -232,8 +232,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -284,8 +284,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -343,8 +343,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -438,8 +438,8 @@ def __init__( identity: Optional["_models.DigitalTwinsIdentity"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -483,8 +483,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsDescription"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -521,7 +521,7 @@ class ExternalResource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -561,7 +561,7 @@ class DigitalTwinsEndpointResource(ExternalResource): "properties": {"key": "properties", "type": "DigitalTwinsEndpointResourceProperties"}, } - def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs): + def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs: Any) -> None: """ :keyword properties: DigitalTwinsInstance endpoint resource properties. Required. :paramtype properties: @@ -590,8 +590,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsEndpointResource"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwinsInstance Endpoints. :paramtype next_link: str @@ -658,8 +658,8 @@ def __init__( authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, dead_letter_secret: Optional[str] = None, dead_letter_uri: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Known values are: "KeyBased" and "IdentityBased". @@ -709,7 +709,7 @@ class DigitalTwinsIdentity(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.DigitalTwinsIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.DigitalTwinsIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The type of Managed Identity used by the DigitalTwinsInstance. Only SystemAssigned is supported. Known values are: "None" and "SystemAssigned". @@ -744,8 +744,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, properties: Optional["_models.DigitalTwinsPatchProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Instance patch properties. :paramtype tags: dict[str, str] @@ -773,7 +773,9 @@ class DigitalTwinsPatchProperties(_serialization.Model): "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, } - def __init__(self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs): + def __init__( + self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs: Any + ) -> None: """ :keyword public_network_access: Public network access for the DigitalTwinsInstance. Known values are: "Enabled" and "Disabled". @@ -809,7 +811,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -828,7 +830,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: Error description. :paramtype error: ~azure.mgmt.digitaltwins.v2020_12_01.models.ErrorDefinition @@ -900,8 +902,8 @@ def __init__( dead_letter_secret: Optional[str] = None, dead_letter_uri: Optional[str] = None, access_key2: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Known values are: "KeyBased" and "IdentityBased". @@ -1000,8 +1002,8 @@ def __init__( connection_string_secondary_key: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Known values are: "KeyBased" and "IdentityBased". @@ -1073,8 +1075,8 @@ def __init__( *, properties: "_models.GroupIdInformationProperties", id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: Required. :paramtype properties: ~azure.mgmt.digitaltwins.v2020_12_01.models.GroupIdInformationProperties @@ -1111,8 +1113,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1150,8 +1152,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1176,7 +1178,7 @@ class GroupIdInformationResponse(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for a Digital Twin. :paramtype value: list[~azure.mgmt.digitaltwins.v2020_12_01.models.GroupIdInformation] @@ -1213,7 +1215,7 @@ class Operation(_serialization.Model): "is_data_action": {"key": "isDataAction", "type": "bool"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Operation properties display. :paramtype display: ~azure.mgmt.digitaltwins.v2020_12_01.models.OperationDisplay @@ -1254,7 +1256,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1264,7 +1266,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results. + """A list of DigitalTwins service operations. It contains a list of operations and a URL link to + get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1284,7 +1287,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -1326,7 +1329,7 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: Required. :paramtype properties: @@ -1380,8 +1383,8 @@ def __init__( private_link_service_connection_state: Optional[ "_models.ConnectionPropertiesPrivateLinkServiceConnectionState" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: :paramtype private_endpoint: @@ -1411,7 +1414,7 @@ class PrivateEndpointConnectionsResponse(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link connections for a Digital Twin. :paramtype value: list[~azure.mgmt.digitaltwins.v2020_12_01.models.PrivateEndpointConnection] @@ -1488,8 +1491,8 @@ def __init__( secondary_connection_string: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Known values are: "KeyBased" and "IdentityBased". diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_endpoint_operations.py index eb14735909b3..3606824e7816 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_endpoint_operations.py @@ -584,7 +584,7 @@ def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2020_12_01.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_operations.py index f1e48585b9b9..4ba99d80d8da 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_digital_twins_operations.py @@ -541,8 +541,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2020_12_01.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -774,7 +774,7 @@ def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2020_12_01.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1203,7 +1203,7 @@ def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2020_12_01.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_private_endpoint_connections_operations.py index 8e7f1371de33..ff9121366da9 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_12_01/operations/_private_endpoint_connections_operations.py @@ -667,7 +667,7 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2020_12_01.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_azure_digital_twins_management_client.py index e750c96db3dd..ac4425248d0b 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_azure_digital_twins_management_client.py @@ -122,5 +122,5 @@ def __enter__(self) -> "AzureDigitalTwinsManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_metadata.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_metadata.json index 6ec803aad75b..a8d40f3b5ac0 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_metadata.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_vendor.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_vendor.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_version.py index f519b2e2f369..9b88116a69e6 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.3.0" +VERSION = "6.4.0b1" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/_azure_digital_twins_management_client.py index f4fd00513f2f..8c0df5fa7489 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/_azure_digital_twins_management_client.py @@ -122,5 +122,5 @@ async def __aenter__(self) -> "AzureDigitalTwinsManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_endpoint_operations.py index 87d2d749d126..b50e8d83414a 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_endpoint_operations.py @@ -406,7 +406,7 @@ async def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_operations.py index 7dde3ee0e2d5..63187d008b91 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_digital_twins_operations.py @@ -301,8 +301,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -538,7 +538,7 @@ async def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -977,7 +977,7 @@ async def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_private_endpoint_connections_operations.py index c8bf54a031f5..982d14e360e7 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_private_endpoint_connections_operations.py @@ -495,7 +495,7 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_time_series_database_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_time_series_database_connections_operations.py index 662108a46eb9..876d85af593c 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_time_series_database_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/aio/operations/_time_series_database_connections_operations.py @@ -406,7 +406,7 @@ async def begin_create_or_update( :param time_series_database_connection_name: Name of time series database connection. Required. :type time_series_database_connection_name: str :param time_series_database_connection_description: The time series database connection - description. Is either a model type or a IO type. Required. + description. Is either a TimeSeriesDatabaseConnection type or a IO type. Required. :type time_series_database_connection_description: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.TimeSeriesDatabaseConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/models/_models_py3.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/models/_models_py3.py index c6f0c046f0ff..9b22773fcfe7 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/models/_models_py3.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -50,7 +50,7 @@ class TimeSeriesDatabaseConnectionProperties(_serialization.Model): _subtype_map = {"connection_type": {"AzureDataExplorer": "AzureDataExplorerConnectionProperties"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.connection_type: Optional[str] = None @@ -58,7 +58,8 @@ def __init__(self, **kwargs): class AzureDataExplorerConnectionProperties(TimeSeriesDatabaseConnectionProperties): - """Properties of a time series database connection to Azure Data Explorer with data being sent via an EventHub. + """Properties of a time series database connection to Azure Data Explorer with data being sent via + an EventHub. Variables are only populated by the server, and will be ignored when sending a request. @@ -129,8 +130,8 @@ def __init__( event_hub_namespace_resource_id: str, adx_table_name: str = "AdtPropertyEvents", event_hub_consumer_group: str = "$Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword adx_resource_id: The resource ID of the Azure Data Explorer cluster. Required. :paramtype adx_resource_id: str @@ -191,7 +192,7 @@ class CheckNameRequest(_serialization.Model): type = "Microsoft.DigitalTwins/digitalTwinsInstances" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -225,8 +226,8 @@ def __init__( name_available: Optional[bool] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -283,8 +284,8 @@ def __init__( private_link_service_connection_state: Optional[ "_models.ConnectionPropertiesPrivateLinkServiceConnectionState" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint. :paramtype private_endpoint: @@ -335,8 +336,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -387,8 +388,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -451,8 +452,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -552,8 +553,8 @@ def __init__( identity: Optional["_models.DigitalTwinsIdentity"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -598,8 +599,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsDescription"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -641,7 +642,7 @@ class ExternalResource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -686,7 +687,7 @@ class DigitalTwinsEndpointResource(ExternalResource): "properties": {"key": "properties", "type": "DigitalTwinsEndpointResourceProperties"}, } - def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs): + def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs: Any) -> None: """ :keyword properties: DigitalTwinsInstance endpoint resource properties. Required. :paramtype properties: @@ -716,8 +717,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsEndpointResource"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwinsInstance Endpoints. :paramtype next_link: str @@ -787,8 +788,8 @@ def __init__( authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, dead_letter_secret: Optional[str] = None, dead_letter_uri: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -842,7 +843,7 @@ class DigitalTwinsIdentity(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.DigitalTwinsIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.DigitalTwinsIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The type of Managed Identity used by the DigitalTwinsInstance. Only SystemAssigned is supported. Known values are: "None" and "SystemAssigned". @@ -879,8 +880,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, properties: Optional["_models.DigitalTwinsPatchProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Instance patch properties. :paramtype tags: dict[str, str] @@ -909,7 +910,9 @@ class DigitalTwinsPatchProperties(_serialization.Model): "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, } - def __init__(self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs): + def __init__( + self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs: Any + ) -> None: """ :keyword public_network_access: Public network access for the DigitalTwinsInstance. Known values are: "Enabled" and "Disabled". @@ -945,7 +948,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -964,7 +967,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: Error description. :paramtype error: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.ErrorDefinition @@ -1039,8 +1042,8 @@ def __init__( dead_letter_secret: Optional[str] = None, dead_letter_uri: Optional[str] = None, access_key2: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1145,8 +1148,8 @@ def __init__( connection_string_secondary_key: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1222,8 +1225,8 @@ def __init__( *, properties: "_models.GroupIdInformationProperties", id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The group information properties. Required. :paramtype properties: @@ -1261,8 +1264,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1288,7 +1291,7 @@ class GroupIdInformationResponse(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for a Digital Twin. :paramtype value: list[~azure.mgmt.digitaltwins.v2021_06_30_preview.models.GroupIdInformation] @@ -1329,7 +1332,7 @@ class Operation(_serialization.Model): "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Operation properties display. :paramtype display: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.OperationDisplay @@ -1371,7 +1374,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1381,7 +1384,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results. + """A list of DigitalTwins service operations. It contains a list of operations and a URL link to + get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1401,7 +1405,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -1428,7 +1432,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1470,7 +1474,7 @@ class PrivateEndpointConnection(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, properties: "_models.ConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.ConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The connection properties. Required. :paramtype properties: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.ConnectionProperties @@ -1495,7 +1499,7 @@ class PrivateEndpointConnectionsResponse(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link connections for a Digital Twin. :paramtype value: @@ -1576,8 +1580,8 @@ def __init__( secondary_connection_string: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1655,8 +1659,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1717,7 +1721,9 @@ class TimeSeriesDatabaseConnection(ExternalResource): "properties": {"key": "properties", "type": "TimeSeriesDatabaseConnectionProperties"}, } - def __init__(self, *, properties: Optional["_models.TimeSeriesDatabaseConnectionProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.TimeSeriesDatabaseConnectionProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Properties of a specific time series database connection. :paramtype properties: @@ -1747,8 +1753,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.TimeSeriesDatabaseConnection"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of results. :paramtype next_link: str diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_endpoint_operations.py index 938b3bda8187..f2127dddce88 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_endpoint_operations.py @@ -598,7 +598,7 @@ def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_operations.py index 7e807a5cac55..a593c737865a 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_digital_twins_operations.py @@ -560,8 +560,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -797,7 +797,7 @@ def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1236,7 +1236,7 @@ def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_private_endpoint_connections_operations.py index b1e3d332d575..fe10eccb3174 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_private_endpoint_connections_operations.py @@ -685,7 +685,7 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_time_series_database_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_time_series_database_connections_operations.py index 3430af93b0b5..57b482e72edf 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_time_series_database_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2021_06_30_preview/operations/_time_series_database_connections_operations.py @@ -610,7 +610,7 @@ def begin_create_or_update( :param time_series_database_connection_name: Name of time series database connection. Required. :type time_series_database_connection_name: str :param time_series_database_connection_description: The time series database connection - description. Is either a model type or a IO type. Required. + description. Is either a TimeSeriesDatabaseConnection type or a IO type. Required. :type time_series_database_connection_description: ~azure.mgmt.digitaltwins.v2021_06_30_preview.models.TimeSeriesDatabaseConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_azure_digital_twins_management_client.py index 593f55421211..c5e3f3781e12 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_azure_digital_twins_management_client.py @@ -121,5 +121,5 @@ def __enter__(self) -> "AzureDigitalTwinsManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_metadata.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_metadata.json index 36d31c322566..abaf36a9f38c 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_metadata.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_vendor.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_vendor.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_version.py index f519b2e2f369..9b88116a69e6 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.3.0" +VERSION = "6.4.0b1" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/_azure_digital_twins_management_client.py index 5e5d606eca10..00af944a28ff 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/_azure_digital_twins_management_client.py @@ -122,5 +122,5 @@ async def __aenter__(self) -> "AzureDigitalTwinsManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_endpoint_operations.py index c282a6a1f895..52d828552dca 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_endpoint_operations.py @@ -400,7 +400,7 @@ async def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2022_05_31.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_operations.py index 30cddfcbb9e6..92276af7f1d9 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_digital_twins_operations.py @@ -296,8 +296,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2022_05_31.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -529,7 +529,7 @@ async def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2022_05_31.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -958,7 +958,7 @@ async def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2022_05_31.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_private_endpoint_connections_operations.py index 016e498f2e51..600a423deecc 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_private_endpoint_connections_operations.py @@ -485,7 +485,7 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2022_05_31.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_time_series_database_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_time_series_database_connections_operations.py index 7b4795ed70c1..39376c88a1dd 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_time_series_database_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/aio/operations/_time_series_database_connections_operations.py @@ -400,7 +400,7 @@ async def begin_create_or_update( :param time_series_database_connection_name: Name of time series database connection. Required. :type time_series_database_connection_name: str :param time_series_database_connection_description: The time series database connection - description. Is either a model type or a IO type. Required. + description. Is either a TimeSeriesDatabaseConnection type or a IO type. Required. :type time_series_database_connection_description: ~azure.mgmt.digitaltwins.v2022_05_31.models.TimeSeriesDatabaseConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/models/_models_py3.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/models/_models_py3.py index efbd8749b7d0..f93ada6c62ee 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/models/_models_py3.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -49,7 +49,7 @@ class TimeSeriesDatabaseConnectionProperties(_serialization.Model): _subtype_map = {"connection_type": {"AzureDataExplorer": "AzureDataExplorerConnectionProperties"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.connection_type: Optional[str] = None @@ -57,7 +57,8 @@ def __init__(self, **kwargs): class AzureDataExplorerConnectionProperties(TimeSeriesDatabaseConnectionProperties): - """Properties of a time series database connection to Azure Data Explorer with data being sent via an EventHub. + """Properties of a time series database connection to Azure Data Explorer with data being sent via + an EventHub. Variables are only populated by the server, and will be ignored when sending a request. @@ -127,8 +128,8 @@ def __init__( event_hub_namespace_resource_id: str, adx_table_name: str = "AdtPropertyEvents", event_hub_consumer_group: str = "$Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword adx_resource_id: The resource ID of the Azure Data Explorer cluster. Required. :paramtype adx_resource_id: str @@ -189,7 +190,7 @@ class CheckNameRequest(_serialization.Model): type = "Microsoft.DigitalTwins/digitalTwinsInstances" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -223,8 +224,8 @@ def __init__( name_available: Optional[bool] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -281,8 +282,8 @@ def __init__( private_link_service_connection_state: Optional[ "_models.ConnectionPropertiesPrivateLinkServiceConnectionState" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint. :paramtype private_endpoint: ~azure.mgmt.digitaltwins.v2022_05_31.models.PrivateEndpoint @@ -332,8 +333,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -384,8 +385,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -448,8 +449,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -549,8 +550,8 @@ def __init__( identity: Optional["_models.DigitalTwinsIdentity"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -594,8 +595,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsDescription"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -636,7 +637,7 @@ class ExternalResource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -681,7 +682,7 @@ class DigitalTwinsEndpointResource(ExternalResource): "properties": {"key": "properties", "type": "DigitalTwinsEndpointResourceProperties"}, } - def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs): + def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs: Any) -> None: """ :keyword properties: DigitalTwinsInstance endpoint resource properties. Required. :paramtype properties: @@ -710,8 +711,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsEndpointResource"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwinsInstance Endpoints. :paramtype next_link: str @@ -781,8 +782,8 @@ def __init__( authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, dead_letter_secret: Optional[str] = None, dead_letter_uri: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -835,7 +836,7 @@ class DigitalTwinsIdentity(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.DigitalTwinsIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.DigitalTwinsIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The type of Managed Identity used by the DigitalTwinsInstance. Only SystemAssigned is supported. Known values are: "None" and "SystemAssigned". @@ -870,8 +871,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, properties: Optional["_models.DigitalTwinsPatchProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Instance patch properties. :paramtype tags: dict[str, str] @@ -899,7 +900,9 @@ class DigitalTwinsPatchProperties(_serialization.Model): "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, } - def __init__(self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs): + def __init__( + self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs: Any + ) -> None: """ :keyword public_network_access: Public network access for the DigitalTwinsInstance. Known values are: "Enabled" and "Disabled". @@ -935,7 +938,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -954,7 +957,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: Error description. :paramtype error: ~azure.mgmt.digitaltwins.v2022_05_31.models.ErrorDefinition @@ -1029,8 +1032,8 @@ def __init__( dead_letter_secret: Optional[str] = None, dead_letter_uri: Optional[str] = None, access_key2: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1135,8 +1138,8 @@ def __init__( connection_string_secondary_key: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1211,8 +1214,8 @@ def __init__( *, properties: "_models.GroupIdInformationProperties", id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The group information properties. Required. :paramtype properties: ~azure.mgmt.digitaltwins.v2022_05_31.models.GroupIdInformationProperties @@ -1249,8 +1252,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1276,7 +1279,7 @@ class GroupIdInformationResponse(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for a Digital Twin. :paramtype value: list[~azure.mgmt.digitaltwins.v2022_05_31.models.GroupIdInformation] @@ -1317,7 +1320,7 @@ class Operation(_serialization.Model): "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Operation properties display. :paramtype display: ~azure.mgmt.digitaltwins.v2022_05_31.models.OperationDisplay @@ -1359,7 +1362,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1369,7 +1372,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results. + """A list of DigitalTwins service operations. It contains a list of operations and a URL link to + get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1389,7 +1393,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -1416,7 +1420,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1458,7 +1462,7 @@ class PrivateEndpointConnection(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, properties: "_models.ConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.ConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The connection properties. Required. :paramtype properties: ~azure.mgmt.digitaltwins.v2022_05_31.models.ConnectionProperties @@ -1482,7 +1486,7 @@ class PrivateEndpointConnectionsResponse(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link connections for a Digital Twin. :paramtype value: list[~azure.mgmt.digitaltwins.v2022_05_31.models.PrivateEndpointConnection] @@ -1562,8 +1566,8 @@ def __init__( secondary_connection_string: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1640,8 +1644,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1701,7 +1705,9 @@ class TimeSeriesDatabaseConnection(ExternalResource): "properties": {"key": "properties", "type": "TimeSeriesDatabaseConnectionProperties"}, } - def __init__(self, *, properties: Optional["_models.TimeSeriesDatabaseConnectionProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.TimeSeriesDatabaseConnectionProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Properties of a specific time series database connection. :paramtype properties: @@ -1730,8 +1736,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.TimeSeriesDatabaseConnection"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of results. :paramtype next_link: str diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_endpoint_operations.py index b43c55c06252..31a563f727b3 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_endpoint_operations.py @@ -584,7 +584,7 @@ def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2022_05_31.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_operations.py index 13c7f4744898..b39cf5ea15bb 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_digital_twins_operations.py @@ -541,8 +541,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2022_05_31.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -774,7 +774,7 @@ def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2022_05_31.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1203,7 +1203,7 @@ def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2022_05_31.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_private_endpoint_connections_operations.py index 0bdacad5f375..dbb0078f22a7 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_private_endpoint_connections_operations.py @@ -667,7 +667,7 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2022_05_31.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_time_series_database_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_time_series_database_connections_operations.py index 0417705ebd4c..c84713c176ea 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_time_series_database_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_05_31/operations/_time_series_database_connections_operations.py @@ -596,7 +596,7 @@ def begin_create_or_update( :param time_series_database_connection_name: Name of time series database connection. Required. :type time_series_database_connection_name: str :param time_series_database_connection_description: The time series database connection - description. Is either a model type or a IO type. Required. + description. Is either a TimeSeriesDatabaseConnection type or a IO type. Required. :type time_series_database_connection_description: ~azure.mgmt.digitaltwins.v2022_05_31.models.TimeSeriesDatabaseConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_azure_digital_twins_management_client.py index 8c81dab19b2d..472f9f45e0a3 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_azure_digital_twins_management_client.py @@ -121,5 +121,5 @@ def __enter__(self) -> "AzureDigitalTwinsManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_metadata.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_metadata.json index be37a4586de0..7e3de7326222 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_metadata.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_vendor.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_vendor.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_version.py index f519b2e2f369..9b88116a69e6 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.3.0" +VERSION = "6.4.0b1" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/_azure_digital_twins_management_client.py index 2f3be7b2803b..b66ae3bcc9a4 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/_azure_digital_twins_management_client.py @@ -122,5 +122,5 @@ async def __aenter__(self) -> "AzureDigitalTwinsManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_endpoint_operations.py index 1f7b250be9c2..dbc45f172d6c 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_endpoint_operations.py @@ -400,7 +400,7 @@ async def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2022_10_31.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_operations.py index f61a53693a41..49853b010234 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_digital_twins_operations.py @@ -296,8 +296,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2022_10_31.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -529,7 +529,7 @@ async def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2022_10_31.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -958,7 +958,7 @@ async def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2022_10_31.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_private_endpoint_connections_operations.py index 5d1a690d969f..ad3931b9a04f 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_private_endpoint_connections_operations.py @@ -485,7 +485,7 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2022_10_31.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_time_series_database_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_time_series_database_connections_operations.py index 2a850319ddf8..45d613aa5d5f 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_time_series_database_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/aio/operations/_time_series_database_connections_operations.py @@ -400,7 +400,7 @@ async def begin_create_or_update( :param time_series_database_connection_name: Name of time series database connection. Required. :type time_series_database_connection_name: str :param time_series_database_connection_description: The time series database connection - description. Is either a model type or a IO type. Required. + description. Is either a TimeSeriesDatabaseConnection type or a IO type. Required. :type time_series_database_connection_description: ~azure.mgmt.digitaltwins.v2022_10_31.models.TimeSeriesDatabaseConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/models/_models_py3.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/models/_models_py3.py index 6e131afd8d7d..0ee037c1f245 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/models/_models_py3.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -52,7 +52,7 @@ class TimeSeriesDatabaseConnectionProperties(_serialization.Model): _subtype_map = {"connection_type": {"AzureDataExplorer": "AzureDataExplorerConnectionProperties"}} - def __init__(self, *, identity: Optional["_models.ManagedIdentityReference"] = None, **kwargs): + def __init__(self, *, identity: Optional["_models.ManagedIdentityReference"] = None, **kwargs: Any) -> None: """ :keyword identity: Managed identity properties for the time series database connection resource. @@ -67,7 +67,8 @@ def __init__(self, *, identity: Optional["_models.ManagedIdentityReference"] = N class AzureDataExplorerConnectionProperties( TimeSeriesDatabaseConnectionProperties ): # pylint: disable=too-many-instance-attributes - """Properties of a time series database connection to Azure Data Explorer with data being sent via an EventHub. + """Properties of a time series database connection to Azure Data Explorer with data being sent via + an EventHub. Variables are only populated by the server, and will be ignored when sending a request. @@ -141,8 +142,8 @@ def __init__( identity: Optional["_models.ManagedIdentityReference"] = None, adx_table_name: str = "AdtPropertyEvents", event_hub_consumer_group: str = "$Default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Managed identity properties for the time series database connection resource. @@ -206,7 +207,7 @@ class CheckNameRequest(_serialization.Model): type = "Microsoft.DigitalTwins/digitalTwinsInstances" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -240,8 +241,8 @@ def __init__( name_available: Optional[bool] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -298,8 +299,8 @@ def __init__( private_link_service_connection_state: Optional[ "_models.ConnectionPropertiesPrivateLinkServiceConnectionState" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint. :paramtype private_endpoint: ~azure.mgmt.digitaltwins.v2022_10_31.models.PrivateEndpoint @@ -349,8 +350,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -401,8 +402,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -465,8 +466,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -566,8 +567,8 @@ def __init__( identity: Optional["_models.DigitalTwinsIdentity"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -611,8 +612,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsDescription"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -653,7 +654,7 @@ class ExternalResource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -698,7 +699,7 @@ class DigitalTwinsEndpointResource(ExternalResource): "properties": {"key": "properties", "type": "DigitalTwinsEndpointResourceProperties"}, } - def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs): + def __init__(self, *, properties: "_models.DigitalTwinsEndpointResourceProperties", **kwargs: Any) -> None: """ :keyword properties: DigitalTwinsInstance endpoint resource properties. Required. :paramtype properties: @@ -727,8 +728,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.DigitalTwinsEndpointResource"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwinsInstance Endpoints. :paramtype next_link: str @@ -802,8 +803,8 @@ def __init__( dead_letter_secret: Optional[str] = None, dead_letter_uri: Optional[str] = None, identity: Optional["_models.ManagedIdentityReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -871,8 +872,8 @@ def __init__( *, type: Optional[Union[str, "_models.DigitalTwinsIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of Managed Identity used by the DigitalTwinsInstance. Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". @@ -914,8 +915,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, identity: Optional["_models.DigitalTwinsIdentity"] = None, properties: Optional["_models.DigitalTwinsPatchProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Instance patch properties. :paramtype tags: dict[str, str] @@ -943,7 +944,9 @@ class DigitalTwinsPatchProperties(_serialization.Model): "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, } - def __init__(self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs): + def __init__( + self, *, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs: Any + ) -> None: """ :keyword public_network_access: Public network access for the DigitalTwinsInstance. Known values are: "Enabled" and "Disabled". @@ -979,7 +982,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -998,7 +1001,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: Error description. :paramtype error: ~azure.mgmt.digitaltwins.v2022_10_31.models.ErrorDefinition @@ -1077,8 +1080,8 @@ def __init__( dead_letter_uri: Optional[str] = None, identity: Optional["_models.ManagedIdentityReference"] = None, access_key2: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1190,8 +1193,8 @@ def __init__( connection_string_secondary_key: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1269,8 +1272,8 @@ def __init__( *, properties: "_models.GroupIdInformationProperties", id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The group information properties. Required. :paramtype properties: ~azure.mgmt.digitaltwins.v2022_10_31.models.GroupIdInformationProperties @@ -1307,8 +1310,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1334,7 +1337,7 @@ class GroupIdInformationResponse(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for a Digital Twin. :paramtype value: list[~azure.mgmt.digitaltwins.v2022_10_31.models.GroupIdInformation] @@ -1364,8 +1367,8 @@ def __init__( *, type: Optional[Union[str, "_models.IdentityType"]] = None, user_assigned_identity: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of managed identity used. Known values are: "SystemAssigned" and "UserAssigned". @@ -1411,7 +1414,7 @@ class Operation(_serialization.Model): "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Operation properties display. :paramtype display: ~azure.mgmt.digitaltwins.v2022_10_31.models.OperationDisplay @@ -1453,7 +1456,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1463,7 +1466,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results. + """A list of DigitalTwins service operations. It contains a list of operations and a URL link to + get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1483,7 +1487,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of DigitalTwins description objects. :paramtype next_link: str @@ -1510,7 +1514,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1552,7 +1556,7 @@ class PrivateEndpointConnection(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, properties: "_models.ConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.ConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The connection properties. Required. :paramtype properties: ~azure.mgmt.digitaltwins.v2022_10_31.models.ConnectionProperties @@ -1576,7 +1580,7 @@ class PrivateEndpointConnectionsResponse(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link connections for a Digital Twin. :paramtype value: list[~azure.mgmt.digitaltwins.v2022_10_31.models.PrivateEndpointConnection] @@ -1660,8 +1664,8 @@ def __init__( secondary_connection_string: Optional[str] = None, endpoint_uri: Optional[str] = None, entity_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be @@ -1741,8 +1745,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1802,7 +1806,9 @@ class TimeSeriesDatabaseConnection(ExternalResource): "properties": {"key": "properties", "type": "TimeSeriesDatabaseConnectionProperties"}, } - def __init__(self, *, properties: Optional["_models.TimeSeriesDatabaseConnectionProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.TimeSeriesDatabaseConnectionProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Properties of a specific time series database connection. :paramtype properties: @@ -1831,8 +1837,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.TimeSeriesDatabaseConnection"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of results. :paramtype next_link: str @@ -1866,7 +1872,7 @@ class UserAssignedIdentity(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.client_id = None diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_endpoint_operations.py index 0bd330f079f4..910e164ca2df 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_endpoint_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_endpoint_operations.py @@ -584,7 +584,7 @@ def begin_create_or_update( :param endpoint_name: Name of Endpoint Resource. Required. :type endpoint_name: str :param endpoint_description: The DigitalTwinsInstance endpoint metadata and security metadata. - Is either a model type or a IO type. Required. + Is either a DigitalTwinsEndpointResource type or a IO type. Required. :type endpoint_description: ~azure.mgmt.digitaltwins.v2022_10_31.models.DigitalTwinsEndpointResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_operations.py index eb1eb68679fb..95135cd22662 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_digital_twins_operations.py @@ -541,8 +541,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str - :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a model - type or a IO type. Required. + :param digital_twins_create: The DigitalTwinsInstance and security metadata. Is either a + DigitalTwinsDescription type or a IO type. Required. :type digital_twins_create: ~azure.mgmt.digitaltwins.v2022_10_31.models.DigitalTwinsDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -774,7 +774,7 @@ def begin_update( :param resource_name: The name of the DigitalTwinsInstance. Required. :type resource_name: str :param digital_twins_patch_description: The DigitalTwinsInstance and security metadata. Is - either a model type or a IO type. Required. + either a DigitalTwinsPatchDescription type or a IO type. Required. :type digital_twins_patch_description: ~azure.mgmt.digitaltwins.v2022_10_31.models.DigitalTwinsPatchDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1203,7 +1203,7 @@ def check_name_availability( :type location: str :param digital_twins_instance_check_name: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. Is - either a model type or a IO type. Required. + either a CheckNameRequest type or a IO type. Required. :type digital_twins_instance_check_name: ~azure.mgmt.digitaltwins.v2022_10_31.models.CheckNameRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_private_endpoint_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_private_endpoint_connections_operations.py index b9c8abe922eb..2a4c3b3e93a0 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_private_endpoint_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_private_endpoint_connections_operations.py @@ -667,7 +667,7 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.digitaltwins.v2022_10_31.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_time_series_database_connections_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_time_series_database_connections_operations.py index 02182609a0db..2ae17d792f62 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_time_series_database_connections_operations.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2022_10_31/operations/_time_series_database_connections_operations.py @@ -596,7 +596,7 @@ def begin_create_or_update( :param time_series_database_connection_name: Name of time series database connection. Required. :type time_series_database_connection_name: str :param time_series_database_connection_description: The time series database connection - description. Is either a model type or a IO type. Required. + description. Is either a TimeSeriesDatabaseConnection type or a IO type. Required. :type time_series_database_connection_description: ~azure.mgmt.digitaltwins.v2022_10_31.models.TimeSeriesDatabaseConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_check_name_availability_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_check_name_availability_example.py new file mode 100644 index 000000000000..619e91cb3d9e --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_check_name_availability_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_check_name_availability_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.check_name_availability( + location="WestUS2", + digital_twins_instance_check_name={ + "name": "myadtinstance", + "type": "Microsoft.DigitalTwins/digitalTwinsInstances", + }, + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsCheckNameAvailability_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_delete_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_delete_example.py new file mode 100644 index 000000000000..04c35176712e --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_delete_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_delete_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.begin_delete( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsDelete_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_delete_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_delete_with_identity_example.py new file mode 100644 index 000000000000..f67ca783738d --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_delete_with_identity_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_delete_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.begin_delete( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsDelete_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_autoscale.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_delete_example.py similarity index 64% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_autoscale.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_delete_example.py index ebed72e4388c..a297966dbed5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_autoscale.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_delete_example.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-digitaltwins # USAGE - python cosmos_db_cassandra_view_migrate_to_autoscale.py + python digital_twins_endpoint_delete_example.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,20 +24,19 @@ def main(): - client = CosmosDBManagementClient( + client = AzureDigitalTwinsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", ) - response = client.cassandra_resources.begin_migrate_cassandra_view_to_autoscale( - resource_group_name="rg1", - account_name="ddb1", - keyspace_name="keyspacename", - view_name="viewname", + response = client.digital_twins_endpoint.begin_delete( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + endpoint_name="myendpoint", ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewMigrateToAutoscale.json +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointDelete_example.json if __name__ == "__main__": main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_delete_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_delete_with_identity_example.py new file mode 100644 index 000000000000..9d141160c8f2 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_delete_with_identity_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_endpoint_delete_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins_endpoint.begin_delete( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + endpoint_name="myendpoint", + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointDelete_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_get_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_get_example.py new file mode 100644 index 000000000000..8dc59c7a11f2 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_get_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_endpoint_get_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins_endpoint.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + endpoint_name="myServiceBus", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointGet_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_get_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_get_with_identity_example.py new file mode 100644 index 000000000000..685cc8917f7d --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_get_with_identity_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_endpoint_get_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins_endpoint.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + endpoint_name="myServiceBus", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointGet_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_redistribute_throughput.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_example.py similarity index 50% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_redistribute_throughput.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_example.py index 02776fbe4021..5e2a82adb363 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_redistribute_throughput.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_example.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-digitaltwins # USAGE - python cosmos_db_mongo_db_collection_redistribute_throughput.py + python digital_twins_endpoint_put_example.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,32 +24,27 @@ def main(): - client = CosmosDBManagementClient( + client = AzureDigitalTwinsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", ) - response = client.mongo_db_resources.begin_mongo_db_container_redistribute_throughput( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - collection_name="collectionName", - redistribute_throughput_parameters={ + response = client.digital_twins_endpoint.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + endpoint_name="myServiceBus", + endpoint_description={ "properties": { - "resource": { - "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], - "targetPhysicalPartitionThroughputInfo": [ - {"id": "0", "throughput": 5000}, - {"id": "1", "throughput": 5000}, - ], - "throughputPolicy": "custom", - } + "authenticationType": "KeyBased", + "endpointType": "ServiceBus", + "primaryConnectionString": "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc", + "secondaryConnectionString": "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc", } }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionRedistributeThroughput.json +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointPut_example.json if __name__ == "__main__": main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_with_identity_example.py new file mode 100644 index 000000000000..7c68da1361eb --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_with_identity_example.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_endpoint_put_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins_endpoint.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + endpoint_name="myServiceBus", + endpoint_description={ + "properties": { + "authenticationType": "IdentityBased", + "endpointType": "ServiceBus", + "endpointUri": "sb://mysb.servicebus.windows.net/", + "entityPath": "mysbtopic", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointPut_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_with_user_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_with_user_identity_example.py new file mode 100644 index 000000000000..08df93422e70 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoint_put_with_user_identity_example.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_endpoint_put_with_user_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins_endpoint.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + endpoint_name="myServiceBus", + endpoint_description={ + "properties": { + "authenticationType": "IdentityBased", + "endpointType": "ServiceBus", + "endpointUri": "sb://mysb.servicebus.windows.net/", + "entityPath": "mysbtopic", + "identity": { + "type": "UserAssigned", + "userAssignedIdentity": "/subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity", + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointPut_WithUserIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoints_get_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoints_get_example.py new file mode 100644 index 000000000000..9c83ad4acf7c --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoints_get_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_endpoints_get_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins_endpoint.list( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointsGet_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoints_get_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoints_get_with_identity_example.py new file mode 100644 index 000000000000..5a124ca63f86 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_endpoints_get_with_identity_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_endpoints_get_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins_endpoint.list( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsEndpointsGet_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_example.py new file mode 100644 index 000000000000..eee7483fbbce --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_get_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsGet_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_with_identity_example.py new file mode 100644 index 000000000000..e075bcd3c378 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_with_identity_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_get_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsGet_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_with_private_endpoint_connection_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_with_private_endpoint_connection_example.py new file mode 100644 index 000000000000..cdc5adb37e01 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_get_with_private_endpoint_connection_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_get_with_private_endpoint_connection_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsGet_WithPrivateEndpointConnection_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_list_by_resource_group_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_list_by_resource_group_example.py new file mode 100644 index 000000000000..b3b7d6e2530a --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_list_by_resource_group_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_list_by_resource_group_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.list_by_resource_group( + resource_group_name="resRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsListByResourceGroup_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_list_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_list_example.py new file mode 100644 index 000000000000..74ce35210db2 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_list_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_operations_list_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_operations_list_example.py new file mode 100644 index 000000000000..ac7283123257 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_operations_list_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_operations_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsOperationsList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_example.py new file mode 100644 index 000000000000..0a3b7ebd3650 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_patch_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.begin_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + digital_twins_patch_description={"tags": {"purpose": "dev"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsPatch_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_with_identity_example.py new file mode 100644 index 000000000000..81315ae4b9ee --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_with_identity_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_patch_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.begin_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + digital_twins_patch_description={"identity": {"type": "None"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsPatch_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_partition_merge.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_with_public_network_access.py similarity index 61% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_partition_merge.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_with_public_network_access.py index 0ad136bdfed5..1e7171407e03 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_partition_merge.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_patch_with_public_network_access.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-digitaltwins # USAGE - python cosmos_db_mongo_db_collection_partition_merge.py + python digital_twins_patch_with_public_network_access.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,21 +24,19 @@ def main(): - client = CosmosDBManagementClient( + client = AzureDigitalTwinsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", ) - response = client.mongo_db_resources.begin_list_mongo_db_collection_partition_merge( - resource_group_name="rgName", - account_name="ddb1", - database_name="databaseName", - collection_name="collectionName", - merge_parameters={"isDryRun": False}, + response = client.digital_twins.begin_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + digital_twins_patch_description={"properties": {"publicNetworkAccess": "Disabled"}}, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionPartitionMerge.json +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsPatch_WithPublicNetworkAccess.json if __name__ == "__main__": main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_example.py new file mode 100644 index 000000000000..d9ef9b221efd --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_put_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + digital_twins_create={"location": "WestUS2"}, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsPut_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_with_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_with_identity_example.py new file mode 100644 index 000000000000..e4396f44c570 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_with_identity_example.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_put_with_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + digital_twins_create={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity": {} + }, + }, + "location": "WestUS2", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsPut_WithIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_with_public_network_access.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_with_public_network_access.py new file mode 100644 index 000000000000..e067f8691acb --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/digital_twins_put_with_public_network_access.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python digital_twins_put_with_public_network_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.digital_twins.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + digital_twins_create={"location": "WestUS2", "properties": {"publicNetworkAccess": "Enabled"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/DigitalTwinsPut_WithPublicNetworkAccess.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_by_connection_name_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_by_connection_name_example.py new file mode 100644 index 000000000000..5b8de9cddbb9 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_by_connection_name_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python private_endpoint_connection_by_connection_name_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + private_endpoint_connection_name="myPrivateConnection", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/PrivateEndpointConnectionByConnectionName_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_delete_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_delete_example.py new file mode 100644 index 000000000000..b1ecaac985e2 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_delete_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python private_endpoint_connection_delete_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.private_endpoint_connections.begin_delete( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + private_endpoint_connection_name="myPrivateConnection", + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/PrivateEndpointConnectionDelete_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_put_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_put_example.py new file mode 100644 index 000000000000..132e08964911 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connection_put_example.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python private_endpoint_connection_put_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.private_endpoint_connections.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + private_endpoint_connection_name="myPrivateConnection", + private_endpoint_connection={ + "properties": { + "privateLinkServiceConnectionState": { + "description": "Approved by johndoe@company.com.", + "status": "Approved", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/PrivateEndpointConnectionPut_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connections_list_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connections_list_example.py new file mode 100644 index 000000000000..81bdf8f705eb --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_endpoint_connections_list_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python private_endpoint_connections_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.private_endpoint_connections.list( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/PrivateEndpointConnectionsList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_link_resources_by_group_id_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_link_resources_by_group_id_example.py new file mode 100644 index 000000000000..8c7b8c983ff1 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_link_resources_by_group_id_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python private_link_resources_by_group_id_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.private_link_resources.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + resource_id="subResource", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/PrivateLinkResourcesByGroupId_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_link_resources_list_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_link_resources_list_example.py new file mode 100644 index 000000000000..1bf84a0dbd4b --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/private_link_resources_list_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python private_link_resources_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.private_link_resources.list( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/PrivateLinkResourcesList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_delete_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_delete_example.py new file mode 100644 index 000000000000..0df6cedcb0b8 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_delete_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python time_series_database_connections_delete_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.time_series_database_connections.begin_delete( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + time_series_database_connection_name="myConnection", + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/TimeSeriesDatabaseConnectionsDelete_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_get_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_get_example.py new file mode 100644 index 000000000000..b2092049624e --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_get_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python time_series_database_connections_get_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.time_series_database_connections.get( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + time_series_database_connection_name="myConnection", + ) + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/TimeSeriesDatabaseConnectionsGet_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_list_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_list_example.py new file mode 100644 index 000000000000..07ac0100918a --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_list_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python time_series_database_connections_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.time_series_database_connections.list( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/TimeSeriesDatabaseConnectionsList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_put_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_put_example.py new file mode 100644 index 000000000000..8aee6f517b4a --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_put_example.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python time_series_database_connections_put_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.time_series_database_connections.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + time_series_database_connection_name="myConnection", + time_series_database_connection_description={ + "properties": { + "adxDatabaseName": "myDatabase", + "adxEndpointUri": "https://mycluster.kusto.windows.net", + "adxResourceId": "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.Kusto/clusters/mycluster", + "adxTableName": "myTable", + "connectionType": "AzureDataExplorer", + "eventHubEndpointUri": "sb://myeh.servicebus.windows.net/", + "eventHubEntityPath": "myeh", + "eventHubNamespaceResourceId": "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.EventHub/namespaces/myeh", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/TimeSeriesDatabaseConnectionsPut_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_put_with_user_identity_example.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_put_with_user_identity_example.py new file mode 100644 index 000000000000..24380df4a51d --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/generated_samples/time_series_database_connections_put_with_user_identity_example.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-digitaltwins +# USAGE + python time_series_database_connections_put_with_user_identity_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureDigitalTwinsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="50016170-c839-41ba-a724-51e9df440b9e", + ) + + response = client.time_series_database_connections.begin_create_or_update( + resource_group_name="resRg", + resource_name="myDigitalTwinsService", + time_series_database_connection_name="myConnection", + time_series_database_connection_description={ + "properties": { + "adxDatabaseName": "myDatabase", + "adxEndpointUri": "https://mycluster.kusto.windows.net", + "adxResourceId": "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.Kusto/clusters/mycluster", + "adxTableName": "myTable", + "connectionType": "AzureDataExplorer", + "eventHubEndpointUri": "sb://myeh.servicebus.windows.net/", + "eventHubEntityPath": "myeh", + "eventHubNamespaceResourceId": "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.EventHub/namespaces/myeh", + "identity": { + "type": "UserAssigned", + "userAssignedIdentity": "/subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity", + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-10-31/examples/TimeSeriesDatabaseConnectionsPut_WithUserIdentity_example.json +if __name__ == "__main__": + main() diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_digital_twin_with_identity.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_digital_twin_with_identity.json index b42e2017cad3..e2c790bfbfef 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_digital_twin_with_identity.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_digital_twin_with_identity.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:11 GMT", + "Date": "Thu, 16 Feb 2023 06:06:40 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:11 GMT", + "Date": "Thu, 16 Feb 2023 06:06:40 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,12 +172,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "863097dc-acd7-490a-9ddb-7012dd2b79a6", + "client-request-id": "a96cd882-9ba6-4c54-9b14-23be6b2c9b3d", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -190,10 +190,11 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "863097dc-acd7-490a-9ddb-7012dd2b79a6", + "client-request-id": "a96cd882-9ba6-4c54-9b14-23be6b2c9b3d", "Content-Length": "114", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-ReVod2Nul7P9WmnpHe4fxQ\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:11 GMT", + "Date": "Thu, 16 Feb 2023 06:06:41 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +202,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -213,7 +214,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2021-04-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2022-09-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -221,12 +222,12 @@ "Connection": "keep-alive", "Content-Length": "160", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/21.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2", "tags": { - "DeleteAfter": "2022-12-23T03:44:11", + "DeleteAfter": "2023-02-16T14:06:39", "BuildId": "local", "BuildJob": "local", "BuildNumber": "local", @@ -238,14 +239,14 @@ "Cache-Control": "no-cache", "Content-Length": "336", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:14 GMT", + "Date": "Thu, 16 Feb 2023 06:06:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b170a3db-2ff8-43fb-80e9-c28f2515d607", + "x-ms-correlation-request-id": "7ea31027-b52f-483b-9910-3d1070e7c38e", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194415Z:b170a3db-2ff8-43fb-80e9-c28f2515d607" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060646Z:7ea31027-b52f-483b-9910-3d1070e7c38e" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname", @@ -253,7 +254,7 @@ "type": "Microsoft.Resources/resourceGroups", "location": "westus2", "tags": { - "DeleteAfter": "2022-12-23T03:44:11", + "DeleteAfter": "2023-02-16T14:06:39", "BuildId": "local", "BuildJob": "local", "BuildNumber": "local", @@ -271,7 +272,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -281,12 +282,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:14 GMT", + "Date": "Thu, 16 Feb 2023 06:06:46 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -365,7 +366,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -375,12 +376,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:14 GMT", + "Date": "Thu, 16 Feb 2023 06:06:46 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -436,12 +437,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "d543d4c3-3739-43f4-96ba-23c449ee68a2", + "client-request-id": "5c89d2de-76f4-45d9-8df6-78cd6fec781d", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -454,10 +455,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "d543d4c3-3739-43f4-96ba-23c449ee68a2", + "client-request-id": "5c89d2de-76f4-45d9-8df6-78cd6fec781d", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:15 GMT", + "Date": "Thu, 16 Feb 2023 06:06:46 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -465,7 +466,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -477,7 +478,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourcecea8383b?api-version=2018-11-30", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourcecea8383b?api-version=2023-01-31", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -485,7 +486,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/7.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2" @@ -495,15 +496,15 @@ "Cache-Control": "no-cache", "Content-Length": "457", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:18 GMT", + "Date": "Thu, 16 Feb 2023 06:06:53 GMT", "Expires": "-1", "Location": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourcecea8383b", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "09a1ad8c-6eea-4d61-967e-6d9a00afdb18", + "x-ms-correlation-request-id": "f2854e1d-cd64-4e49-9eee-f689beb33742", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194418Z:09a1ad8c-6eea-4d61-967e-6d9a00afdb18" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060653Z:f2854e1d-cd64-4e49-9eee-f689beb33742" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourcecea8383b", @@ -513,8 +514,8 @@ "tags": {}, "properties": { "tenantId": "00000000-0000-0000-0000-000000000000", - "principalId": "d86aaa37-1a39-4878-a35d-f11f8f1a9a2d", - "clientId": "fbef33fd-7732-40d2-95c6-cfed7c31b225" + "principalId": "58536f47-4a8b-4699-b421-61ecd936fec3", + "clientId": "abb71446-3676-4d5b-a602-75dad18c1420" } } }, @@ -525,7 +526,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -535,12 +536,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:18 GMT", + "Date": "Thu, 16 Feb 2023 06:06:53 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -619,7 +620,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -629,12 +630,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:18 GMT", + "Date": "Thu, 16 Feb 2023 06:06:53 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -690,12 +691,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "5c363c11-6ea4-49f9-b6cc-e0d9346d932e", + "client-request-id": "d67dc9de-7111-4594-91ce-e8237cce687b", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -708,10 +709,11 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "5c363c11-6ea4-49f9-b6cc-e0d9346d932e", + "client-request-id": "d67dc9de-7111-4594-91ce-e8237cce687b", "Content-Length": "114", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-VobUVVTD72YOxjLkTtfC8w\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:18 GMT", + "Date": "Thu, 16 Feb 2023 06:06:53 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -719,7 +721,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -739,7 +741,2477 @@ "Connection": "keep-alive", "Content-Length": "254", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": { + "location": "westus2", + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourcecea8383b": {} + } + } + }, + "StatusCode": 409, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "457", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:06:54 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "e2108ee6-ef6c-4401-b1ce-17145997a9a1", + "x-ms-failure-cause": "gateway", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060655Z:e2108ee6-ef6c-4401-b1ce-17145997a9a1" + }, + "ResponseBody": { + "error": { + "code": "MissingSubscriptionRegistration", + "message": "The subscription is not registered to use namespace \u0027Microsoft.DigitalTwins\u0027. See https://aka.ms/rps-not-found for how to register subscriptions.", + "details": [ + { + "code": "MissingSubscriptionRegistration", + "target": "Microsoft.DigitalTwins", + "message": "The subscription is not registered to use namespace \u0027Microsoft.DigitalTwins\u0027. See https://aka.ms/rps-not-found for how to register subscriptions." + } + ] + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/register?api-version=2016-02-01", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:06:57 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0ec743f9-56d5-41e1-8497-9c8dc45dab4c", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060658Z:0ec743f9-56d5-41e1-8497-9c8dc45dab4c" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3643", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:07:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2209192b-3a71-4d46-ac8a-1f290105d126", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060708Z:2209192b-3a71-4d46-ac8a-1f290105d126" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3643", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:07:17 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "5c23198b-f528-4ff6-9b78-4c0af1b4bc8a", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060718Z:5c23198b-f528-4ff6-9b78-4c0af1b4bc8a" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3643", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:07:28 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b858a3a6-477b-4d59-95d7-ceed0f9a6b05", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060728Z:b858a3a6-477b-4d59-95d7-ceed0f9a6b05" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3643", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:07:38 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "33ab4940-6863-4720-a340-3f823a1a1756", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060739Z:33ab4940-6863-4720-a340-3f823a1a1756" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3643", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:07:48 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "360f00e9-30b2-4c04-af5c-89f53e2584a1", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060749Z:360f00e9-30b2-4c04-af5c-89f53e2584a1" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3643", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:07:58 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "98bbede8-dea1-4a80-9486-969022d903a2", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060759Z:98bbede8-dea1-4a80-9486-969022d903a2" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3643", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:08:08 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "6168c5a7-49c5-4819-9b18-0435b45162ef", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060809Z:6168c5a7-49c5-4819-9b18-0435b45162ef" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.25.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3642", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:08:19 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "7477d02a-b1c6-4211-b9c9-4a95c517719c", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060819Z:7477d02a-b1c6-4211-b9c9-4a95c517719c" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins", + "namespace": "Microsoft.DigitalTwins", + "authorizations": [ + { + "applicationId": "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" + }, + { + "applicationId": "91ff567f-bb4f-4719-91d7-d983057bc0d6", + "roleDefinitionId": "fa0ab6ed-58e5-4f2f-81af-0b9ffc364bdc" + }, + { + "applicationId": "c115998b-3d59-49b4-b55b-042a9ba1dbfe", + "roleDefinitionId": "07af60d1-cd6d-4ad4-9b56-ece6c78a3fe1" + } + ], + "resourceTypes": [ + { + "resourceType": "locations", + "locations": [], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/checkNameAvailability", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "digitalTwinsInstances/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationResults", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "locations/operationsStatuses", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/endpoints", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + }, + { + "resourceType": "digitalTwinsInstances/timeSeriesDatabaseConnections", + "locations": [ + "West Central US", + "West US 2", + "North Europe", + "Australia East", + "West Europe", + "East US", + "South Central US", + "Southeast Asia", + "UK South", + "East US 2", + "West US 3", + "Japan East", + "Korea Central", + "Qatar Central" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "West Central US" + ], + "apiVersions": [ + "2023-01-31", + "2022-10-31", + "2022-05-31", + "2021-06-30-preview", + "2020-12-01", + "2020-10-31", + "2020-03-01-preview" + ] + } + ], + "registrationState": "Registered" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwincea8383b?api-version=2022-10-31", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "254", + "Content-Type": "application/json", + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2", @@ -752,22 +3224,22 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/37aafc03-940b-406e-8b71-0219b3f661e7?api-version=2022-10-31", "Cache-Control": "no-cache", - "Content-Length": "1050", + "Content-Length": "1052", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:20 GMT", + "Date": "Thu, 16 Feb 2023 06:08:24 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktZGdseTZzNXViamd4NmtzeW1kcG5id2F5bHRpcTJkYWR0dmNodDZvaXN0Z3lpdTJvNWxvMm9sZGE2YmZwaXA1M3QyaXhxeWYzMjN3IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5jZWE4MzgzYiJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktcmFpcGZweGczbXNlaWIybHBuZG5waXpiZ2JmenFyZWg3ZGpxbHhndWc0ZGsybHB2bjRrc3FwdW9kN2plZW53a2Q0b2g1cDJsdDRoIiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5jZWE4MzgzYiJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-fbf126bb945c35ca76693d3358cb5c1b-8e071844e53c3de2-01", + "traceresponse": "00-5a470b2740ca671664f83d24987f5d85-106faf61cbd9bc32-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "670bcc69-62f4-4733-a2d1-1d2fbc4a7dca", - "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194421Z:670bcc69-62f4-4733-a2d1-1d2fbc4a7dca" + "x-ms-correlation-request-id": "01a0d953-949e-424d-9445-7f9983474223", + "x-ms-ratelimit-remaining-subscription-writes": "1196", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060824Z:01a0d953-949e-424d-9445-7f9983474223" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwincea8383b", @@ -775,8 +3247,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Provisioning", - "createdTime": "2022-12-22T19:44:20.6955751Z", - "lastUpdatedTime": "2022-12-22T19:44:20.6955751Z", + "createdTime": "2023-02-16T06:08:23.6507995Z", + "lastUpdatedTime": "2023-02-16T06:08:23.6507995Z", "hostName": null, "publicNetworkAccess": "Enabled" }, @@ -795,56 +3267,21 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:44:20.273014Z", + "createdAt": "2023-02-16T06:08:22.1983462Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:44:20.273014Z" + "lastModifiedAt": "2023-02-16T06:08:22.1983462Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb?api-version=2022-10-31", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:44:31 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Server": "Kestrel", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-55477ae58f5bc27858d7e9d049f43ad5-7c3eec40d0d4deae-01", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "55a019c1-d797-4d31-b831-3e6aaf163dd1", - "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194431Z:55a019c1-d797-4d31-b831-3e6aaf163dd1" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb", - "name": "f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb", - "status": "Running", - "startTime": "2022-12-22T19:44:20.7119975Z" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/37aafc03-940b-406e-8b71-0219b3f661e7?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -852,34 +3289,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:45:01 GMT", + "Date": "Thu, 16 Feb 2023 06:08:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-89fe29d9c5a98f56d133534d59750d30-5d49dc82ef8f0c0d-01", + "traceresponse": "00-3179fde163ef1472a2c865caa0fe8136-c5ef40e8ecc5d205-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "34b86584-5205-48cb-9e4d-162d5a985383", - "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194501Z:34b86584-5205-48cb-9e4d-162d5a985383" + "x-ms-correlation-request-id": "a98facd0-4ca1-4876-9dff-76cf2def517e", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060825Z:a98facd0-4ca1-4876-9dff-76cf2def517e" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb", - "name": "f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/37aafc03-940b-406e-8b71-0219b3f661e7", + "name": "37aafc03-940b-406e-8b71-0219b3f661e7", "status": "Running", - "startTime": "2022-12-22T19:44:20.7119975Z" + "startTime": "2023-02-16T06:08:23.6635152Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/37aafc03-940b-406e-8b71-0219b3f661e7?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -887,25 +3324,25 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:45:31 GMT", + "Date": "Thu, 16 Feb 2023 06:08:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-622fc77743a68e1c589c8484b2e77b32-897754bea22e6afe-01", + "traceresponse": "00-618918362d935d459614836fcf955dda-6e6c247170b9501a-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "102e0d37-dcc3-4def-a05d-1a357ba5ef32", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194532Z:102e0d37-dcc3-4def-a05d-1a357ba5ef32" + "x-ms-correlation-request-id": "763685d9-44d2-4786-b083-eff8fa9d7116", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060855Z:763685d9-44d2-4786-b083-eff8fa9d7116" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb", - "name": "f2e2c3ac-6bab-4ab6-8f95-59456a0f2dcb", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/37aafc03-940b-406e-8b71-0219b3f661e7", + "name": "37aafc03-940b-406e-8b71-0219b3f661e7", "status": "Succeeded", - "startTime": "2022-12-22T19:44:20.7119975Z", - "endTime": "2022-12-22T19:45:07.3294972Z" + "startTime": "2023-02-16T06:08:23.6635152Z", + "endTime": "2023-02-16T06:08:54.4324211Z" } }, { @@ -915,7 +3352,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -923,18 +3360,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:45:32 GMT", + "Date": "Thu, 16 Feb 2023 06:08:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-d749ce7b5e4b0022eff0009eacc2b11b-c82c6b29e0b301ac-01", + "traceresponse": "00-ba3bd65ee02ec03ad5af642ea7aa60eb-4a73880a480ff3fe-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "271a7e65-c87f-4d64-b195-be94739fd129", - "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194532Z:271a7e65-c87f-4d64-b195-be94739fd129" + "x-ms-correlation-request-id": "a4ad5627-8658-44ed-9d87-15807681bdb1", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060856Z:a4ad5627-8658-44ed-9d87-15807681bdb1" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwincea8383b", @@ -942,8 +3379,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Succeeded", - "createdTime": "2022-12-22T19:44:20.6955751Z", - "lastUpdatedTime": "2022-12-22T19:45:07.0011019Z", + "createdTime": "2023-02-16T06:08:23.6507995Z", + "lastUpdatedTime": "2023-02-16T06:08:54.1566411Z", "hostName": "digitalTwincea8383b.api.wus2.digitaltwins.azure.net", "privateEndpointConnections": [], "publicNetworkAccess": "Enabled" @@ -954,8 +3391,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourcecea8383b": { - "clientId": "fbef33fd-7732-40d2-95c6-cfed7c31b225", - "principalId": "d86aaa37-1a39-4878-a35d-f11f8f1a9a2d" + "clientId": "abb71446-3676-4d5b-a602-75dad18c1420", + "principalId": "58536f47-4a8b-4699-b421-61ecd936fec3" } } }, @@ -963,10 +3400,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:44:20.273014Z", + "createdAt": "2023-02-16T06:08:22.1983462Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:44:20.273014Z" + "lastModifiedAt": "2023-02-16T06:08:22.1983462Z" } } }, @@ -978,27 +3415,27 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/85bc77fc-f8e4-4256-bec7-03230abfd32a?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/48321cb1-b523-4531-ab9f-160f9068ceae?api-version=2022-10-31", "Cache-Control": "no-cache", - "Content-Length": "1163", + "Content-Length": "1165", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:45:32 GMT", + "Date": "Thu, 16 Feb 2023 06:08:56 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktZGdseTZzNXViamd4NmtzeW1kcG5id2F5bHRpcTJkYWR0dmNodDZvaXN0Z3lpdTJvNWxvMm9sZGE2YmZwaXA1M3QyaXhxeWYzMjN3IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5jZWE4MzgzYiJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktcmFpcGZweGczbXNlaWIybHBuZG5waXpiZ2JmenFyZWg3ZGpxbHhndWc0ZGsybHB2bjRrc3FwdW9kN2plZW53a2Q0b2g1cDJsdDRoIiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5jZWE4MzgzYiJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-47baeac998096f80106084e54db6da00-c2fe7ef8cd9e7fcf-01", + "traceresponse": "00-14a28cb4aa9f78ba2869427545e6475f-30865812623a85c8-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "28676fe0-a2ad-4594-8941-cadefeb004bd", + "x-ms-correlation-request-id": "868d34e2-a9b9-4206-9eb6-6f345231d5d6", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194533Z:28676fe0-a2ad-4594-8941-cadefeb004bd" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060857Z:868d34e2-a9b9-4206-9eb6-6f345231d5d6" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwincea8383b", @@ -1006,8 +3443,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Deleting", - "createdTime": "2022-12-22T19:44:20.6955751Z", - "lastUpdatedTime": "2022-12-22T19:45:07.0011019Z", + "createdTime": "2023-02-16T06:08:23.6507995Z", + "lastUpdatedTime": "2023-02-16T06:08:54.1566411Z", "hostName": "digitalTwincea8383b.api.wus2.digitaltwins.azure.net", "publicNetworkAccess": "Enabled" }, @@ -1017,8 +3454,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourcecea8383b": { - "clientId": "fbef33fd-7732-40d2-95c6-cfed7c31b225", - "principalId": "d86aaa37-1a39-4878-a35d-f11f8f1a9a2d" + "clientId": "abb71446-3676-4d5b-a602-75dad18c1420", + "principalId": "58536f47-4a8b-4699-b421-61ecd936fec3" } } }, @@ -1026,21 +3463,21 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:44:20.273014Z", + "createdAt": "2023-02-16T06:08:22.1983462Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:44:20.273014Z" + "lastModifiedAt": "2023-02-16T06:08:22.1983462Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/85bc77fc-f8e4-4256-bec7-03230abfd32a?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/48321cb1-b523-4531-ab9f-160f9068ceae?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1048,34 +3485,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:45:43 GMT", + "Date": "Thu, 16 Feb 2023 06:08:57 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-5edfd5c73d20564541450b009284d63a-b87db95660194fd0-01", + "traceresponse": "00-4808deb2c22b1892aef77c4e31f8ebf0-15ad7717f2a28a9e-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7496ff54-d709-47c6-8630-027c9e875f32", - "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194543Z:7496ff54-d709-47c6-8630-027c9e875f32" + "x-ms-correlation-request-id": "83242184-5bd7-4a27-8a03-ad5d01b8575f", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060857Z:83242184-5bd7-4a27-8a03-ad5d01b8575f" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/85bc77fc-f8e4-4256-bec7-03230abfd32a", - "name": "85bc77fc-f8e4-4256-bec7-03230abfd32a", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/48321cb1-b523-4531-ab9f-160f9068ceae", + "name": "48321cb1-b523-4531-ab9f-160f9068ceae", "status": "Running", - "startTime": "2022-12-22T19:45:32.8470889Z" + "startTime": "2023-02-16T06:08:57.1544463Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/85bc77fc-f8e4-4256-bec7-03230abfd32a?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/48321cb1-b523-4531-ab9f-160f9068ceae?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1083,52 +3520,52 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:13 GMT", + "Date": "Thu, 16 Feb 2023 06:09:28 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-5d98ad899f9177a70b3a7e49a472c53b-aabc6583fe08a39d-01", + "traceresponse": "00-68c97c6ebc03992049bbeb63e4a6c97b-10cee0ee59d9c023-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "76fe5624-2547-4b6b-9141-8096b2257b68", - "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194613Z:76fe5624-2547-4b6b-9141-8096b2257b68" + "x-ms-correlation-request-id": "93c7a020-903c-4bac-adf5-60be2ffbe944", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060928Z:93c7a020-903c-4bac-adf5-60be2ffbe944" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/85bc77fc-f8e4-4256-bec7-03230abfd32a", - "name": "85bc77fc-f8e4-4256-bec7-03230abfd32a", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/48321cb1-b523-4531-ab9f-160f9068ceae", + "name": "48321cb1-b523-4531-ab9f-160f9068ceae", "status": "Succeeded", - "startTime": "2022-12-22T19:45:32.8470889Z", - "endTime": "2022-12-22T19:46:10.1283291Z" + "startTime": "2023-02-16T06:08:57.1544463Z", + "endTime": "2023-02-16T06:09:20.9641551Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2021-04-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2022-09-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-resource/21.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 22 Dec 2022 19:46:14 GMT", + "Date": "Thu, 16 Feb 2023 06:09:29 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SR1BZOjJEREdMWTZTNVVCSkdYNktTWU1EUE5CV0FZTFRJUTJEQURUVkNIVDZPSXw4NjNDNUE4Rjg0OUREQkY3LVdFU1RVUzIiLCJqb2JMb2NhdGlvbiI6Indlc3R1czIifQ?api-version=2021-04-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SR1BZOjJEUkFJUEZQWEczTVNFSUIyTFBORE5QSVpCR0JGWlFSRUg3REpRTFhHVXwxQ0YzOEY0QUYzOENEQkQ5LVdFU1RVUzIiLCJqb2JMb2NhdGlvbiI6Indlc3R1czIifQ?api-version=2022-09-01", "Pragma": "no-cache", "Retry-After": "15", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c763af75-6cf4-4ff5-814f-49942604c7fe", + "x-ms-correlation-request-id": "eab6b7fe-eaa7-4352-9bbd-8f4680f622d0", "x-ms-ratelimit-remaining-subscription-deletes": "14998", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194614Z:c763af75-6cf4-4ff5-814f-49942604c7fe" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060930Z:eab6b7fe-eaa7-4352-9bbd-8f4680f622d0" }, "ResponseBody": null } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_endpoint_with_identity.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_endpoint_with_identity.json index 6674fc46ab30..ea06167ab5c9 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_endpoint_with_identity.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_endpoint_with_identity.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:15 GMT", + "Date": "Thu, 16 Feb 2023 06:09:31 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:15 GMT", + "Date": "Thu, 16 Feb 2023 06:09:31 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,12 +172,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "f525c6e9-a28a-44aa-a53f-84021e180d4e", + "client-request-id": "70c92b23-aa87-4a08-89b2-1fd8202f4ccd", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -190,10 +190,11 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "f525c6e9-a28a-44aa-a53f-84021e180d4e", + "client-request-id": "70c92b23-aa87-4a08-89b2-1fd8202f4ccd", "Content-Length": "114", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-BG5czgvaZEuMUy5FqLbxRA\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:15 GMT", + "Date": "Thu, 16 Feb 2023 06:09:31 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +202,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -213,7 +214,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2021-04-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2022-09-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -221,12 +222,12 @@ "Connection": "keep-alive", "Content-Length": "160", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/21.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2", "tags": { - "DeleteAfter": "2022-12-23T03:46:15", + "DeleteAfter": "2023-02-16T14:09:30", "BuildId": "local", "BuildJob": "local", "BuildNumber": "local", @@ -238,14 +239,14 @@ "Cache-Control": "no-cache", "Content-Length": "336", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:16 GMT", + "Date": "Thu, 16 Feb 2023 06:09:32 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "364c4cb2-ad30-444a-8e70-c4719eb969a9", - "x-ms-ratelimit-remaining-subscription-writes": "1196", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194616Z:364c4cb2-ad30-444a-8e70-c4719eb969a9" + "x-ms-correlation-request-id": "3453b4ed-6ee0-40c0-b5f6-28552235acf7", + "x-ms-ratelimit-remaining-subscription-writes": "1195", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060933Z:3453b4ed-6ee0-40c0-b5f6-28552235acf7" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname", @@ -253,7 +254,7 @@ "type": "Microsoft.Resources/resourceGroups", "location": "westus2", "tags": { - "DeleteAfter": "2022-12-23T03:46:15", + "DeleteAfter": "2023-02-16T14:09:30", "BuildId": "local", "BuildJob": "local", "BuildNumber": "local", @@ -271,7 +272,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -280,13 +281,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "1753", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-u4k6uEvdhzPm-elEYhvahg\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:16 GMT", + "Date": "Thu, 16 Feb 2023 06:09:33 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -365,7 +367,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -374,13 +376,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "945", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-NoXGTNw90Z-A6GbqCU1XMQ\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:16 GMT", + "Date": "Thu, 16 Feb 2023 06:09:33 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -436,12 +439,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "5e11e3b8-78fa-434f-b2b6-369458d3351d", + "client-request-id": "03f5a423-5bb9-4ec4-906e-b9dd64fa6c37", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -454,10 +457,11 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "5e11e3b8-78fa-434f-b2b6-369458d3351d", + "client-request-id": "03f5a423-5bb9-4ec4-906e-b9dd64fa6c37", "Content-Length": "114", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-h7kG8movqOqAK2pawcAmWQ\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:16 GMT", + "Date": "Thu, 16 Feb 2023 06:09:33 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -465,7 +469,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -477,7 +481,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d?api-version=2018-11-30", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d?api-version=2023-01-31", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -485,7 +489,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/7.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2" @@ -495,15 +499,15 @@ "Cache-Control": "no-cache", "Content-Length": "457", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:18 GMT", + "Date": "Thu, 16 Feb 2023 06:09:38 GMT", "Expires": "-1", "Location": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "09cbf18c-688c-4da5-bee9-9c27718fbdba", - "x-ms-ratelimit-remaining-subscription-writes": "1195", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194619Z:09cbf18c-688c-4da5-bee9-9c27718fbdba" + "x-ms-correlation-request-id": "4bc48d5c-b07e-4363-aede-6c4c9db28025", + "x-ms-ratelimit-remaining-subscription-writes": "1194", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060939Z:4bc48d5c-b07e-4363-aede-6c4c9db28025" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d", @@ -513,8 +517,8 @@ "tags": {}, "properties": { "tenantId": "00000000-0000-0000-0000-000000000000", - "principalId": "b46eb7f8-ba9e-4e83-a4b9-0faebe04fe1a", - "clientId": "21e494de-ba21-49cc-acd0-0c9c4c174dd2" + "principalId": "696129c1-5f99-4ee3-996d-3c611ea77ce7", + "clientId": "862d7ff4-b4c5-40cc-9d21-c266c9fb4b7f" } } }, @@ -525,7 +529,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -535,12 +539,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:19 GMT", + "Date": "Thu, 16 Feb 2023 06:09:39 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -619,7 +623,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -629,12 +633,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:19 GMT", + "Date": "Thu, 16 Feb 2023 06:09:39 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -690,12 +694,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "ea173b77-4e6e-494b-84a2-072b28e47101", + "client-request-id": "400692df-c7ea-4afd-a545-87349281101f", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -708,10 +712,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "ea173b77-4e6e-494b-84a2-072b28e47101", + "client-request-id": "400692df-c7ea-4afd-a545-87349281101f", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:19 GMT", + "Date": "Thu, 16 Feb 2023 06:09:40 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -719,7 +723,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -739,7 +743,7 @@ "Connection": "keep-alive", "Content-Length": "254", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2", @@ -752,22 +756,22 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/76191f2e-2549-43f3-a56f-1fa8ae15d690?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/955a461f-c37a-4d7c-986e-73f2cf53aa82?api-version=2022-10-31", "Cache-Control": "no-cache", "Content-Length": "1052", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:21 GMT", + "Date": "Thu, 16 Feb 2023 06:09:43 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktbDZidHN2NHU0MnA0NmVvNnY2dnJlNGZpcXR4NmZoZXgyb2dud2hmb3F6ZXp0a3FhMzZhZWg0amRtbWNydHh2bGhxbnlxeGFlMjN0IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHkteWhtZG43YzRxbHJuZnpxd3drdTZua3B2cnJsdDZleG9tamR6N3BrNTR3ZHJjaWh6dGNzNDdreXUyeTR2dDdsZWtzeDRkZXduNWppIiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-929e880282dd96c3d68a095fb58db78b-8219583e13d95265-01", + "traceresponse": "00-dc2d5f2c0521074b94633edf227173bf-a27f87b36f3222a8-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "32b7bc52-395e-4212-9dfa-7fca36c972a2", - "x-ms-ratelimit-remaining-subscription-writes": "1194", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194621Z:32b7bc52-395e-4212-9dfa-7fca36c972a2" + "x-ms-correlation-request-id": "8576a5d8-ece9-43c4-b6ee-bd5c3200a8e6", + "x-ms-ratelimit-remaining-subscription-writes": "1193", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060944Z:8576a5d8-ece9-43c4-b6ee-bd5c3200a8e6" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwinee67369d", @@ -775,8 +779,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Provisioning", - "createdTime": "2022-12-22T19:46:21.1886063Z", - "lastUpdatedTime": "2022-12-22T19:46:21.1886063Z", + "createdTime": "2023-02-16T06:09:42.9500561Z", + "lastUpdatedTime": "2023-02-16T06:09:42.9500561Z", "hostName": null, "publicNetworkAccess": "Enabled" }, @@ -795,21 +799,21 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:46:20.9842673Z", + "createdAt": "2023-02-16T06:09:42.5562622Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:46:20.9842673Z" + "lastModifiedAt": "2023-02-16T06:09:42.5562622Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/76191f2e-2549-43f3-a56f-1fa8ae15d690?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/955a461f-c37a-4d7c-986e-73f2cf53aa82?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -817,69 +821,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:46:31 GMT", + "Date": "Thu, 16 Feb 2023 06:09:43 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-1dd24af160c123f01180a4145b783f50-7509a31b36a382a2-01", + "traceresponse": "00-96e08aea2c8599649484326b5024a207-601ec3283c9bff12-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b7cbdf3a-28f0-47e9-a69f-dd5a134b53b7", - "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194631Z:b7cbdf3a-28f0-47e9-a69f-dd5a134b53b7" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/76191f2e-2549-43f3-a56f-1fa8ae15d690", - "name": "76191f2e-2549-43f3-a56f-1fa8ae15d690", - "status": "Running", - "startTime": "2022-12-22T19:46:21.2032418Z" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/76191f2e-2549-43f3-a56f-1fa8ae15d690?api-version=2022-10-31", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:01 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Server": "Kestrel", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-38fbd9fcc25d0c24237513ac159979d2-31b83bc5f2d2494a-01", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "719dbe9b-217a-4630-b629-1f7b34548a9b", - "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194702Z:719dbe9b-217a-4630-b629-1f7b34548a9b" + "x-ms-correlation-request-id": "b2574d21-5436-4f20-b3c8-8a7a0d97cdd8", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T060944Z:b2574d21-5436-4f20-b3c8-8a7a0d97cdd8" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/76191f2e-2549-43f3-a56f-1fa8ae15d690", - "name": "76191f2e-2549-43f3-a56f-1fa8ae15d690", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/955a461f-c37a-4d7c-986e-73f2cf53aa82", + "name": "955a461f-c37a-4d7c-986e-73f2cf53aa82", "status": "Running", - "startTime": "2022-12-22T19:46:21.2032418Z" + "startTime": "2023-02-16T06:09:42.9642636Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/76191f2e-2549-43f3-a56f-1fa8ae15d690?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/955a461f-c37a-4d7c-986e-73f2cf53aa82?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -887,25 +856,25 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:31 GMT", + "Date": "Thu, 16 Feb 2023 06:10:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-4e619f6d96fb48b5fe8b6b68682bcbeb-55767227c9be99dd-01", + "traceresponse": "00-283db71c608be854cd5ba2c548a512a9-ea6cb6685a088236-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ffef5e2a-6740-4116-a927-a258b2a3c250", - "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194732Z:ffef5e2a-6740-4116-a927-a258b2a3c250" + "x-ms-correlation-request-id": "e768e9ee-36df-4acf-b384-d70f1166e3d2", + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061014Z:e768e9ee-36df-4acf-b384-d70f1166e3d2" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/76191f2e-2549-43f3-a56f-1fa8ae15d690", - "name": "76191f2e-2549-43f3-a56f-1fa8ae15d690", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/955a461f-c37a-4d7c-986e-73f2cf53aa82", + "name": "955a461f-c37a-4d7c-986e-73f2cf53aa82", "status": "Succeeded", - "startTime": "2022-12-22T19:46:21.2032418Z", - "endTime": "2022-12-22T19:47:03.8095321Z" + "startTime": "2023-02-16T06:09:42.9642636Z", + "endTime": "2023-02-16T06:10:07.8654464Z" } }, { @@ -915,7 +884,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -923,18 +892,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:32 GMT", + "Date": "Thu, 16 Feb 2023 06:10:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-e4136feb4a7966132ac50f2010c2a32a-9baf70fa45dbf14b-01", + "traceresponse": "00-140fef16d4c601a757ef877beb899f09-4c11ae0b8ee7b7b5-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5442022e-0a00-4ada-8057-5872a1f3f65f", - "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194732Z:5442022e-0a00-4ada-8057-5872a1f3f65f" + "x-ms-correlation-request-id": "67cd1169-c20e-4783-ae6e-87e2c1b51758", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061015Z:67cd1169-c20e-4783-ae6e-87e2c1b51758" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwinee67369d", @@ -942,8 +911,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Succeeded", - "createdTime": "2022-12-22T19:46:21.1886063Z", - "lastUpdatedTime": "2022-12-22T19:47:03.564491Z", + "createdTime": "2023-02-16T06:09:42.9500561Z", + "lastUpdatedTime": "2023-02-16T06:10:07.5789268Z", "hostName": "digitalTwinee67369d.api.wus2.digitaltwins.azure.net", "privateEndpointConnections": [], "publicNetworkAccess": "Enabled" @@ -954,8 +923,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d": { - "clientId": "21e494de-ba21-49cc-acd0-0c9c4c174dd2", - "principalId": "b46eb7f8-ba9e-4e83-a4b9-0faebe04fe1a" + "clientId": "862d7ff4-b4c5-40cc-9d21-c266c9fb4b7f", + "principalId": "696129c1-5f99-4ee3-996d-3c611ea77ce7" } } }, @@ -963,10 +932,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:46:20.9842673Z", + "createdAt": "2023-02-16T06:09:42.5562622Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:46:20.9842673Z" + "lastModifiedAt": "2023-02-16T06:09:42.5562622Z" } } }, @@ -979,7 +948,7 @@ "Connection": "keep-alive", "Content-Length": "384", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "properties": { @@ -995,22 +964,22 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/a383a4f2-a55e-468b-8fbb-d4cfab1af5c2?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/8b13c10a-fcb9-4102-b242-86ea03c93449?api-version=2022-10-31", "Cache-Control": "no-cache", "Content-Length": "1007", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:32 GMT", + "Date": "Thu, 16 Feb 2023 06:10:15 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRW5kcG9pbnQiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktbDZidHN2NHU0MnA0NmVvNnY2dnJlNGZpcXR4NmZoZXgyb2dud2hmb3F6ZXp0a3FhMzZhZWg0amRtbWNydHh2bGhxbnlxeGFlMjN0IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCIsIm5lc3RlZFJlc291cmNlTmFtZSI6ImVuZHBvaW50ZWU2NzM2OWQifQ%3d%3d?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRW5kcG9pbnQiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHkteWhtZG43YzRxbHJuZnpxd3drdTZua3B2cnJsdDZleG9tamR6N3BrNTR3ZHJjaWh6dGNzNDdreXUyeTR2dDdsZWtzeDRkZXduNWppIiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCIsIm5lc3RlZFJlc291cmNlTmFtZSI6ImVuZHBvaW50ZWU2NzM2OWQifQ%3d%3d?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-0190914bcbee657e835e785fc8c370f2-666781acdaed1a6c-01", + "traceresponse": "00-31a955f745aee5075fc40aa0be63fed3-cefb595c065e2c6e-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "76b74ff9-2507-4d34-8fa1-2ede7398d5d8", - "x-ms-ratelimit-remaining-subscription-writes": "1193", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194733Z:76b74ff9-2507-4d34-8fa1-2ede7398d5d8" + "x-ms-correlation-request-id": "b4179552-7714-4a46-8225-053e25822baf", + "x-ms-ratelimit-remaining-subscription-writes": "1192", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061015Z:b4179552-7714-4a46-8225-053e25822baf" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwinee67369d/endpoints/endpointee67369d", @@ -1026,26 +995,26 @@ "userAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d" }, "provisioningState": "Provisioning", - "createdTime": "2022-12-22T19:47:33.1148247\u002B00:00" + "createdTime": "2023-02-16T06:10:15.6723843\u002B00:00" }, "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:47:32.9321293Z", + "createdAt": "2023-02-16T06:10:15.3144358Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:47:32.9321293Z" + "lastModifiedAt": "2023-02-16T06:10:15.3144358Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/a383a4f2-a55e-468b-8fbb-d4cfab1af5c2?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/8b13c10a-fcb9-4102-b242-86ea03c93449?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1053,25 +1022,60 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:42 GMT", + "Date": "Thu, 16 Feb 2023 06:10:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-52b01636f40f3644d92cf7ed40dc970d-2bd95aafede585f6-01", + "traceresponse": "00-68a53fb1e19461c04f11725bfbbba13b-f182ac685c7205d6-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "195ffaa1-bd97-4fac-bf9b-0f091b8d9990", - "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194743Z:195ffaa1-bd97-4fac-bf9b-0f091b8d9990" + "x-ms-correlation-request-id": "f7c363ee-1ee3-42ed-9655-a21a2cf94f22", + "x-ms-ratelimit-remaining-subscription-reads": "11983", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061016Z:f7c363ee-1ee3-42ed-9655-a21a2cf94f22" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/a383a4f2-a55e-468b-8fbb-d4cfab1af5c2", - "name": "a383a4f2-a55e-468b-8fbb-d4cfab1af5c2", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/8b13c10a-fcb9-4102-b242-86ea03c93449", + "name": "8b13c10a-fcb9-4102-b242-86ea03c93449", + "status": "Running", + "startTime": "2023-02-16T06:10:15.6113949Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/8b13c10a-fcb9-4102-b242-86ea03c93449?api-version=2022-10-31", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:10:45 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "traceresponse": "00-18700bc599351afd7a2c0adca6110dd2-8d8b470417cdb9fa-01", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "22d4a4a9-15f7-4c17-890c-91a55b235bdc", + "x-ms-ratelimit-remaining-subscription-reads": "11982", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061046Z:22d4a4a9-15f7-4c17-890c-91a55b235bdc" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/8b13c10a-fcb9-4102-b242-86ea03c93449", + "name": "8b13c10a-fcb9-4102-b242-86ea03c93449", "status": "Succeeded", - "startTime": "2022-12-22T19:47:33.0349629Z", - "endTime": "2022-12-22T19:47:39.0581694Z" + "startTime": "2023-02-16T06:10:15.6113949Z", + "endTime": "2023-02-16T06:10:21.7979178Z" } }, { @@ -1081,7 +1085,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1089,18 +1093,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:42 GMT", + "Date": "Thu, 16 Feb 2023 06:10:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-48ca98bfd6bb4602bc3eddfbe7f182e8-79e7bee896a1e358-01", + "traceresponse": "00-d042e412b6011b44c36fd3f0e1518bcf-9926c49724be56d1-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a8013a06-f5dc-47bc-9b93-14778ebb0e37", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194743Z:a8013a06-f5dc-47bc-9b93-14778ebb0e37" + "x-ms-correlation-request-id": "63fd6919-7ead-4fc8-a3bc-19aa7f20d469", + "x-ms-ratelimit-remaining-subscription-reads": "11981", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061047Z:63fd6919-7ead-4fc8-a3bc-19aa7f20d469" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwinee67369d/endpoints/endpointee67369d", @@ -1116,15 +1120,15 @@ "userAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d" }, "provisioningState": "Succeeded", - "createdTime": "2022-12-22T19:47:33.1148247\u002B00:00" + "createdTime": "2023-02-16T06:10:15.6723843\u002B00:00" }, "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:47:32.9321293Z", + "createdAt": "2023-02-16T06:10:15.3144358Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:47:32.9321293Z" + "lastModifiedAt": "2023-02-16T06:10:15.3144358Z" } } }, @@ -1136,27 +1140,27 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/716c705a-a0c7-4796-a7ba-c2db00805834?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/a5e6cefc-6d28-4ff8-9369-9aa19d3d9a4a?api-version=2022-10-31", "Cache-Control": "no-cache", - "Content-Length": "742", + "Content-Length": "743", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:43 GMT", + "Date": "Thu, 16 Feb 2023 06:10:47 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRW5kcG9pbnQiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktbDZidHN2NHU0MnA0NmVvNnY2dnJlNGZpcXR4NmZoZXgyb2dud2hmb3F6ZXp0a3FhMzZhZWg0amRtbWNydHh2bGhxbnlxeGFlMjN0IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCIsIm5lc3RlZFJlc291cmNlTmFtZSI6ImVuZHBvaW50ZWU2NzM2OWQifQ%3d%3d?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRW5kcG9pbnQiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHkteWhtZG43YzRxbHJuZnpxd3drdTZua3B2cnJsdDZleG9tamR6N3BrNTR3ZHJjaWh6dGNzNDdreXUyeTR2dDdsZWtzeDRkZXduNWppIiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCIsIm5lc3RlZFJlc291cmNlTmFtZSI6ImVuZHBvaW50ZWU2NzM2OWQifQ%3d%3d?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-4ebc6d42f24adca91a33b16a77c9420b-53a387dac7b6a8cd-01", + "traceresponse": "00-e9a8509a8d74d30c3a5598afc4bad089-1a90665ad9b3f154-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "00798438-4323-4647-a361-8356d6533086", + "x-ms-correlation-request-id": "cd5472fd-20dc-4212-8d7d-5dae69b84944", "x-ms-ratelimit-remaining-subscription-deletes": "14997", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194744Z:00798438-4323-4647-a361-8356d6533086" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061047Z:cd5472fd-20dc-4212-8d7d-5dae69b84944" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitaltwinee67369d/endpoints/endpointee67369d", @@ -1172,19 +1176,54 @@ "userAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d" }, "provisioningState": "Deleting", - "createdTime": "2022-12-22T19:47:33.171546\u002B00:00" + "createdTime": "2023-02-16T06:10:15.7305916\u002B00:00" }, "systemData": null } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/716c705a-a0c7-4796-a7ba-c2db00805834?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/a5e6cefc-6d28-4ff8-9369-9aa19d3d9a4a?api-version=2022-10-31", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:10:47 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "traceresponse": "00-38ca804e64cc1dfb308ecf52d2d155ea-fab19ae875d9746c-01", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "4dc9468a-fef3-4180-813f-c8c39781e46c", + "x-ms-ratelimit-remaining-subscription-reads": "11980", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061048Z:4dc9468a-fef3-4180-813f-c8c39781e46c" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/a5e6cefc-6d28-4ff8-9369-9aa19d3d9a4a", + "name": "a5e6cefc-6d28-4ff8-9369-9aa19d3d9a4a", + "status": "Running", + "startTime": "2023-02-16T06:10:47.4153212Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/a5e6cefc-6d28-4ff8-9369-9aa19d3d9a4a?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1192,25 +1231,25 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:53 GMT", + "Date": "Thu, 16 Feb 2023 06:11:18 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-5b288ad0185e64c97f13165ecabf2ffb-8e2a47919598b8fd-01", + "traceresponse": "00-94a4b4e3c1bfcae2910846ed85b31894-de0c071489d1eafc-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fd76af6e-c83f-4c9f-8593-3f8c65bf630f", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194754Z:fd76af6e-c83f-4c9f-8593-3f8c65bf630f" + "x-ms-correlation-request-id": "26a57b5d-4c82-4748-af7f-6bb3b426d1ca", + "x-ms-ratelimit-remaining-subscription-reads": "11979", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061118Z:26a57b5d-4c82-4748-af7f-6bb3b426d1ca" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/716c705a-a0c7-4796-a7ba-c2db00805834", - "name": "716c705a-a0c7-4796-a7ba-c2db00805834", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/a5e6cefc-6d28-4ff8-9369-9aa19d3d9a4a", + "name": "a5e6cefc-6d28-4ff8-9369-9aa19d3d9a4a", "status": "Succeeded", - "startTime": "2022-12-22T19:47:43.9400255Z", - "endTime": "2022-12-22T19:47:48.0264024Z" + "startTime": "2023-02-16T06:10:47.4153212Z", + "endTime": "2023-02-16T06:10:51.5855294Z" } }, { @@ -1221,27 +1260,27 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/1be0b991-a8e9-400f-ac3f-725093abde65?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/83d94a6b-7b22-430c-9841-b1639f4cbb9b?api-version=2022-10-31", "Cache-Control": "no-cache", - "Content-Length": "1164", + "Content-Length": "1165", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:47:54 GMT", + "Date": "Thu, 16 Feb 2023 06:11:19 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktbDZidHN2NHU0MnA0NmVvNnY2dnJlNGZpcXR4NmZoZXgyb2dud2hmb3F6ZXp0a3FhMzZhZWg0amRtbWNydHh2bGhxbnlxeGFlMjN0IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHkteWhtZG43YzRxbHJuZnpxd3drdTZua3B2cnJsdDZleG9tamR6N3BrNTR3ZHJjaWh6dGNzNDdreXUyeTR2dDdsZWtzeDRkZXduNWppIiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW5lZTY3MzY5ZCJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-0835ba121b92cd10889798366ca0b687-822de966535db3a6-01", + "traceresponse": "00-4e2313a757229381121c61b5b51189b3-a38cf76b2c90c096-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "043de15a-7115-499f-860d-5b5dd167fa0d", + "x-ms-correlation-request-id": "beb1a3a7-e894-40a2-95bb-895933ac1f04", "x-ms-ratelimit-remaining-subscription-deletes": "14996", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194755Z:043de15a-7115-499f-860d-5b5dd167fa0d" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061119Z:beb1a3a7-e894-40a2-95bb-895933ac1f04" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwinee67369d", @@ -1249,8 +1288,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Deleting", - "createdTime": "2022-12-22T19:46:21.1886063Z", - "lastUpdatedTime": "2022-12-22T19:47:03.564491Z", + "createdTime": "2023-02-16T06:09:42.9500561Z", + "lastUpdatedTime": "2023-02-16T06:10:07.5789268Z", "hostName": "digitalTwinee67369d.api.wus2.digitaltwins.azure.net", "publicNetworkAccess": "Enabled" }, @@ -1260,8 +1299,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResourceee67369d": { - "clientId": "21e494de-ba21-49cc-acd0-0c9c4c174dd2", - "principalId": "b46eb7f8-ba9e-4e83-a4b9-0faebe04fe1a" + "clientId": "862d7ff4-b4c5-40cc-9d21-c266c9fb4b7f", + "principalId": "696129c1-5f99-4ee3-996d-3c611ea77ce7" } } }, @@ -1269,21 +1308,21 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:46:20.9842673Z", + "createdAt": "2023-02-16T06:09:42.5562622Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:46:20.9842673Z" + "lastModifiedAt": "2023-02-16T06:09:42.5562622Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/1be0b991-a8e9-400f-ac3f-725093abde65?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/83d94a6b-7b22-430c-9841-b1639f4cbb9b?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1291,34 +1330,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:04 GMT", + "Date": "Thu, 16 Feb 2023 06:11:19 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-a377bfdf9c265534e0ea2dd79b474788-32fbd9a5b641fa48-01", + "traceresponse": "00-0c6a1592b5258bc1ca22d99ff2738958-23f9d5cb7b1b09b6-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7cdef411-d245-4641-80f1-d5c34e78a310", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194805Z:7cdef411-d245-4641-80f1-d5c34e78a310" + "x-ms-correlation-request-id": "ef29c0fa-92de-4dca-9aa5-190b81483e29", + "x-ms-ratelimit-remaining-subscription-reads": "11978", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061119Z:ef29c0fa-92de-4dca-9aa5-190b81483e29" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/1be0b991-a8e9-400f-ac3f-725093abde65", - "name": "1be0b991-a8e9-400f-ac3f-725093abde65", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/83d94a6b-7b22-430c-9841-b1639f4cbb9b", + "name": "83d94a6b-7b22-430c-9841-b1639f4cbb9b", "status": "Running", - "startTime": "2022-12-22T19:47:54.9745473Z" + "startTime": "2023-02-16T06:11:19.0162083Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/1be0b991-a8e9-400f-ac3f-725093abde65?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/83d94a6b-7b22-430c-9841-b1639f4cbb9b?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1326,52 +1365,52 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:35 GMT", + "Date": "Thu, 16 Feb 2023 06:11:49 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-eedf7d3be8e74d40fae07c0874be6257-0422dc0f7544d756-01", + "traceresponse": "00-931008e7e2b1c22a3255f6ce03b96664-702a5d56117e741d-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6fe760fc-f76c-44e4-98d3-f2a00c98940a", - "x-ms-ratelimit-remaining-subscription-reads": "11985", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194835Z:6fe760fc-f76c-44e4-98d3-f2a00c98940a" + "x-ms-correlation-request-id": "200616ea-26f3-4847-9281-889f54ff3645", + "x-ms-ratelimit-remaining-subscription-reads": "11977", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061149Z:200616ea-26f3-4847-9281-889f54ff3645" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/1be0b991-a8e9-400f-ac3f-725093abde65", - "name": "1be0b991-a8e9-400f-ac3f-725093abde65", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/83d94a6b-7b22-430c-9841-b1639f4cbb9b", + "name": "83d94a6b-7b22-430c-9841-b1639f4cbb9b", "status": "Succeeded", - "startTime": "2022-12-22T19:47:54.9745473Z", - "endTime": "2022-12-22T19:48:30.8681518Z" + "startTime": "2023-02-16T06:11:19.0162083Z", + "endTime": "2023-02-16T06:11:42.7026286Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2021-04-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2022-09-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-resource/21.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 22 Dec 2022 19:48:36 GMT", + "Date": "Thu, 16 Feb 2023 06:11:51 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SR1BZOjJETDZCVFNWNFU0MlA0NkVPNlY2VlJFNEZJUVRYNkZIRVgyT0dOV0hGT3wwN0IxQTU5RkY3RjdGQjJBLVdFU1RVUzIiLCJqb2JMb2NhdGlvbiI6Indlc3R1czIifQ?api-version=2021-04-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SR1BZOjJEWUhNRE43QzRRTFJORlpRV1dLVTZOS1BWUlJMVDZFWE9NSkRaN1BLNXw5RDI2MTA3NDI1N0VFQTdCLVdFU1RVUzIiLCJqb2JMb2NhdGlvbiI6Indlc3R1czIifQ?api-version=2022-09-01", "Pragma": "no-cache", "Retry-After": "15", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9bfc8ca6-dd2b-4019-b54f-a9a33425d885", + "x-ms-correlation-request-id": "14da3074-1f8b-43b8-9544-6257b1257126", "x-ms-ratelimit-remaining-subscription-deletes": "14995", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194836Z:9bfc8ca6-dd2b-4019-b54f-a9a33425d885" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061152Z:14da3074-1f8b-43b8-9544-6257b1257126" }, "ResponseBody": null } diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_tsdbconnection_with_identity.json b/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_tsdbconnection_with_identity.json index 25ab4e1ce5b7..d21953db6b3d 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_tsdbconnection_with_identity.json +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/tests/recordings/test_azure_mgmt_digitaltwins.pyTestDigitalTwintest_create_tsdbconnection_with_identity.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:38 GMT", + "Date": "Thu, 16 Feb 2023 06:11:53 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:38 GMT", + "Date": "Thu, 16 Feb 2023 06:11:53 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,12 +172,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "a36c678b-5331-4a75-97e0-b33b5e87002f", + "client-request-id": "638201ac-fce5-4baf-8849-bc94f14260fd", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -190,10 +190,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "a36c678b-5331-4a75-97e0-b33b5e87002f", + "client-request-id": "638201ac-fce5-4baf-8849-bc94f14260fd", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:39 GMT", + "Date": "Thu, 16 Feb 2023 06:11:54 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -213,7 +213,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2021-04-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2022-09-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -221,12 +221,12 @@ "Connection": "keep-alive", "Content-Length": "160", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/21.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2", "tags": { - "DeleteAfter": "2022-12-23T03:48:36", + "DeleteAfter": "2023-02-16T14:11:52", "BuildId": "local", "BuildJob": "local", "BuildNumber": "local", @@ -238,14 +238,14 @@ "Cache-Control": "no-cache", "Content-Length": "336", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:40 GMT", + "Date": "Thu, 16 Feb 2023 06:11:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "70ce4439-5149-4a74-b883-600afa690476", - "x-ms-ratelimit-remaining-subscription-writes": "1192", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194840Z:70ce4439-5149-4a74-b883-600afa690476" + "x-ms-correlation-request-id": "34fb3dfe-4fae-431d-8c25-f894ea8dc7a9", + "x-ms-ratelimit-remaining-subscription-writes": "1191", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061155Z:34fb3dfe-4fae-431d-8c25-f894ea8dc7a9" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname", @@ -253,7 +253,7 @@ "type": "Microsoft.Resources/resourceGroups", "location": "westus2", "tags": { - "DeleteAfter": "2022-12-23T03:48:36", + "DeleteAfter": "2023-02-16T14:11:52", "BuildId": "local", "BuildJob": "local", "BuildNumber": "local", @@ -271,7 +271,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -280,13 +280,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "1753", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-346lyK7aPy4JWlhOZRigrA\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:40 GMT", + "Date": "Thu, 16 Feb 2023 06:11:55 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -365,7 +366,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -374,13 +375,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "945", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-1Xslwn71C6aGGFAk4tbFKg\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:40 GMT", + "Date": "Thu, 16 Feb 2023 06:11:56 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -436,12 +438,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "f521937b-bceb-4155-9411-3d1cf26a5e22", + "client-request-id": "7a4d2d4b-a489-41d3-bd7f-1714a7420401", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -454,10 +456,11 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "f521937b-bceb-4155-9411-3d1cf26a5e22", + "client-request-id": "7a4d2d4b-a489-41d3-bd7f-1714a7420401", "Content-Length": "114", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-rA8ksf5bgTihfqEOxY34gA\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:40 GMT", + "Date": "Thu, 16 Feb 2023 06:11:56 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -465,7 +468,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -477,7 +480,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResource436a3919?api-version=2018-11-30", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResource436a3919?api-version=2023-01-31", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -485,7 +488,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/7.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2" @@ -495,15 +498,15 @@ "Cache-Control": "no-cache", "Content-Length": "457", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:43 GMT", + "Date": "Thu, 16 Feb 2023 06:12:01 GMT", "Expires": "-1", "Location": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResource436a3919", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "54e9c8e4-de24-4afd-8b9b-3289331b048c", - "x-ms-ratelimit-remaining-subscription-writes": "1191", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194843Z:54e9c8e4-de24-4afd-8b9b-3289331b048c" + "x-ms-correlation-request-id": "982c80e7-893b-401e-851c-b1fa2573f031", + "x-ms-ratelimit-remaining-subscription-writes": "1190", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061201Z:982c80e7-893b-401e-851c-b1fa2573f031" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResource436a3919", @@ -513,8 +516,8 @@ "tags": {}, "properties": { "tenantId": "00000000-0000-0000-0000-000000000000", - "principalId": "e9874155-8803-4f65-a232-e64ccc35dd11", - "clientId": "20fda535-abad-42b4-9a4d-8eb16e043b1a" + "principalId": "f36af8cc-5a65-464b-9098-d040ce449b1a", + "clientId": "9795ef93-d905-489a-a234-360a073adc9d" } } }, @@ -525,7 +528,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -535,12 +538,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:43 GMT", + "Date": "Thu, 16 Feb 2023 06:12:02 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -619,7 +622,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -628,13 +631,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "945", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-nBR1u_0gMn4xRxCYY_1bKg\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:43 GMT", + "Date": "Thu, 16 Feb 2023 06:12:02 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -690,12 +694,12 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "fb1b6efe-5c92-4216-af3d-71963fe737ca", + "client-request-id": "8d4ec541-ce43-4d6f-ae86-f1ae7987bf44", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.13.0b1 Python/3.10.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.4 (Windows-10-10.0.22621-SP0)", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", @@ -708,10 +712,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "fb1b6efe-5c92-4216-af3d-71963fe737ca", + "client-request-id": "8d4ec541-ce43-4d6f-ae86-f1ae7987bf44", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:43 GMT", + "Date": "Thu, 16 Feb 2023 06:12:02 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -719,7 +723,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -739,7 +743,7 @@ "Connection": "keep-alive", "Content-Length": "254", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2", @@ -752,22 +756,22 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/ecbba085-4be2-43a8-8a50-87cdbb5e8127?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/d023c493-d058-44f4-9c20-f05342c70abd?api-version=2022-10-31", "Cache-Control": "no-cache", "Content-Length": "1052", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:46 GMT", + "Date": "Thu, 16 Feb 2023 06:12:05 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktcnl6d2ZlZGdjZjJiajV6NHJ0ZWJiYmhoZjczcnZmZ3VrdnF4amllZG9teXFqejV5ZGU1ZTRza3NtYWNwd3RrZjJwbnY3c3p4cXA3IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW40MzZhMzkxOSJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktd3BjZms2Ym9wNmlpM3V3ZGU3YXU1bjZ0NnZmcTM2YXg3bTN3MzQzaXJyM2ZzNmN1aDVlN29ic2s2bTRteHNuNG5weXliajJxd252IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW40MzZhMzkxOSJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-41264aec9f84f8873c845a1b4b4397fb-d35d7e98eade0c48-01", + "traceresponse": "00-dd473cd82acf14ec7f921c2c2dc0dcdc-54069d1cf36605a9-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4a723f30-82bb-45ec-97d0-dd087ba39b97", - "x-ms-ratelimit-remaining-subscription-writes": "1190", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194846Z:4a723f30-82bb-45ec-97d0-dd087ba39b97" + "x-ms-correlation-request-id": "47bad500-0208-4443-b468-09e2328c5bf4", + "x-ms-ratelimit-remaining-subscription-writes": "1189", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061206Z:47bad500-0208-4443-b468-09e2328c5bf4" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwin436a3919", @@ -775,8 +779,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Provisioning", - "createdTime": "2022-12-22T19:48:45.6221309Z", - "lastUpdatedTime": "2022-12-22T19:48:45.6221309Z", + "createdTime": "2023-02-16T06:12:05.5540582Z", + "lastUpdatedTime": "2023-02-16T06:12:05.5540582Z", "hostName": null, "publicNetworkAccess": "Enabled" }, @@ -795,56 +799,21 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:48:45.2720757Z", + "createdAt": "2023-02-16T06:12:05.1149167Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:48:45.2720757Z" + "lastModifiedAt": "2023-02-16T06:12:05.1149167Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/ecbba085-4be2-43a8-8a50-87cdbb5e8127?api-version=2022-10-31", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:48:56 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Server": "Kestrel", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-5d68c96ac5814d6850e8b8452bc11894-443c508126f6d3d3-01", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9ceace43-d767-452e-8d90-5fd0d3970725", - "x-ms-ratelimit-remaining-subscription-reads": "11984", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194856Z:9ceace43-d767-452e-8d90-5fd0d3970725" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/ecbba085-4be2-43a8-8a50-87cdbb5e8127", - "name": "ecbba085-4be2-43a8-8a50-87cdbb5e8127", - "status": "Running", - "startTime": "2022-12-22T19:48:45.6372193Z" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/ecbba085-4be2-43a8-8a50-87cdbb5e8127?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/d023c493-d058-44f4-9c20-f05342c70abd?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -852,34 +821,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:49:25 GMT", + "Date": "Thu, 16 Feb 2023 06:12:05 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-581385ea1f1efe5245f905f74ab7c929-f4c443066bfc521d-01", + "traceresponse": "00-ec10f2025bc876d36ca163b0b1c86890-a703c033c4155e15-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "26eb187e-18df-4f98-a831-cc0b45d7c7e4", - "x-ms-ratelimit-remaining-subscription-reads": "11983", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194926Z:26eb187e-18df-4f98-a831-cc0b45d7c7e4" + "x-ms-correlation-request-id": "ecd7589c-b0b4-4016-8b12-c469b4229908", + "x-ms-ratelimit-remaining-subscription-reads": "11976", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061206Z:ecd7589c-b0b4-4016-8b12-c469b4229908" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/ecbba085-4be2-43a8-8a50-87cdbb5e8127", - "name": "ecbba085-4be2-43a8-8a50-87cdbb5e8127", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/d023c493-d058-44f4-9c20-f05342c70abd", + "name": "d023c493-d058-44f4-9c20-f05342c70abd", "status": "Running", - "startTime": "2022-12-22T19:48:45.6372193Z" + "startTime": "2023-02-16T06:12:05.5668895Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/ecbba085-4be2-43a8-8a50-87cdbb5e8127?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/d023c493-d058-44f4-9c20-f05342c70abd?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -887,25 +856,25 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:49:55 GMT", + "Date": "Thu, 16 Feb 2023 06:12:36 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-91463ec794021adf19d071b7267e25fd-9805a8c4ee23241c-01", + "traceresponse": "00-02b4399f80e3fd02999111aa0601942e-e11a1db0f7239afb-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "76db3a37-0159-4508-a46f-f612a468cf93", - "x-ms-ratelimit-remaining-subscription-reads": "11982", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194956Z:76db3a37-0159-4508-a46f-f612a468cf93" + "x-ms-correlation-request-id": "eb737541-bd05-405a-ae90-0e24c328fd87", + "x-ms-ratelimit-remaining-subscription-reads": "11975", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061237Z:eb737541-bd05-405a-ae90-0e24c328fd87" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/ecbba085-4be2-43a8-8a50-87cdbb5e8127", - "name": "ecbba085-4be2-43a8-8a50-87cdbb5e8127", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/d023c493-d058-44f4-9c20-f05342c70abd", + "name": "d023c493-d058-44f4-9c20-f05342c70abd", "status": "Succeeded", - "startTime": "2022-12-22T19:48:45.6372193Z", - "endTime": "2022-12-22T19:49:33.4401096Z" + "startTime": "2023-02-16T06:12:05.5668895Z", + "endTime": "2023-02-16T06:12:35.58289Z" } }, { @@ -915,7 +884,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -923,18 +892,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:49:56 GMT", + "Date": "Thu, 16 Feb 2023 06:12:37 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-8af9f67ccf848a414aca5413d026c650-9d417dff6d4f321d-01", + "traceresponse": "00-c0bcbd06d24ea190408dd2e6632a3770-41334314f4642f60-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "cf8661bd-9843-4fe1-b926-82769cbc0f33", - "x-ms-ratelimit-remaining-subscription-reads": "11981", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194957Z:cf8661bd-9843-4fe1-b926-82769cbc0f33" + "x-ms-correlation-request-id": "0f62cb7c-6e4d-4730-a4ba-3b8c0bfdd825", + "x-ms-ratelimit-remaining-subscription-reads": "11974", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061237Z:0f62cb7c-6e4d-4730-a4ba-3b8c0bfdd825" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwin436a3919", @@ -942,8 +911,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Succeeded", - "createdTime": "2022-12-22T19:48:45.6221309Z", - "lastUpdatedTime": "2022-12-22T19:49:33.1606793Z", + "createdTime": "2023-02-16T06:12:05.5540582Z", + "lastUpdatedTime": "2023-02-16T06:12:35.2261475Z", "hostName": "digitalTwin436a3919.api.wus2.digitaltwins.azure.net", "privateEndpointConnections": [], "publicNetworkAccess": "Enabled" @@ -954,8 +923,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResource436a3919": { - "clientId": "20fda535-abad-42b4-9a4d-8eb16e043b1a", - "principalId": "e9874155-8803-4f65-a232-e64ccc35dd11" + "clientId": "9795ef93-d905-489a-a234-360a073adc9d", + "principalId": "f36af8cc-5a65-464b-9098-d040ce449b1a" } } }, @@ -963,10 +932,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:48:45.2720757Z", + "createdAt": "2023-02-16T06:12:05.1149167Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:48:45.2720757Z" + "lastModifiedAt": "2023-02-16T06:12:05.1149167Z" } } }, @@ -979,7 +948,7 @@ "Connection": "keep-alive", "Content-Length": "799", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "properties": { @@ -998,22 +967,22 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/12925be2-11ef-40b2-80b2-7f9bb48af74b?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/46748768-7fe5-4d27-b8ce-9e2e1578b6b1?api-version=2022-10-31", "Cache-Control": "no-cache", "Content-Length": "1505", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:49:56 GMT", + "Date": "Thu, 16 Feb 2023 06:12:37 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiVGltZVNlcmllc0RhdGFiYXNlQ29ubmVjdGlvbiIsInJlc291cmNlR3JvdXBOYW1lIjoicmdweS1yeXp3ZmVkZ2NmMmJqNXo0cnRlYmJiaGhmNzNydmZndWt2cXhqaWVkb215cWp6NXlkZTVlNHNrc21hY3B3dGtmMnBudjdzenhxcDciLCJyZXNvdXJjZU5hbWUiOiJkaWdpdGFsVHdpbjQzNmEzOTE5IiwibmVzdGVkUmVzb3VyY2VOYW1lIjoidHNkYkNvbm5lY3Rpb240MzZhMzkxOSJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiQ3JlYXRlIiwicmVzb3VyY2VLaW5kIjoiVGltZVNlcmllc0RhdGFiYXNlQ29ubmVjdGlvbiIsInJlc291cmNlR3JvdXBOYW1lIjoicmdweS13cGNmazZib3A2aWkzdXdkZTdhdTVuNnQ2dmZxMzZheDdtM3czNDNpcnIzZnM2Y3VoNWU3b2JzazZtNG14c240bnB5eWJqMnF3bnYiLCJyZXNvdXJjZU5hbWUiOiJkaWdpdGFsVHdpbjQzNmEzOTE5IiwibmVzdGVkUmVzb3VyY2VOYW1lIjoidHNkYkNvbm5lY3Rpb240MzZhMzkxOSJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-933ab63d0a79008e02d381b47181197e-4f6495b1cfa56a4d-01", + "traceresponse": "00-cf8dbe6d958ea864e825f409bd743c19-ce1e22e930cf7425-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d88dffbf-95aa-4c20-8abe-3718cd817516", - "x-ms-ratelimit-remaining-subscription-writes": "1189", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194957Z:d88dffbf-95aa-4c20-8abe-3718cd817516" + "x-ms-correlation-request-id": "58b146e6-ddc9-4480-a1f8-d7736feb90af", + "x-ms-ratelimit-remaining-subscription-writes": "1188", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061238Z:58b146e6-ddc9-4480-a1f8-d7736feb90af" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwin436a3919/timeSeriesDatabaseConnections/tsdbConnection436a3919", @@ -1038,10 +1007,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:49:57.3787709Z", + "createdAt": "2023-02-16T06:12:37.8839719Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:49:57.3787709Z" + "lastModifiedAt": "2023-02-16T06:12:37.8839719Z" } } }, @@ -1053,27 +1022,27 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/0769377a-a64f-4918-abf6-a85a990a510f?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/77c44da1-6b47-43be-b1bc-24089af3aacd?api-version=2022-10-31", "Cache-Control": "no-cache", "Content-Length": "1501", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:49:57 GMT", + "Date": "Thu, 16 Feb 2023 06:12:38 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiVGltZVNlcmllc0RhdGFiYXNlQ29ubmVjdGlvbiIsInJlc291cmNlR3JvdXBOYW1lIjoicmdweS1yeXp3ZmVkZ2NmMmJqNXo0cnRlYmJiaGhmNzNydmZndWt2cXhqaWVkb215cWp6NXlkZTVlNHNrc21hY3B3dGtmMnBudjdzenhxcDciLCJyZXNvdXJjZU5hbWUiOiJkaWdpdGFsVHdpbjQzNmEzOTE5IiwibmVzdGVkUmVzb3VyY2VOYW1lIjoidHNkYkNvbm5lY3Rpb240MzZhMzkxOSJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiVGltZVNlcmllc0RhdGFiYXNlQ29ubmVjdGlvbiIsInJlc291cmNlR3JvdXBOYW1lIjoicmdweS13cGNmazZib3A2aWkzdXdkZTdhdTVuNnQ2dmZxMzZheDdtM3czNDNpcnIzZnM2Y3VoNWU3b2JzazZtNG14c240bnB5eWJqMnF3bnYiLCJyZXNvdXJjZU5hbWUiOiJkaWdpdGFsVHdpbjQzNmEzOTE5IiwibmVzdGVkUmVzb3VyY2VOYW1lIjoidHNkYkNvbm5lY3Rpb240MzZhMzkxOSJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-883fbc700dbe9c5dc457ad8dcecf7767-314e331b61019caf-01", + "traceresponse": "00-c9d2df9a90de290058a4fbe26141201c-605d05bca415548a-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e2b7471a-9ec1-4c79-9266-4c8c537ea350", + "x-ms-correlation-request-id": "1811c068-fe4f-4ab2-834e-6e92e15ac4f0", "x-ms-ratelimit-remaining-subscription-deletes": "14994", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T194958Z:e2b7471a-9ec1-4c79-9266-4c8c537ea350" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061239Z:1811c068-fe4f-4ab2-834e-6e92e15ac4f0" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwin436a3919/timeSeriesDatabaseConnections/tsdbConnection436a3919", @@ -1098,21 +1067,56 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:49:57.3787709Z", + "createdAt": "2023-02-16T06:12:37.8839719Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:49:57.3787709Z" + "lastModifiedAt": "2023-02-16T06:12:37.8839719Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/0769377a-a64f-4918-abf6-a85a990a510f?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/77c44da1-6b47-43be-b1bc-24089af3aacd?api-version=2022-10-31", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 06:12:38 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "traceresponse": "00-409d602f12984ed308b9708ea0e3b4b7-fc43773544eabaae-01", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8826d148-8636-41bb-9446-e9a356a878e9", + "x-ms-ratelimit-remaining-subscription-reads": "11973", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061239Z:8826d148-8636-41bb-9446-e9a356a878e9" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/77c44da1-6b47-43be-b1bc-24089af3aacd", + "name": "77c44da1-6b47-43be-b1bc-24089af3aacd", + "status": "Running", + "startTime": "2023-02-16T06:12:38.8782778Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/77c44da1-6b47-43be-b1bc-24089af3aacd?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1120,25 +1124,25 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:50:08 GMT", + "Date": "Thu, 16 Feb 2023 06:13:08 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-038ee5823b359f28e0627360bf4f3642-a97e9e71f6666937-01", + "traceresponse": "00-69dcadf4b2ecf63be24a4ae37cff3951-dca48980e7a84835-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "61084479-6c0f-4d49-b099-18b043fb9bc3", - "x-ms-ratelimit-remaining-subscription-reads": "11980", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T195008Z:61084479-6c0f-4d49-b099-18b043fb9bc3" + "x-ms-correlation-request-id": "76bbb9fa-0544-4264-a8b9-c014adf9a620", + "x-ms-ratelimit-remaining-subscription-reads": "11972", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061309Z:76bbb9fa-0544-4264-a8b9-c014adf9a620" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/0769377a-a64f-4918-abf6-a85a990a510f", - "name": "0769377a-a64f-4918-abf6-a85a990a510f", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/77c44da1-6b47-43be-b1bc-24089af3aacd", + "name": "77c44da1-6b47-43be-b1bc-24089af3aacd", "status": "Succeeded", - "startTime": "2022-12-22T19:49:58.2519165Z", - "endTime": "2022-12-22T19:50:00.4450141Z" + "startTime": "2023-02-16T06:12:38.8782778Z", + "endTime": "2023-02-16T06:12:40.9233775Z" } }, { @@ -1149,27 +1153,27 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/044b032e-c302-422c-af20-7cca482dc317?api-version=2022-10-31", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/4fd63c01-c7cc-4993-9821-6ea37b948aa0?api-version=2022-10-31", "Cache-Control": "no-cache", "Content-Length": "1165", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:50:09 GMT", + "Date": "Thu, 16 Feb 2023 06:13:09 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktcnl6d2ZlZGdjZjJiajV6NHJ0ZWJiYmhoZjczcnZmZ3VrdnF4amllZG9teXFqejV5ZGU1ZTRza3NtYWNwd3RrZjJwbnY3c3p4cXA3IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW40MzZhMzkxOSJ9?api-version=2022-10-31", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationResults/eyJvcGVyYXRpb25LaW5kIjoiRGVsZXRlIiwicmVzb3VyY2VLaW5kIjoiRGlnaXRhbFR3aW5zSW5zdGFuY2UiLCJyZXNvdXJjZUdyb3VwTmFtZSI6InJncHktd3BjZms2Ym9wNmlpM3V3ZGU3YXU1bjZ0NnZmcTM2YXg3bTN3MzQzaXJyM2ZzNmN1aDVlN29ic2s2bTRteHNuNG5weXliajJxd252IiwicmVzb3VyY2VOYW1lIjoiZGlnaXRhbFR3aW40MzZhMzkxOSJ9?api-version=2022-10-31", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-19a4ddd8401fd6c4bc439ff1d81bfed1-c96d09ab89e51f11-01", + "traceresponse": "00-cb3e829b1bcd337d073a4787be4cb1fe-0deb0c6e960987de-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bd5994fc-704d-4a37-9916-9964e02a8ad4", + "x-ms-correlation-request-id": "6ddad595-2f23-44a0-8ba9-32b05d7db277", "x-ms-ratelimit-remaining-subscription-deletes": "14993", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T195009Z:bd5994fc-704d-4a37-9916-9964e02a8ad4" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061310Z:6ddad595-2f23-44a0-8ba9-32b05d7db277" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.DigitalTwins/digitalTwinsInstances/digitalTwin436a3919", @@ -1177,8 +1181,8 @@ "type": "Microsoft.DigitalTwins/digitalTwinsInstances", "properties": { "provisioningState": "Deleting", - "createdTime": "2022-12-22T19:48:45.6221309Z", - "lastUpdatedTime": "2022-12-22T19:49:33.1606793Z", + "createdTime": "2023-02-16T06:12:05.5540582Z", + "lastUpdatedTime": "2023-02-16T06:12:35.2261475Z", "hostName": "digitalTwin436a3919.api.wus2.digitaltwins.azure.net", "publicNetworkAccess": "Enabled" }, @@ -1188,8 +1192,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityResource436a3919": { - "clientId": "20fda535-abad-42b4-9a4d-8eb16e043b1a", - "principalId": "e9874155-8803-4f65-a232-e64ccc35dd11" + "clientId": "9795ef93-d905-489a-a234-360a073adc9d", + "principalId": "f36af8cc-5a65-464b-9098-d040ce449b1a" } } }, @@ -1197,21 +1201,21 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-12-22T19:48:45.2720757Z", + "createdAt": "2023-02-16T06:12:05.1149167Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-12-22T19:48:45.2720757Z" + "lastModifiedAt": "2023-02-16T06:12:05.1149167Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/044b032e-c302-422c-af20-7cca482dc317?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/4fd63c01-c7cc-4993-9821-6ea37b948aa0?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1219,34 +1223,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:50:19 GMT", + "Date": "Thu, 16 Feb 2023 06:13:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-94b725cecf684082dd4d167c3dbb89de-b7854444b420781f-01", + "traceresponse": "00-df297c97b9771d97e65aeee2ce800645-717bb8f87fc5b034-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a27f82ef-8142-41db-a98d-9bf7dda145f7", - "x-ms-ratelimit-remaining-subscription-reads": "11979", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T195019Z:a27f82ef-8142-41db-a98d-9bf7dda145f7" + "x-ms-correlation-request-id": "87e2fb67-7372-4b57-a032-97cef8b63097", + "x-ms-ratelimit-remaining-subscription-reads": "11971", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061310Z:87e2fb67-7372-4b57-a032-97cef8b63097" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/044b032e-c302-422c-af20-7cca482dc317", - "name": "044b032e-c302-422c-af20-7cca482dc317", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/4fd63c01-c7cc-4993-9821-6ea37b948aa0", + "name": "4fd63c01-c7cc-4993-9821-6ea37b948aa0", "status": "Running", - "startTime": "2022-12-22T19:50:09.0054077Z" + "startTime": "2023-02-16T06:13:10.3849789Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/044b032e-c302-422c-af20-7cca482dc317?api-version=2022-10-31", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DigitalTwins/locations/westus2/operationsStatuses/4fd63c01-c7cc-4993-9821-6ea37b948aa0?api-version=2022-10-31", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.3.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-digitaltwins/6.4.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1254,52 +1258,52 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 22 Dec 2022 19:50:49 GMT", + "Date": "Thu, 16 Feb 2023 06:13:40 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "traceresponse": "00-0f164db3e3a73ef637a16ef1cdd56e33-0923404cc1d9429d-01", + "traceresponse": "00-4e4c24cb1da47bcd808742fd8e558fcd-7b6ca68ed5631e36-01", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7457e1d9-9c73-464d-a2f2-fdbe2045fa8f", - "x-ms-ratelimit-remaining-subscription-reads": "11978", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T195049Z:7457e1d9-9c73-464d-a2f2-fdbe2045fa8f" + "x-ms-correlation-request-id": "6f5f1a62-9f06-412f-8015-d1a41d058fd1", + "x-ms-ratelimit-remaining-subscription-reads": "11970", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061341Z:6f5f1a62-9f06-412f-8015-d1a41d058fd1" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/044b032e-c302-422c-af20-7cca482dc317", - "name": "044b032e-c302-422c-af20-7cca482dc317", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2/operationsStatuses/4fd63c01-c7cc-4993-9821-6ea37b948aa0", + "name": "4fd63c01-c7cc-4993-9821-6ea37b948aa0", "status": "Succeeded", - "startTime": "2022-12-22T19:50:09.0054077Z", - "endTime": "2022-12-22T19:50:46.2810321Z" + "startTime": "2023-02-16T06:13:10.3849789Z", + "endTime": "2023-02-16T06:13:33.9070808Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2021-04-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname?api-version=2022-09-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-resource/21.1.0 Python/3.10.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 22 Dec 2022 19:50:50 GMT", + "Date": "Thu, 16 Feb 2023 06:13:43 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SR1BZOjJEUllaV0ZFREdDRjJCSjVaNFJURUJCQkhIRjczUlZGR1VLVlFYSklFRHw0QUQxMjZERUY2NEU1OUU5LVdFU1RVUzIiLCJqb2JMb2NhdGlvbiI6Indlc3R1czIifQ?api-version=2021-04-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SR1BZOjJEV1BDRks2Qk9QNklJM1VXREU3QVU1TjZUNlZGUTM2QVg3TTNXMzQzSXxDNDE2REZBOUNGNTMxQ0VELVdFU1RVUzIiLCJqb2JMb2NhdGlvbiI6Indlc3R1czIifQ?api-version=2022-09-01", "Pragma": "no-cache", "Retry-After": "15", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a219f3d1-8408-4f19-bf02-b0dcc3c74f24", + "x-ms-correlation-request-id": "5212b96a-09c3-4687-a2db-e1f87ba4207e", "x-ms-ratelimit-remaining-subscription-deletes": "14992", - "x-ms-routing-request-id": "SOUTHCENTRALUS:20221222T195050Z:a219f3d1-8408-4f19-bf02-b0dcc3c74f24" + "x-ms-routing-request-id": "SOUTHEASTASIA:20230216T061343Z:5212b96a-09c3-4687-a2db-e1f87ba4207e" }, "ResponseBody": null } diff --git a/sdk/eventgrid/azure-eventgrid/pyproject.toml b/sdk/eventgrid/azure-eventgrid/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/eventgrid/azure-eventgrid/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/pyproject.toml b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob/pyproject.toml b/sdk/eventhub/azure-eventhub-checkpointstoreblob/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/eventhub/azure-eventhub-checkpointstoretable/pyproject.toml b/sdk/eventhub/azure-eventhub-checkpointstoretable/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/eventhub/azure-eventhub-checkpointstoretable/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/eventhub/azure-eventhub/pyproject.toml b/sdk/eventhub/azure-eventhub/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/eventhub/azure-eventhub/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/pyproject.toml b/sdk/formrecognizer/azure-ai-formrecognizer/pyproject.toml new file mode 100644 index 000000000000..ae6b3321db78 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/pyproject.toml @@ -0,0 +1,3 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index f645e9c6f53c..58a3acf806e1 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features Added +- Changed parameter from `instance_discovery` to `disable_instance_discovery` to make it more explicit. + ### Breaking Changes ### Bugs Fixed diff --git a/sdk/identity/azure-identity/azure/identity/_internal/msal_credentials.py b/sdk/identity/azure-identity/azure/identity/_internal/msal_credentials.py index 2652ba9d28cf..7fb3e9a8aee7 100644 --- a/sdk/identity/azure-identity/azure/identity/_internal/msal_credentials.py +++ b/sdk/identity/azure-identity/azure/identity/_internal/msal_credentials.py @@ -24,11 +24,11 @@ def __init__( additionally_allowed_tenants: Optional[List[str]] = None, allow_broker: Optional[bool] = None, authority: Optional[str] = None, - instance_discovery: Optional[bool] = None, + disable_instance_discovery: Optional[bool] = None, tenant_id: Optional[str] = None, **kwargs ) -> None: - self._instance_discovery = instance_discovery + self._instance_discovery = None if disable_instance_discovery is None else not disable_instance_discovery self._authority = normalize_authority(authority) if authority else get_default_authority() self._regional_authority = os.environ.get(EnvironmentVariables.AZURE_REGIONAL_AUTHORITY_NAME) if self._regional_authority and self._regional_authority.lower() in ["tryautodetect", "true"]: diff --git a/sdk/identity/azure-identity/pyproject.toml b/sdk/identity/azure-identity/pyproject.toml new file mode 100644 index 000000000000..381c0d9346e5 --- /dev/null +++ b/sdk/identity/azure-identity/pyproject.toml @@ -0,0 +1,3 @@ +[tool.azure-sdk-build] +pyright = false +verifytypes = false diff --git a/sdk/identity/azure-identity/tests/test_device_code_credential.py b/sdk/identity/azure-identity/tests/test_device_code_credential.py index 8a4abfb2db10..1df0c4362e3f 100644 --- a/sdk/identity/azure-identity/tests/test_device_code_credential.py +++ b/sdk/identity/azure-identity/tests/test_device_code_credential.py @@ -203,7 +203,7 @@ def test_device_code_credential(): callback = Mock() credential = DeviceCodeCredential( - client_id=client_id, prompt_callback=callback, transport=transport, instance_discovery=False, + client_id=client_id, prompt_callback=callback, transport=transport, disable_instance_discovery=True, ) now = datetime.datetime.utcnow() @@ -259,7 +259,7 @@ def test_tenant_id(): callback = Mock() credential = DeviceCodeCredential( - client_id=client_id, prompt_callback=callback, transport=transport, instance_discovery=False, additionally_allowed_tenants=['*'] + client_id=client_id, prompt_callback=callback, transport=transport, disable_instance_discovery=True, additionally_allowed_tenants=['*'] ) now = datetime.datetime.utcnow() @@ -274,7 +274,7 @@ def test_timeout(): msal_app.initiate_device_flow.return_value = flow msal_app.acquire_token_by_device_flow.return_value = {"error": "authorization_pending"} - credential = DeviceCodeCredential(client_id="_", timeout=1, instance_discovery=False) + credential = DeviceCodeCredential(client_id="_", timeout=1, disable_instance_discovery=True) with pytest.raises(ClientAuthenticationError) as ex: credential.get_token("scope") assert "timed out" in ex.value.message.lower() diff --git a/sdk/identity/azure-identity/tests/test_instance_discovery.py b/sdk/identity/azure-identity/tests/test_instance_discovery.py index b891a9280fcb..1e897d26a246 100644 --- a/sdk/identity/azure-identity/tests/test_instance_discovery.py +++ b/sdk/identity/azure-identity/tests/test_instance_discovery.py @@ -8,14 +8,14 @@ def test_instance_discovery(): credential = MsalCredential( client_id="CLIENT_ID", - instance_discovery=False, + disable_instance_discovery=True, ) app = credential._get_app() assert not app._instance_discovery credential = MsalCredential( client_id="CLIENT_ID", - instance_discovery=True, + disable_instance_discovery=False, ) app = credential._get_app() assert app._instance_discovery diff --git a/sdk/identity/azure-identity/tests/test_username_password_credential.py b/sdk/identity/azure-identity/tests/test_username_password_credential.py index db9334ec4b2f..d36d89ebd9b8 100644 --- a/sdk/identity/azure-identity/tests/test_username_password_credential.py +++ b/sdk/identity/azure-identity/tests/test_username_password_credential.py @@ -111,7 +111,7 @@ def test_username_password_credential(): username="user@azure", password="secret_password", transport=transport, - instance_discovery=False, # kwargs are passed to MSAL; this one prevents an AAD verification request + disable_instance_discovery=True, # kwargs are passed to MSAL; this one prevents an AAD verification request ) token = credential.get_token("scope") diff --git a/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md b/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md index f315f7b31ca9..6dc9c5f0e7b1 100644 --- a/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md +++ b/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 2.4.0b1 (2023-02-15) + +### Other Changes + + - Added generated samples in github repo + - Drop support for python<3.7.0 + ## 2.3.0 (2022-09-02) ### Features Added diff --git a/sdk/iothub/azure-mgmt-iothub/MANIFEST.in b/sdk/iothub/azure-mgmt-iothub/MANIFEST.in index 4f989fa748a9..f74c68a95952 100644 --- a/sdk/iothub/azure-mgmt-iothub/MANIFEST.in +++ b/sdk/iothub/azure-mgmt-iothub/MANIFEST.in @@ -1,5 +1,6 @@ include _meta.json recursive-include tests *.py *.json +recursive-include samples *.py *.md include *.md include azure/__init__.py include azure/mgmt/__init__.py diff --git a/sdk/iothub/azure-mgmt-iothub/README.md b/sdk/iothub/azure-mgmt-iothub/README.md index efac4c465a39..d81a236ca6b9 100644 --- a/sdk/iothub/azure-mgmt-iothub/README.md +++ b/sdk/iothub/azure-mgmt-iothub/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/iot) -Code samples for this package can be found at [IoT Hub Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/iothub) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-iothub +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = IotHubClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [IoT Hub Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/iothub/azure-mgmt-iothub/_meta.json b/sdk/iothub/azure-mgmt-iothub/_meta.json index 7140ca4b0112..cfb86a41d3b2 100644 --- a/sdk/iothub/azure-mgmt-iothub/_meta.json +++ b/sdk/iothub/azure-mgmt-iothub/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.8.4", + "commit": "d37b3db5ec88a9fc2afcae36bf8d2004b1c5b537", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@6.0.1", - "@autorest/modelerfour@4.23.5" + "@autorest/python@6.4.0", + "@autorest/modelerfour@4.24.3" ], - "commit": "f842bc69f4c215ad60ffae63ef517c201772f8b2", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/iothub/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", + "autorest_command": "autorest specification/iothub/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/iothub/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/__init__.py index 12405308ae99..eb22ec618db9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/__init__.py @@ -14,3 +14,7 @@ patch_sdk() except ImportError: pass + +from ._version import VERSION + +__version__ = VERSION diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py index c38551cfabf9..9fc3b1a9a217 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py @@ -36,9 +36,8 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -53,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py index f480991eb801..0b92d170e8bf 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py @@ -66,10 +66,10 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version=None, # type: Optional[str] + api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -189,6 +189,7 @@ def certificates(self): from .v2022_04_30_preview.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -226,6 +227,7 @@ def iot_hub(self): from .v2022_04_30_preview.operations import IotHubOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -278,6 +280,7 @@ def iot_hub_resource(self): from .v2022_04_30_preview.operations import IotHubResourceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub_resource'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -324,6 +327,7 @@ def operations(self): from .v2022_04_30_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -352,6 +356,7 @@ def private_endpoint_connections(self): from .v2022_04_30_preview.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -380,6 +385,7 @@ def private_link_resources(self): from .v2022_04_30_preview.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -420,6 +426,7 @@ def resource_provider_common(self): from .v2022_04_30_preview.operations import ResourceProviderCommonOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_provider_common'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) def close(self): diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_serialization.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_serialization.py index 2e44d8666b2b..25467dfc00bb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_serialization.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,34 +38,50 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull -_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") # Name used in context CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -75,12 +92,12 @@ def deserialize_from_text(cls, data, content_type=None): :type data: str or bytes or IO :param str content_type: The content type. """ - if hasattr(data, 'read'): + if hasattr(data, "read"): # Assume a stream data = cast(IO, data).read() if isinstance(data, bytes): - data_as_str = data.decode(encoding='utf-8-sig') + data_as_str = data.decode(encoding="utf-8-sig") else: # Explain to mypy the correct type. data_as_str = cast(str, data) @@ -116,7 +133,8 @@ def _json_attemp(data): try: return True, json.loads(data) except ValueError: - return False, None # Don't care about this one + return False, None # Don't care about this one + success, json_result = _json_attemp(data) if success: return json_result @@ -129,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -139,8 +156,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): """ # Try to use content-type from headers if available content_type = None - if 'content-type' in headers: - content_type = headers['content-type'].split(";")[0].strip().lower() + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() # Ouch, this server did not declare what it sent... # Let's guess it's JSON... # Also, since Autorest was considering that an empty body was a valid JSON, @@ -152,20 +169,22 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return cls.deserialize_from_text(body_bytes, content_type) return None + try: basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) try: - _long_type = long # type: ignore + _long_type = long # type: ignore except NameError: _long_type = int + class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" @@ -181,9 +200,11 @@ def dst(self, dt): """No daylight saving for UTC.""" return datetime.timedelta(hours=1) + try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore """Fixed offset in minutes east from UTC. Copy/pasted from Python doc @@ -197,7 +218,7 @@ def utcoffset(self, dt): return self.__offset def tzname(self, dt): - return str(self.__offset.total_seconds()/3600) + return str(self.__offset.total_seconds() / 3600) def __repr__(self): return "".format(self.tzname(None)) @@ -208,14 +229,17 @@ def dst(self, dt): def __getinitargs__(self): return (self.__offset,) + try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore _FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -276,47 +304,42 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): - cls._attribute_map['additional_properties'] = {'key': '', 'type': '{object}'} + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @classmethod def _create_xml_node(cls): - """Create XML node. - """ + """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} - return _create_xml_node( - xml_map.get('name', cls.__name__), - xml_map.get("prefix", None), - xml_map.get("ns", None) - ) + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -330,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -367,7 +397,7 @@ def my_key_transformer(key, attr_desc, value): @classmethod def _infer_class_models(cls): try: - str_models = cls.__module__.rsplit('.', 1)[0] + str_models = cls.__module__.rsplit(".", 1)[0] models = sys.modules[str_models] client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: @@ -378,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -390,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -403,16 +438,20 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = [ - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor - ] if key_extractors is None else key_extractors + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) return deserializer(cls.__name__, data, content_type=content_type) @classmethod def _flatten_subtype(cls, key, objects): - if '_subtype_map' not in cls.__dict__: + if "_subtype_map" not in cls.__dict__: return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): @@ -425,18 +464,14 @@ def _classify(cls, response, objects): We want to ignore any inherited _subtype_maps. Remove the polymorphic key from the initial data. """ - for subtype_key in cls.__dict__.get('_subtype_map', {}).keys(): + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) else: - subtype_value = xml_key_extractor( - subtype_key, - cls._attribute_map[subtype_key], - response - ) + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: # Try to match base class. Can be class name only # (bug to fix in Autorest to support x-ms-discriminator-name) @@ -444,7 +479,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -453,11 +488,7 @@ def _classify(cls, response, objects): ) break else: - _LOGGER.warning( - "Discriminator %s is absent or null, use base class %s.", - subtype_key, - cls.__name__ - ) + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) break return cls @@ -468,29 +499,40 @@ def _get_rest_key_parts(cls, attr_key): :returns: A list of RestAPI part :rtype: list """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]['key']) + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] def _decode_attribute_map_key(key): """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. + inside the received data. - :param str key: A key string from the generated code + :param str key: A key string from the generated code """ - return key.replace('\\.', '.') + return key.replace("\\.", ".") class Serializer(object): """Request object model serializer.""" - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} - - _xml_basic_types_serializers = {'bool': lambda x:str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", - 4: "Fri", 5: "Sat", 6: "Sun"} - months = {1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", - 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec"} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } validation = { "min_length": lambda x, y: len(x) < y, "max_length": lambda x, y: len(x) > y, @@ -502,26 +544,26 @@ class Serializer(object): "max_items": lambda x, y: len(x) > y, "pattern": lambda x, y: not re.match(y, x, re.UNICODE), "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0 - } + "multiple": lambda x, y: x % y != 0, + } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { - 'iso-8601': Serializer.serialize_iso, - 'rfc-1123': Serializer.serialize_rfc, - 'unix-time': Serializer.serialize_unix, - 'duration': Serializer.serialize_duration, - 'date': Serializer.serialize_date, - 'time': Serializer.serialize_time, - 'decimal': Serializer.serialize_decimal, - 'long': Serializer.serialize_long, - 'bytearray': Serializer.serialize_bytearray, - 'base64': Serializer.serialize_base64, - 'object': self.serialize_object, - '[]': self.serialize_iter, - '{}': self.serialize_dict - } - self.dependencies = dict(classes) if classes else {} + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -542,14 +584,12 @@ def _serialize(self, target_obj, data_type=None, **kwargs): class_name = target_obj.__class__.__name__ if data_type: - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) if not hasattr(target_obj, "_attribute_map"): data_type = type(target_obj).__name__ if data_type in self.basic_types.values(): - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) # Force "is_xml" kwargs if we detect a XML model try: @@ -564,10 +604,10 @@ def _serialize(self, target_obj, data_type=None, **kwargs): attributes = target_obj._attribute_map for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): continue - if attr_name == "additional_properties" and attr_desc["key"] == '': + if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: serialized.update(target_obj.additional_properties) continue @@ -575,68 +615,60 @@ def _serialize(self, target_obj, data_type=None, **kwargs): orig_attr = getattr(target_obj, attr) if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) keys = keys if isinstance(keys, list) else [keys] - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) - + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) if is_xml_model_serialization: - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) - xml_prefix = xml_desc.get('prefix', None) - xml_ns = xml_desc.get('ns', None) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if 'name' not in getattr(orig_attr, '_xml_map', {}): + if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace + if len(splitted_tag) == 2: # Namespace new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary - local_node = _create_xml_node( - xml_name, - xml_prefix, - xml_ns - ) + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format( - attr_name, class_name, str(target_obj)) + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise_with_traceback(SerializationError, msg, err) else: return serialized @@ -652,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip('[]{}') - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -668,19 +700,18 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: deserializer.key_extractors = [ rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor + last_rest_key_case_insensitive_extractor, ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback( - SerializationError, "Unable to build a model: "+str(err), err) + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) return self._serialize(data, data_type, **kwargs) @@ -695,13 +726,13 @@ def url(self, name, data, data_type, **kwargs): """ try: output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -720,27 +751,19 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [ - self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" - for d - in data - ] - if not kwargs.get('skip_quote', False): - data = [ - quote(str(d), safe='') - for d - in data - ] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] return str(self.serialize_iter(data, internal_data_type, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -756,11 +779,11 @@ def header(self, name, data, data_type, **kwargs): :raises: ValueError if data is None """ try: - if data_type in ['[str]']: + if data_type in ["[str]"]: data = ["" if d is None else d for d in data] output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) @@ -782,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -796,13 +821,11 @@ def serialize_data(self, data, data_type, **kwargs): iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: - return self.serialize_type[iter_type]( - data, data_type[1:-1], **kwargs) + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback( - SerializationError, msg.format(data, data_type), err) + raise_with_traceback(SerializationError, msg.format(data, data_type), err) else: return self._serialize(data, **kwargs) @@ -829,7 +852,7 @@ def serialize_basic(cls, data, data_type, **kwargs): custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) - if data_type == 'str': + if data_type == "str": return cls.serialize_unicode(data) return eval(data_type)(data) # nosec @@ -847,7 +870,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -886,25 +909,21 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialized.append(None) if div: - serialized = ['' if s is None else str(s) for s in serialized] + serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) - if 'xml' in serialization_ctxt or is_xml: + if "xml" in serialization_ctxt or is_xml: # XML serialization is more complicated - xml_desc = serialization_ctxt.get('xml', {}) - xml_name = xml_desc.get('name') + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") if not xml_name: - xml_name = serialization_ctxt['key'] + xml_name = serialization_ctxt["key"] # Create a wrap node if necessary (use the fact that Element and list have "append") is_wrapped = xml_desc.get("wrapped", False) node_name = xml_desc.get("itemsName", xml_name) if is_wrapped: - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) else: final_result = [] # All list elements to "local_node" @@ -912,11 +931,7 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): if isinstance(el, ET.Element): el_node = el else: - el_node = _create_xml_node( - node_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) if el is not None: # Otherwise it writes "None" :-p el_node.text = str(el) final_result.append(el_node) @@ -936,21 +951,16 @@ def serialize_dict(self, attr, dict_type, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_data( - value, dict_type, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None - if 'xml' in serialization_ctxt: + if "xml" in serialization_ctxt: # XML serialization is more complicated - xml_desc = serialization_ctxt['xml'] - xml_name = xml_desc['name'] + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) for key, value in serialized.items(): ET.SubElement(final_result, key).text = value return final_result @@ -996,8 +1006,7 @@ def serialize_object(self, attr, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_object( - value, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None return serialized @@ -1006,8 +1015,7 @@ def serialize_object(self, attr, **kwargs): serialized = [] for obj in attr: try: - serialized.append(self.serialize_object( - obj, **kwargs)) + serialized.append(self.serialize_object(obj, **kwargs)) except ValueError: pass return serialized @@ -1020,10 +1028,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1045,8 +1053,8 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr).decode('ascii') - return encoded.strip('=').replace('+', '-').replace('/', '_') + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod def serialize_decimal(attr, **kwargs): @@ -1113,16 +1121,20 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], utc.tm_mday, - Serializer.months[utc.tm_mon], utc.tm_year, - utc.tm_hour, utc.tm_min, utc.tm_sec) + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) @staticmethod def serialize_iso(attr, **kwargs): @@ -1136,19 +1148,18 @@ def serialize_iso(attr, **kwargs): attr = isodate.parse_datetime(attr) try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") - microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") if microseconds: - microseconds = '.'+microseconds + microseconds = "." + microseconds date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, - utc.tm_hour, utc.tm_min, utc.tm_sec) - return date + microseconds + 'Z' + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) @@ -1169,18 +1180,19 @@ def serialize_unix(attr, **kwargs): return attr try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") + def rest_key_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: - dict_keys = _FLATTEN.split(key) + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1191,15 +1203,16 @@ def rest_key_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) return working_data.get(key) + def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1211,30 +1224,33 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) if working_data: return attribute_key_case_insensitive_extractor(key, None, working_data) + def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - """ - key = attr_desc['key'] + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) + def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" """ - key = attr_desc['key'] + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + def attribute_key_extractor(attr, _, data): return data.get(attr) + def attribute_key_case_insensitive_extractor(attr, _, data): found_key = None lower_attr = attr.lower() @@ -1245,6 +1261,7 @@ def attribute_key_case_insensitive_extractor(attr, _, data): return data.get(found_key) + def _extract_name_from_internal_type(internal_type): """Given an internal type XML description, extract correct XML name with namespace. @@ -1253,7 +1270,7 @@ def _extract_name_from_internal_type(internal_type): :returns: A tuple XML name + namespace dict """ internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1268,17 +1285,17 @@ def xml_key_extractor(attr, attr_desc, data): if not isinstance(data, ET.Element): return None - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) # Look for a children - is_iter_type = attr_desc['type'].startswith("[") + is_iter_type = attr_desc["type"].startswith("[") is_wrapped = xml_desc.get("wrapped", False) internal_type = attr_desc.get("internalType", None) internal_type_xml_map = getattr(internal_type, "_xml_map", {}) # Integrate namespace if necessary - xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1294,15 +1311,15 @@ def xml_key_extractor(attr, attr_desc, data): # - Wrapped node # - Internal type is an enum (considered basic types) # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): children = data.findall(xml_name) # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: xml_name = _extract_name_from_internal_type(internal_type) children = data.findall(xml_name) # That's an array else: - if internal_type: # Complex type, ignore itemsName and use the complex type name + if internal_type: # Complex type, ignore itemsName and use the complex type name items_name = _extract_name_from_internal_type(internal_type) else: items_name = xml_desc.get("itemsName", xml_name) @@ -1311,21 +1328,22 @@ def xml_key_extractor(attr, attr_desc, data): if len(children) == 0: if is_iter_type: if is_wrapped: - return None # is_wrapped no node, we want None + return None # is_wrapped no node, we want None else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) + else: # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name - )) + ) + ) return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty @@ -1333,6 +1351,7 @@ def xml_key_extractor(attr, attr_desc, data): raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) return children[0] + class Deserializer(object): """Response object model deserializer. @@ -1340,37 +1359,32 @@ class Deserializer(object): :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. """ - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile( - r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' - r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { - 'iso-8601': Deserializer.deserialize_iso, - 'rfc-1123': Deserializer.deserialize_rfc, - 'unix-time': Deserializer.deserialize_unix, - 'duration': Deserializer.deserialize_duration, - 'date': Deserializer.deserialize_date, - 'time': Deserializer.deserialize_time, - 'decimal': Deserializer.deserialize_decimal, - 'long': Deserializer.deserialize_long, - 'bytearray': Deserializer.deserialize_bytearray, - 'base64': Deserializer.deserialize_base64, - 'object': self.deserialize_object, - '[]': self.deserialize_iter, - '{}': self.deserialize_dict - } + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } self.deserialize_expected_types = { - 'duration': (isodate.Duration, datetime.timedelta), - 'iso-8601': (datetime.datetime) + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [ - rest_key_extractor, - xml_key_extractor - ] + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much # complicated, with no real scenario for now. @@ -1403,8 +1417,7 @@ def _deserialize(self, target_obj, data): """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, '_validation', {}).items() - if config.get('constant')] + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: for attr, mapconfig in data._attribute_map.items(): if attr in constants: @@ -1412,15 +1425,11 @@ def _deserialize(self, target_obj, data): value = getattr(data, attr) if value is None: continue - local_type = mapconfig['type'] - internal_data_type = local_type.strip('[]{}') + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): continue - setattr( - data, - attr, - self._deserialize(local_type, value) - ) + setattr(data, attr, self._deserialize(local_type, value)) return data except AttributeError: return @@ -1435,16 +1444,16 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == '': + if attr == "additional_properties" and attr_desc["key"] == "": continue raw_value = None # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip('[]{}') + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") if internal_data_type in self.dependencies: attr_desc["internalType"] = self.dependencies[internal_data_type] @@ -1452,21 +1461,18 @@ def _deserialize(self, target_obj, data): found_value = key_extractor(attr, attr_desc, data) if found_value is not None: if raw_value is not None and raw_value != found_value: - msg = ("Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" ) - _LOGGER.warning( - msg, - found_value, - key_extractor, - attr + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning(msg, found_value, key_extractor, attr) continue raw_value = found_value - value = self.deserialize_data(raw_value, attr_desc['type']) + value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1475,14 +1481,17 @@ def _deserialize(self, target_obj, data): def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": # Check empty string. If it's not empty, someone has a real "additionalProperties" return None if isinstance(data, ET.Element): data = {el.tag: el.text for el in data} - known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) - for desc in attribute_map.values() if desc['key'] != ''} + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } present_keys = set(data.keys()) missing_keys = present_keys - known_keys return {key: data[key] for key in missing_keys} @@ -1493,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1508,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1518,15 +1527,14 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: return self(target_obj, data, content_type=content_type) except: - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None @@ -1554,22 +1562,16 @@ def _unpack_content(raw_data, content_type=None): return context[RawDeserializer.CONTEXT_NAME] raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - #Assume this is enough to recognize universal_http.ClientResponse without importing it + # Assume this is enough to recognize universal_http.ClientResponse without importing it if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text(), - raw_data.headers - ) + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, '_content_consumed'): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text, - raw_data.headers - ) + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1579,14 +1581,11 @@ def _instantiate_model(self, response, attrs, additional_properties=None): :param d_attrs: The deserialized response attributes. """ if callable(response): - subtype = getattr(response, '_subtype_map', {}) + subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() - if v.get('readonly')] - const = [k for k, v in response._validation.items() - if v.get('constant')] - kwargs = {k: v for k, v in attrs.items() - if k not in subtype and k not in readonly + const} + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) @@ -1594,8 +1593,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format( - kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1659,13 +1657,10 @@ def deserialize_iter(self, attr, iter_type): """ if attr is None: return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children + if isinstance(attr, ET.Element): # If I receive an element here, get the children attr = list(attr) if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( - iter_type, - type(attr) - )) + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) return [self.deserialize_data(a, iter_type) for a in attr] def deserialize_dict(self, attr, dict_type): @@ -1677,7 +1672,7 @@ def deserialize_dict(self, attr, dict_type): :rtype: dict """ if isinstance(attr, list): - return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} if isinstance(attr, ET.Element): # Transform value into {"Key": "value"} @@ -1698,7 +1693,7 @@ def deserialize_object(self, attr, **kwargs): # Do no recurse on XML, just return the tree as-is return attr if isinstance(attr, basestring): - return self.deserialize_basic(attr, 'str') + return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: return self.deserialize_basic(attr, self.basic_types[obj_type]) @@ -1709,8 +1704,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = {} for key, value in attr.items(): try: - deserialized[key] = self.deserialize_object( - value, **kwargs) + deserialized[key] = self.deserialize_object(value, **kwargs) except ValueError: deserialized[key] = None return deserialized @@ -1719,8 +1713,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = [] for obj in attr: try: - deserialized.append(self.deserialize_object( - obj, **kwargs)) + deserialized.append(self.deserialize_object(obj, **kwargs)) except ValueError: pass return deserialized @@ -1747,23 +1740,23 @@ def deserialize_basic(self, attr, data_type): if not attr: if data_type == "str": # None or '', node is empty string. - return '' + return "" else: # None or '', node with a strong type is None. # Don't try to model "empty bool" or "empty int" return None - if data_type == 'bool': + if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) elif isinstance(attr, basestring): - if attr.lower() in ['true', '1']: + if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ['false', '0']: + elif attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) - if data_type == 'str': + if data_type == "str": return self.deserialize_unicode(attr) return eval(data_type)(attr) # nosec @@ -1782,7 +1775,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1833,7 +1826,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1845,9 +1838,9 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = '=' * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace('-', '+').replace('_', '/') + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @staticmethod @@ -1861,7 +1854,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1876,7 +1869,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1890,7 +1883,7 @@ def deserialize_duration(attr): attr = attr.text try: duration = isodate.parse_duration(attr) - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1906,7 +1899,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1921,7 +1914,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1936,10 +1929,9 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], - tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -1960,12 +1952,12 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) - check_decimal = attr.split('.') + check_decimal = attr.split(".") if len(check_decimal) > 1: decimal_str = "" for digit in check_decimal[1]: @@ -1980,7 +1972,7 @@ def deserialize_iso(attr): test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1996,11 +1988,11 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise_with_traceback(DeserializationError, msg, err) else: - return date_obj \ No newline at end of file + return date_obj diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py index 22e8405004a6..a72ad8820f68 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py index 865f05b4ea5b..b1bacb51dc4d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py @@ -69,7 +69,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -189,6 +189,7 @@ def certificates(self): from ..v2022_04_30_preview.aio.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -226,6 +227,7 @@ def iot_hub(self): from ..v2022_04_30_preview.aio.operations import IotHubOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -278,6 +280,7 @@ def iot_hub_resource(self): from ..v2022_04_30_preview.aio.operations import IotHubResourceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub_resource'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -324,6 +327,7 @@ def operations(self): from ..v2022_04_30_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -352,6 +356,7 @@ def private_endpoint_connections(self): from ..v2022_04_30_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -380,6 +385,7 @@ def private_link_resources(self): from ..v2022_04_30_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -420,6 +426,7 @@ def resource_provider_common(self): from ..v2022_04_30_preview.aio.operations import ResourceProviderCommonOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_provider_common'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) async def close(self): diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py index fe393233cee1..83e3cf977747 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-03") # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", "2016-02-03") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py index 02b1f576fdc6..2d8d4b2311df 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import IotHubResourceOperations @@ -50,7 +50,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -78,15 +78,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json index 95060ef31fdc..543885c2aa53 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -99,4 +107,4 @@ "operation_groups": { "iot_hub_resource": "IotHubResourceOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py index c5e320081f03..fecc19feceaa 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-03") # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", "2016-02-03") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py index 521305468807..6edf24f001ba 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import IotHubResourceOperations @@ -51,7 +51,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,5 +86,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/__init__.py index 972b73cd63bb..176e993e6151 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._iot_hub_resource_operations import IotHubResourceOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py index b71570d38241..b988be97b93c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -51,6 +53,10 @@ build_list_keys_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,14 +95,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -108,9 +119,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -128,7 +139,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -137,15 +150,20 @@ async def _create_or_update_initial( iot_hub_description: Union[_models.IotHubDescription, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,9 +186,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -188,11 +206,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -298,8 +318,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -321,14 +341,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -348,7 +368,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -360,21 +380,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -386,9 +413,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,12 +441,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -446,13 +475,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -470,7 +499,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -482,9 +511,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -501,10 +532,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -518,16 +554,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -535,13 +578,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -555,7 +598,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -577,10 +620,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -595,16 +643,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -612,13 +667,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -632,7 +687,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -651,14 +708,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -670,9 +732,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -690,7 +752,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -714,10 +778,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -733,16 +802,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -750,13 +826,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -770,7 +846,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -796,10 +874,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -816,16 +899,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -833,13 +923,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -853,7 +943,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -877,14 +969,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -898,9 +995,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -918,7 +1015,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -942,14 +1041,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -963,9 +1067,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -983,7 +1087,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1007,14 +1113,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1028,9 +1139,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1044,7 +1155,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1069,10 +1182,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1088,16 +1206,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1105,13 +1230,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1125,7 +1250,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1148,14 +1275,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1168,9 +1300,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1188,7 +1320,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1212,10 +1346,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1231,16 +1370,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1248,13 +1394,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1268,7 +1414,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload async def check_name_availability( @@ -1319,7 +1467,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2016_02_03.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1329,15 +1477,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1358,9 +1511,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1378,7 +1531,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -1404,10 +1559,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1423,16 +1583,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1440,13 +1607,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1460,7 +1627,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -1483,14 +1652,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -1503,9 +1677,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1523,7 +1697,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -1614,7 +1790,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -1625,15 +1801,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1656,9 +1837,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1676,7 +1857,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -1767,7 +1950,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -1778,15 +1961,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1809,9 +1997,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1829,4 +2017,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/__init__.py index 97481abddb80..b31ca47ca889 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/__init__.py @@ -47,7 +47,7 @@ from ._iot_hub_client_enums import JobType from ._iot_hub_client_enums import OperationMonitoringLevel from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py index 92329bf19f10..f5a423435543 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -48,8 +48,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -97,7 +97,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "Details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -129,8 +129,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The tags. :paramtype tags: dict[str, str] @@ -165,7 +165,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List[str]] = None, **kwargs): + def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Event Hub-compatible consumer group names. :paramtype value: list[str] @@ -210,8 +210,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -251,7 +251,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "ExcludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -296,8 +296,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -338,7 +338,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "OutputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -380,7 +380,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -423,7 +423,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -502,8 +502,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -550,7 +550,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] @@ -584,7 +584,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -678,8 +678,8 @@ def __init__( comments: Optional[str] = None, operations_monitoring_properties: Optional["_models.OperationsMonitoringProperties"] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -758,7 +758,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "MaxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -786,7 +786,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubQuotaMetricInfo] @@ -823,7 +823,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: Information about the SKU of the IoT hub. Required. :paramtype sku: ~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuInfo @@ -856,7 +856,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuDescription] @@ -894,7 +894,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: int, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: int, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", and "S3". :paramtype name: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubSku @@ -935,7 +935,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1000,7 +1002,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1033,7 +1035,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2016_02_03.models.JobResponse] @@ -1074,8 +1076,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1111,7 +1113,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "Name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1121,7 +1123,8 @@ def __init__(self, *, name: str, **kwargs): class OperationsMonitoringProperties(_serialization.Model): - """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. + """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are + Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. :ivar events: Dictionary of :code:``. :vartype events: dict[str, str or @@ -1132,7 +1135,9 @@ class OperationsMonitoringProperties(_serialization.Model): "events": {"key": "events", "type": "{str}"}, } - def __init__(self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs): + def __init__( + self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs: Any + ) -> None: """ :keyword events: Dictionary of :code:``. :paramtype events: dict[str, str or @@ -1167,7 +1172,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1215,8 +1220,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -1261,7 +1266,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -1306,8 +1313,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/__init__.py index 972b73cd63bb..176e993e6151 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/__init__.py @@ -9,7 +9,7 @@ from ._iot_hub_resource_operations import IotHubResourceOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py index 7d38ebd127f3..2626971037cc 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +112,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -120,7 +126,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,7 +141,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -144,7 +150,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +165,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -172,7 +178,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,7 +195,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -203,7 +209,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +226,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -234,7 +240,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,7 +257,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -266,7 +272,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -288,7 +294,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -304,7 +310,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -326,7 +332,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -342,7 +348,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -364,7 +370,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -380,7 +386,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -397,7 +403,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -411,7 +417,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -428,7 +434,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -443,7 +449,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -460,7 +466,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -474,7 +480,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -489,8 +495,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -501,7 +507,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -520,7 +526,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -534,7 +540,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -551,7 +557,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -566,7 +572,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -583,8 +589,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -598,7 +604,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -617,8 +623,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -632,7 +638,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -679,14 +685,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -698,9 +709,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -718,7 +729,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -727,15 +740,20 @@ def _create_or_update_initial( iot_hub_description: Union[_models.IotHubDescription, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -758,9 +776,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -778,11 +796,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -886,8 +906,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -908,14 +928,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -935,7 +955,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -947,21 +967,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -973,9 +1000,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1001,12 +1028,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1032,13 +1061,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1056,7 +1085,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1068,9 +1097,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1086,10 +1117,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1103,16 +1139,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1120,13 +1163,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1140,7 +1183,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1159,10 +1202,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1177,16 +1225,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1194,13 +1249,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1214,7 +1269,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1231,14 +1288,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2016_02_03.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1250,9 +1312,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1270,7 +1332,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1294,10 +1358,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1313,16 +1382,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1330,13 +1406,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1350,7 +1426,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1376,10 +1454,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1396,16 +1479,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1413,13 +1503,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1433,7 +1523,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1457,14 +1549,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1478,9 +1575,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1498,7 +1595,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1522,14 +1621,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1543,9 +1647,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1563,7 +1667,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1587,14 +1693,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1608,9 +1719,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1624,7 +1735,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -1646,10 +1759,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1665,16 +1783,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1682,13 +1807,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1702,7 +1827,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -1723,14 +1850,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1743,9 +1875,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1763,7 +1895,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1787,10 +1921,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1806,16 +1945,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1823,13 +1969,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1843,7 +1989,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload def check_name_availability( @@ -1894,7 +2042,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2016_02_03.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1904,15 +2052,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1933,9 +2086,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1953,7 +2106,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -1979,10 +2134,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1998,16 +2158,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2015,13 +2182,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2035,7 +2202,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2058,14 +2227,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2078,9 +2252,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2098,7 +2272,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2189,7 +2365,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -2200,15 +2376,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2231,9 +2412,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2251,7 +2432,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -2342,7 +2525,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -2353,15 +2536,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2016-02-03"] = kwargs.pop("api_version", _params.pop("api-version", "2016-02-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2384,9 +2572,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2404,4 +2592,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_configuration.py index 99d7a05ade1a..2c7d4dfbbf14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-01-19") # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", "2017-01-19") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py index fca03a72d753..44b35612080e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import IotHubResourceOperations @@ -50,7 +50,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -78,15 +78,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json index 830a9225e6fd..3793ba632ce3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -99,4 +107,4 @@ "operation_groups": { "iot_hub_resource": "IotHubResourceOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py index c0aa5275f93e..43001a34920d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-01-19") # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", "2017-01-19") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py index a038374c6cd4..be09b4138c0f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import IotHubResourceOperations @@ -51,7 +51,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,5 +86,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/__init__.py index 972b73cd63bb..176e993e6151 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._iot_hub_resource_operations import IotHubResourceOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py index 500abcd9f330..dd2d90e9a713 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -51,6 +53,10 @@ build_list_keys_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,14 +95,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -108,9 +119,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -128,7 +139,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -137,15 +150,20 @@ async def _create_or_update_initial( iot_hub_description: Union[_models.IotHubDescription, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,9 +186,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -188,11 +206,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -298,8 +318,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -321,14 +341,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -348,7 +368,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -360,21 +380,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -386,9 +413,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,12 +441,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -446,13 +475,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -470,7 +499,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -482,9 +511,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -501,10 +532,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -518,16 +554,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -535,13 +578,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -555,7 +598,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -577,10 +620,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -595,16 +643,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -612,13 +667,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -632,7 +687,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -651,14 +708,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -670,9 +732,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -690,7 +752,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -714,10 +778,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -733,16 +802,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -750,13 +826,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -770,7 +846,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -796,10 +874,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -816,16 +899,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -833,13 +923,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -853,7 +943,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -877,14 +969,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -898,9 +995,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -918,7 +1015,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -942,14 +1041,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -963,9 +1067,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -983,7 +1087,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1007,14 +1113,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1028,9 +1139,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1044,7 +1155,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1069,10 +1182,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1088,16 +1206,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1105,13 +1230,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1125,7 +1250,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1148,14 +1275,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1168,9 +1300,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1188,7 +1320,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1212,10 +1346,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1231,16 +1370,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1248,13 +1394,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1268,7 +1414,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload async def check_name_availability( @@ -1319,7 +1467,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2017_01_19.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1329,15 +1477,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1358,9 +1511,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1378,7 +1531,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -1404,10 +1559,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1423,16 +1583,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1440,13 +1607,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1460,7 +1627,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -1483,14 +1652,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -1503,9 +1677,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1523,7 +1697,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -1614,7 +1790,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1625,15 +1801,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1656,9 +1837,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1676,7 +1857,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -1767,7 +1950,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1778,15 +1961,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1809,9 +1997,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1829,4 +2017,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/__init__.py index d8247521ad65..1044a9bcc2ff 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/__init__.py @@ -55,7 +55,7 @@ from ._iot_hub_client_enums import OperationMonitoringLevel from ._iot_hub_client_enums import RoutingSource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py index 1992b2788ec3..d6c0d7659470 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -48,8 +48,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -97,7 +97,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "Details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -129,8 +129,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The tags. :paramtype tags: dict[str, str] @@ -165,7 +165,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List[str]] = None, **kwargs): + def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Event Hub-compatible consumer group names. :paramtype value: list[str] @@ -210,8 +210,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -251,7 +251,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "ExcludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -265,7 +265,8 @@ def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwar class FallbackRouteProperties(_serialization.Model): - """The properties related to the fallback route based on which the IoT hub routes messages to the fallback endpoint. + """The properties related to the fallback route based on which the IoT hub routes messages to the + fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -304,8 +305,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source: The source to which the routing rule is to be applied to. e.g. DeviceMessages. Required. Known values are: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", and @@ -360,8 +361,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -402,7 +403,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "OutputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -444,7 +445,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -487,7 +488,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -566,8 +567,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -614,7 +615,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] @@ -648,7 +649,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -748,8 +749,8 @@ def __init__( comments: Optional[str] = None, operations_monitoring_properties: Optional["_models.OperationsMonitoringProperties"] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -833,7 +834,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "MaxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -861,7 +862,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubQuotaMetricInfo] @@ -898,7 +899,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: Information about the SKU of the IoT hub. Required. :paramtype sku: ~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuInfo @@ -931,7 +932,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuDescription] @@ -969,7 +970,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: int, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: int, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", and "S3". :paramtype name: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubSku @@ -1010,7 +1011,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1075,7 +1078,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1108,7 +1111,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2017_01_19.models.JobResponse] @@ -1149,8 +1152,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1186,7 +1189,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "Name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1196,7 +1199,9 @@ def __init__(self, *, name: str, **kwargs): class OperationsMonitoringProperties(_serialization.Model): - """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. + """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are + Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, + Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :ivar events: Dictionary of :code:``. :vartype events: dict[str, str or @@ -1207,7 +1212,9 @@ class OperationsMonitoringProperties(_serialization.Model): "events": {"key": "events", "type": "{str}"}, } - def __init__(self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs): + def __init__( + self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs: Any + ) -> None: """ :keyword events: Dictionary of :code:``. :paramtype events: dict[str, str or @@ -1242,7 +1249,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1296,8 +1303,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1326,7 +1333,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1353,8 +1362,8 @@ def __init__( service_bus_queues: Optional[List["_models.RoutingServiceBusQueueEndpointProperties"]] = None, service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1411,8 +1420,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the event hub endpoint. Required. :paramtype connection_string: str @@ -1434,7 +1443,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -1464,8 +1474,8 @@ def __init__( endpoints: Optional["_models.RoutingEndpoints"] = None, routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -1526,8 +1536,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus queue endpoint. Required. :paramtype connection_string: str @@ -1587,8 +1597,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus topic endpoint. Required. :paramtype connection_string: str @@ -1650,8 +1660,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -1696,7 +1706,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -1741,8 +1753,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/__init__.py index 972b73cd63bb..176e993e6151 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/__init__.py @@ -9,7 +9,7 @@ from ._iot_hub_resource_operations import IotHubResourceOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py index b23a7e69bdf3..2ec92b49289d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +112,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +126,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,7 +141,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +150,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +165,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,7 +195,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +209,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +226,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +240,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,7 +257,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -266,7 +272,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -288,7 +294,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -304,7 +310,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -326,7 +332,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -342,7 +348,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -364,7 +370,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -380,7 +386,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -397,7 +403,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -411,7 +417,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -428,7 +434,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -443,7 +449,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -460,7 +466,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -474,7 +480,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -489,8 +495,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -501,7 +507,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -520,7 +526,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -534,7 +540,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -551,7 +557,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -566,7 +572,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -583,8 +589,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -598,7 +604,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -617,8 +623,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -632,7 +638,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -679,14 +685,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -698,9 +709,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -718,7 +729,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -727,15 +740,20 @@ def _create_or_update_initial( iot_hub_description: Union[_models.IotHubDescription, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -758,9 +776,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -778,11 +796,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -886,8 +906,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -908,14 +928,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -935,7 +955,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -947,21 +967,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -973,9 +1000,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1001,12 +1028,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1032,13 +1061,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1056,7 +1085,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1068,9 +1097,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1086,10 +1117,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1103,16 +1139,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1120,13 +1163,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1140,7 +1183,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1159,10 +1202,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1177,16 +1225,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1194,13 +1249,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1214,7 +1269,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1231,14 +1288,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2017_01_19.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1250,9 +1312,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1270,7 +1332,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1294,10 +1358,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1313,16 +1382,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1330,13 +1406,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1350,7 +1426,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1376,10 +1454,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1396,16 +1479,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1413,13 +1503,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1433,7 +1523,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1457,14 +1549,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1478,9 +1575,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1498,7 +1595,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1522,14 +1621,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1543,9 +1647,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1563,7 +1667,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1587,14 +1693,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1608,9 +1719,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1624,7 +1735,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -1646,10 +1759,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1665,16 +1783,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1682,13 +1807,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1702,7 +1827,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -1723,14 +1850,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1743,9 +1875,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1763,7 +1895,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1787,10 +1921,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1806,16 +1945,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1823,13 +1969,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1843,7 +1989,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload def check_name_availability( @@ -1894,7 +2042,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2017_01_19.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1904,15 +2052,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1933,9 +2086,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1953,7 +2106,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -1979,10 +2134,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1998,16 +2158,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2015,13 +2182,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2035,7 +2202,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2058,14 +2227,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2078,9 +2252,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2098,7 +2272,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2189,7 +2365,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2200,15 +2376,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2231,9 +2412,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2251,7 +2432,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -2342,7 +2525,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2353,15 +2536,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-01-19"] = kwargs.pop("api_version", _params.pop("api-version", "2017-01-19")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2384,9 +2572,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2404,4 +2592,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py index 2947099a69ae..e38ae7135670 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-07-01") # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", "2017-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py index 53e686df05f1..141efcc6c9cd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import CertificatesOperations, IotHubResourceOperations, Operations @@ -54,7 +54,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -84,15 +84,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json index 378c3f3428bb..0d92a99269f1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -101,4 +109,4 @@ "iot_hub_resource": "IotHubResourceOperations", "certificates": "CertificatesOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py index 20d6b03ad869..584edefb0edc 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-07-01") # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", "2017-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py index ae7f15087c1d..52880c51c521 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import CertificatesOperations, IotHubResourceOperations, Operations @@ -55,7 +55,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -92,5 +92,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py index 2b2483f833aa..1b5dfbe28acd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._certificates_operations import CertificatesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py index 036dd72277c3..468e9556cb96 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2017_07_01.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2017_07_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py index d80a2a66e6a3..18bcd77ed131 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -51,6 +53,10 @@ build_list_keys_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,14 +95,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -108,9 +119,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -128,7 +139,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -138,15 +151,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -170,9 +188,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -190,11 +208,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -309,8 +329,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -335,14 +355,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -363,7 +383,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -375,21 +395,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -401,9 +428,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -429,12 +456,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -461,13 +490,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -485,7 +514,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -497,9 +526,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -516,10 +547,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -533,16 +569,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -550,13 +593,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -570,7 +613,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -591,10 +634,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -609,16 +657,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -626,13 +681,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -646,7 +701,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -665,14 +722,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -684,9 +746,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -704,7 +766,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -728,10 +792,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -747,16 +816,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -764,13 +840,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -784,7 +860,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -810,10 +888,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -830,16 +913,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -847,13 +937,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -867,7 +957,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -891,14 +983,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -912,9 +1009,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -932,7 +1029,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -956,14 +1055,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -977,9 +1081,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -997,7 +1101,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1021,14 +1127,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1042,9 +1153,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1058,7 +1169,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1083,10 +1196,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1102,16 +1220,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1119,13 +1244,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1139,7 +1264,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1162,14 +1289,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1182,9 +1314,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1202,7 +1334,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1226,10 +1360,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1245,16 +1384,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1262,13 +1408,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1282,7 +1428,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload async def check_name_availability( @@ -1333,7 +1481,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2017_07_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1343,15 +1491,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1372,9 +1525,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1392,7 +1545,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -1418,10 +1573,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1437,16 +1597,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1454,13 +1621,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1474,7 +1641,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -1497,14 +1666,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -1517,9 +1691,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1537,7 +1711,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -1628,7 +1804,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1639,15 +1815,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1670,9 +1851,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1690,7 +1871,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -1781,7 +1964,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1792,15 +1975,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1823,9 +2011,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1843,4 +2031,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py index 35da389e046e..10599c08f61a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/__init__.py index 01c5f1df9068..072440961f19 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/__init__.py @@ -66,7 +66,7 @@ from ._iot_hub_client_enums import OperationMonitoringLevel from ._iot_hub_client_enums import RoutingSource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py index e9c93415c67f..15965b3e1fe9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -29,7 +29,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -71,7 +71,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2017_07_01.models.CertificateProperties @@ -95,7 +95,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription] @@ -141,7 +141,7 @@ class CertificateProperties(_serialization.Model): "updated": {"key": "updated", "type": "rfc-1123"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -153,7 +153,8 @@ def __init__(self, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -194,7 +195,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "verification_code": {"key": "verificationCode", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -218,7 +219,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -261,7 +262,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -306,8 +307,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -355,7 +356,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "Details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -387,8 +388,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The tags. :paramtype tags: dict[str, str] @@ -423,7 +424,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List[str]] = None, **kwargs): + def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Event Hub-compatible consumer group names. :paramtype value: list[str] @@ -468,8 +469,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -509,7 +510,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "ExcludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -523,7 +524,8 @@ def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwar class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -562,8 +564,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source: The source to which the routing rule is to be applied to. For example, DeviceMessages. Required. Known values are: "DeviceMessages", "TwinChangeEvents", @@ -618,8 +620,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -660,7 +662,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "OutputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -702,7 +704,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -745,7 +747,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -824,8 +826,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -872,7 +874,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] @@ -906,7 +908,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1006,8 +1008,8 @@ def __init__( comments: Optional[str] = None, operations_monitoring_properties: Optional["_models.OperationsMonitoringProperties"] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1091,7 +1093,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "MaxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1119,7 +1121,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubQuotaMetricInfo] @@ -1156,7 +1158,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: Information about the SKU of the IoT hub. Required. :paramtype sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo @@ -1189,7 +1191,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuDescription] @@ -1227,7 +1229,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: int, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: int, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", and "S3". :paramtype name: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubSku @@ -1268,7 +1270,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1333,7 +1337,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1366,7 +1370,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2017_07_01.models.JobResponse] @@ -1407,8 +1411,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1447,7 +1451,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2017_07_01.models.OperationDisplay @@ -1482,7 +1486,7 @@ class OperationDisplay(_serialization.Model): "operation": {"key": "operation", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1507,7 +1511,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "Name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1517,7 +1521,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1537,7 +1542,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1545,7 +1550,9 @@ def __init__(self, **kwargs): class OperationsMonitoringProperties(_serialization.Model): - """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. + """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are + Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, + Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :ivar events: Dictionary of :code:``. :vartype events: dict[str, str or @@ -1556,7 +1563,9 @@ class OperationsMonitoringProperties(_serialization.Model): "events": {"key": "events", "type": "{str}"}, } - def __init__(self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs): + def __init__( + self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs: Any + ) -> None: """ :keyword events: Dictionary of :code:``. :paramtype events: dict[str, str or @@ -1591,7 +1600,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1645,8 +1654,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1675,7 +1684,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1708,8 +1719,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1771,8 +1782,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the event hub endpoint. Required. :paramtype connection_string: str @@ -1794,7 +1805,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -1824,8 +1836,8 @@ def __init__( endpoints: Optional["_models.RoutingEndpoints"] = None, routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -1886,8 +1898,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus queue endpoint. Required. :paramtype connection_string: str @@ -1947,8 +1959,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus topic endpoint. Required. :paramtype connection_string: str @@ -2035,8 +2047,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the storage account. Required. :paramtype connection_string: str @@ -2117,8 +2129,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -2163,7 +2175,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -2208,8 +2222,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py index 2b2483f833aa..1b5dfbe28acd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/__init__.py @@ -11,7 +11,7 @@ from ._certificates_operations import CertificatesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py index 1b3302d58064..2eac2702b3f1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2017_07_01.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2017_07_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py index c338275aa177..18ff057414a4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +114,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +128,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +143,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +152,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,7 +167,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +180,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,7 +197,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +211,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,7 +228,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +242,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -253,7 +259,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -268,7 +274,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,7 +296,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -306,7 +312,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -328,7 +334,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -344,7 +350,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -366,7 +372,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -382,7 +388,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -399,7 +405,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -413,7 +419,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -430,7 +436,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -445,7 +451,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -462,7 +468,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -476,7 +482,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -491,8 +497,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -503,7 +509,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -522,7 +528,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -536,7 +542,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -553,7 +559,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -568,7 +574,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -585,8 +591,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -600,7 +606,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -619,8 +625,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -634,7 +640,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -681,14 +687,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -700,9 +711,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -720,7 +731,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -730,15 +743,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -762,9 +780,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -782,11 +800,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -899,8 +919,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -924,14 +944,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -952,7 +972,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -964,21 +984,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -990,9 +1017,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1018,12 +1045,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1049,13 +1078,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1073,7 +1102,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1085,9 +1114,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1103,10 +1134,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1120,16 +1156,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1137,13 +1180,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1157,7 +1200,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1175,10 +1218,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1193,16 +1241,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1210,13 +1265,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1230,7 +1285,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1247,14 +1304,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2017_07_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1266,9 +1328,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1286,7 +1348,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1310,10 +1374,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1329,16 +1398,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1346,13 +1422,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1366,7 +1442,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1392,10 +1470,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1412,16 +1495,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1429,13 +1519,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1449,7 +1539,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1473,14 +1565,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1494,9 +1591,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1514,7 +1611,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1538,14 +1637,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1559,9 +1663,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1579,7 +1683,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1603,14 +1709,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1624,9 +1735,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1640,7 +1751,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -1662,10 +1775,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1681,16 +1799,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1698,13 +1823,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1718,7 +1843,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -1739,14 +1866,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1759,9 +1891,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1779,7 +1911,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1803,10 +1937,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1822,16 +1961,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1839,13 +1985,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1859,7 +2005,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload def check_name_availability( @@ -1910,7 +2058,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2017_07_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1920,15 +2068,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1949,9 +2102,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1969,7 +2122,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -1995,10 +2150,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2014,16 +2174,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2031,13 +2198,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2051,7 +2218,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2074,14 +2243,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2094,9 +2268,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2114,7 +2288,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2205,7 +2381,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2216,15 +2392,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2247,9 +2428,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2267,7 +2448,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -2358,7 +2541,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2369,15 +2552,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2400,9 +2588,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2420,4 +2608,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py index dccf836e7004..24758f83713f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2017-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py index 239ccd525137..c70e009c1afa 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-01-22") # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", "2018-01-22") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py index 268e8ee0eb2b..ae24cd0331e2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import CertificatesOperations, IotHubResourceOperations, Operations @@ -54,7 +54,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -84,15 +84,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json index 8b3efc0dcd35..08d836bb33cb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -101,4 +109,4 @@ "iot_hub_resource": "IotHubResourceOperations", "certificates": "CertificatesOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py index 882a8161e308..48dd29af1cd4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-01-22") # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", "2018-01-22") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py index 885f9db7bbc9..8c980a2278a2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import CertificatesOperations, IotHubResourceOperations, Operations @@ -55,7 +55,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -92,5 +92,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py index 2b2483f833aa..1b5dfbe28acd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._certificates_operations import CertificatesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py index 5ac3bd2b2cf8..4240f5981d00 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2018_01_22.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2018_01_22.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py index dc7a05ab0fcc..60e4c2406c41 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -52,6 +54,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,14 +96,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -109,9 +120,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,7 +140,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -139,15 +152,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -171,9 +189,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -191,11 +209,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -310,8 +330,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -336,14 +356,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -364,7 +384,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -376,22 +396,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -414,9 +441,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -433,7 +460,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -524,7 +553,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2018_01_22.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -546,14 +575,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -573,7 +602,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -585,21 +614,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -611,9 +647,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -639,12 +675,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -671,13 +709,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -695,7 +733,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -707,9 +745,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -726,10 +766,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -743,16 +788,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -760,13 +812,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -780,7 +832,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -801,10 +853,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -819,16 +876,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -836,13 +900,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -856,7 +920,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -875,14 +941,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -894,9 +965,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -914,7 +985,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -938,10 +1011,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -957,16 +1035,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -974,13 +1059,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -994,7 +1079,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1022,10 +1109,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1042,16 +1134,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1059,13 +1158,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1079,7 +1178,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1103,14 +1204,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1124,9 +1230,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1144,7 +1250,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -1168,14 +1276,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1189,9 +1302,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1209,7 +1322,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1233,14 +1348,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1254,9 +1374,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1270,7 +1390,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1295,10 +1417,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1314,16 +1441,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1331,13 +1465,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1351,7 +1485,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1374,14 +1510,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1394,9 +1535,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1414,7 +1555,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1438,10 +1581,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1457,16 +1605,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1474,13 +1629,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1494,7 +1649,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload async def check_name_availability( @@ -1545,7 +1702,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2018_01_22.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1555,15 +1712,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1584,9 +1746,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1604,7 +1766,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -1630,10 +1794,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1649,16 +1818,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1666,13 +1842,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1686,7 +1862,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -1709,14 +1887,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -1729,9 +1912,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1749,7 +1932,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -1840,7 +2025,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1851,15 +2036,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1882,9 +2072,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1902,7 +2092,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -1993,7 +2185,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2004,15 +2196,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2035,9 +2232,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2055,4 +2252,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py index eda95b8d8884..fbb25fd59bdb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/__init__.py index 678e384ef856..bd84445a69e9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/__init__.py @@ -67,7 +67,7 @@ from ._iot_hub_client_enums import OperationMonitoringLevel from ._iot_hub_client_enums import RoutingSource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py index 0747e4c2a15f..92f2b0b2eb5d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -29,7 +29,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -71,7 +71,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2018_01_22.models.CertificateProperties @@ -95,7 +95,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription] @@ -141,7 +141,7 @@ class CertificateProperties(_serialization.Model): "updated": {"key": "updated", "type": "rfc-1123"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -153,7 +153,8 @@ def __init__(self, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -194,7 +195,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "verification_code": {"key": "verificationCode", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -218,7 +219,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -261,7 +262,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -306,8 +307,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -355,7 +356,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -396,7 +397,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, str] @@ -429,7 +430,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo] @@ -474,8 +475,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -515,7 +516,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "excludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -529,7 +530,8 @@ def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwar class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -573,8 +575,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -633,8 +635,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -675,7 +677,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "outputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -717,7 +719,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -760,7 +762,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -828,8 +830,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -869,7 +871,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] @@ -903,7 +905,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1007,8 +1009,8 @@ def __init__( comments: Optional[str] = None, operations_monitoring_properties: Optional["_models.OperationsMonitoringProperties"] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1093,7 +1095,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1121,7 +1123,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubQuotaMetricInfo] @@ -1158,7 +1160,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo @@ -1191,7 +1193,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuDescription] @@ -1228,7 +1230,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", and "S3". :paramtype name: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubSku @@ -1269,7 +1271,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1334,7 +1338,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1367,7 +1371,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2018_01_22.models.JobResponse] @@ -1408,8 +1412,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1448,7 +1452,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2018_01_22.models.OperationDisplay @@ -1483,7 +1487,7 @@ class OperationDisplay(_serialization.Model): "operation": {"key": "operation", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1508,7 +1512,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1518,7 +1522,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1538,7 +1543,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1546,7 +1551,9 @@ def __init__(self, **kwargs): class OperationsMonitoringProperties(_serialization.Model): - """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. + """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are + Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, + Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :ivar events: Dictionary of :code:``. :vartype events: dict[str, str or @@ -1557,7 +1564,9 @@ class OperationsMonitoringProperties(_serialization.Model): "events": {"key": "events", "type": "{str}"}, } - def __init__(self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs): + def __init__( + self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs: Any + ) -> None: """ :keyword events: Dictionary of :code:``. :paramtype events: dict[str, str or @@ -1592,7 +1601,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1646,8 +1655,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1676,7 +1685,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1709,8 +1720,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1772,8 +1783,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the event hub endpoint. Required. :paramtype connection_string: str @@ -1795,7 +1806,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -1825,8 +1837,8 @@ def __init__( endpoints: Optional["_models.RoutingEndpoints"] = None, routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -1887,8 +1899,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus queue endpoint. Required. :paramtype connection_string: str @@ -1948,8 +1960,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus topic endpoint. Required. :paramtype connection_string: str @@ -2036,8 +2048,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the storage account. Required. :paramtype connection_string: str @@ -2118,8 +2130,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -2164,7 +2176,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -2209,8 +2223,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -2230,7 +2244,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -2240,7 +2255,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py index 2b2483f833aa..1b5dfbe28acd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/__init__.py @@ -11,7 +11,7 @@ from ._certificates_operations import CertificatesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py index cb0042274dce..2e947148d109 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2018_01_22.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2018_01_22.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py index 83474e2a8047..828daeb3b591 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,7 +368,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +384,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -400,7 +406,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +422,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -433,7 +439,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -447,7 +453,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -464,7 +470,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -479,7 +485,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -496,7 +502,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +516,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -525,8 +531,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -537,7 +543,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -556,7 +562,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -570,7 +576,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -587,7 +593,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -602,7 +608,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -619,8 +625,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -634,7 +640,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -653,8 +659,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -668,7 +674,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -715,14 +721,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -734,9 +745,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -754,7 +765,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -764,15 +777,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -796,9 +814,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -816,11 +834,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -933,8 +953,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -958,14 +978,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -986,7 +1006,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -998,22 +1018,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1036,9 +1063,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1055,7 +1082,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1144,7 +1173,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2018_01_22.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1165,14 +1194,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1192,7 +1221,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1204,21 +1233,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1230,9 +1266,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1258,12 +1294,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1289,13 +1327,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1313,7 +1351,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1325,9 +1363,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1343,10 +1383,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1360,16 +1405,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1377,13 +1429,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1397,7 +1449,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1415,10 +1467,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1433,16 +1490,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1450,13 +1514,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1470,7 +1534,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1487,14 +1553,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2018_01_22.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1506,9 +1577,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1526,7 +1597,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1550,10 +1623,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1569,16 +1647,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1586,13 +1671,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1606,7 +1691,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1634,10 +1721,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1654,16 +1746,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1671,13 +1770,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1691,7 +1790,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1715,14 +1816,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1736,9 +1842,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1756,7 +1862,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1780,14 +1888,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1801,9 +1914,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1821,7 +1934,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1845,14 +1960,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1866,9 +1986,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1882,7 +2002,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -1904,10 +2026,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1923,16 +2050,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1940,13 +2074,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1960,7 +2094,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -1981,14 +2117,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2001,9 +2142,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2021,7 +2162,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2045,10 +2188,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2064,16 +2212,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2081,13 +2236,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2101,7 +2256,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @overload def check_name_availability( @@ -2152,7 +2309,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2018_01_22.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2162,15 +2319,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2191,9 +2353,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2211,7 +2373,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @distributed_trace def list_keys( @@ -2237,10 +2401,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2256,16 +2425,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2273,13 +2449,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2293,7 +2469,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2316,14 +2494,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2336,9 +2519,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2356,7 +2539,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2447,7 +2632,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2458,15 +2643,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2489,9 +2679,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2509,7 +2699,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -2600,7 +2792,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2611,15 +2803,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2642,9 +2839,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2662,4 +2859,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py index cd5750cd03c3..6382878d51ca 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-01-22"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-22")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py index 1514d2e1159e..b45f2e6a7f39 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-04-01") # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", "2018-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py index e22396a3c956..f2fca3de7611 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import CertificatesOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations @@ -57,7 +57,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -90,15 +90,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json index 4a82cf4b544a..bf9a3441fd08 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -102,4 +110,4 @@ "resource_provider_common": "ResourceProviderCommonOperations", "certificates": "CertificatesOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py index c3520a092864..5ed4bc5e6cc4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-04-01") # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", "2018-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py index 937aca447b75..f7137aa3c8b0 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import CertificatesOperations, IotHubResourceOperations, Operations, ResourceProviderCommonOperations @@ -58,7 +58,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -98,5 +98,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py index 64c35ba588b5..8f4d9f75f01b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/__init__.py @@ -12,7 +12,7 @@ from ._certificates_operations import CertificatesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py index d8d313117e32..043e123beac8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2018_04_01.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2018_04_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py index a338b637ea03..25fe778f974f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +123,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +143,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +155,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +192,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +212,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +333,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -339,14 +359,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +387,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +399,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +444,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -436,7 +463,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -527,7 +556,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2018_04_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -549,14 +578,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -576,7 +605,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -588,21 +617,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -614,9 +650,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,12 +678,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -674,13 +712,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -698,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -710,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -729,10 +769,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -746,16 +791,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -763,13 +815,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -783,7 +835,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -804,10 +856,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -822,16 +879,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +903,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -859,7 +923,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -878,14 +944,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -897,9 +968,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -917,7 +988,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -941,10 +1014,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -960,16 +1038,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -977,13 +1062,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -997,7 +1082,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1025,10 +1112,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1045,16 +1137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1062,13 +1161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1106,14 +1207,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1127,9 +1233,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,7 +1253,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -1171,14 +1279,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1192,9 +1305,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1212,7 +1325,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1236,14 +1351,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1257,9 +1377,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1273,7 +1393,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1298,10 +1420,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1317,16 +1444,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1334,13 +1468,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1354,7 +1488,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1377,14 +1513,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1397,9 +1538,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1417,7 +1558,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1441,10 +1584,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1460,16 +1608,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1477,13 +1632,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1497,7 +1652,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1520,10 +1677,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1539,16 +1701,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1556,13 +1725,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1576,7 +1745,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1627,7 +1798,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2018_04_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1637,15 +1808,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1666,9 +1842,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1686,7 +1862,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1758,7 +1936,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1768,15 +1947,20 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1799,9 +1983,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1819,7 +2003,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1891,7 +2077,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1901,15 +2088,20 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1932,9 +2124,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1952,7 +2144,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -1978,10 +2172,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1997,16 +2196,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2014,13 +2220,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2034,7 +2240,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2057,14 +2265,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2077,9 +2290,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2097,7 +2310,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2188,7 +2403,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2199,15 +2414,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2230,9 +2450,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2250,7 +2470,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2341,7 +2563,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2352,15 +2574,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2383,9 +2610,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2403,4 +2630,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py index 9f2389ff551a..c9a3b52acc22 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py index a16230bf0ab5..850d22cc9986 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,19 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +88,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +108,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/__init__.py index 0c50a358af8e..2342c989af91 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/__init__.py @@ -87,7 +87,7 @@ from ._iot_hub_client_enums import RoutingSource from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py index 66d946d3c062..2d559720c36d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -35,7 +36,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -77,7 +78,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2018_04_01.models.CertificateProperties @@ -101,7 +102,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription] @@ -150,7 +151,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: The certificate content. :paramtype certificate: str @@ -166,7 +167,8 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -211,7 +213,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -236,7 +238,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -279,7 +281,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -324,8 +326,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -364,8 +366,8 @@ def __init__( *, endpoint_id: Optional[str] = None, health_status: Optional[Union[str, "_models.EndpointHealthStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -398,7 +400,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthData] @@ -437,7 +439,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -478,7 +480,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, str] @@ -511,7 +513,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo] @@ -556,8 +558,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -597,7 +599,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "excludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -611,7 +613,8 @@ def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwar class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -655,8 +658,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -715,8 +718,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -757,7 +760,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "outputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -799,7 +802,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -842,7 +845,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -910,8 +913,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -951,7 +954,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] @@ -985,7 +988,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1089,8 +1092,8 @@ def __init__( comments: Optional[str] = None, operations_monitoring_properties: Optional["_models.OperationsMonitoringProperties"] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1175,7 +1178,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1203,7 +1206,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubQuotaMetricInfo] @@ -1240,7 +1243,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo @@ -1273,7 +1276,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuDescription] @@ -1312,7 +1315,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1354,7 +1357,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1419,7 +1424,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1452,7 +1457,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.JobResponse] @@ -1473,7 +1478,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties @@ -1513,8 +1518,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1547,7 +1552,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -1579,7 +1584,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2018_04_01.models.OperationDisplay @@ -1614,7 +1619,7 @@ class OperationDisplay(_serialization.Model): "operation": {"key": "operation", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1639,7 +1644,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1649,7 +1654,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1669,7 +1675,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1677,7 +1683,9 @@ def __init__(self, **kwargs): class OperationsMonitoringProperties(_serialization.Model): - """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. + """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are + Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, + Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :ivar events: Dictionary of :code:``. :vartype events: dict[str, str or @@ -1688,7 +1696,9 @@ class OperationsMonitoringProperties(_serialization.Model): "events": {"key": "events", "type": "{str}"}, } - def __init__(self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs): + def __init__( + self, *, events: Optional[Dict[str, Union[str, "_models.OperationMonitoringLevel"]]] = None, **kwargs: Any + ) -> None: """ :keyword events: Dictionary of :code:``. :paramtype events: dict[str, str or @@ -1723,7 +1733,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1754,8 +1764,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -1784,7 +1794,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -1815,8 +1825,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition @@ -1874,8 +1884,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1904,7 +1914,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1937,8 +1949,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2000,8 +2012,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the event hub endpoint. Required. :paramtype connection_string: str @@ -2045,8 +2057,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2062,7 +2074,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2092,8 +2105,8 @@ def __init__( endpoints: Optional["_models.RoutingEndpoints"] = None, routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2154,8 +2167,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus queue endpoint. Required. :paramtype connection_string: str @@ -2215,8 +2228,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus topic endpoint. Required. :paramtype connection_string: str @@ -2303,8 +2316,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the storage account. Required. :paramtype connection_string: str @@ -2360,8 +2373,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -2388,8 +2405,8 @@ class RoutingTwinProperties(_serialization.Model): } def __init__( - self, *, desired_properties: Optional[JSON] = None, reported_properties: Optional[JSON] = None, **kwargs - ): + self, *, desired_properties: Optional[JSON] = None, reported_properties: Optional[JSON] = None, **kwargs: Any + ) -> None: """ :keyword desired_properties: Twin desired properties. :paramtype desired_properties: JSON @@ -2441,8 +2458,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -2487,7 +2504,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -2532,8 +2551,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -2553,7 +2572,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -2563,7 +2583,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2596,8 +2616,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", and "DeviceJobLifecycleEvents". @@ -2624,7 +2644,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2018_04_01.models.MatchedRoute] @@ -2662,8 +2682,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage @@ -2697,8 +2717,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2018_04_01.models.TestResultStatus @@ -2721,7 +2741,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -2766,8 +2788,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -2811,7 +2833,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py index 64c35ba588b5..8f4d9f75f01b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/__init__.py @@ -12,7 +12,7 @@ from ._certificates_operations import CertificatesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py index 8290efc651ad..e84b235474ff 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2018_04_01.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2018_04_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py index 0712139c6799..90671bd3fa37 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,7 +368,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +384,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -400,7 +406,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +422,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -433,7 +439,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -447,7 +453,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -464,7 +470,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -479,7 +485,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -496,7 +502,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +516,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -527,7 +533,7 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -541,7 +547,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -556,8 +562,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -568,7 +574,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -587,8 +593,8 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -602,7 +608,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -621,8 +627,8 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -636,7 +642,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -655,7 +661,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -669,7 +675,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -686,7 +692,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -701,7 +707,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -718,8 +724,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -733,7 +739,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -752,8 +758,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -767,7 +773,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -814,14 +820,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -833,9 +844,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -853,7 +864,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -863,15 +876,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -895,9 +913,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -915,11 +933,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1032,8 +1052,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -1057,14 +1077,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1085,7 +1105,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1097,22 +1117,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1135,9 +1162,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1154,7 +1181,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1243,7 +1272,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2018_04_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1264,14 +1293,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1291,7 +1320,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1303,21 +1332,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1329,9 +1365,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1357,12 +1393,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1388,13 +1426,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1412,7 +1450,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1424,9 +1462,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1442,10 +1482,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1459,16 +1504,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1476,13 +1528,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1496,7 +1548,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1514,10 +1566,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1532,16 +1589,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1549,13 +1613,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1569,7 +1633,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1586,14 +1652,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2018_04_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1605,9 +1676,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1625,7 +1696,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1649,10 +1722,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1668,16 +1746,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1685,13 +1770,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1705,7 +1790,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1733,10 +1820,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1753,16 +1845,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1770,13 +1869,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1790,7 +1889,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1814,14 +1915,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1835,9 +1941,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1855,7 +1961,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1879,14 +1987,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1900,9 +2013,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1920,7 +2033,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1944,14 +2059,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1965,9 +2085,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1981,7 +2101,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2003,10 +2125,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2022,16 +2149,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2039,13 +2173,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2059,7 +2193,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2080,14 +2216,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2100,9 +2241,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2120,7 +2261,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2144,10 +2287,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2163,16 +2311,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2180,13 +2335,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2200,7 +2355,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2222,10 +2379,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2241,16 +2403,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2258,13 +2427,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2278,7 +2447,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2329,7 +2500,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2018_04_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2339,15 +2510,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2368,9 +2544,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2388,7 +2564,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2460,7 +2638,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2470,15 +2649,20 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2501,9 +2685,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2521,7 +2705,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2593,7 +2779,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2603,15 +2790,20 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2634,9 +2826,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2654,7 +2846,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2680,10 +2874,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2699,16 +2898,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2716,13 +2922,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2736,7 +2942,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2759,14 +2967,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2779,9 +2992,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2799,7 +3012,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2890,7 +3105,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2901,15 +3116,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2932,9 +3152,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2952,7 +3172,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3043,7 +3265,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3054,15 +3276,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3085,9 +3312,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3105,4 +3332,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py index ae4ea0042988..502b6d2f4268 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py index 6efc7e46bf61..21b7902fe27e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +52,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +93,19 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2018-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-04-01")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +115,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +135,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py index 13d7b2f3b92e..1652a7a9b244 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-03-22") # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", "2019-03-22") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py index cdbf47476858..7c63d0f85f30 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -65,7 +65,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -99,15 +99,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json index b7007f1a01f5..66471dd94ff1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -103,4 +111,4 @@ "certificates": "CertificatesOperations", "iot_hub": "IotHubOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py index 94f8c4a5dc5f..02cbb7971fcf 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-03-22") # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", "2019-03-22") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py index 74ade549d742..76b7fa38c52d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -66,7 +66,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -107,5 +107,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py index 6d99efb7caff..80194cd2074a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._iot_hub_operations import IotHubOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py index a009bf62e36c..cb8589d0016a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2019_03_22.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2019_03_22.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py index baaa902fefc4..a30a209d59a9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,20 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +100,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +116,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +220,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2019_03_22.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +240,12 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +265,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +277,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py index 2484153534a3..bc81b399733e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +123,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +143,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +155,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +192,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +212,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +333,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -339,14 +359,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +387,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +399,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +444,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -436,7 +463,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -527,7 +556,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2019_03_22.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -549,14 +578,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -576,7 +605,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -588,21 +617,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -614,9 +650,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,12 +678,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -674,13 +712,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -698,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -710,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -729,10 +769,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -746,16 +791,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -763,13 +815,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -783,7 +835,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -804,10 +856,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -822,16 +879,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +903,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -859,7 +923,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -878,14 +944,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -897,9 +968,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -917,7 +988,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -941,10 +1014,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -960,16 +1038,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -977,13 +1062,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -997,7 +1082,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1025,10 +1112,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1045,16 +1137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1062,13 +1161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1106,14 +1207,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1127,9 +1233,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,7 +1253,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -1171,14 +1279,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1192,9 +1305,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1212,7 +1325,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1236,14 +1351,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1257,9 +1377,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1273,7 +1393,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1298,10 +1420,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1317,16 +1444,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1334,13 +1468,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1354,7 +1488,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1377,14 +1513,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1397,9 +1538,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1417,7 +1558,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1441,10 +1584,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1460,16 +1608,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1477,13 +1632,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1497,7 +1652,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1520,10 +1677,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1539,16 +1701,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1556,13 +1725,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1576,7 +1745,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1627,7 +1798,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2019_03_22.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1637,15 +1808,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1666,9 +1842,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1686,7 +1862,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1758,7 +1936,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1768,15 +1947,20 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1799,9 +1983,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1819,7 +2003,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1891,7 +2077,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1901,15 +2088,20 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1932,9 +2124,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1952,7 +2144,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -1978,10 +2172,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1997,16 +2196,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2014,13 +2220,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2034,7 +2240,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2057,14 +2265,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2077,9 +2290,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2097,7 +2310,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2188,7 +2403,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2199,15 +2414,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2230,9 +2450,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2250,7 +2470,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2341,7 +2563,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2352,15 +2574,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2383,9 +2610,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2403,4 +2630,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py index 6b02054cdc9e..6ebcb5fbb83b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py index 5940e845f9fa..43e678425401 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,19 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +88,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +108,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/__init__.py index 29447a7dfd3d..6d878c937638 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/__init__.py @@ -89,7 +89,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py index b5f128f79f9d..d9ee18b34cb8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -35,7 +36,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -77,7 +78,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2019_03_22.models.CertificateProperties @@ -101,7 +102,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription] @@ -150,7 +151,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: The certificate content. :paramtype certificate: str @@ -166,7 +167,8 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -211,7 +213,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -236,7 +238,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -279,7 +281,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -324,8 +326,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -372,8 +374,8 @@ def __init__( *, endpoint_id: Optional[str] = None, health_status: Optional[Union[str, "_models.EndpointHealthStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -414,7 +416,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthData] @@ -453,7 +455,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -494,7 +496,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, str] @@ -527,7 +529,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo] @@ -572,8 +574,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -613,7 +615,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "excludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -643,7 +645,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -653,7 +655,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -697,8 +700,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -757,8 +760,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -799,7 +802,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "outputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -841,7 +844,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -884,7 +887,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -952,8 +955,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -993,7 +996,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] @@ -1025,8 +1028,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1065,7 +1068,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1162,8 +1165,8 @@ def __init__( cloud_to_device: Optional["_models.CloudToDeviceProperties"] = None, comments: Optional[str] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1242,7 +1245,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1270,7 +1273,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubQuotaMetricInfo] @@ -1307,7 +1310,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo @@ -1340,7 +1343,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuDescription] @@ -1379,7 +1382,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1421,7 +1424,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1486,7 +1491,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1519,7 +1524,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.JobResponse] @@ -1540,7 +1545,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties @@ -1580,8 +1585,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1614,7 +1619,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -1646,7 +1651,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2019_03_22.models.OperationDisplay @@ -1685,7 +1690,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1711,7 +1716,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1721,7 +1726,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1741,7 +1747,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1773,7 +1779,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1804,8 +1810,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -1834,7 +1840,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -1865,8 +1871,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition @@ -1924,8 +1930,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1954,7 +1960,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -1987,8 +1995,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2050,8 +2058,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the event hub endpoint. Required. :paramtype connection_string: str @@ -2095,8 +2103,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2112,7 +2120,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2142,8 +2151,8 @@ def __init__( endpoints: Optional["_models.RoutingEndpoints"] = None, routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2203,8 +2212,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus queue endpoint. Required. :paramtype connection_string: str @@ -2263,8 +2272,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus topic endpoint. Required. :paramtype connection_string: str @@ -2353,8 +2362,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the storage account. Required. :paramtype connection_string: str @@ -2412,8 +2421,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -2439,7 +2452,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -2491,8 +2504,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -2537,7 +2550,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -2582,8 +2597,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -2603,7 +2618,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -2613,7 +2629,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2646,8 +2662,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", and "DeviceJobLifecycleEvents". @@ -2674,7 +2690,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2019_03_22.models.MatchedRoute] @@ -2712,8 +2728,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage @@ -2747,8 +2763,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2019_03_22.models.TestResultStatus @@ -2771,7 +2787,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -2816,8 +2834,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -2861,7 +2879,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py index 6d99efb7caff..80194cd2074a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/__init__.py @@ -13,7 +13,7 @@ from ._iot_hub_operations import IotHubOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py index 128776b7b678..55d1860f89b2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2019_03_22.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2019_03_22.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py index f283af4b8280..45f6a5111fc3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,8 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +62,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +101,20 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +137,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +153,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +257,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2019_03_22.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +277,12 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +302,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +314,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py index c6c4b48b845d..1d9eeee9c66e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,7 +368,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +384,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -400,7 +406,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +422,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -433,7 +439,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -447,7 +453,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -464,7 +470,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -479,7 +485,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -496,7 +502,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +516,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -527,7 +533,7 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -541,7 +547,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -556,8 +562,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -568,7 +574,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -587,8 +593,8 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -602,7 +608,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -621,8 +627,8 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -636,7 +642,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -655,7 +661,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -669,7 +675,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -686,7 +692,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -701,7 +707,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -718,8 +724,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -733,7 +739,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -752,8 +758,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -767,7 +773,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -814,14 +820,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -833,9 +844,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -853,7 +864,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -863,15 +876,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -895,9 +913,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -915,11 +933,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1032,8 +1052,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -1057,14 +1077,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1085,7 +1105,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1097,22 +1117,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1135,9 +1162,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1154,7 +1181,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1243,7 +1272,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2019_03_22.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1264,14 +1293,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1291,7 +1320,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1303,21 +1332,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1329,9 +1365,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1357,12 +1393,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1388,13 +1426,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1412,7 +1450,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1424,9 +1462,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1442,10 +1482,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1459,16 +1504,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1476,13 +1528,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1496,7 +1548,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1514,10 +1566,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1532,16 +1589,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1549,13 +1613,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1569,7 +1633,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1586,14 +1652,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2019_03_22.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1605,9 +1676,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1625,7 +1696,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1649,10 +1722,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1668,16 +1746,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1685,13 +1770,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1705,7 +1790,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1733,10 +1820,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1753,16 +1845,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1770,13 +1869,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1790,7 +1889,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1814,14 +1915,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1835,9 +1941,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1855,7 +1961,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1879,14 +1987,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1900,9 +2013,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1920,7 +2033,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1944,14 +2059,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1965,9 +2085,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1981,7 +2101,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2003,10 +2125,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2022,16 +2149,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2039,13 +2173,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2059,7 +2193,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2080,14 +2216,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2100,9 +2241,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2120,7 +2261,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2144,10 +2287,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2163,16 +2311,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2180,13 +2335,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2200,7 +2355,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2222,10 +2379,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2241,16 +2403,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2258,13 +2427,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2278,7 +2447,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2329,7 +2500,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2019_03_22.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2339,15 +2510,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2368,9 +2544,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2388,7 +2564,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2460,7 +2638,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2470,15 +2649,20 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2501,9 +2685,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2521,7 +2705,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2593,7 +2779,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2603,15 +2790,20 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2634,9 +2826,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2654,7 +2846,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2680,10 +2874,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2699,16 +2898,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2716,13 +2922,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2736,7 +2942,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2759,14 +2967,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2779,9 +2992,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2799,7 +3012,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2890,7 +3105,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2901,15 +3116,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2932,9 +3152,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2952,7 +3172,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3043,7 +3265,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3054,15 +3276,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3085,9 +3312,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3105,4 +3332,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py index 5d83b6282026..444db13c4c82 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py index 82bc95b509df..0e3c5d471cf5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +52,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +93,19 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2019-03-22"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-22")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +115,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +135,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py index 3210ab329adf..2fac9d2365e6 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-07-01-preview") # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop("api_version", "2019-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py index 6d02c3866063..2c011620580f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -66,7 +66,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -100,15 +100,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json index 7a57abcec424..2f7e0bf58c06 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -103,4 +111,4 @@ "certificates": "CertificatesOperations", "iot_hub": "IotHubOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py index eb680cb8cd67..132f273707f0 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-07-01-preview") # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop("api_version", "2019-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py index c4740f271b45..443d57523922 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -67,7 +67,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -108,5 +108,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py index 6d99efb7caff..80194cd2074a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._iot_hub_operations import IotHubOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py index 0f2b1ff09b70..bae3f5f3f404 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,21 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +105,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +125,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +148,21 @@ async def get( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +175,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +195,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -268,8 +292,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -283,15 +307,22 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -316,9 +347,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -336,11 +367,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -363,14 +396,21 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -384,9 +424,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -400,7 +440,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -424,14 +466,21 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -445,9 +494,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -465,7 +514,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -563,8 +614,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -575,15 +626,22 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -608,9 +666,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -628,4 +686,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py index 1e3871c13a3b..305ce9d3f296 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,22 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +102,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +118,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -195,8 +210,8 @@ async def begin_manual_failover( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param failover_input: Region to failover to. Must be a azure DR pair. Is either a model type - or a IO type. Required. + :param failover_input: Region to failover to. Must be a azure DR pair. Is either a + FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2019_07_01_preview.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -216,12 +231,14 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -241,7 +258,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -253,6 +270,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py index 5ae07d83f3e4..b881b969f9f2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,21 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +125,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +145,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +157,22 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +196,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +216,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +337,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required @@ -340,14 +364,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -368,7 +394,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -380,22 +406,31 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -418,9 +453,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -437,7 +472,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -528,7 +565,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2019_07_01_preview.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -550,14 +587,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -577,7 +616,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -589,21 +628,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +663,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -643,12 +691,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -676,13 +726,15 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -700,7 +752,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -712,9 +764,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -731,10 +785,17 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -748,16 +809,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -765,13 +833,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -785,7 +853,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -806,10 +874,17 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -824,16 +899,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -841,13 +923,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -861,7 +943,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -880,14 +964,21 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -899,9 +990,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -919,7 +1010,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -943,10 +1036,17 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -962,16 +1062,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -979,13 +1086,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -999,7 +1106,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1027,10 +1136,17 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1047,16 +1163,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1064,13 +1187,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1084,7 +1207,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1108,14 +1233,21 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1129,9 +1261,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1149,7 +1281,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -1173,14 +1307,21 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1194,9 +1335,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1214,7 +1355,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1238,14 +1381,21 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1259,9 +1409,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1275,7 +1425,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1300,10 +1452,17 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1319,16 +1478,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1336,13 +1502,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1356,7 +1522,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1379,14 +1547,21 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1399,9 +1574,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1419,7 +1594,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1443,10 +1620,17 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1462,16 +1646,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1479,13 +1670,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1499,7 +1690,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1522,10 +1715,17 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1541,16 +1741,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1558,13 +1765,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1578,7 +1785,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1629,7 +1838,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1639,15 +1848,22 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1668,9 +1884,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1688,7 +1904,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1760,7 +1978,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1770,15 +1989,22 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1801,9 +2027,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1821,7 +2047,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1893,7 +2121,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1903,15 +2132,22 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1934,9 +2170,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1954,7 +2190,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -1980,10 +2218,17 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1999,16 +2244,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2016,13 +2268,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2036,7 +2288,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2059,14 +2313,21 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2079,9 +2340,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2099,7 +2360,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2191,7 +2454,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2202,15 +2465,22 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2233,9 +2503,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2253,7 +2523,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2345,7 +2617,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2356,15 +2628,22 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2387,9 +2666,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2407,4 +2686,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py index 6ee594ef433d..605f1f3290d7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,17 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py index 6dd380cb664f..ffa704e0c729 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,21 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +90,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +110,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py index f94e3e6d6866..5e4f10770868 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py @@ -91,7 +91,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py index 62019aca4861..48be276791f9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -35,7 +36,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -77,7 +78,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateProperties @@ -101,7 +102,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription] @@ -150,7 +151,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: The certificate content. :paramtype certificate: str @@ -166,7 +167,8 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -211,7 +213,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -236,7 +238,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -280,7 +282,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -326,8 +328,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -375,8 +377,8 @@ def __init__( *, endpoint_id: Optional[str] = None, health_status: Optional[Union[str, "_models.EndpointHealthStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -418,7 +420,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthData] @@ -454,7 +456,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -499,7 +501,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -540,7 +542,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, str] @@ -573,7 +575,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo] @@ -618,8 +620,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -659,7 +661,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "excludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -689,7 +691,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -699,7 +701,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -743,8 +746,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -803,8 +806,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -845,7 +848,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "outputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -887,7 +890,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -930,7 +933,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -998,8 +1001,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1039,7 +1042,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] @@ -1069,8 +1072,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Azure Geo Regions. :paramtype location: str @@ -1108,7 +1111,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1211,8 +1214,8 @@ def __init__( comments: Optional[str] = None, device_streams: Optional["_models.IotHubPropertiesDeviceStreams"] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1282,7 +1285,7 @@ class IotHubPropertiesDeviceStreams(_serialization.Model): "streaming_endpoints": {"key": "streamingEndpoints", "type": "[str]"}, } - def __init__(self, *, streaming_endpoints: Optional[List[str]] = None, **kwargs): + def __init__(self, *, streaming_endpoints: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword streaming_endpoints: List of Device Streams Endpoints. :paramtype streaming_endpoints: list[str] @@ -1316,7 +1319,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1344,7 +1347,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubQuotaMetricInfo] @@ -1381,7 +1384,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo @@ -1414,7 +1417,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuDescription] @@ -1453,7 +1456,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1495,7 +1498,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1560,7 +1565,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1593,7 +1598,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse] @@ -1614,7 +1619,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties @@ -1654,8 +1659,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1688,7 +1693,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -1720,7 +1725,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationDisplay @@ -1759,7 +1764,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1785,7 +1790,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1795,7 +1800,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1815,7 +1821,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1847,7 +1853,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1878,8 +1884,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -1908,7 +1914,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -1939,8 +1945,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition @@ -1998,8 +2004,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -2028,7 +2034,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2062,8 +2070,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2126,8 +2134,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the event hub endpoint. Required. :paramtype connection_string: str @@ -2171,8 +2179,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2188,7 +2196,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2223,8 +2232,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2290,8 +2299,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus queue endpoint. Required. :paramtype connection_string: str @@ -2350,8 +2359,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus topic endpoint. Required. :paramtype connection_string: str @@ -2440,8 +2449,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the storage account. Required. :paramtype connection_string: str @@ -2499,8 +2508,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -2526,7 +2539,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -2578,8 +2591,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -2624,7 +2637,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -2669,8 +2684,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -2690,7 +2705,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -2700,7 +2716,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2734,8 +2750,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", and @@ -2763,7 +2779,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.MatchedRoute] @@ -2801,8 +2817,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage @@ -2836,8 +2852,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.TestResultStatus @@ -2861,7 +2877,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -2906,8 +2924,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -2951,7 +2969,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py index 6d99efb7caff..80194cd2074a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py @@ -13,7 +13,7 @@ from ._iot_hub_operations import IotHubOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py index 5b92971d0e1e..fa109f101ad6 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +61,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +78,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +97,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +120,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +140,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +167,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +186,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +210,9 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +229,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +253,10 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +273,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +323,21 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +349,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +369,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +392,21 @@ def get( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +419,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +439,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -500,8 +536,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -515,15 +551,22 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -548,9 +591,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -568,11 +611,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -595,14 +640,21 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -616,9 +668,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -632,7 +684,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -656,14 +710,21 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -677,9 +738,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -697,7 +758,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -795,8 +858,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -807,15 +870,22 @@ def verify( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -840,9 +910,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -860,4 +930,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py index 3df6060c5eda..0e4eed50c054 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,10 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +64,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +103,22 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +141,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +157,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -232,8 +249,8 @@ def begin_manual_failover( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param failover_input: Region to failover to. Must be a azure DR pair. Is either a model type - or a IO type. Required. + :param failover_input: Region to failover to. Must be a azure DR pair. Is either a + FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2019_07_01_preview.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -253,12 +270,14 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -278,7 +297,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -290,6 +309,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py index 57abe74b2d1a..e0ef596a6e42 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,9 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +63,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +80,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +97,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +118,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +135,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +154,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +170,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +185,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +196,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +211,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +226,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +243,9 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +259,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +276,9 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +292,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +309,9 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +326,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +348,9 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +366,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,7 +388,9 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +406,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -400,7 +428,9 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +446,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -433,7 +463,9 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -447,7 +479,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -464,7 +496,9 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -479,7 +513,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -496,7 +530,9 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +546,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -527,7 +563,9 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -541,7 +579,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -556,8 +594,10 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -568,7 +608,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -587,8 +627,10 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -602,7 +644,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -621,8 +663,10 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -636,7 +680,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -655,7 +699,9 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -669,7 +715,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -686,7 +732,9 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -701,7 +749,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -718,8 +766,10 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -733,7 +783,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -752,8 +802,10 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -767,7 +819,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -814,14 +866,21 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -833,9 +892,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -853,7 +912,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -863,15 +924,22 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -895,9 +963,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -915,11 +983,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1034,8 +1104,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required @@ -1061,14 +1131,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1089,7 +1161,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1101,22 +1173,31 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1139,9 +1220,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1158,7 +1239,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1249,7 +1332,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2019_07_01_preview.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1271,14 +1354,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1298,7 +1383,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1310,21 +1395,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1336,9 +1430,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1364,12 +1458,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1396,13 +1492,15 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1420,7 +1518,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1432,9 +1530,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1451,10 +1551,17 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1468,16 +1575,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1485,13 +1599,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1505,7 +1619,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1524,10 +1638,17 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1542,16 +1663,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1559,13 +1687,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1579,7 +1707,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1596,14 +1726,21 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1615,9 +1752,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1635,7 +1772,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1659,10 +1798,17 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1678,16 +1824,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1695,13 +1848,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1715,7 +1868,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1743,10 +1898,17 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1763,16 +1925,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1780,13 +1949,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1800,7 +1969,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1824,14 +1995,21 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1845,9 +2023,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1865,7 +2043,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1889,14 +2069,21 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1910,9 +2097,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1930,7 +2117,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1954,14 +2143,21 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1975,9 +2171,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1991,7 +2187,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2013,10 +2211,17 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2032,16 +2237,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2049,13 +2261,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2069,7 +2281,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2090,14 +2304,21 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2110,9 +2331,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2130,7 +2351,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2154,10 +2377,17 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2173,16 +2403,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2190,13 +2427,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2210,7 +2447,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2233,10 +2472,17 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2252,16 +2498,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2269,13 +2522,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2289,7 +2542,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2340,7 +2595,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2350,15 +2605,22 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2379,9 +2641,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2399,7 +2661,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2471,7 +2735,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2481,15 +2746,22 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2512,9 +2784,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2532,7 +2804,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2604,7 +2878,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2614,15 +2889,22 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2645,9 +2927,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2665,7 +2947,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2691,10 +2975,17 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2710,16 +3001,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2727,13 +3025,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2747,7 +3045,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2770,14 +3070,21 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2790,9 +3097,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2810,7 +3117,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2902,7 +3211,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2913,15 +3222,22 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2944,9 +3260,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2964,7 +3280,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3056,7 +3374,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3067,15 +3385,22 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3098,9 +3423,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3118,4 +3443,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py index 9970e19bcbcd..22a936ef4ddc 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +93,17 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +116,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +140,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +160,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py index 207173c42dbd..de19da3c0b61 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,9 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +54,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +95,21 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2019-07-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2019-07-01-preview") + ) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +119,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +139,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py index b0c11fd12328..30b6bfd41547 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-11-04") # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", "2019-11-04") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py index 7edce1e790d0..6f614f370ca2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -65,7 +65,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -99,15 +99,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json index ed3f7a9ecc93..74f2b9621d28 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -103,4 +111,4 @@ "certificates": "CertificatesOperations", "iot_hub": "IotHubOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py index 12754351a5d1..48384170c1d7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-11-04") # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", "2019-11-04") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py index 406ba0e03306..f759d164a73b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -66,7 +66,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -107,5 +107,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py index 6d99efb7caff..80194cd2074a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._iot_hub_operations import IotHubOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py index b1b68db41c9e..7bbe30348aca 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2019_11_04.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2019_11_04.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py index cc2d3f3e1ca3..4b2db85392a3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,20 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +100,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +116,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +220,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2019_11_04.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +240,12 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +265,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +277,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py index 934a6f6b77f9..7c26a4b69a59 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +123,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +143,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +155,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +192,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +212,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +333,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -339,14 +359,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +387,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +399,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +444,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -436,7 +463,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -527,7 +556,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2019_11_04.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -549,14 +578,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -576,7 +605,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -588,21 +617,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -614,9 +650,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,12 +678,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -674,13 +712,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -698,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -710,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -729,10 +769,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -746,16 +791,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -763,13 +815,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -783,7 +835,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -804,10 +856,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -822,16 +879,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +903,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -859,7 +923,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -878,14 +944,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -897,9 +968,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -917,7 +988,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -941,10 +1014,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -960,16 +1038,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -977,13 +1062,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -997,7 +1082,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1025,10 +1112,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1045,16 +1137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1062,13 +1161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1106,14 +1207,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1127,9 +1233,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,7 +1253,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -1171,14 +1279,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1192,9 +1305,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1212,7 +1325,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1236,14 +1351,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1257,9 +1377,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1273,7 +1393,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1298,10 +1420,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1317,16 +1444,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1334,13 +1468,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1354,7 +1488,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1377,14 +1513,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1397,9 +1538,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1417,7 +1558,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1441,10 +1584,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1460,16 +1608,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1477,13 +1632,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1497,7 +1652,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1520,10 +1677,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1539,16 +1701,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1556,13 +1725,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1576,7 +1745,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1627,7 +1798,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2019_11_04.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1637,15 +1808,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1666,9 +1842,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1686,7 +1862,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1758,7 +1936,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1768,15 +1947,20 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1799,9 +1983,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1819,7 +2003,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1891,7 +2077,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1901,15 +2088,20 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1932,9 +2124,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1952,7 +2144,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -1978,10 +2172,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1997,16 +2196,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2014,13 +2220,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2034,7 +2240,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2057,14 +2265,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2077,9 +2290,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2097,7 +2310,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2188,7 +2403,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2199,15 +2414,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2230,9 +2450,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2250,7 +2470,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2341,7 +2563,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2352,15 +2574,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2383,9 +2610,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2403,4 +2630,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py index 5258847a950a..1b0368c10204 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py index e767422d0954..7de138964260 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,19 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +88,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +108,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/__init__.py index b446f736ac58..0f70879a69ba 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/__init__.py @@ -90,7 +90,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py index 28412710b900..0c47213e5270 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -35,7 +36,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -77,7 +78,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2019_11_04.models.CertificateProperties @@ -101,7 +102,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription] @@ -150,7 +151,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: The certificate content. :paramtype certificate: str @@ -166,7 +167,8 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -211,7 +213,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -236,7 +238,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -279,7 +281,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -324,8 +326,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -372,8 +374,8 @@ def __init__( *, endpoint_id: Optional[str] = None, health_status: Optional[Union[str, "_models.EndpointHealthStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -414,7 +416,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthData] @@ -450,7 +452,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -495,7 +497,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -536,7 +538,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, str] @@ -569,7 +571,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo] @@ -614,8 +616,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -655,7 +657,7 @@ class ExportDevicesRequest(_serialization.Model): "exclude_keys": {"key": "excludeKeys", "type": "bool"}, } - def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs): + def __init__(self, *, export_blob_container_uri: str, exclude_keys: bool, **kwargs: Any) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -685,7 +687,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -695,7 +697,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -739,8 +742,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -799,8 +802,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -841,7 +844,7 @@ class ImportDevicesRequest(_serialization.Model): "output_blob_container_uri": {"key": "outputBlobContainerUri", "type": "str"}, } - def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs): + def __init__(self, *, input_blob_container_uri: str, output_blob_container_uri: str, **kwargs: Any) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -883,7 +886,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -926,7 +929,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -994,8 +997,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1035,7 +1038,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] @@ -1067,8 +1070,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1107,7 +1110,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1204,8 +1207,8 @@ def __init__( cloud_to_device: Optional["_models.CloudToDeviceProperties"] = None, comments: Optional[str] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1284,7 +1287,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1312,7 +1315,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubQuotaMetricInfo] @@ -1349,7 +1352,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo @@ -1382,7 +1385,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuDescription] @@ -1421,7 +1424,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1463,7 +1466,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1528,7 +1533,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1561,7 +1566,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.JobResponse] @@ -1582,7 +1587,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties @@ -1622,8 +1627,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1656,7 +1661,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -1688,7 +1693,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2019_11_04.models.OperationDisplay @@ -1727,7 +1732,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1753,7 +1758,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1763,7 +1768,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1783,7 +1789,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1815,7 +1821,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -1846,8 +1852,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -1876,7 +1882,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -1907,8 +1913,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition @@ -1966,8 +1972,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1996,7 +2002,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2029,8 +2037,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2092,8 +2100,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the event hub endpoint. Required. :paramtype connection_string: str @@ -2137,8 +2145,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2154,7 +2162,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2189,8 +2198,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2255,8 +2264,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus queue endpoint. Required. :paramtype connection_string: str @@ -2315,8 +2324,8 @@ def __init__( name: str, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the service bus topic endpoint. Required. :paramtype connection_string: str @@ -2405,8 +2414,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_string: The connection string of the storage account. Required. :paramtype connection_string: str @@ -2464,8 +2473,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -2491,7 +2504,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -2543,8 +2556,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -2589,7 +2602,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -2634,8 +2649,8 @@ def __init__( connection_string: str, container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -2655,7 +2670,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -2665,7 +2681,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2698,8 +2714,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", and "DeviceJobLifecycleEvents". @@ -2726,7 +2742,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2019_11_04.models.MatchedRoute] @@ -2764,8 +2780,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage @@ -2799,8 +2815,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2019_11_04.models.TestResultStatus @@ -2823,7 +2839,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -2868,8 +2886,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -2913,7 +2931,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py index 6d99efb7caff..80194cd2074a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/__init__.py @@ -13,7 +13,7 @@ from ._iot_hub_operations import IotHubOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py index 14e12d9df01f..7351bd4d8490 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2019_11_04.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2019_11_04.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py index bd533fe6b90b..05db949ce709 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,8 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +62,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +101,20 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +137,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +153,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +257,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2019_11_04.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +277,12 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +302,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +314,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py index bb3cef3a45d8..4772cca2248c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,7 +368,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +384,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -400,7 +406,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +422,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -433,7 +439,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -447,7 +453,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -464,7 +470,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -479,7 +485,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -496,7 +502,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +516,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -527,7 +533,7 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -541,7 +547,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -556,8 +562,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -568,7 +574,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -587,8 +593,8 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -602,7 +608,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -621,8 +627,8 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -636,7 +642,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -655,7 +661,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -669,7 +675,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -686,7 +692,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -701,7 +707,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -718,8 +724,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -733,7 +739,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -752,8 +758,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -767,7 +773,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -814,14 +820,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -833,9 +844,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -853,7 +864,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -863,15 +876,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -895,9 +913,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -915,11 +933,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1032,8 +1052,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -1057,14 +1077,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1085,7 +1105,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1097,22 +1117,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1135,9 +1162,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1154,7 +1181,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1243,7 +1272,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2019_11_04.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1264,14 +1293,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1291,7 +1320,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1303,21 +1332,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1329,9 +1365,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1357,12 +1393,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1388,13 +1426,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1412,7 +1450,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1424,9 +1462,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1442,10 +1482,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1459,16 +1504,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1476,13 +1528,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1496,7 +1548,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1514,10 +1566,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1532,16 +1589,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1549,13 +1613,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1569,7 +1633,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1586,14 +1652,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2019_11_04.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1605,9 +1676,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1625,7 +1696,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1649,10 +1722,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1668,16 +1746,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1685,13 +1770,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1705,7 +1790,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1733,10 +1820,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1753,16 +1845,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1770,13 +1869,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1790,7 +1889,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1814,14 +1915,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1835,9 +1941,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1855,7 +1961,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1879,14 +1987,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1900,9 +2013,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1920,7 +2033,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1944,14 +2059,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1965,9 +2085,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1981,7 +2101,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2003,10 +2125,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2022,16 +2149,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2039,13 +2173,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2059,7 +2193,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2080,14 +2216,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2100,9 +2241,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2120,7 +2261,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2144,10 +2287,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2163,16 +2311,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2180,13 +2335,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2200,7 +2355,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2222,10 +2379,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2241,16 +2403,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2258,13 +2427,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2278,7 +2447,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2329,7 +2500,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2019_11_04.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2339,15 +2510,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2368,9 +2544,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2388,7 +2564,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2460,7 +2638,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2470,15 +2649,20 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2501,9 +2685,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2521,7 +2705,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2593,7 +2779,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2603,15 +2790,20 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2634,9 +2826,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2654,7 +2846,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2680,10 +2874,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2699,16 +2898,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2716,13 +2922,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2736,7 +2942,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2759,14 +2967,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2779,9 +2992,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2799,7 +3012,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2890,7 +3105,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2901,15 +3116,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2932,9 +3152,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2952,7 +3172,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3043,7 +3265,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3054,15 +3276,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3085,9 +3312,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3105,4 +3332,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py index 6688c05a2677..9b7d1974bf09 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py index d5d6c0a37915..4d6c7d6d18dd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +52,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +93,19 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2019-11-04"] = kwargs.pop("api_version", _params.pop("api-version", "2019-11-04")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +115,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +135,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py index c2db94f3e1e6..28592c37893e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-03-01") # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", "2020-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py index f36dfb943cc4..d08ba453e84e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -73,7 +73,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -113,15 +113,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json index ffc7d283c8e9..e184a679f71d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -105,4 +113,4 @@ "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py index 6e3735f3b830..308f9e521dc1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-03-01") # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", "2020-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py index f08b210a42af..6a8cf1c15fdc 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -74,7 +74,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -121,5 +121,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py index fac267cb2dce..16c73bd1a2fb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2020_03_01.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2020_03_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py index 849bb8d96b70..d7e11178fc7e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,20 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +100,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +116,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +220,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2020_03_01.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +240,12 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +265,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +277,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py index b052c602e70c..4f6d32967cf9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +123,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +143,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +155,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +192,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +212,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +333,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -339,14 +359,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +387,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +399,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +444,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -436,7 +463,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -527,7 +556,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2020_03_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -549,14 +578,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -576,7 +605,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -588,21 +617,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -614,9 +650,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,12 +678,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -674,13 +712,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -698,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -710,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -729,10 +769,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -746,16 +791,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -763,13 +815,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -783,7 +835,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -804,10 +856,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -822,16 +879,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +903,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -859,7 +923,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -878,14 +944,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -897,9 +968,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -917,7 +988,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -941,10 +1014,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -960,16 +1038,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -977,13 +1062,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -997,7 +1082,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1025,10 +1112,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1045,16 +1137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1062,13 +1161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1106,14 +1207,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1127,9 +1233,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,7 +1253,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def create_event_hub_consumer_group( @@ -1171,14 +1279,19 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1192,9 +1305,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1212,7 +1325,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1236,14 +1351,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1257,9 +1377,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1273,7 +1393,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1298,10 +1420,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1317,16 +1444,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1334,13 +1468,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1354,7 +1488,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1377,14 +1513,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1397,9 +1538,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1417,7 +1558,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1441,10 +1584,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1460,16 +1608,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1477,13 +1632,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1497,7 +1652,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1520,10 +1677,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1539,16 +1701,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1556,13 +1725,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1576,7 +1745,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1627,7 +1798,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2020_03_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1637,15 +1808,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1666,9 +1842,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1686,7 +1862,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1758,7 +1936,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1768,15 +1947,20 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1799,9 +1983,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1819,7 +2003,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1891,7 +2077,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1901,15 +2088,20 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1932,9 +2124,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1952,7 +2144,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -1978,10 +2172,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1997,16 +2196,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2014,13 +2220,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2034,7 +2240,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2057,14 +2265,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2077,9 +2290,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2097,7 +2310,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2188,7 +2403,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2199,15 +2414,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2230,9 +2450,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2250,7 +2470,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2341,7 +2563,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2352,15 +2574,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2383,9 +2610,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2403,4 +2630,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py index a975ad5f1678..6ecea7d585c2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py index 09e9f6bc0ba3..229ea917fd4e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list( :rtype: list[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _update_initial( self, @@ -183,15 +203,20 @@ async def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +240,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,11 +260,13 @@ async def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_update( @@ -346,7 +373,7 @@ async def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -369,14 +396,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -397,7 +424,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -409,21 +436,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -436,9 +470,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -461,7 +495,9 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -494,13 +530,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -519,7 +555,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -531,6 +567,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py index 73023035fc14..e9e37103ea0e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,14 +70,19 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -83,9 +94,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +114,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -124,14 +137,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -144,9 +162,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +182,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py index e8d579095db4..e9e42cdae5d7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,19 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +88,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +108,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/__init__.py index 52b78aeb740e..ffd3a0a474fe 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/__init__.py @@ -100,7 +100,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py index da9a4fa309a1..55d78598294e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -35,7 +36,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -77,7 +78,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.CertificateProperties @@ -101,7 +102,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription] @@ -150,7 +151,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: The certificate content. :paramtype certificate: str @@ -166,7 +167,8 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -211,7 +213,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -236,7 +238,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -279,7 +281,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -324,8 +326,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -372,8 +374,8 @@ def __init__( *, endpoint_id: Optional[str] = None, health_status: Optional[Union[str, "_models.EndpointHealthStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -414,7 +416,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthData] @@ -450,7 +452,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -495,7 +497,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -536,7 +538,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, str] @@ -569,7 +571,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo] @@ -614,8 +616,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -670,8 +672,8 @@ def __init__( exclude_keys: bool, export_blob_name: Optional[str] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -710,7 +712,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -720,7 +722,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -764,8 +767,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -824,8 +827,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -876,7 +879,7 @@ class GroupIdInformation(_serialization.Model): "properties": {"key": "properties", "type": "GroupIdInformationProperties"}, } - def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs): + def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs: Any) -> None: """ :keyword properties: The properties for a group information object. Required. :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformationProperties @@ -911,8 +914,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -967,8 +970,8 @@ def __init__( input_blob_name: Optional[str] = None, output_blob_name: Optional[str] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -1021,7 +1024,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -1064,7 +1067,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1132,8 +1135,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1173,7 +1176,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] @@ -1205,8 +1208,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1245,7 +1248,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1358,8 +1361,8 @@ def __init__( cloud_to_device: Optional["_models.CloudToDeviceProperties"] = None, comments: Optional[str] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1451,7 +1454,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1479,7 +1482,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubQuotaMetricInfo] @@ -1516,7 +1519,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo @@ -1549,7 +1552,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuDescription] @@ -1588,7 +1591,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1630,7 +1633,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1695,7 +1700,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1728,7 +1733,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.JobResponse] @@ -1749,7 +1754,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties @@ -1789,8 +1794,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1823,7 +1828,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -1855,7 +1860,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2020_03_01.models.OperationDisplay @@ -1894,7 +1899,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1920,7 +1925,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -1930,7 +1935,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1950,7 +1956,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1974,7 +1980,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2011,7 +2017,7 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The properties of a private endpoint connection. Required. :paramtype properties: @@ -2054,8 +2060,8 @@ def __init__( *, private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", private_endpoint: Optional["_models.PrivateEndpoint"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint property of a private endpoint connection. :paramtype private_endpoint: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpoint @@ -2080,7 +2086,7 @@ class PrivateLinkResources(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for an IotHub. :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation] @@ -2122,8 +2128,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -2166,7 +2172,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -2197,8 +2203,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -2227,7 +2233,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -2258,8 +2264,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition @@ -2317,8 +2323,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -2347,7 +2353,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2380,8 +2388,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2459,8 +2467,8 @@ def __init__( authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the event hub endpoint. :paramtype id: str @@ -2517,8 +2525,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2534,7 +2542,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2569,8 +2578,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2652,8 +2661,8 @@ def __init__( authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus queue endpoint. :paramtype id: str @@ -2743,8 +2752,8 @@ def __init__( authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus topic endpoint. :paramtype id: str @@ -2859,8 +2868,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the storage container endpoint. :paramtype id: str @@ -2928,8 +2937,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -2955,7 +2968,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -3007,8 +3020,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -3053,7 +3066,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -3103,8 +3118,8 @@ def __init__( container_name: str, sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -3128,7 +3143,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -3138,7 +3154,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3171,8 +3187,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", and "DeviceJobLifecycleEvents". @@ -3199,7 +3215,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2020_03_01.models.MatchedRoute] @@ -3237,8 +3253,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage @@ -3272,8 +3288,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2020_03_01.models.TestResultStatus @@ -3296,7 +3312,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -3341,8 +3359,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -3386,7 +3404,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py index 465d80933309..8449df6e9e13 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateBodyDescription + type or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2020_03_01.models.CertificateBodyDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2020_03_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py index de2daa8f0631..7fd5aa040f6e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,8 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +62,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +101,20 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +137,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +153,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +257,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2020_03_01.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +277,12 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +302,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +314,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py index 7f40389a06ac..b34341306d93 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,7 +368,7 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +384,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -400,7 +406,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +422,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -433,7 +439,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -447,7 +453,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -464,7 +470,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -479,7 +485,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -496,7 +502,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +516,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -527,7 +533,7 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -541,7 +547,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -556,8 +562,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -568,7 +574,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -587,8 +593,8 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -602,7 +608,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -621,8 +627,8 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -636,7 +642,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -655,7 +661,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -669,7 +675,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -686,7 +692,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -701,7 +707,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -718,8 +724,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -733,7 +739,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -752,8 +758,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -767,7 +773,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -814,14 +820,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -833,9 +844,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -853,7 +864,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -863,15 +876,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -895,9 +913,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -915,11 +933,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1032,8 +1052,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -1057,14 +1077,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1085,7 +1105,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1097,22 +1117,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1135,9 +1162,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1154,7 +1181,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1243,7 +1272,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2020_03_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1264,14 +1293,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1291,7 +1320,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1303,21 +1332,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1329,9 +1365,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1357,12 +1393,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1388,13 +1426,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1412,7 +1450,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1424,9 +1462,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1442,10 +1482,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1459,16 +1504,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1476,13 +1528,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1496,7 +1548,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1514,10 +1566,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1532,16 +1589,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1549,13 +1613,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1569,7 +1633,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1586,14 +1652,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2020_03_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1605,9 +1676,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1625,7 +1696,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1649,10 +1722,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1668,16 +1746,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1685,13 +1770,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1705,7 +1790,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1733,10 +1820,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1753,16 +1845,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1770,13 +1869,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1790,7 +1889,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1814,14 +1915,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1835,9 +1941,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1855,7 +1961,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def create_event_hub_consumer_group( @@ -1879,14 +1987,19 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_create_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1900,9 +2013,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1920,7 +2033,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1944,14 +2059,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1965,9 +2085,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1981,7 +2101,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2003,10 +2125,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2022,16 +2149,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2039,13 +2173,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2059,7 +2193,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2080,14 +2216,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2100,9 +2241,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2120,7 +2261,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2144,10 +2287,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2163,16 +2311,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2180,13 +2335,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2200,7 +2355,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2222,10 +2379,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2241,16 +2403,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2258,13 +2427,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2278,7 +2447,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2329,7 +2500,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2020_03_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2339,15 +2510,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2368,9 +2544,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2388,7 +2564,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2460,7 +2638,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2470,15 +2649,20 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2501,9 +2685,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2521,7 +2705,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2593,7 +2779,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2603,15 +2790,20 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2634,9 +2826,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2654,7 +2846,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2680,10 +2874,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2699,16 +2898,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2716,13 +2922,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2736,7 +2942,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2759,14 +2967,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2779,9 +2992,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2799,7 +3012,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2890,7 +3105,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2901,15 +3116,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2932,9 +3152,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2952,7 +3172,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3043,7 +3265,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3054,15 +3276,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3085,9 +3312,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3105,4 +3332,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py index 93ca0ce48805..b0066354632d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py index 71799d04bd87..48728d98ecd9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +99,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +120,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,14 +225,19 @@ def list( :rtype: list[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -238,9 +249,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +269,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace def get( @@ -279,14 +292,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -299,9 +317,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,7 +337,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _update_initial( self, @@ -329,15 +349,20 @@ def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,9 +386,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,11 +406,13 @@ def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_update( @@ -492,7 +519,7 @@ def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -515,14 +542,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -543,7 +570,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -555,21 +582,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -582,9 +616,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -607,7 +641,9 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -640,13 +676,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -665,7 +701,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -677,6 +713,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py index 966de1aa52b3..2b8c1ebf92b1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +91,7 @@ def build_get_request( "groupId": _SERIALIZER.url("group_id", group_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,14 +136,19 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -149,9 +160,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -169,7 +180,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace def get( @@ -190,14 +203,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -210,9 +228,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,4 +248,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py index f830f05fdad4..f0a637a34339 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +52,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +93,19 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2020-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +115,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +135,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py index 5d208c2c03e0..28a068897dd5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-03-preview") # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop("api_version", "2021-03-03-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py index b59f116c1153..7df145f9801f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -74,7 +74,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -114,15 +114,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json index 254652ee5a93..50570156e397 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -105,4 +113,4 @@ "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py index ffb616eb5315..4c79a7fffbcb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-03-preview") # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop("api_version", "2021-03-03-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py index 1670f1f8898b..d88e7ffc5640 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -75,7 +75,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -122,5 +122,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py index e03c72c77210..63ba68d35749 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,21 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +105,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +125,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +148,21 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +175,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +195,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -268,8 +292,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -283,15 +307,22 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -316,9 +347,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -336,11 +367,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -363,14 +396,21 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -384,9 +424,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -400,7 +440,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -424,14 +466,21 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -445,9 +494,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -465,7 +514,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -563,8 +614,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -575,15 +626,22 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -608,9 +666,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -628,4 +686,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py index 3834fd6d4644..60f7ee1adcf8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,22 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +102,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +118,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +222,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_03_03_preview.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +242,14 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +269,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +281,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py index 5c76e5239f71..39217f0bab3b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,21 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +125,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +145,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +157,22 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +196,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +216,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -307,8 +331,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required @@ -334,14 +358,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -362,7 +388,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -374,22 +400,31 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -412,9 +447,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -431,7 +466,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -522,7 +559,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_03_preview.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -544,14 +581,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -571,7 +610,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -583,21 +622,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -609,9 +657,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -637,12 +685,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -670,13 +720,15 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -694,7 +746,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -706,9 +758,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -725,10 +779,17 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -742,16 +803,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -759,13 +827,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -779,7 +847,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -800,10 +868,17 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -818,16 +893,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -835,13 +917,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -855,7 +937,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -874,14 +958,21 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -893,9 +984,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -913,7 +1004,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -937,10 +1030,17 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -956,16 +1056,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -973,13 +1080,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -993,7 +1100,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1021,10 +1130,17 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1041,16 +1157,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1058,13 +1181,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1078,7 +1201,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1102,14 +1227,21 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1123,9 +1255,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1143,7 +1275,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload async def create_event_hub_consumer_group( @@ -1241,8 +1375,8 @@ async def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1253,15 +1387,22 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1286,9 +1427,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1306,7 +1447,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1330,14 +1473,21 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1351,9 +1501,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1367,7 +1517,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1392,10 +1544,17 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1411,16 +1570,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1428,13 +1594,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1448,7 +1614,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1471,14 +1639,21 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1491,9 +1666,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1511,7 +1686,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1535,10 +1712,17 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1554,16 +1738,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1571,13 +1762,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1591,7 +1782,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1614,10 +1807,17 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1633,16 +1833,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1650,13 +1857,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1670,7 +1877,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1721,7 +1930,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1731,15 +1940,22 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1760,9 +1976,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1780,7 +1996,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1852,7 +2070,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1862,15 +2081,22 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1893,9 +2119,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1913,7 +2139,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1985,7 +2213,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1995,15 +2224,22 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2026,9 +2262,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2046,7 +2282,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2072,10 +2310,17 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2091,16 +2336,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2108,13 +2360,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2128,7 +2380,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2151,14 +2405,21 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2171,9 +2432,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2191,7 +2452,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2283,7 +2546,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2294,15 +2557,22 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2325,9 +2595,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2345,7 +2615,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2437,7 +2709,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2448,15 +2720,22 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2479,9 +2758,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2499,4 +2778,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py index 6b1aeea492d7..fa4d78d71eb3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,17 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py index 7d419ac5fe62..912ea1847783 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,21 @@ async def list( :rtype: list[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -92,9 +105,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +125,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -133,14 +148,21 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +175,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +195,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _update_initial( self, @@ -183,15 +207,22 @@ async def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +246,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,11 +266,13 @@ async def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_update( @@ -346,7 +379,7 @@ async def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -369,14 +402,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -397,7 +432,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -409,21 +444,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -436,9 +480,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -461,7 +505,9 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -494,13 +540,15 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -519,7 +567,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -531,6 +579,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py index 9e656850826d..504d9abb2c01 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,14 +70,21 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -83,9 +96,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +116,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -124,14 +139,21 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -144,9 +166,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +186,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py index 33f7f3b6b823..f5f8c52ef654 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,21 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +90,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +110,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py index 3d708a8a05a2..b013af16b747 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py @@ -113,7 +113,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py index 9e6beadb385f..590069a2e493 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -59,8 +60,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.ArmUserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user @@ -99,7 +100,7 @@ class ArmUserIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -118,7 +119,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -160,7 +161,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateProperties @@ -184,7 +185,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription] @@ -233,7 +234,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: The certificate content. :paramtype certificate: str @@ -249,7 +250,8 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -294,7 +296,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -319,7 +321,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -363,7 +365,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -409,8 +411,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -449,8 +451,8 @@ def __init__( *, key_source: Optional[str] = None, key_vault_properties: Optional[List["_models.KeyVaultKeyProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_source: The source of the key. :paramtype key_source: str @@ -509,8 +511,8 @@ def __init__( last_known_error_time: Optional[datetime.datetime] = None, last_successful_send_attempt_time: Optional[datetime.datetime] = None, last_send_attempt_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -566,7 +568,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthData] @@ -602,7 +604,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -647,7 +649,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -667,7 +669,7 @@ class EventHubConsumerGroupBodyDescription(_serialization.Model): "properties": {"key": "properties", "type": "EventHubConsumerGroupName"}, } - def __init__(self, *, properties: Optional["_models.EventHubConsumerGroupName"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.EventHubConsumerGroupName"] = None, **kwargs: Any) -> None: """ :keyword properties: The EventHub consumer group name. :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupName @@ -708,7 +710,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, str] @@ -732,7 +734,7 @@ class EventHubConsumerGroupName(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: EventHub consumer group name. :paramtype name: str @@ -761,7 +763,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo] @@ -806,8 +808,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -867,8 +869,8 @@ def __init__( export_blob_name: Optional[str] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, identity: Optional["_models.ManagedIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -911,7 +913,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -921,7 +923,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -966,8 +969,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1027,8 +1030,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -1079,7 +1082,7 @@ class GroupIdInformation(_serialization.Model): "properties": {"key": "properties", "type": "GroupIdInformationProperties"}, } - def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs): + def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs: Any) -> None: """ :keyword properties: The properties for a group information object. Required. :paramtype properties: @@ -1115,8 +1118,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1176,8 +1179,8 @@ def __init__( output_blob_name: Optional[str] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, identity: Optional["_models.ManagedIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -1234,7 +1237,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -1277,7 +1280,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1349,8 +1352,8 @@ def __init__( etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, identity: Optional["_models.ArmIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1393,7 +1396,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] @@ -1425,8 +1428,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1466,7 +1469,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1595,8 +1598,8 @@ def __init__( device_streams: Optional["_models.IotHubPropertiesDeviceStreams"] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, encryption: Optional["_models.EncryptionPropertiesDescription"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1687,7 +1690,7 @@ class IotHubPropertiesDeviceStreams(_serialization.Model): "streaming_endpoints": {"key": "streamingEndpoints", "type": "[str]"}, } - def __init__(self, *, streaming_endpoints: Optional[List[str]] = None, **kwargs): + def __init__(self, *, streaming_endpoints: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword streaming_endpoints: List of Device Streams Endpoints. :paramtype streaming_endpoints: list[str] @@ -1721,7 +1724,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1749,7 +1752,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubQuotaMetricInfo] @@ -1786,7 +1789,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo @@ -1819,7 +1822,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuDescription] @@ -1858,7 +1861,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1900,7 +1903,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1965,7 +1970,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1998,7 +2003,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse] @@ -2023,8 +2028,12 @@ class KeyVaultKeyProperties(_serialization.Model): } def __init__( - self, *, key_identifier: Optional[str] = None, identity: Optional["_models.ManagedIdentity"] = None, **kwargs - ): + self, + *, + key_identifier: Optional[str] = None, + identity: Optional["_models.ManagedIdentity"] = None, + **kwargs: Any + ) -> None: """ :keyword key_identifier: The identifier of the key. :paramtype key_identifier: str @@ -2047,7 +2056,7 @@ class ManagedIdentity(_serialization.Model): "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: The user assigned identity. :paramtype user_assigned_identity: str @@ -2067,7 +2076,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties @@ -2107,8 +2116,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -2141,7 +2150,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -2179,8 +2188,13 @@ class NetworkRuleSetIpRule(_serialization.Model): } def __init__( - self, *, filter_name: str, ip_mask: str, action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", **kwargs - ): + self, + *, + filter_name: str, + ip_mask: str, + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword filter_name: Name of the IP filter rule. Required. :paramtype filter_name: str @@ -2228,8 +2242,8 @@ def __init__( apply_to_built_in_event_hub_endpoint: bool, ip_rules: List["_models.NetworkRuleSetIpRule"], default_action: Union[str, "_models.DefaultAction"] = "Deny", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_action: Default Action for Network Rule Set. Known values are: "Deny" and "Allow". @@ -2266,7 +2280,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationDisplay @@ -2305,7 +2319,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2331,7 +2345,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -2341,7 +2355,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -2361,7 +2376,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2385,7 +2400,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2423,7 +2438,7 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The properties of a private endpoint connection. Required. :paramtype properties: @@ -2466,8 +2481,8 @@ def __init__( *, private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", private_endpoint: Optional["_models.PrivateEndpoint"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint property of a private endpoint connection. :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpoint @@ -2492,7 +2507,7 @@ class PrivateLinkResources(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for an IotHub. :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation] @@ -2534,8 +2549,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -2578,7 +2593,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -2609,8 +2624,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -2639,7 +2654,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -2670,8 +2685,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition @@ -2730,8 +2745,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -2761,7 +2776,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2795,8 +2812,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2880,8 +2897,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the event hub endpoint. :paramtype id: str @@ -2942,8 +2959,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2959,7 +2976,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2994,8 +3012,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -3084,8 +3102,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus queue endpoint. :paramtype id: str @@ -3184,8 +3202,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus topic endpoint. :paramtype id: str @@ -3309,8 +3327,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the storage container endpoint. :paramtype id: str @@ -3382,8 +3400,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -3409,7 +3431,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -3461,8 +3483,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -3507,7 +3529,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -3562,8 +3586,8 @@ def __init__( sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, identity: Optional["_models.ManagedIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -3591,7 +3615,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -3601,7 +3626,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3635,8 +3660,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", @@ -3664,7 +3689,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.MatchedRoute] @@ -3702,8 +3727,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage @@ -3737,8 +3762,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.TestResultStatus @@ -3762,7 +3787,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -3807,8 +3834,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -3852,7 +3879,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py index 92ca93ce8b0c..ada3a1990303 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +61,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +78,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +97,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +120,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +140,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +167,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +186,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +210,9 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +229,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +253,10 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +273,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +323,21 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +349,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +369,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +392,21 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +419,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +439,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -500,8 +536,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -515,15 +551,22 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -548,9 +591,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -568,11 +611,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -595,14 +640,21 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -616,9 +668,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -632,7 +684,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -656,14 +710,21 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -677,9 +738,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -697,7 +758,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -795,8 +858,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -807,15 +870,22 @@ def verify( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -840,9 +910,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -860,4 +930,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py index 85cd9bc430cf..19e0f9c9edb8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,10 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +64,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +103,22 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +141,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +157,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +261,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_03_03_preview.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +281,14 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +308,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +320,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py index 039b902bb228..a890890c8bdf 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,9 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +63,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +80,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +97,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +118,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +135,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +154,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +170,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +185,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +196,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +211,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +226,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +243,9 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +259,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +276,9 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +292,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +309,9 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +326,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +348,9 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +366,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,8 +388,10 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +407,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -403,7 +431,9 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +449,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -436,7 +466,9 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -450,7 +482,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -467,7 +499,9 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,7 +516,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -499,7 +533,9 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -513,7 +549,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -530,7 +566,9 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -544,7 +582,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -559,8 +597,10 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -571,7 +611,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -590,8 +630,10 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,7 +647,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -624,8 +666,10 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +683,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -658,7 +702,9 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -672,7 +718,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -689,7 +735,9 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -704,7 +752,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -721,8 +769,10 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -736,7 +786,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -755,8 +805,10 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -770,7 +822,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -817,14 +869,21 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -836,9 +895,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -856,7 +915,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -866,15 +927,22 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -898,9 +966,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -918,11 +986,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1031,8 +1101,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required @@ -1058,14 +1128,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1086,7 +1158,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1098,22 +1170,31 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1136,9 +1217,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1155,7 +1236,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1246,7 +1329,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_03_preview.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1268,14 +1351,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1295,7 +1380,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1307,21 +1392,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1333,9 +1427,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1361,12 +1455,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1393,13 +1489,15 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1417,7 +1515,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1429,9 +1527,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1448,10 +1548,17 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1465,16 +1572,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1482,13 +1596,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1502,7 +1616,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1521,10 +1635,17 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1539,16 +1660,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1556,13 +1684,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1576,7 +1704,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1593,14 +1723,21 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1612,9 +1749,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1632,7 +1769,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1656,10 +1795,17 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1675,16 +1821,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1692,13 +1845,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1712,7 +1865,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1740,10 +1895,17 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1760,16 +1922,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1777,13 +1946,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1797,7 +1966,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1821,14 +1992,21 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1842,9 +2020,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1862,7 +2040,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload def create_event_hub_consumer_group( @@ -1960,8 +2140,8 @@ def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1972,15 +2152,22 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2005,9 +2192,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2025,7 +2212,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -2049,14 +2238,21 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -2070,9 +2266,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2086,7 +2282,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2108,10 +2306,17 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2127,16 +2332,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2144,13 +2356,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2164,7 +2376,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2185,14 +2399,21 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2205,9 +2426,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2225,7 +2446,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2249,10 +2472,17 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2268,16 +2498,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2285,13 +2522,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2305,7 +2542,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2328,10 +2567,17 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2347,16 +2593,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2364,13 +2617,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2384,7 +2637,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2435,7 +2690,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2445,15 +2700,22 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2474,9 +2736,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2494,7 +2756,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2566,7 +2830,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2576,15 +2841,22 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2607,9 +2879,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2627,7 +2899,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2699,7 +2973,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2709,15 +2984,22 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2740,9 +3022,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2760,7 +3042,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2786,10 +3070,17 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2805,16 +3096,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2822,13 +3120,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2842,7 +3140,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2865,14 +3165,21 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2885,9 +3192,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2905,7 +3212,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2997,7 +3306,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3008,15 +3317,22 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3039,9 +3355,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3059,7 +3375,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3151,7 +3469,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3162,15 +3480,22 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3193,9 +3518,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3213,4 +3538,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py index 3004ce913b54..451400ab0ef9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +93,17 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +116,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +140,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +160,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py index 7b04efaad45a..81beaf76dc7c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +63,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +84,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +103,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +124,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +144,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +167,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +186,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,14 +233,21 @@ def list( :rtype: list[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -238,9 +259,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +279,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace def get( @@ -279,14 +302,21 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -299,9 +329,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,7 +349,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _update_initial( self, @@ -329,15 +361,22 @@ def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,9 +400,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,11 +420,13 @@ def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_update( @@ -492,7 +533,7 @@ def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -515,14 +556,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -543,7 +586,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -555,21 +598,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -582,9 +634,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -607,7 +659,9 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -640,13 +694,15 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -665,7 +721,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -677,6 +733,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py index 2af07a62ab5f..a43f3cdb9281 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +61,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +78,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +95,7 @@ def build_get_request( "groupId": _SERIALIZER.url("group_id", group_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,14 +140,21 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -149,9 +166,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -169,7 +186,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace def get( @@ -190,14 +209,21 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -210,9 +236,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,4 +256,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py index d1caf6fba853..8e34d8362347 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,9 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +54,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +95,21 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-03-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-03-03-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-03-03-preview") + ) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +119,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +139,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py index c77ba0040a13..dd7091ed780e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-31") # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", "2021-03-31") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py index 8f93504f469b..d669cde0f029 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -73,7 +73,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -113,15 +113,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json index a1b4e4d93cfa..a7b25e166181 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -105,4 +113,4 @@ "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py index ecff387645e7..bb36811bb171 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-31") # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", "2021-03-31") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py index 27a0ad8d8f56..29ea319eca48 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -74,7 +74,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -121,5 +121,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py index afb4ef36ab3d..3eda1b406141 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_31.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py index 89a6b8c775ee..23358357d9ea 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,20 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +100,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +116,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +220,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_03_31.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +240,12 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +265,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +277,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py index c6e3835fd779..f1d164b5149e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +123,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +143,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +155,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +192,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +212,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +333,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -339,14 +359,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +387,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +399,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +444,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -436,7 +463,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -527,7 +556,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_31.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -549,14 +578,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -576,7 +605,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -588,21 +617,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -614,9 +650,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,12 +678,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -674,13 +712,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -698,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -710,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -729,10 +769,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -746,16 +791,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -763,13 +815,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -783,7 +835,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -804,10 +856,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -822,16 +879,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +903,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -859,7 +923,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -878,14 +944,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -897,9 +968,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -917,7 +988,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -941,10 +1014,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -960,16 +1038,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -977,13 +1062,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -997,7 +1082,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1025,10 +1112,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1045,16 +1137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1062,13 +1161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1106,14 +1207,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1127,9 +1233,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,7 +1253,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload async def create_event_hub_consumer_group( @@ -1245,8 +1353,8 @@ async def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1257,15 +1365,20 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1290,9 +1403,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1310,7 +1423,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1334,14 +1449,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1355,9 +1475,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1371,7 +1491,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1396,10 +1518,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1415,16 +1542,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1432,13 +1566,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1452,7 +1586,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1475,14 +1611,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1495,9 +1636,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1515,7 +1656,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1539,10 +1682,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1558,16 +1706,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1575,13 +1730,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1595,7 +1750,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1618,10 +1775,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1637,16 +1799,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1654,13 +1823,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1674,7 +1843,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1725,7 +1896,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_03_31.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1735,15 +1906,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1764,9 +1940,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1784,7 +1960,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1856,7 +2034,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1866,15 +2045,20 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1897,9 +2081,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1917,7 +2101,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1989,7 +2175,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1999,15 +2186,20 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2030,9 +2222,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2050,7 +2242,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2076,10 +2270,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2095,16 +2294,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2112,13 +2318,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2132,7 +2338,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2155,14 +2363,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2175,9 +2388,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2195,7 +2408,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2286,7 +2501,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2297,15 +2512,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2328,9 +2548,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2348,7 +2568,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2439,7 +2661,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2450,15 +2672,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2481,9 +2708,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2501,4 +2728,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py index 061dc920f70a..5cb64c007697 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py index c98c9a842a39..057b9a6f2fcc 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list( :rtype: list[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _update_initial( self, @@ -183,15 +203,20 @@ async def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +240,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,11 +260,13 @@ async def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_update( @@ -346,7 +373,7 @@ async def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -369,14 +396,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -397,7 +424,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -409,21 +436,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -436,9 +470,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -461,7 +495,9 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -494,13 +530,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -519,7 +555,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -531,6 +567,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py index df86e0137925..2150fddad51b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,14 +70,19 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -83,9 +94,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +114,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -124,14 +137,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -144,9 +162,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +182,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py index 5753f39e5a1f..a86ad76f05b9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,19 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +88,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +108,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py index 5bc745b7306b..eab35dc103e7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py @@ -110,7 +110,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py index d8c445ef4f5f..4fd683d8042a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -59,8 +60,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.ArmUserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned @@ -99,7 +100,7 @@ class ArmUserIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -118,7 +119,7 @@ class CertificateBodyDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -160,7 +161,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.CertificateProperties @@ -184,7 +185,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription] @@ -233,7 +234,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: The certificate content. :paramtype certificate: str @@ -249,7 +250,8 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -294,7 +296,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -319,7 +321,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -362,7 +364,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -407,8 +409,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -472,8 +474,8 @@ def __init__( last_known_error_time: Optional[datetime.datetime] = None, last_successful_send_attempt_time: Optional[datetime.datetime] = None, last_send_attempt_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -528,7 +530,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthData] @@ -564,7 +566,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -609,7 +611,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -635,7 +637,7 @@ class EventHubConsumerGroupBodyDescription(_serialization.Model): "properties": {"key": "properties", "type": "EventHubConsumerGroupName"}, } - def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs): + def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs: Any) -> None: """ :keyword properties: The EventHub consumer group name. Required. :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupName @@ -676,7 +678,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, any] @@ -706,7 +708,7 @@ class EventHubConsumerGroupName(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: EventHub consumer group name. Required. :paramtype name: str @@ -735,7 +737,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo] @@ -780,8 +782,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -849,8 +851,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -900,7 +902,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -910,7 +912,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -954,8 +957,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1014,8 +1017,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -1066,7 +1069,7 @@ class GroupIdInformation(_serialization.Model): "properties": {"key": "properties", "type": "GroupIdInformationProperties"}, } - def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs): + def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs: Any) -> None: """ :keyword properties: The properties for a group information object. Required. :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformationProperties @@ -1101,8 +1104,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1170,8 +1173,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -1235,7 +1238,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -1278,7 +1281,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1350,8 +1353,8 @@ def __init__( etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, identity: Optional["_models.ArmIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1394,7 +1397,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] @@ -1426,8 +1429,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1466,7 +1469,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1583,8 +1586,8 @@ def __init__( cloud_to_device: Optional["_models.CloudToDeviceProperties"] = None, comments: Optional[str] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1679,7 +1682,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1707,7 +1710,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubQuotaMetricInfo] @@ -1744,7 +1747,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo @@ -1777,7 +1780,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuDescription] @@ -1816,7 +1819,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1858,7 +1861,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1923,7 +1928,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -1956,7 +1961,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.JobResponse] @@ -1977,7 +1982,7 @@ class ManagedIdentity(_serialization.Model): "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: The user assigned identity. :paramtype user_assigned_identity: str @@ -1997,7 +2002,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties @@ -2037,8 +2042,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -2071,7 +2076,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -2109,8 +2114,13 @@ class NetworkRuleSetIpRule(_serialization.Model): } def __init__( - self, *, filter_name: str, ip_mask: str, action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", **kwargs - ): + self, + *, + filter_name: str, + ip_mask: str, + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword filter_name: Name of the IP filter rule. Required. :paramtype filter_name: str @@ -2158,8 +2168,8 @@ def __init__( apply_to_built_in_event_hub_endpoint: bool, ip_rules: List["_models.NetworkRuleSetIpRule"], default_action: Union[str, "_models.DefaultAction"] = "Deny", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_action: Default Action for Network Rule Set. Known values are: "Deny" and "Allow". @@ -2196,7 +2206,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2021_03_31.models.OperationDisplay @@ -2235,7 +2245,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2261,7 +2271,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -2271,7 +2281,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -2291,7 +2302,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2315,7 +2326,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2352,7 +2363,7 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The properties of a private endpoint connection. Required. :paramtype properties: @@ -2395,8 +2406,8 @@ def __init__( *, private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", private_endpoint: Optional["_models.PrivateEndpoint"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint property of a private endpoint connection. :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpoint @@ -2421,7 +2432,7 @@ class PrivateLinkResources(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for an IotHub. :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation] @@ -2463,8 +2474,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -2507,7 +2518,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -2538,8 +2549,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -2568,7 +2579,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -2599,8 +2610,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition @@ -2658,8 +2669,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -2688,7 +2699,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2721,8 +2734,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2804,8 +2817,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the event hub endpoint. :paramtype id: str @@ -2865,8 +2878,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2882,7 +2895,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2917,8 +2931,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -3004,8 +3018,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus queue endpoint. :paramtype id: str @@ -3102,8 +3116,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus topic endpoint. :paramtype id: str @@ -3225,8 +3239,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the storage container endpoint. :paramtype id: str @@ -3297,8 +3311,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -3324,7 +3342,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -3376,8 +3394,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -3422,7 +3440,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -3476,8 +3496,8 @@ def __init__( sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, identity: Optional["_models.ManagedIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -3504,7 +3524,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -3514,7 +3535,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3548,8 +3569,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", and @@ -3577,7 +3598,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2021_03_31.models.MatchedRoute] @@ -3615,8 +3636,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage @@ -3650,8 +3671,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2021_03_31.models.TestResultStatus @@ -3674,7 +3695,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -3719,8 +3742,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -3764,7 +3787,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py index 6989cd2cd265..1166f09bcd9a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_31.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py index 0e3b900c0584..703067072dcf 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,8 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +62,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +101,20 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +137,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +153,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +257,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_03_31.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +277,12 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +302,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +314,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py index 2d1f2948e7a3..fda43732d148 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,8 +368,8 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +385,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -403,7 +409,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +425,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -436,7 +442,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -450,7 +456,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -467,7 +473,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,7 +488,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -499,7 +505,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -513,7 +519,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -530,7 +536,7 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -544,7 +550,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -559,8 +565,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -571,7 +577,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -590,8 +596,8 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,7 +611,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -624,8 +630,8 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +645,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -658,7 +664,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -672,7 +678,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -689,7 +695,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -704,7 +710,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -721,8 +727,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -736,7 +742,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -755,8 +761,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -770,7 +776,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -817,14 +823,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -836,9 +847,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -856,7 +867,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -866,15 +879,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -898,9 +916,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -918,11 +936,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1035,8 +1055,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -1060,14 +1080,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1088,7 +1108,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1100,22 +1120,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1138,9 +1165,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1157,7 +1184,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1246,7 +1275,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_31.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1267,14 +1296,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1294,7 +1323,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1306,21 +1335,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1332,9 +1368,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1360,12 +1396,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1391,13 +1429,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1415,7 +1453,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1427,9 +1465,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1445,10 +1485,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1462,16 +1507,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1479,13 +1531,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1499,7 +1551,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1517,10 +1569,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1535,16 +1592,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1552,13 +1616,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1572,7 +1636,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1589,14 +1655,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_03_31.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1608,9 +1679,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1628,7 +1699,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1652,10 +1725,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1671,16 +1749,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1688,13 +1773,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1708,7 +1793,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1736,10 +1823,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1756,16 +1848,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1773,13 +1872,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1793,7 +1892,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1817,14 +1918,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1838,9 +1944,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1858,7 +1964,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload def create_event_hub_consumer_group( @@ -1956,8 +2064,8 @@ def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1968,15 +2076,20 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2001,9 +2114,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2021,7 +2134,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -2045,14 +2160,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -2066,9 +2186,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2082,7 +2202,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2104,10 +2226,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2123,16 +2250,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2140,13 +2274,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2160,7 +2294,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2181,14 +2317,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2201,9 +2342,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2221,7 +2362,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2245,10 +2388,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2264,16 +2412,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2281,13 +2436,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2301,7 +2456,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2323,10 +2480,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2342,16 +2504,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2359,13 +2528,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2379,7 +2548,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2430,7 +2601,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_03_31.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2440,15 +2611,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2469,9 +2645,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2489,7 +2665,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2561,7 +2739,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2571,15 +2750,20 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2602,9 +2786,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2622,7 +2806,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2694,7 +2880,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2704,15 +2891,20 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2735,9 +2927,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2755,7 +2947,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2781,10 +2975,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2800,16 +2999,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2817,13 +3023,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2837,7 +3043,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2860,14 +3068,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2880,9 +3093,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2900,7 +3113,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2991,7 +3206,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3002,15 +3217,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3033,9 +3253,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3053,7 +3273,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3144,7 +3366,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3155,15 +3377,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3186,9 +3413,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3206,4 +3433,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py index 84e5a7147597..cfb0c6a34adf 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py index 0f18daec6219..446fc810d60c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +99,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +120,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,14 +225,19 @@ def list( :rtype: list[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -238,9 +249,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +269,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace def get( @@ -279,14 +292,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -299,9 +317,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,7 +337,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _update_initial( self, @@ -329,15 +349,20 @@ def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,9 +386,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,11 +406,13 @@ def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_update( @@ -492,7 +519,7 @@ def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -515,14 +542,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -543,7 +570,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -555,21 +582,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -582,9 +616,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -607,7 +641,9 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -640,13 +676,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -665,7 +701,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -677,6 +713,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py index facfb2d37c0a..c4976e765ef8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +91,7 @@ def build_get_request( "groupId": _SERIALIZER.url("group_id", group_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,14 +136,19 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -149,9 +160,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -169,7 +180,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace def get( @@ -190,14 +203,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -210,9 +228,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,4 +248,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py index e58cfca1e65a..2365e3e73735 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +52,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +93,19 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-03-31"] = kwargs.pop("api_version", _params.pop("api-version", "2021-03-31")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +115,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +135,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py index 16e7beaf5b87..a39f0d6e4b55 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01") # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", "2021-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py index 442671d41c51..8ff92cfc74a2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -73,7 +73,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -113,15 +113,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json index 288c61e9f248..189a5c1dbf95 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -105,4 +113,4 @@ "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py index f8644aa032b9..2b857a5926f4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01") # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", "2021-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py index 3cd5ff05d017..5b9043e2d12b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -74,7 +74,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -121,5 +121,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py index 360de3261ffd..93cd8ce0b4e5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_07_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py index 0b1a3d0d7b6f..3c8aa30ade98 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,20 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +100,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +116,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +220,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_07_01.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +240,12 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +265,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +277,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py index 42a38202d093..4061262cc373 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +123,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +143,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +155,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +192,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +212,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +333,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -339,14 +359,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +387,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +399,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +444,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -436,7 +463,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -527,7 +556,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_07_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -549,14 +578,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -576,7 +605,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -588,21 +617,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -614,9 +650,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,12 +678,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -674,13 +712,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -698,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -710,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -729,10 +769,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -746,16 +791,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -763,13 +815,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -783,7 +835,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -804,10 +856,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -822,16 +879,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +903,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -859,7 +923,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -878,14 +944,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -897,9 +968,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -917,7 +988,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -941,10 +1014,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -960,16 +1038,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -977,13 +1062,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -997,7 +1082,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1025,10 +1112,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1045,16 +1137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1062,13 +1161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1106,14 +1207,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1127,9 +1233,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,7 +1253,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload async def create_event_hub_consumer_group( @@ -1245,8 +1353,8 @@ async def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1257,15 +1365,20 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1290,9 +1403,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1310,7 +1423,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1334,14 +1449,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1355,9 +1475,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1371,7 +1491,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1396,10 +1518,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1415,16 +1542,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1432,13 +1566,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1452,7 +1586,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1475,14 +1611,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1495,9 +1636,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1515,7 +1656,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1539,10 +1682,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1558,16 +1706,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1575,13 +1730,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1595,7 +1750,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1618,10 +1775,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1637,16 +1799,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1654,13 +1823,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1674,7 +1843,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1725,7 +1896,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_07_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1735,15 +1906,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1764,9 +1940,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1784,7 +1960,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1856,7 +2034,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1866,15 +2045,20 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1897,9 +2081,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1917,7 +2101,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1989,7 +2175,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1999,15 +2186,20 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2030,9 +2222,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2050,7 +2242,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2076,10 +2270,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2095,16 +2294,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2112,13 +2318,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2132,7 +2338,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2155,14 +2363,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2175,9 +2388,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2195,7 +2408,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2286,7 +2501,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2297,15 +2512,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2328,9 +2548,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2348,7 +2568,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2439,7 +2661,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2450,15 +2672,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2481,9 +2708,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2501,4 +2728,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py index c2fb417fccdc..e2ce8434ee77 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py index 2b1cc317847f..441d642de9e5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list( :rtype: list[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _update_initial( self, @@ -183,15 +203,20 @@ async def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +240,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,11 +260,13 @@ async def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_update( @@ -346,7 +373,7 @@ async def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -369,14 +396,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -397,7 +424,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -409,21 +436,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -436,9 +470,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -461,7 +495,9 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -494,13 +530,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -519,7 +555,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -531,6 +567,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py index 1288f3669397..698385e99175 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,14 +70,19 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -83,9 +94,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +114,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -124,14 +137,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -144,9 +162,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +182,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py index 2848ced636aa..9883b780bced 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,19 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +88,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +108,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py index 5bc745b7306b..eab35dc103e7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py @@ -110,7 +110,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py index 1425beb4c207..6f3451b6eec9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -59,8 +60,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.ArmUserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned @@ -99,7 +100,7 @@ class ArmUserIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -122,7 +123,7 @@ class CertificateBodyDescription(_serialization.Model): "is_verified": {"key": "isVerified", "type": "bool"}, } - def __init__(self, *, certificate: Optional[str] = None, is_verified: Optional[bool] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, is_verified: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -168,7 +169,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.CertificateProperties @@ -192,7 +193,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription] @@ -240,7 +241,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword is_verified: Determines whether certificate has been verified. :paramtype is_verified: bool @@ -258,7 +259,8 @@ def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[ class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -303,7 +305,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -328,7 +330,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -371,7 +373,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -416,8 +418,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -481,8 +483,8 @@ def __init__( last_known_error_time: Optional[datetime.datetime] = None, last_successful_send_attempt_time: Optional[datetime.datetime] = None, last_send_attempt_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -537,7 +539,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthData] @@ -573,7 +575,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -618,7 +620,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -644,7 +646,7 @@ class EventHubConsumerGroupBodyDescription(_serialization.Model): "properties": {"key": "properties", "type": "EventHubConsumerGroupName"}, } - def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs): + def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs: Any) -> None: """ :keyword properties: The EventHub consumer group name. Required. :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupName @@ -685,7 +687,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, any] @@ -715,7 +717,7 @@ class EventHubConsumerGroupName(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: EventHub consumer group name. Required. :paramtype name: str @@ -744,7 +746,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo] @@ -789,8 +791,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -858,8 +860,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -909,7 +911,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -919,7 +921,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -963,8 +966,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1023,8 +1026,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -1075,7 +1078,7 @@ class GroupIdInformation(_serialization.Model): "properties": {"key": "properties", "type": "GroupIdInformationProperties"}, } - def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs): + def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs: Any) -> None: """ :keyword properties: The properties for a group information object. Required. :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformationProperties @@ -1110,8 +1113,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1179,8 +1182,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -1244,7 +1247,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -1287,7 +1290,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1359,8 +1362,8 @@ def __init__( etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, identity: Optional["_models.ArmIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1403,7 +1406,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] @@ -1435,8 +1438,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1475,7 +1478,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1617,8 +1620,8 @@ def __init__( cloud_to_device: Optional["_models.CloudToDeviceProperties"] = None, comments: Optional[str] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1733,7 +1736,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1761,7 +1764,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubQuotaMetricInfo] @@ -1798,7 +1801,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo @@ -1831,7 +1834,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuDescription] @@ -1870,7 +1873,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1912,7 +1915,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1977,7 +1982,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -2010,7 +2015,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.JobResponse] @@ -2031,7 +2036,7 @@ class ManagedIdentity(_serialization.Model): "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: The user assigned identity. :paramtype user_assigned_identity: str @@ -2051,7 +2056,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties @@ -2091,8 +2096,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -2125,7 +2130,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -2163,8 +2168,13 @@ class NetworkRuleSetIpRule(_serialization.Model): } def __init__( - self, *, filter_name: str, ip_mask: str, action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", **kwargs - ): + self, + *, + filter_name: str, + ip_mask: str, + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword filter_name: Name of the IP filter rule. Required. :paramtype filter_name: str @@ -2212,8 +2222,8 @@ def __init__( apply_to_built_in_event_hub_endpoint: bool, ip_rules: List["_models.NetworkRuleSetIpRule"], default_action: Union[str, "_models.DefaultAction"] = "Deny", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_action: Default Action for Network Rule Set. Known values are: "Deny" and "Allow". @@ -2250,7 +2260,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2021_07_01.models.OperationDisplay @@ -2289,7 +2299,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2315,7 +2325,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -2325,7 +2335,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -2345,7 +2356,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2369,7 +2380,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2406,7 +2417,7 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The properties of a private endpoint connection. Required. :paramtype properties: @@ -2449,8 +2460,8 @@ def __init__( *, private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", private_endpoint: Optional["_models.PrivateEndpoint"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint property of a private endpoint connection. :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpoint @@ -2475,7 +2486,7 @@ class PrivateLinkResources(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for an IotHub. :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation] @@ -2517,8 +2528,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -2561,7 +2572,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -2592,8 +2603,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -2622,7 +2633,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -2653,8 +2664,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition @@ -2712,8 +2723,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -2742,7 +2753,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2775,8 +2788,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2858,8 +2871,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the event hub endpoint. :paramtype id: str @@ -2919,8 +2932,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2936,7 +2949,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2971,8 +2985,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -3058,8 +3072,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus queue endpoint. :paramtype id: str @@ -3156,8 +3170,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus topic endpoint. :paramtype id: str @@ -3279,8 +3293,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the storage container endpoint. :paramtype id: str @@ -3351,8 +3365,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -3378,7 +3396,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -3430,8 +3448,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -3476,7 +3494,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -3530,8 +3550,8 @@ def __init__( sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, identity: Optional["_models.ManagedIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -3558,7 +3578,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -3568,7 +3589,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3602,8 +3623,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", and @@ -3631,7 +3652,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2021_07_01.models.MatchedRoute] @@ -3669,8 +3690,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage @@ -3704,8 +3725,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2021_07_01.models.TestResultStatus @@ -3728,7 +3749,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -3773,8 +3796,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -3818,7 +3841,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py index f5a3804f3049..6e1a82dedd3e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_07_01.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py index 666ee27e5e74..1ef7a245e8ab 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,8 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +62,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +101,20 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +137,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +153,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +257,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_07_01.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +277,12 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +302,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +314,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py index 75ba201529c6..ef6eb271dc97 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,8 +368,8 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +385,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -403,7 +409,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +425,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -436,7 +442,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -450,7 +456,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -467,7 +473,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,7 +488,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -499,7 +505,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -513,7 +519,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -530,7 +536,7 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -544,7 +550,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -559,8 +565,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -571,7 +577,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -590,8 +596,8 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,7 +611,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -624,8 +630,8 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +645,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -658,7 +664,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -672,7 +678,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -689,7 +695,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -704,7 +710,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -721,8 +727,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -736,7 +742,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -755,8 +761,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -770,7 +776,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -817,14 +823,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -836,9 +847,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -856,7 +867,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -866,15 +879,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -898,9 +916,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -918,11 +936,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1035,8 +1055,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -1060,14 +1080,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1088,7 +1108,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1100,22 +1120,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1138,9 +1165,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1157,7 +1184,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1246,7 +1275,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_07_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1267,14 +1296,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1294,7 +1323,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1306,21 +1335,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1332,9 +1368,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1360,12 +1396,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1391,13 +1429,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1415,7 +1453,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1427,9 +1465,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1445,10 +1485,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1462,16 +1507,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1479,13 +1531,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1499,7 +1551,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1517,10 +1569,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1535,16 +1592,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1552,13 +1616,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1572,7 +1636,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1589,14 +1655,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_07_01.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1608,9 +1679,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1628,7 +1699,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1652,10 +1725,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1671,16 +1749,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1688,13 +1773,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1708,7 +1793,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1736,10 +1823,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1756,16 +1848,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1773,13 +1872,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1793,7 +1892,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1817,14 +1918,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1838,9 +1944,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1858,7 +1964,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload def create_event_hub_consumer_group( @@ -1956,8 +2064,8 @@ def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1968,15 +2076,20 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2001,9 +2114,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2021,7 +2134,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -2045,14 +2160,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -2066,9 +2186,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2082,7 +2202,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2104,10 +2226,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2123,16 +2250,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2140,13 +2274,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2160,7 +2294,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2181,14 +2317,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2201,9 +2342,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2221,7 +2362,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2245,10 +2388,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2264,16 +2412,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2281,13 +2436,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2301,7 +2456,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2323,10 +2480,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2342,16 +2504,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2359,13 +2528,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2379,7 +2548,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2430,7 +2601,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_07_01.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2440,15 +2611,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2469,9 +2645,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2489,7 +2665,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2561,7 +2739,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2571,15 +2750,20 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2602,9 +2786,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2622,7 +2806,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2694,7 +2880,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2704,15 +2891,20 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2735,9 +2927,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2755,7 +2947,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2781,10 +2975,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2800,16 +2999,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2817,13 +3023,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2837,7 +3043,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2860,14 +3068,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2880,9 +3093,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2900,7 +3113,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2991,7 +3206,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3002,15 +3217,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3033,9 +3253,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3053,7 +3273,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3144,7 +3366,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3155,15 +3377,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3186,9 +3413,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3206,4 +3433,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py index ad3f880e1b94..88aeae1f2c96 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py index 5597a3a59cde..abbdbc1f178c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +99,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +120,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,14 +225,19 @@ def list( :rtype: list[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -238,9 +249,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +269,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace def get( @@ -279,14 +292,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -299,9 +317,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,7 +337,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _update_initial( self, @@ -329,15 +349,20 @@ def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,9 +386,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,11 +406,13 @@ def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_update( @@ -492,7 +519,7 @@ def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -515,14 +542,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -543,7 +570,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -555,21 +582,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -582,9 +616,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -607,7 +641,9 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -640,13 +676,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -665,7 +701,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -677,6 +713,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py index 113f25b4ba1b..0e89490eced4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +91,7 @@ def build_get_request( "groupId": _SERIALIZER.url("group_id", group_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,14 +136,19 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -149,9 +160,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -169,7 +180,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace def get( @@ -190,14 +203,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -210,9 +228,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,4 +248,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py index 5c18d1944879..09240e4badc7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +52,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +93,19 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +115,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +135,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py index 6e3d9202ba2d..f648a2a2b80b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-02") # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", "2021-07-02") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py index c3f648a63f15..b05c9c0d5517 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -73,7 +73,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -113,15 +113,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_metadata.json index 6553ac8e8ff8..57f36064955b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -105,4 +113,4 @@ "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py index 5c86a573cc7c..82babdbe1b53 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-02") # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", "2021-07-02") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py index 6b7fb957a8e6..b5e9435b1f2e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -74,7 +74,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -121,5 +121,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_certificates_operations.py index 3187cce33870..325f4171646b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -267,8 +287,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -282,15 +302,20 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -335,11 +360,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -362,14 +389,19 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -383,9 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -423,14 +457,19 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -444,9 +483,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,7 +503,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -562,8 +603,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_07_02.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -574,15 +615,20 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,9 +653,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -627,4 +673,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_operations.py index bd1a7788a9ae..1e4c43211c57 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,20 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +100,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +116,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +220,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_07_02.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +240,12 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +265,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +277,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_resource_operations.py index 17d64943478f..4ea04f5d5c91 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,19 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +123,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +143,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +155,20 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +192,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,11 +212,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -313,8 +333,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -339,14 +359,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +387,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +399,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +444,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -436,7 +463,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -527,7 +556,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_07_02.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -549,14 +578,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -576,7 +605,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -588,21 +617,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -614,9 +650,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,12 +678,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -674,13 +712,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -698,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -710,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -729,10 +769,15 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -746,16 +791,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -763,13 +815,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -783,7 +835,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -804,10 +856,15 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -822,16 +879,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +903,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -859,7 +923,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -878,14 +944,19 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -897,9 +968,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -917,7 +988,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -941,10 +1014,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -960,16 +1038,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -977,13 +1062,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -997,7 +1082,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1025,10 +1112,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1045,16 +1137,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1062,13 +1161,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1106,14 +1207,19 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1127,9 +1233,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,7 +1253,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload async def create_event_hub_consumer_group( @@ -1245,8 +1353,8 @@ async def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1257,15 +1365,20 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1290,9 +1403,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1310,7 +1423,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1334,14 +1449,19 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1355,9 +1475,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1371,7 +1491,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1396,10 +1518,15 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1415,16 +1542,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1432,13 +1566,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1452,7 +1586,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1475,14 +1611,19 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1495,9 +1636,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1515,7 +1656,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1539,10 +1682,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1558,16 +1706,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1575,13 +1730,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1595,7 +1750,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1618,10 +1775,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1637,16 +1799,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1654,13 +1823,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1674,7 +1843,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1725,7 +1896,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_07_02.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1735,15 +1906,20 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1764,9 +1940,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1784,7 +1960,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1856,7 +2034,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_02.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1866,15 +2045,20 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1897,9 +2081,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1917,7 +2101,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -1989,7 +2175,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_02.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1999,15 +2186,20 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2030,9 +2222,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2050,7 +2242,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2076,10 +2270,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2095,16 +2294,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2112,13 +2318,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2132,7 +2338,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2155,14 +2363,19 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2175,9 +2388,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2195,7 +2408,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2286,7 +2501,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_07_02.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2297,15 +2512,20 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2328,9 +2548,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2348,7 +2568,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2439,7 +2661,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_07_02.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2450,15 +2672,20 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2481,9 +2708,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2501,4 +2728,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_operations.py index 36cf909a1350..daee4faee5ae 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +91,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +115,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_endpoint_connections_operations.py index 484c84e24149..22fe5be56032 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,19 @@ async def list( :rtype: list[~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -92,9 +103,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +123,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -133,14 +146,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _update_initial( self, @@ -183,15 +203,20 @@ async def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +240,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,11 +260,13 @@ async def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_update( @@ -346,7 +373,7 @@ async def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -369,14 +396,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -397,7 +424,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -409,21 +436,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -436,9 +470,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -461,7 +495,9 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -494,13 +530,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -519,7 +555,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -531,6 +567,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_link_resources_operations.py index b21b5684e1b5..2fc5dbf1ad2b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,14 +70,19 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any :rtype: ~azure.mgmt.iothub.v2021_07_02.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -83,9 +94,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +114,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -124,14 +137,19 @@ async def get( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -144,9 +162,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +182,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_resource_provider_common_operations.py index a9d048b3e195..46700749e225 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,19 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2021_07_02.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +88,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +108,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/__init__.py index 4741c375bd90..e16a33384a80 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/__init__.py @@ -112,7 +112,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_models_py3.py index 5606e99d95cd..9930b4d40fbc 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -59,8 +60,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.ArmUserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned @@ -99,7 +100,7 @@ class ArmUserIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -122,7 +123,7 @@ class CertificateBodyDescription(_serialization.Model): "is_verified": {"key": "isVerified", "type": "bool"}, } - def __init__(self, *, certificate: Optional[str] = None, is_verified: Optional[bool] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, is_verified: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -168,7 +169,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.CertificateProperties @@ -192,7 +193,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription] @@ -240,7 +241,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword is_verified: Determines whether certificate has been verified. :paramtype is_verified: bool @@ -258,7 +259,8 @@ def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[ class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -303,7 +305,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -328,7 +330,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -371,7 +373,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -416,8 +418,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -481,8 +483,8 @@ def __init__( last_known_error_time: Optional[datetime.datetime] = None, last_successful_send_attempt_time: Optional[datetime.datetime] = None, last_send_attempt_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -537,7 +539,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.EndpointHealthData] @@ -573,7 +575,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -618,7 +620,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -644,7 +646,7 @@ class EventHubConsumerGroupBodyDescription(_serialization.Model): "properties": {"key": "properties", "type": "EventHubConsumerGroupName"}, } - def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs): + def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs: Any) -> None: """ :keyword properties: The EventHub consumer group name. Required. :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupName @@ -685,7 +687,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, any] @@ -715,7 +717,7 @@ class EventHubConsumerGroupName(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: EventHub consumer group name. Required. :paramtype name: str @@ -744,7 +746,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupInfo] @@ -789,8 +791,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -858,8 +860,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -909,7 +911,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -919,7 +921,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -963,8 +966,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1023,8 +1026,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -1075,7 +1078,7 @@ class GroupIdInformation(_serialization.Model): "properties": {"key": "properties", "type": "GroupIdInformationProperties"}, } - def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs): + def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs: Any) -> None: """ :keyword properties: The properties for a group information object. Required. :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.GroupIdInformationProperties @@ -1110,8 +1113,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1179,8 +1182,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -1244,7 +1247,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -1287,7 +1290,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1363,8 +1366,8 @@ def __init__( etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, identity: Optional["_models.ArmIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1408,7 +1411,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription] @@ -1440,8 +1443,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1480,7 +1483,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1627,8 +1630,8 @@ def __init__( # pylint: disable=too-many-locals comments: Optional[str] = None, features: Optional[Union[str, "_models.Capabilities"]] = None, enable_data_residency: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1747,7 +1750,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1775,7 +1778,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.IotHubQuotaMetricInfo] @@ -1812,7 +1815,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2021_07_02.models.IotHubSkuInfo @@ -1845,7 +1848,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.IotHubSkuDescription] @@ -1884,7 +1887,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -1926,7 +1929,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -1991,7 +1996,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -2024,7 +2029,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.JobResponse] @@ -2045,7 +2050,7 @@ class ManagedIdentity(_serialization.Model): "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: The user assigned identity. :paramtype user_assigned_identity: str @@ -2065,7 +2070,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2021_07_02.models.RouteProperties @@ -2105,8 +2110,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -2139,7 +2144,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -2177,8 +2182,13 @@ class NetworkRuleSetIpRule(_serialization.Model): } def __init__( - self, *, filter_name: str, ip_mask: str, action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", **kwargs - ): + self, + *, + filter_name: str, + ip_mask: str, + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword filter_name: Name of the IP filter rule. Required. :paramtype filter_name: str @@ -2226,8 +2236,8 @@ def __init__( apply_to_built_in_event_hub_endpoint: bool, ip_rules: List["_models.NetworkRuleSetIpRule"], default_action: Union[str, "_models.DefaultAction"] = "Deny", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_action: Default Action for Network Rule Set. Known values are: "Deny" and "Allow". @@ -2264,7 +2274,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2021_07_02.models.OperationDisplay @@ -2303,7 +2313,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2329,7 +2339,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -2339,7 +2349,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -2359,7 +2370,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2383,7 +2394,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2420,7 +2431,7 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The properties of a private endpoint connection. Required. :paramtype properties: @@ -2463,8 +2474,8 @@ def __init__( *, private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", private_endpoint: Optional["_models.PrivateEndpoint"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint property of a private endpoint connection. :paramtype private_endpoint: ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpoint @@ -2489,7 +2500,7 @@ class PrivateLinkResources(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for an IotHub. :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.GroupIdInformation] @@ -2531,8 +2542,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -2575,7 +2586,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -2606,8 +2617,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -2636,7 +2647,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -2667,8 +2678,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2021_07_02.models.RouteErrorPosition @@ -2726,8 +2737,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -2756,7 +2767,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2789,8 +2802,8 @@ def __init__( service_bus_topics: Optional[List["_models.RoutingServiceBusTopicEndpointProperties"]] = None, event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -2872,8 +2885,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the event hub endpoint. :paramtype id: str @@ -2933,8 +2946,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -2950,7 +2963,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2963,8 +2977,7 @@ class RoutingProperties(_serialization.Model): :vartype routes: list[~azure.mgmt.iothub.v2021_07_02.models.RouteProperties] :ivar fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. - When this property is not set, the messages which do not meet any of the conditions specified - in the 'routes' section get routed to the built-in eventhub endpoint. + When this property is not present in the template, the fallback route is disabled by default. :vartype fallback_route: ~azure.mgmt.iothub.v2021_07_02.models.FallbackRouteProperties :ivar enrichments: The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. @@ -2985,8 +2998,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -2999,8 +3012,8 @@ def __init__( :paramtype routes: list[~azure.mgmt.iothub.v2021_07_02.models.RouteProperties] :keyword fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional - parameter. When this property is not set, the messages which do not meet any of the conditions - specified in the 'routes' section get routed to the built-in eventhub endpoint. + parameter. When this property is not present in the template, the fallback route is disabled by + default. :paramtype fallback_route: ~azure.mgmt.iothub.v2021_07_02.models.FallbackRouteProperties :keyword enrichments: The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. See: @@ -3072,8 +3085,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus queue endpoint. :paramtype id: str @@ -3170,8 +3183,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus topic endpoint. :paramtype id: str @@ -3293,8 +3306,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the storage container endpoint. :paramtype id: str @@ -3365,8 +3378,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -3392,7 +3409,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -3444,8 +3461,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -3490,7 +3507,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -3544,8 +3563,8 @@ def __init__( sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, identity: Optional["_models.ManagedIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -3608,8 +3627,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -3636,7 +3655,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -3646,7 +3666,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3680,8 +3700,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", and @@ -3709,7 +3729,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2021_07_02.models.MatchedRoute] @@ -3747,8 +3767,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2021_07_02.models.RoutingMessage @@ -3782,8 +3802,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2021_07_02.models.TestResultStatus @@ -3806,7 +3826,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -3851,8 +3873,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -3896,7 +3918,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2021_07_02.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_certificates_operations.py index 5e79eafd95fd..e9ca4f254232 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +134,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +202,7 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +219,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +243,8 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +261,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +311,19 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +335,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +355,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +378,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +403,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +423,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -499,8 +519,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -514,15 +534,20 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,9 +572,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,11 +592,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -594,14 +621,19 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -615,9 +647,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +663,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -655,14 +689,19 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -676,9 +715,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -696,7 +735,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -794,8 +835,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2021_07_02.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -806,15 +847,20 @@ def verify( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +885,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +905,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py index 47a5f4711b41..5907d6f1de18 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,8 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +62,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +101,20 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +137,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +153,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +257,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2021_07_02.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +277,12 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +302,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +314,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_resource_operations.py index 50ff5dfead45..9d68c56238d7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +78,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +114,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +129,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +162,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +177,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +186,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +231,7 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +245,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +262,7 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +293,7 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +308,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +330,7 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +346,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,8 +368,8 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +385,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -403,7 +409,7 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +425,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -436,7 +442,7 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -450,7 +456,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -467,7 +473,7 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,7 +488,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -499,7 +505,7 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -513,7 +519,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -530,7 +536,7 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -544,7 +550,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -559,8 +565,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -571,7 +577,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -590,8 +596,8 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,7 +611,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -624,8 +630,8 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +645,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -658,7 +664,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -672,7 +678,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -689,7 +695,7 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -704,7 +710,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -721,8 +727,8 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -736,7 +742,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -755,8 +761,8 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -770,7 +776,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -817,14 +823,19 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -836,9 +847,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -856,7 +867,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -866,15 +879,20 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -898,9 +916,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -918,11 +936,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1035,8 +1055,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2021_07_02.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. Default value is None. @@ -1060,14 +1080,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1088,7 +1108,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1100,22 +1120,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1138,9 +1165,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1157,7 +1184,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1246,7 +1275,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2021_07_02.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1267,14 +1296,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1294,7 +1323,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1306,21 +1335,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1332,9 +1368,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1360,12 +1396,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1391,13 +1429,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1415,7 +1453,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1427,9 +1465,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1445,10 +1485,15 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1462,16 +1507,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1479,13 +1531,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1499,7 +1551,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1517,10 +1569,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1535,16 +1592,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1552,13 +1616,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1572,7 +1636,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1589,14 +1655,19 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2021_07_02.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1608,9 +1679,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1628,7 +1699,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1652,10 +1725,15 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1671,16 +1749,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1688,13 +1773,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1708,7 +1793,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1736,10 +1823,15 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1756,16 +1848,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1773,13 +1872,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1793,7 +1892,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1817,14 +1918,19 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1838,9 +1944,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1858,7 +1964,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload def create_event_hub_consumer_group( @@ -1956,8 +2064,8 @@ def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1968,15 +2076,20 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2001,9 +2114,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2021,7 +2134,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -2045,14 +2160,19 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -2066,9 +2186,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2082,7 +2202,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2104,10 +2226,15 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2123,16 +2250,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2140,13 +2274,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2160,7 +2294,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2181,14 +2317,19 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2021_07_02.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2201,9 +2342,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2221,7 +2362,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2245,10 +2388,15 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2264,16 +2412,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2281,13 +2436,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2301,7 +2456,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2323,10 +2480,15 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2342,16 +2504,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2359,13 +2528,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2379,7 +2548,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2430,7 +2601,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2021_07_02.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2440,15 +2611,20 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2469,9 +2645,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2489,7 +2665,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2561,7 +2739,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_02.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2571,15 +2750,20 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2602,9 +2786,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2622,7 +2806,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2694,7 +2880,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2021_07_02.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2704,15 +2891,20 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2735,9 +2927,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2755,7 +2947,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2781,10 +2975,15 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2800,16 +2999,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2817,13 +3023,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2837,7 +3043,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2860,14 +3068,19 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2880,9 +3093,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2900,7 +3113,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -2991,7 +3206,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2021_07_02.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3002,15 +3217,20 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3033,9 +3253,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3053,7 +3273,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3144,7 +3366,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2021_07_02.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3155,15 +3377,20 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3186,9 +3413,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3206,4 +3433,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_operations.py index 8e70f6ab1795..f4f8e4164eeb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +91,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +112,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +136,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +156,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_endpoint_connections_operations.py index b141b446d40c..88c5e240ef34 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +61,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +99,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +120,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +178,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,14 +225,19 @@ def list( :rtype: list[~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -238,9 +249,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +269,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace def get( @@ -279,14 +292,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -299,9 +317,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,7 +337,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _update_initial( self, @@ -329,15 +349,20 @@ def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,9 +386,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,11 +406,13 @@ def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_update( @@ -492,7 +519,7 @@ def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_07_02.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -515,14 +542,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -543,7 +570,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -555,21 +582,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -582,9 +616,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -607,7 +641,9 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -640,13 +676,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -665,7 +701,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -677,6 +713,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_link_resources_operations.py index 63762ae3c9c5..8e169db5c8c0 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +59,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +91,7 @@ def build_get_request( "groupId": _SERIALIZER.url("group_id", group_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,14 +136,19 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.iothub.v2021_07_02.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -149,9 +160,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -169,7 +180,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace def get( @@ -190,14 +203,19 @@ def get( :rtype: ~azure.mgmt.iothub.v2021_07_02.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -210,9 +228,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,4 +248,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_resource_provider_common_operations.py index c9c4ef382645..9d94ff8cd072 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +52,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +93,19 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2021_07_02.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2021-07-02"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-02")) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +115,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +135,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/__init__.py index 6b2a2a8b0d68..c6c8f9fc0a14 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_configuration.py index e1805d0f2a82..782c0b0e6df4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-04-30-preview") # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop("api_version", "2022-04-30-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-iothub/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_iot_hub_client.py index e0472c913c1d..4af0eabfc212 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -74,7 +74,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -114,15 +114,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> IotHubClient + def __enter__(self) -> "IotHubClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_metadata.json index d33e1d2d37e4..1b7a1e109880 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The subscription identifier. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -105,4 +113,4 @@ "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_vendor.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_vendor.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_version.py index 6398307550c1..ee7fc9de5b4f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.3.0" +VERSION = "2.4.0b1" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/__init__.py index 5d9bb0b6c365..63c7f30f2936 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["IotHubClient"] +__all__ = [ + "IotHubClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_configuration.py index d3fcede05d64..f6b98771b263 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class IotHubClientConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IotHubClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-04-30-preview") # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop("api_version", "2022-04-30-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_iot_hub_client.py index 47d922cd7247..a4b2f43c178a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/_iot_hub_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import IotHubClientConfiguration from .operations import ( @@ -75,7 +75,7 @@ def __init__( self._config = IotHubClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -122,5 +122,5 @@ async def __aenter__(self) -> "IotHubClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_certificates_operations.py index b3d0d6abc7f9..40baabeb5669 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_verify_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,21 @@ async def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -92,9 +105,9 @@ async def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +125,9 @@ async def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace_async async def get( @@ -133,14 +148,21 @@ async def get( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +175,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +195,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload async def create_or_update( @@ -268,8 +292,8 @@ async def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -283,15 +307,22 @@ async def create_or_update( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -316,9 +347,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -336,11 +367,13 @@ async def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -363,14 +396,21 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -384,9 +424,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -400,7 +440,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace_async async def generate_verification_code( @@ -424,14 +466,21 @@ async def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -445,9 +494,9 @@ async def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -465,7 +514,9 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload async def verify( @@ -563,8 +614,8 @@ async def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -575,15 +626,22 @@ async def verify( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -608,9 +666,9 @@ async def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -628,4 +686,6 @@ async def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_operations.py index 11342fd1c2fc..20997c616d23 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._iot_hub_operations import build_manual_failover_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,15 +64,22 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,9 +102,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +118,9 @@ async def _manual_failover_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload async def begin_manual_failover( @@ -207,7 +222,7 @@ async def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2022_04_30_preview.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,12 +242,14 @@ async def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -252,7 +269,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -264,6 +281,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_resource_operations.py index 6d7dd2f8d504..31008e1f2883 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_iot_hub_resource_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,6 +57,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,14 +99,21 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -112,9 +125,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +145,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _create_or_update_initial( self, @@ -142,15 +157,22 @@ async def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +196,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -199,11 +221,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_create_or_update( @@ -312,8 +336,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required @@ -339,14 +363,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -367,7 +393,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -379,22 +405,31 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,9 +452,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -441,7 +476,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload async def begin_update( @@ -532,7 +569,7 @@ async def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2022_04_30_preview.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -554,14 +591,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -587,7 +626,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -599,21 +638,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -625,9 +673,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -658,12 +706,14 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace_async async def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[AsyncLROPoller[_models.IotHubDescription], AsyncLROPoller[_models.ErrorDetails]]: + ) -> AsyncLROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -691,13 +741,15 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -715,7 +767,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -727,9 +779,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDescription"]: @@ -746,10 +800,17 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IotHubDe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -763,16 +824,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -780,13 +848,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -800,7 +868,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group( @@ -821,10 +889,17 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -839,16 +914,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -856,13 +938,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -876,7 +958,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace_async async def get_stats( @@ -895,14 +979,21 @@ async def get_stats( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -914,9 +1005,9 @@ async def get_stats( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -934,7 +1025,9 @@ async def get_stats( return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -958,10 +1051,17 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -977,16 +1077,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -994,13 +1101,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1014,7 +1121,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1042,10 +1151,17 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1062,16 +1178,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1079,13 +1202,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1099,7 +1222,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace_async async def get_event_hub_consumer_group( @@ -1123,14 +1248,21 @@ async def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1144,9 +1276,9 @@ async def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1164,7 +1296,9 @@ async def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload async def create_event_hub_consumer_group( @@ -1262,8 +1396,8 @@ async def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1274,15 +1408,22 @@ async def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1307,9 +1448,9 @@ async def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1327,7 +1468,9 @@ async def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace_async async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -1351,14 +1494,21 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1372,9 +1522,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1388,7 +1538,9 @@ async def delete_event_hub_consumer_group( # pylint: disable=inconsistent-retur if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs( @@ -1413,10 +1565,17 @@ def list_jobs( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1432,16 +1591,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1449,13 +1615,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1469,7 +1635,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace_async async def get_job( @@ -1492,14 +1660,21 @@ async def get_job( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -1512,9 +1687,9 @@ async def get_job( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1532,7 +1707,9 @@ async def get_job( return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -1556,10 +1733,17 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1575,16 +1759,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1592,13 +1783,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1612,7 +1803,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -1635,10 +1828,17 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1654,16 +1854,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1671,13 +1878,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1691,7 +1898,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload async def check_name_availability( @@ -1742,7 +1951,7 @@ async def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2022_04_30_preview.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1752,15 +1961,22 @@ async def check_name_availability( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1781,9 +1997,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1801,7 +2017,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload async def test_all_routes( @@ -1873,7 +2091,8 @@ async def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1883,15 +2102,22 @@ async def test_all_routes( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1914,9 +2140,9 @@ async def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1934,7 +2160,9 @@ async def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload async def test_route( @@ -2006,7 +2234,8 @@ async def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2016,15 +2245,22 @@ async def test_route( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2047,9 +2283,9 @@ async def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2067,7 +2303,9 @@ async def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2093,10 +2331,17 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2112,16 +2357,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2129,13 +2381,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2149,7 +2401,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace_async async def get_keys_for_key_name( @@ -2172,14 +2426,21 @@ async def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2192,9 +2453,9 @@ async def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2212,7 +2473,9 @@ async def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload async def export_devices( @@ -2304,7 +2567,7 @@ async def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2022_04_30_preview.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2315,15 +2578,22 @@ async def export_devices( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2346,9 +2616,9 @@ async def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2366,7 +2636,9 @@ async def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload async def import_devices( @@ -2458,7 +2730,7 @@ async def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2022_04_30_preview.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2469,15 +2741,22 @@ async def import_devices( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2500,9 +2779,9 @@ async def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2520,4 +2799,6 @@ async def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_operations.py index ba68bacc048a..fce3ddb5f719 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -15,6 +16,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +70,17 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -80,16 +93,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -97,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -117,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_endpoint_connections_operations.py index 1295d4c847cd..886ffd50f969 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,14 +79,21 @@ async def list( :rtype: list[~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -92,9 +105,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +125,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -133,14 +148,21 @@ async def get( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -153,9 +175,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -173,7 +195,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _update_initial( self, @@ -183,15 +207,22 @@ async def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +246,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -240,11 +271,13 @@ async def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_update( @@ -351,7 +384,7 @@ async def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -374,14 +407,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -402,7 +437,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -414,21 +449,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -441,9 +485,9 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -471,7 +515,9 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -504,13 +550,15 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -529,7 +577,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -541,6 +589,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_link_resources_operations.py index a3d7fd1016f3..c35871464111 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,14 +70,21 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -83,9 +96,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +116,9 @@ async def list(self, resource_group_name: str, resource_name: str, **kwargs: Any return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -124,14 +139,21 @@ async def get( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -144,9 +166,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +186,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_resource_provider_common_operations.py index 8aebcdc7bc91..95a084daaf5f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/aio/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._resource_provider_common_operations import build_get_subscription_quota_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,14 +66,21 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -77,9 +90,9 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -97,4 +110,4 @@ async def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptio return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/__init__.py index 669dd46bf547..4e06d5a4da4c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/__init__.py @@ -117,7 +117,7 @@ from ._iot_hub_client_enums import RoutingStorageContainerPropertiesEncoding from ._iot_hub_client_enums import TestResultStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/_models_py3.py index a57fdd80d183..00a1e91a26c7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -59,8 +60,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.ArmUserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user @@ -99,7 +100,7 @@ class ArmUserIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -122,7 +123,7 @@ class CertificateBodyDescription(_serialization.Model): "is_verified": {"key": "isVerified", "type": "bool"}, } - def __init__(self, *, certificate: Optional[str] = None, is_verified: Optional[bool] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, is_verified: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem file content. @@ -168,7 +169,7 @@ class CertificateDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate. :paramtype properties: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateProperties @@ -192,7 +193,7 @@ class CertificateListDescription(_serialization.Model): "value": {"key": "value", "type": "[CertificateDescription]"}, } - def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CertificateDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of Certificate objects. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription] @@ -240,7 +241,7 @@ class CertificateProperties(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword is_verified: Determines whether certificate has been verified. :paramtype is_verified: bool @@ -258,7 +259,8 @@ def __init__(self, *, is_verified: Optional[bool] = None, certificate: Optional[ class CertificatePropertiesWithNonce(_serialization.Model): - """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + """The description of an X509 CA Certificate including the challenge nonce issued for the + Proof-Of-Possession flow. Variables are only populated by the server, and will be ignored when sending a request. @@ -303,7 +305,7 @@ class CertificatePropertiesWithNonce(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subject = None @@ -328,7 +330,7 @@ class CertificateVerificationDescription(_serialization.Model): "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs): + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file content. @@ -372,7 +374,7 @@ class CertificateWithNonceDescription(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.CertificatePropertiesWithNonce"] = None, **kwargs: Any) -> None: """ :keyword properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. @@ -418,8 +420,8 @@ def __init__( max_delivery_count: Optional[int] = None, default_ttl_as_iso8601: Optional[datetime.timedelta] = None, feedback: Optional["_models.FeedbackProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword max_delivery_count: The max delivery count for cloud-to-device messages in the device queue. See: @@ -458,8 +460,8 @@ def __init__( *, key_source: Optional[str] = None, key_vault_properties: Optional[List["_models.KeyVaultKeyProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_source: The source of the key. :paramtype key_source: str @@ -518,8 +520,8 @@ def __init__( last_known_error_time: Optional[datetime.datetime] = None, last_successful_send_attempt_time: Optional[datetime.datetime] = None, last_send_attempt_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoint_id: Id of the endpoint. :paramtype endpoint_id: str @@ -575,7 +577,7 @@ class EndpointHealthDataListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EndpointHealthData"]] = None, **kwargs: Any) -> None: """ :keyword value: JSON-serialized array of Endpoint health data. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.EndpointHealthData] @@ -611,7 +613,7 @@ class EnrichmentProperties(_serialization.Model): "endpoint_names": {"key": "endpointNames", "type": "[str]"}, } - def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs): + def __init__(self, *, key: str, value: str, endpoint_names: List[str], **kwargs: Any) -> None: """ :keyword key: The key or name for the enrichment property. Required. :paramtype key: str @@ -656,7 +658,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -682,7 +684,7 @@ class EventHubConsumerGroupBodyDescription(_serialization.Model): "properties": {"key": "properties", "type": "EventHubConsumerGroupName"}, } - def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs): + def __init__(self, *, properties: "_models.EventHubConsumerGroupName", **kwargs: Any) -> None: """ :keyword properties: The EventHub consumer group name. Required. :paramtype properties: ~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupName @@ -723,7 +725,7 @@ class EventHubConsumerGroupInfo(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword properties: The tags. :paramtype properties: dict[str, any] @@ -753,7 +755,7 @@ class EventHubConsumerGroupName(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: EventHub consumer group name. Required. :paramtype name: str @@ -782,7 +784,7 @@ class EventHubConsumerGroupsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.EventHubConsumerGroupInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: List of consumer groups objects. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupInfo] @@ -827,8 +829,8 @@ class EventHubProperties(_serialization.Model): } def __init__( - self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs - ): + self, *, retention_time_in_days: Optional[int] = None, partition_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword retention_time_in_days: The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. @@ -897,8 +899,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword export_blob_container_uri: The export blob container URI. Required. :paramtype export_blob_container_uri: str @@ -949,7 +951,7 @@ class FailoverInput(_serialization.Model): "failover_region": {"key": "failoverRegion", "type": "str"}, } - def __init__(self, *, failover_region: str, **kwargs): + def __init__(self, *, failover_region: str, **kwargs: Any) -> None: """ :keyword failover_region: Region the hub will be failed over to. Required. :paramtype failover_region: str @@ -959,7 +961,8 @@ def __init__(self, *, failover_region: str, **kwargs): class FallbackRouteProperties(_serialization.Model): - """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to + the fallback endpoint. All required parameters must be populated in order to send to Azure. @@ -1004,8 +1007,8 @@ def __init__( is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -1065,8 +1068,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -1117,7 +1120,7 @@ class GroupIdInformation(_serialization.Model): "properties": {"key": "properties", "type": "GroupIdInformationProperties"}, } - def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs): + def __init__(self, *, properties: "_models.GroupIdInformationProperties", **kwargs: Any) -> None: """ :keyword properties: The properties for a group information object. Required. :paramtype properties: @@ -1153,8 +1156,8 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_id: The group id. :paramtype group_id: str @@ -1223,8 +1226,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, include_configurations: Optional[bool] = None, configurations_blob_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword input_blob_container_uri: The input blob container URI. Required. :paramtype input_blob_container_uri: str @@ -1289,7 +1292,7 @@ class IotHubCapacity(_serialization.Model): "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.minimum = None @@ -1332,7 +1335,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1408,8 +1411,8 @@ def __init__( etag: Optional[str] = None, properties: Optional["_models.IotHubProperties"] = None, identity: Optional["_models.ArmIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The resource location. Required. :paramtype location: str @@ -1453,7 +1456,7 @@ class IotHubDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubDescription objects. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubDescription] @@ -1485,8 +1488,8 @@ def __init__( *, location: Optional[str] = None, role: Optional[Union[str, "_models.IotHubReplicaRoleType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The name of the Azure region. :paramtype location: str @@ -1526,7 +1529,7 @@ class IotHubNameAvailabilityInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: The detailed reason message. :paramtype message: str @@ -1690,8 +1693,8 @@ def __init__( # pylint: disable=too-many-locals encryption: Optional["_models.EncryptionPropertiesDescription"] = None, enable_data_residency: Optional[bool] = None, root_certificate: Optional["_models.RootCertificateProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. @@ -1810,7 +1813,7 @@ class IotHubPropertiesDeviceStreams(_serialization.Model): "streaming_endpoints": {"key": "streamingEndpoints", "type": "[str]"}, } - def __init__(self, *, streaming_endpoints: Optional[List[str]] = None, **kwargs): + def __init__(self, *, streaming_endpoints: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword streaming_endpoints: List of Device Streams Endpoints. :paramtype streaming_endpoints: list[str] @@ -1844,7 +1847,7 @@ class IotHubQuotaMetricInfo(_serialization.Model): "max_value": {"key": "maxValue", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1872,7 +1875,7 @@ class IotHubQuotaMetricInfoListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubQuotaMetricInfo"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of quota metrics objects. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubQuotaMetricInfo] @@ -1909,7 +1912,7 @@ class IotHubSkuDescription(_serialization.Model): "capacity": {"key": "capacity", "type": "IotHubCapacity"}, } - def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs): + def __init__(self, *, sku: "_models.IotHubSkuInfo", capacity: "_models.IotHubCapacity", **kwargs: Any) -> None: """ :keyword sku: The type of the resource. Required. :paramtype sku: ~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubSkuInfo @@ -1942,7 +1945,7 @@ class IotHubSkuDescriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.IotHubSkuDescription"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of IotHubSkuDescription. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubSkuDescription] @@ -1981,7 +1984,7 @@ class IotHubSkuInfo(_serialization.Model): "capacity": {"key": "capacity", "type": "int"}, } - def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs): + def __init__(self, *, name: Union[str, "_models.IotHubSku"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The name of the SKU. Required. Known values are: "F1", "S1", "S2", "S3", "B1", "B2", and "B3". @@ -2023,7 +2026,9 @@ class IpFilterRule(_serialization.Model): "ip_mask": {"key": "ipMask", "type": "str"}, } - def __init__(self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs): + def __init__( + self, *, filter_name: str, action: Union[str, "_models.IpFilterActionType"], ip_mask: str, **kwargs: Any + ) -> None: """ :keyword filter_name: The name of the IP filter rule. Required. :paramtype filter_name: str @@ -2088,7 +2093,7 @@ class JobResponse(_serialization.Model): "parent_job_id": {"key": "parentJobId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.job_id = None @@ -2121,7 +2126,7 @@ class JobResponseListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobResponse"]] = None, **kwargs: Any) -> None: """ :keyword value: The array of JobResponse objects. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.JobResponse] @@ -2146,8 +2151,12 @@ class KeyVaultKeyProperties(_serialization.Model): } def __init__( - self, *, key_identifier: Optional[str] = None, identity: Optional["_models.ManagedIdentity"] = None, **kwargs - ): + self, + *, + key_identifier: Optional[str] = None, + identity: Optional["_models.ManagedIdentity"] = None, + **kwargs: Any + ) -> None: """ :keyword key_identifier: The identifier of the key. :paramtype key_identifier: str @@ -2170,7 +2179,7 @@ class ManagedIdentity(_serialization.Model): "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: The user assigned identity. :paramtype user_assigned_identity: str @@ -2190,7 +2199,7 @@ class MatchedRoute(_serialization.Model): "properties": {"key": "properties", "type": "RouteProperties"}, } - def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RouteProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of routes that matched. :paramtype properties: ~azure.mgmt.iothub.v2022_04_30_preview.models.RouteProperties @@ -2230,8 +2239,8 @@ def __init__( lock_duration_as_iso8601: Optional[datetime.timedelta] = None, ttl_as_iso8601: Optional[datetime.timedelta] = None, max_delivery_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -2264,7 +2273,7 @@ class Name(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: IotHub type. :paramtype value: str @@ -2302,8 +2311,13 @@ class NetworkRuleSetIpRule(_serialization.Model): } def __init__( - self, *, filter_name: str, ip_mask: str, action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", **kwargs - ): + self, + *, + filter_name: str, + ip_mask: str, + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword filter_name: Name of the IP filter rule. Required. :paramtype filter_name: str @@ -2351,8 +2365,8 @@ def __init__( apply_to_built_in_event_hub_endpoint: bool, ip_rules: List["_models.NetworkRuleSetIpRule"], default_action: Union[str, "_models.DefaultAction"] = "Deny", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_action: Default Action for Network Rule Set. Known values are: "Deny" and "Allow". @@ -2389,7 +2403,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.iothub.v2022_04_30_preview.models.OperationDisplay @@ -2428,7 +2442,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2454,7 +2468,7 @@ class OperationInputs(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name of the IoT hub to check. Required. :paramtype name: str @@ -2464,7 +2478,8 @@ def __init__(self, *, name: str, **kwargs): class OperationListResult(_serialization.Model): - """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -2484,7 +2499,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2508,7 +2523,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2546,7 +2561,7 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs): + def __init__(self, *, properties: "_models.PrivateEndpointConnectionProperties", **kwargs: Any) -> None: """ :keyword properties: The properties of a private endpoint connection. Required. :paramtype properties: @@ -2589,8 +2604,8 @@ def __init__( *, private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", private_endpoint: Optional["_models.PrivateEndpoint"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint property of a private endpoint connection. :paramtype private_endpoint: ~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateEndpoint @@ -2615,7 +2630,7 @@ class PrivateLinkResources(_serialization.Model): "value": {"key": "value", "type": "[GroupIdInformation]"}, } - def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GroupIdInformation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available private link resources for an IotHub. :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.GroupIdInformation] @@ -2657,8 +2672,8 @@ def __init__( status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: str, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of a private endpoint connection. Required. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". @@ -2701,7 +2716,7 @@ class RegistryStatistics(_serialization.Model): "disabled_device_count": {"key": "disabledDeviceCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.total_device_count = None @@ -2730,7 +2745,7 @@ class RootCertificateProperties(_serialization.Model): "last_updated_time_utc": {"key": "lastUpdatedTimeUtc", "type": "iso-8601"}, } - def __init__(self, *, enable_root_certificate_v2: Optional[bool] = None, **kwargs): + def __init__(self, *, enable_root_certificate_v2: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enable_root_certificate_v2: This property when set to true, hub will use G2 cert; while it's set to false, hub uses Baltimore Cert. @@ -2764,8 +2779,8 @@ def __init__( message: Optional[str] = None, severity: Optional[Union[str, "_models.RouteErrorSeverity"]] = None, location: Optional["_models.RouteErrorRange"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Route error message. :paramtype message: str @@ -2794,7 +2809,7 @@ class RouteErrorPosition(_serialization.Model): "column": {"key": "column", "type": "int"}, } - def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs): + def __init__(self, *, line: Optional[int] = None, column: Optional[int] = None, **kwargs: Any) -> None: """ :keyword line: Line where the route error happened. :paramtype line: int @@ -2825,8 +2840,8 @@ def __init__( *, start: Optional["_models.RouteErrorPosition"] = None, end: Optional["_models.RouteErrorPosition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start: Start where the route error happened. :paramtype start: ~azure.mgmt.iothub.v2022_04_30_preview.models.RouteErrorPosition @@ -2885,8 +2900,8 @@ def __init__( endpoint_names: List[str], is_enabled: bool, condition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. @@ -2999,8 +3014,8 @@ def __init__( secondary_key: Optional[str] = None, partition_key_name: Optional[str] = None, partition_key_template: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The @@ -3058,7 +3073,9 @@ def __init__( class RoutingEndpoints(_serialization.Model): - """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + """The properties related to the custom endpoints to which your IoT hub routes messages based on + the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for + paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. :ivar service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -3098,8 +3115,8 @@ def __init__( event_hubs: Optional[List["_models.RoutingEventHubProperties"]] = None, storage_containers: Optional[List["_models.RoutingStorageContainerProperties"]] = None, cosmos_db_sql_collections: Optional[List["_models.RoutingCosmosDBSqlApiProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. @@ -3188,8 +3205,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the event hub endpoint. :paramtype id: str @@ -3250,8 +3267,8 @@ def __init__( body: Optional[str] = None, app_properties: Optional[Dict[str, str]] = None, system_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword body: Body of routing message. :paramtype body: str @@ -3267,7 +3284,8 @@ def __init__( class RoutingProperties(_serialization.Model): - """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + """The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. :ivar endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -3302,8 +3320,8 @@ def __init__( routes: Optional[List["_models.RouteProperties"]] = None, fallback_route: Optional["_models.FallbackRouteProperties"] = None, enrichments: Optional[List["_models.EnrichmentProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all @@ -3392,8 +3410,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus queue endpoint. :paramtype id: str @@ -3492,8 +3510,8 @@ def __init__( identity: Optional["_models.ManagedIdentity"] = None, subscription_id: Optional[str] = None, resource_group: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the service bus topic endpoint. :paramtype id: str @@ -3617,8 +3635,8 @@ def __init__( batch_frequency_in_seconds: Optional[int] = None, max_chunk_size_in_bytes: Optional[int] = None, encoding: Optional[Union[str, "_models.RoutingStorageContainerPropertiesEncoding"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the storage container endpoint. :paramtype id: str @@ -3690,8 +3708,12 @@ class RoutingTwin(_serialization.Model): } def __init__( - self, *, tags: Optional[JSON] = None, properties: Optional["_models.RoutingTwinProperties"] = None, **kwargs - ): + self, + *, + tags: Optional[JSON] = None, + properties: Optional["_models.RoutingTwinProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Twin Tags. :paramtype tags: JSON @@ -3717,7 +3739,7 @@ class RoutingTwinProperties(_serialization.Model): "reported": {"key": "reported", "type": "object"}, } - def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs): + def __init__(self, *, desired: Optional[JSON] = None, reported: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword desired: Twin desired properties. :paramtype desired: JSON @@ -3769,8 +3791,8 @@ def __init__( rights: Union[str, "_models.AccessRights"], primary_key: Optional[str] = None, secondary_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the shared access policy. Required. :paramtype key_name: str @@ -3815,7 +3837,9 @@ class SharedAccessSignatureAuthorizationRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SharedAccessSignatureAuthorizationRule"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of shared access policies. :paramtype value: @@ -3870,8 +3894,8 @@ def __init__( sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, authentication_type: Optional[Union[str, "_models.AuthenticationType"]] = None, identity: Optional["_models.ManagedIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: @@ -3936,8 +3960,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -3965,7 +3989,8 @@ def __init__( class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + """A container holding only the Tags for a resource, allowing the user to update the tags on an + IoT Hub instance. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -3975,7 +4000,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -4009,8 +4034,8 @@ def __init__( routing_source: Optional[Union[str, "_models.RoutingSource"]] = None, message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword routing_source: Routing source. Known values are: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", @@ -4038,7 +4063,7 @@ class TestAllRoutesResult(_serialization.Model): "routes": {"key": "routes", "type": "[MatchedRoute]"}, } - def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs): + def __init__(self, *, routes: Optional[List["_models.MatchedRoute"]] = None, **kwargs: Any) -> None: """ :keyword routes: JSON-serialized array of matched routes. :paramtype routes: list[~azure.mgmt.iothub.v2022_04_30_preview.models.MatchedRoute] @@ -4076,8 +4101,8 @@ def __init__( route: "_models.RouteProperties", message: Optional["_models.RoutingMessage"] = None, twin: Optional["_models.RoutingTwin"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Routing message. :paramtype message: ~azure.mgmt.iothub.v2022_04_30_preview.models.RoutingMessage @@ -4111,8 +4136,8 @@ def __init__( *, result: Optional[Union[str, "_models.TestResultStatus"]] = None, details: Optional["_models.TestRouteResultDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword result: Result of testing route. Known values are: "undefined", "false", and "true". :paramtype result: str or ~azure.mgmt.iothub.v2022_04_30_preview.models.TestResultStatus @@ -4136,7 +4161,9 @@ class TestRouteResultDetails(_serialization.Model): "compilation_errors": {"key": "compilationErrors", "type": "[RouteCompilationError]"}, } - def __init__(self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs): + def __init__( + self, *, compilation_errors: Optional[List["_models.RouteCompilationError"]] = None, **kwargs: Any + ) -> None: """ :keyword compilation_errors: JSON-serialized list of route compilation errors. :paramtype compilation_errors: @@ -4181,8 +4208,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.Name"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: IotHub type id. :paramtype id: str @@ -4226,7 +4253,7 @@ class UserSubscriptionQuotaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UserSubscriptionQuota"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.iothub.v2022_04_30_preview.models.UserSubscriptionQuota] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/__init__.py index 901e21834b4d..96fcc782e2e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/__init__.py @@ -15,7 +15,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_certificates_operations.py index 038dca3da852..d6ee9d4c78ee 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_certificates_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_by_iot_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +61,7 @@ def build_list_by_iot_hub_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +78,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +97,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,8 +120,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +140,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +167,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +186,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,7 +210,9 @@ def build_generate_verification_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +229,7 @@ def build_generate_verification_code_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,8 +253,10 @@ def build_verify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,7 +273,7 @@ def build_verify_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,14 +323,21 @@ def list_by_iot_hub( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateListDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.CertificateListDescription] = kwargs.pop("cls", None) request = build_list_by_iot_hub_request( resource_group_name=resource_group_name, @@ -324,9 +349,9 @@ def list_by_iot_hub( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +369,9 @@ def list_by_iot_hub( return deserialized - list_by_iot_hub.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates"} # type: ignore + list_by_iot_hub.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + } @distributed_trace def get( @@ -365,14 +392,21 @@ def get( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +419,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,7 +439,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @overload def create_or_update( @@ -500,8 +536,8 @@ def create_or_update( :type resource_name: str :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_description: The certificate body. Is either a model type or a IO type. - Required. + :param certificate_description: The certificate body. Is either a CertificateDescription type + or a IO type. Required. :type certificate_description: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription or IO :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. @@ -515,15 +551,22 @@ def create_or_update( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -548,9 +591,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -568,11 +611,13 @@ def create_or_update( deserialized = self._deserialize("CertificateDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -595,14 +640,21 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -616,9 +668,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -632,7 +684,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + } @distributed_trace def generate_verification_code( @@ -656,14 +710,21 @@ def generate_verification_code( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateWithNonceDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateWithNonceDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.CertificateWithNonceDescription] = kwargs.pop("cls", None) request = build_generate_verification_code_request( resource_group_name=resource_group_name, @@ -677,9 +738,9 @@ def generate_verification_code( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -697,7 +758,9 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore + generate_verification_code.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + } @overload def verify( @@ -795,8 +858,8 @@ def verify( :type certificate_name: str :param if_match: ETag of the Certificate. Required. :type if_match: str - :param certificate_verification_body: The name of the certificate. Is either a model type or a - IO type. Required. + :param certificate_verification_body: The name of the certificate. Is either a + CertificateVerificationDescription type or a IO type. Required. :type certificate_verification_body: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateVerificationDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -807,15 +870,22 @@ def verify( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.CertificateDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -840,9 +910,9 @@ def verify( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -860,4 +930,6 @@ def verify( return deserialized - verify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify"} # type: ignore + verify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_operations.py index 4d67512d95d7..7ce1b4e6d122 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,8 +47,10 @@ def build_manual_failover_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +64,7 @@ def build_manual_failover_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,15 +103,22 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements failover_input: Union[_models.FailoverInput, IO], **kwargs: Any ) -> None: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,9 +141,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -142,7 +157,9 @@ def _manual_failover_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _manual_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + _manual_failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } @overload def begin_manual_failover( @@ -244,7 +261,7 @@ def begin_manual_failover( :type resource_group_name: str :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see - https://aka.ms/manualfailover/region. Is either a model type or a IO type. Required. + https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required. :type failover_input: ~azure.mgmt.iothub.v2022_04_30_preview.models.FailoverInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,12 +281,14 @@ def begin_manual_failover( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._manual_failover_initial( # type: ignore iot_hub_name=iot_hub_name, @@ -289,7 +308,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -301,6 +320,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_manual_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"} # type: ignore + begin_manual_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_resource_operations.py index 0c1e9f0b522d..84afe2a398e5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_iot_hub_resource_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -30,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,9 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +63,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +80,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +97,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +118,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +135,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +154,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +170,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +185,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +196,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +211,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +226,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,7 +243,9 @@ def build_get_stats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +259,7 @@ def build_get_stats_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +276,9 @@ def build_get_valid_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +292,7 @@ def build_get_valid_skus_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +309,9 @@ def build_list_event_hub_consumer_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +326,7 @@ def build_list_event_hub_consumer_groups_request( "eventHubEndpointName": _SERIALIZER.url("event_hub_endpoint_name", event_hub_endpoint_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +348,9 @@ def build_get_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +366,7 @@ def build_get_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,8 +388,10 @@ def build_create_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +407,7 @@ def build_create_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -403,7 +431,9 @@ def build_delete_event_hub_consumer_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +449,7 @@ def build_delete_event_hub_consumer_group_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -436,7 +466,9 @@ def build_list_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -450,7 +482,7 @@ def build_list_jobs_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -467,7 +499,9 @@ def build_get_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,7 +516,7 @@ def build_get_job_request( "jobId": _SERIALIZER.url("job_id", job_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -499,7 +533,9 @@ def build_get_quota_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -513,7 +549,7 @@ def build_get_quota_metrics_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -530,7 +566,9 @@ def build_get_endpoint_health_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -544,7 +582,7 @@ def build_get_endpoint_health_request( "iotHubName": _SERIALIZER.url("iot_hub_name", iot_hub_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -559,8 +597,10 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -571,7 +611,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -590,8 +630,10 @@ def build_test_all_routes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,7 +647,7 @@ def build_test_all_routes_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -624,8 +666,10 @@ def build_test_route_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +683,7 @@ def build_test_route_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -658,7 +702,9 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -672,7 +718,7 @@ def build_list_keys_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -689,7 +735,9 @@ def build_get_keys_for_key_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -704,7 +752,7 @@ def build_get_keys_for_key_name_request( "keyName": _SERIALIZER.url("key_name", key_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -721,8 +769,10 @@ def build_export_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -736,7 +786,7 @@ def build_export_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -755,8 +805,10 @@ def build_import_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -770,7 +822,7 @@ def build_import_devices_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -817,14 +869,21 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubDescription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -836,9 +895,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -856,7 +915,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _create_or_update_initial( self, @@ -866,15 +927,22 @@ def _create_or_update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -898,9 +966,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -923,11 +991,13 @@ def _create_or_update_initial( deserialized = self._deserialize("IotHubDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_create_or_update( @@ -1036,8 +1106,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the IoT hub. Required. :type resource_name: str - :param iot_hub_description: The IoT hub metadata and security metadata. Is either a model type - or a IO type. Required. + :param iot_hub_description: The IoT hub metadata and security metadata. Is either a + IotHubDescription type or a IO type. Required. :type iot_hub_description: ~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubDescription or IO :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required @@ -1063,14 +1133,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_description=iot_hub_description, @@ -1091,7 +1163,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1103,22 +1175,31 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _update_initial( self, resource_group_name: str, resource_name: str, iot_hub_tags: Union[_models.TagsResource, IO], **kwargs: Any ) -> _models.IotHubDescription: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1141,9 +1222,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1165,7 +1246,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @overload def begin_update( @@ -1256,7 +1339,7 @@ def begin_update( :param resource_name: Name of iot hub to update. Required. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. Is either a - model type or a IO type. Required. + TagsResource type or a IO type. Required. :type iot_hub_tags: ~azure.mgmt.iothub.v2022_04_30_preview.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1278,14 +1361,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, iot_hub_tags=iot_hub_tags, @@ -1311,7 +1396,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1323,21 +1408,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> Union[_models.IotHubDescription, _models.ErrorDetails]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[Union[_models.IotHubDescription, _models.ErrorDetails]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1349,9 +1443,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1382,12 +1476,14 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def begin_delete( self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Union[LROPoller[_models.IotHubDescription], LROPoller[_models.ErrorDetails]]: + ) -> LROPoller[_models.IotHubDescription]: """Delete an IoT hub. Delete an IoT hub. @@ -1414,13 +1510,15 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, @@ -1438,7 +1536,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1450,9 +1548,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1469,10 +1569,17 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IotHubDescrip _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1486,16 +1593,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1503,13 +1617,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1523,7 +1637,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IotHubDescription"]: @@ -1542,10 +1656,17 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1560,16 +1681,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1577,13 +1705,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1597,7 +1725,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + } @distributed_trace def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.RegistryStatistics: @@ -1614,14 +1744,21 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.RegistryStatistics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegistryStatistics] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.RegistryStatistics] = kwargs.pop("cls", None) request = build_get_stats_request( resource_group_name=resource_group_name, @@ -1633,9 +1770,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1653,7 +1790,9 @@ def get_stats(self, resource_group_name: str, resource_name: str, **kwargs: Any) return deserialized - get_stats.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats"} # type: ignore + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + } @distributed_trace def get_valid_skus( @@ -1677,10 +1816,17 @@ def get_valid_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubSkuDescriptionListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubSkuDescriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1696,16 +1842,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1713,13 +1866,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubSkuDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1733,7 +1886,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_valid_skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus"} # type: ignore + get_valid_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + } @distributed_trace def list_event_hub_consumer_groups( @@ -1761,10 +1916,17 @@ def list_event_hub_consumer_groups( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupsListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -1781,16 +1943,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1798,13 +1967,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubConsumerGroupsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1818,7 +1987,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_event_hub_consumer_groups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups"} # type: ignore + list_event_hub_consumer_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + } @distributed_trace def get_event_hub_consumer_group( @@ -1842,14 +2013,21 @@ def get_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) request = build_get_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -1863,9 +2041,9 @@ def get_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1883,7 +2061,9 @@ def get_event_hub_consumer_group( return deserialized - get_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + get_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @overload def create_event_hub_consumer_group( @@ -1981,8 +2161,8 @@ def create_event_hub_consumer_group( :type event_hub_endpoint_name: str :param name: The name of the consumer group to add. Required. :type name: str - :param consumer_group_body: The consumer group to add. Is either a model type or a IO type. - Required. + :param consumer_group_body: The consumer group to add. Is either a + EventHubConsumerGroupBodyDescription type or a IO type. Required. :type consumer_group_body: ~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupBodyDescription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1993,15 +2173,22 @@ def create_event_hub_consumer_group( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.EventHubConsumerGroupInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EventHubConsumerGroupInfo] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EventHubConsumerGroupInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2026,9 +2213,9 @@ def create_event_hub_consumer_group( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2046,7 +2233,9 @@ def create_event_hub_consumer_group( return deserialized - create_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + create_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-statements @@ -2070,14 +2259,21 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_event_hub_consumer_group_request( resource_group_name=resource_group_name, @@ -2091,9 +2287,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2107,7 +2303,9 @@ def delete_event_hub_consumer_group( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_event_hub_consumer_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"} # type: ignore + delete_event_hub_consumer_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + } @distributed_trace def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.JobResponse"]: @@ -2129,10 +2327,17 @@ def list_jobs(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponseListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.JobResponseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2148,16 +2353,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2165,13 +2377,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResponseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2185,7 +2397,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_jobs.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs"} # type: ignore + list_jobs.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + } @distributed_trace def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **kwargs: Any) -> _models.JobResponse: @@ -2206,14 +2420,21 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) request = build_get_job_request( resource_group_name=resource_group_name, @@ -2226,9 +2447,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2246,7 +2467,9 @@ def get_job(self, resource_group_name: str, resource_name: str, job_id: str, **k return deserialized - get_job.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}"} # type: ignore + get_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + } @distributed_trace def get_quota_metrics( @@ -2270,10 +2493,17 @@ def get_quota_metrics( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubQuotaMetricInfoListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.IotHubQuotaMetricInfoListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2289,16 +2519,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2306,13 +2543,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IotHubQuotaMetricInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2326,7 +2563,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_quota_metrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics"} # type: ignore + get_quota_metrics.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + } @distributed_trace def get_endpoint_health( @@ -2349,10 +2588,17 @@ def get_endpoint_health( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointHealthDataListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.EndpointHealthDataListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2368,16 +2614,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2385,13 +2638,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointHealthDataListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2405,7 +2658,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_endpoint_health.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth"} # type: ignore + get_endpoint_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + } @overload def check_name_availability( @@ -2456,7 +2711,7 @@ def check_name_availability( Check if an IoT hub name is available. :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of - the IoT hub to check. Is either a model type or a IO type. Required. + the IoT hub to check. Is either a OperationInputs type or a IO type. Required. :type operation_inputs: ~azure.mgmt.iothub.v2022_04_30_preview.models.OperationInputs or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2466,15 +2721,22 @@ def check_name_availability( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.IotHubNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IotHubNameAvailabilityInfo] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IotHubNameAvailabilityInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2495,9 +2757,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2515,7 +2777,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + } @overload def test_all_routes( @@ -2587,7 +2851,8 @@ def test_all_routes( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Input for testing all routes. Is either a model type or a IO type. Required. + :param input: Input for testing all routes. Is either a TestAllRoutesInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestAllRoutesInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2597,15 +2862,22 @@ def test_all_routes( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestAllRoutesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestAllRoutesResult] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestAllRoutesResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2628,9 +2900,9 @@ def test_all_routes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2648,7 +2920,9 @@ def test_all_routes( return deserialized - test_all_routes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall"} # type: ignore + test_all_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + } @overload def test_route( @@ -2720,7 +2994,8 @@ def test_route( :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to. Required. :type resource_group_name: str - :param input: Route that needs to be tested. Is either a model type or a IO type. Required. + :param input: Route that needs to be tested. Is either a TestRouteInput type or a IO type. + Required. :type input: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestRouteInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2730,15 +3005,22 @@ def test_route( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.TestRouteResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestRouteResult] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestRouteResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2761,9 +3043,9 @@ def test_route( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2781,7 +3063,9 @@ def test_route( return deserialized - test_route.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew"} # type: ignore + test_route.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + } @distributed_trace def list_keys( @@ -2807,10 +3091,17 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -2826,16 +3117,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2843,13 +3141,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessSignatureAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2863,7 +3161,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + } @distributed_trace def get_keys_for_key_name( @@ -2886,14 +3186,21 @@ def get_keys_for_key_name( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.SharedAccessSignatureAuthorizationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SharedAccessSignatureAuthorizationRule] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.SharedAccessSignatureAuthorizationRule] = kwargs.pop("cls", None) request = build_get_keys_for_key_name_request( resource_group_name=resource_group_name, @@ -2906,9 +3213,9 @@ def get_keys_for_key_name( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2926,7 +3233,9 @@ def get_keys_for_key_name( return deserialized - get_keys_for_key_name.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys"} # type: ignore + get_keys_for_key_name.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + } @overload def export_devices( @@ -3018,7 +3327,7 @@ def export_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. Is - either a model type or a IO type. Required. + either a ExportDevicesRequest type or a IO type. Required. :type export_devices_parameters: ~azure.mgmt.iothub.v2022_04_30_preview.models.ExportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3029,15 +3338,22 @@ def export_devices( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3060,9 +3376,9 @@ def export_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3080,7 +3396,9 @@ def export_devices( return deserialized - export_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices"} # type: ignore + export_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + } @overload def import_devices( @@ -3172,7 +3490,7 @@ def import_devices( :param resource_name: The name of the IoT hub. Required. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. Is - either a model type or a IO type. Required. + either a ImportDevicesRequest type or a IO type. Required. :type import_devices_parameters: ~azure.mgmt.iothub.v2022_04_30_preview.models.ImportDevicesRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3183,15 +3501,22 @@ def import_devices( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.JobResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResponse] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3214,9 +3539,9 @@ def import_devices( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3234,4 +3559,6 @@ def import_devices( return deserialized - import_devices.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices"} # type: ignore + import_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_operations.py index 7f7ecb87b2c6..353b2daeafc9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_operations.py @@ -6,14 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,10 +93,17 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): @@ -101,16 +116,23 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +140,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,4 +160,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Devices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Devices/operations"} diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_endpoint_connections_operations.py index b0dd3777eb28..b3b8335665d0 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +63,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +84,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +103,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +124,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +144,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +167,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +186,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,14 +233,21 @@ def list( :rtype: list[~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.PrivateEndpointConnection]] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -238,9 +259,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,7 +279,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + } @distributed_trace def get( @@ -279,14 +302,21 @@ def get( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -299,9 +329,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,7 +349,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _update_initial( self, @@ -329,15 +361,22 @@ def _update_initial( private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,9 +400,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -386,11 +425,13 @@ def _update_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_update( @@ -497,7 +538,7 @@ def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. Is - either a model type or a IO type. Required. + either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -520,14 +561,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -548,7 +591,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -560,21 +603,30 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -587,9 +639,9 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -617,7 +669,9 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -650,13 +704,15 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -675,7 +731,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -687,6 +743,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_link_resources_operations.py index 96d954bdfb29..6ea1b36e6e7c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +45,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +61,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +78,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +95,7 @@ def build_get_request( "groupId": _SERIALIZER.url("group_id", group_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,14 +140,21 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.PrivateLinkResources :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResources] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -149,9 +166,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -169,7 +186,9 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _ return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + } @distributed_trace def get( @@ -190,14 +209,21 @@ def get( :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.GroupIdInformation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GroupIdInformation] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -210,9 +236,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,4 +256,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + } diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_resource_provider_common_operations.py index 7f81da914c21..1d94643b0930 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2022_04_30_preview/operations/_resource_provider_common_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -13,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +43,9 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +54,7 @@ def build_get_subscription_quota_request(subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,14 +95,21 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota :rtype: ~azure.mgmt.iothub.v2022_04_30_preview.models.UserSubscriptionQuotaListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-30-preview")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserSubscriptionQuotaListResult] + api_version: Literal["2022-04-30-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-04-30-preview") + ) + cls: ClsType[_models.UserSubscriptionQuotaListResult] = kwargs.pop("cls", None) request = build_get_subscription_quota_request( subscription_id=self._config.subscription_id, @@ -104,9 +119,9 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +139,4 @@ def get_subscription_quota(self, **kwargs: Any) -> _models.UserSubscriptionQuota return deserialized - get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} # type: ignore + get_subscription_quota.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages"} diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/check_name_availability.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/check_name_availability.py new file mode 100644 index 000000000000..8b32af7ea0dc --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/check_name_availability.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python check_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.check_name_availability( + operation_inputs={"name": "test-request"}, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/checkNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iot_hub_manual_failover.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iot_hub_manual_failover.py new file mode 100644 index 000000000000..071b2a1672d7 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iot_hub_manual_failover.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iot_hub_manual_failover.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub.begin_manual_failover( + iot_hub_name="testHub", + resource_group_name="myResourceGroup", + failover_input={"failoverRegion": "testHub"}, + ).result() + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/IotHub_ManualFailover.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certificatescreateorupdate.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certificatescreateorupdate.py new file mode 100644 index 000000000000..36df11e9d706 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certificatescreateorupdate.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_certificatescreateorupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.certificates.create_or_update( + resource_group_name="myResourceGroup", + resource_name="iothub", + certificate_name="cert", + certificate_description={"properties": {"certificate": "############################################"}}, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_certificatescreateorupdate.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certificatesdelete.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certificatesdelete.py new file mode 100644 index 000000000000..c08c1cf420da --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certificatesdelete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_certificatesdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.certificates.delete( + resource_group_name="myResourceGroup", + resource_name="myhub", + certificate_name="cert", + if_match="AAAAAAAADGk=", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_certificatesdelete.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certverify.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certverify.py new file mode 100644 index 000000000000..87093137fdea --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_certverify.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_certverify.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.certificates.verify( + resource_group_name="myResourceGroup", + resource_name="myFirstProvisioningService", + certificate_name="cert", + if_match="AAAAAAAADGk=", + certificate_verification_body={"certificate": "#####################################"}, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_certverify.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_create_or_update.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_create_or_update.py new file mode 100644 index 000000000000..3534680fb04f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_create_or_update.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.begin_create_or_update( + resource_group_name="myResourceGroup", + resource_name="testHub", + iot_hub_description={ + "etag": "AAAAAAFD6M4=", + "location": "centraluseuap", + "properties": { + "cloudToDevice": { + "defaultTtlAsIso8601": "PT1H", + "feedback": {"lockDurationAsIso8601": "PT1M", "maxDeliveryCount": 10, "ttlAsIso8601": "PT1H"}, + "maxDeliveryCount": 10, + }, + "enableDataResidency": False, + "enableFileUploadNotifications": False, + "eventHubEndpoints": {"events": {"partitionCount": 2, "retentionTimeInDays": 1}}, + "features": "None", + "ipFilterRules": [], + "messagingEndpoints": { + "fileNotifications": { + "lockDurationAsIso8601": "PT1M", + "maxDeliveryCount": 10, + "ttlAsIso8601": "PT1H", + } + }, + "minTlsVersion": "1.2", + "networkRuleSets": { + "applyToBuiltInEventHubEndpoint": True, + "defaultAction": "Deny", + "ipRules": [ + {"action": "Allow", "filterName": "rule1", "ipMask": "131.117.159.53"}, + {"action": "Allow", "filterName": "rule2", "ipMask": "157.55.59.128/25"}, + ], + }, + "routing": { + "endpoints": { + "eventHubs": [], + "serviceBusQueues": [], + "serviceBusTopics": [], + "storageContainers": [], + }, + "fallbackRoute": { + "condition": "true", + "endpointNames": ["events"], + "isEnabled": True, + "name": "$fallback", + "source": "DeviceMessages", + }, + "routes": [], + }, + "storageEndpoints": { + "$default": {"connectionString": "", "containerName": "", "sasTtlAsIso8601": "PT1H"} + }, + }, + "sku": {"capacity": 1, "name": "S1"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_createconsumergroup.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_createconsumergroup.py new file mode 100644 index 000000000000..babdce6a4d9b --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_createconsumergroup.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_createconsumergroup.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.create_event_hub_consumer_group( + resource_group_name="myResourceGroup", + resource_name="testHub", + event_hub_endpoint_name="events", + name="test", + consumer_group_body={"properties": {"name": "test"}}, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_createconsumergroup.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_delete.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_delete.py new file mode 100644 index 000000000000..b34bb51968cb --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.begin_delete( + resource_group_name="myResourceGroup", + resource_name="testHub", + ).result() + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_delete.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_deleteconsumergroup.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_deleteconsumergroup.py new file mode 100644 index 000000000000..031aa4c9f71f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_deleteconsumergroup.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_deleteconsumergroup.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.delete_event_hub_consumer_group( + resource_group_name="myResourceGroup", + resource_name="testHub", + event_hub_endpoint_name="events", + name="test", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_deleteconsumergroup.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_deleteprivateendpointconnection.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_deleteprivateendpointconnection.py new file mode 100644 index 000000000000..c5f4e8aeaef8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_deleteprivateendpointconnection.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_deleteprivateendpointconnection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.private_endpoint_connections.begin_delete( + resource_group_name="myResourceGroup", + resource_name="testHub", + private_endpoint_connection_name="myPrivateEndpointConnection", + ).result() + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_deleteprivateendpointconnection.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_exportdevices.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_exportdevices.py new file mode 100644 index 000000000000..abc9c0349383 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_exportdevices.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_exportdevices.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.export_devices( + resource_group_name="myResourceGroup", + resource_name="testHub", + export_devices_parameters={"excludeKeys": True, "exportBlobContainerUri": "testBlob"}, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_exportdevices.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_generateverificationcode.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_generateverificationcode.py new file mode 100644 index 000000000000..5d44b4b61573 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_generateverificationcode.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_generateverificationcode.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.certificates.generate_verification_code( + resource_group_name="myResourceGroup", + resource_name="testHub", + certificate_name="cert", + if_match="AAAAAAAADGk=", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_generateverificationcode.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_get.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_get.py new file mode 100644 index 000000000000..00c26811be1a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_get.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getcertificate.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getcertificate.py new file mode 100644 index 000000000000..cdad38958279 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getcertificate.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_getcertificate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.certificates.get( + resource_group_name="myResourceGroup", + resource_name="testhub", + certificate_name="cert", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getcertificate.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getconsumergroup.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getconsumergroup.py new file mode 100644 index 000000000000..ce8e6199c387 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getconsumergroup.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_getconsumergroup.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get_event_hub_consumer_group( + resource_group_name="myResourceGroup", + resource_name="testHub", + event_hub_endpoint_name="events", + name="test", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getconsumergroup.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getjob.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getjob.py new file mode 100644 index 000000000000..ebd558326d25 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getjob.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_getjob.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get_job( + resource_group_name="myResourceGroup", + resource_name="testHub", + job_id="test", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getjob.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getkey.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getkey.py new file mode 100644 index 000000000000..d0f07c52c6e2 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getkey.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_getkey.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get_keys_for_key_name( + resource_group_name="myResourceGroup", + resource_name="testHub", + key_name="iothubowner", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getkey.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getprivateendpointconnection.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getprivateendpointconnection.py new file mode 100644 index 000000000000..4eadb10b2e4e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getprivateendpointconnection.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_getprivateendpointconnection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="myResourceGroup", + resource_name="testHub", + private_endpoint_connection_name="myPrivateEndpointConnection", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getprivateendpointconnection.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getprivatelinkresources.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getprivatelinkresources.py new file mode 100644 index 000000000000..f3e3d8425198 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getprivatelinkresources.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_getprivatelinkresources.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.private_link_resources.get( + resource_group_name="myResourceGroup", + resource_name="testHub", + group_id="iotHub", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getprivatelinkresources.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getskus.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getskus.py new file mode 100644 index 000000000000..dba99c55aa0e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_getskus.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_getskus.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get_valid_skus( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getskus.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_importdevices.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_importdevices.py new file mode 100644 index 000000000000..0f6917bc5277 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_importdevices.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_importdevices.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.import_devices( + resource_group_name="myResourceGroup", + resource_name="testHub", + import_devices_parameters={"inputBlobContainerUri": "testBlob", "outputBlobContainerUri": "testBlob"}, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_importdevices.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listbyrg.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listbyrg.py new file mode 100644 index 000000000000..740402cf79a5 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listbyrg.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listbyrg.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listbyrg.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listbysubscription.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listbysubscription.py new file mode 100644 index 000000000000..a2c7e9d08916 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listbysubscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listbysubscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listbysubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listcertificates.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listcertificates.py new file mode 100644 index 000000000000..db5df711aade --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listcertificates.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listcertificates.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.certificates.list_by_iot_hub( + resource_group_name="myResourceGroup", + resource_name="testhub", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listcertificates.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listehgroups.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listehgroups.py new file mode 100644 index 000000000000..29677ea29956 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listehgroups.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listehgroups.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.list_event_hub_consumer_groups( + resource_group_name="myResourceGroup", + resource_name="testHub", + event_hub_endpoint_name="events", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listehgroups.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listjobs.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listjobs.py new file mode 100644 index 000000000000..234d23a98594 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listjobs.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listjobs.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.list_jobs( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listjobs.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listkeys.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listkeys.py new file mode 100644 index 000000000000..c2c4c25b1f4d --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listkeys.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listkeys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.list_keys( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listkeys.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listprivateendpointconnections.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listprivateendpointconnections.py new file mode 100644 index 000000000000..e7b27902fca3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listprivateendpointconnections.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listprivateendpointconnections.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.private_endpoint_connections.list( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listprivateendpointconnections.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listprivatelinkresources.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listprivatelinkresources.py new file mode 100644 index 000000000000..164ca722de52 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_listprivatelinkresources.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_listprivatelinkresources.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.private_link_resources.list( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listprivatelinkresources.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/skus_list.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_operations.py similarity index 74% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/skus_list.py rename to sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_operations.py index c053028277cb..3fa0bae22aa0 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/skus_list.py +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_operations.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.workloads import WorkloadsClient +from azure.mgmt.iothub import IotHubClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-workloads + pip install azure-mgmt-iothub # USAGE - python skus_list.py + python iothub_operations.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,16 +24,16 @@ def main(): - client = WorkloadsClient( + client = IotHubClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.skus.list() + response = client.operations.list() for item in response: print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/Skus_List.json +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_operations.json if __name__ == "__main__": main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_quotametrics.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_quotametrics.py new file mode 100644 index 000000000000..fb4b96e5e2aa --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_quotametrics.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_quotametrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get_quota_metrics( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_quotametrics.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_routingendpointhealth.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_routingendpointhealth.py new file mode 100644 index 000000000000..55fbcde54837 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_routingendpointhealth.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_routingendpointhealth.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get_endpoint_health( + resource_group_name="myResourceGroup", + iot_hub_name="testHub", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_routingendpointhealth.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_stats.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_stats.py new file mode 100644 index 000000000000..d67067f8cfbc --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_stats.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_stats.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.get_stats( + resource_group_name="myResourceGroup", + resource_name="testHub", + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_stats.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_testallroutes.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_testallroutes.py new file mode 100644 index 000000000000..eb04dc7cfbf6 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_testallroutes.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_testallroutes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.test_all_routes( + iot_hub_name="testHub", + resource_group_name="myResourceGroup", + input={ + "message": { + "appProperties": {"key1": "value1"}, + "body": "Body of message", + "systemProperties": {"key1": "value1"}, + }, + "routingSource": "DeviceMessages", + }, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_testallroutes.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_testnewroute.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_testnewroute.py new file mode 100644 index 000000000000..b61ee216be97 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_testnewroute.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_testnewroute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.iot_hub_resource.test_route( + iot_hub_name="testHub", + resource_group_name="myResourceGroup", + input={ + "message": { + "appProperties": {"key1": "value1"}, + "body": "Body of message", + "systemProperties": {"key1": "value1"}, + }, + "route": {"endpointNames": ["id1"], "isEnabled": True, "name": "Routeid", "source": "DeviceMessages"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_testnewroute.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_updateprivateendpointconnection.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_updateprivateendpointconnection.py new file mode 100644 index 000000000000..08636d2fffae --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_updateprivateendpointconnection.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_updateprivateendpointconnection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.private_endpoint_connections.begin_update( + resource_group_name="myResourceGroup", + resource_name="testHub", + private_endpoint_connection_name="myPrivateEndpointConnection", + private_endpoint_connection={ + "properties": { + "privateLinkServiceConnectionState": { + "description": "Approved by johndoe@contoso.com", + "status": "Approved", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_updateprivateendpointconnection.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_usages.py b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_usages.py new file mode 100644 index 000000000000..03f74725cebe --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/generated_samples/iothub_usages.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iothub import IotHubClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iothub +# USAGE + python iothub_usages.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IotHubClient( + credential=DefaultAzureCredential(), + subscription_id="91d12660-3dec-467a-be2a-213b5544ddc0", + ) + + response = client.resource_provider_common.get_subscription_quota() + print(response) + + +# x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_usages.json +if __name__ == "__main__": + main() diff --git a/sdk/iothub/azure-mgmt-iothub/setup.py b/sdk/iothub/azure-mgmt-iothub/setup.py index 6aa7d7e8a1b8..1347e89d640c 100644 --- a/sdk/iothub/azure-mgmt-iothub/setup.py +++ b/sdk/iothub/azure-mgmt-iothub/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -69,9 +70,10 @@ 'pytyped': ['py.typed'], }, install_requires=[ - 'msrest>=0.7.1', - 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.2,<2.0.0', + "msrest>=0.7.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", ], python_requires=">=3.7" ) diff --git a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.pyTestMgmtIoTHubtest_iothub.json b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.pyTestMgmtIoTHubtest_iothub.json index f0b267c12381..1efd2aa11218 100644 --- a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.pyTestMgmtIoTHubtest_iothub.json +++ b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.pyTestMgmtIoTHubtest_iothub.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:11:31 GMT", + "Date": "Wed, 15 Feb 2023 03:43:59 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13481.9 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -86,7 +86,7 @@ "email" ], "kerberos_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/kerberos", - "tenant_region_scope": "NA", + "tenant_region_scope": "WW", "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:11:31 GMT", + "Date": "Wed, 15 Feb 2023 03:43:59 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13418.10 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "a6b3bff4-2de9-4c69-8829-5cdb72dd3a7f", + "client-request-id": "8b5e90d3-a8e0-4393-b0e3-5b9071de0a08", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.18.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "a6b3bff4-2de9-4c69-8829-5cdb72dd3a7f", - "Content-Length": "93", + "client-request-id": "8b5e90d3-a8e0-4393-b0e3-5b9071de0a08", + "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:11:31 GMT", + "Date": "Wed, 15 Feb 2023 03:44:00 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,13 +201,14 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.13481.9 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { "token_type": "Bearer", - "expires_in": 3599, - "ext_expires_in": 3599, + "expires_in": 86399, + "ext_expires_in": 86399, + "refresh_in": 43199, "access_token": "access_token" } }, @@ -220,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "name": "iot35912252" @@ -228,19 +229,17 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "56", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:11:32 GMT", + "Date": "Wed, 15 Feb 2023 03:43:59 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7c14d33e-57c0-457f-95f1-7a37e5f39e74", + "x-ms-correlation-request-id": "1ddf53c9-da45-4646-9e3a-4e836082cf87", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "CENTRALUS:20220812T021132Z:7c14d33e-57c0-457f-95f1-7a37e5f39e74" + "x-ms-routing-request-id": "EASTUS:20230215T034400Z:1ddf53c9-da45-4646-9e3a-4e836082cf87" }, "ResponseBody": { "nameAvailable": true, @@ -257,7 +256,7 @@ "Connection": "keep-alive", "Content-Length": "136", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "westus", @@ -272,19 +271,19 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfZWU2ODlkYzQtYzI3NS00N2NlLTgzOTEtMWI1YTAzYTc4NWQzO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfYjk5YjI2NWMtMjZmMy00Yzc4LThjMTAtNWZhY2MyNWMwNjcwO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "Cache-Control": "no-cache", - "Content-Length": "653", + "Content-Length": "475", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:11:37 GMT", + "Date": "Wed, 15 Feb 2023 03:44:05 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b9d4627d-d89a-4876-8fc3-867e4dfd4157", + "x-ms-correlation-request-id": "466a707f-85d5-4d60-a4d0-1cfbb8b20e7d", "x-ms-ratelimit-remaining-subscription-resource-requests": "4999", - "x-ms-routing-request-id": "CENTRALUS:20220812T021137Z:b9d4627d-d89a-4876-8fc3-867e4dfd4157" + "x-ms-routing-request-id": "EASTUS:20230215T034405Z:466a707f-85d5-4d60-a4d0-1cfbb8b20e7d" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/35912252/providers/Microsoft.Devices/IotHubs/iot35912252", @@ -295,18 +294,8 @@ "subscriptionid": "00000000-0000-0000-0000-000000000000", "resourcegroup": "35912252", "properties": { - "state": "Activating", "provisioningState": "Accepted", "enableFileUploadNotifications": false, - "cloudToDevice": { - "maxDeliveryCount": 10, - "defaultTtlAsIso8601": "PT1H", - "feedback": { - "lockDurationAsIso8601": "PT1M", - "ttlAsIso8601": "PT1H", - "maxDeliveryCount": 10 - } - }, "features": "None", "allowedFqdnList": [] }, @@ -318,155 +307,145 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfZWU2ODlkYzQtYzI3NS00N2NlLTgzOTEtMWI1YTAzYTc4NWQzO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfYjk5YjI2NWMtMjZmMy00Yzc4LThjMTAtNWZhY2MyNWMwNjcwO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:12:07 GMT", + "Date": "Wed, 15 Feb 2023 03:44:05 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c410dc67-4cab-4b65-8743-2f4450ac828a", + "x-ms-correlation-request-id": "f8ff33e3-d5ea-4bc9-8e4f-cb284f57edeb", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "CENTRALUS:20220812T021207Z:c410dc67-4cab-4b65-8743-2f4450ac828a" + "x-ms-routing-request-id": "EASTUS:20230215T034406Z:f8ff33e3-d5ea-4bc9-8e4f-cb284f57edeb" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfZWU2ODlkYzQtYzI3NS00N2NlLTgzOTEtMWI1YTAzYTc4NWQzO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfYjk5YjI2NWMtMjZmMy00Yzc4LThjMTAtNWZhY2MyNWMwNjcwO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:12:37 GMT", + "Date": "Wed, 15 Feb 2023 03:44:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a28f850a-a501-45d7-9d03-9a997251031e", + "x-ms-correlation-request-id": "bb68456b-ae1a-4860-a44c-0ee1843d3c23", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "CENTRALUS:20220812T021237Z:a28f850a-a501-45d7-9d03-9a997251031e" + "x-ms-routing-request-id": "EASTUS:20230215T034436Z:bb68456b-ae1a-4860-a44c-0ee1843d3c23" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfZWU2ODlkYzQtYzI3NS00N2NlLTgzOTEtMWI1YTAzYTc4NWQzO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfYjk5YjI2NWMtMjZmMy00Yzc4LThjMTAtNWZhY2MyNWMwNjcwO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:13:07 GMT", + "Date": "Wed, 15 Feb 2023 03:45:06 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4b54b71c-5949-40cc-b665-e9168c2ae21f", + "x-ms-correlation-request-id": "3b1857c2-a11e-4c41-b7d3-754b060bb004", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "CENTRALUS:20220812T021308Z:4b54b71c-5949-40cc-b665-e9168c2ae21f" + "x-ms-routing-request-id": "EASTUS:20230215T034506Z:3b1857c2-a11e-4c41-b7d3-754b060bb004" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfZWU2ODlkYzQtYzI3NS00N2NlLTgzOTEtMWI1YTAzYTc4NWQzO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfYjk5YjI2NWMtMjZmMy00Yzc4LThjMTAtNWZhY2MyNWMwNjcwO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:13:37 GMT", + "Date": "Wed, 15 Feb 2023 03:45:36 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8639c376-7e99-4962-81bc-e628525d47db", + "x-ms-correlation-request-id": "8ddff4e7-a0e4-4b80-b62d-f2885c1264d3", "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "CENTRALUS:20220812T021338Z:8639c376-7e99-4962-81bc-e628525d47db" + "x-ms-routing-request-id": "EASTUS:20230215T034536Z:8ddff4e7-a0e4-4b80-b62d-f2885c1264d3" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfZWU2ODlkYzQtYzI3NS00N2NlLTgzOTEtMWI1YTAzYTc4NWQzO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfYjk5YjI2NWMtMjZmMy00Yzc4LThjMTAtNWZhY2MyNWMwNjcwO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "22", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:08 GMT", + "Date": "Wed, 15 Feb 2023 03:46:06 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "27673d7f-3ea7-498f-ae83-5799ee53b064", + "x-ms-correlation-request-id": "3c9c3d8e-5e7a-435d-9804-37fd36385ac6", "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "CENTRALUS:20220812T021408Z:27673d7f-3ea7-498f-ae83-5799ee53b064" + "x-ms-routing-request-id": "EASTUS:20230215T034606Z:3c9c3d8e-5e7a-435d-9804-37fd36385ac6" }, "ResponseBody": { "status": "Succeeded" @@ -479,25 +458,23 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "1594", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:10 GMT", + "Date": "Wed, 15 Feb 2023 03:46:07 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "84a0b377-5293-488b-9587-c7cdd8cb81c3", + "x-ms-correlation-request-id": "73235a2f-181b-4726-aa92-92e4c7d05e59", "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "CENTRALUS:20220812T021410Z:84a0b377-5293-488b-9587-c7cdd8cb81c3" + "x-ms-routing-request-id": "EASTUS:20230215T034607Z:73235a2f-181b-4726-aa92-92e4c7d05e59" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/35912252/providers/Microsoft.Devices/IotHubs/iot35912252", @@ -507,7 +484,7 @@ "tags": {}, "subscriptionid": "00000000-0000-0000-0000-000000000000", "resourcegroup": "35912252", - "etag": "AAAADG6KVBI=", + "etag": "AAAADHxI/7M=", "properties": { "locations": [ { @@ -534,7 +511,7 @@ "3" ], "path": "iot35912252", - "endpoint": "sb://iothub-ns-iot3591225-20885742-6ce2f99e18.servicebus.windows.net/" + "endpoint": "sb://iothub-ns-iot3591225-24605715-e95a23f53c.servicebus.windows.net/" } }, "routing": { @@ -591,7 +568,7 @@ "type": "None" }, "systemData": { - "createdAt": "2022-08-12T02:11:36.8Z" + "createdAt": "2023-02-15T03:44:04.6233333Z" } } }, @@ -602,25 +579,23 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "1594", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:11 GMT", + "Date": "Wed, 15 Feb 2023 03:46:08 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "181b0a35-f8f6-4ec7-a345-620424cf9e93", + "x-ms-correlation-request-id": "8f4816c3-76f8-4512-bfa7-fa5660a43d55", "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "CENTRALUS:20220812T021411Z:181b0a35-f8f6-4ec7-a345-620424cf9e93" + "x-ms-routing-request-id": "EASTUS:20230215T034608Z:8f4816c3-76f8-4512-bfa7-fa5660a43d55" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/35912252/providers/Microsoft.Devices/IotHubs/iot35912252", @@ -630,7 +605,7 @@ "tags": {}, "subscriptionid": "00000000-0000-0000-0000-000000000000", "resourcegroup": "35912252", - "etag": "AAAADG6KVBI=", + "etag": "AAAADHxI/7M=", "properties": { "locations": [ { @@ -657,7 +632,7 @@ "3" ], "path": "iot35912252", - "endpoint": "sb://iothub-ns-iot3591225-20885742-6ce2f99e18.servicebus.windows.net/" + "endpoint": "sb://iothub-ns-iot3591225-24605715-e95a23f53c.servicebus.windows.net/" } }, "routing": { @@ -714,7 +689,7 @@ "type": "None" }, "systemData": { - "createdAt": "2022-08-12T02:11:36.8Z" + "createdAt": "2023-02-15T03:44:04.6233333Z" } } }, @@ -725,25 +700,23 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "1606", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:11 GMT", + "Date": "Wed, 15 Feb 2023 03:46:08 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c1227176-8b59-4b3f-bd8c-daf328a247bf", + "x-ms-correlation-request-id": "c20c5cca-9153-41e3-9e71-30d0726dd3bd", "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "CENTRALUS:20220812T021411Z:c1227176-8b59-4b3f-bd8c-daf328a247bf" + "x-ms-routing-request-id": "EASTUS:20230215T034609Z:c20c5cca-9153-41e3-9e71-30d0726dd3bd" }, "ResponseBody": { "value": [ @@ -755,7 +728,7 @@ "tags": {}, "subscriptionid": "00000000-0000-0000-0000-000000000000", "resourcegroup": "35912252", - "etag": "AAAADG6KVBI=", + "etag": "AAAADHxI/7M=", "properties": { "locations": [ { @@ -782,7 +755,7 @@ "3" ], "path": "iot35912252", - "endpoint": "sb://iothub-ns-iot3591225-20885742-6ce2f99e18.servicebus.windows.net/" + "endpoint": "sb://iothub-ns-iot3591225-24605715-e95a23f53c.servicebus.windows.net/" } }, "routing": { @@ -839,7 +812,7 @@ "type": "None" }, "systemData": { - "createdAt": "2022-08-12T02:11:36.8Z" + "createdAt": "2023-02-15T03:44:04.6233333Z" } } ] @@ -852,28 +825,26 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "3763", + "Content-Length": "3975", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:12 GMT", + "Date": "Wed, 15 Feb 2023 03:46:09 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b0c78ef9-fc66-45bb-baa2-e22b2c1b6067", + "x-ms-correlation-request-id": "3e6449b4-f9a7-4bd3-99c0-4dfece58d5b9", "x-ms-original-request-ids": [ "", "" ], "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-routing-request-id": "CENTRALUS:20220812T021412Z:b0c78ef9-fc66-45bb-baa2-e22b2c1b6067" + "x-ms-routing-request-id": "EASTUS:20230215T034609Z:3e6449b4-f9a7-4bd3-99c0-4dfece58d5b9" }, "ResponseBody": { "value": [ @@ -885,7 +856,7 @@ "tags": {}, "subscriptionid": "00000000-0000-0000-0000-000000000000", "resourcegroup": "35912252", - "etag": "AAAADG6KVBI=", + "etag": "AAAADHxI/7M=", "properties": { "locations": [ { @@ -912,7 +883,7 @@ "3" ], "path": "iot35912252", - "endpoint": "sb://iothub-ns-iot3591225-20885742-6ce2f99e18.servicebus.windows.net/" + "endpoint": "sb://iothub-ns-iot3591225-24605715-e95a23f53c.servicebus.windows.net/" } }, "routing": { @@ -969,33 +940,33 @@ "type": "None" }, "systemData": { - "createdAt": "2022-08-12T02:11:36.8Z" + "createdAt": "2023-02-15T03:44:04.6233333Z" } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python-sdk-test/providers/Microsoft.Devices/IotHubs/iothub-yyc", - "name": "iothub-yyc", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python-sdk-test/providers/Microsoft.Devices/IotHubs/new-iothub-yyc", + "name": "new-iothub-yyc", "type": "Microsoft.Devices/IotHubs", - "location": "westus2", + "location": "eastus", "tags": {}, "subscriptionid": "00000000-0000-0000-0000-000000000000", "resourcegroup": "python-sdk-test", - "etag": "AAAADFwIuDE=", + "etag": "AAAADHwU0HE=", "properties": { "locations": [ { - "location": "West US 2", + "location": "East US", "role": "primary" }, { - "location": "West Central US", + "location": "West US", "role": "secondary" } ], "state": "Active", "provisioningState": "Succeeded", "ipFilterRules": [], - "hostName": "iothub-yyc.azure-devices.net", + "hostName": "new-iothub-yyc.azure-devices.net", "eventHubEndpoints": { "events": { "retentionTimeInDays": 1, @@ -1006,8 +977,8 @@ "2", "3" ], - "path": "iothub-yyc", - "endpoint": "sb://iothub-ns-iothub-yyc-15359990-a6a965f2cb.servicebus.windows.net/" + "path": "new-iothub-yyc", + "endpoint": "sb://iothub-ns-new-iothub-21271406-5748c28170.servicebus.windows.net/" } }, "routing": { @@ -1044,6 +1015,15 @@ "events" ], "isEnabled": true + }, + { + "name": "DeviceUpdate.DeviceConnectionState", + "source": "DeviceConnectionStateEvents", + "condition": "true", + "endpointNames": [ + "events" + ], + "isEnabled": true } ], "fallbackRoute": { @@ -1081,7 +1061,9 @@ } }, "features": "None", - "allowedFqdnList": [] + "disableLocalAuth": false, + "allowedFqdnList": [], + "enableDataResidency": false }, "sku": { "name": "S1", @@ -1092,7 +1074,7 @@ "type": "None" }, "systemData": { - "createdAt": "2021-10-14T05:25:45.29Z" + "createdAt": "2022-09-01T06:15:23.95Z" } } ] @@ -1105,25 +1087,23 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "69", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:12 GMT", + "Date": "Wed, 15 Feb 2023 03:46:09 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ab004df9-7cdd-48ab-9b41-bd97c0313d81", + "x-ms-correlation-request-id": "1d850334-6e90-46d5-b067-ca1651ac80ee", "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-routing-request-id": "CENTRALUS:20220812T021412Z:ab004df9-7cdd-48ab-9b41-bd97c0313d81" + "x-ms-routing-request-id": "EASTUS:20230215T034610Z:1d850334-6e90-46d5-b067-ca1651ac80ee" }, "ResponseBody": { "totalDeviceCount": 0, @@ -1138,25 +1118,23 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "475", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:13 GMT", + "Date": "Wed, 15 Feb 2023 03:46:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "30b3d040-6f4c-480d-81f9-5b620c2d3fb9", + "x-ms-correlation-request-id": "f2ce1572-5222-4a7e-a5a5-20d039d80c89", "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-routing-request-id": "CENTRALUS:20220812T021413Z:30b3d040-6f4c-480d-81f9-5b620c2d3fb9" + "x-ms-routing-request-id": "EASTUS:20230215T034610Z:f2ce1572-5222-4a7e-a5a5-20d039d80c89" }, "ResponseBody": { "value": [ @@ -1209,25 +1187,23 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "12", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:13 GMT", + "Date": "Wed, 15 Feb 2023 03:46:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "99d86434-ce16-49a4-9eef-983210c449a8", + "x-ms-correlation-request-id": "81397efb-463f-43f4-8fe7-d029bba9ee7e", "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-routing-request-id": "CENTRALUS:20220812T021413Z:99d86434-ce16-49a4-9eef-983210c449a8" + "x-ms-routing-request-id": "EASTUS:20230215T034611Z:81397efb-463f-43f4-8fe7-d029bba9ee7e" }, "ResponseBody": { "value": [] @@ -1240,25 +1216,23 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "135", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:13 GMT", + "Date": "Wed, 15 Feb 2023 03:46:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c990139b-d1c3-4cea-b7a5-b1a8309c4103", + "x-ms-correlation-request-id": "0d4ffb7c-4875-4fc3-83c4-681b7fb40ea2", "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-routing-request-id": "CENTRALUS:20220812T021413Z:c990139b-d1c3-4cea-b7a5-b1a8309c4103" + "x-ms-routing-request-id": "EASTUS:20230215T034612Z:0d4ffb7c-4875-4fc3-83c4-681b7fb40ea2" }, "ResponseBody": { "value": [ @@ -1283,55 +1257,82 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfM2UxZTI2MjAtODkzZC00MzUwLTliY2EtYTQ5NjQwNjkzNTVhO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfNjE3OTJmZDEtNWU4Ny00MmFlLTkyYjktNzhiZGU3ODU5ZTg3O3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "Cache-Control": "no-cache", "Content-Length": "4", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:15 GMT", + "Date": "Wed, 15 Feb 2023 03:46:12 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfM2UxZTI2MjAtODkzZC00MzUwLTliY2EtYTQ5NjQwNjkzNTVhO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfNjE3OTJmZDEtNWU4Ny00MmFlLTkyYjktNzhiZGU3ODU5ZTg3O3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other", "Pragma": "no-cache", "Retry-After": "15", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8be74742-e2a6-4b79-a594-cae7fe470679", + "x-ms-correlation-request-id": "27442a52-710b-4cbe-8cce-745589a333f1", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "CENTRALUS:20220812T021415Z:8be74742-e2a6-4b79-a594-cae7fe470679" + "x-ms-routing-request-id": "EASTUS:20230215T034613Z:27442a52-710b-4cbe-8cce-745589a333f1" }, "ResponseBody": "null" }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfM2UxZTI2MjAtODkzZC00MzUwLTliY2EtYTQ5NjQwNjkzNTVhO3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfNjE3OTJmZDEtNWU4Ny00MmFlLTkyYjktNzhiZGU3ODU5ZTg3O3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-iothub/2.3.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 12 Aug 2022 02:14:30 GMT", + "Date": "Wed, 15 Feb 2023 03:46:12 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b751b704-fb6f-455b-8ec9-4ad4b088266c", + "x-ms-correlation-request-id": "ffd5d1b7-970b-4646-81e2-17c123f9d5e6", "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-routing-request-id": "CENTRALUS:20220812T021430Z:b751b704-fb6f-455b-8ec9-4ad4b088266c" + "x-ms-routing-request-id": "EASTUS:20230215T034613Z:ffd5d1b7-970b-4646-81e2-17c123f9d5e6" + }, + "ResponseBody": { + "status": "Pending" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/locations/westus/operationResults/aWQ9b3NfaWhfNjE3OTJmZDEtNWU4Ny00MmFlLTkyYjktNzhiZGU3ODU5ZTg3O3JlZ2lvbj13ZXN0dXM=?api-version=2021-07-02\u0026operationSource=other\u0026asyncinfo", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-iothub/2.4.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "22", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 03:46:42 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-HTTPAPI/2.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "bf4a6429-230f-44f9-a637-d50fd21fea98", + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-routing-request-id": "EASTUS:20230215T034643Z:bf4a6429-230f-44f9-a637-d50fd21fea98" }, "ResponseBody": { "status": "Succeeded" diff --git a/sdk/keyvault/azure-keyvault-administration/pyproject.toml b/sdk/keyvault/azure-keyvault-administration/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/keyvault/azure-keyvault-certificates/pyproject.toml b/sdk/keyvault/azure-keyvault-certificates/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/keyvault/azure-keyvault-keys/pyproject.toml b/sdk/keyvault/azure-keyvault-keys/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/keyvault/azure-keyvault-secrets/pyproject.toml b/sdk/keyvault/azure-keyvault-secrets/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/keyvault/azure-keyvault/pyproject.toml b/sdk/keyvault/azure-keyvault/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/keyvault/azure-keyvault/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/kusto/azure-mgmt-kusto/CHANGELOG.md b/sdk/kusto/azure-mgmt-kusto/CHANGELOG.md index 8b32460a0e56..60abe657f67b 100644 --- a/sdk/kusto/azure-mgmt-kusto/CHANGELOG.md +++ b/sdk/kusto/azure-mgmt-kusto/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 3.1.0 (2023-02-15) + +### Features Added + + - Added operation group SkusOperations + - Model LanguageExtension has a new parameter language_extension_image_name + - Model SkuLocationInfoItem has a new parameter zone_details + - Model TableLevelSharingProperties has a new parameter functions_to_exclude + - Model TableLevelSharingProperties has a new parameter functions_to_include + ## 3.1.0b1 (2022-12-27) ### Features Added diff --git a/sdk/kusto/azure-mgmt-kusto/README.md b/sdk/kusto/azure-mgmt-kusto/README.md index e5796d34bfa2..1fbfbaa87a11 100644 --- a/sdk/kusto/azure-mgmt-kusto/README.md +++ b/sdk/kusto/azure-mgmt-kusto/README.md @@ -28,7 +28,7 @@ By default, [Azure Active Directory](https://aka.ms/awps/aad) token authenticati - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +- `AZURE_CLIENT_SECRET` for Azure client secret. In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. diff --git a/sdk/kusto/azure-mgmt-kusto/_meta.json b/sdk/kusto/azure-mgmt-kusto/_meta.json index 37216d97d627..1620c3466ba7 100644 --- a/sdk/kusto/azure-mgmt-kusto/_meta.json +++ b/sdk/kusto/azure-mgmt-kusto/_meta.json @@ -1,11 +1,11 @@ { - "commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c", + "commit": "78ec1b99699a4bf44869bd13f1b0ed7d92a99c27", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/azure-kusto/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/azure-kusto/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/azure-kusto/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py index 79349c030257..edad8654a0c1 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py @@ -36,14 +36,14 @@ class KustoManagementClientConfiguration(Configuration): # pylint: disable=too- :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-11-11". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-12-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(KustoManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", "2022-11-11") + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", "2022-12-29") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py index e77d97ae9e03..75d0ce3336a4 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py @@ -83,7 +83,7 @@ class KustoManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-11". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-12-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_serialization.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_serialization.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_vendor.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_vendor.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py index 48b05f9c489c..47babc28d5ed 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0b1" +VERSION = "3.1.0" diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_configuration.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_configuration.py index 3ec4255eeb43..49079b14674d 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_configuration.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_configuration.py @@ -36,14 +36,14 @@ class KustoManagementClientConfiguration(Configuration): # pylint: disable=too- :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-11-11". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-12-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(KustoManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", "2022-11-11") + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", "2022-12-29") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py index ec4e2cf10591..186f88a6e76c 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py @@ -83,7 +83,7 @@ class KustoManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-11". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-12-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_configurations_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_configurations_operations.py index e11a29f2b8bf..5e55fe8b00da 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_configurations_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_configurations_operations.py @@ -162,7 +162,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -233,7 +233,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AttachedDatabaseConfigurationListResult] = kwargs.pop("cls", None) @@ -336,7 +336,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AttachedDatabaseConfiguration] = kwargs.pop("cls", None) @@ -394,7 +394,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -576,7 +576,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -638,7 +638,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -702,7 +702,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_operations.py index 9cc471865527..12452d14077c 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_operations.py @@ -161,7 +161,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -240,7 +240,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterPrincipalAssignment] = kwargs.pop("cls", None) @@ -298,7 +298,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -473,7 +473,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -535,7 +535,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -598,7 +598,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -662,7 +662,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterPrincipalAssignmentListResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_operations.py index 17d0ff36fd7c..70bbbce3b50a 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_operations.py @@ -104,7 +104,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) @@ -162,7 +162,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -359,7 +359,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -427,7 +427,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -618,7 +618,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -680,7 +680,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -738,7 +738,7 @@ async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -794,7 +794,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -852,7 +852,7 @@ async def begin_stop(self, resource_group_name: str, cluster_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -908,7 +908,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -966,7 +966,7 @@ async def begin_start(self, resource_group_name: str, cluster_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1030,7 +1030,7 @@ def list_follower_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FollowerDatabaseListResult] = kwargs.pop("cls", None) @@ -1121,7 +1121,7 @@ async def _detach_follower_databases_initial( # pylint: disable=inconsistent-re _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1273,7 +1273,7 @@ async def begin_detach_follower_databases( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1332,7 +1332,7 @@ async def _diagnose_virtual_network_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.DiagnoseVirtualNetworkResult]] = kwargs.pop("cls", None) @@ -1401,7 +1401,7 @@ async def begin_diagnose_virtual_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DiagnoseVirtualNetworkResult] = kwargs.pop("cls", None) @@ -1462,7 +1462,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) @@ -1546,7 +1546,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) @@ -1627,7 +1627,7 @@ def list_skus(self, **kwargs: Any) -> AsyncIterable["_models.SkuDescription"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SkuDescriptionList] = kwargs.pop("cls", None) @@ -1768,7 +1768,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1836,7 +1836,7 @@ def list_skus_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListResourceSkusResult] = kwargs.pop("cls", None) @@ -1930,7 +1930,7 @@ def list_outbound_network_dependencies_endpoints( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OutboundNetworkDependenciesEndpointListResult] = kwargs.pop("cls", None) @@ -2022,7 +2022,7 @@ def list_language_extensions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.LanguageExtensionsList] = kwargs.pop("cls", None) @@ -2113,7 +2113,7 @@ async def _add_language_extensions_initial( # pylint: disable=inconsistent-retu _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2265,7 +2265,7 @@ async def begin_add_language_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2328,7 +2328,7 @@ async def _remove_language_extensions_initial( # pylint: disable=inconsistent-r _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2480,7 +2480,7 @@ async def begin_remove_language_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_operations.py index 44e67ac09692..7f5c05c5198a 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_operations.py @@ -89,7 +89,7 @@ def list_by_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataConnectionListResult] = kwargs.pop("cls", None) @@ -182,7 +182,7 @@ async def _data_connection_validation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -358,7 +358,7 @@ async def begin_data_connection_validation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -510,7 +510,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -592,7 +592,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataConnection] = kwargs.pop("cls", None) @@ -652,7 +652,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -840,7 +840,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -909,7 +909,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1104,7 +1104,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1167,7 +1167,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1233,7 +1233,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_operations.py index bd25348e884c..36b7851433f5 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_operations.py @@ -170,7 +170,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -257,7 +257,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabasePrincipalAssignment] = kwargs.pop("cls", None) @@ -317,7 +317,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -505,7 +505,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -573,7 +573,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -644,7 +644,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -711,7 +711,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabasePrincipalAssignmentListResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_operations.py index bdf14130bbc9..a81544ddd480 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_operations.py @@ -162,7 +162,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -231,7 +231,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) @@ -333,7 +333,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -392,7 +392,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -584,7 +584,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -653,7 +653,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -854,7 +854,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -917,7 +917,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -980,7 +980,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1044,7 +1044,7 @@ def list_principals( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabasePrincipalListResult] = kwargs.pop("cls", None) @@ -1220,7 +1220,7 @@ async def add_principals( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1374,7 +1374,7 @@ async def remove_principals( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_operations.py index 5b22df2ab46a..8587f44baf6f 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_operations.py @@ -159,7 +159,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -230,7 +230,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ManagedPrivateEndpointListResult] = kwargs.pop("cls", None) @@ -332,7 +332,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ManagedPrivateEndpoint] = kwargs.pop("cls", None) @@ -390,7 +390,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -566,7 +566,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -633,7 +633,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -811,7 +811,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -873,7 +873,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -936,7 +936,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations.py index 49400c4d4e39..cc6fb9764aff 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations.py @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_location_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_location_operations.py index dab9b6b8e203..9bee71954a38 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_location_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_location_operations.py @@ -81,7 +81,7 @@ async def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py index 95ca5de7560b..a9271ed5051e 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py @@ -79,7 +79,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_operations.py index c5c8ce3d45db..5f1da542d996 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_operations.py @@ -86,7 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) @@ -188,7 +188,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -246,7 +246,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -480,7 +480,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -543,7 +543,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_operations.py index 92c31cecc34b..41eba884a23f 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_operations.py @@ -77,7 +77,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) @@ -179,7 +179,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_operations.py index 87de9fcd2f0c..9dfc9f3d5722 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_operations.py @@ -88,7 +88,7 @@ def list_by_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ScriptListResult] = kwargs.pop("cls", None) @@ -193,7 +193,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Script] = kwargs.pop("cls", None) @@ -253,7 +253,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -439,7 +439,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -508,7 +508,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -696,7 +696,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -759,7 +759,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -825,7 +825,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -970,7 +970,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_skus_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_skus_operations.py index 923d888ad77c..a67d7e131906 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_skus_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_skus_operations.py @@ -71,7 +71,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.SkuDescri _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SkuDescriptionList] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py index 5f902e336e8f..7c3d7c4dcf3e 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py @@ -41,8 +41,10 @@ class AzureSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_L16_S_V2 = "Standard_L16s_v2" STANDARD_L8_S_V3 = "Standard_L8s_v3" STANDARD_L16_S_V3 = "Standard_L16s_v3" + STANDARD_L32_S_V3 = "Standard_L32s_v3" STANDARD_L8_AS_V3 = "Standard_L8as_v3" STANDARD_L16_AS_V3 = "Standard_L16as_v3" + STANDARD_L32_AS_V3 = "Standard_L32as_v3" STANDARD_E64_I_V3 = "Standard_E64i_v3" STANDARD_E80_IDS_V4 = "Standard_E80ids_v4" STANDARD_E2_A_V4 = "Standard_E2a_v4" diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py index 06a8e4a8e391..a737807859fa 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py @@ -35,7 +35,7 @@ class AcceptedAudiences(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: GUID or valid URL representing an accepted audience. :paramtype value: str @@ -71,7 +71,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -80,7 +80,8 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -106,7 +107,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -189,8 +190,8 @@ def __init__( table_level_sharing_properties: Optional["_models.TableLevelSharingProperties"] = None, database_name_override: Optional[str] = None, database_name_prefix: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -237,7 +238,7 @@ class AttachedDatabaseConfigurationListResult(_serialization.Model): "value": {"key": "value", "type": "[AttachedDatabaseConfiguration]"}, } - def __init__(self, *, value: Optional[List["_models.AttachedDatabaseConfiguration"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AttachedDatabaseConfiguration"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of attached database configurations. :paramtype value: list[~azure.mgmt.kusto.models.AttachedDatabaseConfiguration] @@ -273,7 +274,7 @@ class AttachedDatabaseConfigurationsCheckNameRequest(_serialization.Model): type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Attached database resource name. Required. :paramtype name: str @@ -312,8 +313,14 @@ class AzureCapacity(_serialization.Model): } def __init__( - self, *, scale_type: Union[str, "_models.AzureScaleType"], minimum: int, maximum: int, default: int, **kwargs - ): + self, + *, + scale_type: Union[str, "_models.AzureScaleType"], + minimum: int, + maximum: int, + default: int, + **kwargs: Any + ) -> None: """ :keyword scale_type: Scale type. Required. Known values are: "automatic", "manual", and "none". :paramtype scale_type: str or ~azure.mgmt.kusto.models.AzureScaleType @@ -354,8 +361,8 @@ def __init__( resource_type: Optional[str] = None, sku: Optional["_models.AzureSku"] = None, capacity: Optional["_models.AzureCapacity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: Resource Namespace and Type. :paramtype resource_type: str @@ -380,19 +387,20 @@ class AzureSku(_serialization.Model): "Standard_D14_v2", "Standard_D32d_v4", "Standard_D16d_v5", "Standard_D32d_v5", "Standard_DS13_v2+1TB_PS", "Standard_DS13_v2+2TB_PS", "Standard_DS14_v2+3TB_PS", "Standard_DS14_v2+4TB_PS", "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L8s_v2", - "Standard_L16s_v2", "Standard_L8s_v3", "Standard_L16s_v3", "Standard_L8as_v3", - "Standard_L16as_v3", "Standard_E64i_v3", "Standard_E80ids_v4", "Standard_E2a_v4", - "Standard_E4a_v4", "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", - "Standard_E8as_v4+2TB_PS", "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", - "Standard_E8as_v5+1TB_PS", "Standard_E8as_v5+2TB_PS", "Standard_E16as_v5+3TB_PS", - "Standard_E16as_v5+4TB_PS", "Standard_E2ads_v5", "Standard_E4ads_v5", "Standard_E8ads_v5", - "Standard_E16ads_v5", "Standard_EC8as_v5+1TB_PS", "Standard_EC8as_v5+2TB_PS", - "Standard_EC16as_v5+3TB_PS", "Standard_EC16as_v5+4TB_PS", "Standard_EC8ads_v5", - "Standard_EC16ads_v5", "Standard_E8s_v4+1TB_PS", "Standard_E8s_v4+2TB_PS", - "Standard_E16s_v4+3TB_PS", "Standard_E16s_v4+4TB_PS", "Standard_E8s_v5+1TB_PS", - "Standard_E8s_v5+2TB_PS", "Standard_E16s_v5+3TB_PS", "Standard_E16s_v5+4TB_PS", - "Standard_E2d_v4", "Standard_E4d_v4", "Standard_E8d_v4", "Standard_E16d_v4", "Standard_E2d_v5", - "Standard_E4d_v5", "Standard_E8d_v5", and "Standard_E16d_v5". + "Standard_L16s_v2", "Standard_L8s_v3", "Standard_L16s_v3", "Standard_L32s_v3", + "Standard_L8as_v3", "Standard_L16as_v3", "Standard_L32as_v3", "Standard_E64i_v3", + "Standard_E80ids_v4", "Standard_E2a_v4", "Standard_E4a_v4", "Standard_E8a_v4", + "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", "Standard_E8as_v4+2TB_PS", + "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", "Standard_E8as_v5+1TB_PS", + "Standard_E8as_v5+2TB_PS", "Standard_E16as_v5+3TB_PS", "Standard_E16as_v5+4TB_PS", + "Standard_E2ads_v5", "Standard_E4ads_v5", "Standard_E8ads_v5", "Standard_E16ads_v5", + "Standard_EC8as_v5+1TB_PS", "Standard_EC8as_v5+2TB_PS", "Standard_EC16as_v5+3TB_PS", + "Standard_EC16as_v5+4TB_PS", "Standard_EC8ads_v5", "Standard_EC16ads_v5", + "Standard_E8s_v4+1TB_PS", "Standard_E8s_v4+2TB_PS", "Standard_E16s_v4+3TB_PS", + "Standard_E16s_v4+4TB_PS", "Standard_E8s_v5+1TB_PS", "Standard_E8s_v5+2TB_PS", + "Standard_E16s_v5+3TB_PS", "Standard_E16s_v5+4TB_PS", "Standard_E2d_v4", "Standard_E4d_v4", + "Standard_E8d_v4", "Standard_E16d_v4", "Standard_E2d_v5", "Standard_E4d_v5", "Standard_E8d_v5", + and "Standard_E16d_v5". :vartype name: str or ~azure.mgmt.kusto.models.AzureSkuName :ivar capacity: The number of instances of the cluster. :vartype capacity: int @@ -417,27 +425,28 @@ def __init__( name: Union[str, "_models.AzureSkuName"], tier: Union[str, "_models.AzureSkuTier"], capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: SKU name. Required. Known values are: "Dev(No SLA)_Standard_D11_v2", "Dev(No SLA)_Standard_E2a_v4", "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", "Standard_D32d_v4", "Standard_D16d_v5", "Standard_D32d_v5", "Standard_DS13_v2+1TB_PS", "Standard_DS13_v2+2TB_PS", "Standard_DS14_v2+3TB_PS", "Standard_DS14_v2+4TB_PS", "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L8s_v2", - "Standard_L16s_v2", "Standard_L8s_v3", "Standard_L16s_v3", "Standard_L8as_v3", - "Standard_L16as_v3", "Standard_E64i_v3", "Standard_E80ids_v4", "Standard_E2a_v4", - "Standard_E4a_v4", "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", - "Standard_E8as_v4+2TB_PS", "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", - "Standard_E8as_v5+1TB_PS", "Standard_E8as_v5+2TB_PS", "Standard_E16as_v5+3TB_PS", - "Standard_E16as_v5+4TB_PS", "Standard_E2ads_v5", "Standard_E4ads_v5", "Standard_E8ads_v5", - "Standard_E16ads_v5", "Standard_EC8as_v5+1TB_PS", "Standard_EC8as_v5+2TB_PS", - "Standard_EC16as_v5+3TB_PS", "Standard_EC16as_v5+4TB_PS", "Standard_EC8ads_v5", - "Standard_EC16ads_v5", "Standard_E8s_v4+1TB_PS", "Standard_E8s_v4+2TB_PS", - "Standard_E16s_v4+3TB_PS", "Standard_E16s_v4+4TB_PS", "Standard_E8s_v5+1TB_PS", - "Standard_E8s_v5+2TB_PS", "Standard_E16s_v5+3TB_PS", "Standard_E16s_v5+4TB_PS", - "Standard_E2d_v4", "Standard_E4d_v4", "Standard_E8d_v4", "Standard_E16d_v4", "Standard_E2d_v5", - "Standard_E4d_v5", "Standard_E8d_v5", and "Standard_E16d_v5". + "Standard_L16s_v2", "Standard_L8s_v3", "Standard_L16s_v3", "Standard_L32s_v3", + "Standard_L8as_v3", "Standard_L16as_v3", "Standard_L32as_v3", "Standard_E64i_v3", + "Standard_E80ids_v4", "Standard_E2a_v4", "Standard_E4a_v4", "Standard_E8a_v4", + "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", "Standard_E8as_v4+2TB_PS", + "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", "Standard_E8as_v5+1TB_PS", + "Standard_E8as_v5+2TB_PS", "Standard_E16as_v5+3TB_PS", "Standard_E16as_v5+4TB_PS", + "Standard_E2ads_v5", "Standard_E4ads_v5", "Standard_E8ads_v5", "Standard_E16ads_v5", + "Standard_EC8as_v5+1TB_PS", "Standard_EC8as_v5+2TB_PS", "Standard_EC16as_v5+3TB_PS", + "Standard_EC16as_v5+4TB_PS", "Standard_EC8ads_v5", "Standard_EC16ads_v5", + "Standard_E8s_v4+1TB_PS", "Standard_E8s_v4+2TB_PS", "Standard_E16s_v4+3TB_PS", + "Standard_E16s_v4+4TB_PS", "Standard_E8s_v5+1TB_PS", "Standard_E8s_v5+2TB_PS", + "Standard_E16s_v5+3TB_PS", "Standard_E16s_v5+4TB_PS", "Standard_E2d_v4", "Standard_E4d_v4", + "Standard_E8d_v4", "Standard_E16d_v4", "Standard_E2d_v5", "Standard_E4d_v5", "Standard_E8d_v5", + and "Standard_E16d_v5". :paramtype name: str or ~azure.mgmt.kusto.models.AzureSkuName :keyword capacity: The number of instances of the cluster. :paramtype capacity: int @@ -473,7 +482,7 @@ class CheckNameRequest(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: Union[str, "_models.Type"], **kwargs): + def __init__(self, *, name: str, type: Union[str, "_models.Type"], **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -516,8 +525,8 @@ def __init__( name: Optional[str] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -567,8 +576,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -590,7 +599,8 @@ def __init__( class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -625,7 +635,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -817,8 +827,8 @@ def __init__( # pylint: disable=too-many-locals allowed_fqdn_list: Optional[List[str]] = None, public_ip_type: Union[str, "_models.PublicIPType"] = "IPv4", virtual_cluster_graduation_properties: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -937,7 +947,7 @@ class ClusterCheckNameRequest(_serialization.Model): type = "Microsoft.Kusto/clusters" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Cluster name. Required. :paramtype name: str @@ -957,7 +967,7 @@ class ClusterListResult(_serialization.Model): "value": {"key": "value", "type": "[Cluster]"}, } - def __init__(self, *, value: Optional[List["_models.Cluster"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Cluster"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto clusters. :paramtype value: list[~azure.mgmt.kusto.models.Cluster] @@ -1031,8 +1041,8 @@ def __init__( role: Optional[Union[str, "_models.ClusterPrincipalRole"]] = None, tenant_id: Optional[str] = None, principal_type: Optional[Union[str, "_models.PrincipalType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group name. @@ -1082,7 +1092,7 @@ class ClusterPrincipalAssignmentCheckNameRequest(_serialization.Model): type = "Microsoft.Kusto/clusters/principalAssignments" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Principal Assignment resource name. Required. :paramtype name: str @@ -1102,7 +1112,7 @@ class ClusterPrincipalAssignmentListResult(_serialization.Model): "value": {"key": "value", "type": "[ClusterPrincipalAssignment]"}, } - def __init__(self, *, value: Optional[List["_models.ClusterPrincipalAssignment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ClusterPrincipalAssignment"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto cluster principal assignments. :paramtype value: list[~azure.mgmt.kusto.models.ClusterPrincipalAssignment] @@ -1275,8 +1285,8 @@ def __init__( # pylint: disable=too-many-locals allowed_fqdn_list: Optional[List[str]] = None, public_ip_type: Union[str, "_models.PublicIPType"] = "IPv4", virtual_cluster_graduation_properties: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1387,7 +1397,7 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1443,7 +1453,7 @@ class DataConnection(ProxyResource): } } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1536,8 +1546,8 @@ def __init__( cosmos_db_database: Optional[str] = None, cosmos_db_container: Optional[str] = None, retrieval_start_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1616,7 +1626,7 @@ class Database(ProxyResource): _subtype_map = {"kind": {"ReadOnlyFollowing": "ReadOnlyFollowingDatabase", "ReadWrite": "ReadWriteDatabase"}} - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1637,7 +1647,7 @@ class DatabaseListResult(_serialization.Model): "value": {"key": "value", "type": "[Database]"}, } - def __init__(self, *, value: Optional[List["_models.Database"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Database"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto databases. :paramtype value: list[~azure.mgmt.kusto.models.Database] @@ -1696,8 +1706,8 @@ def __init__( fqn: Optional[str] = None, email: Optional[str] = None, app_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword role: Database principal role. Required. Known values are: "Admin", "Ingestor", "Monitor", "User", "UnrestrictedViewer", and "Viewer". @@ -1788,8 +1798,8 @@ def __init__( role: Optional[Union[str, "_models.DatabasePrincipalRole"]] = None, tenant_id: Optional[str] = None, principal_type: Optional[Union[str, "_models.PrincipalType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: The principal ID assigned to the database principal. It can be a user email, application ID, or security group name. @@ -1839,7 +1849,7 @@ class DatabasePrincipalAssignmentCheckNameRequest(_serialization.Model): type = "Microsoft.Kusto/clusters/databases/principalAssignments" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Principal Assignment resource name. Required. :paramtype name: str @@ -1859,7 +1869,7 @@ class DatabasePrincipalAssignmentListResult(_serialization.Model): "value": {"key": "value", "type": "[DatabasePrincipalAssignment]"}, } - def __init__(self, *, value: Optional[List["_models.DatabasePrincipalAssignment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DatabasePrincipalAssignment"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto database principal assignments. :paramtype value: list[~azure.mgmt.kusto.models.DatabasePrincipalAssignment] @@ -1879,7 +1889,7 @@ class DatabasePrincipalListRequest(_serialization.Model): "value": {"key": "value", "type": "[DatabasePrincipal]"}, } - def __init__(self, *, value: Optional[List["_models.DatabasePrincipal"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DatabasePrincipal"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto database principals. :paramtype value: list[~azure.mgmt.kusto.models.DatabasePrincipal] @@ -1899,7 +1909,7 @@ class DatabasePrincipalListResult(_serialization.Model): "value": {"key": "value", "type": "[DatabasePrincipal]"}, } - def __init__(self, *, value: Optional[List["_models.DatabasePrincipal"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DatabasePrincipal"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto database principals. :paramtype value: list[~azure.mgmt.kusto.models.DatabasePrincipal] @@ -1919,7 +1929,7 @@ class DatabaseStatistics(_serialization.Model): "size": {"key": "size", "type": "float"}, } - def __init__(self, *, size: Optional[float] = None, **kwargs): + def __init__(self, *, size: Optional[float] = None, **kwargs: Any) -> None: """ :keyword size: The database size - the total size of compressed data and index in bytes. :paramtype size: float @@ -1954,7 +1964,7 @@ class DataConnectionCheckNameRequest(_serialization.Model): type = "Microsoft.Kusto/clusters/databases/dataConnections" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Data Connection name. Required. :paramtype name: str @@ -1974,7 +1984,7 @@ class DataConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[DataConnection]"}, } - def __init__(self, *, value: Optional[List["_models.DataConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DataConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto data connections. :paramtype value: list[~azure.mgmt.kusto.models.DataConnection] @@ -2002,8 +2012,8 @@ def __init__( *, data_connection_name: Optional[str] = None, properties: Optional["_models.DataConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data_connection_name: The name of the data connection. :paramtype data_connection_name: str @@ -2026,7 +2036,9 @@ class DataConnectionValidationListResult(_serialization.Model): "value": {"key": "value", "type": "[DataConnectionValidationResult]"}, } - def __init__(self, *, value: Optional[List["_models.DataConnectionValidationResult"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.DataConnectionValidationResult"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of Kusto data connection validation errors. :paramtype value: list[~azure.mgmt.kusto.models.DataConnectionValidationResult] @@ -2046,7 +2058,7 @@ class DataConnectionValidationResult(_serialization.Model): "error_message": {"key": "errorMessage", "type": "str"}, } - def __init__(self, *, error_message: Optional[str] = None, **kwargs): + def __init__(self, *, error_message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword error_message: A message which indicates a problem in data connection validation. :paramtype error_message: str @@ -2066,7 +2078,7 @@ class DiagnoseVirtualNetworkResult(_serialization.Model): "findings": {"key": "findings", "type": "[str]"}, } - def __init__(self, *, findings: Optional[List[str]] = None, **kwargs): + def __init__(self, *, findings: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword findings: The list of network connectivity diagnostic finding. :paramtype findings: list[str] @@ -2094,8 +2106,8 @@ def __init__( *, domain_name: Optional[str] = None, endpoint_details: Optional[List["_models.EndpointDetail"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain_name: The domain name of the dependency. :paramtype domain_name: str @@ -2118,7 +2130,7 @@ class EndpointDetail(_serialization.Model): "port": {"key": "port", "type": "int"}, } - def __init__(self, *, port: Optional[int] = None, **kwargs): + def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: """ :keyword port: The port an endpoint is connected to. :paramtype port: int @@ -2232,8 +2244,8 @@ def __init__( blob_storage_event_type: Optional[Union[str, "_models.BlobStorageEventType"]] = None, managed_identity_resource_id: Optional[str] = None, database_routing: Optional[Union[str, "_models.DatabaseRouting"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -2390,8 +2402,8 @@ def __init__( managed_identity_resource_id: Optional[str] = None, database_routing: Optional[Union[str, "_models.DatabaseRouting"]] = None, retrieval_start_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -2482,7 +2494,7 @@ class FollowerDatabaseDefinition(_serialization.Model): "database_share_origin": {"key": "databaseShareOrigin", "type": "str"}, } - def __init__(self, *, cluster_resource_id: str, attached_database_configuration_name: str, **kwargs): + def __init__(self, *, cluster_resource_id: str, attached_database_configuration_name: str, **kwargs: Any) -> None: """ :keyword cluster_resource_id: Resource id of the cluster that follows a database owned by this cluster. Required. @@ -2510,7 +2522,7 @@ class FollowerDatabaseListResult(_serialization.Model): "value": {"key": "value", "type": "[FollowerDatabaseDefinition]"}, } - def __init__(self, *, value: Optional[List["_models.FollowerDatabaseDefinition"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.FollowerDatabaseDefinition"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of follower database result. :paramtype value: list[~azure.mgmt.kusto.models.FollowerDatabaseDefinition] @@ -2565,8 +2577,8 @@ def __init__( user_assigned_identities: Optional[ Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type @@ -2677,8 +2689,8 @@ def __init__( shared_access_policy_name: Optional[str] = None, database_routing: Optional[Union[str, "_models.DatabaseRouting"]] = None, retrieval_start_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -2751,8 +2763,8 @@ def __init__( key_version: Optional[str] = None, key_vault_uri: Optional[str] = None, user_identity: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: The name of the key vault key. :paramtype key_name: str @@ -2792,8 +2804,8 @@ def __init__( *, language_extension_name: Optional[Union[str, "_models.LanguageExtensionName"]] = None, language_extension_image_name: Optional[Union[str, "_models.LanguageExtensionImageName"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword language_extension_name: The language extension name. Known values are: "PYTHON" and "R". @@ -2819,7 +2831,7 @@ class LanguageExtensionsList(_serialization.Model): "value": {"key": "value", "type": "[LanguageExtension]"}, } - def __init__(self, *, value: Optional[List["_models.LanguageExtension"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.LanguageExtension"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of language extensions. :paramtype value: list[~azure.mgmt.kusto.models.LanguageExtension] @@ -2839,7 +2851,7 @@ class ListResourceSkusResult(_serialization.Model): "value": {"key": "value", "type": "[AzureResourceSku]"}, } - def __init__(self, *, value: Optional[List["_models.AzureResourceSku"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AzureResourceSku"]] = None, **kwargs: Any) -> None: """ :keyword value: The collection of available SKUs for an existing resource. :paramtype value: list[~azure.mgmt.kusto.models.AzureResourceSku] @@ -2905,8 +2917,8 @@ def __init__( private_link_resource_region: Optional[str] = None, group_id: Optional[str] = None, request_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_link_resource_id: The ARM resource ID of the resource for which the managed private endpoint is created. @@ -2939,7 +2951,7 @@ class ManagedPrivateEndpointListResult(_serialization.Model): "value": {"key": "value", "type": "[ManagedPrivateEndpoint]"}, } - def __init__(self, *, value: Optional[List["_models.ManagedPrivateEndpoint"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ManagedPrivateEndpoint"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of managed private endpoints. :paramtype value: list[~azure.mgmt.kusto.models.ManagedPrivateEndpoint] @@ -2975,7 +2987,7 @@ class ManagedPrivateEndpointsCheckNameRequest(_serialization.Model): type = "Microsoft.Kusto/clusters/managedPrivateEndpoints" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Managed private endpoint resource name. Required. :paramtype name: str @@ -3011,8 +3023,8 @@ def __init__( display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: This is of the format {provider}/{resource}/{operation}. :paramtype name: str @@ -3057,8 +3069,8 @@ def __init__( operation: Optional[str] = None, resource: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -3077,7 +3089,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + """Result of the request to list REST API operations. It contains a list of operations and a URL + nextLink to get the next set of results. :ivar value: The list of operations supported by the resource provider. :vartype value: list[~azure.mgmt.kusto.models.Operation] @@ -3090,7 +3103,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.kusto.models.Operation] @@ -3165,8 +3180,8 @@ def __init__( message: Optional[str] = None, operation_kind: Optional[str] = None, operation_state: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_time: The operation start time. :paramtype start_time: ~datetime.datetime @@ -3227,7 +3242,7 @@ class OptimizedAutoscale(_serialization.Model): "maximum": {"key": "maximum", "type": "int"}, } - def __init__(self, *, version: int, is_enabled: bool, minimum: int, maximum: int, **kwargs): + def __init__(self, *, version: int, is_enabled: bool, minimum: int, maximum: int, **kwargs: Any) -> None: """ :keyword version: The version of the template defined, for instance 1. Required. :paramtype version: int @@ -3247,7 +3262,8 @@ def __init__(self, *, version: int, is_enabled: bool, minimum: int, maximum: int class OutboundNetworkDependenciesEndpoint(ProxyResource): - """Endpoints accessed for a common purpose that the Kusto Service Environment requires outbound network access to. + """Endpoints accessed for a common purpose that the Kusto Service Environment requires outbound + network access to. Variables are only populated by the server, and will be ignored when sending a request. @@ -3294,8 +3310,8 @@ def __init__( *, category: Optional[str] = None, endpoints: Optional[List["_models.EndpointDependency"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword category: The type of service accessed by the Kusto Service Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. @@ -3333,7 +3349,7 @@ class OutboundNetworkDependenciesEndpointListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.OutboundNetworkDependenciesEndpoint"], **kwargs): + def __init__(self, *, value: List["_models.OutboundNetworkDependenciesEndpoint"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.kusto.models.OutboundNetworkDependenciesEndpoint] @@ -3398,8 +3414,8 @@ def __init__( self, *, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_link_service_connection_state: Connection State of the Private Endpoint Connection. @@ -3425,7 +3441,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private endpoint connections. :paramtype value: list[~azure.mgmt.kusto.models.PrivateEndpointConnection] @@ -3451,7 +3467,7 @@ class PrivateEndpointProperty(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -3500,7 +3516,7 @@ class PrivateLinkResource(Resource): "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.system_data = None @@ -3520,7 +3536,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private link resources. :paramtype value: list[~azure.mgmt.kusto.models.PrivateLinkResource] @@ -3553,7 +3569,7 @@ class PrivateLinkServiceConnectionStateProperty(_serialization.Model): "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword status: The private link service connection status. :paramtype status: str @@ -3653,8 +3669,8 @@ class ReadOnlyFollowingDatabase(Database): # pylint: disable=too-many-instance- } def __init__( - self, *, location: Optional[str] = None, hot_cache_period: Optional[datetime.timedelta] = None, **kwargs - ): + self, *, location: Optional[str] = None, hot_cache_period: Optional[datetime.timedelta] = None, **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -3739,8 +3755,8 @@ def __init__( location: Optional[str] = None, soft_delete_period: Optional[datetime.timedelta] = None, hot_cache_period: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -3781,7 +3797,7 @@ class ResourceSkuCapabilities(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -3810,7 +3826,7 @@ class ResourceSkuZoneDetails(_serialization.Model): "capabilities": {"key": "capabilities", "type": "[ResourceSkuCapabilities]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -3880,8 +3896,8 @@ def __init__( script_content: Optional[str] = None, force_update_tag: Optional[str] = None, continue_on_errors: bool = False, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword script_url: The url to the KQL script blob file. Must not be used together with scriptContent property. @@ -3935,7 +3951,7 @@ class ScriptCheckNameRequest(_serialization.Model): type = "Microsoft.Kusto/clusters/databases/scripts" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Script name. Required. :paramtype name: str @@ -3955,7 +3971,7 @@ class ScriptListResult(_serialization.Model): "value": {"key": "value", "type": "[Script]"}, } - def __init__(self, *, value: Optional[List["_models.Script"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Script"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto scripts. :paramtype value: list[~azure.mgmt.kusto.models.Script] @@ -4001,7 +4017,7 @@ class SkuDescription(_serialization.Model): "restrictions": {"key": "restrictions", "type": "[object]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_type = None @@ -4029,7 +4045,7 @@ class SkuDescriptionList(_serialization.Model): "value": {"key": "value", "type": "[SkuDescription]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -4064,8 +4080,8 @@ def __init__( location: str, zones: Optional[List[str]] = None, zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The available location of the SKU. Required. :paramtype location: str @@ -4117,8 +4133,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -4153,14 +4169,19 @@ class TableLevelSharingProperties(_serialization.Model): :vartype tables_to_exclude: list[str] :ivar external_tables_to_include: List of external tables to include in the follower database. :vartype external_tables_to_include: list[str] - :ivar external_tables_to_exclude: List of external tables exclude from the follower database. + :ivar external_tables_to_exclude: List of external tables to exclude from the follower + database. :vartype external_tables_to_exclude: list[str] :ivar materialized_views_to_include: List of materialized views to include in the follower database. :vartype materialized_views_to_include: list[str] - :ivar materialized_views_to_exclude: List of materialized views exclude from the follower + :ivar materialized_views_to_exclude: List of materialized views to exclude from the follower database. :vartype materialized_views_to_exclude: list[str] + :ivar functions_to_include: List of functions to include in the follower database. + :vartype functions_to_include: list[str] + :ivar functions_to_exclude: List of functions to exclude from the follower database. + :vartype functions_to_exclude: list[str] """ _attribute_map = { @@ -4170,6 +4191,8 @@ class TableLevelSharingProperties(_serialization.Model): "external_tables_to_exclude": {"key": "externalTablesToExclude", "type": "[str]"}, "materialized_views_to_include": {"key": "materializedViewsToInclude", "type": "[str]"}, "materialized_views_to_exclude": {"key": "materializedViewsToExclude", "type": "[str]"}, + "functions_to_include": {"key": "functionsToInclude", "type": "[str]"}, + "functions_to_exclude": {"key": "functionsToExclude", "type": "[str]"}, } def __init__( @@ -4181,8 +4204,10 @@ def __init__( external_tables_to_exclude: Optional[List[str]] = None, materialized_views_to_include: Optional[List[str]] = None, materialized_views_to_exclude: Optional[List[str]] = None, - **kwargs - ): + functions_to_include: Optional[List[str]] = None, + functions_to_exclude: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ :keyword tables_to_include: List of tables to include in the follower database. :paramtype tables_to_include: list[str] @@ -4191,15 +4216,19 @@ def __init__( :keyword external_tables_to_include: List of external tables to include in the follower database. :paramtype external_tables_to_include: list[str] - :keyword external_tables_to_exclude: List of external tables exclude from the follower + :keyword external_tables_to_exclude: List of external tables to exclude from the follower database. :paramtype external_tables_to_exclude: list[str] :keyword materialized_views_to_include: List of materialized views to include in the follower database. :paramtype materialized_views_to_include: list[str] - :keyword materialized_views_to_exclude: List of materialized views exclude from the follower + :keyword materialized_views_to_exclude: List of materialized views to exclude from the follower database. :paramtype materialized_views_to_exclude: list[str] + :keyword functions_to_include: List of functions to include in the follower database. + :paramtype functions_to_include: list[str] + :keyword functions_to_exclude: List of functions to exclude from the follower database. + :paramtype functions_to_exclude: list[str] """ super().__init__(**kwargs) self.tables_to_include = tables_to_include @@ -4208,6 +4237,8 @@ def __init__( self.external_tables_to_exclude = external_tables_to_exclude self.materialized_views_to_include = materialized_views_to_include self.materialized_views_to_exclude = materialized_views_to_exclude + self.functions_to_include = functions_to_include + self.functions_to_exclude = functions_to_exclude class TrustedExternalTenant(_serialization.Model): @@ -4221,7 +4252,7 @@ class TrustedExternalTenant(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: GUID representing an external tenant. :paramtype value: str @@ -4256,7 +4287,9 @@ class VirtualNetworkConfiguration(_serialization.Model): "data_management_public_ip_id": {"key": "dataManagementPublicIpId", "type": "str"}, } - def __init__(self, *, subnet_id: str, engine_public_ip_id: str, data_management_public_ip_id: str, **kwargs): + def __init__( + self, *, subnet_id: str, engine_public_ip_id: str, data_management_public_ip_id: str, **kwargs: Any + ) -> None: """ :keyword subnet_id: The subnet resource id. Required. :paramtype subnet_id: str diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py index d0330cd14ecb..5b307f6c62b1 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py @@ -49,7 +49,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -83,7 +83,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +118,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +197,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +340,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -410,7 +410,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AttachedDatabaseConfigurationListResult] = kwargs.pop("cls", None) @@ -513,7 +513,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AttachedDatabaseConfiguration] = kwargs.pop("cls", None) @@ -571,7 +571,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -750,7 +750,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -812,7 +812,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -876,7 +876,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py index cad9349706fb..ee3c232b3c6e 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py @@ -49,7 +49,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -83,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +180,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +319,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -398,7 +398,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterPrincipalAssignment] = kwargs.pop("cls", None) @@ -456,7 +456,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -631,7 +631,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -693,7 +693,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -756,7 +756,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -819,7 +819,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterPrincipalAssignmentListResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py index c588bc8c7e80..522e33b086d6 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py @@ -47,7 +47,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +84,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +122,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +158,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +187,7 @@ def build_stop_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +218,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -249,7 +249,7 @@ def build_list_follower_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,7 +280,7 @@ def build_detach_follower_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -314,7 +314,7 @@ def build_diagnose_virtual_network_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +343,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -371,7 +371,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -395,7 +395,7 @@ def build_list_skus_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +419,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -452,7 +452,7 @@ def build_list_skus_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -483,7 +483,7 @@ def build_list_outbound_network_dependencies_endpoints_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -514,7 +514,7 @@ def build_list_language_extensions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -545,7 +545,7 @@ def build_add_language_extensions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -579,7 +579,7 @@ def build_remove_language_extensions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -651,7 +651,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) @@ -709,7 +709,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -903,7 +903,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -971,7 +971,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1159,7 +1159,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1221,7 +1221,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1279,7 +1279,7 @@ def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1335,7 +1335,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1393,7 +1393,7 @@ def begin_stop(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1449,7 +1449,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1507,7 +1507,7 @@ def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1570,7 +1570,7 @@ def list_follower_databases( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FollowerDatabaseListResult] = kwargs.pop("cls", None) @@ -1661,7 +1661,7 @@ def _detach_follower_databases_initial( # pylint: disable=inconsistent-return-s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1813,7 +1813,7 @@ def begin_detach_follower_databases( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1872,7 +1872,7 @@ def _diagnose_virtual_network_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.DiagnoseVirtualNetworkResult]] = kwargs.pop("cls", None) @@ -1940,7 +1940,7 @@ def begin_diagnose_virtual_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DiagnoseVirtualNetworkResult] = kwargs.pop("cls", None) @@ -2001,7 +2001,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) @@ -2085,7 +2085,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) @@ -2166,7 +2166,7 @@ def list_skus(self, **kwargs: Any) -> Iterable["_models.SkuDescription"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SkuDescriptionList] = kwargs.pop("cls", None) @@ -2307,7 +2307,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2375,7 +2375,7 @@ def list_skus_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListResourceSkusResult] = kwargs.pop("cls", None) @@ -2469,7 +2469,7 @@ def list_outbound_network_dependencies_endpoints( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OutboundNetworkDependenciesEndpointListResult] = kwargs.pop("cls", None) @@ -2561,7 +2561,7 @@ def list_language_extensions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.LanguageExtensionsList] = kwargs.pop("cls", None) @@ -2652,7 +2652,7 @@ def _add_language_extensions_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2804,7 +2804,7 @@ def begin_add_language_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2867,7 +2867,7 @@ def _remove_language_extensions_initial( # pylint: disable=inconsistent-return- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -3019,7 +3019,7 @@ def begin_remove_language_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py index 5e814d2ae31e..0f39696cf6c7 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py @@ -49,7 +49,7 @@ def build_list_by_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_data_connection_validation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -116,7 +116,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -156,7 +156,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +194,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -235,7 +235,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -276,7 +276,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +343,7 @@ def list_by_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataConnectionListResult] = kwargs.pop("cls", None) @@ -436,7 +436,7 @@ def _data_connection_validation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -612,7 +612,7 @@ def begin_data_connection_validation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -764,7 +764,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -846,7 +846,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataConnection] = kwargs.pop("cls", None) @@ -906,7 +906,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1094,7 +1094,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1163,7 +1163,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1358,7 +1358,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1421,7 +1421,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1487,7 +1487,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py index b685825e2350..202682096f11 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py @@ -49,7 +49,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +201,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -350,7 +350,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -437,7 +437,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabasePrincipalAssignment] = kwargs.pop("cls", None) @@ -497,7 +497,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -682,7 +682,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -750,7 +750,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -821,7 +821,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -887,7 +887,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabasePrincipalAssignmentListResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py index 2ab148c601bc..28e3791579dd 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py @@ -49,7 +49,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -83,7 +83,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +114,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +152,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -195,7 +195,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -232,7 +232,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +264,7 @@ def build_list_principals_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -296,7 +296,7 @@ def build_add_principals_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -331,7 +331,7 @@ def build_remove_principals_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -471,7 +471,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -540,7 +540,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) @@ -640,7 +640,7 @@ def get(self, resource_group_name: str, cluster_name: str, database_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -699,7 +699,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -888,7 +888,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -957,7 +957,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1155,7 +1155,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1218,7 +1218,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1281,7 +1281,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1345,7 +1345,7 @@ def list_principals( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatabasePrincipalListResult] = kwargs.pop("cls", None) @@ -1521,7 +1521,7 @@ def add_principals( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1675,7 +1675,7 @@ def remove_principals( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py index b68490428e3d..bf1b995c3e0d 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py @@ -49,7 +49,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -81,7 +81,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +146,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -183,7 +183,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +220,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -359,7 +359,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -429,7 +429,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ManagedPrivateEndpointListResult] = kwargs.pop("cls", None) @@ -531,7 +531,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ManagedPrivateEndpoint] = kwargs.pop("cls", None) @@ -589,7 +589,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -765,7 +765,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -832,7 +832,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1010,7 +1010,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1072,7 +1072,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1135,7 +1135,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations.py index 751518eb4b0c..d2ccc8d648a4 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_location_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_location_operations.py index 59872ed6dcce..19fad0d53c9a 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_location_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_location_operations.py @@ -42,7 +42,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) # Construct URL _url = kwargs.pop( "template_url", @@ -107,7 +107,7 @@ def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py index 80d2e6b3bd22..689352860d8b 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py @@ -43,7 +43,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +111,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationResult] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py index a8c42c68444f..6619e274c235 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py @@ -47,7 +47,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -161,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +228,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) @@ -330,7 +330,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -388,7 +388,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -560,7 +560,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -622,7 +622,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -685,7 +685,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py index 7c555a09f450..691e21068ab5 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py @@ -45,7 +45,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +140,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) @@ -242,7 +242,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py index 304cdfc588d1..6de979c1bfe1 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py @@ -49,7 +49,7 @@ def build_list_by_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +124,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +165,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -206,7 +206,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +239,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -308,7 +308,7 @@ def list_by_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ScriptListResult] = kwargs.pop("cls", None) @@ -413,7 +413,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Script] = kwargs.pop("cls", None) @@ -473,7 +473,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -656,7 +656,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -725,7 +725,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -910,7 +910,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -973,7 +973,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1039,7 +1039,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1184,7 +1184,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_skus_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_skus_operations.py index 98d015181778..97e8f32c9e0a 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_skus_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_skus_operations.py @@ -45,7 +45,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-11")) + api_version: Literal["2022-12-29"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-29")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.SkuDescription _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-11"] = kwargs.pop( + api_version: Literal["2022-12-29"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SkuDescriptionList] = kwargs.pop("cls", None) diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configuration_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configuration_check_name_availability.py index 373c2ab432c4..faadb48d2cca 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configuration_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configuration_check_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoAttachedDatabaseConfigurationCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoAttachedDatabaseConfigurationCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_create_or_update.py index f92d6db58361..59c37de35092 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_create_or_update.py @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoAttachedDatabaseConfigurationsCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoAttachedDatabaseConfigurationsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_delete.py index 3a69b6ca2df1..00564c681896 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoAttachedDatabaseConfigurationsDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoAttachedDatabaseConfigurationsDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_get.py index 5064b58639f0..c6e2019a558c 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoAttachedDatabaseConfigurationsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoAttachedDatabaseConfigurationsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_list_by_cluster.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_list_by_cluster.py index c8311de12c6f..e4c8274c0869 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_list_by_cluster.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_attached_database_configurations_list_by_cluster.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoAttachedDatabaseConfigurationsListByCluster.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoAttachedDatabaseConfigurationsListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_add_language_extensions.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_add_language_extensions.py index 5a9f6c94a8a1..6d897476f26a 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_add_language_extensions.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_add_language_extensions.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterAddLanguageExtensions.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterAddLanguageExtensions.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_detach_follower_databases.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_detach_follower_databases.py index 367b28313eca..ea5fdcebb62e 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_detach_follower_databases.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_detach_follower_databases.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterDetachFollowerDatabases.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterDetachFollowerDatabases.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_follower_databases.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_follower_databases.py index f9d8cdc1dc46..a8a9efea8698 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_follower_databases.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_follower_databases.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterListFollowerDatabases.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterListFollowerDatabases.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_language_extensions.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_language_extensions.py index f13886190c5a..a1459477dcaf 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_language_extensions.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_list_language_extensions.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterListLanguageExtensions.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterListLanguageExtensions.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_check_name_availability.py index fc3ac0ee8cae..4425fb874d09 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_check_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterPrincipalAssignmentsCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterPrincipalAssignmentsCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_create_or_update.py index 93a5bf8bf029..f0302931be84 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterPrincipalAssignmentsCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterPrincipalAssignmentsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_delete.py index cbcf651de9ce..defea9b180a3 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterPrincipalAssignmentsDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterPrincipalAssignmentsDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_get.py index feb5417f09de..4f809232322c 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterPrincipalAssignmentsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterPrincipalAssignmentsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_list.py index de57c6af3b45..9ad61cf3332b 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_principal_assignments_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterPrincipalAssignmentsList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterPrincipalAssignmentsList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_remove_language_extensions.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_remove_language_extensions.py index 41ab25823e6a..e2c21fed2f83 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_remove_language_extensions.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_cluster_remove_language_extensions.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClusterRemoveLanguageExtensions.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClusterRemoveLanguageExtensions.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_check_name_availability.py index 1c60ce8619e3..c1bf39a85121 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_check_name_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_create_or_update.py index 5a85cd620cdf..046e0b4df465 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_create_or_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_delete.py index 6fc974e82dc5..f359c6252571 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_diagnose_virtual_network.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_diagnose_virtual_network.py index aa378a81970c..8279590cd5e2 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_diagnose_virtual_network.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_diagnose_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersDiagnoseVirtualNetwork.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersDiagnoseVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_get.py index cb8cc40c1c44..882465745a3b 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list.py index 03c240310a57..2c107ef64336 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_by_resource_group.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_by_resource_group.py index c2333d8b258e..84668b572934 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_by_resource_group.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersListByResourceGroup.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_resource_skus.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_resource_skus.py index 2aabc617590b..741045085420 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_resource_skus.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_resource_skus.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersListResourceSkus.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersListResourceSkus.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_skus.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_skus.py index 791c40cb2914..4fdd4c1adc01 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_skus.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_list_skus.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersListSkus.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersListSkus.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_start.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_start.py index 32fe2108f3ac..231d223d1ea7 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_start.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_start.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersStart.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersStart.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_stop.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_stop.py index 5cf062de71ea..0906f443acd5 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_stop.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_stop.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersStop.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersStop.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_update.py index 7e98ec68949f..77706107c061 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_clusters_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoClustersUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoClustersUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_event_grid_validation_async.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_event_grid_validation_async.py index acf20a9a00c2..fe84f68f0ac4 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_event_grid_validation_async.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_event_grid_validation_async.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionEventGridValidationAsync.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionEventGridValidationAsync.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_validation_async.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_validation_async.py index 9694528735a3..18322c66d2ce 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_validation_async.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connection_validation_async.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionValidationAsync.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionValidationAsync.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_check_name_availability.py index 61b465a13055..e844e8aa2ea0 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_check_name_availability.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_create_or_update.py index 3f2236800a00..1ae340c1e4b8 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_create_or_update.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsCosmosDbCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsCosmosDbCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_get.py index 8b4eaf7b65ed..c39beadae898 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsCosmosDbGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsCosmosDbGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_update.py index debc056ab5f0..6b5f4262e7fb 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_cosmos_db_update.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsCosmosDbUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsCosmosDbUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_create_or_update.py index c7b10d47095f..5d55ec930a09 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_create_or_update.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_delete.py index 6786f0d4153a..21cec350a5b4 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_delete.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_create_or_update.py index 95f6e5c33c41..7d3ecc4882ac 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_create_or_update.py @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsEventGridCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsEventGridCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_get.py index 9a1af8b5225e..27d8864aa059 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsEventGridGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsEventGridGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_update.py index ebc80dd0946e..386e344909fa 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_event_grid_update.py @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsEventGridUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsEventGridUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_get.py index f77a040ccd2f..9275dc3fa52e 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_list_by_database.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_list_by_database.py index 72c60497d795..b814327e3b9e 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_list_by_database.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_list_by_database.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsListByDatabase.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsListByDatabase.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_update.py index e313ed547521..5d7b97a0c2ad 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_data_connections_update.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDataConnectionsUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDataConnectionsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_add_principals.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_add_principals.py index d6fd72a109ca..6bcd9a953409 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_add_principals.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_add_principals.py @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabaseAddPrincipals.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabaseAddPrincipals.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_list_principals.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_list_principals.py index d500bf4782d9..294559a73306 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_list_principals.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_list_principals.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabaseListPrincipals.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabaseListPrincipals.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_check_name_availability.py index 52a266d21f36..c1a1bd69085e 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_check_name_availability.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasePrincipalAssignmentsCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasePrincipalAssignmentsCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_create_or_update.py index f1bb1fecaf20..9483e566765b 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_create_or_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasePrincipalAssignmentsCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasePrincipalAssignmentsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_delete.py index 2f8b210c8ac3..2be3f82a2d63 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_delete.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasePrincipalAssignmentsDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasePrincipalAssignmentsDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_get.py index e7e13f19218e..f834a5161d6c 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasePrincipalAssignmentsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasePrincipalAssignmentsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_list.py index e781c020b72e..36e49d284df3 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_principal_assignments_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasePrincipalAssignmentsList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasePrincipalAssignmentsList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_readonly_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_readonly_update.py index 6a554c128eaa..08b1d7eab7fe 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_readonly_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_readonly_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabaseReadonlyUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabaseReadonlyUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_remove_principals.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_remove_principals.py index 427fd7bcc5ae..daad934fb658 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_remove_principals.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_database_remove_principals.py @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabaseRemovePrincipals.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabaseRemovePrincipals.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_check_name_availability.py index 48fcd7e27230..891e53c656e6 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_check_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasesCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasesCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_create_or_update.py index 5598e24431bd..7d49250d435f 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_create_or_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasesCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasesCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_delete.py index 3eab793bd37c..825cc37de15a 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasesDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasesDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_get.py index 2c31f31129ed..a712cb0f901f 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasesGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasesGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_list_by_cluster.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_list_by_cluster.py index 2907d3863b92..7903a69f9136 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_list_by_cluster.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_list_by_cluster.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasesListByCluster.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasesListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_update.py index 9bdf32feecf2..a717fc0b5be8 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_databases_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoDatabasesUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoDatabasesUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_check_name_availability.py index 6775eaa278fc..d083c2ac2bc0 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_check_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoManagedPrivateEndpointsCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoManagedPrivateEndpointsCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_create_or_update.py index 934d1e78668e..5adf9a3833df 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoManagedPrivateEndpointsCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoManagedPrivateEndpointsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_delete.py index 236117994b03..8791bf504ebd 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoManagedPrivateEndpointsDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoManagedPrivateEndpointsDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_get.py index 0d9fe05ae2a8..8b8f557f721b 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoManagedPrivateEndpointsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoManagedPrivateEndpointsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_list.py index 2499fc8f7c1b..11af537e9705 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoManagedPrivateEndpointsList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoManagedPrivateEndpointsList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_update.py index 7e91039ae08d..7bb5ad328912 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_managed_private_endpoints_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoManagedPrivateEndpointsUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoManagedPrivateEndpointsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_get.py index 83935a2366db..45b858f5051f 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoOperationResultsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoOperationResultsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_operation_result_response_type_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_operation_result_response_type_get.py index 6829dfa707b3..11952e9b1514 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_operation_result_response_type_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operation_results_operation_result_response_type_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoOperationResultsOperationResultResponseTypeGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoOperationResultsOperationResultResponseTypeGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operations_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operations_list.py index ae9dc27af548..714e6d00dde2 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operations_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoOperationsList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoOperationsList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_outbound_network_dependencies_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_outbound_network_dependencies_list.py index 81cce490510e..7ccae7a32494 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_outbound_network_dependencies_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_outbound_network_dependencies_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoOutboundNetworkDependenciesList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoOutboundNetworkDependenciesList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_create_or_update.py index 2d1d8c2fc5ff..25be83a7820d 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoPrivateEndpointConnectionsCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoPrivateEndpointConnectionsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_delete.py index fd36590608da..a1292e15f521 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoPrivateEndpointConnectionsDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoPrivateEndpointConnectionsDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_get.py index ea4880a094d0..9cf43809d093 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoPrivateEndpointConnectionsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoPrivateEndpointConnectionsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_list.py index 0d325f5ec21c..79dfa77bbb7c 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_endpoint_connections_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoPrivateEndpointConnectionsList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoPrivateEndpointConnectionsList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_get.py index a086618f2e17..5996467d5f64 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoPrivateLinkResourcesGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoPrivateLinkResourcesGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_list.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_list.py index 43beed7a4996..09e2f8330ca5 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_list.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_private_link_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoPrivateLinkResourcesList.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoPrivateLinkResourcesList.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_check_name_availability.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_check_name_availability.py index f8fdf00604b8..0f1bf69cad8e 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_check_name_availability.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_check_name_availability.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoScriptsCheckNameAvailability.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoScriptsCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_create_or_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_create_or_update.py index b6daf9dea716..6082d8353862 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_create_or_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_create_or_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoScriptsCreateOrUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoScriptsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_delete.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_delete.py index 4e587c7b3ecf..7c57136c7528 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_delete.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_delete.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoScriptsDelete.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoScriptsDelete.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_get.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_get.py index b869233f976a..617e39a97d31 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_get.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoScriptsGet.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoScriptsGet.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_list_by_database.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_list_by_database.py index 398c09cc2aaf..0d004c9698e1 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_list_by_database.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_list_by_database.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoScriptsListByDatabase.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoScriptsListByDatabase.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_update.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_update.py index 584ecb307b0c..35be24fb4192 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_update.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_scripts_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoScriptsUpdate.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoScriptsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_skus.py b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_skus.py index d8acf19ee8f7..5c801139705b 100644 --- a/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_skus.py +++ b/sdk/kusto/azure-mgmt-kusto/generated_samples/kusto_skus.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-11-11/examples/KustoSkus.json +# x-ms-original-file: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-12-29/examples/KustoSkus.json if __name__ == "__main__": main() diff --git a/sdk/loadtestservice/azure-developer-loadtesting/CHANGELOG.md b/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md similarity index 70% rename from sdk/loadtestservice/azure-developer-loadtesting/CHANGELOG.md rename to sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md index 3c00e1795d5d..b7f550fbda5a 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/CHANGELOG.md +++ b/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md @@ -3,10 +3,18 @@ ## 1.0.0 (2023-01-23) ### Breaking Changes -- removed `azure.developer.loadtesting.LoadTestingClient.administration.upload_test_file` as it moved all functionality to `azure.developer.loadtesting.LoadTestingClient.administration.begin_upload_test_file` -- removed `azure.developer.loadtesting.aio.LoadTestingClient.administration.upload_test_file` as it moved all functionality to `azure.developer.loadtesting.aio.LoadTestingClient.administration.begin_upload_test_file` -- removed `azure.developer.loadtesting.LoadTestingClient.test_run.create_or_update_test_run` as it moved all functionality to `azure.developer.loadtesting.LoadTestingClient.test_run.begin_test_run` -- removed `azure.developer.loadtesting.aio.LoadTestingClient.test_run.create_or_update_test_run` as it moved all functionality to `azure.developer.loadtesting.aio.LoadTestingClient.test_run.begin_test_run` +- moved all operations under `azure.developer.loadtesting.LoadTestingClient.test_run` to `azure.developer.loadtesting.LoadTestRunClient` +- moved all operations under `azure.developer.loadtesting.LoadTestingClient.administration` to `azure.developer.loadtesting.LoadTestAdministrationClient` +- moved all operations under `azure.developer.loadtesting.aio.LoadTestingClient.test_run` to `azure.developer.loadtesting.aio.LoadTestRunClient` +- moved all operations under `azure.developer.loadtesting.aio.LoadTestingClient.administration` to `azure.developer.loadtesting.aio.LoadTestAdministrationClient` +- removed `azure.developer.loadtesting.LoadTestingClient.administration.upload_test_file` as it moved all functionality to `azure.developer.loadtesting.LoadTestAdministrationClient.begin_upload_test_file` +- removed `azure.developer.loadtesting.aio.LoadTestingClient.administration.upload_test_file` as it moved all functionality to `azure.developer.loadtesting.aio.LoadTestAdministrationClient.begin_upload_test_file` +- removed `azure.developer.loadtesting.LoadTestingClient.test_run.create_or_update_test_run` as it moved all functionality to `azure.developer.loadtesting.LoadTestRunClient.begin_test_run` +- removed `azure.developer.loadtesting.aio.LoadTestingClient.test_run.create_or_update_test_run` as it moved all functionality to `azure.developer.loadtesting.aio.LoadTestRunClient.begin_test_run` +- removed `azure.developer.loadtesting.aio.LoadTestingClient.test_run.list_metric_definitions` as it moved all functionality to `azure.developer.loadtesting.aio.LoadTestRunClient.get_metric_definitions` +- removed `azure.developer.loadtesting.LoadTestingClient.test_run.list_metric_definitions` as it moved all functionality to `azure.developer.loadtesting.LoadTestRunClient.get_metric_definitions` +- removed `azure.developer.loadtesting.aio.LoadTestingClient.test_run.list_metric_definitions` as it moved all functionality to `azure.developer.loadtesting.aio.LoadTestRunClient.get_metric_definitions` +- removed `azure.developer.loadtesting.LoadTestingClient.test_run.list_metric_namespaces` as it moved all functionality to `azure.developer.loadtesting.LoadTestRunClient.get_metric_namespaces` ### Other Changes - bumped version to stable `1.0.0` diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/LICENSE b/sdk/loadtesting/azure-developer-loadtesting/LICENSE similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/LICENSE rename to sdk/loadtesting/azure-developer-loadtesting/LICENSE diff --git a/sdk/loadtestservice/azure-developer-loadtesting/MANIFEST.in b/sdk/loadtesting/azure-developer-loadtesting/MANIFEST.in similarity index 59% rename from sdk/loadtestservice/azure-developer-loadtesting/MANIFEST.in rename to sdk/loadtesting/azure-developer-loadtesting/MANIFEST.in index 6ebb7e55a108..bfc592bbcc88 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/MANIFEST.in +++ b/sdk/loadtesting/azure-developer-loadtesting/MANIFEST.in @@ -1,7 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md include *.md +include azure/__init__.py +include azure/developer/__init__.py include LICENSE include azure/developer/loadtesting/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include azure/__init__.py -include azure/developer/__init__.py \ No newline at end of file diff --git a/sdk/loadtesting/azure-developer-loadtesting/README.md b/sdk/loadtesting/azure-developer-loadtesting/README.md new file mode 100644 index 000000000000..7ea54ac93635 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/README.md @@ -0,0 +1,63 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 3.7+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-developer-loadtesting +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.developer.loadtesting import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-developer-loadtesting%2FREADME.png) diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/__init__.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/__init__.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/__init__.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/__init__.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/__init__.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/__init__.py diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/__init__.py new file mode 100644 index 000000000000..4a0e34c91089 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/__init__.py @@ -0,0 +1,8 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from ._client import LoadTestAdministrationClient, LoadTestRunClient + +__all__ = ["LoadTestAdministrationClient", "LoadTestRunClient"] \ No newline at end of file diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_client.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_client.py new file mode 100644 index 000000000000..58851a9d3cac --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_client.py @@ -0,0 +1,97 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse + +from ._generated._configuration import LoadTestingClientConfiguration +from ._generated._serialization import Deserializer, Serializer +from ._generated.operations import AdministrationOperations, TestRunOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class _BaseClient: + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "https://{Endpoint}" + self._config = LoadTestingClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + super().__init__(self._client, self._config, self._serialize, self._deserialize) + + def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) + + +class LoadTestAdministrationClient(_BaseClient, AdministrationOperations): # pylint: disable=client-accepts-api-version-keyword + """These APIs allow end users to do various administrative operations on Azure Load Test Service. + + :param endpoint: URL to perform data plane API operations on the resource. Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __enter__(self) -> "AdministrationClient": + self._client.__enter__() + return self + +class LoadTestRunClient(_BaseClient, TestRunOperations): # pylint: disable=client-accepts-api-version-keyword + """These APIs allow end users to run Azure Load Test and manage test run. + + :param endpoint: URL to perform data plane API operations on the resource. Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __enter__(self) -> "TestRunClient": + self._client.__enter__() + return self + diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/__init__.py similarity index 90% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/__init__.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/__init__.py index 2b8aa025d9ba..8e63d39f5980 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/__init__.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_client.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_client.py similarity index 91% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_client.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_client.py index c503b4c86884..019c36cc6112 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_client.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_client.py @@ -25,9 +25,10 @@ class LoadTestingClient: # pylint: disable=client-accepts-api-version-keyword """These APIs allow end users to create, view and run load tests using Azure Load Test Service. :ivar administration: AdministrationOperations operations - :vartype administration: azure.developer.loadtesting.operations.AdministrationOperations + :vartype administration: + azure.developer.loadtesting._generated.operations.AdministrationOperations :ivar test_run: TestRunOperations operations - :vartype test_run: azure.developer.loadtesting.operations.TestRunOperations + :vartype test_run: azure.developer.loadtesting._generated.operations.TestRunOperations :param endpoint: URL to perform data plane API operations on the resource. Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. @@ -74,15 +75,12 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> LoadTestingClient + def __enter__(self) -> "LoadTestingClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_configuration.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_configuration.py similarity index 94% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_configuration.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_configuration.py index a9bb6eeea626..8731e1db8e0c 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_configuration.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_configuration.py @@ -41,7 +41,7 @@ class LoadTestingClientConfiguration(Configuration): # pylint: disable=too-many def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: super(LoadTestingClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-11-01") # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", "2022-11-01") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -55,10 +55,7 @@ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) kwargs.setdefault("sdk_moniker", "developer-loadtesting/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_patch.py similarity index 99% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_patch.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_patch.py index f672fcc9f7bf..7478f85edfe2 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_patch.py @@ -11,8 +11,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports pass - - __all__: List[str] = [] # Add all objects you want publicly available to users at this # package level diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_serialization.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_serialization.py similarity index 94% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_serialization.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_serialization.py index 7c1dedb5133d..f17c068e833e 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_serialization.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -606,13 +630,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_vendor.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_vendor.py similarity index 80% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_vendor.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_vendor.py index 54f238858ed8..8598d2b74592 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_vendor.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + def _format_url_section(template, **kwargs): components = template.split("/") @@ -12,6 +14,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_version.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_version.py similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_version.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/_version.py diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/__init__.py similarity index 90% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/__init__.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/__init__.py index 2eefa6ffbfa4..0f9a8d5b46a5 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/__init__.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_client.py similarity index 93% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_client.py index 3a5f8fd60988..2c01197961c1 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_client.py @@ -25,9 +25,10 @@ class LoadTestingClient: # pylint: disable=client-accepts-api-version-keyword """These APIs allow end users to create, view and run load tests using Azure Load Test Service. :ivar administration: AdministrationOperations operations - :vartype administration: azure.developer.loadtesting.aio.operations.AdministrationOperations + :vartype administration: + azure.developer.loadtesting._generated.aio.operations.AdministrationOperations :ivar test_run: TestRunOperations operations - :vartype test_run: azure.developer.loadtesting.aio.operations.TestRunOperations + :vartype test_run: azure.developer.loadtesting._generated.aio.operations.TestRunOperations :param endpoint: URL to perform data plane API operations on the resource. Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. @@ -81,5 +82,5 @@ async def __aenter__(self) -> "LoadTestingClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_configuration.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_configuration.py similarity index 97% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_configuration.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_configuration.py index 2aa478148c24..c6e58b2592e7 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_configuration.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_configuration.py @@ -41,7 +41,7 @@ class LoadTestingClientConfiguration(Configuration): # pylint: disable=too-many def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(LoadTestingClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-11-01") # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", "2022-11-01") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_patch.py similarity index 99% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_patch.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_patch.py index 85e5c711254a..7fa7d5a5e794 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_patch.py @@ -11,8 +11,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports pass - - __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_vendor.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_vendor.py similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/_vendor.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/_vendor.py diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/__init__.py similarity index 90% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/__init__.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/__init__.py index 93b41e04737c..499aa580cf02 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/__init__.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/__init__.py @@ -10,7 +10,7 @@ from ._operations import TestRunOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/_operations.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/_operations.py similarity index 88% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/_operations.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/_operations.py index ee67312af87d..0d2e9cc7a359 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/_operations.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/_operations.py @@ -45,12 +45,12 @@ build_test_run_create_or_update_server_metrics_config_request, build_test_run_delete_test_run_request, build_test_run_get_app_components_request, + build_test_run_get_metric_definitions_request, + build_test_run_get_metric_namespaces_request, build_test_run_get_server_metrics_config_request, build_test_run_get_test_run_file_request, build_test_run_get_test_run_request, - build_test_run_list_metric_definitions_request, build_test_run_list_metric_dimension_values_request, - build_test_run_list_metric_namespaces_request, build_test_run_list_metrics_request, build_test_run_list_test_runs_request, build_test_run_stop_test_run_request, @@ -71,7 +71,7 @@ class AdministrationOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.developer.loadtesting.aio.LoadTestingClient`'s + :class:`~azure.developer.loadtesting._generated.aio.LoadTestingClient`'s :attr:`administration` attribute. """ @@ -637,7 +637,7 @@ async def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwa :param test_id: Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_id: str - :param body: Load test model. Is either a model type or a IO type. Required. + :param body: Load test model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -649,6 +649,172 @@ async def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwa Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "certificate": { + "name": "str", # Optional. Name of the certificate. + "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" + "value": "str" # Optional. The value of the certificate for + respective type. + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "description": "str", # Optional. The test description. + "displayName": "str", # Optional. Display name of a test. + "environmentVariables": { + "str": "str" # Optional. Environment variables which are defined as + a set of pairs. + }, + "inputArtifacts": { + "additionalFileInfo": [ + { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + } + ], + "configFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + }, + "inputArtifactsZipFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + }, + "testScriptFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + }, + "userPropFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + } + }, + "keyvaultReferenceIdentityId": "str", # Optional. Resource Id of the managed + identity referencing the Key vault. + "keyvaultReferenceIdentityType": "str", # Optional. Type of the managed + identity referencing the Key vault. + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "loadTestConfiguration": { + "engineInstances": 0, # Optional. The number of engine instances to + execute load test. Supported values are in range of 1-45. Required for + creating a new test. + "optionalLoadTestConfig": { + "duration": 0, # Optional. Test run duration. + "endpointUrl": "str", # Optional. Test URL. Provide the + complete HTTP URL. For example, + http://contoso-app.azurewebsites.net/login. + "rampUpTime": 0, # Optional. Ramp up time. + "virtualUsers": 0 # Optional. No of concurrent virtual + users. + }, + "quickStartTest": False, # Optional. Default value is False. If + true, optionalLoadTestConfig is required and JMX script for the load test is + not required to upload. + "splitAllCSVs": False # Optional. Default value is False. If false, + Azure Load Testing copies and processes your input files unmodified across + all test engine instances. If true, Azure Load Testing splits the CSV input + data evenly across all engine instances. If you provide multiple CSV files, + each file will be split evenly. + }, + "passFailCriteria": { + "passFailMetrics": { + "str": { + "action": "continue", # Optional. Default value is + "continue". Action taken after the threshold is met. Default is + "u2018continue"u2019. Known values are: "continue" and "stop". + "actualValue": 0.0, # Optional. The actual value of + the client metric for the test run. + "aggregate": "str", # Optional. The aggregation + function to be applied on the client metric. Allowed functions - + "u2018percentage"u2019 - for error metric , "u2018avg"u2019, + "u2018p50"u2019, "u2018p90"u2019, "u2018p95"u2019, "u2018p99"u2019, + "u2018min"u2019, "u2018max"u2019 - for response_time_ms and latency + metric, "u2018avg"u2019 - for requests_per_sec, "u2018count"u2019 - + for requests. Known values are: "count", "percentage", "avg", "p50", + "p90", "p95", "p99", "min", and "max". + "clientMetric": "str", # Optional. The client metric + on which the criteria should be applied. Known values are: + "response_time_ms", "latency", "error", "requests", and + "requests_per_sec". + "condition": "str", # Optional. The comparison + operator. Supported types "u2018>"u2019, "u2018<"u2019. + "requestName": "str", # Optional. Request name for + which the Pass fail criteria has to be applied. + "result": "str", # Optional. Outcome of the test + run. Known values are: "passed", "undetermined", and "failed". + "value": 0.0 # Optional. The value to compare with + the client metric. Allowed values - "u2018error : [0.0 , 100.0] unit- + % "u2019, response_time_ms and latency : any integer value unit- ms. + } + } + }, + "secrets": { + "str": { + "type": "str", # Optional. Type of secret. Known values are: + "AKV_SECRET_URI" and "SECRET_VALUE". + "value": "str" # Optional. The value of the secret for the + respective type. + } + }, + "subnetId": "str", # Optional. Subnet ID on which the load test instances + should run. + "testId": "str" # Optional. Unique test name as identifier. + } + # response body for status code(s): 200, 201 response == { "certificate": { @@ -826,8 +992,8 @@ async def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -849,9 +1015,9 @@ async def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwa path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -874,9 +1040,9 @@ async def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwa deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace_async async def delete_test(self, test_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -902,7 +1068,7 @@ async def delete_test(self, test_id: str, **kwargs: Any) -> None: # pylint: dis _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_administration_delete_test_request( test_id=test_id, @@ -913,9 +1079,9 @@ async def delete_test(self, test_id: str, **kwargs: Any) -> None: # pylint: dis path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1121,7 +1287,7 @@ async def get_test(self, test_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_administration_get_test_request( test_id=test_id, @@ -1132,9 +1298,9 @@ async def get_test(self, test_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1359,7 +1525,7 @@ def list_tests( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1386,7 +1552,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -1406,7 +1572,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -1414,13 +1580,13 @@ async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1488,8 +1654,8 @@ async def begin_upload_test_file( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[JSON] = kwargs.pop("cls", None) _content = body @@ -1506,9 +1672,9 @@ async def begin_upload_test_file( path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1572,7 +1738,7 @@ async def get_test_file(self, test_id: str, file_name: str, **kwargs: Any) -> JS _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_administration_get_test_file_request( test_id=test_id, @@ -1584,9 +1750,9 @@ async def get_test_file(self, test_id: str, file_name: str, **kwargs: Any) -> JS path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1634,7 +1800,7 @@ async def delete_test_file( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_administration_delete_test_file_request( test_id=test_id, @@ -1646,9 +1812,9 @@ async def delete_test_file( # pylint: disable=inconsistent-return-statements path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1695,7 +1861,7 @@ def list_test_files(self, test_id: str, **kwargs: Any) -> AsyncIterable[JSON]: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1719,7 +1885,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -1739,7 +1905,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -1747,13 +1913,13 @@ async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1910,7 +2076,7 @@ async def create_or_update_app_components(self, test_id: str, body: Union[JSON, :param test_id: Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_id: str - :param body: App Component model. Is either a model type or a IO type. Required. + :param body: App Component model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -1922,6 +2088,35 @@ async def create_or_update_app_components(self, test_id: str, body: Union[JSON, Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "components": { + "str": { + "displayName": "str", # Optional. Azure resource display + name. + "kind": "str", # Optional. Kind of Azure resource type. + "resourceGroup": "str", # Optional. Resource group name of + the Azure resource. + "resourceId": "str", # Optional. fully qualified resource Id + e.g + subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + "resourceName": "str", # Optional. Azure resource name, + required while creating the app component. + "resourceType": "str", # Optional. Azure resource type, + required while creating the app component. + "subscriptionId": "str" # Optional. Subscription Id of the + Azure resource. + } + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "testId": "str" # Optional. Test identifier. + } + # response body for status code(s): 200, 201 response == { "components": { @@ -1962,8 +2157,8 @@ async def create_or_update_app_components(self, test_id: str, body: Union[JSON, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -1985,9 +2180,9 @@ async def create_or_update_app_components(self, test_id: str, body: Union[JSON, path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2010,9 +2205,9 @@ async def create_or_update_app_components(self, test_id: str, body: Union[JSON, deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace_async async def get_app_components(self, test_id: str, **kwargs: Any) -> JSON: @@ -2070,7 +2265,7 @@ async def get_app_components(self, test_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_administration_get_app_components_request( test_id=test_id, @@ -2081,9 +2276,9 @@ async def get_app_components(self, test_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2232,7 +2427,7 @@ async def create_or_update_server_metrics_config(self, test_id: str, body: Union :param test_id: Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_id: str - :param body: Server metric configuration model. Is either a model type or a IO type. Required. + :param body: Server metric configuration model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -2244,6 +2439,30 @@ async def create_or_update_server_metrics_config(self, test_id: str, body: Union Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "metrics": { + "str": { + "aggregation": "str", # Metric aggregation. Required. + "metricNamespace": "str", # Metric name space. Required. + "name": "str", # The invariant value of metric name. + Required. + "resourceId": "str", # Azure resource id. Required. + "resourceType": "str", # Azure resource type. Required. + "displayDescription": "str", # Optional. Metric description. + "id": "str", # Optional. Unique name for metric. + "unit": "str" # Optional. Metric unit. + } + }, + "testId": "str" # Optional. Test identifier. + } + # response body for status code(s): 200, 201 response == { "createdBy": "str", # Optional. The user that created. @@ -2279,8 +2498,8 @@ async def create_or_update_server_metrics_config(self, test_id: str, body: Union _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -2302,9 +2521,9 @@ async def create_or_update_server_metrics_config(self, test_id: str, body: Union path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2327,9 +2546,9 @@ async def create_or_update_server_metrics_config(self, test_id: str, body: Union deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace_async async def get_server_metrics_config(self, test_id: str, **kwargs: Any) -> JSON: @@ -2368,107 +2587,351 @@ async def get_server_metrics_config(self, test_id: str, **kwargs: Any) -> JSON: "unit": "str" # Optional. Metric unit. } }, - "testId": "str" # Optional. Test identifier. + "testId": "str" # Optional. Test identifier. + } + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + request = build_administration_get_server_metrics_config_request( + test_id=test_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) + + return cast(JSON, deserialized) + + +class TestRunOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.developer.loadtesting._generated.aio.LoadTestingClient`'s + :attr:`test_run` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def begin_test_run( + self, + test_run_id: str, + body: JSON, + *, + old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> JSON: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: JSON + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "certificate": { + "name": "str", # Optional. Name of the certificate. + "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" + "value": "str" # Optional. The value of the certificate for + respective type. + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "description": "str", # Optional. The test run description. + "displayName": "str", # Optional. Display name of a testRun. + "duration": 0, # Optional. Test run duration in milliseconds. + "endDateTime": "2020-02-20 00:00:00", # Optional. The test run end + DateTime(ISO 8601 literal format). + "environmentVariables": { + "str": "str" # Optional. Environment variables which are defined as + a set of pairs. + }, + "errorDetails": [ + { + "message": "str" # Optional. Error details in case test run + was not successfully run. + } + ], + "executedDateTime": "2020-02-20 00:00:00", # Optional. Test run initiated + time. + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "loadTestConfiguration": { + "engineInstances": 0, # Optional. The number of engine instances to + execute load test. Supported values are in range of 1-45. Required for + creating a new test. + "optionalLoadTestConfig": { + "duration": 0, # Optional. Test run duration. + "endpointUrl": "str", # Optional. Test URL. Provide the + complete HTTP URL. For example, + http://contoso-app.azurewebsites.net/login. + "rampUpTime": 0, # Optional. Ramp up time. + "virtualUsers": 0 # Optional. No of concurrent virtual + users. + }, + "quickStartTest": False, # Optional. Default value is False. If + true, optionalLoadTestConfig is required and JMX script for the load test is + not required to upload. + "splitAllCSVs": False # Optional. Default value is False. If false, + Azure Load Testing copies and processes your input files unmodified across + all test engine instances. If true, Azure Load Testing splits the CSV input + data evenly across all engine instances. If you provide multiple CSV files, + each file will be split evenly. + }, + "passFailCriteria": { + "passFailMetrics": { + "str": { + "action": "continue", # Optional. Default value is + "continue". Action taken after the threshold is met. Default is + "u2018continue"u2019. Known values are: "continue" and "stop". + "actualValue": 0.0, # Optional. The actual value of + the client metric for the test run. + "aggregate": "str", # Optional. The aggregation + function to be applied on the client metric. Allowed functions - + "u2018percentage"u2019 - for error metric , "u2018avg"u2019, + "u2018p50"u2019, "u2018p90"u2019, "u2018p95"u2019, "u2018p99"u2019, + "u2018min"u2019, "u2018max"u2019 - for response_time_ms and latency + metric, "u2018avg"u2019 - for requests_per_sec, "u2018count"u2019 - + for requests. Known values are: "count", "percentage", "avg", "p50", + "p90", "p95", "p99", "min", and "max". + "clientMetric": "str", # Optional. The client metric + on which the criteria should be applied. Known values are: + "response_time_ms", "latency", "error", "requests", and + "requests_per_sec". + "condition": "str", # Optional. The comparison + operator. Supported types "u2018>"u2019, "u2018<"u2019. + "requestName": "str", # Optional. Request name for + which the Pass fail criteria has to be applied. + "result": "str", # Optional. Outcome of the test + run. Known values are: "passed", "undetermined", and "failed". + "value": 0.0 # Optional. The value to compare with + the client metric. Allowed values - "u2018error : [0.0 , 100.0] unit- + % "u2019, response_time_ms and latency : any integer value unit- ms. + } + } + }, + "portalUrl": "str", # Optional. Portal url. + "secrets": { + "str": { + "type": "str", # Optional. Type of secret. Known values are: + "AKV_SECRET_URI" and "SECRET_VALUE". + "value": "str" # Optional. The value of the secret for the + respective type. + } + }, + "startDateTime": "2020-02-20 00:00:00", # Optional. The test run start + DateTime(ISO 8601 literal format). + "status": "str", # Optional. The test run status. Known values are: + "ACCEPTED", "NOTSTARTED", "PROVISIONING", "PROVISIONED", "CONFIGURING", + "CONFIGURED", "EXECUTING", "EXECUTED", "DEPROVISIONING", "DEPROVISIONED", "DONE", + "CANCELLING", "CANCELLED", "FAILED", "VALIDATION_SUCCESS", and + "VALIDATION_FAILURE". + "subnetId": "str", # Optional. Subnet ID on which the load test instances + should run. + "testArtifacts": { + "inputArtifacts": { + "additionalFileInfo": [ + { + "expireDateTime": "2020-02-20 00:00:00", # + Optional. Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the + file. + "fileType": "str", # Optional. File type. + Known values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # + Optional. Validation failure error details. + "validationStatus": "str" # Optional. + Validation status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", + "VALIDATION_INITIATED", and "VALIDATION_NOT_REQUIRED". + } + ], + "configFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "inputArtifactsZipFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "testScriptFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "userPropFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + } + }, + "outputArtifacts": { + "logsFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "resultFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + } + } + }, + "testId": "str", # Optional. Associated test Id. + "testResult": "str", # Optional. Test result for pass/Fail criteria used + during the test run. Known values are: "PASSED", "NOT_APPLICABLE", and "FAILED". + "testRunId": "str", # Optional. Unique test run name as identifier. + "testRunStatistics": { + "str": { + "errorCount": 0.0, # Optional. Error count. + "errorPct": 0.0, # Optional. Error percentage. + "maxResTime": 0.0, # Optional. Max response time. + "meanResTime": 0.0, # Optional. Mean response time. + "medianResTime": 0.0, # Optional. Median response time. + "minResTime": 0.0, # Optional. Minimum response time. + "pct1ResTime": 0.0, # Optional. 90 percentile response time. + "pct2ResTime": 0.0, # Optional. 95 percentile response time. + "pct3ResTime": 0.0, # Optional. 99 percentile response time. + "receivedKBytesPerSec": 0.0, # Optional. Received network + bytes. + "sampleCount": 0.0, # Optional. Sampler count. + "sentKBytesPerSec": 0.0, # Optional. Send network bytes. + "throughput": 0.0, # Optional. Throughput. + "transaction": "str" # Optional. Transaction name. + } + }, + "virtualUsers": 0 # Optional. Number of virtual users, for which test has + been run. } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[JSON] - - request = build_administration_get_server_metrics_config_request( - test_id=test_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) - - return cast(JSON, deserialized) - - -class TestRunOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.developer.loadtesting.aio.LoadTestingClient`'s - :attr:`test_run` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def begin_test_run( - self, - test_run_id: str, - body: JSON, - *, - old_test_run_id: Optional[str] = None, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> JSON: - """Create and start a new test run with the given name. - - Create and start a new test run with the given name. - - :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: Load test run model. Required. - :type body: JSON - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run in the request - body. Default value is None. - :paramtype old_test_run_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { + # response body for status code(s): 200, 201 + response == { "certificate": { "name": "str", # Optional. Name of the certificate. "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" @@ -2710,6 +3173,41 @@ async def begin_test_run( "virtualUsers": 0 # Optional. Number of virtual users, for which test has been run. } + """ + + @overload + async def begin_test_run( + self, + test_run_id: str, + body: IO, + *, + old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> JSON: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: IO + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python # response body for status code(s): 200, 201 response == { @@ -2956,15 +3454,9 @@ async def begin_test_run( } """ - @overload + @distributed_trace_async async def begin_test_run( - self, - test_run_id: str, - body: IO, - *, - old_test_run_id: Optional[str] = None, - content_type: str = "application/merge-patch+json", - **kwargs: Any + self, test_run_id: str, body: Union[JSON, IO], *, old_test_run_id: Optional[str] = None, **kwargs: Any ) -> JSON: """Create and start a new test run with the given name. @@ -2973,15 +3465,15 @@ async def begin_test_run( :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: Load test run model. Required. - :type body: IO + :param body: Load test run model. Is either a JSON type or a IO type. Required. + :type body: JSON or IO :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is provided, the test will run with the JMX file, configuration and app components from the existing test run. You can override the configuration values for new test run in the request body. Default value is None. :paramtype old_test_run_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". + :keyword content_type: Body Parameter content-type. Known values are: + 'application/merge-patch+json'. Default value is None. :paramtype content_type: str :return: JSON object :rtype: JSON @@ -2990,8 +3482,8 @@ async def begin_test_run( Example: .. code-block:: python - # response body for status code(s): 200, 201 - response == { + # JSON input template you can fill out and use as your body input. + body = { "certificate": { "name": "str", # Optional. Name of the certificate. "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" @@ -3233,35 +3725,6 @@ async def begin_test_run( "virtualUsers": 0 # Optional. Number of virtual users, for which test has been run. } - """ - - @distributed_trace_async - async def begin_test_run( - self, test_run_id: str, body: Union[JSON, IO], *, old_test_run_id: Optional[str] = None, **kwargs: Any - ) -> JSON: - """Create and start a new test run with the given name. - - Create and start a new test run with the given name. - - :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: Load test run model. Is either a model type or a IO type. Required. - :type body: JSON or IO - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run in the request - body. Default value is None. - :paramtype old_test_run_id: str - :keyword content_type: Body Parameter content-type. Known values are: - 'application/merge-patch+json'. Default value is None. - :paramtype content_type: str - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python # response body for status code(s): 200, 201 response == { @@ -3518,8 +3981,8 @@ async def begin_test_run( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -3542,9 +4005,9 @@ async def begin_test_run( path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3567,9 +4030,9 @@ async def begin_test_run( deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace_async async def get_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: @@ -3842,7 +4305,7 @@ async def get_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_test_run_request( test_run_id=test_run_id, @@ -3853,9 +4316,9 @@ async def get_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3901,7 +4364,7 @@ async def delete_test_run( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_test_run_delete_test_run_request( test_run_id=test_run_id, @@ -3912,9 +4375,9 @@ async def delete_test_run( # pylint: disable=inconsistent-return-statements path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3971,7 +4434,7 @@ async def get_test_run_file(self, test_run_id: str, file_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_test_run_file_request( test_run_id=test_run_id, @@ -3983,9 +4446,9 @@ async def get_test_run_file(self, test_run_id: str, file_name: str, **kwargs: An path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4292,7 +4755,7 @@ def list_test_runs( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -4321,7 +4784,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -4341,7 +4804,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -4349,13 +4812,13 @@ async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -4639,7 +5102,7 @@ async def stop_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_stop_test_run_request( test_run_id=test_run_id, @@ -4650,9 +5113,9 @@ async def stop_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4673,7 +5136,7 @@ async def stop_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) @distributed_trace_async - async def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: + async def get_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: """List the metric namespaces for a load test run. List the metric namespaces for a load test run. @@ -4709,9 +5172,9 @@ async def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) - request = build_test_run_list_metric_namespaces_request( + request = build_test_run_get_metric_namespaces_request( test_run_id=test_run_id, api_version=self._config.api_version, headers=_headers, @@ -4720,9 +5183,9 @@ async def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4743,7 +5206,7 @@ async def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) @distributed_trace_async - async def list_metric_definitions(self, test_run_id: str, *, metric_namespace: str, **kwargs: Any) -> JSON: + async def get_metric_definitions(self, test_run_id: str, *, metric_namespace: str, **kwargs: Any) -> JSON: """List the metric definitions for a load test run. List the metric definitions for a load test run. @@ -4809,9 +5272,9 @@ async def list_metric_definitions(self, test_run_id: str, *, metric_namespace: s _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) - request = build_test_run_list_metric_definitions_request( + request = build_test_run_get_metric_definitions_request( test_run_id=test_run_id, metric_namespace=metric_namespace, api_version=self._config.api_version, @@ -4821,9 +5284,9 @@ async def list_metric_definitions(self, test_run_id: str, *, metric_namespace: s path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5002,7 +5465,7 @@ def list_metrics( :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: Metric dimension filter. Is either a model type or a IO type. Default value is + :param body: Metric dimension filter. Is either a JSON type or a IO type. Default value is None. :type body: JSON or IO :keyword metricname: Metric name. Required. @@ -5027,6 +5490,19 @@ def list_metrics( Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "filters": [ + { + "name": "str", # Optional. The dimension name. + "values": [ + "str" # Optional. The dimension values. Maximum + values can be 20. + ] + } + ] + } + # response body for status code(s): 200 response == { "data": [ @@ -5047,8 +5523,8 @@ def list_metrics( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5090,7 +5566,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -5110,7 +5586,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -5118,13 +5594,13 @@ async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5181,7 +5657,7 @@ def list_metric_dimension_values( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5210,7 +5686,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -5230,7 +5706,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -5238,13 +5714,13 @@ async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5401,7 +5877,7 @@ async def create_or_update_app_components(self, test_run_id: str, body: Union[JS :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: App Component model. Is either a model type or a IO type. Required. + :param body: App Component model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -5413,6 +5889,35 @@ async def create_or_update_app_components(self, test_run_id: str, body: Union[JS Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "components": { + "str": { + "displayName": "str", # Optional. Azure resource display + name. + "kind": "str", # Optional. Kind of Azure resource type. + "resourceGroup": "str", # Optional. Resource group name of + the Azure resource. + "resourceId": "str", # Optional. fully qualified resource Id + e.g + subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + "resourceName": "str", # Optional. Azure resource name, + required while creating the app component. + "resourceType": "str", # Optional. Azure resource type, + required while creating the app component. + "subscriptionId": "str" # Optional. Subscription Id of the + Azure resource. + } + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "testRunId": "str" # Optional. Test run identifier. + } + # response body for status code(s): 200, 201 response == { "components": { @@ -5453,8 +5958,8 @@ async def create_or_update_app_components(self, test_run_id: str, body: Union[JS _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -5476,9 +5981,9 @@ async def create_or_update_app_components(self, test_run_id: str, body: Union[JS path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5501,9 +6006,9 @@ async def create_or_update_app_components(self, test_run_id: str, body: Union[JS deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace_async async def get_app_components(self, test_run_id: str, **kwargs: Any) -> JSON: @@ -5561,7 +6066,7 @@ async def get_app_components(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_app_components_request( test_run_id=test_run_id, @@ -5572,9 +6077,9 @@ async def get_app_components(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5725,7 +6230,7 @@ async def create_or_update_server_metrics_config( :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: Server metric configuration model. Is either a model type or a IO type. Required. + :param body: Server metric configuration model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -5737,6 +6242,30 @@ async def create_or_update_server_metrics_config( Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "metrics": { + "str": { + "aggregation": "str", # Metric aggregation. Required. + "metricNamespace": "str", # Metric name space. Required. + "name": "str", # The invariant value of metric name. + Required. + "resourceId": "str", # Azure resource id. Required. + "resourceType": "str", # Azure resource type. Required. + "displayDescription": "str", # Optional. Metric description. + "id": "str", # Optional. Unique name for metric. + "unit": "str" # Optional. Metric unit. + } + }, + "testRunId": "str" # Optional. Test run identifier. + } + # response body for status code(s): 200, 201 response == { "createdBy": "str", # Optional. The user that created. @@ -5772,8 +6301,8 @@ async def create_or_update_server_metrics_config( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -5795,9 +6324,9 @@ async def create_or_update_server_metrics_config( path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5820,9 +6349,9 @@ async def create_or_update_server_metrics_config( deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace_async async def get_server_metrics_config(self, test_run_id: str, **kwargs: Any) -> JSON: @@ -5875,7 +6404,7 @@ async def get_server_metrics_config(self, test_run_id: str, **kwargs: Any) -> JS _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_server_metrics_config_request( test_run_id=test_run_id, @@ -5886,9 +6415,9 @@ async def get_server_metrics_config(self, test_run_id: str, **kwargs: Any) -> JS path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/_patch.py similarity index 67% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/_patch.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/_patch.py index 493172d35689..763ae64110f3 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/aio/operations/_patch.py @@ -9,19 +9,19 @@ import asyncio import logging from functools import partial -from typing import List, Optional, Any, IO, Union, Callable +from typing import List, Optional, Any, IO, Union, Callable, overload, Generic, TypeVar -from azure.core.polling import NoPolling, AsyncNoPolling, AsyncPollingMethod, AsyncLROPoller -from azure.core.polling._async_poller import PollingReturnType +from azure.core.polling import AsyncPollingMethod, AsyncLROPoller from azure.core.tracing.decorator import distributed_trace from ._operations import AdministrationOperations as AdministrationOperationsGenerated, JSON from ._operations import TestRunOperations as TestRunOperationsGenerated +PollingReturnType = TypeVar("PollingReturnType") logger = logging.getLogger(__name__) -class AsyncLoadTestingPollingMethod(AsyncPollingMethod): +class AsyncLoadTestingPollingMethod(AsyncPollingMethod, Generic[PollingReturnType]): """Base class for custom async polling methods.""" def _update_status(self) -> None: @@ -83,7 +83,7 @@ def _update_status(self) -> None: self._status = self._resource["status"] -class AsyncLoadTestingLROPoller(AsyncLROPoller): +class AsyncLoadTestingLROPoller(AsyncLROPoller, Generic[PollingReturnType]): """Async poller for long-running operations. :param client: A pipeline service client @@ -109,7 +109,7 @@ def __init__( client, initial_response, deserialization_callback, polling_method ) - def get_initial_response(self) -> Any: + def get_initial_response(self) -> JSON: """Return the result of the initial operation. :return: The result of the initial operation. @@ -128,15 +128,8 @@ def __init__(self, *args, **kwargs): @distributed_trace async def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: IO, - *, - poll_for_validation_status: bool = True, - file_type: Optional[str] = None, - **kwargs: Any - ) -> AsyncLoadTestingLROPoller: + self, test_id: str, file_name: str, body: IO, *, file_type: Optional[str] = None, **kwargs: Any + ) -> AsyncLoadTestingLROPoller[JSON]: """Upload file to the test :param test_id: Unique id for the test @@ -147,10 +140,7 @@ async def begin_upload_test_file( :type body: IO :param file_type: Type of the file to be uploaded :type file_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An instance of LROPoller object to check the validation status of file - :param poll_for_validation_status: If true, polls for validation status of the file, else does not - :type poll_for_validation_status: bool :rtype: ~azure.core.polling.LROPoller :raises ~azure.core.exceptions.HttpResponseError: :raises ~azure.core.exceptions.ResourceNotFoundError: @@ -165,13 +155,10 @@ async def begin_upload_test_file( command = partial(self.get_test_file, test_id=test_id, file_name=file_name) - if poll_for_validation_status: - create_validation_status_polling = AsyncValidationCheckPoller(interval=polling_interval) - return AsyncLoadTestingLROPoller( - command, upload_test_file_operation, lambda *_: None, create_validation_status_polling - ) - else: - return AsyncLoadTestingLROPoller(command, upload_test_file_operation, lambda *_: None, AsyncNoPolling()) + create_validation_status_polling = AsyncValidationCheckPoller(interval=polling_interval) + return AsyncLoadTestingLROPoller( + command, upload_test_file_operation, lambda *_: None, create_validation_status_polling + ) class TestRunOperations(TestRunOperationsGenerated): @@ -182,16 +169,74 @@ class to perform operations on TestRun def __init__(self, *args, **kwargs): super(TestRunOperations, self).__init__(*args, **kwargs) - @distributed_trace + @overload + async def begin_test_run( + self, + test_run_id: str, + body: JSON, + *, + old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> AsyncLoadTestingLROPoller[JSON]: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: IO + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload async def begin_test_run( self, test_run_id: str, - body: Union[JSON, IO], + body: IO, *, - poll_for_test_run_status=True, old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> AsyncLoadTestingLROPoller: + ) -> AsyncLoadTestingLROPoller[JSON]: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: IO + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + async def begin_test_run( + self, test_run_id: str, body: Union[JSON, IO], *, old_test_run_id: Optional[str] = None, **kwargs: Any + ) -> AsyncLoadTestingLROPoller[JSON]: """Create and start a new test run with the given name. Create and start a new test run with the given name. @@ -205,8 +250,6 @@ async def begin_test_run( provided, the test will run with the JMX file, configuration and app components from the existing test run. You can override the configuration values for new test run in the request body. Default value is None. - :param poll_for_test_run_status: If true, polls for test run status, else does not - :type poll_for_test_run_status: bool :paramtype old_test_run_id: str :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -226,13 +269,10 @@ async def begin_test_run( command = partial(self.get_test_run, test_run_id=test_run_id) - if poll_for_test_run_status: - create_test_run_polling = AsyncTestRunStatusPoller(interval=polling_interval) - return AsyncLoadTestingLROPoller( - command, create_or_update_test_run_operation, lambda *_: None, create_test_run_polling - ) - else: - return AsyncLoadTestingLROPoller(command, create_or_update_test_run_operation, lambda *_: None, NoPolling()) + create_test_run_polling = AsyncTestRunStatusPoller(interval=polling_interval) + return AsyncLoadTestingLROPoller( + command, create_or_update_test_run_operation, lambda *_: None, create_test_run_polling + ) __all__: List[str] = ["AdministrationOperations", "TestRunOperations", "AsyncLoadTestingLROPoller"] diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/__init__.py similarity index 90% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/__init__.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/__init__.py index 93b41e04737c..499aa580cf02 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/aio/operations/__init__.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/__init__.py @@ -10,7 +10,7 @@ from ._operations import TestRunOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/_operations.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/_operations.py similarity index 87% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/_operations.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/_operations.py index 755bc1de7bbe..23f9e71de534 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/_operations.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/_operations.py @@ -49,8 +49,8 @@ def build_administration_create_or_update_test_request(test_id: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_administration_create_or_update_test_request(test_id: str, **kwargs: A "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +76,7 @@ def build_administration_delete_test_request(test_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_administration_delete_test_request(test_id: str, **kwargs: Any) -> Htt "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +100,7 @@ def build_administration_get_test_request(test_id: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_administration_get_test_request(test_id: str, **kwargs: Any) -> HttpRe "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +131,7 @@ def build_administration_list_tests_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,8 +162,8 @@ def build_administration_begin_upload_test_file_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +173,7 @@ def build_administration_begin_upload_test_file_request( "fileName": _SERIALIZER.url("file_name", file_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if file_type is not None: @@ -192,7 +192,7 @@ def build_administration_get_test_file_request(test_id: str, file_name: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +202,7 @@ def build_administration_get_test_file_request(test_id: str, file_name: str, **k "fileName": _SERIALIZER.url("file_name", file_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -217,7 +217,7 @@ def build_administration_delete_test_file_request(test_id: str, file_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -227,7 +227,7 @@ def build_administration_delete_test_file_request(test_id: str, file_name: str, "fileName": _SERIALIZER.url("file_name", file_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +242,7 @@ def build_administration_list_test_files_request(test_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +251,7 @@ def build_administration_list_test_files_request(test_id: str, **kwargs: Any) -> "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -266,8 +266,8 @@ def build_administration_create_or_update_app_components_request(test_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +276,7 @@ def build_administration_create_or_update_app_components_request(test_id: str, * "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -293,7 +293,7 @@ def build_administration_get_app_components_request(test_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +302,7 @@ def build_administration_get_app_components_request(test_id: str, **kwargs: Any) "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -317,8 +317,8 @@ def build_administration_create_or_update_server_metrics_config_request(test_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -327,7 +327,7 @@ def build_administration_create_or_update_server_metrics_config_request(test_id: "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -344,7 +344,7 @@ def build_administration_get_server_metrics_config_request(test_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -353,7 +353,7 @@ def build_administration_get_server_metrics_config_request(test_id: str, **kwarg "testId": _SERIALIZER.url("test_id", test_id, "str", max_length=50, min_length=2, pattern=r"^[a-z0-9_-]*$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -370,8 +370,8 @@ def build_test_run_begin_test_run_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -382,7 +382,7 @@ def build_test_run_begin_test_run_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if old_test_run_id is not None: @@ -401,7 +401,7 @@ def build_test_run_get_test_run_request(test_run_id: str, **kwargs: Any) -> Http _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -412,7 +412,7 @@ def build_test_run_get_test_run_request(test_run_id: str, **kwargs: Any) -> Http ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -427,7 +427,7 @@ def build_test_run_delete_test_run_request(test_run_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -438,7 +438,7 @@ def build_test_run_delete_test_run_request(test_run_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -453,7 +453,7 @@ def build_test_run_get_test_run_file_request(test_run_id: str, file_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -465,7 +465,7 @@ def build_test_run_get_test_run_file_request(test_run_id: str, file_name: str, * "fileName": _SERIALIZER.url("file_name", file_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -489,7 +489,7 @@ def build_test_run_list_test_runs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -520,7 +520,7 @@ def build_test_run_stop_test_run_request(test_run_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -531,7 +531,7 @@ def build_test_run_stop_test_run_request(test_run_id: str, **kwargs: Any) -> Htt ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -542,11 +542,11 @@ def build_test_run_stop_test_run_request(test_run_id: str, **kwargs: Any) -> Htt return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_test_run_list_metric_namespaces_request(test_run_id: str, **kwargs: Any) -> HttpRequest: +def build_test_run_get_metric_namespaces_request(test_run_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -557,7 +557,7 @@ def build_test_run_list_metric_namespaces_request(test_run_id: str, **kwargs: An ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -568,13 +568,13 @@ def build_test_run_list_metric_namespaces_request(test_run_id: str, **kwargs: An return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_test_run_list_metric_definitions_request( +def build_test_run_get_metric_definitions_request( test_run_id: str, *, metric_namespace: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -585,7 +585,7 @@ def build_test_run_list_metric_definitions_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["metricNamespace"] = _SERIALIZER.query("metric_namespace", metric_namespace, "str") @@ -610,8 +610,8 @@ def build_test_run_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -622,7 +622,7 @@ def build_test_run_list_metrics_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if aggregation is not None: @@ -655,7 +655,7 @@ def build_test_run_list_metric_dimension_values_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -667,7 +667,7 @@ def build_test_run_list_metric_dimension_values_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if interval is not None: @@ -687,8 +687,8 @@ def build_test_run_create_or_update_app_components_request(test_run_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -699,7 +699,7 @@ def build_test_run_create_or_update_app_components_request(test_run_id: str, **k ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -716,7 +716,7 @@ def build_test_run_get_app_components_request(test_run_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -727,7 +727,7 @@ def build_test_run_get_app_components_request(test_run_id: str, **kwargs: Any) - ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -742,8 +742,8 @@ def build_test_run_create_or_update_server_metrics_config_request(test_run_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -754,7 +754,7 @@ def build_test_run_create_or_update_server_metrics_config_request(test_run_id: s ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -771,7 +771,7 @@ def build_test_run_get_server_metrics_config_request(test_run_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: Literal["2022-11-01"] + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -782,7 +782,7 @@ def build_test_run_get_server_metrics_config_request(test_run_id: str, **kwargs: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -799,7 +799,7 @@ class AdministrationOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.developer.loadtesting.LoadTestingClient`'s + :class:`~azure.developer.loadtesting._generated.LoadTestingClient`'s :attr:`administration` attribute. """ @@ -1365,7 +1365,7 @@ def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwargs: A :param test_id: Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_id: str - :param body: Load test model. Is either a model type or a IO type. Required. + :param body: Load test model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -1377,6 +1377,172 @@ def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwargs: A Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "certificate": { + "name": "str", # Optional. Name of the certificate. + "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" + "value": "str" # Optional. The value of the certificate for + respective type. + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "description": "str", # Optional. The test description. + "displayName": "str", # Optional. Display name of a test. + "environmentVariables": { + "str": "str" # Optional. Environment variables which are defined as + a set of pairs. + }, + "inputArtifacts": { + "additionalFileInfo": [ + { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + } + ], + "configFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + }, + "inputArtifactsZipFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + }, + "testScriptFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + }, + "userPropFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. Expiry + time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known values are: + "JMX_FILE", "USER_PROPERTIES", and "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. Validation + failure error details. + "validationStatus": "str" # Optional. Validation status of + the file. Known values are: "NOT_VALIDATED", "VALIDATION_SUCCESS", + "VALIDATION_FAILURE", "VALIDATION_INITIATED", and + "VALIDATION_NOT_REQUIRED". + } + }, + "keyvaultReferenceIdentityId": "str", # Optional. Resource Id of the managed + identity referencing the Key vault. + "keyvaultReferenceIdentityType": "str", # Optional. Type of the managed + identity referencing the Key vault. + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "loadTestConfiguration": { + "engineInstances": 0, # Optional. The number of engine instances to + execute load test. Supported values are in range of 1-45. Required for + creating a new test. + "optionalLoadTestConfig": { + "duration": 0, # Optional. Test run duration. + "endpointUrl": "str", # Optional. Test URL. Provide the + complete HTTP URL. For example, + http://contoso-app.azurewebsites.net/login. + "rampUpTime": 0, # Optional. Ramp up time. + "virtualUsers": 0 # Optional. No of concurrent virtual + users. + }, + "quickStartTest": False, # Optional. Default value is False. If + true, optionalLoadTestConfig is required and JMX script for the load test is + not required to upload. + "splitAllCSVs": False # Optional. Default value is False. If false, + Azure Load Testing copies and processes your input files unmodified across + all test engine instances. If true, Azure Load Testing splits the CSV input + data evenly across all engine instances. If you provide multiple CSV files, + each file will be split evenly. + }, + "passFailCriteria": { + "passFailMetrics": { + "str": { + "action": "continue", # Optional. Default value is + "continue". Action taken after the threshold is met. Default is + "u2018continue"u2019. Known values are: "continue" and "stop". + "actualValue": 0.0, # Optional. The actual value of + the client metric for the test run. + "aggregate": "str", # Optional. The aggregation + function to be applied on the client metric. Allowed functions - + "u2018percentage"u2019 - for error metric , "u2018avg"u2019, + "u2018p50"u2019, "u2018p90"u2019, "u2018p95"u2019, "u2018p99"u2019, + "u2018min"u2019, "u2018max"u2019 - for response_time_ms and latency + metric, "u2018avg"u2019 - for requests_per_sec, "u2018count"u2019 - + for requests. Known values are: "count", "percentage", "avg", "p50", + "p90", "p95", "p99", "min", and "max". + "clientMetric": "str", # Optional. The client metric + on which the criteria should be applied. Known values are: + "response_time_ms", "latency", "error", "requests", and + "requests_per_sec". + "condition": "str", # Optional. The comparison + operator. Supported types "u2018>"u2019, "u2018<"u2019. + "requestName": "str", # Optional. Request name for + which the Pass fail criteria has to be applied. + "result": "str", # Optional. Outcome of the test + run. Known values are: "passed", "undetermined", and "failed". + "value": 0.0 # Optional. The value to compare with + the client metric. Allowed values - "u2018error : [0.0 , 100.0] unit- + % "u2019, response_time_ms and latency : any integer value unit- ms. + } + } + }, + "secrets": { + "str": { + "type": "str", # Optional. Type of secret. Known values are: + "AKV_SECRET_URI" and "SECRET_VALUE". + "value": "str" # Optional. The value of the secret for the + respective type. + } + }, + "subnetId": "str", # Optional. Subnet ID on which the load test instances + should run. + "testId": "str" # Optional. Unique test name as identifier. + } + # response body for status code(s): 200, 201 response == { "certificate": { @@ -1554,8 +1720,8 @@ def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -1577,9 +1743,9 @@ def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwargs: A path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1602,9 +1768,9 @@ def create_or_update_test(self, test_id: str, body: Union[JSON, IO], **kwargs: A deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace def delete_test(self, test_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -1630,7 +1796,7 @@ def delete_test(self, test_id: str, **kwargs: Any) -> None: # pylint: disable=i _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_administration_delete_test_request( test_id=test_id, @@ -1641,9 +1807,9 @@ def delete_test(self, test_id: str, **kwargs: Any) -> None: # pylint: disable=i path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1849,7 +2015,7 @@ def get_test(self, test_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_administration_get_test_request( test_id=test_id, @@ -1860,9 +2026,9 @@ def get_test(self, test_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2087,7 +2253,7 @@ def list_tests( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2114,7 +2280,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -2134,7 +2300,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -2142,13 +2308,13 @@ def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2216,8 +2382,8 @@ def begin_upload_test_file( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[JSON] = kwargs.pop("cls", None) _content = body @@ -2234,9 +2400,9 @@ def begin_upload_test_file( path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2300,7 +2466,7 @@ def get_test_file(self, test_id: str, file_name: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_administration_get_test_file_request( test_id=test_id, @@ -2312,9 +2478,9 @@ def get_test_file(self, test_id: str, file_name: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2362,7 +2528,7 @@ def delete_test_file( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_administration_delete_test_file_request( test_id=test_id, @@ -2374,9 +2540,9 @@ def delete_test_file( # pylint: disable=inconsistent-return-statements path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2423,7 +2589,7 @@ def list_test_files(self, test_id: str, **kwargs: Any) -> Iterable[JSON]: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2447,7 +2613,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -2467,7 +2633,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -2475,13 +2641,13 @@ def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2638,7 +2804,7 @@ def create_or_update_app_components(self, test_id: str, body: Union[JSON, IO], * :param test_id: Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_id: str - :param body: App Component model. Is either a model type or a IO type. Required. + :param body: App Component model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -2650,6 +2816,35 @@ def create_or_update_app_components(self, test_id: str, body: Union[JSON, IO], * Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "components": { + "str": { + "displayName": "str", # Optional. Azure resource display + name. + "kind": "str", # Optional. Kind of Azure resource type. + "resourceGroup": "str", # Optional. Resource group name of + the Azure resource. + "resourceId": "str", # Optional. fully qualified resource Id + e.g + subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + "resourceName": "str", # Optional. Azure resource name, + required while creating the app component. + "resourceType": "str", # Optional. Azure resource type, + required while creating the app component. + "subscriptionId": "str" # Optional. Subscription Id of the + Azure resource. + } + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "testId": "str" # Optional. Test identifier. + } + # response body for status code(s): 200, 201 response == { "components": { @@ -2690,8 +2885,8 @@ def create_or_update_app_components(self, test_id: str, body: Union[JSON, IO], * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -2713,9 +2908,9 @@ def create_or_update_app_components(self, test_id: str, body: Union[JSON, IO], * path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2738,9 +2933,9 @@ def create_or_update_app_components(self, test_id: str, body: Union[JSON, IO], * deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace def get_app_components(self, test_id: str, **kwargs: Any) -> JSON: @@ -2798,7 +2993,7 @@ def get_app_components(self, test_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_administration_get_app_components_request( test_id=test_id, @@ -2809,9 +3004,9 @@ def get_app_components(self, test_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2960,7 +3155,7 @@ def create_or_update_server_metrics_config(self, test_id: str, body: Union[JSON, :param test_id: Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_id: str - :param body: Server metric configuration model. Is either a model type or a IO type. Required. + :param body: Server metric configuration model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -2972,6 +3167,30 @@ def create_or_update_server_metrics_config(self, test_id: str, body: Union[JSON, Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "metrics": { + "str": { + "aggregation": "str", # Metric aggregation. Required. + "metricNamespace": "str", # Metric name space. Required. + "name": "str", # The invariant value of metric name. + Required. + "resourceId": "str", # Azure resource id. Required. + "resourceType": "str", # Azure resource type. Required. + "displayDescription": "str", # Optional. Metric description. + "id": "str", # Optional. Unique name for metric. + "unit": "str" # Optional. Metric unit. + } + }, + "testId": "str" # Optional. Test identifier. + } + # response body for status code(s): 200, 201 response == { "createdBy": "str", # Optional. The user that created. @@ -3007,8 +3226,8 @@ def create_or_update_server_metrics_config(self, test_id: str, body: Union[JSON, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -3030,9 +3249,9 @@ def create_or_update_server_metrics_config(self, test_id: str, body: Union[JSON, path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3055,9 +3274,9 @@ def create_or_update_server_metrics_config(self, test_id: str, body: Union[JSON, deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace def get_server_metrics_config(self, test_id: str, **kwargs: Any) -> JSON: @@ -3096,107 +3315,351 @@ def get_server_metrics_config(self, test_id: str, **kwargs: Any) -> JSON: "unit": "str" # Optional. Metric unit. } }, - "testId": "str" # Optional. Test identifier. + "testId": "str" # Optional. Test identifier. + } + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + request = build_administration_get_server_metrics_config_request( + test_id=test_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) + + return cast(JSON, deserialized) + + +class TestRunOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.developer.loadtesting._generated.LoadTestingClient`'s + :attr:`test_run` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def begin_test_run( + self, + test_run_id: str, + body: JSON, + *, + old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> JSON: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: JSON + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "certificate": { + "name": "str", # Optional. Name of the certificate. + "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" + "value": "str" # Optional. The value of the certificate for + respective type. + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "description": "str", # Optional. The test run description. + "displayName": "str", # Optional. Display name of a testRun. + "duration": 0, # Optional. Test run duration in milliseconds. + "endDateTime": "2020-02-20 00:00:00", # Optional. The test run end + DateTime(ISO 8601 literal format). + "environmentVariables": { + "str": "str" # Optional. Environment variables which are defined as + a set of pairs. + }, + "errorDetails": [ + { + "message": "str" # Optional. Error details in case test run + was not successfully run. + } + ], + "executedDateTime": "2020-02-20 00:00:00", # Optional. Test run initiated + time. + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "loadTestConfiguration": { + "engineInstances": 0, # Optional. The number of engine instances to + execute load test. Supported values are in range of 1-45. Required for + creating a new test. + "optionalLoadTestConfig": { + "duration": 0, # Optional. Test run duration. + "endpointUrl": "str", # Optional. Test URL. Provide the + complete HTTP URL. For example, + http://contoso-app.azurewebsites.net/login. + "rampUpTime": 0, # Optional. Ramp up time. + "virtualUsers": 0 # Optional. No of concurrent virtual + users. + }, + "quickStartTest": False, # Optional. Default value is False. If + true, optionalLoadTestConfig is required and JMX script for the load test is + not required to upload. + "splitAllCSVs": False # Optional. Default value is False. If false, + Azure Load Testing copies and processes your input files unmodified across + all test engine instances. If true, Azure Load Testing splits the CSV input + data evenly across all engine instances. If you provide multiple CSV files, + each file will be split evenly. + }, + "passFailCriteria": { + "passFailMetrics": { + "str": { + "action": "continue", # Optional. Default value is + "continue". Action taken after the threshold is met. Default is + "u2018continue"u2019. Known values are: "continue" and "stop". + "actualValue": 0.0, # Optional. The actual value of + the client metric for the test run. + "aggregate": "str", # Optional. The aggregation + function to be applied on the client metric. Allowed functions - + "u2018percentage"u2019 - for error metric , "u2018avg"u2019, + "u2018p50"u2019, "u2018p90"u2019, "u2018p95"u2019, "u2018p99"u2019, + "u2018min"u2019, "u2018max"u2019 - for response_time_ms and latency + metric, "u2018avg"u2019 - for requests_per_sec, "u2018count"u2019 - + for requests. Known values are: "count", "percentage", "avg", "p50", + "p90", "p95", "p99", "min", and "max". + "clientMetric": "str", # Optional. The client metric + on which the criteria should be applied. Known values are: + "response_time_ms", "latency", "error", "requests", and + "requests_per_sec". + "condition": "str", # Optional. The comparison + operator. Supported types "u2018>"u2019, "u2018<"u2019. + "requestName": "str", # Optional. Request name for + which the Pass fail criteria has to be applied. + "result": "str", # Optional. Outcome of the test + run. Known values are: "passed", "undetermined", and "failed". + "value": 0.0 # Optional. The value to compare with + the client metric. Allowed values - "u2018error : [0.0 , 100.0] unit- + % "u2019, response_time_ms and latency : any integer value unit- ms. + } + } + }, + "portalUrl": "str", # Optional. Portal url. + "secrets": { + "str": { + "type": "str", # Optional. Type of secret. Known values are: + "AKV_SECRET_URI" and "SECRET_VALUE". + "value": "str" # Optional. The value of the secret for the + respective type. + } + }, + "startDateTime": "2020-02-20 00:00:00", # Optional. The test run start + DateTime(ISO 8601 literal format). + "status": "str", # Optional. The test run status. Known values are: + "ACCEPTED", "NOTSTARTED", "PROVISIONING", "PROVISIONED", "CONFIGURING", + "CONFIGURED", "EXECUTING", "EXECUTED", "DEPROVISIONING", "DEPROVISIONED", "DONE", + "CANCELLING", "CANCELLED", "FAILED", "VALIDATION_SUCCESS", and + "VALIDATION_FAILURE". + "subnetId": "str", # Optional. Subnet ID on which the load test instances + should run. + "testArtifacts": { + "inputArtifacts": { + "additionalFileInfo": [ + { + "expireDateTime": "2020-02-20 00:00:00", # + Optional. Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the + file. + "fileType": "str", # Optional. File type. + Known values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # + Optional. Validation failure error details. + "validationStatus": "str" # Optional. + Validation status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", + "VALIDATION_INITIATED", and "VALIDATION_NOT_REQUIRED". + } + ], + "configFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "inputArtifactsZipFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "testScriptFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "userPropFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + } + }, + "outputArtifacts": { + "logsFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + }, + "resultFileInfo": { + "expireDateTime": "2020-02-20 00:00:00", # Optional. + Expiry time of the file (ISO 8601 literal format). + "fileName": "str", # Optional. Name of the file. + "fileType": "str", # Optional. File type. Known + values are: "JMX_FILE", "USER_PROPERTIES", and + "ADDITIONAL_ARTIFACTS". + "url": "str", # Optional. File URL. + "validationFailureDetails": "str", # Optional. + Validation failure error details. + "validationStatus": "str" # Optional. Validation + status of the file. Known values are: "NOT_VALIDATED", + "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", + and "VALIDATION_NOT_REQUIRED". + } + } + }, + "testId": "str", # Optional. Associated test Id. + "testResult": "str", # Optional. Test result for pass/Fail criteria used + during the test run. Known values are: "PASSED", "NOT_APPLICABLE", and "FAILED". + "testRunId": "str", # Optional. Unique test run name as identifier. + "testRunStatistics": { + "str": { + "errorCount": 0.0, # Optional. Error count. + "errorPct": 0.0, # Optional. Error percentage. + "maxResTime": 0.0, # Optional. Max response time. + "meanResTime": 0.0, # Optional. Mean response time. + "medianResTime": 0.0, # Optional. Median response time. + "minResTime": 0.0, # Optional. Minimum response time. + "pct1ResTime": 0.0, # Optional. 90 percentile response time. + "pct2ResTime": 0.0, # Optional. 95 percentile response time. + "pct3ResTime": 0.0, # Optional. 99 percentile response time. + "receivedKBytesPerSec": 0.0, # Optional. Received network + bytes. + "sampleCount": 0.0, # Optional. Sampler count. + "sentKBytesPerSec": 0.0, # Optional. Send network bytes. + "throughput": 0.0, # Optional. Throughput. + "transaction": "str" # Optional. Transaction name. + } + }, + "virtualUsers": 0 # Optional. Number of virtual users, for which test has + been run. } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[JSON] - - request = build_administration_get_server_metrics_config_request( - test_id=test_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) - - return cast(JSON, deserialized) - - -class TestRunOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.developer.loadtesting.LoadTestingClient`'s - :attr:`test_run` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def begin_test_run( - self, - test_run_id: str, - body: JSON, - *, - old_test_run_id: Optional[str] = None, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> JSON: - """Create and start a new test run with the given name. - - Create and start a new test run with the given name. - - :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: Load test run model. Required. - :type body: JSON - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run in the request - body. Default value is None. - :paramtype old_test_run_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { + # response body for status code(s): 200, 201 + response == { "certificate": { "name": "str", # Optional. Name of the certificate. "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" @@ -3438,6 +3901,41 @@ def begin_test_run( "virtualUsers": 0 # Optional. Number of virtual users, for which test has been run. } + """ + + @overload + def begin_test_run( + self, + test_run_id: str, + body: IO, + *, + old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> JSON: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: IO + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python # response body for status code(s): 200, 201 response == { @@ -3684,15 +4182,9 @@ def begin_test_run( } """ - @overload + @distributed_trace def begin_test_run( - self, - test_run_id: str, - body: IO, - *, - old_test_run_id: Optional[str] = None, - content_type: str = "application/merge-patch+json", - **kwargs: Any + self, test_run_id: str, body: Union[JSON, IO], *, old_test_run_id: Optional[str] = None, **kwargs: Any ) -> JSON: """Create and start a new test run with the given name. @@ -3701,15 +4193,15 @@ def begin_test_run( :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: Load test run model. Required. - :type body: IO + :param body: Load test run model. Is either a JSON type or a IO type. Required. + :type body: JSON or IO :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is provided, the test will run with the JMX file, configuration and app components from the existing test run. You can override the configuration values for new test run in the request body. Default value is None. :paramtype old_test_run_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". + :keyword content_type: Body Parameter content-type. Known values are: + 'application/merge-patch+json'. Default value is None. :paramtype content_type: str :return: JSON object :rtype: JSON @@ -3718,8 +4210,8 @@ def begin_test_run( Example: .. code-block:: python - # response body for status code(s): 200, 201 - response == { + # JSON input template you can fill out and use as your body input. + body = { "certificate": { "name": "str", # Optional. Name of the certificate. "type": "str", # Optional. Type of certificate. "AKV_CERT_URI" @@ -3961,35 +4453,6 @@ def begin_test_run( "virtualUsers": 0 # Optional. Number of virtual users, for which test has been run. } - """ - - @distributed_trace - def begin_test_run( - self, test_run_id: str, body: Union[JSON, IO], *, old_test_run_id: Optional[str] = None, **kwargs: Any - ) -> JSON: - """Create and start a new test run with the given name. - - Create and start a new test run with the given name. - - :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: Load test run model. Is either a model type or a IO type. Required. - :type body: JSON or IO - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run in the request - body. Default value is None. - :paramtype old_test_run_id: str - :keyword content_type: Body Parameter content-type. Known values are: - 'application/merge-patch+json'. Default value is None. - :paramtype content_type: str - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python # response body for status code(s): 200, 201 response == { @@ -4246,8 +4709,8 @@ def begin_test_run( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -4270,9 +4733,9 @@ def begin_test_run( path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4295,9 +4758,9 @@ def begin_test_run( deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace def get_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: @@ -4570,7 +5033,7 @@ def get_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_test_run_request( test_run_id=test_run_id, @@ -4581,9 +5044,9 @@ def get_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4629,7 +5092,7 @@ def delete_test_run( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_test_run_delete_test_run_request( test_run_id=test_run_id, @@ -4640,9 +5103,9 @@ def delete_test_run( # pylint: disable=inconsistent-return-statements path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4699,7 +5162,7 @@ def get_test_run_file(self, test_run_id: str, file_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_test_run_file_request( test_run_id=test_run_id, @@ -4711,9 +5174,9 @@ def get_test_run_file(self, test_run_id: str, file_name: str, **kwargs: Any) -> path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5020,7 +5483,7 @@ def list_test_runs( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5049,7 +5512,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -5069,7 +5532,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -5077,13 +5540,13 @@ def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5367,7 +5830,7 @@ def stop_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_stop_test_run_request( test_run_id=test_run_id, @@ -5378,9 +5841,9 @@ def stop_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5401,7 +5864,7 @@ def stop_test_run(self, test_run_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) @distributed_trace - def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: + def get_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: """List the metric namespaces for a load test run. List the metric namespaces for a load test run. @@ -5437,9 +5900,9 @@ def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) - request = build_test_run_list_metric_namespaces_request( + request = build_test_run_get_metric_namespaces_request( test_run_id=test_run_id, api_version=self._config.api_version, headers=_headers, @@ -5448,9 +5911,9 @@ def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5471,7 +5934,7 @@ def list_metric_namespaces(self, test_run_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) @distributed_trace - def list_metric_definitions(self, test_run_id: str, *, metric_namespace: str, **kwargs: Any) -> JSON: + def get_metric_definitions(self, test_run_id: str, *, metric_namespace: str, **kwargs: Any) -> JSON: """List the metric definitions for a load test run. List the metric definitions for a load test run. @@ -5537,9 +6000,9 @@ def list_metric_definitions(self, test_run_id: str, *, metric_namespace: str, ** _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) - request = build_test_run_list_metric_definitions_request( + request = build_test_run_get_metric_definitions_request( test_run_id=test_run_id, metric_namespace=metric_namespace, api_version=self._config.api_version, @@ -5549,9 +6012,9 @@ def list_metric_definitions(self, test_run_id: str, *, metric_namespace: str, ** path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -5730,7 +6193,7 @@ def list_metrics( :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: Metric dimension filter. Is either a model type or a IO type. Default value is + :param body: Metric dimension filter. Is either a JSON type or a IO type. Default value is None. :type body: JSON or IO :keyword metricname: Metric name. Required. @@ -5755,6 +6218,19 @@ def list_metrics( Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "filters": [ + { + "name": "str", # Optional. The dimension name. + "values": [ + "str" # Optional. The dimension values. Maximum + values can be 20. + ] + } + ] + } + # response body for status code(s): 200 response == { "data": [ @@ -5775,8 +6251,8 @@ def list_metrics( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5818,7 +6294,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -5838,7 +6314,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -5846,13 +6322,13 @@ def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -5909,7 +6385,7 @@ def list_metric_dimension_values( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -5938,7 +6414,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -5958,7 +6434,7 @@ def prepare_request(next_link=None): "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) return request @@ -5966,13 +6442,13 @@ def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = deserialized["value"] if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -6129,7 +6605,7 @@ def create_or_update_app_components(self, test_run_id: str, body: Union[JSON, IO :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: App Component model. Is either a model type or a IO type. Required. + :param body: App Component model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -6141,6 +6617,35 @@ def create_or_update_app_components(self, test_run_id: str, body: Union[JSON, IO Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "components": { + "str": { + "displayName": "str", # Optional. Azure resource display + name. + "kind": "str", # Optional. Kind of Azure resource type. + "resourceGroup": "str", # Optional. Resource group name of + the Azure resource. + "resourceId": "str", # Optional. fully qualified resource Id + e.g + subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + "resourceName": "str", # Optional. Azure resource name, + required while creating the app component. + "resourceType": "str", # Optional. Azure resource type, + required while creating the app component. + "subscriptionId": "str" # Optional. Subscription Id of the + Azure resource. + } + }, + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "testRunId": "str" # Optional. Test run identifier. + } + # response body for status code(s): 200, 201 response == { "components": { @@ -6181,8 +6686,8 @@ def create_or_update_app_components(self, test_run_id: str, body: Union[JSON, IO _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -6204,9 +6709,9 @@ def create_or_update_app_components(self, test_run_id: str, body: Union[JSON, IO path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6229,9 +6734,9 @@ def create_or_update_app_components(self, test_run_id: str, body: Union[JSON, IO deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace def get_app_components(self, test_run_id: str, **kwargs: Any) -> JSON: @@ -6289,7 +6794,7 @@ def get_app_components(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_app_components_request( test_run_id=test_run_id, @@ -6300,9 +6805,9 @@ def get_app_components(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6451,7 +6956,7 @@ def create_or_update_server_metrics_config(self, test_run_id: str, body: Union[J :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters. Required. :type test_run_id: str - :param body: Server metric configuration model. Is either a model type or a IO type. Required. + :param body: Server metric configuration model. Is either a JSON type or a IO type. Required. :type body: JSON or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -6463,6 +6968,30 @@ def create_or_update_server_metrics_config(self, test_run_id: str, body: Union[J Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "createdBy": "str", # Optional. The user that created. + "createdDateTime": "2020-02-20 00:00:00", # Optional. The creation + datetime(ISO 8601 literal format). + "lastModifiedBy": "str", # Optional. The user that last modified. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. The last Modified + datetime(ISO 8601 literal format). + "metrics": { + "str": { + "aggregation": "str", # Metric aggregation. Required. + "metricNamespace": "str", # Metric name space. Required. + "name": "str", # The invariant value of metric name. + Required. + "resourceId": "str", # Azure resource id. Required. + "resourceType": "str", # Azure resource type. Required. + "displayDescription": "str", # Optional. Metric description. + "id": "str", # Optional. Unique name for metric. + "unit": "str" # Optional. Metric unit. + } + }, + "testRunId": "str" # Optional. Test run identifier. + } + # response body for status code(s): 200, 201 response == { "createdBy": "str", # Optional. The user that created. @@ -6498,8 +7027,8 @@ def create_or_update_server_metrics_config(self, test_run_id: str, body: Union[J _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _json = None @@ -6521,9 +7050,9 @@ def create_or_update_server_metrics_config(self, test_run_id: str, body: Union[J path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -6546,9 +7075,9 @@ def create_or_update_server_metrics_config(self, test_run_id: str, body: Union[J deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace def get_server_metrics_config(self, test_run_id: str, **kwargs: Any) -> JSON: @@ -6601,7 +7130,7 @@ def get_server_metrics_config(self, test_run_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_test_run_get_server_metrics_config_request( test_run_id=test_run_id, @@ -6612,9 +7141,9 @@ def get_server_metrics_config(self, test_run_id: str, **kwargs: Any) -> JSON: path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/_patch.py similarity index 67% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/_patch.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/_patch.py index f917a125024e..33111751278f 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/operations/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/operations/_patch.py @@ -9,9 +9,9 @@ import logging import time from functools import partial -from typing import List, IO, Optional, Any, Union +from typing import List, IO, Optional, Any, Union, overload, Generic, TypeVar -from azure.core.polling import NoPolling, PollingMethod, LROPoller +from azure.core.polling import PollingMethod, LROPoller from azure.core.tracing.decorator import distributed_trace from ._operations import AdministrationOperations as AdministrationOperationsGenerated, JSON @@ -21,10 +21,12 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False +PollingReturnType = TypeVar("PollingReturnType") + logger = logging.getLogger(__name__) -class LoadTestingPollingMethod(PollingMethod): +class LoadTestingPollingMethod(PollingMethod, Generic[PollingReturnType]): """Base class for custom sync polling methods.""" def _update_status(self) -> None: @@ -88,7 +90,7 @@ def _update_status(self) -> None: self._status = self._resource["status"] -class LoadTestingLROPoller(LROPoller): +class LoadTestingLROPoller(LROPoller, Generic[PollingReturnType]): """LoadTesting Poller for long-running operations. :param client: A pipeline service client @@ -107,7 +109,7 @@ def __init__(self, client, initial_response, deserialization_callback, polling_m self._initial_response = initial_response super(LoadTestingLROPoller, self).__init__(client, initial_response, deserialization_callback, polling_method) - def get_initial_response(self) -> Any: + def get_initial_response(self) -> JSON: """Return the result of the initial operation. :return: The result of the initial operation. @@ -126,15 +128,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: IO, - *, - poll_for_validation_status: bool = True, - file_type: Optional[str] = None, - **kwargs: Any - ) -> LoadTestingLROPoller: + self, test_id: str, file_name: str, body: IO, *, file_type: Optional[str] = None, **kwargs: Any + ) -> LoadTestingLROPoller[JSON]: """Upload file to the test :param test_id: Unique id for the test @@ -145,9 +140,6 @@ def begin_upload_test_file( :type body: IO :param file_type: Type of the file to be uploaded :type file_type: str - :param poll_for_validation_status: If true, polls for validation status of the file, else does not - :type poll_for_validation_status: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An instance of LROPoller object to check the validation status of file :rtype: ~azure.developer.loadtesting._polling.LoadTestingLROPoller :raises ~azure.core.exceptions.HttpResponseError: @@ -163,13 +155,10 @@ def begin_upload_test_file( command = partial(self.get_test_file, test_id=test_id, file_name=file_name) - if poll_for_validation_status: - create_validation_status_polling = ValidationCheckPoller(interval=polling_interval) - return LoadTestingLROPoller( - command, upload_test_file_operation, lambda *_: None, create_validation_status_polling - ) - else: - return LoadTestingLROPoller(command, upload_test_file_operation, lambda *_: None, NoPolling()) + create_validation_status_polling = ValidationCheckPoller(interval=polling_interval) + return LoadTestingLROPoller( + command, upload_test_file_operation, lambda *_: None, create_validation_status_polling + ) class TestRunOperations(TestRunOperationsGenerated): @@ -180,16 +169,74 @@ class to perform operations on TestRun def __init__(self, *args, **kwargs): super(TestRunOperations, self).__init__(*args, **kwargs) - @distributed_trace - def begin_test_run( + @overload + async def begin_test_run( self, test_run_id: str, - body: Union[JSON, IO], + body: JSON, *, - poll_for_test_run_status=True, old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> LoadTestingLROPoller: + ) -> LoadTestingLROPoller[JSON]: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: IO + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_run( + self, + test_run_id: str, + body: IO, + *, + old_test_run_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> LoadTestingLROPoller[JSON]: + """Create and start a new test run with the given name. + + Create and start a new test run with the given name. + + :param test_run_id: Unique name for the load test run, must contain only lower-case alphabetic, + numeric, underscore or hyphen characters. Required. + :type test_run_id: str + :param body: Load test run model. Required. + :type body: IO + :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is + provided, the test will run with the JMX file, configuration and app components from the + existing test run. You can override the configuration values for new test run in the request + body. Default value is None. + :paramtype old_test_run_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_run( + self, test_run_id: str, body: Union[JSON, IO], *, old_test_run_id: Optional[str] = None, **kwargs: Any + ) -> LoadTestingLROPoller[JSON]: """Create and start a new test run with the given name. Create and start a new test run with the given name. @@ -203,8 +250,6 @@ def begin_test_run( provided, the test will run with the JMX file, configuration and app components from the existing test run. You can override the configuration values for new test run in the request body. Default value is None. - :param poll_for_test_run_status: If true, polls for test run status, else does not - :type poll_for_test_run_status: bool :paramtype old_test_run_id: str :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. @@ -224,13 +269,10 @@ def begin_test_run( command = partial(self.get_test_run, test_run_id=test_run_id) - if poll_for_test_run_status: - create_test_run_polling = TestRunStatusPoller(interval=polling_interval) - return LoadTestingLROPoller( - command, create_or_update_test_run_operation, lambda *_: None, create_test_run_polling - ) - else: - return LoadTestingLROPoller(command, create_or_update_test_run_operation, lambda *_: None, NoPolling()) + create_test_run_polling = TestRunStatusPoller(interval=polling_interval) + return LoadTestingLROPoller( + command, create_or_update_test_run_operation, lambda *_: None, create_test_run_polling + ) __all__: List[str] = ["AdministrationOperations", "TestRunOperations", "LoadTestingLROPoller"] diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/py.typed b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/py.typed similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/py.typed rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_generated/py.typed diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_version.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_version.py new file mode 100644 index 000000000000..8eedef9ba349 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_version.py @@ -0,0 +1,6 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +VERSION = "1.0.0" diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azure_appconfiguration_provider_error.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/__init__.py similarity index 68% rename from sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azure_appconfiguration_provider_error.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/__init__.py index 3c7021cb71ba..61feb1b264e3 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azure_appconfiguration_provider_error.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/__init__.py @@ -1,9 +1,9 @@ -# ------------------------------------------------------------------------ + +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -# ------------------------------------------------------------------------- - +# -------------------------------------------------------------------------- +from ._client import LoadTestRunClient, LoadAdministrationClient -class KeyVaultReferenceError(ValueError): - """Raised when a Key Vault reference is invalid.""" +__all__ = ["LoadAdministrationClient", "LoadTestRunClient"] \ No newline at end of file diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py new file mode 100644 index 000000000000..bd9917aee515 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py @@ -0,0 +1,107 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable + +from azure.core.credentials_async import AsyncTokenCredential +from azure.core import AsyncPipelineClient +from azure.core.rest import HttpRequest, AsyncHttpResponse + +from .._generated.aio._configuration import LoadTestingClientConfiguration +from .._generated._serialization import Deserializer, Serializer +from .._generated.aio.operations import AdministrationOperations, TestRunOperations + +class _BaseClient: # pylint: disable=client-accepts-api-version-keyword + """These APIs allow end users to create, view and run load tests using Azure Load Test Service. + + :ivar administration: AdministrationOperations operations + :vartype administration: azure.developer.loadtesting.aio.operations.AdministrationOperations + :ivar test_run: TestRunOperations operations + :vartype test_run: azure.developer.loadtesting.aio.operations.TestRunOperations + :param endpoint: URL to perform data plane API operations on the resource. Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "https://{Endpoint}" + self._config = LoadTestingClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + super().__init__(self._client, self._config, self._serialize, self._deserialize) + + def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) + + +class LoadAdministrationClient(_BaseClient, AdministrationOperations): # pylint: disable=client-accepts-api-version-keyword + """These APIs allow end users to create, view and run load tests using Azure Load Test Service. + + :param endpoint: URL to perform data plane API operations on the resource. Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + async def __aenter__(self) -> "AdministrationClient": + await self._client.__aenter__() + return self + +class LoadTestRunClient(_BaseClient, TestRunOperations): # pylint: disable=client-accepts-api-version-keyword + """These APIs allow end users to create, view and run load tests using Azure Load Test Service. + + :param endpoint: URL to perform data plane API operations on the resource. Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + async def __aenter__(self) -> "TestRunClient": + await self._client.__aenter__() + return self diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/py.typed b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/py.typed similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/py.typed rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/py.typed diff --git a/sdk/loadtestservice/azure-developer-loadtesting/dev_requirements.txt b/sdk/loadtesting/azure-developer-loadtesting/dev_requirements.txt similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/dev_requirements.txt rename to sdk/loadtesting/azure-developer-loadtesting/dev_requirements.txt diff --git a/sdk/loadtesting/azure-developer-loadtesting/pyproject.toml b/sdk/loadtesting/azure-developer-loadtesting/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/loadtestservice/azure-developer-loadtesting/pytest.ini b/sdk/loadtesting/azure-developer-loadtesting/pytest.ini similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/pytest.ini rename to sdk/loadtesting/azure-developer-loadtesting/pytest.ini diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/begin_test_run.py b/sdk/loadtesting/azure-developer-loadtesting/samples/begin_test_run.py similarity index 87% rename from sdk/loadtestservice/azure-developer-loadtesting/samples/begin_test_run.py rename to sdk/loadtesting/azure-developer-loadtesting/samples/begin_test_run.py index c242d20f2c30..f1a34f455b4e 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/begin_test_run.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/begin_test_run.py @@ -19,7 +19,7 @@ 3) AZURE_TENANT_ID - tenant id for your Azure 4) LOADTESTSERVICE_ENDPOINT - Data Plane endpoint for Loadtestservice """ -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestRunClient # for details refer: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/loadtestservice/azure-developer # -loadtesting/README.md @@ -35,15 +35,14 @@ TEST_ID = "my-sdk-test-id" # Build a client through AAD and resource endpoint -client = LoadTestingClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) +client = LoadTestRunClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) -testRunPoller = client.test_run.begin_test_run( +testRunPoller = client.begin_test_run( TEST_RUN_ID, { "testId": TEST_ID, "displayName": "My New Load Test Run", - }, - poll_for_test_run_status=True + } ) #waiting for test run status to be completed with timeout = 3600 seconds diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/create_or_update_app_components.py b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_app_components.py similarity index 87% rename from sdk/loadtestservice/azure-developer-loadtesting/samples/create_or_update_app_components.py rename to sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_app_components.py index 9c565b61248c..bded3768978e 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/create_or_update_app_components.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_app_components.py @@ -20,7 +20,7 @@ 4) RESOURCE_ID - resource id of resource to connect 5) LOADTESTSERVICE_ENDPOINT - Data Plane endpoint for Loadtestservice """ -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestAdministrationClient # for details refer: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/loadtestservice/azure-developer # -loadtesting/README.md @@ -35,12 +35,12 @@ RESOURCE_ID = os.environ["RESOURCE_ID"] # Build a client through AAD and resource endpoint -client = LoadTestingClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) +client = LoadTestAdministrationClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) TEST_ID = "my-sdk-test-id" APP_COMPONENT = "my-new-app-component" -result = client.administration.create_or_update_app_components( +result = client.create_or_update_app_components( TEST_ID, { "components": { diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/create_or_update_test_function.py b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test_function.py similarity index 91% rename from sdk/loadtestservice/azure-developer-loadtesting/samples/create_or_update_test_function.py rename to sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test_function.py index 37ce5425983a..968373f5e794 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/create_or_update_test_function.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test_function.py @@ -19,7 +19,7 @@ 3) AZURE_TENANT_ID - tenant id for your Azure 4) LOADTESTSERVICE_ENDPOINT - Data Plane endpoint for Loadtestservice """ -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestAdministrationClient # for details refer: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/loadtestservice/azure-developer # -loadtesting/README.md @@ -32,12 +32,12 @@ LOADTESTSERVICE_ENDPOINT = os.environ["LOADTESTSERVICE_ENDPOINT"] # Build a client through AAD and resource endpoint -client = LoadTestingClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) +client = LoadTestAdministrationClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) # ID to be assigned to test TEST_ID = "my-sdk-test-id" -result = client.administration.create_or_update_test( +result = client.create_or_update_test( TEST_ID, { "description": "", diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/delete_load_test_function.py b/sdk/loadtesting/azure-developer-loadtesting/samples/delete_load_test_function.py similarity index 87% rename from sdk/loadtestservice/azure-developer-loadtesting/samples/delete_load_test_function.py rename to sdk/loadtesting/azure-developer-loadtesting/samples/delete_load_test_function.py index 39cc55449c36..4ea0a3846be6 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/delete_load_test_function.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/delete_load_test_function.py @@ -20,7 +20,7 @@ 4) LOADTESTSERVICE_ENDPOINT - Data Plane endpoint for Loadtestservice """ # main library import -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestAdministrationClient # for managing authentication and authorization can be installed from pypi, follow: # https://pypi.org/project/azure-identity/ using DefaultAzureCredentials, read more at: @@ -38,9 +38,9 @@ load_dotenv() LOADTESTSERVICE_ENDPOINT = os.environ["LOADTESTSERVICE_ENDPOINT"] -TEST_ID = "my-new-sdk-test-id" +TEST_ID = "my-sdk-test-id" # Build a client through AAD and resource endpoint -client = LoadTestingClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) +client = LoadTestAdministrationClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) -client.administration.delete_test(TEST_ID) +client.delete_test(TEST_ID) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/delete_load_test_run.py b/sdk/loadtesting/azure-developer-loadtesting/samples/delete_load_test_run.py similarity index 84% rename from sdk/loadtestservice/azure-developer-loadtesting/samples/delete_load_test_run.py rename to sdk/loadtesting/azure-developer-loadtesting/samples/delete_load_test_run.py index 6b51be2fc7bf..ee9dc4ba533f 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/delete_load_test_run.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/delete_load_test_run.py @@ -19,7 +19,7 @@ 3) AZURE_TENANT_ID - tenant id for your Azure 4) LOADTESTSERVICE_ENDPOINT - Data Plane endpoint for Loadtestservice """ -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestRunClient # for details refer: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/loadtestservice/azure-developer # -loadtesting/README.md @@ -31,9 +31,9 @@ load_dotenv() LOADTESTSERVICE_ENDPOINT = os.environ["LOADTESTSERVICE_ENDPOINT"] -TEST_RUN_ID = "my-new-load-test-run" +TEST_RUN_ID = "some-test-run-id" # Build a client through AAD and resource endpoint -client = LoadTestingClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) +client = LoadTestRunClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) -client.test_run.delete_test_run(TEST_RUN_ID) +client.delete_test_run(TEST_RUN_ID) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/get_metrics.py b/sdk/loadtesting/azure-developer-loadtesting/samples/get_metrics.py similarity index 79% rename from sdk/loadtestservice/azure-developer-loadtesting/samples/get_metrics.py rename to sdk/loadtesting/azure-developer-loadtesting/samples/get_metrics.py index f58981ca93ed..7759553b40a9 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/get_metrics.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/get_metrics.py @@ -19,7 +19,7 @@ 3) AZURE_TENANT_ID - tenant id for your Azure 4) LOADTESTSERVICE_ENDPOINT - Data Plane endpoint for Loadtestservice """ -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestRunClient # for details refer: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/loadtestservice/azure-developer # -loadtesting/README.md @@ -36,23 +36,23 @@ LOADTESTSERVICE_ENDPOINT = os.environ["LOADTESTSERVICE_ENDPOINT"] # Build a client through AAD and resource endpoint -client = LoadTestingClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) +client = LoadTestRunClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) TEST_ID = "my-sdk-test-id" -TEST_RUN_ID = "my-sdk-load-test-run-id" +TEST_RUN_ID = "some-test-run-id" -test_run_response = client.test_run.get_test_run(TEST_RUN_ID) +test_run_response = client.get_test_run(TEST_RUN_ID) # get a list of metric namespaces for a given test run -metric_namespaces = client.test_run.list_metric_namespaces(TEST_RUN_ID) +metric_namespaces = client.get_metric_namespaces(TEST_RUN_ID) print(metric_namespaces) # get a list of metric definitions for a given test run and metric namespace -metric_definitions = client.test_run.list_metric_definitions(TEST_RUN_ID, metric_namespace=metric_namespaces["value"][0]["name"]) +metric_definitions = client.get_metric_definitions(TEST_RUN_ID, metric_namespace=metric_namespaces["value"][0]["name"]) print(metric_definitions) # fetch metrics for a test run using metric definition and namespace -metrics = client.test_run.list_metrics( +metrics = client.list_metrics( TEST_RUN_ID, metricname=metric_definitions["value"][0]["name"], metric_namespace=metric_namespaces["value"][0]["name"], diff --git a/sdk/loadtesting/azure-developer-loadtesting/samples/sample.jmx b/sdk/loadtesting/azure-developer-loadtesting/samples/sample.jmx new file mode 100644 index 000000000000..ad094aacba15 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/sample.jmx @@ -0,0 +1,192 @@ + + + + + + false + true + false + + + + + + + + + + 10 + 0 + 180 + 240 + 5 + + + + false + -1 + + continue + + + + + + + app-service-sample-demo.azurewebsites.net + + https + + + GET + true + false + true + false + + HttpClient4 + 60000 + 60000 + + + + + + 10 + 50 + 180 + + + 50 + 50 + 240 + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + + udv_webapp + ${__BeanShell( System.getenv("webapp") )} + Web App URL + = + + + + + + + \ No newline at end of file diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/upload_test_file.py b/sdk/loadtesting/azure-developer-loadtesting/samples/upload_test_file.py similarity index 82% rename from sdk/loadtestservice/azure-developer-loadtesting/samples/upload_test_file.py rename to sdk/loadtesting/azure-developer-loadtesting/samples/upload_test_file.py index e8c93cb696c1..a5a3302fa8ff 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/upload_test_file.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/upload_test_file.py @@ -20,7 +20,7 @@ Please ensure that correct jmx file and path is used """ -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestAdministrationClient # for details refer: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/loadtestservice/azure-developer # -loadtesting/README.md @@ -32,13 +32,13 @@ load_dotenv() LOADTESTSERVICE_ENDPOINT = os.environ["LOADTESTSERVICE_ENDPOINT"] -client = LoadTestingClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) +client = LoadTestAdministrationClient(credential=DefaultAzureCredential(), endpoint=LOADTESTSERVICE_ENDPOINT) TEST_ID = "my-sdk-test-id" FILE_NAME = "my-file-id.jmx" # uploading .jmx file to a test -resultPoller = client.administration.begin_upload_test_file(TEST_ID, FILE_NAME, open("sample.jmx", "rb"), poll_for_validation_status=True) +resultPoller = client.begin_upload_test_file(TEST_ID, FILE_NAME, open("sample.jmx", "rb")) fileUploadResponse = resultPoller.get_initial_response() print(fileUploadResponse) diff --git a/sdk/loadtesting/azure-developer-loadtesting/sdk_packaging.toml b/sdk/loadtesting/azure-developer-loadtesting/sdk_packaging.toml new file mode 100644 index 000000000000..7414cb17a02d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/sdk_packaging.toml @@ -0,0 +1,10 @@ +[packaging] +package_name = "azure-developer-loadtesting" +package_nspkg = "azure-developer-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" diff --git a/sdk/loadtesting/azure-developer-loadtesting/setup.py b/sdk/loadtesting/azure-developer-loadtesting/setup.py new file mode 100644 index 000000000000..e1470918288d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/setup.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-developer-loadtesting" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.developer', + ]), + include_package_data=True, + package_data={ + 'pytyped': ['py.typed'], + }, + install_requires=[ + "msrest>=0.7.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", + ], + python_requires=">=3.7" +) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/swagger/README.md b/sdk/loadtesting/azure-developer-loadtesting/swagger/README.md similarity index 75% rename from sdk/loadtestservice/azure-developer-loadtesting/swagger/README.md rename to sdk/loadtesting/azure-developer-loadtesting/swagger/README.md index 85d124fa53ae..a014697c51d4 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/swagger/README.md +++ b/sdk/loadtesting/azure-developer-loadtesting/swagger/README.md @@ -3,7 +3,7 @@ ```yaml input-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/loadtestservice/data-plane/Microsoft.LoadTestService/stable/2022-11-01/loadtestservice.json output-folder: ../ -namespace: azure.developer.loadtesting +namespace: azure.developer.loadtesting._generated package-name: azure-developer-loadtesting license-header: MICROSOFT_MIT_NO_VERSION title: LoadTestingClient @@ -19,7 +19,13 @@ directive: - from: swagger-document where: $["paths"]["/test-runs/{testRunId}"].patch transform: $["operationId"] = "LoadTestRun_BeginTestRun"; - + - from: swagger-document + where: $["paths"]["/test-runs/{testRunId}/metric-namespaces"].get + transform: $["operationId"] = "LoadTestRun_GetMetricNamespaces"; + - from: swagger-document + where: $["paths"]["/test-runs/{testRunId}/metric-definitions"].get + transform: $["operationId"] = "LoadTestRun_GetMetricDefinitions"; + - from: swagger-document where: '$.paths.*[?(@.tags=="Test")]' transform: > diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/conftest.py b/sdk/loadtesting/azure-developer-loadtesting/tests/conftest.py similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/conftest.py rename to sdk/loadtesting/azure-developer-loadtesting/tests/conftest.py diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json similarity index 90% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json index d6f03614e212..fd360fc0d409 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:15 GMT", + "Date": "Wed, 15 Feb 2023 12:14:00 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:15 GMT", + "Date": "Wed, 15 Feb 2023 12:14:00 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,7 +172,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "a7939a03-d12a-48fc-9ff0-3e248bfb5a5f", + "client-request-id": "0a1671a3-4d79-478b-abe4-d1f5511c44f8", "Connection": "keep-alive", "Content-Length": "298", "Content-Type": "application/x-www-form-urlencoded", @@ -190,10 +190,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "a7939a03-d12a-48fc-9ff0-3e248bfb5a5f", + "client-request-id": "0a1671a3-4d79-478b-abe4-d1f5511c44f8", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:15 GMT", + "Date": "Wed, 15 Feb 2023 12:14:00 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "319", "Content-Type": "application/merge-patch\u002Bjson", - "User-Agent": "azsdk-python-developer-loadtesting/1.0.0b3 Python/3.10.8 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-developer-loadtesting/1.0.0 Python/3.10.8 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "description": "", @@ -239,17 +239,18 @@ "keyvaultReferenceIdentityType": "SystemAssigned", "keyvaultReferenceIdentityId": null }, - "StatusCode": 200, + "StatusCode": 201, "ResponseHeaders": { "api-supported-versions": "2021-07-01-preview, 2022-06-01-preview, 2022-11-01", "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:16 GMT", - "mise-correlation-id": "2830f50a-53ec-4b08-b8d3-4036a07c2427", + "Date": "Wed, 15 Feb 2023 12:14:03 GMT", + "Location": "https://https://myservice.azure.com/tests/pytest_setup_load_test_id?api-version=2022-11-01", + "mise-correlation-id": "ba8756b0-ace2-45a2-9a2d-03aa453a4d3b", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f25d6481-9ea5-4ce0-9e1f-fe10828de047" + "x-ms-correlation-request-id": "790b0003-f466-47cf-9f80-de0b5fc9bb71" }, "ResponseBody": { "passFailCriteria": { @@ -267,8 +268,8 @@ "description": "", "displayName": "TestingResourcePyTest", "keyvaultReferenceIdentityType": "SystemAssigned", - "createdDateTime": "2023-01-04T10:26:01.046Z", - "lastModifiedDateTime": "2023-01-04T10:26:16.621Z" + "createdDateTime": "2023-02-15T12:14:03.431Z", + "lastModifiedDateTime": "2023-02-15T12:14:03.431Z" } }, { @@ -288,12 +289,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:16 GMT", + "Date": "Wed, 15 Feb 2023 12:14:02 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -382,12 +383,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:16 GMT", + "Date": "Wed, 15 Feb 2023 12:14:02 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -443,7 +444,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "fa623d50-e4a4-45f9-ab5c-5a901b49b33d", + "client-request-id": "7567d130-af38-4d25-9ca9-daffc9249dc3", "Connection": "keep-alive", "Content-Length": "298", "Content-Type": "application/x-www-form-urlencoded", @@ -461,10 +462,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "fa623d50-e4a4-45f9-ab5c-5a901b49b33d", + "client-request-id": "7567d130-af38-4d25-9ca9-daffc9249dc3", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:16 GMT", + "Date": "Wed, 15 Feb 2023 12:14:03 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -472,7 +473,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -492,7 +493,7 @@ "Connection": "keep-alive", "Content-Length": "9942", "Content-Type": "application/octet-stream", - "User-Agent": "azsdk-python-developer-loadtesting/1.0.0b3 Python/3.10.8 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-developer-loadtesting/1.0.0 Python/3.10.8 (Windows-10-10.0.22621-SP0)" }, "RequestBody": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGptZXRlclRlc3RQbGFuIHZlcnNpb249IjEuMiIgcHJvcGVydGllcz0iNS4wIiBqbWV0ZXI9IjUuNC4zIj4KICA8aGFzaFRyZWU\u002BCiAgICA8VGVzdFBsYW4gZ3VpY2xhc3M9IlRlc3RQbGFuR3VpIiB0ZXN0Y2xhc3M9IlRlc3RQbGFuIiB0ZXN0bmFtZT0iVGVzdCBQbGFuIiBlbmFibGVkPSJ0cnVlIj4KICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iVGVzdFBsYW4uY29tbWVudHMiPjwvc3RyaW5nUHJvcD4KICAgICAgPGJvb2xQcm9wIG5hbWU9IlRlc3RQbGFuLmZ1bmN0aW9uYWxfbW9kZSI\u002BZmFsc2U8L2Jvb2xQcm9wPgogICAgICA8Ym9vbFByb3AgbmFtZT0iVGVzdFBsYW4udGVhckRvd25fb25fc2h1dGRvd24iPnRydWU8L2Jvb2xQcm9wPgogICAgICA8Ym9vbFByb3AgbmFtZT0iVGVzdFBsYW4uc2VyaWFsaXplX3RocmVhZGdyb3VwcyI\u002BZmFsc2U8L2Jvb2xQcm9wPgogICAgICA8ZWxlbWVudFByb3AgbmFtZT0iVGVzdFBsYW4udXNlcl9kZWZpbmVkX3ZhcmlhYmxlcyIgZWxlbWVudFR5cGU9IkFyZ3VtZW50cyIgZ3VpY2xhc3M9IkFyZ3VtZW50c1BhbmVsIiB0ZXN0Y2xhc3M9IkFyZ3VtZW50cyIgdGVzdG5hbWU9IlVzZXIgRGVmaW5lZCBWYXJpYWJsZXMiIGVuYWJsZWQ9InRydWUiPgogICAgICAgIDxjb2xsZWN0aW9uUHJvcCBuYW1lPSJBcmd1bWVudHMuYXJndW1lbnRzIi8\u002BCiAgICAgIDwvZWxlbWVudFByb3A\u002BCiAgICAgIDxzdHJpbmdQcm9wIG5hbWU9IlRlc3RQbGFuLnVzZXJfZGVmaW5lX2NsYXNzcGF0aCI\u002BPC9zdHJpbmdQcm9wPgogICAgPC9UZXN0UGxhbj4KICAgIDxoYXNoVHJlZT4KICAgICAgPGtnLmFwYy5qbWV0ZXIudGhyZWFkcy5VbHRpbWF0ZVRocmVhZEdyb3VwIGd1aWNsYXNzPSJrZy5hcGMuam1ldGVyLnRocmVhZHMuVWx0aW1hdGVUaHJlYWRHcm91cEd1aSIgdGVzdGNsYXNzPSJrZy5hcGMuam1ldGVyLnRocmVhZHMuVWx0aW1hdGVUaHJlYWRHcm91cCIgdGVzdG5hbWU9ImpwQGdjIC0gVWx0aW1hdGUgVGhyZWFkIEdyb3VwIiBlbmFibGVkPSJ0cnVlIj4KICAgICAgICA8Y29sbGVjdGlvblByb3AgbmFtZT0idWx0aW1hdGV0aHJlYWRncm91cGRhdGEiPgogICAgICAgICAgPGNvbGxlY3Rpb25Qcm9wIG5hbWU9Ii0xMTA4NjkxNTE4Ij4KICAgICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iMTU2NyI\u002BMTA8L3N0cmluZ1Byb3A\u002BCiAgICAgICAgICAgIDxzdHJpbmdQcm9wIG5hbWU9IjQ4Ij4wPC9zdHJpbmdQcm9wPgogICAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSI0ODg3MyI\u002BMTgwPC9zdHJpbmdQcm9wPgogICAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSI0OTcxMCI\u002BMjQwPC9zdHJpbmdQcm9wPgogICAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSIxMCI\u002BNTwvc3RyaW5nUHJvcD4KICAgICAgICAgIDwvY29sbGVjdGlvblByb3A\u002BCiAgICAgICAgPC9jb2xsZWN0aW9uUHJvcD4KICAgICAgICA8ZWxlbWVudFByb3AgbmFtZT0iVGhyZWFkR3JvdXAubWFpbl9jb250cm9sbGVyIiBlbGVtZW50VHlwZT0iTG9vcENvbnRyb2xsZXIiIGd1aWNsYXNzPSJMb29wQ29udHJvbFBhbmVsIiB0ZXN0Y2xhc3M9Ikxvb3BDb250cm9sbGVyIiB0ZXN0bmFtZT0iTG9vcCBDb250cm9sbGVyIiBlbmFibGVkPSJ0cnVlIj4KICAgICAgICAgIDxib29sUHJvcCBuYW1lPSJMb29wQ29udHJvbGxlci5jb250aW51ZV9mb3JldmVyIj5mYWxzZTwvYm9vbFByb3A\u002BCiAgICAgICAgICA8aW50UHJvcCBuYW1lPSJMb29wQ29udHJvbGxlci5sb29wcyI\u002BLTE8L2ludFByb3A\u002BCiAgICAgICAgPC9lbGVtZW50UHJvcD4KICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSJUaHJlYWRHcm91cC5vbl9zYW1wbGVfZXJyb3IiPmNvbnRpbnVlPC9zdHJpbmdQcm9wPgogICAgICA8L2tnLmFwYy5qbWV0ZXIudGhyZWFkcy5VbHRpbWF0ZVRocmVhZEdyb3VwPgogICAgICA8aGFzaFRyZWU\u002BCiAgICAgICAgPEhUVFBTYW1wbGVyUHJveHkgZ3VpY2xhc3M9Ikh0dHBUZXN0U2FtcGxlR3VpIiB0ZXN0Y2xhc3M9IkhUVFBTYW1wbGVyUHJveHkiIHRlc3RuYW1lPSJHRVQiIGVuYWJsZWQ9InRydWUiPgogICAgICAgICAgPGVsZW1lbnRQcm9wIG5hbWU9IkhUVFBzYW1wbGVyLkFyZ3VtZW50cyIgZWxlbWVudFR5cGU9IkFyZ3VtZW50cyIgZ3VpY2xhc3M9IkhUVFBBcmd1bWVudHNQYW5lbCIgdGVzdGNsYXNzPSJBcmd1bWVudHMiIHRlc3RuYW1lPSJVc2VyIERlZmluZWQgVmFyaWFibGVzIiBlbmFibGVkPSJ0cnVlIj4KICAgICAgICAgICAgPGNvbGxlY3Rpb25Qcm9wIG5hbWU9IkFyZ3VtZW50cy5hcmd1bWVudHMiLz4KICAgICAgICAgIDwvZWxlbWVudFByb3A\u002BCiAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSJIVFRQU2FtcGxlci5kb21haW4iPmFwcC1zZXJ2aWNlLXNhbXBsZS1kZW1vLmF6dXJld2Vic2l0ZXMubmV0PC9zdHJpbmdQcm9wPgogICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iSFRUUFNhbXBsZXIucG9ydCI\u002BPC9zdHJpbmdQcm9wPgogICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iSFRUUFNhbXBsZXIucHJvdG9jb2wiPmh0dHBzPC9zdHJpbmdQcm9wPgogICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iSFRUUFNhbXBsZXIuY29udGVudEVuY29kaW5nIj48L3N0cmluZ1Byb3A\u002BCiAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSJIVFRQU2FtcGxlci5wYXRoIj48L3N0cmluZ1Byb3A\u002BCiAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSJIVFRQU2FtcGxlci5tZXRob2QiPkdFVDwvc3RyaW5nUHJvcD4KICAgICAgICAgIDxib29sUHJvcCBuYW1lPSJIVFRQU2FtcGxlci5mb2xsb3dfcmVkaXJlY3RzIj50cnVlPC9ib29sUHJvcD4KICAgICAgICAgIDxib29sUHJvcCBuYW1lPSJIVFRQU2FtcGxlci5hdXRvX3JlZGlyZWN0cyI\u002BZmFsc2U8L2Jvb2xQcm9wPgogICAgICAgICAgPGJvb2xQcm9wIG5hbWU9IkhUVFBTYW1wbGVyLnVzZV9rZWVwYWxpdmUiPnRydWU8L2Jvb2xQcm9wPgogICAgICAgICAgPGJvb2xQcm9wIG5hbWU9IkhUVFBTYW1wbGVyLkRPX01VTFRJUEFSVF9QT1NUIj5mYWxzZTwvYm9vbFByb3A\u002BCiAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSJIVFRQU2FtcGxlci5lbWJlZGRlZF91cmxfcmUiPjwvc3RyaW5nUHJvcD4KICAgICAgICAgIDxzdHJpbmdQcm9wIG5hbWU9IkhUVFBTYW1wbGVyLmltcGxlbWVudGF0aW9uIj5IdHRwQ2xpZW50NDwvc3RyaW5nUHJvcD4KICAgICAgICAgIDxzdHJpbmdQcm9wIG5hbWU9IkhUVFBTYW1wbGVyLmNvbm5lY3RfdGltZW91dCI\u002BNjAwMDA8L3N0cmluZ1Byb3A\u002BCiAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSJIVFRQU2FtcGxlci5yZXNwb25zZV90aW1lb3V0Ij42MDAwMDwvc3RyaW5nUHJvcD4KICAgICAgICA8L0hUVFBTYW1wbGVyUHJveHk\u002BCiAgICAgICAgPGhhc2hUcmVlLz4KICAgICAgICA8a2cuYXBjLmptZXRlci50aW1lcnMuVmFyaWFibGVUaHJvdWdocHV0VGltZXIgZ3VpY2xhc3M9ImtnLmFwYy5qbWV0ZXIudGltZXJzLlZhcmlhYmxlVGhyb3VnaHB1dFRpbWVyR3VpIiB0ZXN0Y2xhc3M9ImtnLmFwYy5qbWV0ZXIudGltZXJzLlZhcmlhYmxlVGhyb3VnaHB1dFRpbWVyIiB0ZXN0bmFtZT0ianBAZ2MgLSBUaHJvdWdocHV0IFNoYXBpbmcgVGltZXIiIGVuYWJsZWQ9InRydWUiPgogICAgICAgICAgPGNvbGxlY3Rpb25Qcm9wIG5hbWU9ImxvYWRfcHJvZmlsZSI\u002BCiAgICAgICAgICAgIDxjb2xsZWN0aW9uUHJvcCBuYW1lPSIxNTQzOTEyMTczIj4KICAgICAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSIxNTY3Ij4xMDwvc3RyaW5nUHJvcD4KICAgICAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSIxNjkxIj41MDwvc3RyaW5nUHJvcD4KICAgICAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSI0ODg3MyI\u002BMTgwPC9zdHJpbmdQcm9wPgogICAgICAgICAgICA8L2NvbGxlY3Rpb25Qcm9wPgogICAgICAgICAgICA8Y29sbGVjdGlvblByb3AgbmFtZT0iMTU4MjM1NTYyNyI\u002BCiAgICAgICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iMTY5MSI\u002BNTA8L3N0cmluZ1Byb3A\u002BCiAgICAgICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iMTY5MSI\u002BNTA8L3N0cmluZ1Byb3A\u002BCiAgICAgICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iNDk3MTAiPjI0MDwvc3RyaW5nUHJvcD4KICAgICAgICAgICAgPC9jb2xsZWN0aW9uUHJvcD4KICAgICAgICAgIDwvY29sbGVjdGlvblByb3A\u002BCiAgICAgICAgPC9rZy5hcGMuam1ldGVyLnRpbWVycy5WYXJpYWJsZVRocm91Z2hwdXRUaW1lcj4KICAgICAgICA8aGFzaFRyZWUvPgogICAgICAgIDxSZXN1bHRDb2xsZWN0b3IgZ3VpY2xhc3M9IlZpZXdSZXN1bHRzRnVsbFZpc3VhbGl6ZXIiIHRlc3RjbGFzcz0iUmVzdWx0Q29sbGVjdG9yIiB0ZXN0bmFtZT0iVmlldyBSZXN1bHRzIFRyZWUiIGVuYWJsZWQ9InRydWUiPgogICAgICAgICAgPGJvb2xQcm9wIG5hbWU9IlJlc3VsdENvbGxlY3Rvci5lcnJvcl9sb2dnaW5nIj5mYWxzZTwvYm9vbFByb3A\u002BCiAgICAgICAgICA8b2JqUHJvcD4KICAgICAgICAgICAgPG5hbWU\u002Bc2F2ZUNvbmZpZzwvbmFtZT4KICAgICAgICAgICAgPHZhbHVlIGNsYXNzPSJTYW1wbGVTYXZlQ29uZmlndXJhdGlvbiI\u002BCiAgICAgICAgICAgICAgPHRpbWU\u002BdHJ1ZTwvdGltZT4KICAgICAgICAgICAgICA8bGF0ZW5jeT50cnVlPC9sYXRlbmN5PgogICAgICAgICAgICAgIDx0aW1lc3RhbXA\u002BdHJ1ZTwvdGltZXN0YW1wPgogICAgICAgICAgICAgIDxzdWNjZXNzPnRydWU8L3N1Y2Nlc3M\u002BCiAgICAgICAgICAgICAgPGxhYmVsPnRydWU8L2xhYmVsPgogICAgICAgICAgICAgIDxjb2RlPnRydWU8L2NvZGU\u002BCiAgICAgICAgICAgICAgPG1lc3NhZ2U\u002BdHJ1ZTwvbWVzc2FnZT4KICAgICAgICAgICAgICA8dGhyZWFkTmFtZT50cnVlPC90aHJlYWROYW1lPgogICAgICAgICAgICAgIDxkYXRhVHlwZT50cnVlPC9kYXRhVHlwZT4KICAgICAgICAgICAgICA8ZW5jb2Rpbmc\u002BZmFsc2U8L2VuY29kaW5nPgogICAgICAgICAgICAgIDxhc3NlcnRpb25zPnRydWU8L2Fzc2VydGlvbnM\u002BCiAgICAgICAgICAgICAgPHN1YnJlc3VsdHM\u002BdHJ1ZTwvc3VicmVzdWx0cz4KICAgICAgICAgICAgICA8cmVzcG9uc2VEYXRhPmZhbHNlPC9yZXNwb25zZURhdGE\u002BCiAgICAgICAgICAgICAgPHNhbXBsZXJEYXRhPmZhbHNlPC9zYW1wbGVyRGF0YT4KICAgICAgICAgICAgICA8eG1sPmZhbHNlPC94bWw\u002BCiAgICAgICAgICAgICAgPGZpZWxkTmFtZXM\u002BdHJ1ZTwvZmllbGROYW1lcz4KICAgICAgICAgICAgICA8cmVzcG9uc2VIZWFkZXJzPmZhbHNlPC9yZXNwb25zZUhlYWRlcnM\u002BCiAgICAgICAgICAgICAgPHJlcXVlc3RIZWFkZXJzPmZhbHNlPC9yZXF1ZXN0SGVhZGVycz4KICAgICAgICAgICAgICA8cmVzcG9uc2VEYXRhT25FcnJvcj5mYWxzZTwvcmVzcG9uc2VEYXRhT25FcnJvcj4KICAgICAgICAgICAgICA8c2F2ZUFzc2VydGlvblJlc3VsdHNGYWlsdXJlTWVzc2FnZT50cnVlPC9zYXZlQXNzZXJ0aW9uUmVzdWx0c0ZhaWx1cmVNZXNzYWdlPgogICAgICAgICAgICAgIDxhc3NlcnRpb25zUmVzdWx0c1RvU2F2ZT4wPC9hc3NlcnRpb25zUmVzdWx0c1RvU2F2ZT4KICAgICAgICAgICAgICA8Ynl0ZXM\u002BdHJ1ZTwvYnl0ZXM\u002BCiAgICAgICAgICAgICAgPHNlbnRCeXRlcz50cnVlPC9zZW50Qnl0ZXM\u002BCiAgICAgICAgICAgICAgPHVybD50cnVlPC91cmw\u002BCiAgICAgICAgICAgICAgPHRocmVhZENvdW50cz50cnVlPC90aHJlYWRDb3VudHM\u002BCiAgICAgICAgICAgICAgPGlkbGVUaW1lPnRydWU8L2lkbGVUaW1lPgogICAgICAgICAgICAgIDxjb25uZWN0VGltZT50cnVlPC9jb25uZWN0VGltZT4KICAgICAgICAgICAgPC92YWx1ZT4KICAgICAgICAgIDwvb2JqUHJvcD4KICAgICAgICAgIDxzdHJpbmdQcm9wIG5hbWU9ImZpbGVuYW1lIj48L3N0cmluZ1Byb3A\u002BCiAgICAgICAgPC9SZXN1bHRDb2xsZWN0b3I\u002BCiAgICAgICAgPGhhc2hUcmVlLz4KICAgICAgICA8UmVzdWx0Q29sbGVjdG9yIGd1aWNsYXNzPSJUYWJsZVZpc3VhbGl6ZXIiIHRlc3RjbGFzcz0iUmVzdWx0Q29sbGVjdG9yIiB0ZXN0bmFtZT0iVmlldyBSZXN1bHRzIGluIFRhYmxlIiBlbmFibGVkPSJ0cnVlIj4KICAgICAgICAgIDxib29sUHJvcCBuYW1lPSJSZXN1bHRDb2xsZWN0b3IuZXJyb3JfbG9nZ2luZyI\u002BZmFsc2U8L2Jvb2xQcm9wPgogICAgICAgICAgPG9ialByb3A\u002BCiAgICAgICAgICAgIDxuYW1lPnNhdmVDb25maWc8L25hbWU\u002BCiAgICAgICAgICAgIDx2YWx1ZSBjbGFzcz0iU2FtcGxlU2F2ZUNvbmZpZ3VyYXRpb24iPgogICAgICAgICAgICAgIDx0aW1lPnRydWU8L3RpbWU\u002BCiAgICAgICAgICAgICAgPGxhdGVuY3k\u002BdHJ1ZTwvbGF0ZW5jeT4KICAgICAgICAgICAgICA8dGltZXN0YW1wPnRydWU8L3RpbWVzdGFtcD4KICAgICAgICAgICAgICA8c3VjY2Vzcz50cnVlPC9zdWNjZXNzPgogICAgICAgICAgICAgIDxsYWJlbD50cnVlPC9sYWJlbD4KICAgICAgICAgICAgICA8Y29kZT50cnVlPC9jb2RlPgogICAgICAgICAgICAgIDxtZXNzYWdlPnRydWU8L21lc3NhZ2U\u002BCiAgICAgICAgICAgICAgPHRocmVhZE5hbWU\u002BdHJ1ZTwvdGhyZWFkTmFtZT4KICAgICAgICAgICAgICA8ZGF0YVR5cGU\u002BdHJ1ZTwvZGF0YVR5cGU\u002BCiAgICAgICAgICAgICAgPGVuY29kaW5nPmZhbHNlPC9lbmNvZGluZz4KICAgICAgICAgICAgICA8YXNzZXJ0aW9ucz50cnVlPC9hc3NlcnRpb25zPgogICAgICAgICAgICAgIDxzdWJyZXN1bHRzPnRydWU8L3N1YnJlc3VsdHM\u002BCiAgICAgICAgICAgICAgPHJlc3BvbnNlRGF0YT5mYWxzZTwvcmVzcG9uc2VEYXRhPgogICAgICAgICAgICAgIDxzYW1wbGVyRGF0YT5mYWxzZTwvc2FtcGxlckRhdGE\u002BCiAgICAgICAgICAgICAgPHhtbD5mYWxzZTwveG1sPgogICAgICAgICAgICAgIDxmaWVsZE5hbWVzPnRydWU8L2ZpZWxkTmFtZXM\u002BCiAgICAgICAgICAgICAgPHJlc3BvbnNlSGVhZGVycz5mYWxzZTwvcmVzcG9uc2VIZWFkZXJzPgogICAgICAgICAgICAgIDxyZXF1ZXN0SGVhZGVycz5mYWxzZTwvcmVxdWVzdEhlYWRlcnM\u002BCiAgICAgICAgICAgICAgPHJlc3BvbnNlRGF0YU9uRXJyb3I\u002BZmFsc2U8L3Jlc3BvbnNlRGF0YU9uRXJyb3I\u002BCiAgICAgICAgICAgICAgPHNhdmVBc3NlcnRpb25SZXN1bHRzRmFpbHVyZU1lc3NhZ2U\u002BdHJ1ZTwvc2F2ZUFzc2VydGlvblJlc3VsdHNGYWlsdXJlTWVzc2FnZT4KICAgICAgICAgICAgICA8YXNzZXJ0aW9uc1Jlc3VsdHNUb1NhdmU\u002BMDwvYXNzZXJ0aW9uc1Jlc3VsdHNUb1NhdmU\u002BCiAgICAgICAgICAgICAgPGJ5dGVzPnRydWU8L2J5dGVzPgogICAgICAgICAgICAgIDxzZW50Qnl0ZXM\u002BdHJ1ZTwvc2VudEJ5dGVzPgogICAgICAgICAgICAgIDx1cmw\u002BdHJ1ZTwvdXJsPgogICAgICAgICAgICAgIDx0aHJlYWRDb3VudHM\u002BdHJ1ZTwvdGhyZWFkQ291bnRzPgogICAgICAgICAgICAgIDxpZGxlVGltZT50cnVlPC9pZGxlVGltZT4KICAgICAgICAgICAgICA8Y29ubmVjdFRpbWU\u002BdHJ1ZTwvY29ubmVjdFRpbWU\u002BCiAgICAgICAgICAgIDwvdmFsdWU\u002BCiAgICAgICAgICA8L29ialByb3A\u002BCiAgICAgICAgICA8c3RyaW5nUHJvcCBuYW1lPSJmaWxlbmFtZSI\u002BPC9zdHJpbmdQcm9wPgogICAgICAgIDwvUmVzdWx0Q29sbGVjdG9yPgogICAgICAgIDxoYXNoVHJlZS8\u002BCiAgICAgICAgPFJlc3VsdENvbGxlY3RvciBndWljbGFzcz0iVmlld1Jlc3VsdHNGdWxsVmlzdWFsaXplciIgdGVzdGNsYXNzPSJSZXN1bHRDb2xsZWN0b3IiIHRlc3RuYW1lPSJWaWV3IFJlc3VsdHMgVHJlZSIgZW5hYmxlZD0idHJ1ZSI\u002BCiAgICAgICAgICA8Ym9vbFByb3AgbmFtZT0iUmVzdWx0Q29sbGVjdG9yLmVycm9yX2xvZ2dpbmciPmZhbHNlPC9ib29sUHJvcD4KICAgICAgICAgIDxvYmpQcm9wPgogICAgICAgICAgICA8bmFtZT5zYXZlQ29uZmlnPC9uYW1lPgogICAgICAgICAgICA8dmFsdWUgY2xhc3M9IlNhbXBsZVNhdmVDb25maWd1cmF0aW9uIj4KICAgICAgICAgICAgICA8dGltZT50cnVlPC90aW1lPgogICAgICAgICAgICAgIDxsYXRlbmN5PnRydWU8L2xhdGVuY3k\u002BCiAgICAgICAgICAgICAgPHRpbWVzdGFtcD50cnVlPC90aW1lc3RhbXA\u002BCiAgICAgICAgICAgICAgPHN1Y2Nlc3M\u002BdHJ1ZTwvc3VjY2Vzcz4KICAgICAgICAgICAgICA8bGFiZWw\u002BdHJ1ZTwvbGFiZWw\u002BCiAgICAgICAgICAgICAgPGNvZGU\u002BdHJ1ZTwvY29kZT4KICAgICAgICAgICAgICA8bWVzc2FnZT50cnVlPC9tZXNzYWdlPgogICAgICAgICAgICAgIDx0aHJlYWROYW1lPnRydWU8L3RocmVhZE5hbWU\u002BCiAgICAgICAgICAgICAgPGRhdGFUeXBlPnRydWU8L2RhdGFUeXBlPgogICAgICAgICAgICAgIDxlbmNvZGluZz5mYWxzZTwvZW5jb2Rpbmc\u002BCiAgICAgICAgICAgICAgPGFzc2VydGlvbnM\u002BdHJ1ZTwvYXNzZXJ0aW9ucz4KICAgICAgICAgICAgICA8c3VicmVzdWx0cz50cnVlPC9zdWJyZXN1bHRzPgogICAgICAgICAgICAgIDxyZXNwb25zZURhdGE\u002BZmFsc2U8L3Jlc3BvbnNlRGF0YT4KICAgICAgICAgICAgICA8c2FtcGxlckRhdGE\u002BZmFsc2U8L3NhbXBsZXJEYXRhPgogICAgICAgICAgICAgIDx4bWw\u002BZmFsc2U8L3htbD4KICAgICAgICAgICAgICA8ZmllbGROYW1lcz50cnVlPC9maWVsZE5hbWVzPgogICAgICAgICAgICAgIDxyZXNwb25zZUhlYWRlcnM\u002BZmFsc2U8L3Jlc3BvbnNlSGVhZGVycz4KICAgICAgICAgICAgICA8cmVxdWVzdEhlYWRlcnM\u002BZmFsc2U8L3JlcXVlc3RIZWFkZXJzPgogICAgICAgICAgICAgIDxyZXNwb25zZURhdGFPbkVycm9yPmZhbHNlPC9yZXNwb25zZURhdGFPbkVycm9yPgogICAgICAgICAgICAgIDxzYXZlQXNzZXJ0aW9uUmVzdWx0c0ZhaWx1cmVNZXNzYWdlPnRydWU8L3NhdmVBc3NlcnRpb25SZXN1bHRzRmFpbHVyZU1lc3NhZ2U\u002BCiAgICAgICAgICAgICAgPGFzc2VydGlvbnNSZXN1bHRzVG9TYXZlPjA8L2Fzc2VydGlvbnNSZXN1bHRzVG9TYXZlPgogICAgICAgICAgICAgIDxieXRlcz50cnVlPC9ieXRlcz4KICAgICAgICAgICAgICA8c2VudEJ5dGVzPnRydWU8L3NlbnRCeXRlcz4KICAgICAgICAgICAgICA8dXJsPnRydWU8L3VybD4KICAgICAgICAgICAgICA8dGhyZWFkQ291bnRzPnRydWU8L3RocmVhZENvdW50cz4KICAgICAgICAgICAgICA8aWRsZVRpbWU\u002BdHJ1ZTwvaWRsZVRpbWU\u002BCiAgICAgICAgICAgICAgPGNvbm5lY3RUaW1lPnRydWU8L2Nvbm5lY3RUaW1lPgogICAgICAgICAgICA8L3ZhbHVlPgogICAgICAgICAgPC9vYmpQcm9wPgogICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iZmlsZW5hbWUiPjwvc3RyaW5nUHJvcD4KICAgICAgICA8L1Jlc3VsdENvbGxlY3Rvcj4KICAgICAgICA8aGFzaFRyZWUvPgogICAgICA8L2hhc2hUcmVlPgogICAgICA8QXJndW1lbnRzIGd1aWNsYXNzPSJBcmd1bWVudHNQYW5lbCIgdGVzdGNsYXNzPSJBcmd1bWVudHMiIHRlc3RuYW1lPSJVc2VyIERlZmluZWQgVmFyaWFibGVzIiBlbmFibGVkPSJ0cnVlIj4KICAgICAgICA8Y29sbGVjdGlvblByb3AgbmFtZT0iQXJndW1lbnRzLmFyZ3VtZW50cyI\u002BCiAgICAgICAgICA8ZWxlbWVudFByb3AgbmFtZT0idWR2X3dlYmFwcCIgZWxlbWVudFR5cGU9IkFyZ3VtZW50Ij4KICAgICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iQXJndW1lbnQubmFtZSI\u002BdWR2X3dlYmFwcDwvc3RyaW5nUHJvcD4KICAgICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iQXJndW1lbnQudmFsdWUiPiR7X19CZWFuU2hlbGwoIFN5c3RlbS5nZXRlbnYoJnF1b3Q7d2ViYXBwJnF1b3Q7KSApfTwvc3RyaW5nUHJvcD4KICAgICAgICAgICAgPHN0cmluZ1Byb3AgbmFtZT0iQXJndW1lbnQuZGVzYyI\u002BV2ViIEFwcCBVUkw8L3N0cmluZ1Byb3A\u002BCiAgICAgICAgICAgIDxzdHJpbmdQcm9wIG5hbWU9IkFyZ3VtZW50Lm1ldGFkYXRhIj49PC9zdHJpbmdQcm9wPgogICAgICAgICAgPC9lbGVtZW50UHJvcD4KICAgICAgICA8L2NvbGxlY3Rpb25Qcm9wPgogICAgICA8L0FyZ3VtZW50cz4KICAgICAgPGhhc2hUcmVlLz4KICAgIDwvaGFzaFRyZWU\u002BCiAgPC9oYXNoVHJlZT4KPC9qbWV0ZXJUZXN0UGxhbj4K", "StatusCode": 201, @@ -501,18 +502,18 @@ "Connection": "keep-alive", "Content-Length": "148", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:18 GMT", + "Date": "Wed, 15 Feb 2023 12:14:06 GMT", "Location": "https://https://myservice.azure.com/tests/pytest_setup_load_test_id/files/sample.jmx?api-version=2022-11-01", - "mise-correlation-id": "868415ee-0b64-417b-abbd-d31fae8e002d", + "mise-correlation-id": "3842de04-096d-4b81-85c0-fcfd6a47398f", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6b21b6bb-9b1a-44c1-929b-c9497e06a898" + "x-ms-correlation-request-id": "20c97140-56f9-416c-9577-44ecc1f91308" }, "ResponseBody": { "url": "url", "fileName": "sample.jmx", "fileType": "JMX_FILE", - "expireDateTime": "2023-01-04T10:36:18.2466931", + "expireDateTime": "2023-02-15T12:24:06.5950726", "validationStatus": "VALIDATION_INITIATED" } }, @@ -533,12 +534,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:17 GMT", + "Date": "Wed, 15 Feb 2023 12:14:05 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -627,12 +628,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:18 GMT", + "Date": "Wed, 15 Feb 2023 12:14:05 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -688,7 +689,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "b8a0b584-2faa-4ba3-b40c-874b51ba6236", + "client-request-id": "d1aa76cf-e9e6-4c98-848d-874feb0a60fa", "Connection": "keep-alive", "Content-Length": "298", "Content-Type": "application/x-www-form-urlencoded", @@ -706,10 +707,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "b8a0b584-2faa-4ba3-b40c-874b51ba6236", + "client-request-id": "d1aa76cf-e9e6-4c98-848d-874feb0a60fa", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:18 GMT", + "Date": "Wed, 15 Feb 2023 12:14:06 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -717,7 +718,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -735,26 +736,56 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-developer-loadtesting/1.0.0b3 Python/3.10.8 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-developer-loadtesting/1.0.0 Python/3.10.8 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2021-07-01-preview, 2022-06-01-preview, 2022-11-01", + "Connection": "keep-alive", + "Content-Length": "148", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 12:14:08 GMT", + "mise-correlation-id": "81d99016-f7bd-4252-85a8-3fc7cd95b881", + "Strict-Transport-Security": "max-age=15724800; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8bedfbbc-1d93-4a19-9aea-b1adfe5fd76b" + }, + "ResponseBody": { + "url": "url", + "fileName": "sample.jmx", + "fileType": "JMX_FILE", + "expireDateTime": "2023-02-15T12:24:08.2908654", + "validationStatus": "VALIDATION_INITIATED" + } + }, + { + "RequestUri": "https://https://myservice.azure.com/tests/pytest_setup_load_test_id/files/sample.jmx?api-version=2022-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-developer-loadtesting/1.0.0 Python/3.10.8 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "api-supported-versions": "2021-07-01-preview, 2022-06-01-preview, 2022-11-01", "Connection": "keep-alive", - "Content-Length": "147", + "Content-Length": "148", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:19 GMT", - "mise-correlation-id": "d820b460-5968-49ee-9b83-0876fcfba319", + "Date": "Wed, 15 Feb 2023 12:14:08 GMT", + "mise-correlation-id": "5e39388e-fcdd-4de0-b9c3-1010916bedf0", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1668fa0e-1e41-48f6-978f-8923afbfc287" + "x-ms-correlation-request-id": "fee67c15-5093-4acb-8d49-a481a5d2b970" }, "ResponseBody": { "url": "url", "fileName": "sample.jmx", "fileType": "JMX_FILE", - "expireDateTime": "2023-01-04T10:36:19.386221", + "expireDateTime": "2023-02-15T12:24:08.4354802", "validationStatus": "VALIDATION_INITIATED" } }, @@ -765,7 +796,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-developer-loadtesting/1.0.0b3 Python/3.10.8 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-developer-loadtesting/1.0.0 Python/3.10.8 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -774,11 +805,11 @@ "Connection": "keep-alive", "Content-Length": "142", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 04 Jan 2023 10:26:19 GMT", - "mise-correlation-id": "2b9499e1-9f14-4f8f-8c46-2417f7d25187", + "Date": "Wed, 15 Feb 2023 12:14:09 GMT", + "mise-correlation-id": "91864196-e93c-454e-b942-715d32242af7", "Strict-Transport-Security": "max-age=15724800; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "805519d4-0380-48b1-a36c-a115a6e94d67" + "x-ms-correlation-request-id": "9f318c7a-f3a4-4443-a76d-2ae6dde10406" }, "ResponseBody": { "error": { diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_app_components.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_load_test.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_create_or_update_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_load_test.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_delete_test_file.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_file_upload_poller.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_app_components.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_load_test.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_get_test_file.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_admin_ops.pyTestLoadTestAdministrationClienttest_list_load_tests.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_app_component.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_app_component.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_app_component.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_app_component.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_delete_test_run.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_delete_test_run.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_delete_test_run.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_delete_test_run.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_app_component.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_app_component.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_app_component.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_app_component.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_metrics.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_metrics.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_metrics.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_metrics.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run_file.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run_file.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run_file.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_get_test_run_file.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_list_test_runs.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_list_test_runs.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_list_test_runs.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_list_test_runs.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_stop_test_run.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_stop_test_run.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_stop_test_run.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_stop_test_run.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_test_run_poller.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_test_run_poller.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_test_run_poller.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_async_run_ops.pyTestRunOpstest_test_run_poller.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_app_component.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_app_component.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_app_component.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_app_component.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_create_or_update_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_delete_test_run.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_delete_test_run.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_delete_test_run.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_delete_test_run.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_app_component.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_app_component.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_app_component.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_app_component.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_metrics.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_metrics.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_metrics.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_metrics.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_server_metrics_config.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_server_metrics_config.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_server_metrics_config.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_server_metrics_config.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run_file.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run_file.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run_file.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_get_test_run_file.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_list_test_runs.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_list_test_runs.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_list_test_runs.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_list_test_runs.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_stop_test_run.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_stop_test_run.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_stop_test_run.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_stop_test_run.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_test_run_poller.json b/sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_test_run_poller.json similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_test_run_poller.json rename to sdk/loadtesting/azure-developer-loadtesting/tests/recordings/test_run_ops.pyTestRunOpstest_test_run_poller.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/sample.jmx b/sdk/loadtesting/azure-developer-loadtesting/tests/sample.jmx similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/sample.jmx rename to sdk/loadtesting/azure-developer-loadtesting/tests/sample.jmx diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/second-sample.jmx b/sdk/loadtesting/azure-developer-loadtesting/tests/second-sample.jmx similarity index 100% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/second-sample.jmx rename to sdk/loadtesting/azure-developer-loadtesting/tests/second-sample.jmx diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_admin_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_admin_ops.py similarity index 75% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/test_admin_ops.py rename to sdk/loadtesting/azure-developer-loadtesting/tests/test_admin_ops.py index 744f3262f02d..c05fd819cc78 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_admin_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_admin_ops.py @@ -19,9 +19,9 @@ class TestLoadTestAdministrationClient(LoadtestingTest): def setup_create_load_test(self, endpoint): self.setup_load_test_id = "pytest_setup_load_test_id" - client = self.create_client(endpoint) + client = self.create_administration_client(endpoint) - client.administration.create_or_update_test( + client.create_or_update_test( self.setup_load_test_id, { "description": "", @@ -40,14 +40,14 @@ def setup_create_load_test(self, endpoint): ) def setup_upload_test_file(self, endpoint): - client = self.create_client(endpoint) + client = self.create_administration_client(endpoint) self.setup_file_name = "sample.jmx" - client.administration.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb"), poll_for_validation_status=False) + client.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb")) def setup_app_components(self, endpoint, resource_id): - client = self.create_client(endpoint) + client = self.create_administration_client(endpoint) - client.administration.create_or_update_app_components( + client.create_or_update_app_components( self.setup_load_test_id, { "components": { @@ -65,8 +65,8 @@ def setup_app_components(self, endpoint, resource_id): def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = client.administration.create_or_update_test( + client = self.create_administration_client(loadtesting_endpoint) + result = client.create_or_update_test( loadtesting_test_id, { "description": "", @@ -86,7 +86,7 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test assert result is not None with pytest.raises(HttpResponseError): - client.administration.create_or_update_test( + client.create_or_update_test( loadtesting_test_id, { "description": "", @@ -110,12 +110,12 @@ def test_delete_load_test(self, loadtesting_endpoint): set_bodiless_matcher() self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = client.administration.delete_test(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = client.delete_test(self.setup_load_test_id) assert result is None with pytest.raises(ResourceNotFoundError): - client.administration.delete_test(NON_EXISTING_RESOURCE) + client.delete_test(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy @@ -123,12 +123,12 @@ def test_get_load_test(self, loadtesting_endpoint): set_bodiless_matcher() self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = client.administration.get_test(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = client.get_test(self.setup_load_test_id) assert result is not None with pytest.raises(ResourceNotFoundError): - client.administration.get_test(NON_EXISTING_RESOURCE) + client.get_test(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy @@ -136,8 +136,8 @@ def test_list_load_tests(self, loadtesting_endpoint): set_bodiless_matcher() self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = client.administration.list_tests() + client = self.create_administration_client(loadtesting_endpoint) + result = client.list_tests() assert result is not None @@ -148,12 +148,12 @@ def test_get_test_file(self, loadtesting_endpoint): self.setup_create_load_test(loadtesting_endpoint) self.setup_upload_test_file(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = client.administration.get_test_file(self.setup_load_test_id, self.setup_file_name) + client = self.create_administration_client(loadtesting_endpoint) + result = client.get_test_file(self.setup_load_test_id, self.setup_file_name) assert result is not None with pytest.raises(ResourceNotFoundError): - client.administration.get_test_file(self.setup_load_test_id, "nonexistent.jmx") + client.get_test_file(self.setup_load_test_id, "nonexistent.jmx") @LoadtestingPowerShellPreparer() @recorded_by_proxy @@ -162,12 +162,12 @@ def test_delete_test_file(self, loadtesting_endpoint): self.setup_create_load_test(loadtesting_endpoint) self.setup_upload_test_file(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = client.administration.delete_test_file(self.setup_load_test_id, self.setup_file_name) + client = self.create_administration_client(loadtesting_endpoint) + result = client.delete_test_file(self.setup_load_test_id, self.setup_file_name) assert result is None with pytest.raises(ResourceNotFoundError): - client.administration.delete_test_file(self.setup_load_test_id, "nonexistent.jmx") + client.delete_test_file(self.setup_load_test_id, "nonexistent.jmx") @LoadtestingPowerShellPreparer() @@ -177,20 +177,20 @@ def list_test_files(self, loadtesting_endpoint): self.setup_create_load_test(loadtesting_endpoint) self.setup_upload_test_file(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = client.administration.list_test_files(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = client.list_test_files(self.setup_load_test_id) assert result is not None with pytest.raises(ResourceNotFoundError): - client.administration.list_test_files(NON_EXISTING_RESOURCE) + client.list_test_files(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy def test_create_or_update_app_components(self, loadtesting_endpoint, loadtesting_test_id, loadtesting_resource_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = client.administration.create_or_update_app_components( + client = self.create_administration_client(loadtesting_endpoint) + result = client.create_or_update_app_components( loadtesting_test_id, { "components": @@ -208,7 +208,7 @@ def test_create_or_update_app_components(self, loadtesting_endpoint, loadtesting assert result is not None with pytest.raises(ResourceNotFoundError): - client.administration.create_or_update_app_components( + client.create_or_update_app_components( NON_EXISTING_RESOURCE, { "components": { @@ -229,12 +229,12 @@ def test_get_app_components(self, loadtesting_endpoint, loadtesting_resource_id) self.setup_create_load_test(loadtesting_endpoint) self.setup_app_components(loadtesting_endpoint, loadtesting_resource_id) - client = self.create_client(loadtesting_endpoint) - result = client.administration.get_app_components(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = client.get_app_components(self.setup_load_test_id) assert result is not None with pytest.raises(ResourceNotFoundError): - client.administration.get_app_components(NON_EXISTING_RESOURCE) + client.get_app_components(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy @@ -242,10 +242,9 @@ def test_file_upload_poller(self, loadtesting_endpoint): set_bodiless_matcher() self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - poller = client.administration.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", - open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb"), - poll_for_validation_status=True) + client = self.create_administration_client(loadtesting_endpoint) + poller = client.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", + open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb")) assert poller.get_initial_response() is not None @@ -259,8 +258,8 @@ def test_file_upload_poller(self, loadtesting_endpoint): def test_create_or_update_server_metrics_config(self, loadtesting_endpoint, loadtesting_resource_id, loadtesting_test_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = client.administration.create_or_update_server_metrics_config( + client = self.create_administration_client(loadtesting_endpoint) + result = client.create_or_update_server_metrics_config( loadtesting_test_id, { "metrics": { @@ -282,6 +281,6 @@ def test_create_or_update_server_metrics_config(self, loadtesting_endpoint, load @recorded_by_proxy def test_get_server_metrics_config(self, loadtesting_endpoint, loadtesting_test_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = client.administration.get_server_metrics_config(loadtesting_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = client.get_server_metrics_config(loadtesting_test_id) assert result is not None diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_async_admin_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_admin_ops.py similarity index 75% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/test_async_admin_ops.py rename to sdk/loadtesting/azure-developer-loadtesting/tests/test_async_admin_ops.py index 98f4a5418785..f3f773bd4d12 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_async_admin_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_admin_ops.py @@ -21,9 +21,9 @@ class TestLoadTestAdministrationClient(LoadtestingAsyncTest): async def setup_create_load_test(self, endpoint): self.setup_load_test_id = "pytest_setup_load_test_id" - client = self.create_client(endpoint) + client = self.create_administration_client(endpoint) - await client.administration.create_or_update_test( + await client.create_or_update_test( self.setup_load_test_id, { "description": "", @@ -42,14 +42,14 @@ async def setup_create_load_test(self, endpoint): ) async def setup_upload_test_file(self, endpoint): - client = self.create_client(endpoint) + client = self.create_administration_client(endpoint) self.setup_file_name = "sample.jmx" - await client.administration.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb"), poll_for_validation_status=False) + await client.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb")) async def setup_app_components(self, endpoint, resource_id): - client = self.create_client(endpoint) + client = self.create_administration_client(endpoint) - await client.administration.create_or_update_app_components( + await client.create_or_update_app_components( self.setup_load_test_id, { "components": { @@ -67,8 +67,8 @@ async def setup_app_components(self, endpoint, resource_id): async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = await client.administration.create_or_update_test( + client = self.create_administration_client(loadtesting_endpoint) + result = await client.create_or_update_test( loadtesting_test_id, { "description": "", @@ -88,7 +88,7 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin assert result is not None with pytest.raises(HttpResponseError): - await client.administration.create_or_update_test( + await client.create_or_update_test( loadtesting_test_id, { "description": "", @@ -112,12 +112,12 @@ async def test_delete_load_test(self, loadtesting_endpoint): set_bodiless_matcher() await self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = await client.administration.delete_test(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = await client.delete_test(self.setup_load_test_id) assert result is None with pytest.raises(ResourceNotFoundError): - await client.administration.delete_test(NON_EXISTING_RESOURCE) + await client.delete_test(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy_async @@ -125,12 +125,12 @@ async def test_get_load_test(self, loadtesting_endpoint): set_bodiless_matcher() await self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = await client.administration.get_test(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = await client.get_test(self.setup_load_test_id) assert result is not None with pytest.raises(ResourceNotFoundError): - await client.administration.get_test(NON_EXISTING_RESOURCE) + await client.get_test(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy_async @@ -138,8 +138,8 @@ async def test_list_load_tests(self, loadtesting_endpoint): set_bodiless_matcher() await self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = client.administration.list_tests() + client = self.create_administration_client(loadtesting_endpoint) + result = client.list_tests() assert result is not None @@ -150,12 +150,12 @@ async def test_get_test_file(self, loadtesting_endpoint): await self.setup_create_load_test(loadtesting_endpoint) await self.setup_upload_test_file(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = await client.administration.get_test_file(self.setup_load_test_id, self.setup_file_name) + client = self.create_administration_client(loadtesting_endpoint) + result = await client.get_test_file(self.setup_load_test_id, self.setup_file_name) assert result is not None with pytest.raises(ResourceNotFoundError): - await client.administration.get_test_file(self.setup_load_test_id, "nonexistent.jmx") + await client.get_test_file(self.setup_load_test_id, "nonexistent.jmx") @LoadtestingPowerShellPreparer() @recorded_by_proxy_async @@ -164,12 +164,12 @@ async def test_delete_test_file(self, loadtesting_endpoint): await self.setup_create_load_test(loadtesting_endpoint) await self.setup_upload_test_file(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = await client.administration.delete_test_file(self.setup_load_test_id, self.setup_file_name) + client = self.create_administration_client(loadtesting_endpoint) + result = await client.delete_test_file(self.setup_load_test_id, self.setup_file_name) assert result is None with pytest.raises(ResourceNotFoundError): - await client.administration.delete_test_file(self.setup_load_test_id, "nonexistent.jmx") + await client.delete_test_file(self.setup_load_test_id, "nonexistent.jmx") @LoadtestingPowerShellPreparer() @@ -179,20 +179,20 @@ async def list_test_files(self, loadtesting_endpoint): await self.setup_create_load_test(loadtesting_endpoint) await self.setup_upload_test_file(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - result = await client.administration.list_test_files(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = await client.list_test_files(self.setup_load_test_id) assert result is not None with pytest.raises(ResourceNotFoundError): - await client.administration.list_test_files(NON_EXISTING_RESOURCE) + await client.list_test_files(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy_async async def test_create_or_update_app_components(self, loadtesting_endpoint, loadtesting_test_id, loadtesting_resource_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = await client.administration.create_or_update_app_components( + client = self.create_administration_client(loadtesting_endpoint) + result = await client.create_or_update_app_components( loadtesting_test_id, { "components": @@ -210,7 +210,7 @@ async def test_create_or_update_app_components(self, loadtesting_endpoint, loadt assert result is not None with pytest.raises(ResourceNotFoundError): - await client.administration.create_or_update_app_components( + await client.create_or_update_app_components( NON_EXISTING_RESOURCE, { "components": { @@ -231,12 +231,12 @@ async def test_get_app_components(self, loadtesting_endpoint, loadtesting_resour await self.setup_create_load_test(loadtesting_endpoint) await self.setup_app_components(loadtesting_endpoint, loadtesting_resource_id) - client = self.create_client(loadtesting_endpoint) - result = await client.administration.get_app_components(self.setup_load_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = await client.get_app_components(self.setup_load_test_id) assert result is not None with pytest.raises(ResourceNotFoundError): - await client.administration.get_app_components(NON_EXISTING_RESOURCE) + await client.get_app_components(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy_async @@ -244,10 +244,10 @@ async def test_file_upload_poller(self, loadtesting_endpoint): set_bodiless_matcher() await self.setup_create_load_test(loadtesting_endpoint) - client = self.create_client(loadtesting_endpoint) - poller = await client.administration.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", - open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb"), - poll_for_validation_status=True) + client = self.create_administration_client(loadtesting_endpoint) + poller = await client.begin_upload_test_file(self.setup_load_test_id, "sample.jmx", + open(os.path.join(Path(__file__).resolve().parent, "sample.jmx"), "rb")) + assert poller.get_initial_response() is not None result = await poller.result() @@ -260,8 +260,8 @@ async def test_file_upload_poller(self, loadtesting_endpoint): async def test_create_or_update_server_metrics_config(self, loadtesting_endpoint, loadtesting_resource_id, loadtesting_test_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = await client.administration.create_or_update_server_metrics_config( + client = self.create_administration_client(loadtesting_endpoint) + result = await client.create_or_update_server_metrics_config( loadtesting_test_id, { "metrics": { @@ -283,6 +283,6 @@ async def test_create_or_update_server_metrics_config(self, loadtesting_endpoint @recorded_by_proxy_async async def test_get_server_metrics_config(self, loadtesting_endpoint, loadtesting_test_id): set_bodiless_matcher() - client = self.create_client(loadtesting_endpoint) - result = await client.administration.get_server_metrics_config(loadtesting_test_id) + client = self.create_administration_client(loadtesting_endpoint) + result = await client.get_server_metrics_config(loadtesting_test_id) assert result is not None diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_async_run_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_run_ops.py similarity index 74% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/test_async_run_ops.py rename to sdk/loadtesting/azure-developer-loadtesting/tests/test_async_run_ops.py index 2b9dd39bf650..1540d6ae1585 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_async_run_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_run_ops.py @@ -20,9 +20,9 @@ class TestRunOps(LoadtestingAsyncTest): async def setup_loadtest(self, endpoint, test_id): - admin_client = self.create_client(endpoint) + admin_client = self.create_administration_client(endpoint) - await admin_client.administration.create_or_update_test( + await admin_client.create_or_update_test( test_id, { "description": "", @@ -40,9 +40,8 @@ async def setup_loadtest(self, endpoint, test_id): } ) - validation_poller = await admin_client.administration.begin_upload_test_file( - test_id, "sample.jmx", open(os.path.join(os.path.dirname(__file__), "sample.jmx"), "rb"), - poll_for_validation_status=True + validation_poller = await admin_client.begin_upload_test_file( + test_id, "sample.jmx", open(os.path.join(os.path.dirname(__file__), "sample.jmx"), "rb") ) await validation_poller.result() @@ -50,9 +49,9 @@ async def setup_loadtest(self, endpoint, test_id): async def setup_test_run(self, endpoint, test_id, test_run_id): await self.setup_loadtest(endpoint, test_id) - run_client = self.create_client(endpoint) + run_client = self.create_run_client(endpoint) - run_poller = await run_client.test_run.begin_test_run( + run_poller = await run_client.begin_test_run( test_run_id, { "testId": test_id, @@ -68,15 +67,14 @@ async def test_test_run_poller(self, loadtesting_endpoint, loadtesting_test_id, await self.setup_loadtest(loadtesting_endpoint, loadtesting_test_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - run_poller = await run_client.test_run.begin_test_run( + run_poller = await run_client.begin_test_run( loadtesting_test_run_id, { "testId": loadtesting_test_id, "displayName": "My New Load Test Run from PyTest", - }, - poll_for_test_run_status = True + } ) assert run_poller.get_initial_response() is not None @@ -92,13 +90,13 @@ async def test_test_run_poller(self, loadtesting_endpoint, loadtesting_test_id, async def test_get_test_run(self, loadtesting_endpoint, loadtesting_test_run_id): set_bodiless_matcher() - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = await run_client.test_run.get_test_run(loadtesting_test_run_id) + result = await run_client.get_test_run(loadtesting_test_run_id) assert result is not None with pytest.raises(ResourceNotFoundError): - await run_client.test_run.get_test_run(NON_EXISTING_RESOURCE) + await run_client.get_test_run(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy_async @@ -107,13 +105,13 @@ async def test_delete_test_run(self, loadtesting_endpoint, loadtesting_test_id, await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = await run_client.test_run.delete_test_run(loadtesting_test_run_id) + result = await run_client.delete_test_run(loadtesting_test_run_id) assert result is None with pytest.raises(ResourceNotFoundError): - await run_client.test_run.delete_test_run(NON_EXISTING_RESOURCE) + await run_client.delete_test_run(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @@ -123,16 +121,16 @@ async def test_get_test_run_file(self, loadtesting_endpoint, loadtesting_test_id await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = await run_client.test_run.get_test_run_file(loadtesting_test_run_id, "sample.jmx") + result = await run_client.get_test_run_file(loadtesting_test_run_id, "sample.jmx") assert result is not None with pytest.raises(ResourceNotFoundError): - await run_client.test_run.get_test_run_file(NON_EXISTING_RESOURCE, "sample.jmx") + await run_client.get_test_run_file(NON_EXISTING_RESOURCE, "sample.jmx") with pytest.raises(HttpResponseError): - await run_client.test_run.get_test_run_file(loadtesting_test_run_id, NON_EXISTING_RESOURCE) + await run_client.get_test_run_file(loadtesting_test_run_id, NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @@ -142,9 +140,9 @@ async def test_list_test_runs(self, loadtesting_endpoint, loadtesting_test_id, l await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.list_test_runs() + result = run_client.list_test_runs() assert result is not None @@ -154,24 +152,23 @@ async def test_stop_test_run(self, loadtesting_endpoint): set_bodiless_matcher() await self.setup_loadtest(loadtesting_endpoint, "new-load-test-from-pytest-aio-abc") - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) try: - await run_client.test_run.delete_test_run("my-new-test-run-from-pytest-aio-abc") + await run_client.delete_test_run("my-new-test-run-from-pytest-aio-abc") except ResourceNotFoundError: pass - run_poller = await run_client.test_run.begin_test_run( + run_poller = await run_client.begin_test_run( "my-new-test-run-from-pytest-aio-abc", { "testId": "new-load-test-from-pytest-aio-abc", "displayName": "My New Load Test Run from PyTest", - }, - poll_for_test_run_status=False + } ) assert run_poller.get_initial_response() is not None - result = await run_client.test_run.stop_test_run("my-new-test-run-from-pytest-aio-abc") + result = await run_client.stop_test_run("my-new-test-run-from-pytest-aio-abc") assert result is not None @LoadtestingPowerShellPreparer() @@ -180,19 +177,19 @@ async def test_get_metrics(self, loadtesting_endpoint, loadtesting_test_id, load set_bodiless_matcher() await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - test_run_response = await run_client.test_run.get_test_run(loadtesting_test_run_id) + test_run_response = await run_client.get_test_run(loadtesting_test_run_id) assert test_run_response is not None - metric_namespaces = await run_client.test_run.list_metric_namespaces(loadtesting_test_run_id) + metric_namespaces = await run_client.get_metric_namespaces(loadtesting_test_run_id) assert metric_namespaces is not None - metric_definitions = await run_client.test_run.list_metric_definitions(loadtesting_test_run_id, + metric_definitions = await run_client.get_metric_definitions(loadtesting_test_run_id, metric_namespace=metric_namespaces["value"][0]["name"]) assert metric_definitions is not None - metrics = run_client.test_run.list_metrics( + metrics = run_client.list_metrics( test_run_id=loadtesting_test_run_id, metricname=metric_definitions["value"][0]["name"], metric_namespace=metric_namespaces["value"][0]["name"], @@ -207,9 +204,9 @@ async def test_create_or_update_app_component(self, loadtesting_endpoint, loadte await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = await run_client.test_run.create_or_update_app_components( + result = await run_client.create_or_update_app_components( loadtesting_test_run_id, { "components": @@ -227,7 +224,7 @@ async def test_create_or_update_app_component(self, loadtesting_endpoint, loadte assert result is not None with pytest.raises(ResourceNotFoundError): - await run_client.test_run.create_or_update_app_components( + await run_client.create_or_update_app_components( NON_EXISTING_RESOURCE, { "components": @@ -249,9 +246,9 @@ async def test_get_app_component(self, loadtesting_endpoint, loadtesting_test_id set_bodiless_matcher() await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = await run_client.test_run.get_app_components(loadtesting_test_run_id) + result = await run_client.get_app_components(loadtesting_test_run_id) assert result is not None @LoadtestingPowerShellPreparer() @@ -260,9 +257,9 @@ async def test_create_or_update_server_metrics_config(self, loadtesting_endpoint set_bodiless_matcher() await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = await run_client.test_run.create_or_update_server_metrics_config( + result = await run_client.create_or_update_server_metrics_config( loadtesting_test_run_id, { "metrics": { @@ -286,7 +283,7 @@ async def test_get_server_metrics_config(self, loadtesting_endpoint, loadtesting set_bodiless_matcher() await self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = await run_client.test_run.get_server_metrics_config(loadtesting_test_run_id) + result = await run_client.get_server_metrics_config(loadtesting_test_run_id) assert result is not None \ No newline at end of file diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_run_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_run_ops.py similarity index 75% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/test_run_ops.py rename to sdk/loadtesting/azure-developer-loadtesting/tests/test_run_ops.py index 3d7953615214..448478d1f663 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/tests/test_run_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_run_ops.py @@ -19,9 +19,9 @@ class TestRunOps(LoadtestingTest): def setup_loadtest(self, endpoint, test_id): - admin_client = self.create_client(endpoint) + admin_client = self.create_administration_client(endpoint) - admin_client.administration.create_or_update_test( + admin_client.create_or_update_test( test_id, { "description": "", @@ -39,9 +39,8 @@ def setup_loadtest(self, endpoint, test_id): } ) - validation_poller = admin_client.administration.begin_upload_test_file( - test_id, "sample.jmx", open(os.path.join(os.path.dirname(__file__), "sample.jmx"), "rb"), - poll_for_validation_status=True + validation_poller = admin_client.begin_upload_test_file( + test_id, "sample.jmx", open(os.path.join(os.path.dirname(__file__), "sample.jmx"), "rb") ) validation_poller.result(6000) @@ -49,14 +48,14 @@ def setup_loadtest(self, endpoint, test_id): def setup_test_run(self, endpoint, test_id, test_run_id): self.setup_loadtest(endpoint, test_id) - run_client = self.create_client(endpoint) + run_client = self.create_run_client(endpoint) - run_poller = run_client.test_run.begin_test_run( + run_poller = run_client.begin_test_run( test_run_id, { "testId": test_id, "displayName": "My New Load Test Run from PyTest", - }, + } ) run_poller.result(10800) @@ -67,9 +66,9 @@ def test_test_run_poller(self, loadtesting_endpoint, loadtesting_test_id, loadte self.setup_loadtest(loadtesting_endpoint, loadtesting_test_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - run_poller = run_client.test_run.begin_test_run( + run_poller = run_client.begin_test_run( loadtesting_test_run_id, { "testId": loadtesting_test_id, @@ -90,13 +89,13 @@ def test_test_run_poller(self, loadtesting_endpoint, loadtesting_test_id, loadte def test_get_test_run(self, loadtesting_endpoint, loadtesting_test_run_id): set_bodiless_matcher() - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.get_test_run(loadtesting_test_run_id) + result = run_client.get_test_run(loadtesting_test_run_id) assert result is not None with pytest.raises(ResourceNotFoundError): - run_client.test_run.get_test_run(NON_EXISTING_RESOURCE) + run_client.get_test_run(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @recorded_by_proxy @@ -105,13 +104,13 @@ def test_delete_test_run(self, loadtesting_endpoint, loadtesting_test_id, loadte self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.delete_test_run(loadtesting_test_run_id) + result = run_client.delete_test_run(loadtesting_test_run_id) assert result is None with pytest.raises(ResourceNotFoundError): - run_client.test_run.delete_test_run(NON_EXISTING_RESOURCE) + run_client.delete_test_run(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @@ -121,16 +120,16 @@ def test_get_test_run_file(self, loadtesting_endpoint, loadtesting_test_id, load self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.get_test_run_file(loadtesting_test_run_id, "sample.jmx") + result = run_client.get_test_run_file(loadtesting_test_run_id, "sample.jmx") assert result is not None with pytest.raises(ResourceNotFoundError): - run_client.test_run.get_test_run_file(NON_EXISTING_RESOURCE, "sample.jmx") + run_client.get_test_run_file(NON_EXISTING_RESOURCE, "sample.jmx") with pytest.raises(HttpResponseError): - run_client.test_run.get_test_run_file(loadtesting_test_run_id, NON_EXISTING_RESOURCE) + run_client.get_test_run_file(loadtesting_test_run_id, NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @@ -140,9 +139,9 @@ def test_list_test_runs(self, loadtesting_endpoint, loadtesting_test_id, loadtes self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.list_test_runs() + result = run_client.list_test_runs() assert result is not None @@ -152,28 +151,27 @@ def test_stop_test_run(self, loadtesting_endpoint): set_bodiless_matcher() self.setup_loadtest(loadtesting_endpoint, "new-load-test-from-pytest-abc") - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) try: - run_client.test_run.delete_test_run("my-new-test-run-from-pytest") + run_client.delete_test_run("my-new-test-run-from-pytest") except ResourceNotFoundError: pass - run_poller = run_client.test_run.begin_test_run( + run_poller = run_client.begin_test_run( "my-new-test-run-from-pytest", { "testId": "new-load-test-from-pytest-abc", "displayName": "My New Load Test Run from PyTest", - }, - poll_for_test_run_status=False + } ) assert run_poller.get_initial_response() is not None - result = run_client.test_run.stop_test_run("my-new-test-run-from-pytest") + result = run_client.stop_test_run("my-new-test-run-from-pytest") assert result is not None with pytest.raises(ResourceNotFoundError): - run_client.test_run.stop_test_run(NON_EXISTING_RESOURCE) + run_client.stop_test_run(NON_EXISTING_RESOURCE) @LoadtestingPowerShellPreparer() @@ -182,19 +180,19 @@ def test_get_metrics(self, loadtesting_endpoint, loadtesting_test_id, loadtestin set_bodiless_matcher() self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - test_run_response = run_client.test_run.get_test_run(loadtesting_test_run_id) + test_run_response = run_client.get_test_run(loadtesting_test_run_id) assert test_run_response is not None - metric_namespaces = run_client.test_run.list_metric_namespaces(loadtesting_test_run_id) + metric_namespaces = run_client.get_metric_namespaces(loadtesting_test_run_id) assert metric_namespaces is not None - metric_definitions = run_client.test_run.list_metric_definitions(loadtesting_test_run_id, + metric_definitions = run_client.get_metric_definitions(loadtesting_test_run_id, metric_namespace=metric_namespaces["value"][0]["name"]) assert metric_definitions is not None - metrics = run_client.test_run.list_metrics( + metrics = run_client.list_metrics( test_run_id=loadtesting_test_run_id, metricname=metric_definitions["value"][0]["name"], metric_namespace=metric_namespaces["value"][0]["name"], @@ -209,9 +207,9 @@ def test_create_or_update_app_component(self, loadtesting_endpoint, loadtesting_ self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.create_or_update_app_components( + result = run_client.create_or_update_app_components( loadtesting_test_run_id, { "components": @@ -229,7 +227,7 @@ def test_create_or_update_app_component(self, loadtesting_endpoint, loadtesting_ assert result is not None with pytest.raises(ResourceNotFoundError): - run_client.test_run.create_or_update_app_components( + run_client.create_or_update_app_components( NON_EXISTING_RESOURCE, { "components": @@ -251,9 +249,9 @@ def test_get_app_component(self, loadtesting_endpoint, loadtesting_test_id, load set_bodiless_matcher() self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.get_app_components(loadtesting_test_run_id) + result = run_client.get_app_components(loadtesting_test_run_id) assert result is not None @LoadtestingPowerShellPreparer() @@ -262,9 +260,9 @@ def test_create_or_update_server_metrics_config(self, loadtesting_endpoint, load set_bodiless_matcher() self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.create_or_update_server_metrics_config( + result = run_client.create_or_update_server_metrics_config( loadtesting_test_run_id, { "metrics": { @@ -288,7 +286,7 @@ def test_get_server_metrics_config(self, loadtesting_endpoint, loadtesting_test_ set_bodiless_matcher() self.setup_test_run(loadtesting_endpoint, loadtesting_test_id, loadtesting_test_run_id) - run_client = self.create_client(loadtesting_endpoint) + run_client = self.create_run_client(loadtesting_endpoint) - result = run_client.test_run.get_server_metrics_config(loadtesting_test_run_id) + result = run_client.get_server_metrics_config(loadtesting_test_run_id) assert result is not None \ No newline at end of file diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/testcase.py b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase.py similarity index 65% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/testcase.py rename to sdk/loadtesting/azure-developer-loadtesting/tests/testcase.py index f41bffb752e4..4c662118b11c 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/tests/testcase.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase.py @@ -7,14 +7,22 @@ import os import functools from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -from azure.developer.loadtesting import LoadTestingClient +from azure.developer.loadtesting import LoadTestAdministrationClient, LoadTestRunClient class LoadtestingTest(AzureRecordedTestCase): - def create_client(self, endpoint): - credential = self.get_credential(LoadTestingClient) + def create_administration_client(self, endpoint): + credential = self.get_credential(LoadTestAdministrationClient) return self.create_client_from_credential( - LoadTestingClient, + LoadTestAdministrationClient, + credential=credential, + endpoint=endpoint, + ) + + def create_run_client(self, endpoint): + credential = self.get_credential(LoadTestRunClient) + return self.create_client_from_credential( + LoadTestRunClient, credential=credential, endpoint=endpoint, ) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/tests/testcase_async.py b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase_async.py similarity index 51% rename from sdk/loadtestservice/azure-developer-loadtesting/tests/testcase_async.py rename to sdk/loadtesting/azure-developer-loadtesting/tests/testcase_async.py index 0c7144831846..d128828e0c90 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/tests/testcase_async.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase_async.py @@ -4,15 +4,23 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from azure.developer.loadtesting.aio import LoadTestingClient +from azure.developer.loadtesting.aio import LoadTestRunClient, LoadAdministrationClient from devtools_testutils import AzureRecordedTestCase class LoadtestingAsyncTest(AzureRecordedTestCase): - def create_client(self, endpoint): - credential = self.get_credential(LoadTestingClient, is_async=True) + def create_administration_client(self, endpoint): + credential = self.get_credential(LoadAdministrationClient, is_async=True) return self.create_client_from_credential( - LoadTestingClient, + LoadAdministrationClient, + credential=credential, + endpoint=endpoint, + ) + + def create_run_client(self, endpoint): + credential = self.get_credential(LoadTestRunClient, is_async=True) + return self.create_client_from_credential( + LoadTestRunClient, credential=credential, endpoint=endpoint, ) \ No newline at end of file diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/CHANGELOG.md b/sdk/loadtesting/azure-mgmt-loadtesting/CHANGELOG.md similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/CHANGELOG.md rename to sdk/loadtesting/azure-mgmt-loadtesting/CHANGELOG.md diff --git a/sdk/loadtestservice/azure-developer-loadtesting/LICENSE b/sdk/loadtesting/azure-mgmt-loadtesting/LICENSE similarity index 99% rename from sdk/loadtestservice/azure-developer-loadtesting/LICENSE rename to sdk/loadtesting/azure-mgmt-loadtesting/LICENSE index 63447fd8bbbf..b2f52a2bad4e 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/LICENSE +++ b/sdk/loadtesting/azure-mgmt-loadtesting/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/MANIFEST.in b/sdk/loadtesting/azure-mgmt-loadtesting/MANIFEST.in similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/MANIFEST.in rename to sdk/loadtesting/azure-mgmt-loadtesting/MANIFEST.in diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/README.md b/sdk/loadtesting/azure-mgmt-loadtesting/README.md similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/README.md rename to sdk/loadtesting/azure-mgmt-loadtesting/README.md diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/_meta.json b/sdk/loadtesting/azure-mgmt-loadtesting/_meta.json similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/_meta.json rename to sdk/loadtesting/azure-mgmt-loadtesting/_meta.json diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/__init__.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/__init__.py similarity index 79% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/__init__.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/__init__.py index d55ccad1f573..8db66d3d0f0f 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/__init__.py +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/__init__.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/__init__.py similarity index 79% rename from sdk/loadtestservice/azure-developer-loadtesting/azure/developer/__init__.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/__init__.py index d55ccad1f573..8db66d3d0f0f 100644 --- a/sdk/loadtestservice/azure-developer-loadtesting/azure/developer/__init__.py +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/__init__.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/__init__.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/__init__.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/__init__.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_configuration.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_configuration.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_configuration.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_configuration.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_load_test_mgmt_client.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_load_test_mgmt_client.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_load_test_mgmt_client.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_load_test_mgmt_client.py diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_patch.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_serialization.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_serialization.py new file mode 100644 index 000000000000..f17c068e833e --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_serialization.py @@ -0,0 +1,1996 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to azure from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_vendor.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_vendor.py new file mode 100644 index 000000000000..bd0df84f5319 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_vendor.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import List, cast + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_version.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_version.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_version.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/_version.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/__init__.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/__init__.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/__init__.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/__init__.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_configuration.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_configuration.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_configuration.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_configuration.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_load_test_mgmt_client.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_load_test_mgmt_client.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_load_test_mgmt_client.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_load_test_mgmt_client.py diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_patch.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/__init__.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/__init__.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/__init__.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/__init__.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_load_tests_operations.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_load_tests_operations.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_load_tests_operations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_load_tests_operations.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_operations.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_operations.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_operations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_operations.py diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_patch.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_quotas_operations.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_quotas_operations.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_quotas_operations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/aio/operations/_quotas_operations.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/__init__.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/__init__.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/__init__.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/__init__.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_load_test_mgmt_client_enums.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_load_test_mgmt_client_enums.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_load_test_mgmt_client_enums.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_load_test_mgmt_client_enums.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_models_py3.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_models_py3.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_models_py3.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_models_py3.py diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_patch.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/__init__.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/__init__.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/__init__.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/__init__.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_load_tests_operations.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_load_tests_operations.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_load_tests_operations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_load_tests_operations.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_operations.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_operations.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_operations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_operations.py diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_patch.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_quotas_operations.py b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_quotas_operations.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_quotas_operations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/operations/_quotas_operations.py diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/py.typed b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/azure/mgmt/loadtesting/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/dev_requirements.txt b/sdk/loadtesting/azure-mgmt-loadtesting/dev_requirements.txt similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/dev_requirements.txt rename to sdk/loadtesting/azure-mgmt-loadtesting/dev_requirements.txt diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_delete.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_delete.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_delete.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_delete.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_get.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_get.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_get.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_get.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_resource_group.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_resource_group.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_resource_group.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_resource_group.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_subscription.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_subscription.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_subscription.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_list_by_subscription.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_list_outbound_network_dependencies_endpoints.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_list_outbound_network_dependencies_endpoints.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/load_tests_list_outbound_network_dependencies_endpoints.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/load_tests_list_outbound_network_dependencies_endpoints.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/operations_list.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/operations_list.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/operations_list.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/operations_list.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/quotas_get.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/quotas_get.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/quotas_get.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/quotas_get.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/quotas_list.py b/sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/quotas_list.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/generated_samples/quotas_list.py rename to sdk/loadtesting/azure-mgmt-loadtesting/generated_samples/quotas_list.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/sdk_packaging.toml b/sdk/loadtesting/azure-mgmt-loadtesting/sdk_packaging.toml similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/sdk_packaging.toml rename to sdk/loadtesting/azure-mgmt-loadtesting/sdk_packaging.toml diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/setup.py b/sdk/loadtesting/azure-mgmt-loadtesting/setup.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/setup.py rename to sdk/loadtesting/azure-mgmt-loadtesting/setup.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/conftest.py b/sdk/loadtesting/azure-mgmt-loadtesting/tests/conftest.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/conftest.py rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/conftest.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/mgmt_test_helper.py b/sdk/loadtesting/azure-mgmt-loadtesting/tests/mgmt_test_helper.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/mgmt_test_helper.py rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/mgmt_test_helper.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_check_quota_availability.json b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_check_quota_availability.json similarity index 88% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_check_quota_availability.json rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_check_quota_availability.json index a8895886896d..a9586a8d15fa 100644 --- a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_check_quota_availability.json +++ b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_check_quota_availability.json @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:47 GMT", + "Date": "Thu, 16 Feb 2023 04:36:13 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:47 GMT", + "Date": "Thu, 16 Feb 2023 04:36:13 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,7 +172,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "bcdbe128-ce37-4681-aff2-e672c7e78aeb", + "client-request-id": "2be6d41a-442b-4d08-85bf-b77c05bcb353", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", @@ -190,10 +190,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "bcdbe128-ce37-4681-aff2-e672c7e78aeb", + "client-request-id": "2be6d41a-442b-4d08-85bf-b77c05bcb353", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:47 GMT", + "Date": "Thu, 16 Feb 2023 04:36:13 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -219,7 +219,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -227,18 +227,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:47 GMT", + "Date": "Thu, 16 Feb 2023 04:36:14 GMT", "Expires": "-1", - "mise-correlation-id": "5fe94d54-5002-486c-8151-c6f0215d9416", + "mise-correlation-id": "927287f2-6432-48a5-bb56-210933d911dc", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "663d6226-8977-4f69-9d9c-ce8d68111cf6", + "x-ms-correlation-request-id": "d5dda1e4-c3f5-4524-ba6e-2506bededa04", "x-ms-providerhub-traffic": "True", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163848Z:663d6226-8977-4f69-9d9c-ce8d68111cf6" + "x-ms-ratelimit-remaining-subscription-reads": "11961", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043614Z:d5dda1e4-c3f5-4524-ba6e-2506bededa04" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/westus2/quotas/maxEngineInstancesPerTestRun", @@ -259,7 +259,7 @@ "Connection": "keep-alive", "Content-Length": "32", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "properties": { @@ -271,18 +271,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:48 GMT", + "Date": "Thu, 16 Feb 2023 04:36:15 GMT", "Expires": "-1", - "mise-correlation-id": "5698bfc1-aad7-494f-ac2c-fe107acae0e1", + "mise-correlation-id": "b00ff8bc-47ef-405a-b6d7-fb2ce76f5a88", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f12fdd8b-70a4-4971-9d59-2a7904d4c632", + "x-ms-correlation-request-id": "4cddeaaf-860e-4898-a496-16cf73e76192", "x-ms-providerhub-traffic": "True", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163848Z:f12fdd8b-70a4-4971-9d59-2a7904d4c632" + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043615Z:4cddeaaf-860e-4898-a496-16cf73e76192" }, "ResponseBody": { "properties": { diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_get_quota.json b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_get_quota.json similarity index 88% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_get_quota.json rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_get_quota.json index 2677c14d0f80..e65e82d44774 100644 --- a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_get_quota.json +++ b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_get_quota.json @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:46 GMT", + "Date": "Thu, 16 Feb 2023 04:36:12 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -110,13 +110,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "945", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-p61qbrSN8pj8-GTU3fDSEQ\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:46 GMT", + "Date": "Thu, 16 Feb 2023 04:36:12 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,7 +173,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "83bb7387-0113-48a2-af76-2d18cce31863", + "client-request-id": "c5649197-62eb-440d-8d6c-1061b9c3a919", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", @@ -190,10 +191,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "83bb7387-0113-48a2-af76-2d18cce31863", + "client-request-id": "c5649197-62eb-440d-8d6c-1061b9c3a919", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:46 GMT", + "Date": "Thu, 16 Feb 2023 04:36:12 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +202,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -219,7 +220,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -227,18 +228,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:46 GMT", + "Date": "Thu, 16 Feb 2023 04:36:13 GMT", "Expires": "-1", - "mise-correlation-id": "c2ff568c-93a5-4da4-9406-c0fa5ea33162", + "mise-correlation-id": "52ea4878-971b-4d28-8c30-ff731f166bb6", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8f3a4b67-77dd-4a44-95bc-c0ca0f86c6f4", + "x-ms-correlation-request-id": "c5778e94-87a6-4554-8693-c59c111b43fc", "x-ms-providerhub-traffic": "True", - "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163847Z:8f3a4b67-77dd-4a44-95bc-c0ca0f86c6f4" + "x-ms-ratelimit-remaining-subscription-reads": "11962", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043613Z:c5778e94-87a6-4554-8693-c59c111b43fc" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/westus2/quotas/maxEngineInstancesPerTestRun", diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_list_quota.json b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_list_quota.json similarity index 89% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_list_quota.json rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_list_quota.json index 815ddc05b705..ac3cf4e5a9b0 100644 --- a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_list_quota.json +++ b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_quotaoperations.pyTestQuotaOperationstest_list_quota.json @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:44 GMT", + "Date": "Thu, 16 Feb 2023 04:36:08 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -110,13 +110,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "945", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-RdK6XWBLI2EKIt7qvcOHvA\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:44 GMT", + "Date": "Thu, 16 Feb 2023 04:36:09 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,7 +173,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "33b97f02-955a-4cf1-9c20-08e186176526", + "client-request-id": "e389039f-d777-49dd-84ae-8f68df9ff62a", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", @@ -190,10 +191,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "33b97f02-955a-4cf1-9c20-08e186176526", + "client-request-id": "e389039f-d777-49dd-84ae-8f68df9ff62a", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:44 GMT", + "Date": "Thu, 16 Feb 2023 04:36:09 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +202,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -219,7 +220,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -227,18 +228,18 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:45 GMT", + "Date": "Thu, 16 Feb 2023 04:36:11 GMT", "Expires": "-1", - "mise-correlation-id": "ae812e43-9234-4acd-bd69-480c49bca4d8", + "mise-correlation-id": "3ea4100a-4f30-4f45-b834-4f62bf945012", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c9ef8ed2-7d2e-41ec-ab5f-1129b8714685", + "x-ms-correlation-request-id": "72b5aa46-6e93-4eef-be04-2c0fedae4fbc", "x-ms-providerhub-traffic": "True", - "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163846Z:c9ef8ed2-7d2e-41ec-ab5f-1129b8714685" + "x-ms-ratelimit-remaining-subscription-reads": "11963", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043612Z:72b5aa46-6e93-4eef-be04-2c0fedae4fbc" }, "ResponseBody": { "value": [ diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_resourceoperations.pyTestResourceOperationstest_load_test_resource_operations.json b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_resourceoperations.pyTestResourceOperationstest_load_test_resource_operations.json similarity index 69% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_resourceoperations.pyTestResourceOperationstest_load_test_resource_operations.json rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_resourceoperations.pyTestResourceOperationstest_load_test_resource_operations.json index b2d9f14b321a..7290877b039f 100644 --- a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/recordings/test_resourceoperations.pyTestResourceOperationstest_load_test_resource_operations.json +++ b/sdk/loadtesting/azure-mgmt-loadtesting/tests/recordings/test_resourceoperations.pyTestResourceOperationstest_load_test_resource_operations.json @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:53 GMT", + "Date": "Thu, 16 Feb 2023 04:36:19 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:53 GMT", + "Date": "Thu, 16 Feb 2023 04:36:19 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,7 +172,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "746ba13a-65fc-418c-a27a-f94c3ffffc9e", + "client-request-id": "e42afd94-98a0-4455-b947-1f60718c4f27", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", @@ -190,10 +190,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "746ba13a-65fc-418c-a27a-f94c3ffffc9e", + "client-request-id": "e42afd94-98a0-4455-b947-1f60718c4f27", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:38:54 GMT", + "Date": "Thu, 16 Feb 2023 04:36:19 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -213,7 +213,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1?api-version=2018-11-30", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1?api-version=2023-01-31", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/7.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2" @@ -229,33 +229,33 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "448", + "Content-Length": "457", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:04 GMT", + "Date": "Thu, 16 Feb 2023 04:36:30 GMT", "Expires": "-1", - "Location": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1", + "Location": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fe8f4006-ffb4-4d8c-8fa5-047a33c024ee", + "x-ms-correlation-request-id": "56562acf-68ee-42a6-b5a5-4d5f67258f0f", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163904Z:fe8f4006-ffb4-4d8c-8fa5-047a33c024ee" + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043630Z:56562acf-68ee-42a6-b5a5-4d5f67258f0f" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1", - "name": "pysdkde2c3882mi1", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1", + "name": "altpysdkde2c3882mi1", "type": "Microsoft.ManagedIdentity/userAssignedIdentities", "location": "westus2", "tags": {}, "properties": { "tenantId": "00000000-0000-0000-0000-000000000000", - "principalId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", - "clientId": "041a6c95-3dd0-4b59-bf7a-a4f9fdd45f36" + "principalId": "749730e7-3a62-4235-bc48-c85c30e17acc", + "clientId": "58fee43f-dc32-4ec5-895f-03a30b8a9528" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi2?api-version=2018-11-30", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi2?api-version=2023-01-31", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -263,7 +263,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/7.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2" @@ -271,28 +271,28 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "448", + "Content-Length": "457", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:08 GMT", + "Date": "Thu, 16 Feb 2023 04:36:34 GMT", "Expires": "-1", - "Location": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi2", + "Location": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi2", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "53c0b228-5a35-4d81-9bbd-a28c5933027e", + "x-ms-correlation-request-id": "c162d3e0-d90f-4c28-9488-df650025a34d", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163908Z:53c0b228-5a35-4d81-9bbd-a28c5933027e" + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043635Z:c162d3e0-d90f-4c28-9488-df650025a34d" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi2", - "name": "pysdkde2c3882mi2", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi2", + "name": "altpysdkde2c3882mi2", "type": "Microsoft.ManagedIdentity/userAssignedIdentities", "location": "westus2", "tags": {}, "properties": { "tenantId": "00000000-0000-0000-0000-000000000000", - "principalId": "947c9e21-ffa4-44f3-b5f3-cd9e675849fc", - "clientId": "3c137bf9-676b-4898-9bb2-e3d02d534e1c" + "principalId": "9b960ccd-e32e-4c37-8e0c-df69a4285cb2", + "clientId": "0dc3f694-1a27-4a20-96c8-8b3c21ff5a4d" } } }, @@ -313,12 +313,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:08 GMT", + "Date": "Thu, 16 Feb 2023 04:36:34 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -407,12 +407,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:08 GMT", + "Date": "Thu, 16 Feb 2023 04:36:34 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -468,7 +468,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "6737b1c5-e366-4475-aff1-d3ebd58e686f", + "client-request-id": "3b5c4f10-9e4b-4a0f-98ff-3ae763fb0431", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", @@ -486,10 +486,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "6737b1c5-e366-4475-aff1-d3ebd58e686f", + "client-request-id": "3b5c4f10-9e4b-4a0f-98ff-3ae763fb0431", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:08 GMT", + "Date": "Thu, 16 Feb 2023 04:36:34 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -497,7 +497,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -509,7 +509,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.KeyVault/vaults/pysdkde2c3882akv?api-version=2022-07-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.KeyVault/vaults/altpysdkde2c3882akv?api-version=2022-07-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -542,7 +542,7 @@ }, { "tenantId": "00000000-0000-0000-0000-000000000000", - "objectId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", + "objectId": "749730e7-3a62-4235-bc48-c85c30e17acc", "permissions": { "keys": [ "all" @@ -562,7 +562,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:14 GMT", + "Date": "Thu, 16 Feb 2023 04:36:42 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -571,24 +571,24 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "00454eb9-245d-4477-b7c3-f4484aebece0", - "x-ms-keyvault-service-version": "1.5.606.0", + "x-ms-correlation-request-id": "cbc0e856-771a-4041-827f-a049b9f6f31a", + "x-ms-keyvault-service-version": "1.5.666.2", "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163915Z:00454eb9-245d-4477-b7c3-f4484aebece0" + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043643Z:cbc0e856-771a-4041-827f-a049b9f6f31a" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.KeyVault/vaults/pysdkde2c3882akv", - "name": "pysdkde2c3882akv", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.KeyVault/vaults/altpysdkde2c3882akv", + "name": "altpysdkde2c3882akv", "type": "Microsoft.KeyVault/vaults", "location": "westus2", "tags": {}, "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2023-01-08T16:39:11.983Z", + "createdAt": "2023-02-16T04:36:39.757Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2023-01-08T16:39:11.983Z" + "lastModifiedAt": "2023-02-16T04:36:39.757Z" }, "properties": { "sku": { @@ -611,7 +611,7 @@ }, { "tenantId": "00000000-0000-0000-0000-000000000000", - "objectId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", + "objectId": "749730e7-3a62-4235-bc48-c85c30e17acc", "permissions": { "keys": [ "all" @@ -624,14 +624,14 @@ "enabledForTemplateDeployment": true, "enableSoftDelete": true, "enablePurgeProtection": true, - "vaultUri": "https://pysdkde2c3882akv.vault.azure.net", + "vaultUri": "https://altpysdkde2c3882akv.vault.azure.net", "provisioningState": "RegisteringDns", "publicNetworkAccess": "Enabled" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.KeyVault/vaults/pysdkde2c3882akv?api-version=2022-07-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.KeyVault/vaults/altpysdkde2c3882akv?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -645,7 +645,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:15 GMT", + "Date": "Thu, 16 Feb 2023 04:36:42 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -654,24 +654,24 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "256f5e66-ddfd-4b1f-a6f9-12b473a40901", - "x-ms-keyvault-service-version": "1.5.606.0", - "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163915Z:256f5e66-ddfd-4b1f-a6f9-12b473a40901" + "x-ms-correlation-request-id": "68e6cdea-24b9-485d-a90f-227a9449b6aa", + "x-ms-keyvault-service-version": "1.5.666.2", + "x-ms-ratelimit-remaining-subscription-reads": "11960", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043643Z:68e6cdea-24b9-485d-a90f-227a9449b6aa" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.KeyVault/vaults/pysdkde2c3882akv", - "name": "pysdkde2c3882akv", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.KeyVault/vaults/altpysdkde2c3882akv", + "name": "altpysdkde2c3882akv", "type": "Microsoft.KeyVault/vaults", "location": "westus2", "tags": {}, "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2023-01-08T16:39:11.983Z", + "createdAt": "2023-02-16T04:36:39.757Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2023-01-08T16:39:11.983Z" + "lastModifiedAt": "2023-02-16T04:36:39.757Z" }, "properties": { "sku": { @@ -694,7 +694,7 @@ }, { "tenantId": "00000000-0000-0000-0000-000000000000", - "objectId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", + "objectId": "749730e7-3a62-4235-bc48-c85c30e17acc", "permissions": { "keys": [ "all" @@ -707,14 +707,14 @@ "enabledForTemplateDeployment": true, "enableSoftDelete": true, "enablePurgeProtection": true, - "vaultUri": "https://pysdkde2c3882akv.vault.azure.net/", + "vaultUri": "https://altpysdkde2c3882akv.vault.azure.net/", "provisioningState": "RegisteringDns", "publicNetworkAccess": "Enabled" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.KeyVault/vaults/pysdkde2c3882akv?api-version=2022-07-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.KeyVault/vaults/altpysdkde2c3882akv?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -728,7 +728,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:45 GMT", + "Date": "Thu, 16 Feb 2023 04:37:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -737,24 +737,24 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "190b7a54-3021-4b40-b529-04f20d91ccdf", - "x-ms-keyvault-service-version": "1.5.606.0", - "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163945Z:190b7a54-3021-4b40-b529-04f20d91ccdf" + "x-ms-correlation-request-id": "1e2f1ba4-398a-4b18-ac31-1c2e3474dff9", + "x-ms-keyvault-service-version": "1.5.666.2", + "x-ms-ratelimit-remaining-subscription-reads": "11959", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043714Z:1e2f1ba4-398a-4b18-ac31-1c2e3474dff9" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.KeyVault/vaults/pysdkde2c3882akv", - "name": "pysdkde2c3882akv", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.KeyVault/vaults/altpysdkde2c3882akv", + "name": "altpysdkde2c3882akv", "type": "Microsoft.KeyVault/vaults", "location": "westus2", "tags": {}, "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2023-01-08T16:39:11.983Z", + "createdAt": "2023-02-16T04:36:39.757Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2023-01-08T16:39:11.983Z" + "lastModifiedAt": "2023-02-16T04:36:39.757Z" }, "properties": { "sku": { @@ -777,7 +777,7 @@ }, { "tenantId": "00000000-0000-0000-0000-000000000000", - "objectId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", + "objectId": "749730e7-3a62-4235-bc48-c85c30e17acc", "permissions": { "keys": [ "all" @@ -790,14 +790,14 @@ "enabledForTemplateDeployment": true, "enableSoftDelete": true, "enablePurgeProtection": true, - "vaultUri": "https://pysdkde2c3882akv.vault.azure.net/", + "vaultUri": "https://altpysdkde2c3882akv.vault.azure.net/", "provisioningState": "Succeeded", "publicNetworkAccess": "Enabled" } } }, { - "RequestUri": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/create?api-version=7.4-preview.1", + "RequestUri": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/create?api-version=7.4-preview.1", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -813,15 +813,15 @@ "Cache-Control": "no-cache", "Content-Length": "97", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:48 GMT", + "Date": "Thu, 16 Feb 2023 04:37:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000;includeSubDomains", "WWW-Authenticate": "Bearer authorization=\u0022https://login.windows.net/00000000-0000-0000-0000-000000000000\u0022, resource=\u0022https://vault.azure.net\u0022", "X-Content-Type-Options": "nosniff", - "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=183.82.205.92;act_addr_fam=InterNetwork;", + "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=167.220.238.147;act_addr_fam=InterNetwork;", "x-ms-keyvault-region": "westus2", - "x-ms-keyvault-service-version": "1.9.576.1" + "x-ms-keyvault-service-version": "1.9.713.1" }, "ResponseBody": { "error": { @@ -846,13 +846,14 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "1753", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-000VfzQSy53KmeXaglV7Fg\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027 \u0027report-sample\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:48 GMT", + "Date": "Thu, 16 Feb 2023 04:37:15 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.11 - KRSLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -941,12 +942,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:48 GMT", + "Date": "Thu, 16 Feb 2023 04:37:15 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -1002,7 +1003,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "80a59594-0c47-4611-a6c6-23ec25108f80", + "client-request-id": "2802c754-b4ec-42d4-912c-c3b21efa3f8b", "Connection": "keep-alive", "Content-Length": "283", "Content-Type": "application/x-www-form-urlencoded", @@ -1020,10 +1021,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "80a59594-0c47-4611-a6c6-23ec25108f80", + "client-request-id": "2802c754-b4ec-42d4-912c-c3b21efa3f8b", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:48 GMT", + "Date": "Thu, 16 Feb 2023 04:37:15 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -1031,7 +1032,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -1043,7 +1044,7 @@ } }, { - "RequestUri": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/create?api-version=7.4-preview.1", + "RequestUri": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/create?api-version=7.4-preview.1", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -1059,20 +1060,20 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "697", + "Content-Length": "703", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:49 GMT", + "Date": "Thu, 16 Feb 2023 04:37:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000;includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=183.82.205.92;act_addr_fam=InterNetwork;", + "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=167.220.238.147;act_addr_fam=InterNetwork;", "x-ms-keyvault-region": "westus2", - "x-ms-keyvault-service-version": "1.9.576.1" + "x-ms-keyvault-service-version": "1.9.713.1" }, "ResponseBody": { "key": { - "kid": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/431735934a1d4d0cb8858eccc1d07880", + "kid": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/f7632dbda50644dfbfc5bbb54d2f9ccb", "kty": "RSA", "key_ops": [ "encrypt", @@ -1082,13 +1083,13 @@ "wrapKey", "unwrapKey" ], - "n": "to5KmI6cg4r4hLhXL7Nzg9ycqGql9ZCySrZbUIcf8yKtotrx0vBzuJuTAja59Eg_h3EmBg2uEleNihyIeakrYTOHgWkHqxKZnZ2OJcXOXY_jeNadk_eMrQfO8wnkthIk33uT-xrhdosSCrvOysVSOAILneajWqen2_tvGcvqFXcBKRfVM2P7rJeUYsNkzn1VQbyZLosogzVi_vrm3MOCNNe71s4eJUM4lmBvDe71T4P-kf8l_eMDc20Rtak1c-gHgCR6q_lwF3ibhTsjlrJzFIZkheOEk_joveCQEggjrOkMFq67ggseUvUTvQmrC_1jQFoyrTv2swy_tJXpLJGNmQ", + "n": "wAaWaB0J8yPYqx9kKZLuA7zWGZje9AyPP-bXSbvukg2b87DeUhsThAohhke5WT4Ypj5e7uX7gOjZ-4UMNGsv4mE1oMpgBzcR9607n5GrWUhxVhqhVEEFXqjKtXj2KRhc3XmlfgD1LmDKUngrCwEy2cmQg5lDIO9skiP86b3ao9uvVYAg5AYabnhxwbPh6oSh_ESFxrQ-RDNToilag2hpD_3zETccCqOdY57T4SEa5CHyTEMM8AJI990hIedQuq-Y6J_SdU_NqulqvOUOyBQRg4B7QRhiq-dUQvqGuxCqPEGG5pZNngiKlUAHjEq3_j10UySnFpYh0XxvDDNpp4d-RQ", "e": "AQAB" }, "attributes": { "enabled": true, - "created": 1673195989, - "updated": 1673195989, + "created": 1676522235, + "updated": 1676522235, "recoveryLevel": "Recoverable", "recoverableDays": 90, "exportable": false @@ -1112,12 +1113,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:49 GMT", + "Date": "Thu, 16 Feb 2023 04:37:15 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -1206,12 +1207,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:49 GMT", + "Date": "Thu, 16 Feb 2023 04:37:16 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14357.7 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SEASLR1 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -1267,7 +1268,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "b726bce0-481e-4556-89c5-0bcf96fe34c4", + "client-request-id": "0b638a4b-9e0d-480b-8863-9ab4477ec853", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", @@ -1285,10 +1286,10 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "b726bce0-481e-4556-89c5-0bcf96fe34c4", + "client-request-id": "0b638a4b-9e0d-480b-8863-9ab4477ec853", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:49 GMT", + "Date": "Thu, 16 Feb 2023 04:37:16 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -1296,7 +1297,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14357.7 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - KRC ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -1308,89 +1309,89 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource?api-version=2022-12-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "785", + "Content-Length": "809", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "location": "westus2", "identity": { "type": "SystemAssigned,UserAssigned", "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1": {}, - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi2": {} + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1": {}, + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi2": {} } }, "properties": { "encryption": { "identity": { "type": "UserAssigned", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1" + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1" }, - "keyUrl": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/431735934a1d4d0cb8858eccc1d07880" + "keyUrl": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/f7632dbda50644dfbfc5bbb54d2f9ccb" } } }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/0c65d7a2-567c-470f-815b-c6164c8ae1c1*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/ca65b442-62d3-4482-a00b-c3a9f3c96258*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", "Cache-Control": "no-cache", - "Content-Length": "1728", + "Content-Length": "1761", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:59 GMT", - "ETag": "\u002231014425-0000-0800-0000-63baf1de0000\u0022", + "Date": "Thu, 16 Feb 2023 04:37:27 GMT", + "ETag": "\u00221201e901-0000-0800-0000-63edb3060000\u0022", "Expires": "-1", - "mise-correlation-id": "a67b6997-ffd3-412f-9529-69e10e77bb7f", + "mise-correlation-id": "2e34f1a1-cec3-464e-8f1f-c09929e6a12f", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bcd343c4-65c3-4818-b9ec-7440261e54ec", + "x-ms-correlation-request-id": "ba986337-c0c1-4723-934e-9e9f4da67abc", "x-ms-providerhub-traffic": "True", "x-ms-ratelimit-remaining-subscription-writes": "1196", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163959Z:bcd343c4-65c3-4818-b9ec-7440261e54ec" + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043728Z:ba986337-c0c1-4723-934e-9e9f4da67abc" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", - "name": "pysdkde2c3882resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource", + "name": "altpysdkde2c3882resource", "type": "microsoft.loadtestservice/loadtests", "location": "westus2", "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2023-01-08T16:39:52.5626344Z", + "createdAt": "2023-02-16T04:37:19.1165266Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2023-01-08T16:39:52.5626344Z" + "lastModifiedAt": "2023-02-16T04:37:19.1165266Z" }, "identity": { - "principalId": "86d4f3f2-4b86-493b-92c7-46d3e66d01fc", + "principalId": "c8475be5-abe5-4444-a46f-df52e9d3a038", "tenantId": "00000000-0000-0000-0000-000000000000", "type": "SystemAssigned, UserAssigned", "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/pysdkde2c3882mi1": { - "principalId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", - "clientId": "041a6c95-3dd0-4b59-bf7a-a4f9fdd45f36" + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/altpysdkde2c3882mi1": { + "principalId": "749730e7-3a62-4235-bc48-c85c30e17acc", + "clientId": "58fee43f-dc32-4ec5-895f-03a30b8a9528" }, - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/pysdkde2c3882mi2": { - "principalId": "947c9e21-ffa4-44f3-b5f3-cd9e675849fc", - "clientId": "3c137bf9-676b-4898-9bb2-e3d02d534e1c" + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/altpysdkde2c3882mi2": { + "principalId": "9b960ccd-e32e-4c37-8e0c-df69a4285cb2", + "clientId": "0dc3f694-1a27-4a20-96c8-8b3c21ff5a4d" } } }, "properties": { "description": null, - "dataPlaneURI": "128af252-af21-47de-9e46-b53e43e4b46a.westus2.cnt-prod.loadtesting.azure.com", + "dataPlaneURI": "dbb6738f-0112-4f9e-8273-3ca53c5bc0fc.westus2.cnt-prod.loadtesting.azure.com", "encryption": { - "keyUrl": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/431735934a1d4d0cb8858eccc1d07880", + "keyUrl": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/f7632dbda50644dfbfc5bbb54d2f9ccb", "identity": { "type": "UserAssigned", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1" + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1" } }, "provisioningState": "Accepted" @@ -1398,13 +1399,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/0c65d7a2-567c-470f-815b-c6164c8ae1c1*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/ca65b442-62d3-4482-a00b-c3a9f3c96258*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1412,36 +1413,36 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:39:59 GMT", - "ETag": "\u0022b00404f1-0000-0800-0000-63baf1df0000\u0022", + "Date": "Thu, 16 Feb 2023 04:37:27 GMT", + "ETag": "\u00228100e117-0000-0800-0000-63edb3080000\u0022", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b1f9402d-7555-439d-88ab-7a44d47bd48d", - "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T163959Z:b1f9402d-7555-439d-88ab-7a44d47bd48d" + "x-ms-correlation-request-id": "09e3585b-336c-4fe1-8c3a-bc58605ea2e1", + "x-ms-ratelimit-remaining-subscription-reads": "11958", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043728Z:09e3585b-336c-4fe1-8c3a-bc58605ea2e1" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/0c65d7a2-567c-470f-815b-c6164c8ae1c1*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "name": "0c65d7a2-567c-470f-815b-c6164c8ae1c1*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/ca65b442-62d3-4482-a00b-c3a9f3c96258*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E", + "name": "ca65b442-62d3-4482-a00b-c3a9f3c96258*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource", "status": "Succeeded", - "startTime": "2023-01-08T16:39:54.3496468Z", - "endTime": "2023-01-08T16:39:59.3888085Z", + "startTime": "2023-02-16T04:37:21.9685369Z", + "endTime": "2023-02-16T04:37:28.0387523Z", "properties": null } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource?api-version=2022-12-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1449,55 +1450,55 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:00 GMT", - "ETag": "\u002231014525-0000-0800-0000-63baf1df0000\u0022", + "Date": "Thu, 16 Feb 2023 04:37:27 GMT", + "ETag": "\u00221201f701-0000-0800-0000-63edb3080000\u0022", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "96fd7bdf-b40e-4863-a347-9bbd9048271b", + "x-ms-correlation-request-id": "2e231e93-a543-4ad0-9fa8-2234fa0ce4c0", "x-ms-providerhub-traffic": "True", - "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164000Z:96fd7bdf-b40e-4863-a347-9bbd9048271b" + "x-ms-ratelimit-remaining-subscription-reads": "11957", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043728Z:2e231e93-a543-4ad0-9fa8-2234fa0ce4c0" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", - "name": "pysdkde2c3882resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource", + "name": "altpysdkde2c3882resource", "type": "microsoft.loadtestservice/loadtests", "location": "westus2", "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2023-01-08T16:39:52.5626344Z", + "createdAt": "2023-02-16T04:37:19.1165266Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2023-01-08T16:39:52.5626344Z" + "lastModifiedAt": "2023-02-16T04:37:19.1165266Z" }, "identity": { - "principalId": "86d4f3f2-4b86-493b-92c7-46d3e66d01fc", + "principalId": "c8475be5-abe5-4444-a46f-df52e9d3a038", "tenantId": "00000000-0000-0000-0000-000000000000", "type": "SystemAssigned, UserAssigned", "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/pysdkde2c3882mi1": { - "principalId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", - "clientId": "041a6c95-3dd0-4b59-bf7a-a4f9fdd45f36" + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/altpysdkde2c3882mi1": { + "principalId": "749730e7-3a62-4235-bc48-c85c30e17acc", + "clientId": "58fee43f-dc32-4ec5-895f-03a30b8a9528" }, - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/pysdkde2c3882mi2": { - "principalId": "947c9e21-ffa4-44f3-b5f3-cd9e675849fc", - "clientId": "3c137bf9-676b-4898-9bb2-e3d02d534e1c" + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/altpysdkde2c3882mi2": { + "principalId": "9b960ccd-e32e-4c37-8e0c-df69a4285cb2", + "clientId": "0dc3f694-1a27-4a20-96c8-8b3c21ff5a4d" } } }, "properties": { "description": null, - "dataPlaneURI": "128af252-af21-47de-9e46-b53e43e4b46a.westus2.cnt-prod.loadtesting.azure.com", + "dataPlaneURI": "dbb6738f-0112-4f9e-8273-3ca53c5bc0fc.westus2.cnt-prod.loadtesting.azure.com", "encryption": { - "keyUrl": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/431735934a1d4d0cb8858eccc1d07880", + "keyUrl": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/f7632dbda50644dfbfc5bbb54d2f9ccb", "identity": { "type": "UserAssigned", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1" + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1" } }, "provisioningState": "Succeeded" @@ -1505,13 +1506,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource?api-version=2022-12-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1519,55 +1520,55 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:00 GMT", - "ETag": "\u002231014525-0000-0800-0000-63baf1df0000\u0022", + "Date": "Thu, 16 Feb 2023 04:37:28 GMT", + "ETag": "\u00221201f701-0000-0800-0000-63edb3080000\u0022", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "11d24632-6f79-433a-b39f-825d7adbfae4", + "x-ms-correlation-request-id": "8ada087e-17c5-4c6d-8d96-e0c57bcbdf49", "x-ms-providerhub-traffic": "True", - "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164000Z:11d24632-6f79-433a-b39f-825d7adbfae4" + "x-ms-ratelimit-remaining-subscription-reads": "11956", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043729Z:8ada087e-17c5-4c6d-8d96-e0c57bcbdf49" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", - "name": "pysdkde2c3882resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource", + "name": "altpysdkde2c3882resource", "type": "microsoft.loadtestservice/loadtests", "location": "westus2", "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2023-01-08T16:39:52.5626344Z", + "createdAt": "2023-02-16T04:37:19.1165266Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2023-01-08T16:39:52.5626344Z" + "lastModifiedAt": "2023-02-16T04:37:19.1165266Z" }, "identity": { - "principalId": "86d4f3f2-4b86-493b-92c7-46d3e66d01fc", + "principalId": "c8475be5-abe5-4444-a46f-df52e9d3a038", "tenantId": "00000000-0000-0000-0000-000000000000", "type": "SystemAssigned, UserAssigned", "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/pysdkde2c3882mi1": { - "principalId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", - "clientId": "041a6c95-3dd0-4b59-bf7a-a4f9fdd45f36" + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/altpysdkde2c3882mi1": { + "principalId": "749730e7-3a62-4235-bc48-c85c30e17acc", + "clientId": "58fee43f-dc32-4ec5-895f-03a30b8a9528" }, - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/pysdkde2c3882mi2": { - "principalId": "947c9e21-ffa4-44f3-b5f3-cd9e675849fc", - "clientId": "3c137bf9-676b-4898-9bb2-e3d02d534e1c" + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/altpysdkde2c3882mi2": { + "principalId": "9b960ccd-e32e-4c37-8e0c-df69a4285cb2", + "clientId": "0dc3f694-1a27-4a20-96c8-8b3c21ff5a4d" } } }, "properties": { "description": null, - "dataPlaneURI": "128af252-af21-47de-9e46-b53e43e4b46a.westus2.cnt-prod.loadtesting.azure.com", + "dataPlaneURI": "dbb6738f-0112-4f9e-8273-3ca53c5bc0fc.westus2.cnt-prod.loadtesting.azure.com", "encryption": { - "keyUrl": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/431735934a1d4d0cb8858eccc1d07880", + "keyUrl": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/f7632dbda50644dfbfc5bbb54d2f9ccb", "identity": { "type": "UserAssigned", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1" + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1" } }, "provisioningState": "Succeeded" @@ -1575,53 +1576,53 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource?api-version=2022-12-01", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "247", + "Content-Length": "253", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "identity": { "type": "SystemAssigned,UserAssigned", "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi2": null + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi2": null } } }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", "Cache-Control": "no-cache", "Content-Length": "4", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:02 GMT", - "ETag": "\u002231014625-0000-0800-0000-63baf1e20000\u0022", + "Date": "Thu, 16 Feb 2023 04:37:29 GMT", + "ETag": "\u002212011c02-0000-0800-0000-63edb30a0000\u0022", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", - "mise-correlation-id": "e94a7936-09f6-4f46-a824-b2aae1952e3b", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", + "mise-correlation-id": "6a1da323-ccbb-47cc-a4e0-6380d68639ba", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b32e17cb-f5f4-46dd-9deb-4ddb589deff2", + "x-ms-correlation-request-id": "4a9a936c-cc7e-4a3d-9f7b-6a5107bcc44f", "x-ms-providerhub-traffic": "True", "x-ms-ratelimit-remaining-subscription-writes": "1195", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164002Z:b32e17cb-f5f4-46dd-9deb-4ddb589deff2" + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043730Z:4a9a936c-cc7e-4a3d-9f7b-6a5107bcc44f" }, "ResponseBody": "null" }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1629,34 +1630,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:02 GMT", - "ETag": "\u0022b00456f1-0000-0800-0000-63baf1e20000\u0022", + "Date": "Thu, 16 Feb 2023 04:37:29 GMT", + "ETag": "\u002281007f18-0000-0800-0000-63edb30a0000\u0022", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a3cc7abd-0de8-4717-a937-d4851d77ef4d", - "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164002Z:a3cc7abd-0de8-4717-a937-d4851d77ef4d" + "x-ms-correlation-request-id": "d0838a8b-bab0-4e4a-9755-b1a51b729a2a", + "x-ms-ratelimit-remaining-subscription-reads": "11955", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043730Z:d0838a8b-bab0-4e4a-9755-b1a51b729a2a" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "name": "79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E", + "name": "da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource", "status": "Accepted", - "startTime": "2023-01-08T16:40:02.3134373Z" + "startTime": "2023-02-16T04:37:30.3550049Z" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1664,36 +1665,36 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:32 GMT", - "ETag": "\u0022b004a2f1-0000-0800-0000-63baf1e40000\u0022", + "Date": "Thu, 16 Feb 2023 04:38:00 GMT", + "ETag": "\u00228100bb18-0000-0800-0000-63edb30b0000\u0022", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f746c87e-b12b-4420-9bee-2f2312380051", - "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164032Z:f746c87e-b12b-4420-9bee-2f2312380051" + "x-ms-correlation-request-id": "d2a898c8-bd12-493e-ba50-5f4f87c7918f", + "x-ms-ratelimit-remaining-subscription-reads": "11954", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043801Z:d2a898c8-bd12-493e-ba50-5f4f87c7918f" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "name": "79549cbe-5e89-4441-8e98-311802ecd552*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E", + "name": "da110bd3-bca3-4ed1-8365-791dcd85fec7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource", "status": "Succeeded", - "startTime": "2023-01-08T16:40:02.3134373Z", - "endTime": "2023-01-08T16:40:04.961597Z", + "startTime": "2023-02-16T04:37:30.3550049Z", + "endTime": "2023-02-16T04:37:31.5044789Z", "properties": null } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource?api-version=2022-12-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1701,51 +1702,51 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:32 GMT", - "ETag": "\u002231014725-0000-0800-0000-63baf1e50000\u0022", + "Date": "Thu, 16 Feb 2023 04:38:00 GMT", + "ETag": "\u002212012902-0000-0800-0000-63edb30b0000\u0022", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "dbfc8ae3-ff90-4db9-962e-ba6f4312ae46", + "x-ms-correlation-request-id": "944b5fa8-54dd-4a46-aed8-567382d09d01", "x-ms-providerhub-traffic": "True", - "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164033Z:dbfc8ae3-ff90-4db9-962e-ba6f4312ae46" + "x-ms-ratelimit-remaining-subscription-reads": "11953", + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043801Z:944b5fa8-54dd-4a46-aed8-567382d09d01" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", - "name": "pysdkde2c3882resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource", + "name": "altpysdkde2c3882resource", "type": "microsoft.loadtestservice/loadtests", "location": "westus2", "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2023-01-08T16:39:52.5626344Z", + "createdAt": "2023-02-16T04:37:19.1165266Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2023-01-08T16:40:02.1722892Z" + "lastModifiedAt": "2023-02-16T04:37:30.2103239Z" }, "identity": { - "principalId": "86d4f3f2-4b86-493b-92c7-46d3e66d01fc", + "principalId": "c8475be5-abe5-4444-a46f-df52e9d3a038", "tenantId": "00000000-0000-0000-0000-000000000000", "type": "SystemAssigned, UserAssigned", "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/pysdkde2c3882mi1": { - "principalId": "3d0798f7-b5dd-4726-8fe8-5291d7db9ffa", - "clientId": "041a6c95-3dd0-4b59-bf7a-a4f9fdd45f36" + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/microsoft.managedidentity/userassignedidentities/altpysdkde2c3882mi1": { + "principalId": "749730e7-3a62-4235-bc48-c85c30e17acc", + "clientId": "58fee43f-dc32-4ec5-895f-03a30b8a9528" } } }, "properties": { "description": null, - "dataPlaneURI": "128af252-af21-47de-9e46-b53e43e4b46a.westus2.cnt-prod.loadtesting.azure.com", + "dataPlaneURI": "dbb6738f-0112-4f9e-8273-3ca53c5bc0fc.westus2.cnt-prod.loadtesting.azure.com", "encryption": { - "keyUrl": "https://pysdkde2c3882akv.vault.azure.net/keys/pysdkde2c3882key/431735934a1d4d0cb8858eccc1d07880", + "keyUrl": "https://altpysdkde2c3882akv.vault.azure.net/keys/altpysdkde2c3882key/f7632dbda50644dfbfc5bbb54d2f9ccb", "identity": { "type": "UserAssigned", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/pysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pysdkde2c3882mi1" + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/altpysdkde2c3882/providers/Microsoft.ManagedIdentity/userAssignedIdentities/altpysdkde2c3882mi1" } }, "provisioningState": "Succeeded" @@ -1753,143 +1754,36 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource?api-version=2022-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/altpysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/altpysdkde2c3882resource?api-version=2022-12-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/b079c81b-00d5-4c47-af99-83012a723ae7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", "Cache-Control": "no-cache", "Content-Length": "4", "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:33 GMT", - "ETag": "\u002231014925-0000-0800-0000-63baf2020000\u0022", + "Date": "Thu, 16 Feb 2023 04:38:01 GMT", + "ETag": "\u002212010604-0000-0800-0000-63edb32a0000\u0022", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", - "mise-correlation-id": "a89fa3f8-c586-43b9-9870-13bc23a23a57", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/b079c81b-00d5-4c47-af99-83012a723ae7*5425F08230E6E8909169ED62FDC8181B48D59432E60F7DC35CD686BE90BD5F9E?api-version=2022-12-01", + "mise-correlation-id": "66bdb862-6d53-4ae8-95ef-074dfaba5275", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7406eb24-95ff-4df9-b335-2aef0742f259", + "x-ms-correlation-request-id": "9695621d-776d-4ada-a4c3-e91c8cefe19e", "x-ms-providerhub-traffic": "True", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164034Z:7406eb24-95ff-4df9-b335-2aef0742f259" + "x-ms-routing-request-id": "JIOINDIACENTRAL:20230216T043802Z:9695621d-776d-4ada-a4c3-e91c8cefe19e" }, "ResponseBody": "null" - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" - }, - "RequestBody": null, - "StatusCode": 202, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Length": "572", - "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:40:34 GMT", - "ETag": "\u0022b00454f4-0000-0800-0000-63baf2020000\u0022", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4b72eebc-19f5-4c2f-a675-4d42c78e64b4", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164034Z:4b72eebc-19f5-4c2f-a675-4d42c78e64b4" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "name": "6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", - "status": "Deleting", - "startTime": "2023-01-08T16:40:34.0735513Z" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:41:04 GMT", - "ETag": "\u0022b00462f4-0000-0800-0000-63baf2020000\u0022", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "2c8ab222-d26b-44ae-af3f-53933211f1f3", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164104Z:2c8ab222-d26b-44ae-af3f-53933211f1f3" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "name": "6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", - "status": "Succeeded", - "startTime": "2023-01-08T16:40:34.0735513Z", - "endTime": "2023-01-08T16:40:34.6424372Z", - "properties": null - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF?api-version=2022-12-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-loadtesting/1.0.0b1 Python/3.10.7 (Windows-10-10.0.22621-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Sun, 08 Jan 2023 16:41:04 GMT", - "ETag": "\u0022b00462f4-0000-0800-0000-63baf2020000\u0022", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f6c41720-4a99-40ac-88fe-19b853019e7a", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-routing-request-id": "SOUTHINDIA:20230108T164105Z:f6c41720-4a99-40ac-88fe-19b853019e7a" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/WESTUS2/operationStatuses/6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "name": "6a68527d-d159-44f9-8f84-f8674e2f1d48*07D73C59138101BA7B6996C4540001F720C77634C15AD6739ADA751B8CFCC4EF", - "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdkde2c3882/providers/Microsoft.LoadTestService/loadTests/pysdkde2c3882resource", - "status": "Succeeded", - "startTime": "2023-01-08T16:40:34.0735513Z", - "endTime": "2023-01-08T16:40:34.6424372Z", - "properties": null - } } ], "Variables": {} diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/test_quotaoperations.py b/sdk/loadtesting/azure-mgmt-loadtesting/tests/test_quotaoperations.py similarity index 100% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/test_quotaoperations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/test_quotaoperations.py diff --git a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/test_resourceoperations.py b/sdk/loadtesting/azure-mgmt-loadtesting/tests/test_resourceoperations.py similarity index 99% rename from sdk/loadtestservice/azure-mgmt-loadtesting/tests/test_resourceoperations.py rename to sdk/loadtesting/azure-mgmt-loadtesting/tests/test_resourceoperations.py index 53829aefc0b9..95f7d7e8a364 100644 --- a/sdk/loadtestservice/azure-mgmt-loadtesting/tests/test_resourceoperations.py +++ b/sdk/loadtesting/azure-mgmt-loadtesting/tests/test_resourceoperations.py @@ -48,7 +48,7 @@ def setup_method(self, method): os.environ.get("CLIENT_OID", None) if self.is_live else DEFAULT_SANITIZER ) - @ResourceGroupPreparer(name_prefix="pysdk") + @ResourceGroupPreparer(name_prefix="altpysdk") @recorded_by_proxy def test_load_test_resource_operations(self, resource_group): diff --git a/sdk/loadtestservice/ci.yml b/sdk/loadtesting/ci.yml similarity index 87% rename from sdk/loadtestservice/ci.yml rename to sdk/loadtesting/ci.yml index 5f58ff9ce215..7af5541ce1a6 100644 --- a/sdk/loadtestservice/ci.yml +++ b/sdk/loadtesting/ci.yml @@ -10,7 +10,7 @@ trigger: - restapi* paths: include: - - sdk/loadtestservice/ + - sdk/loadtesting/ pr: branches: @@ -22,12 +22,12 @@ pr: - restapi* paths: include: - - sdk/loadtestservice/ + - sdk/loadtesting/ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: loadtestservice + ServiceDirectory: loadtesting TestProxy: true Artifacts: - name: azure-developer-loadtesting diff --git a/sdk/loadtestservice/azure-developer-loadtesting/README.md b/sdk/loadtestservice/azure-developer-loadtesting/README.md deleted file mode 100644 index 0337c6ac7af2..000000000000 --- a/sdk/loadtestservice/azure-developer-loadtesting/README.md +++ /dev/null @@ -1,226 +0,0 @@ - -# Azure Load Testing client library for Python -Azure Load Testing provides client library in python to the user by which they can interact natively with Azure Load Testing service. Azure Load Testing is a fully managed load-testing service that enables you to generate high-scale load. The service simulates traffic for your applications, regardless of where they're hosted. Developers, testers, and quality assurance (QA) engineers can use it to optimize application performance, scalability, or capacity. - -## Documentation -Various documentation is available to help you get started - - -- [API reference documentation][api_reference_doc] -- [Product Documentation][product_documentation] - -## Getting started - -### Installing the package - -```bash -python -m pip install azure-developer-loadtesting -``` - -#### Prequisites - -- Python 3.7 or later is required to use this package. -- You need an [Azure subscription][azure_sub] to use this package. -- An existing Azure Developer LoadTesting instance. - -#### Create with an Azure Active Directory Credential - -To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], -provide an instance of the desired credential type obtained from the -[azure-identity][azure_identity_credentials] library. - -To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] - -After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. - -As an example, sign in via the Azure CLI `az login` command and [DefaultAzureCredential](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python) will authenticate as that user. - -Use the returned token credential to authenticate the client. - -#### Create the client - -Azure Developer LoadTesting SDK has 2 sub-clients of the main client (`LoadTestingClient`) to interact with the service, 'administration' and 'test_run'. - -```python -from azure.developer.loadtesting import LoadTestingClient - -# for managing authentication and authorization -# can be installed from pypi, follow: https://pypi.org/project/azure-identity/ -# using DefaultAzureCredentials, read more at: https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python -from azure.identity import DefaultAzureCredential - -client = LoadTestingClient(endpoint='', credential=DefaultAzureCredential()) -``` - -`` refers to the data-plane endpoint/URL of the resource. - -## Key concepts - -The following components make up the Azure Load Testing service. The Azure Load Test client library for python allows you to interact with each of these components through the use of clients. There are two top-level clients which are the main entry points for the library - -- `LoadTestingClient.administration` (`azure.developer.loadtesting.LoadTestingClient.administration`) -- `LoadTestingClient.test_run` (`azure.developer.loadtesting.LoadTestingClient.test_run`) - -These two clients also have there asynchronous counterparts, which are -- `LoadTestingClient.administration` (`azure.developer.loadtesting.aio.LoadTestingClient.administration`) -- `LoadTestingClient.test_run` (`azure.developer.loadtesting.aio.LoadTestingClient.test_run`) - -### Load Test Administration Client - -The `LoadTestingClient.administration` is used to administer and configure the load tests, app components and metrics. - -#### Test - -A test specifies the test script, and configuration settings for running a load test. You can create one or more tests in an Azure Load Testing resource. - -#### App Component - -When you run a load test for an Azure-hosted application, you can monitor resource metrics for the different Azure application components (server-side metrics). While the load test runs, and after completion of the test, you can monitor and analyze the resource metrics in the Azure Load Testing dashboard. - -#### Metrics - -During a load test, Azure Load Testing collects metrics about the test execution. There are two types of metrics: - -1. Client-side metrics give you details reported by the test engine. These metrics include the number of virtual users, the request response time, the number of failed requests, or the number of requests per second. - -2. Server-side metrics are available for Azure-hosted applications and provide information about your Azure application components. Metrics can be for the number of database reads, the type of HTTP responses, or container resource consumption. - -### Test Run Client - -The `LoadTestingClient.test_run` is used to start and stop test runs corresponding to a load test. A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter script, the load test YAML configuration, the list of app components to monitor, and the results of the test. - -### Data-Plane Endpoint - -Data-plane of Azure Load Testing resources is addressable using the following URL format: - -`00000000-0000-0000-0000-000000000000.aaa.cnt-prod.loadtesting.azure.com` - -The first GUID `00000000-0000-0000-0000-000000000000` is the unique identifier used for accessing the Azure Load Testing resource. This is followed by `aaa` which is the Azure region of the resource. - -The data-plane endpoint is obtained from Control Plane APIs. - -**Example:** `1234abcd-12ab-12ab-12ab-123456abcdef.eus.cnt-prod.loadtesting.azure.com` - -In the above example, `eus` represents the Azure region `East US`. - -## Examples - -### Creating a load test -```python -from azure.developer.loadtesting import LoadTestingClient -from azure.identity import DefaultAzureCredential -from azure.core.exceptions import HttpResponseError -import os - -TEST_ID = "some-test-id" -DISPLAY_NAME = "my-load-test" - -# set SUBSCRIPTION_ID as an environment variable -SUBSCRIPTION_ID = os.environ["SUBSCRIPTION_ID"] - -client = LoadTestingClient(endpoint='', credential=DefaultAzureCredential()) - -try: - result = client.administration.create_or_update_test( - TEST_ID, - { - "description": "", - "displayName": DISPLAY_NAME, - "loadTestConfig": { - "engineInstances": 1, - "splitAllCSVs": False, - }, - "secrets": {}, - "environmentVariables": {}, - "passFailCriteria": {"passFailMetrics": {}} - }, - ) - print(result) -except HttpResponseError as e: - print('Service responded with error: {}'.format(e.response.json())) - -``` - -### Uploading .jmx file to a Test -```python -from azure.developer.loadtesting import LoadTestingClient -from azure.identity import DefaultAzureCredential -from azure.core.exceptions import HttpResponseError - -TEST_ID = "some-test-id" -FILE_NAME = "some-file-name.jmx" - -client = LoadTestingClient(endpoint='', credential=DefaultAzureCredential()) - -try: - - result = client.administration.upload_test_file(TEST_ID, FILE_NAME, open("sample.jmx", "rb")) - print(result) -except HttpResponseError as e: - print("Failed with error: {}".format(e.response.json())) -``` - -### Running a Test -```python -from azure.developer.loadtesting import LoadTestingClient -from azure.identity import DefaultAzureCredential -from azure.core.exceptions import HttpResponseError - -TEST_ID = "some-test-id" -TEST_RUN_ID = "some-testrun-id" -DISPLAY_NAME = "my-load-test-run" - -client = LoadTestingClient(endpoint='', credential=DefaultAzureCredential()) - -try: - testRunPoller = client.test_run.begin_test_run( - TEST_RUN_ID, - { - "testId": TEST_ID, - "displayName": "My New Load Test Run", - }, - poll_for_test_run_status=True - ) - - #waiting for test run status to be completed with timeout = 3600 seconds - result = testRunPoller.result(3600) - - print(result) -except HttpResponseError as e: - print("Failed with error: {}".format(e.response.json())) -``` - -## Next steps - -More samples can be found [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/loadtestservice/azure-developer-loadtesting/samples). - -## Contributing - -This project welcomes contributions and suggestions. Most contributions require -you to agree to a Contributor License Agreement (CLA) declaring that you have -the right to, and actually do, grant us the rights to use your contribution. -For details, visit https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether -you need to provide a CLA and decorate the PR appropriately (e.g., label, -comment). Simply follow the instructions provided by the bot. You will only -need to do this once across all repos using our CLA. - -This project has adopted the -[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, -see the Code of Conduct FAQ or contact opencode@microsoft.com with any -additional questions or comments. - -## Troubleshooting -More about it is coming soon... - - -[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ -[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token -[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials -[azure_identity_pip]: https://pypi.org/project/azure-identity/ -[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential -[pip]: https://pypi.org/project/pip/ -[azure_sub]: https://azure.microsoft.com/free/ -[api_reference_doc]: https://docs.microsoft.com/rest/api/loadtesting/ -[product_documentation]: https://azure.microsoft.com/services/load-testing/ \ No newline at end of file diff --git a/sdk/loadtestservice/azure-developer-loadtesting/samples/sample.jmx b/sdk/loadtestservice/azure-developer-loadtesting/samples/sample.jmx deleted file mode 100644 index 8133a2f24a47..000000000000 --- a/sdk/loadtestservice/azure-developer-loadtesting/samples/sample.jmx +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - false - true - false - - - - - - - - - - threads_per_engine - ${__BeanShell( System.getenv("threads_per_engine") )} - = - - - ramp_up_time - ${__BeanShell( System.getenv("ramp_up_time") )} - = - - - duration_in_sec - ${__BeanShell( System.getenv("duration_in_sec") )} - = - - - domain - ${__BeanShell( System.getenv("domain") )} - = - - - protocol - ${__BeanShell( System.getenv("protocol") )} - = - - - path - ${__BeanShell( System.getenv("path") )} - = - - - - - - continue - - false - -1 - - ${threads_per_engine} - ${ramp_up_time} - true - ${duration_in_sec} - 5 - true - - - - - - - ${domain} - - ${protocol} - - ${path} - GET - true - false - true - false - - - - - - - - - diff --git a/sdk/loadtestservice/azure-developer-loadtesting/setup.py b/sdk/loadtestservice/azure-developer-loadtesting/setup.py deleted file mode 100644 index efe061bdca5c..000000000000 --- a/sdk/loadtestservice/azure-developer-loadtesting/setup.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# coding: utf-8 - -import os -import re -from setuptools import setup, find_packages - - -PACKAGE_NAME = "azure-developer-loadtesting" -PACKAGE_PPRINT_NAME = "Azure Developer LoadTesting" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") - -# Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure Developer LoadTesting Client Library for Python", - long_description=open("README.md", "r").read(), - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk", - keywords="azure, azure sdk", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.developer", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-core<2.0.0,>=1.24.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", - ], - python_requires=">=3.7", -) diff --git a/sdk/maps/azure-maps-geolocation/pyproject.toml b/sdk/maps/azure-maps-geolocation/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/maps/azure-maps-render/pyproject.toml b/sdk/maps/azure-maps-render/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/maps/azure-maps-render/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/maps/azure-maps-route/pyproject.toml b/sdk/maps/azure-maps-route/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/maps/azure-maps-route/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/maps/azure-maps-search/pyproject.toml b/sdk/maps/azure-maps-search/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/maps/azure-maps-search/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/pyproject.toml b/sdk/metricsadvisor/azure-ai-metricsadvisor/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml b/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/ml/azure-ai-ml/CHANGELOG.md b/sdk/ml/azure-ai-ml/CHANGELOG.md index 80c8423e6013..84481b1fefb2 100644 --- a/sdk/ml/azure-ai-ml/CHANGELOG.md +++ b/sdk/ml/azure-ai-ml/CHANGELOG.md @@ -3,6 +3,9 @@ ## 1.5.0 (Unreleased) ### Features Added +- Added support for `tags` on Compute Resources. +- Add managed network preview feature for the workspace. +- Add outbound rule operations to interact with the outbound rules of the managed network property for workspace. ### Bugs Fixed diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_base.json b/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_base.json index 2946ef1feeec..1efee5280cac 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_base.json +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_base.json @@ -386,6 +386,15 @@ "metadata": { "description": "ARM identifier of primary user assigned managed identity, in case multiple ones are specified. Also the default managed identity for clusterless compute." } + }, + "managedNetwork": { + "type": "object", + "defaultValue": { + "isolationMode": "Disabled" + }, + "metadata": { + "description": "Managed network settings to be used for the workspace. If not specified, isolation mode Disabled is the default" + } } }, "variables": { @@ -543,7 +552,7 @@ { "condition": "[variables('enablePE')]", "type": "Microsoft.MachineLearningServices/workspaces", - "apiVersion": "2022-01-01-preview", + "apiVersion": "2022-12-01-preview", "tags": "[parameters('tagValues')]", "name": "[parameters('workspaceName')]", "location": "[parameters('location')]", @@ -576,7 +585,8 @@ "storageAccountArmId": "[parameters('encryption_storage_resourceid')]", "SearchAccountArmId": "[parameters('encryption_search_resourceid')]" }, - "primaryUserAssignedIdentity": "[parameters('primaryUserAssignedIdentity')]" + "primaryUserAssignedIdentity": "[parameters('primaryUserAssignedIdentity')]", + "managedNetwork": "[parameters('managedNetwork')]" } }, { diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_param.json b/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_param.json index 83b45fbc0e6b..d4e4c6ca0c87 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_param.json +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_param.json @@ -115,5 +115,8 @@ }, "primaryUserAssignedIdentity": { "value": "" + }, + "managedNetwork": { + "value": {} } } \ No newline at end of file diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_blob_storage_helper.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_blob_storage_helper.py index d3273540c8e6..4af026ecddea 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_blob_storage_helper.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_blob_storage_helper.py @@ -93,7 +93,7 @@ def upload( file_size, _ = get_directory_size(source, ignore_file=ignore_file) file_size_in_mb = file_size / 10**6 cloud = _get_cloud_details() - cloud_endpoint = cloud['storage_endpoint'] # make sure proper cloud endpoint is used + cloud_endpoint = cloud["storage_endpoint"] # make sure proper cloud endpoint is used full_storage_url = f"https://{self.account_name}.blob.{cloud_endpoint}/{self.container}/{dest}" if file_size_in_mb > 100: module_logger.warning(FILE_SIZE_WARNING.format(source=source, destination=full_storage_url)) @@ -231,9 +231,9 @@ def download( # check if total size of download has exceeded 100 MB # make sure proper cloud endpoint is used cloud = _get_cloud_details() - cloud_endpoint = cloud['storage_endpoint'] + cloud_endpoint = cloud["storage_endpoint"] full_storage_url = f"https://{self.account_name}.blob.{cloud_endpoint}/{self.container}/{starts_with}" - download_size_in_mb += (blob_content.size / 10**6) + download_size_in_mb += blob_content.size / 10**6 if download_size_in_mb > 100: module_logger.warning(FILE_SIZE_WARNING.format(source=full_storage_url, destination=destination)) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_gen2_storage_helper.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_gen2_storage_helper.py index 6e53bf1142bb..9458c493349f 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_gen2_storage_helper.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_gen2_storage_helper.py @@ -85,7 +85,7 @@ def upload( file_size_in_mb = file_size / 10**6 cloud = _get_cloud_details() - cloud_endpoint = cloud['storage_endpoint'] # make sure proper cloud endpoint is used + cloud_endpoint = cloud["storage_endpoint"] # make sure proper cloud endpoint is used full_storage_url = f"https://{self.account_name}.dfs.{cloud_endpoint}/{self.file_system}/{dest}" if file_size_in_mb > 100: module_logger.warning(FILE_SIZE_WARNING.format(source=source, destination=full_storage_url)) @@ -185,9 +185,9 @@ def download(self, starts_with: str, destination: str = Path.home()) -> None: # check if total size of download has exceeded 100 MB cloud = _get_cloud_details() - cloud_endpoint = cloud['storage_endpoint'] # make sure proper cloud endpoint is used + cloud_endpoint = cloud["storage_endpoint"] # make sure proper cloud endpoint is used full_storage_url = f"https://{self.account_name}.dfs.{cloud_endpoint}/{self.file_system}/{starts_with}" - download_size_in_mb += (file_client.get_file_properties().size / 10**6) + download_size_in_mb += file_client.get_file_properties().size / 10**6 if download_size_in_mb > 100: module_logger.warning(FILE_SIZE_WARNING.format(source=full_storage_url, destination=destination)) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py index c42317356990..f08de6c9bb6a 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py @@ -15,7 +15,6 @@ from azure.mgmt.core import ARMPipelineClient - module_logger = logging.getLogger(__name__) @@ -63,10 +62,11 @@ class EndpointURLS: # pylint: disable=too-few-public-methods,no-init _requests_pipeline = None + def _get_cloud(cloud: str): if cloud in _environments: return _environments[cloud] - arm_url = os.environ.get(ArmConstants.METADATA_URL_ENV_NAME,ArmConstants.DEFAULT_URL) + arm_url = os.environ.get(ArmConstants.METADATA_URL_ENV_NAME, ArmConstants.DEFAULT_URL) arm_clouds = _get_clouds_by_metadata_url(arm_url) try: new_cloud = arm_clouds[cloud] @@ -75,6 +75,7 @@ def _get_cloud(cloud: str): except KeyError: raise Exception('Unknown cloud environment "{0}".'.format(cloud)) + def _get_default_cloud_name(): """Return AzureCloud as the default cloud.""" return os.getenv(AZUREML_CLOUD_ENV_NAME, AzureEnvironments.ENV_DEFAULT) @@ -209,53 +210,56 @@ def _resource_to_scopes(resource): scope = resource + "/.default" return [scope] + def _get_registry_discovery_url(cloud, cloud_suffix=""): """Get or generate the registry discovery url - :param cloud: configuration of the cloud to get the registry_discovery_url from - :param cloud_suffix: the suffix to use for the cloud, in the case that the registry_discovery_url - must be generated - :return: string of discovery url + :param cloud: configuration of the cloud to get the registry_discovery_url from + :param cloud_suffix: the suffix to use for the cloud, in the case that the registry_discovery_url + must be generated + :return: string of discovery url """ cloud_name = cloud["name"] if cloud_name in _environments: return _environments[cloud_name].registry_url registry_discovery_region = os.environ.get( - ArmConstants.REGISTRY_DISCOVERY_REGION_ENV_NAME, - ArmConstants.REGISTRY_DISCOVERY_DEFAULT_REGION + ArmConstants.REGISTRY_DISCOVERY_REGION_ENV_NAME, ArmConstants.REGISTRY_DISCOVERY_DEFAULT_REGION ) registry_discovery_region_default = "https://{}{}.api.azureml.{}/".format( - cloud_name.lower(), - registry_discovery_region, - cloud_suffix + cloud_name.lower(), registry_discovery_region, cloud_suffix ) return os.environ.get(ArmConstants.REGISTRY_ENV_URL, registry_discovery_region_default) + def _get_clouds_by_metadata_url(metadata_url): """Get all the clouds by the specified metadata url - :return: list of the clouds + :return: list of the clouds """ try: - module_logger.debug('Start : Loading cloud metadata from the url specified by %s', metadata_url) + module_logger.debug("Start : Loading cloud metadata from the url specified by %s", metadata_url) client = ARMPipelineClient(base_url=metadata_url, policies=[]) HttpRequest("GET", metadata_url) with client.send_request(HttpRequest("GET", metadata_url)) as meta_response: arm_cloud_dict = meta_response.json() cli_cloud_dict = _convert_arm_to_cli(arm_cloud_dict) - module_logger.debug('Finish : Loading cloud metadata from the url specified by %s', metadata_url) + module_logger.debug("Finish : Loading cloud metadata from the url specified by %s", metadata_url) return cli_cloud_dict except Exception as ex: # pylint: disable=broad-except - module_logger.warning("Error: Azure ML was unable to load cloud metadata from the url specified by %s. %s. " - "This may be due to a misconfiguration of networking controls. Azure Machine Learning Python " - "SDK requires outbound access to Azure Resource Manager. Please contact your networking team " - "to configure outbound access to Azure Resource Manager on both Network Security Group and " - "Firewall. For more details on required configurations, see " - "https://docs.microsoft.com/azure/machine-learning/how-to-access-azureml-behind-firewall.", - metadata_url, ex) + module_logger.warning( + "Error: Azure ML was unable to load cloud metadata from the url specified by %s. %s. " + "This may be due to a misconfiguration of networking controls. Azure Machine Learning Python " + "SDK requires outbound access to Azure Resource Manager. Please contact your networking team " + "to configure outbound access to Azure Resource Manager on both Network Security Group and " + "Firewall. For more details on required configurations, see " + "https://docs.microsoft.com/azure/machine-learning/how-to-access-azureml-behind-firewall.", + metadata_url, + ex, + ) return {} + def _convert_arm_to_cli(arm_cloud_metadata): cli_cloud_metadata_dict = {} if isinstance(arm_cloud_metadata, dict): @@ -265,7 +269,7 @@ def _convert_arm_to_cli(arm_cloud_metadata): try: cloud_name = cloud["name"] portal_endpoint = cloud["portal"] - cloud_suffix = ".".join(portal_endpoint.split('.')[2:]).replace("/", "") + cloud_suffix = ".".join(portal_endpoint.split(".")[2:]).replace("/", "") registry_discovery_url = _get_registry_discovery_url(cloud, cloud_suffix) cli_cloud_metadata_dict[cloud_name] = { EndpointURLS.AZURE_PORTAL_ENDPOINT: cloud["portal"], @@ -273,7 +277,7 @@ def _convert_arm_to_cli(arm_cloud_metadata): EndpointURLS.ACTIVE_DIRECTORY_ENDPOINT: cloud["authentication"]["loginEndpoint"], EndpointURLS.AML_RESOURCE_ID: "https://ml.azure.{}".format(cloud_suffix), EndpointURLS.STORAGE_ENDPOINT: cloud["suffixes"]["storage"], - EndpointURLS.REGISTRY_DISCOVERY_ENDPOINT: registry_discovery_url + EndpointURLS.REGISTRY_DISCOVERY_ENDPOINT: registry_discovery_url, } except KeyError as ex: module_logger.warning("Property on cloud not found in arm cloud metadata: %s", ex) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/component.py index 71c49a588779..a13ac8cf4ccd 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/component.py @@ -119,6 +119,7 @@ def _serialize(self, obj, *, many: bool = False): def add_param_overrides(self, data, **kwargs): source_path = self.context.pop(SOURCE_PATH_CONTEXT_KEY, None) if isinstance(data, dict) and source_path and os.path.isfile(source_path): + def should_node_overwritten(_root, _parts): parts = _parts.copy() parts.pop() @@ -135,9 +136,7 @@ def should_node_overwritten(_root, _parts): ("inputs.*.enum", should_node_overwritten), ]: for dot_key in get_valid_dot_keys_with_wildcard( - origin_data, - dot_key_wildcard, - validate_func=condition_func + origin_data, dot_key_wildcard, validate_func=condition_func ): pydash.set_(data, dot_key, pydash.get(origin_data, dot_key)) return super().add_param_overrides(data, **kwargs) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/input_output.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/input_output.py index 7571cda2bed3..057087ae82b7 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/input_output.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_schema/input_output.py @@ -17,6 +17,8 @@ "String", "float", "Float", + "double", + "Double", ] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/__init__.py index a065b8489c06..13d8db80f83b 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/__init__.py @@ -4,6 +4,4 @@ from ._yaml_utils import yaml_safe_load_with_base_resolver -__all__ = [ - "yaml_safe_load_with_base_resolver" -] +__all__ = ["yaml_safe_load_with_base_resolver"] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/_yaml_utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/_yaml_utils.py index a0dd70cee2c0..29c2d8491f8d 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/_yaml_utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/_utils/_yaml_utils.py @@ -18,6 +18,7 @@ class _SafeLoaderWithBaseLoader(strictyaml.ruamel.SafeLoader): from the inheritance list. Instead, we overwrite add_version_implicit_resolver method to make _SafeLoaderWithBaseLoader._version_implicit_resolver empty. Then the resolver will act like a BaseResolver. """ + def fetch_comment(self, comment): pass diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_additional_includes.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_additional_includes.py index 0ebb927265c9..6116381edbed 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_additional_includes.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_additional_includes.py @@ -95,11 +95,7 @@ def _copy(src: Path, dst: Path, *, ignore_file=None) -> None: # for same folder, the expected behavior is merging # ignore will be also applied during this process for name in src.glob("*"): - _AdditionalIncludes._copy( - name, - dst / name.name, - ignore_file=ignore_file.merge(name) - ) + _AdditionalIncludes._copy(name, dst / name.name, ignore_file=ignore_file.merge(name)) @staticmethod def _is_folder_to_compress(path: Path) -> bool: @@ -182,9 +178,7 @@ def resolve(self) -> None: skip_ignore_file=True, ) self._copy( - Path(self._code_path), - tmp_folder_path / Path(self._code_path).name, - ignore_file=root_ignore_file + Path(self._code_path), tmp_folder_path / Path(self._code_path).name, ignore_file=root_ignore_file ) else: # current implementation of ignore file is based on absolute path, so it cannot be shared diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_input_outputs.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_input_outputs.py index 1d56d8473ddb..803a107e4475 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_input_outputs.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/_input_outputs.py @@ -4,6 +4,10 @@ from typing import Dict, Optional, Union from azure.ai.ml import Input, Output +from azure.ai.ml._internal._schema.input_output import SUPPORTED_INTERNAL_PARAM_TYPES +from azure.ai.ml._utils.utils import get_all_enum_values_iter +from azure.ai.ml.constants import AssetTypes +from azure.ai.ml.constants._common import InputTypes from azure.ai.ml.constants._component import ComponentParameterTypes, IOConstants _INPUT_TYPE_ENUM = "enum" @@ -127,3 +131,22 @@ def _from_base(cls, _output: Union[Output, Dict]) -> Optional["InternalOutput"]: _output.__class__ = InternalOutput return _output return InternalOutput(**_output) + + def map_pipeline_output_type(self): + """Map output type to pipeline output type.""" + + def _map_primitive_type(_type): + """Convert double and float to number type.""" + _type = _type.lower() + if _type in ["double", "float"]: + return InputTypes.NUMBER + return _type + + if self.type in list(get_all_enum_values_iter(AssetTypes)): + return self.type + if self.type in SUPPORTED_INTERNAL_PARAM_TYPES: + return _map_primitive_type(self.type) + if self.type in ["AnyFile"]: + return AssetTypes.URI_FILE + # Handle AnyDirectory and the other types. + return AssetTypes.URI_FOLDER diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py index 7983eacaa73f..28a84ea46b76 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py @@ -76,6 +76,7 @@ VirtualClusterOperations, WorkspaceConnectionsOperations, WorkspaceOperations, + WorkspaceOutboundRuleOperations, ) from azure.ai.ml.operations._code_operations import CodeOperations from azure.ai.ml.operations._local_deployment_helper import _LocalDeploymentHelper @@ -223,7 +224,7 @@ def __init__( **kwargs, ) - self._rp_service_client = ServiceClient102022Preview( + self._rp_service_client = ServiceClient122022Preview( subscription_id=self._operation_scope._subscription_id, credential=self._credential, base_url=base_url, @@ -296,6 +297,14 @@ def __init__( **app_insights_handler_kwargs, ) + self._workspace_outbound_rule = WorkspaceOutboundRuleOperations( + self._operation_scope, + self._rp_service_client, + self._operation_container, + self._credential, + **kwargs, + ) + # TODO make sure that at least one reviewer who understands operation initialization details reviews this self._registries = RegistryOperations( self._operation_scope, @@ -553,6 +562,15 @@ def workspaces(self) -> WorkspaceOperations: """ return self._workspaces + @property + def workspace_outbound_rule(self) -> WorkspaceOutboundRuleOperations: + """A collection of workspace managed network outbound rule related operations. + + :return: Workspace Outbound Rule operations + :rtype: WorkspaceOutboundRuleOperations + """ + return self._workspace_outbound_rule + @property @experimental def registries(self) -> RegistryOperations: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/_azure_machine_learning_workspaces.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/_azure_machine_learning_workspaces.py index 98300e49264d..79227c1c2960 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/_azure_machine_learning_workspaces.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/_azure_machine_learning_workspaces.py @@ -15,7 +15,7 @@ from . import models from ._configuration import AzureMachineLearningWorkspacesConfiguration -from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, JobsOperations, LabelingJobsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations +from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, JobsOperations, LabelingJobsOperations, ManagedNetworkSettingsOperations, ManagedNetworkSettingsRuleOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -49,6 +49,12 @@ class AzureMachineLearningWorkspaces(object): # pylint: disable=too-many-inst :ivar workspace_connections: WorkspaceConnectionsOperations operations :vartype workspace_connections: azure.mgmt.machinelearningservices.operations.WorkspaceConnectionsOperations + :ivar managed_network_settings: ManagedNetworkSettingsOperations operations + :vartype managed_network_settings: + azure.mgmt.machinelearningservices.operations.ManagedNetworkSettingsOperations + :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations + :vartype managed_network_settings_rule: + azure.mgmt.machinelearningservices.operations.ManagedNetworkSettingsRuleOperations :ivar registries: RegistriesOperations operations :vartype registries: azure.mgmt.machinelearningservices.operations.RegistriesOperations :ivar workspace_features: WorkspaceFeaturesOperations operations @@ -162,6 +168,8 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings = ManagedNetworkSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_features = WorkspaceFeaturesOperations(self._client, self._config, self._serialize, self._deserialize) self.registry_code_containers = RegistryCodeContainersOperations(self._client, self._config, self._serialize, self._deserialize) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/_azure_machine_learning_workspaces.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/_azure_machine_learning_workspaces.py index e0e67672bd44..94bdeea22c8b 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/_azure_machine_learning_workspaces.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/_azure_machine_learning_workspaces.py @@ -16,7 +16,7 @@ from .. import models from ._configuration import AzureMachineLearningWorkspacesConfiguration -from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, JobsOperations, LabelingJobsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations +from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, JobsOperations, LabelingJobsOperations, ManagedNetworkSettingsOperations, ManagedNetworkSettingsRuleOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -47,6 +47,12 @@ class AzureMachineLearningWorkspaces: # pylint: disable=too-many-instance-att :ivar workspace_connections: WorkspaceConnectionsOperations operations :vartype workspace_connections: azure.mgmt.machinelearningservices.aio.operations.WorkspaceConnectionsOperations + :ivar managed_network_settings: ManagedNetworkSettingsOperations operations + :vartype managed_network_settings: + azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkSettingsOperations + :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations + :vartype managed_network_settings_rule: + azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkSettingsRuleOperations :ivar registries: RegistriesOperations operations :vartype registries: azure.mgmt.machinelearningservices.aio.operations.RegistriesOperations :ivar workspace_features: WorkspaceFeaturesOperations operations @@ -163,6 +169,8 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings = ManagedNetworkSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_features = WorkspaceFeaturesOperations(self._client, self._config, self._serialize, self._deserialize) self.registry_code_containers = RegistryCodeContainersOperations(self._client, self._config, self._serialize, self._deserialize) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/__init__.py index 01fa2d886d14..fdeb50af974b 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/__init__.py @@ -15,6 +15,8 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._managed_network_settings_operations import ManagedNetworkSettingsOperations +from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations from ._registry_code_containers_operations import RegistryCodeContainersOperations @@ -54,6 +56,8 @@ 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'WorkspaceConnectionsOperations', + 'ManagedNetworkSettingsOperations', + 'ManagedNetworkSettingsRuleOperations', 'RegistriesOperations', 'WorkspaceFeaturesOperations', 'RegistryCodeContainersOperations', diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/_managed_network_settings_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/_managed_network_settings_operations.py new file mode 100644 index 000000000000..fe3db8a447fd --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/_managed_network_settings_operations.py @@ -0,0 +1,335 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_network_settings_operations import build_create_or_update_request_initial, build_get_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedNetworkSettingsOperations: + """ManagedNetworkSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.ManagedNetworkSettings": + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedNetworkSettings, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedNetworkSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedNetworkSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + + async def _update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + body: "_models.ManagedNetworkDto", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'ManagedNetworkDto') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + + @distributed_trace_async + async def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + body: "_models.ManagedNetworkDto", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkDto + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + async def _create_or_update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + body: "_models.ManagedNetworkDto", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'ManagedNetworkDto') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + body: "_models.ManagedNetworkDto", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkDto + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/_managed_network_settings_rule_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/_managed_network_settings_rule_operations.py new file mode 100644 index 000000000000..53920fff283d --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/aio/operations/_managed_network_settings_rule_operations.py @@ -0,0 +1,278 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_network_settings_rule_operations import build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedNetworkSettingsRuleOperations: + """ManagedNetworkSettingsRuleOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Dict[str, "_models.OutboundRule"]: + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: dict mapping str to OutboundRule, or the result of cls(response) + :rtype: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.OutboundRule"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('{OutboundRule}', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param rule_name: + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.OutboundRule": + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param rule_name: + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundRule, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.OutboundRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OutboundRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/__init__.py index 6529b7e7e880..11c40b1373b5 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/__init__.py @@ -187,6 +187,7 @@ from ._models_py3 import Forecasting from ._models_py3 import ForecastingSettings from ._models_py3 import ForecastingTrainingSettings + from ._models_py3 import FqdnOutboundRule from ._models_py3 import GridSamplingAlgorithm from ._models_py3 import HDInsight from ._models_py3 import HDInsightProperties @@ -261,6 +262,8 @@ from ._models_py3 import MLTableJobOutput from ._models_py3 import ManagedIdentity from ._models_py3 import ManagedIdentityAuthTypeWorkspaceConnectionProperties + from ._models_py3 import ManagedNetworkDto + from ._models_py3 import ManagedNetworkSettings from ._models_py3 import ManagedOnlineDeployment from ._models_py3 import ManagedServiceIdentity from ._models_py3 import MedianStoppingPolicy @@ -294,6 +297,7 @@ from ._models_py3 import OnlineEndpointTrackedResourceArmPaginatedResult from ._models_py3 import OnlineRequestSettings from ._models_py3 import OnlineScaleSettings + from ._models_py3 import OutboundRule from ._models_py3 import OutputPathAssetReference from ._models_py3 import PATAuthTypeWorkspaceConnectionProperties from ._models_py3 import PaginatedComputeResourcesList @@ -311,6 +315,9 @@ from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateEndpointDestination + from ._models_py3 import PrivateEndpointOutboundRule + from ._models_py3 import PrivateEndpointOutboundRuleDestination from ._models_py3 import PrivateLinkResource from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionState @@ -355,6 +362,9 @@ from ._models_py3 import ServicePrincipalAuthTypeWorkspaceConnectionProperties from ._models_py3 import ServicePrincipalDatastoreCredentials from ._models_py3 import ServicePrincipalDatastoreSecrets + from ._models_py3 import ServiceTagDestination + from ._models_py3 import ServiceTagOutboundRule + from ._models_py3 import ServiceTagOutboundRuleDestination from ._models_py3 import SetupScripts from ._models_py3 import SharedPrivateLinkResource from ._models_py3 import Sku @@ -438,6 +448,7 @@ from ._models_py3 import WorkspaceConnectionSharedAccessSignature from ._models_py3 import WorkspaceConnectionUsernamePassword from ._models_py3 import WorkspaceListResult + from ._models_py3 import WorkspacePropertiesManagedNetwork from ._models_py3 import WorkspaceUpdateParameters except (SyntaxError, ImportError): from ._models import AKS # type: ignore @@ -620,6 +631,7 @@ from ._models import Forecasting # type: ignore from ._models import ForecastingSettings # type: ignore from ._models import ForecastingTrainingSettings # type: ignore + from ._models import FqdnOutboundRule # type: ignore from ._models import GridSamplingAlgorithm # type: ignore from ._models import HDInsight # type: ignore from ._models import HDInsightProperties # type: ignore @@ -694,6 +706,8 @@ from ._models import MLTableJobOutput # type: ignore from ._models import ManagedIdentity # type: ignore from ._models import ManagedIdentityAuthTypeWorkspaceConnectionProperties # type: ignore + from ._models import ManagedNetworkDto # type: ignore + from ._models import ManagedNetworkSettings # type: ignore from ._models import ManagedOnlineDeployment # type: ignore from ._models import ManagedServiceIdentity # type: ignore from ._models import MedianStoppingPolicy # type: ignore @@ -727,6 +741,7 @@ from ._models import OnlineEndpointTrackedResourceArmPaginatedResult # type: ignore from ._models import OnlineRequestSettings # type: ignore from ._models import OnlineScaleSettings # type: ignore + from ._models import OutboundRule # type: ignore from ._models import OutputPathAssetReference # type: ignore from ._models import PATAuthTypeWorkspaceConnectionProperties # type: ignore from ._models import PaginatedComputeResourcesList # type: ignore @@ -744,6 +759,9 @@ from ._models import PrivateEndpoint # type: ignore from ._models import PrivateEndpointConnection # type: ignore from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateEndpointDestination # type: ignore + from ._models import PrivateEndpointOutboundRule # type: ignore + from ._models import PrivateEndpointOutboundRuleDestination # type: ignore from ._models import PrivateLinkResource # type: ignore from ._models import PrivateLinkResourceListResult # type: ignore from ._models import PrivateLinkServiceConnectionState # type: ignore @@ -788,6 +806,9 @@ from ._models import ServicePrincipalAuthTypeWorkspaceConnectionProperties # type: ignore from ._models import ServicePrincipalDatastoreCredentials # type: ignore from ._models import ServicePrincipalDatastoreSecrets # type: ignore + from ._models import ServiceTagDestination # type: ignore + from ._models import ServiceTagOutboundRule # type: ignore + from ._models import ServiceTagOutboundRuleDestination # type: ignore from ._models import SetupScripts # type: ignore from ._models import SharedPrivateLinkResource # type: ignore from ._models import Sku # type: ignore @@ -871,6 +892,7 @@ from ._models import WorkspaceConnectionSharedAccessSignature # type: ignore from ._models import WorkspaceConnectionUsernamePassword # type: ignore from ._models import WorkspaceListResult # type: ignore + from ._models import WorkspacePropertiesManagedNetwork # type: ignore from ._models import WorkspaceUpdateParameters # type: ignore from ._azure_machine_learning_workspaces_enums import ( @@ -923,6 +945,7 @@ IncrementalDataRefresh, InputDeliveryMode, InstanceSegmentationPrimaryMetrics, + IsolationMode, JobInputType, JobLimitsType, JobOutputType, @@ -936,6 +959,8 @@ LogVerbosity, MLAssistConfigurationType, MLFlowAutologgerState, + ManagedNetworkDtoIsolationMode, + ManagedNetworkSettingsIsolationMode, ManagedServiceIdentityType, MediaType, MlflowAutologger, @@ -955,6 +980,8 @@ OperationTrigger, OrderString, OsType, + OutboundRuleCategory, + OutboundRuleType, OutputDeliveryMode, PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, @@ -970,6 +997,8 @@ RegressionModels, RegressionPrimaryMetrics, RemoteLoginPortPublicAccess, + RuleCategory, + RuleType, SamplingAlgorithmType, ScaleType, ScheduleActionType, @@ -1193,6 +1222,7 @@ 'Forecasting', 'ForecastingSettings', 'ForecastingTrainingSettings', + 'FqdnOutboundRule', 'GridSamplingAlgorithm', 'HDInsight', 'HDInsightProperties', @@ -1267,6 +1297,8 @@ 'MLTableJobOutput', 'ManagedIdentity', 'ManagedIdentityAuthTypeWorkspaceConnectionProperties', + 'ManagedNetworkDto', + 'ManagedNetworkSettings', 'ManagedOnlineDeployment', 'ManagedServiceIdentity', 'MedianStoppingPolicy', @@ -1300,6 +1332,7 @@ 'OnlineEndpointTrackedResourceArmPaginatedResult', 'OnlineRequestSettings', 'OnlineScaleSettings', + 'OutboundRule', 'OutputPathAssetReference', 'PATAuthTypeWorkspaceConnectionProperties', 'PaginatedComputeResourcesList', @@ -1317,6 +1350,9 @@ 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionListResult', + 'PrivateEndpointDestination', + 'PrivateEndpointOutboundRule', + 'PrivateEndpointOutboundRuleDestination', 'PrivateLinkResource', 'PrivateLinkResourceListResult', 'PrivateLinkServiceConnectionState', @@ -1361,6 +1397,9 @@ 'ServicePrincipalAuthTypeWorkspaceConnectionProperties', 'ServicePrincipalDatastoreCredentials', 'ServicePrincipalDatastoreSecrets', + 'ServiceTagDestination', + 'ServiceTagOutboundRule', + 'ServiceTagOutboundRuleDestination', 'SetupScripts', 'SharedPrivateLinkResource', 'Sku', @@ -1444,6 +1483,7 @@ 'WorkspaceConnectionSharedAccessSignature', 'WorkspaceConnectionUsernamePassword', 'WorkspaceListResult', + 'WorkspacePropertiesManagedNetwork', 'WorkspaceUpdateParameters', 'AllocationState', 'ApplicationSharingPolicy', @@ -1494,6 +1534,7 @@ 'IncrementalDataRefresh', 'InputDeliveryMode', 'InstanceSegmentationPrimaryMetrics', + 'IsolationMode', 'JobInputType', 'JobLimitsType', 'JobOutputType', @@ -1507,6 +1548,8 @@ 'LogVerbosity', 'MLAssistConfigurationType', 'MLFlowAutologgerState', + 'ManagedNetworkDtoIsolationMode', + 'ManagedNetworkSettingsIsolationMode', 'ManagedServiceIdentityType', 'MediaType', 'MlflowAutologger', @@ -1526,6 +1569,8 @@ 'OperationTrigger', 'OrderString', 'OsType', + 'OutboundRuleCategory', + 'OutboundRuleType', 'OutputDeliveryMode', 'PrivateEndpointConnectionProvisioningState', 'PrivateEndpointServiceConnectionStatus', @@ -1541,6 +1586,8 @@ 'RegressionModels', 'RegressionPrimaryMetrics', 'RemoteLoginPortPublicAccess', + 'RuleCategory', + 'RuleType', 'SamplingAlgorithmType', 'ScaleType', 'ScheduleActionType', diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_azure_machine_learning_workspaces_enums.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_azure_machine_learning_workspaces_enums.py index 96a7eec9bbc5..f2544200bb52 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_azure_machine_learning_workspaces_enums.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_azure_machine_learning_workspaces_enums.py @@ -636,6 +636,12 @@ class InstanceSegmentationPrimaryMetrics(with_metaclass(CaseInsensitiveEnumMeta, #: AP is calculated for each class and averaged to get the MAP. MEAN_AVERAGE_PRECISION = "MeanAveragePrecision" +class IsolationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DISABLED = "Disabled" + ALLOW_INTERNET_OUTBOUND = "AllowInternetOutbound" + ALLOW_ONLY_APPROVED_OUTBOUND = "AllowOnlyApprovedOutbound" + class JobInputType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum to determine the Job Input Type. """ @@ -770,6 +776,18 @@ class LogVerbosity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Only critical statements logged. CRITICAL = "Critical" +class ManagedNetworkDtoIsolationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DISABLED = "Disabled" + ALLOW_INTERNET_OUTBOUND = "AllowInternetOutbound" + ALLOW_ONLY_APPROVED_OUTBOUND = "AllowOnlyApprovedOutbound" + +class ManagedNetworkSettingsIsolationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DISABLED = "Disabled" + ALLOW_INTERNET_OUTBOUND = "AllowInternetOutbound" + ALLOW_ONLY_APPROVED_OUTBOUND = "AllowOnlyApprovedOutbound" + class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). @@ -962,6 +980,18 @@ class OsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LINUX = "Linux" WINDOWS = "Windows" +class OutboundRuleCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + REQUIRED = "Required" + RECOMMENDED = "Recommended" + USER_DEFINED = "UserDefined" + +class OutboundRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + FQDN = "FQDN" + PRIVATE_ENDPOINT = "PrivateEndpoint" + SERVICE_TAG = "ServiceTag" + class OutputDeliveryMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Output data delivery mode enums. """ @@ -1142,6 +1172,18 @@ class RemoteLoginPortPublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, E DISABLED = "Disabled" NOT_SPECIFIED = "NotSpecified" +class RuleCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + REQUIRED = "Required" + RECOMMENDED = "Recommended" + USER_DEFINED = "UserDefined" + +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + FQDN = "FQDN" + PRIVATE_ENDPOINT = "PrivateEndpoint" + SERVICE_TAG = "ServiceTag" + class SamplingAlgorithmType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GRID = "Grid" diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models.py index d2d796021e61..9459d69607ae 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models.py @@ -10153,6 +10153,86 @@ def __init__( self.endpoints = kwargs.get('endpoints', None) +class OutboundRule(msrest.serialization.Model): + """OutboundRule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FqdnOutboundRule, PrivateEndpointOutboundRule, ServiceTagOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'FQDN': 'FqdnOutboundRule', 'PrivateEndpoint': 'PrivateEndpointOutboundRule', 'ServiceTag': 'ServiceTagOutboundRule'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + """ + super(OutboundRule, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.category = kwargs.get('category', None) + + +class FqdnOutboundRule(OutboundRule): + """FqdnOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :ivar destination: + :vartype destination: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :keyword destination: + :paramtype destination: str + """ + super(FqdnOutboundRule, self).__init__(**kwargs) + self.type = 'FQDN' # type: str + self.destination = kwargs.get('destination', None) + + class GridSamplingAlgorithm(SamplingAlgorithm): """Defines a Sampling Algorithm that exhaustively generates every value combination in the space. @@ -14873,6 +14953,78 @@ def __init__( self.credentials = kwargs.get('credentials', None) +class ManagedNetworkDto(msrest.serialization.Model): + """ManagedNetworkDto. + + :ivar isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkDtoIsolationMode + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + + _attribute_map = { + 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, + 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkDtoIsolationMode + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + super(ManagedNetworkDto, self).__init__(**kwargs) + self.isolation_mode = kwargs.get('isolation_mode', None) + self.outbound_rules = kwargs.get('outbound_rules', None) + + +class ManagedNetworkSettings(msrest.serialization.Model): + """ManagedNetworkSettings. + + :ivar isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :ivar network_id: + :vartype network_id: str + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + + _attribute_map = { + 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, + 'network_id': {'key': 'networkId', 'type': 'str'}, + 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :keyword network_id: + :paramtype network_id: str + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + super(ManagedNetworkSettings, self).__init__(**kwargs) + self.isolation_mode = kwargs.get('isolation_mode', None) + self.network_id = kwargs.get('network_id', None) + self.outbound_rules = kwargs.get('outbound_rules', None) + + class ManagedOnlineDeployment(OnlineDeploymentProperties): """Properties specific to a ManagedOnlineDeployment. @@ -17544,6 +17696,114 @@ def __init__( self.value = kwargs.get('value', None) +class PrivateEndpointDestination(msrest.serialization.Model): + """PrivateEndpointDestination. + + :ivar service_resource_id: + :vartype service_resource_id: str + :ivar subresource_target: + :vartype subresource_target: str + :ivar spark_enabled: + :vartype spark_enabled: bool + """ + + _attribute_map = { + 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, + 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, + 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword service_resource_id: + :paramtype service_resource_id: str + :keyword subresource_target: + :paramtype subresource_target: str + :keyword spark_enabled: + :paramtype spark_enabled: bool + """ + super(PrivateEndpointDestination, self).__init__(**kwargs) + self.service_resource_id = kwargs.get('service_resource_id', None) + self.subresource_target = kwargs.get('subresource_target', None) + self.spark_enabled = kwargs.get('spark_enabled', None) + + +class PrivateEndpointOutboundRule(OutboundRule): + """PrivateEndpointOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :ivar destination: + :vartype destination: + ~azure.mgmt.machinelearningservices.models.PrivateEndpointOutboundRuleDestination + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'PrivateEndpointOutboundRuleDestination'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :keyword destination: + :paramtype destination: + ~azure.mgmt.machinelearningservices.models.PrivateEndpointOutboundRuleDestination + """ + super(PrivateEndpointOutboundRule, self).__init__(**kwargs) + self.type = 'PrivateEndpoint' # type: str + self.destination = kwargs.get('destination', None) + + +class PrivateEndpointOutboundRuleDestination(PrivateEndpointDestination): + """PrivateEndpointOutboundRuleDestination. + + :ivar service_resource_id: + :vartype service_resource_id: str + :ivar subresource_target: + :vartype subresource_target: str + :ivar spark_enabled: + :vartype spark_enabled: bool + """ + + _attribute_map = { + 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, + 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, + 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword service_resource_id: + :paramtype service_resource_id: str + :keyword subresource_target: + :paramtype subresource_target: str + :keyword spark_enabled: + :paramtype spark_enabled: bool + """ + super(PrivateEndpointOutboundRuleDestination, self).__init__(**kwargs) + + class PrivateLinkResource(Resource): """A private link resource. @@ -19428,6 +19688,114 @@ def __init__( self.client_secret = kwargs.get('client_secret', None) +class ServiceTagDestination(msrest.serialization.Model): + """ServiceTagDestination. + + :ivar service_tag: + :vartype service_tag: str + :ivar protocol: + :vartype protocol: str + :ivar port_ranges: + :vartype port_ranges: str + """ + + _attribute_map = { + 'service_tag': {'key': 'serviceTag', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port_ranges': {'key': 'portRanges', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword service_tag: + :paramtype service_tag: str + :keyword protocol: + :paramtype protocol: str + :keyword port_ranges: + :paramtype port_ranges: str + """ + super(ServiceTagDestination, self).__init__(**kwargs) + self.service_tag = kwargs.get('service_tag', None) + self.protocol = kwargs.get('protocol', None) + self.port_ranges = kwargs.get('port_ranges', None) + + +class ServiceTagOutboundRule(OutboundRule): + """ServiceTagOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :ivar destination: + :vartype destination: + ~azure.mgmt.machinelearningservices.models.ServiceTagOutboundRuleDestination + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'ServiceTagOutboundRuleDestination'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :keyword destination: + :paramtype destination: + ~azure.mgmt.machinelearningservices.models.ServiceTagOutboundRuleDestination + """ + super(ServiceTagOutboundRule, self).__init__(**kwargs) + self.type = 'ServiceTag' # type: str + self.destination = kwargs.get('destination', None) + + +class ServiceTagOutboundRuleDestination(ServiceTagDestination): + """ServiceTagOutboundRuleDestination. + + :ivar service_tag: + :vartype service_tag: str + :ivar protocol: + :vartype protocol: str + :ivar port_ranges: + :vartype port_ranges: str + """ + + _attribute_map = { + 'service_tag': {'key': 'serviceTag', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port_ranges': {'key': 'portRanges', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword service_tag: + :paramtype service_tag: str + :keyword protocol: + :paramtype protocol: str + :keyword port_ranges: + :paramtype port_ranges: str + """ + super(ServiceTagOutboundRuleDestination, self).__init__(**kwargs) + + class SetupScripts(msrest.serialization.Model): """Details of customized scripts to execute for setting up the cluster. @@ -23229,6 +23597,9 @@ class Workspace(Resource): :ivar feature_store_settings: Settings for feature store type workspace. :vartype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar managed_network: Managed network settings. + :vartype managed_network: + ~azure.mgmt.machinelearningservices.models.WorkspacePropertiesManagedNetwork """ _validation = { @@ -23288,6 +23659,7 @@ class Workspace(Resource): 'scheduled_purge_date': {'key': 'properties.scheduledPurgeDate', 'type': 'str'}, 'system_datastores_auth_mode': {'key': 'properties.systemDatastoresAuthMode', 'type': 'str'}, 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'WorkspacePropertiesManagedNetwork'}, } def __init__( @@ -23356,6 +23728,9 @@ def __init__( :keyword feature_store_settings: Settings for feature store type workspace. :paramtype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword managed_network: Managed network settings. + :paramtype managed_network: + ~azure.mgmt.machinelearningservices.models.WorkspacePropertiesManagedNetwork """ super(Workspace, self).__init__(**kwargs) self.identity = kwargs.get('identity', None) @@ -23392,6 +23767,7 @@ def __init__( self.scheduled_purge_date = None self.system_datastores_auth_mode = kwargs.get('system_datastores_auth_mode', None) self.feature_store_settings = kwargs.get('feature_store_settings', None) + self.managed_network = kwargs.get('managed_network', None) class WorkspaceConnectionAccessKey(msrest.serialization.Model): @@ -23681,6 +24057,42 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class WorkspacePropertiesManagedNetwork(ManagedNetworkSettings): + """Managed network settings. + + :ivar isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :ivar network_id: + :vartype network_id: str + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + + _attribute_map = { + 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, + 'network_id': {'key': 'networkId', 'type': 'str'}, + 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :keyword network_id: + :paramtype network_id: str + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + super(WorkspacePropertiesManagedNetwork, self).__init__(**kwargs) + + class WorkspaceUpdateParameters(msrest.serialization.Model): """The parameters for updating a machine learning workspace. @@ -23712,6 +24124,8 @@ class WorkspaceUpdateParameters(msrest.serialization.Model): :vartype container_registry: str :ivar encryption: The encryption settings of the workspace. :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :ivar managed_network: Managed network settings. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :ivar feature_store_settings: Settings for feature store type workspace. :vartype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings @@ -23730,6 +24144,7 @@ class WorkspaceUpdateParameters(msrest.serialization.Model): 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionUpdateProperties'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, } @@ -23767,6 +24182,8 @@ def __init__( :paramtype container_registry: str :keyword encryption: The encryption settings of the workspace. :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :keyword managed_network: Managed network settings. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :keyword feature_store_settings: Settings for feature store type workspace. :paramtype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings @@ -23784,4 +24201,5 @@ def __init__( self.application_insights = kwargs.get('application_insights', None) self.container_registry = kwargs.get('container_registry', None) self.encryption = kwargs.get('encryption', None) + self.managed_network = kwargs.get('managed_network', None) self.feature_store_settings = kwargs.get('feature_store_settings', None) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models_py3.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models_py3.py index c87907d479f5..41f8e3f6e002 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models_py3.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/models/_models_py3.py @@ -10945,6 +10945,91 @@ def __init__( self.endpoints = endpoints +class OutboundRule(msrest.serialization.Model): + """OutboundRule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FqdnOutboundRule, PrivateEndpointOutboundRule, ServiceTagOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'FQDN': 'FqdnOutboundRule', 'PrivateEndpoint': 'PrivateEndpointOutboundRule', 'ServiceTag': 'ServiceTagOutboundRule'} + } + + def __init__( + self, + *, + category: Optional[Union[str, "OutboundRuleCategory"]] = None, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + """ + super(OutboundRule, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.category = category + + +class FqdnOutboundRule(OutboundRule): + """FqdnOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :ivar destination: + :vartype destination: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'str'}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "OutboundRuleCategory"]] = None, + destination: Optional[str] = None, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :keyword destination: + :paramtype destination: str + """ + super(FqdnOutboundRule, self).__init__(category=category, **kwargs) + self.type = 'FQDN' # type: str + self.destination = destination + + class GridSamplingAlgorithm(SamplingAlgorithm): """Defines a Sampling Algorithm that exhaustively generates every value combination in the space. @@ -16134,6 +16219,85 @@ def __init__( self.credentials = credentials +class ManagedNetworkDto(msrest.serialization.Model): + """ManagedNetworkDto. + + :ivar isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkDtoIsolationMode + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + + _attribute_map = { + 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, + 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, + } + + def __init__( + self, + *, + isolation_mode: Optional[Union[str, "ManagedNetworkDtoIsolationMode"]] = None, + outbound_rules: Optional[Dict[str, "OutboundRule"]] = None, + **kwargs + ): + """ + :keyword isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkDtoIsolationMode + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + super(ManagedNetworkDto, self).__init__(**kwargs) + self.isolation_mode = isolation_mode + self.outbound_rules = outbound_rules + + +class ManagedNetworkSettings(msrest.serialization.Model): + """ManagedNetworkSettings. + + :ivar isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :ivar network_id: + :vartype network_id: str + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + + _attribute_map = { + 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, + 'network_id': {'key': 'networkId', 'type': 'str'}, + 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, + } + + def __init__( + self, + *, + isolation_mode: Optional[Union[str, "ManagedNetworkSettingsIsolationMode"]] = None, + network_id: Optional[str] = None, + outbound_rules: Optional[Dict[str, "OutboundRule"]] = None, + **kwargs + ): + """ + :keyword isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :keyword network_id: + :paramtype network_id: str + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + super(ManagedNetworkSettings, self).__init__(**kwargs) + self.isolation_mode = isolation_mode + self.network_id = network_id + self.outbound_rules = outbound_rules + + class ManagedOnlineDeployment(OnlineDeploymentProperties): """Properties specific to a ManagedOnlineDeployment. @@ -19037,6 +19201,125 @@ def __init__( self.value = value +class PrivateEndpointDestination(msrest.serialization.Model): + """PrivateEndpointDestination. + + :ivar service_resource_id: + :vartype service_resource_id: str + :ivar subresource_target: + :vartype subresource_target: str + :ivar spark_enabled: + :vartype spark_enabled: bool + """ + + _attribute_map = { + 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, + 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, + 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + service_resource_id: Optional[str] = None, + subresource_target: Optional[str] = None, + spark_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword service_resource_id: + :paramtype service_resource_id: str + :keyword subresource_target: + :paramtype subresource_target: str + :keyword spark_enabled: + :paramtype spark_enabled: bool + """ + super(PrivateEndpointDestination, self).__init__(**kwargs) + self.service_resource_id = service_resource_id + self.subresource_target = subresource_target + self.spark_enabled = spark_enabled + + +class PrivateEndpointOutboundRule(OutboundRule): + """PrivateEndpointOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :ivar destination: + :vartype destination: + ~azure.mgmt.machinelearningservices.models.PrivateEndpointOutboundRuleDestination + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'PrivateEndpointOutboundRuleDestination'}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "OutboundRuleCategory"]] = None, + destination: Optional["PrivateEndpointOutboundRuleDestination"] = None, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :keyword destination: + :paramtype destination: + ~azure.mgmt.machinelearningservices.models.PrivateEndpointOutboundRuleDestination + """ + super(PrivateEndpointOutboundRule, self).__init__(category=category, **kwargs) + self.type = 'PrivateEndpoint' # type: str + self.destination = destination + + +class PrivateEndpointOutboundRuleDestination(PrivateEndpointDestination): + """PrivateEndpointOutboundRuleDestination. + + :ivar service_resource_id: + :vartype service_resource_id: str + :ivar subresource_target: + :vartype subresource_target: str + :ivar spark_enabled: + :vartype spark_enabled: bool + """ + + _attribute_map = { + 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, + 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, + 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + service_resource_id: Optional[str] = None, + subresource_target: Optional[str] = None, + spark_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword service_resource_id: + :paramtype service_resource_id: str + :keyword subresource_target: + :paramtype subresource_target: str + :keyword spark_enabled: + :paramtype spark_enabled: bool + """ + super(PrivateEndpointOutboundRuleDestination, self).__init__(service_resource_id=service_resource_id, subresource_target=subresource_target, spark_enabled=spark_enabled, **kwargs) + + class PrivateLinkResource(Resource): """A private link resource. @@ -21087,6 +21370,125 @@ def __init__( self.client_secret = client_secret +class ServiceTagDestination(msrest.serialization.Model): + """ServiceTagDestination. + + :ivar service_tag: + :vartype service_tag: str + :ivar protocol: + :vartype protocol: str + :ivar port_ranges: + :vartype port_ranges: str + """ + + _attribute_map = { + 'service_tag': {'key': 'serviceTag', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port_ranges': {'key': 'portRanges', 'type': 'str'}, + } + + def __init__( + self, + *, + service_tag: Optional[str] = None, + protocol: Optional[str] = None, + port_ranges: Optional[str] = None, + **kwargs + ): + """ + :keyword service_tag: + :paramtype service_tag: str + :keyword protocol: + :paramtype protocol: str + :keyword port_ranges: + :paramtype port_ranges: str + """ + super(ServiceTagDestination, self).__init__(**kwargs) + self.service_tag = service_tag + self.protocol = protocol + self.port_ranges = port_ranges + + +class ServiceTagOutboundRule(OutboundRule): + """ServiceTagOutboundRule. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Constant filled by server. Possible values include: "FQDN", + "PrivateEndpoint", "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleType + :ivar category: Possible values include: "Required", "Recommended", "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :ivar destination: + :vartype destination: + ~azure.mgmt.machinelearningservices.models.ServiceTagOutboundRuleDestination + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'ServiceTagOutboundRuleDestination'}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "OutboundRuleCategory"]] = None, + destination: Optional["ServiceTagOutboundRuleDestination"] = None, + **kwargs + ): + """ + :keyword category: Possible values include: "Required", "Recommended", "UserDefined". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.OutboundRuleCategory + :keyword destination: + :paramtype destination: + ~azure.mgmt.machinelearningservices.models.ServiceTagOutboundRuleDestination + """ + super(ServiceTagOutboundRule, self).__init__(category=category, **kwargs) + self.type = 'ServiceTag' # type: str + self.destination = destination + + +class ServiceTagOutboundRuleDestination(ServiceTagDestination): + """ServiceTagOutboundRuleDestination. + + :ivar service_tag: + :vartype service_tag: str + :ivar protocol: + :vartype protocol: str + :ivar port_ranges: + :vartype port_ranges: str + """ + + _attribute_map = { + 'service_tag': {'key': 'serviceTag', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port_ranges': {'key': 'portRanges', 'type': 'str'}, + } + + def __init__( + self, + *, + service_tag: Optional[str] = None, + protocol: Optional[str] = None, + port_ranges: Optional[str] = None, + **kwargs + ): + """ + :keyword service_tag: + :paramtype service_tag: str + :keyword protocol: + :paramtype protocol: str + :keyword port_ranges: + :paramtype port_ranges: str + """ + super(ServiceTagOutboundRuleDestination, self).__init__(service_tag=service_tag, protocol=protocol, port_ranges=port_ranges, **kwargs) + + class SetupScripts(msrest.serialization.Model): """Details of customized scripts to execute for setting up the cluster. @@ -25234,6 +25636,9 @@ class Workspace(Resource): :ivar feature_store_settings: Settings for feature store type workspace. :vartype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar managed_network: Managed network settings. + :vartype managed_network: + ~azure.mgmt.machinelearningservices.models.WorkspacePropertiesManagedNetwork """ _validation = { @@ -25293,6 +25698,7 @@ class Workspace(Resource): 'scheduled_purge_date': {'key': 'properties.scheduledPurgeDate', 'type': 'str'}, 'system_datastores_auth_mode': {'key': 'properties.systemDatastoresAuthMode', 'type': 'str'}, 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'WorkspacePropertiesManagedNetwork'}, } def __init__( @@ -25321,6 +25727,7 @@ def __init__( v1_legacy_mode: Optional[bool] = False, system_datastores_auth_mode: Optional[str] = None, feature_store_settings: Optional["FeatureStoreSettings"] = None, + managed_network: Optional["WorkspacePropertiesManagedNetwork"] = None, **kwargs ): """ @@ -25385,6 +25792,9 @@ def __init__( :keyword feature_store_settings: Settings for feature store type workspace. :paramtype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword managed_network: Managed network settings. + :paramtype managed_network: + ~azure.mgmt.machinelearningservices.models.WorkspacePropertiesManagedNetwork """ super(Workspace, self).__init__(**kwargs) self.identity = identity @@ -25421,6 +25831,7 @@ def __init__( self.scheduled_purge_date = None self.system_datastores_auth_mode = system_datastores_auth_mode self.feature_store_settings = feature_store_settings + self.managed_network = managed_network class WorkspaceConnectionAccessKey(msrest.serialization.Model): @@ -25734,6 +26145,46 @@ def __init__( self.next_link = next_link +class WorkspacePropertiesManagedNetwork(ManagedNetworkSettings): + """Managed network settings. + + :ivar isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :ivar network_id: + :vartype network_id: str + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + + _attribute_map = { + 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, + 'network_id': {'key': 'networkId', 'type': 'str'}, + 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, + } + + def __init__( + self, + *, + isolation_mode: Optional[Union[str, "ManagedNetworkSettingsIsolationMode"]] = None, + network_id: Optional[str] = None, + outbound_rules: Optional[Dict[str, "OutboundRule"]] = None, + **kwargs + ): + """ + :keyword isolation_mode: Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or + ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettingsIsolationMode + :keyword network_id: + :paramtype network_id: str + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + """ + super(WorkspacePropertiesManagedNetwork, self).__init__(isolation_mode=isolation_mode, network_id=network_id, outbound_rules=outbound_rules, **kwargs) + + class WorkspaceUpdateParameters(msrest.serialization.Model): """The parameters for updating a machine learning workspace. @@ -25765,6 +26216,8 @@ class WorkspaceUpdateParameters(msrest.serialization.Model): :vartype container_registry: str :ivar encryption: The encryption settings of the workspace. :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :ivar managed_network: Managed network settings. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :ivar feature_store_settings: Settings for feature store type workspace. :vartype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings @@ -25783,6 +26236,7 @@ class WorkspaceUpdateParameters(msrest.serialization.Model): 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionUpdateProperties'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, } @@ -25801,6 +26255,7 @@ def __init__( application_insights: Optional[str] = None, container_registry: Optional[str] = None, encryption: Optional["EncryptionUpdateProperties"] = None, + managed_network: Optional["ManagedNetworkSettings"] = None, feature_store_settings: Optional["FeatureStoreSettings"] = None, **kwargs ): @@ -25834,6 +26289,8 @@ def __init__( :paramtype container_registry: str :keyword encryption: The encryption settings of the workspace. :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :keyword managed_network: Managed network settings. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :keyword feature_store_settings: Settings for feature store type workspace. :paramtype feature_store_settings: ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings @@ -25851,4 +26308,5 @@ def __init__( self.application_insights = application_insights self.container_registry = container_registry self.encryption = encryption + self.managed_network = managed_network self.feature_store_settings = feature_store_settings diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/__init__.py index 01fa2d886d14..fdeb50af974b 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/__init__.py @@ -15,6 +15,8 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._managed_network_settings_operations import ManagedNetworkSettingsOperations +from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations from ._registry_code_containers_operations import RegistryCodeContainersOperations @@ -54,6 +56,8 @@ 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'WorkspaceConnectionsOperations', + 'ManagedNetworkSettingsOperations', + 'ManagedNetworkSettingsRuleOperations', 'RegistriesOperations', 'WorkspaceFeaturesOperations', 'RegistryCodeContainersOperations', diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_managed_network_settings_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_managed_network_settings_operations.py new file mode 100644 index 000000000000..277b53ef483b --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_managed_network_settings_operations.py @@ -0,0 +1,466 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ManagedNetworkSettingsOperations(object): + """ManagedNetworkSettingsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagedNetworkSettings" + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedNetworkSettings, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedNetworkSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedNetworkSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + + def _update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + body, # type: "_models.ManagedNetworkDto" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'ManagedNetworkDto') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + + @distributed_trace + def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + body, # type: "_models.ManagedNetworkDto" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkDto + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + def _create_or_update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + body, # type: "_models.ManagedNetworkDto" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'ManagedNetworkDto') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore + + + @distributed_trace + def begin_create_or_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + body, # type: "_models.ManagedNetworkDto" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkDto + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_managed_network_settings_rule_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_managed_network_settings_rule_operations.py new file mode 100644 index 000000000000..de8164971606 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_managed_network_settings_rule_operations.py @@ -0,0 +1,406 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ManagedNetworkSettingsRuleOperations(object): + """ManagedNetworkSettingsRuleOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Dict[str, "_models.OutboundRule"] + """list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: dict mapping str to OutboundRule, or the result of cls(response) + :rtype: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.OutboundRule"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('{OutboundRule}', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param rule_name: + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OutboundRule" + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param rule_name: + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundRule, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.OutboundRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OutboundRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_asset_schema.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_asset_schema.py index 7311510e4cc9..4d9a3ab171ae 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_asset_schema.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_asset_schema.py @@ -18,6 +18,7 @@ class DataAssetSchema(metaclass=PatchedSchemaMeta): name = fields.Str() path = fields.Str() version = fields.Int() + data_id = fields.Str() @post_load def make(self, data: Any, **kwargs: Any) -> Any: # pylint: disable=unused-argument diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_collector_schema.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_collector_schema.py index 2ca0d037afd1..0c4fb1965623 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_collector_schema.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/data_collector_schema.py @@ -23,7 +23,7 @@ class DataCollectorSchema(metaclass=PatchedSchemaMeta): collections = fields.Mapping(fields.Str, NestedField(DeploymentCollectionSchema)) rolling_rate = StringTransformedEnum( required=False, - allowed_values=[ RollingRate.MINUTE, RollingRate.DAY, RollingRate.HOUR], + allowed_values=[RollingRate.MINUTE, RollingRate.DAY, RollingRate.HOUR], ) destination = NestedField(DestinationSchema) sampling_rate = fields.Float() diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/deployment_collection_schema.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/deployment_collection_schema.py index fb7dad0f5064..41b624b9ace4 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/deployment_collection_schema.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/deployment_collection_schema.py @@ -15,10 +15,7 @@ class DeploymentCollectionSchema(metaclass=PatchedSchemaMeta): - enabled = StringTransformedEnum( - required= True, - allowed_values=[Boolean.TRUE, Boolean.FALSE] - ) + enabled = StringTransformedEnum(required=True, allowed_values=[Boolean.TRUE, Boolean.FALSE]) data = NestedField(DataAssetSchema) # pylint: disable=unused-argument,no-self-use diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/payload_response_schema.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/payload_response_schema.py index ed4c19f24827..e1dd1ae267a5 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/payload_response_schema.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/online/payload_response_schema.py @@ -14,10 +14,7 @@ class PayloadResponseSchema(metaclass=PatchedSchemaMeta): - enabled = StringTransformedEnum( - required= True, - allowed_values=[Boolean.TRUE, Boolean.FALSE] - ) + enabled = StringTransformedEnum(required=True, allowed_values=[Boolean.TRUE, Boolean.FALSE]) # pylint: disable=unused-argument,no-self-use @post_load diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_endpoint/endpoint.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_endpoint/endpoint.py index e0b896b40f7c..1ff43338bc74 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_endpoint/endpoint.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_endpoint/endpoint.py @@ -18,10 +18,7 @@ class EndpointSchema(PathAwareSchema): id = fields.Str() - name = fields.Str( - required=True, - validate=validate.Regexp(EndpointConfigurations.NAME_REGEX_PATTERN) - ) + name = fields.Str(required=True, validate=validate.Regexp(EndpointConfigurations.NAME_REGEX_PATTERN)) description = fields.Str(metadata={"description": "Description of the inference endpoint."}) tags = fields.Dict() provisioning_state = fields.Str(metadata={"description": "Provisioning state for the endpoint."}) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/assets/environment.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/assets/environment.py index 273ff477765a..b3034bff5539 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/assets/environment.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/assets/environment.py @@ -75,9 +75,7 @@ class _BaseEnvironmentSchema(AssetSchema): ) build = NestedField( BuildContextSchema, - metadata={ - "description": "Docker build context to create the environment. Mutually exclusive with image" - }, + metadata={"description": "Docker build context to create the environment. Mutually exclusive with image"}, ) image = fields.Str() conda_file = UnionField([fields.Raw(), fields.Str()]) @@ -101,9 +99,7 @@ def pre_load(self, data, **kwargs): # validates that "channels" and "dependencies" are not included in the data creation. # These properties should only be on environment conda files not in the environment creation file if "channels" in data or "dependencies" in data: - environmentMessage = CREATE_ENVIRONMENT_ERROR_MESSAGE.format( - YAMLRefDocLinks.ENVIRONMENT - ) + environmentMessage = CREATE_ENVIRONMENT_ERROR_MESSAGE.format(YAMLRefDocLinks.ENVIRONMENT) raise ValidationError(environmentMessage) return data diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/__init__.py index 9d7867c513e7..ca2d9f01ca26 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/__init__.py @@ -9,11 +9,18 @@ from .import_component import AnonymousImportComponentSchema, ImportComponentFileRefField, ImportComponentSchema from .parallel_component import AnonymousParallelComponentSchema, ParallelComponentFileRefField, ParallelComponentSchema from .spark_component import AnonymousSparkComponentSchema, SparkComponentFileRefField, SparkComponentSchema -from .data_transfer_component import AnonymousDataTransferCopyComponentSchema, DataTransferCopyComponentFileRefField, \ - DataTransferCopyComponentSchema, AnonymousDataTransferImportComponentSchema, \ - DataTransferImportComponentFileRefField, DataTransferImportComponentSchema, \ - AnonymousDataTransferExportComponentSchema, DataTransferExportComponentFileRefField, \ - DataTransferExportComponentSchema +from .data_transfer_component import ( + AnonymousDataTransferCopyComponentSchema, + DataTransferCopyComponentFileRefField, + DataTransferCopyComponentSchema, + AnonymousDataTransferImportComponentSchema, + DataTransferImportComponentFileRefField, + DataTransferImportComponentSchema, + AnonymousDataTransferExportComponentSchema, + DataTransferExportComponentFileRefField, + DataTransferExportComponentSchema, +) + __all__ = [ "ComponentSchema", "CommandComponentSchema", diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/data_transfer_component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/data_transfer_component.py index 68ebce3c3f1b..e0e569ea9187 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/data_transfer_component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/data_transfer_component.py @@ -15,8 +15,13 @@ from azure.ai.ml._schema.core.schema_meta import PatchedSchemaMeta from azure.ai.ml._schema.core.fields import FileRefField, StringTransformedEnum, NestedField from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY, AssetTypes -from azure.ai.ml.constants._component import ComponentSource, NodeType, DataTransferTaskType, DataCopyMode, \ - ExternalDataType +from azure.ai.ml.constants._component import ( + ComponentSource, + NodeType, + DataTransferTaskType, + DataCopyMode, + ExternalDataType, +) class DataTransferComponentSchemaMixin(ComponentSchema): @@ -25,8 +30,9 @@ class DataTransferComponentSchemaMixin(ComponentSchema): class DataTransferCopyComponentSchema(DataTransferComponentSchemaMixin): task = StringTransformedEnum(allowed_values=[DataTransferTaskType.COPY_DATA], required=True) - data_copy_mode = StringTransformedEnum(allowed_values=[DataCopyMode.MERGE_WITH_OVERWRITE, - DataCopyMode.FAIL_IF_CONFLICT]) + data_copy_mode = StringTransformedEnum( + allowed_values=[DataCopyMode.MERGE_WITH_OVERWRITE, DataCopyMode.FAIL_IF_CONFLICT] + ) inputs = fields.Dict( keys=fields.Str(), values=NestedField(InputPortSchema), @@ -34,24 +40,25 @@ class DataTransferCopyComponentSchema(DataTransferComponentSchemaMixin): class SinkSourceSchema(metaclass=PatchedSchemaMeta): - type = StringTransformedEnum(allowed_values=[ExternalDataType.FILE_SYSTEM, ExternalDataType.DATABASE], - required=True) + type = StringTransformedEnum( + allowed_values=[ExternalDataType.FILE_SYSTEM, ExternalDataType.DATABASE], required=True + ) class SourceInputsSchema(metaclass=PatchedSchemaMeta): """ For export task in DataTransfer, inputs type only support uri_file for database and uri_folder for filesystem. """ - type = StringTransformedEnum(allowed_values=[AssetTypes.URI_FOLDER, AssetTypes.URI_FILE], - required=True) + + type = StringTransformedEnum(allowed_values=[AssetTypes.URI_FOLDER, AssetTypes.URI_FILE], required=True) class SinkOutputsSchema(metaclass=PatchedSchemaMeta): """ For import task in DataTransfer, outputs type only support mltable for database and uri_folder for filesystem; """ - type = StringTransformedEnum(allowed_values=[AssetTypes.MLTABLE, AssetTypes.URI_FOLDER], - required=True) + + type = StringTransformedEnum(allowed_values=[AssetTypes.MLTABLE, AssetTypes.URI_FOLDER], required=True) class DataTransferImportComponentSchema(DataTransferComponentSchemaMixin): @@ -64,14 +71,15 @@ class DataTransferImportComponentSchema(DataTransferComponentSchemaMixin): @validates("inputs") def inputs_key(self, value): - raise ValidationError(f"inputs field is not a valid filed in task type " - f"{DataTransferTaskType.IMPORT_DATA}.") + raise ValidationError(f"inputs field is not a valid filed in task type " f"{DataTransferTaskType.IMPORT_DATA}.") @validates("outputs") def outputs_key(self, value): if len(value) != 1 or value and list(value.keys())[0] != "sink": - raise ValidationError(f"outputs field only support one output called sink in task type " - f"{DataTransferTaskType.IMPORT_DATA}.") + raise ValidationError( + f"outputs field only support one output called sink in task type " + f"{DataTransferTaskType.IMPORT_DATA}." + ) class DataTransferExportComponentSchema(DataTransferComponentSchemaMixin): @@ -85,13 +93,16 @@ class DataTransferExportComponentSchema(DataTransferComponentSchemaMixin): @validates("inputs") def inputs_key(self, value): if len(value) != 1 or value and list(value.keys())[0] != "source": - raise ValidationError(f"inputs field only support one input called source in task type " - f"{DataTransferTaskType.EXPORT_DATA}.") + raise ValidationError( + f"inputs field only support one input called source in task type " + f"{DataTransferTaskType.EXPORT_DATA}." + ) @validates("outputs") def outputs_key(self, value): - raise ValidationError(f"outputs field is not a valid filed in task type " - f"{DataTransferTaskType.EXPORT_DATA}.") + raise ValidationError( + f"outputs field is not a valid filed in task type " f"{DataTransferTaskType.EXPORT_DATA}." + ) class RestDataTransferCopyComponentSchema(DataTransferCopyComponentSchema): diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/aml_compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/aml_compute.py index 83b65aebfb3f..f3ba226ab2bf 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/aml_compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/aml_compute.py @@ -29,9 +29,7 @@ def make(self, data, **kwargs): class AmlComputeSchema(ComputeSchema): type = StringTransformedEnum(allowed_values=[ComputeType.AMLCOMPUTE], required=True) size = fields.Str() - tier = StringTransformedEnum( - allowed_values=[ComputeTier.LOWPRIORITY, ComputeTier.DEDICATED] - ) + tier = StringTransformedEnum(allowed_values=[ComputeTier.LOWPRIORITY, ComputeTier.DEDICATED]) min_instances = fields.Int() max_instances = fields.Int() idle_time_before_scale_down = fields.Int() @@ -40,7 +38,5 @@ class AmlComputeSchema(ComputeSchema): network_settings = NestedField(NetworkSettingsSchema) identity = NestedField(IdentitySchema) enable_node_public_ip = fields.Bool( - metadata={ - "description": "Enable or disable node public IP address provisioning." - } + metadata={"description": "Enable or disable node public IP address provisioning."} ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute.py index f750346d23dd..6d43425be110 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute.py @@ -24,6 +24,7 @@ class ComputeSchema(PathAwareSchema): created_on = fields.Str(dump_only=True) provisioning_state = fields.Str(dump_only=True) resource_id = fields.Str() + tags = fields.Dict(keys=fields.Str(), values=fields.Str()) class NetworkSettingsSchema(PathAwareSchema): diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute_instance.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute_instance.py index 344a60adc874..f7cd68bacb0c 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute_instance.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/compute/compute_instance.py @@ -52,9 +52,7 @@ def make(self, data, **kwargs): class ComputeInstanceSchema(ComputeSchema): - type = StringTransformedEnum( - allowed_values=[ComputeType.COMPUTEINSTANCE], required=True - ) + type = StringTransformedEnum(allowed_values=[ComputeType.COMPUTEINSTANCE], required=True) size = fields.Str() network_settings = NestedField(NetworkSettingsSchema) create_on_behalf_of = NestedField(CreateOnBehalfOfSchema) @@ -62,20 +60,14 @@ class ComputeInstanceSchema(ComputeSchema): ssh_public_access_enabled = fields.Bool(dump_default=None) state = fields.Str(dump_only=True) last_operation = fields.Dict(keys=fields.Str(), values=fields.Str(), dump_only=True) - services = fields.List( - fields.Dict(keys=fields.Str(), values=fields.Str()), dump_only=True - ) + services = fields.List(fields.Dict(keys=fields.Str(), values=fields.Str()), dump_only=True) schedules = NestedField(ComputeSchedulesSchema) identity = ExperimentalField(NestedField(IdentitySchema)) idle_time_before_shutdown = ExperimentalField(fields.Str()) idle_time_before_shutdown_minutes = ExperimentalField(fields.Int()) custom_applications = ExperimentalField(fields.List(NestedField(CustomApplicationsSchema))) setup_scripts = ExperimentalField(NestedField(SetupScriptsSchema)) - os_image_metadata = ExperimentalField( - NestedField(OsImageMetadataSchema, dump_only=True) - ) + os_image_metadata = ExperimentalField(NestedField(OsImageMetadataSchema, dump_only=True)) enable_node_public_ip = fields.Bool( - metadata={ - "description": "Enable or disable node public IP address provisioning." - } + metadata={"description": "Enable or disable node public IP address provisioning."} ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py index b23ceb90e1f3..43ff86ec485c 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py @@ -83,24 +83,14 @@ def _jsonschema_type_mapping(self): def _serialize(self, value, attr, obj, **kwargs): if not value: return - if ( - isinstance(value, str) - and self.casing_transform(value) in self.allowed_values - ): + if isinstance(value, str) and self.casing_transform(value) in self.allowed_values: return value if self.pass_original else self.casing_transform(value) - raise ValidationError( - f"Value {value!r} passed is not in set {self.allowed_values}" - ) + raise ValidationError(f"Value {value!r} passed is not in set {self.allowed_values}") def _deserialize(self, value, attr, data, **kwargs): - if ( - isinstance(value, str) - and self.casing_transform(value) in self.allowed_values - ): + if isinstance(value, str) and self.casing_transform(value) in self.allowed_values: return value if self.pass_original else self.casing_transform(value) - raise ValidationError( - f"Value {value!r} passed is not in set {self.allowed_values}" - ) + raise ValidationError(f"Value {value!r} passed is not in set {self.allowed_values}") class DumpableEnumField(StringTransformedEnum): @@ -141,14 +131,20 @@ def _resolve_path(self, value) -> Path: """Resolve path to absolute path based on base_path in context. Will resolve the path if it's already an absolute path. """ - result = Path(value) - base_path = Path(self.context[BASE_PATH_CONTEXT_KEY]) - if not result.is_absolute(): - result = base_path / result try: - return result.resolve() + result = Path(value) + base_path = Path(self.context[BASE_PATH_CONTEXT_KEY]) + if not result.is_absolute(): + result = base_path / result + + # for non-path string like "azureml:/xxx", OSError can be raised in either + # resolve() or is_dir() or is_file() + result = result.resolve() + if (self._allow_dir and result.is_dir()) or (self._allow_file and result.is_file()): + return result except OSError: raise self.make_error("invalid_path") + raise self.make_error("path_not_exist", path=result.as_posix(), allow_type=self.allowed_path_type) @property def allowed_path_type(self) -> str: @@ -164,23 +160,14 @@ def _validate(self, value): if value is None: return - path = self._resolve_path(value) - if (self._allow_dir and path.is_dir()) or (self._allow_file and path.is_file()): - return - raise self.make_error( - "path_not_exist", path=path.as_posix(), allow_type=self.allowed_path_type - ) + self._resolve_path(value) def _serialize(self, value, attr, obj, **kwargs) -> typing.Optional[str]: # do not block serializing None even if required or not allow_none. if value is None: return None - self._validate(value) # always dump path as absolute path in string as base_path will be dropped after serialization - return super(LocalPathField, self)._serialize( - self._resolve_path(value).as_posix(), attr, obj, **kwargs - ) - + return super(LocalPathField, self)._serialize(self._resolve_path(value).as_posix(), attr, obj, **kwargs) class SerializeValidatedUrl(fields.Url): @@ -273,9 +260,7 @@ def _validate(self, value): try: from_iso_datetime(value) except Exception: - raise ValidationError( - f"Not a valid ISO8601-formatted datetime string: {value}" - ) + raise ValidationError(f"Not a valid ISO8601-formatted datetime string: {value}") class ArmStr(Field): @@ -317,9 +302,7 @@ def _deserialize(self, value, attr, data, **kwargs): if self.azureml_type is not None: azureml_type_suffix = self.azureml_type else: - azureml_type_suffix = ( - "" + "//)" - ) + azureml_type_suffix = "" + "//)" raise ValidationError( f"In order to specify an existing {self.azureml_type if self.azureml_type is not None else 'asset'}, " "please provide either of the following prefixed with 'azureml:':\n" @@ -363,9 +346,7 @@ def _deserialize(self, value, attr, data, **kwargs): if not (label or version): if self.allow_default_version: return name - raise ValidationError( - f"Either version or label is not provided for {attr} or the id is not valid." - ) + raise ValidationError(f"Either version or label is not provided for {attr} or the id is not valid.") if version: return f"{name}:{version}" @@ -452,16 +433,12 @@ def __init__(self, union_fields: List[fields.Field], is_strict=False, **kwargs): try: # add the validation and make sure union_fields must be subclasses or instances of # marshmallow.base.FieldABC - self._union_fields = [ - resolve_field_instance(cls_or_instance) - for cls_or_instance in union_fields - ] + self._union_fields = [resolve_field_instance(cls_or_instance) for cls_or_instance in union_fields] # TODO: make serialization/de-serialization work in the same way as json schema when is_strict is True self.is_strict = is_strict # S\When True, combine fields with oneOf instead of anyOf at schema generation except FieldInstanceResolutionError as error: raise ValueError( - 'Elements of "union_fields" must be subclasses or ' - "instances of marshmallow.base.FieldABC." + 'Elements of "union_fields" must be subclasses or ' "instances of marshmallow.base.FieldABC." ) from error @property @@ -521,13 +498,9 @@ def _deserialize(self, value, attr, data, **kwargs): and isinstance(schema.schema, PathAwareSchema) ): # use old base path to recover original base path - schema.schema.context[ - BASE_PATH_CONTEXT_KEY - ] = schema.schema.old_base_path + schema.schema.context[BASE_PATH_CONTEXT_KEY] = schema.schema.old_base_path # recover base path of parent schema - schema.context[BASE_PATH_CONTEXT_KEY] = schema.schema.context[ - BASE_PATH_CONTEXT_KEY - ] + schema.context[BASE_PATH_CONTEXT_KEY] = schema.schema.context[BASE_PATH_CONTEXT_KEY] raise ValidationError(errors, field_name=attr) @@ -565,8 +538,7 @@ def __init__( for type_name, type_sensitive_fields in type_sensitive_fields_dict.items(): union_fields.extend(type_sensitive_fields) self._type_sensitive_fields_dict[type_name] = [ - resolve_field_instance(cls_or_instance) - for cls_or_instance in type_sensitive_fields + resolve_field_instance(cls_or_instance) for cls_or_instance in type_sensitive_fields ] super(TypeSensitiveUnionField, self).__init__(union_fields, **kwargs) @@ -578,9 +550,7 @@ def _bind_to_schema(self, field_name, schema): type_name, type_sensitive_fields, ) in self._type_sensitive_fields_dict.items(): - self._type_sensitive_fields_dict[type_name] = self._create_bind_fields( - type_sensitive_fields, field_name - ) + self._type_sensitive_fields_dict[type_name] = self._create_bind_fields(type_sensitive_fields, field_name) @property def type_field_name(self) -> str: @@ -602,18 +572,14 @@ def _raise_simplified_error_base_on_type(self, e, value, attr): & its type doesn't match any allowed types, raise "Value {} not in set {}"; If value has type & its type matches at least 1 field, return the first matched error message;""" - value_type = try_get_non_arbitrary_attr_for_potential_attr_dict( - value, self.type_field_name - ) + value_type = try_get_non_arbitrary_attr_for_potential_attr_dict(value, self.type_field_name) if value_type is None: # if value has no type field, raise original error raise e if value_type not in self.allowed_types: # if value has type field but its value doesn't match any allowed value, raise ValidationError directly raise ValidationError( - message={ - self.type_field_name: f"Value {value_type!r} passed is not in set {self.allowed_types}" - }, + message={self.type_field_name: f"Value {value_type!r} passed is not in set {self.allowed_types}"}, field_name=attr, ) # if value has type field and its value match at least 1 allowed value, raise first matched @@ -630,9 +596,7 @@ def _raise_simplified_error_base_on_type(self, e, value, attr): def _serialize(self, value, attr, obj, **kwargs): union_fields = self._union_fields[:] - value_type = try_get_non_arbitrary_attr_for_potential_attr_dict( - value, self.type_field_name - ) + value_type = try_get_non_arbitrary_attr_for_potential_attr_dict(value, self.type_field_name) if value_type is not None and value_type in self.allowed_types: target_fields = self._type_sensitive_fields_dict[value_type] if len(target_fields) == 1: @@ -640,9 +604,7 @@ def _serialize(self, value, attr, obj, **kwargs): self._union_fields = target_fields try: - return super(TypeSensitiveUnionField, self)._serialize( - value, attr, obj, **kwargs - ) + return super(TypeSensitiveUnionField, self)._serialize(value, attr, obj, **kwargs) except ValidationError as e: self._raise_simplified_error_base_on_type(e, value, attr) finally: @@ -670,9 +632,7 @@ def _try_load_from_yaml(self, value): def _deserialize(self, value, attr, data, **kwargs): try: - return super(TypeSensitiveUnionField, self)._deserialize( - value, attr, data, **kwargs - ) + return super(TypeSensitiveUnionField, self)._deserialize(value, attr, data, **kwargs) except ValidationError as e: if isinstance(value, str) and self._allow_load_from_yaml: value = self._try_load_from_yaml(value) @@ -711,9 +671,7 @@ def CodeField(**kwargs): # put arm versioned string at last order as it can deserialize any string into "azureml:" ArmVersionedStr(azureml_type=AzureMLResourceType.CODE), ], - metadata={ - "description": "A local path or http:, https:, azureml: url pointing to a remote location." - }, + metadata={"description": "A local path or http:, https:, azureml: url pointing to a remote location."}, **kwargs, ) @@ -777,9 +735,7 @@ def _deserialize(self, value, attr, data, **kwargs) -> str: class DumpableIntegerField(fields.Integer): - def _serialize( - self, value, attr, obj, **kwargs - ) -> typing.Optional[typing.Union[str, _T]]: + def _serialize(self, value, attr, obj, **kwargs) -> typing.Optional[typing.Union[str, _T]]: if self.strict and not isinstance(value, int): # this implementation can serialize bool to bool raise self.make_error("invalid", input=value) @@ -803,16 +759,12 @@ def _validated(self, value): raise self.make_error("invalid", input=value) return super()._validated(value) - def _serialize( - self, value, attr, obj, **kwargs - ) -> typing.Optional[typing.Union[str, _T]]: + def _serialize(self, value, attr, obj, **kwargs) -> typing.Optional[typing.Union[str, _T]]: return super()._serialize(self._validated(value), attr, obj, **kwargs) class DumpableStringField(fields.String): - def _serialize( - self, value, attr, obj, **kwargs - ) -> typing.Optional[typing.Union[str, _T]]: + def _serialize(self, value, attr, obj, **kwargs) -> typing.Optional[typing.Union[str, _T]]: if not isinstance(value, str): raise ValidationError("Given value is not a string") return super()._serialize(value, attr, obj, **kwargs) @@ -826,8 +778,7 @@ def __init__(self, experimental_field: fields.Field, **kwargs): self.required = experimental_field.required except FieldInstanceResolutionError as error: raise ValueError( - '"experimental_field" must be subclasses or ' - "instances of marshmallow.base.FieldABC." + '"experimental_field" must be subclasses or ' "instances of marshmallow.base.FieldABC." ) from error # This sets the parent for the schema and also handles nesting. @@ -842,9 +793,7 @@ def _serialize(self, value, attr, obj, **kwargs): def _deserialize(self, value, attr, data, **kwargs): if value is not None: - message = "Field '{0}': {1} {2}".format( - attr, EXPERIMENTAL_FIELD_MESSAGE, EXPERIMENTAL_LINK_MESSAGE - ) + message = "Field '{0}': {1} {2}".format(attr, EXPERIMENTAL_FIELD_MESSAGE, EXPERIMENTAL_LINK_MESSAGE) if not _is_warning_cached(message): module_logger.warning(message) @@ -953,6 +902,4 @@ def _serialize(self, value, attr, obj, **kwargs): def _deserialize(self, value, attr, data, **kwargs): if isinstance(value, str) and value.startswith("git+"): return value - raise ValidationError( - "In order to specify a git path, please provide the correct path prefixed with 'git+\n" - ) + raise ValidationError("In order to specify a git path, please provide the correct path prefixed with 'git+\n") diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/data_transfer_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/data_transfer_job.py index 48a4aa32e47e..2bc56df1777d 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/data_transfer_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/data_transfer_job.py @@ -16,8 +16,9 @@ class DataTransferCopyJobSchema(BaseJobSchema): type = StringTransformedEnum(required=True, allowed_values=JobType.DATA_TRANSFER) task = StringTransformedEnum(allowed_values=[DataTransferTaskType.COPY_DATA], required=True) - data_copy_mode = StringTransformedEnum(allowed_values=[DataCopyMode.MERGE_WITH_OVERWRITE, - DataCopyMode.FAIL_IF_CONFLICT]) + data_copy_mode = StringTransformedEnum( + allowed_values=[DataCopyMode.MERGE_WITH_OVERWRITE, DataCopyMode.FAIL_IF_CONFLICT] + ) compute = ComputeField() inputs = InputsField() outputs = OutputsField() @@ -25,7 +26,7 @@ class DataTransferCopyJobSchema(BaseJobSchema): class DataTransferImportJobSchema(BaseJobSchema): type = StringTransformedEnum(required=True, allowed_values=JobType.DATA_TRANSFER) - task = StringTransformedEnum(allowed_values=[DataTransferTaskType.IMPORT_DATA], required=True) + task = StringTransformedEnum(allowed_values=[DataTransferTaskType.IMPORT_DATA], required=True) compute = ComputeField() outputs = fields.Dict( keys=fields.Str(), @@ -37,13 +38,15 @@ class DataTransferImportJobSchema(BaseJobSchema): @validates("outputs") def outputs_key(self, value): # pylint: disable=no-self-use if len(value) != 1 or list(value.keys())[0] != "sink": - raise ValidationError(f"outputs field only support one output called sink in task type " - f"{DataTransferTaskType.IMPORT_DATA}.") + raise ValidationError( + f"outputs field only support one output called sink in task type " + f"{DataTransferTaskType.IMPORT_DATA}." + ) class DataTransferExportJobSchema(BaseJobSchema): type = StringTransformedEnum(required=True, allowed_values=JobType.DATA_TRANSFER) - task = StringTransformedEnum(allowed_values=[DataTransferTaskType.EXPORT_DATA], required=True) + task = StringTransformedEnum(allowed_values=[DataTransferTaskType.EXPORT_DATA], required=True) compute = ComputeField() inputs = InputsField(allow_none=False) sink = UnionField([NestedField(DatabaseSchema), NestedField(FileSystemSchema)], required=True, allow_none=False) @@ -51,5 +54,7 @@ class DataTransferExportJobSchema(BaseJobSchema): @validates("inputs") def inputs_key(self, value): # pylint: disable=no-self-use if len(value) != 1 or list(value.keys())[0] != "source": - raise ValidationError(f"inputs field only support one input called source in task type " - f"{DataTransferTaskType.EXPORT_DATA}.") + raise ValidationError( + f"inputs field only support one input called source in task type " + f"{DataTransferTaskType.EXPORT_DATA}." + ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_entry.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_entry.py index f27e8d8dcc15..3e8aa99542ba 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_entry.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_entry.py @@ -51,7 +51,9 @@ def generate_path_property(azureml_type): fields.Str(metadata={"pattern": r"^(http(s)?):.*"}), fields.Str(metadata={"pattern": r"^(wasb(s)?):.*"}), LocalPathField(pattern=r"^file:.*"), - LocalPathField(pattern=r"^(?!(azureml|http(s)?|wasb(s)?|file):).*",), + LocalPathField( + pattern=r"^(?!(azureml|http(s)?|wasb(s)?|file):).*", + ), ], is_strict=True, ) @@ -104,7 +106,6 @@ class DataInputSchema(InputSchema): datastore = generate_datastore_property() - class MLTableInputSchema(InputSchema): mode = StringTransformedEnum( allowed_values=[ @@ -121,7 +122,6 @@ class MLTableInputSchema(InputSchema): datastore = generate_datastore_property() - class InputLiteralValueSchema(metaclass=PatchedSchemaMeta): value = UnionField([fields.Str(), fields.Bool(), fields.Int(), fields.Float()]) @@ -191,17 +191,10 @@ def check_dict(self, data, **kwargs): class DatabaseSchema(metaclass=PatchedSchemaMeta): - type = StringTransformedEnum( - allowed_values=[ - ExternalDataType.DATABASE - ], - required=True - ) + type = StringTransformedEnum(allowed_values=[ExternalDataType.DATABASE], required=True) table_name = fields.Str() query = fields.Str( - metadata={ - "description": "The sql query command." - }, + metadata={"description": "The sql query command."}, ) stored_procedure = fields.Str() stored_procedure_params = fields.List(NestedField(StoredProcedureParamsSchema)) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_fields_provider.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_fields_provider.py index c59ec0dd4411..7fb2e8e014d6 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_fields_provider.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/input_output_fields_provider.py @@ -37,12 +37,7 @@ def InputsField(*, support_databinding: bool = False, **kwargs): return fields.Dict( keys=fields.Str(), - values=UnionField( - value_fields, - metadata={"description": "Inputs to a job."}, - is_strict=True, - **kwargs - ), + values=UnionField(value_fields, metadata={"description": "Inputs to a job."}, is_strict=True, **kwargs), ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/__init__.py index b4598f6f4643..a19931cd30e6 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/__init__.py @@ -4,7 +4,14 @@ # pylint: disable=unused-import __path__ = __import__("pkgutil").extend_path(__path__, __name__) -from .component_job import CommandSchema, ImportSchema, ParallelSchema, SparkSchema, DataTransferCopySchema, \ - DataTransferImportSchema, DataTransferExportSchema +from .component_job import ( + CommandSchema, + ImportSchema, + ParallelSchema, + SparkSchema, + DataTransferCopySchema, + DataTransferImportSchema, + DataTransferExportSchema, +) from .pipeline_job import PipelineJobSchema from .settings import PipelineJobSettingsSchema diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/component_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/component_job.py index 75e61f857b0a..a06135e81aa8 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/component_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/component_job.py @@ -440,21 +440,20 @@ class DataTransferImportSchema(BaseNodeSchema): compute = ComputeField() source = UnionField([NestedField(DatabaseSchema), NestedField(FileSystemSchema)], required=True, allow_none=False) outputs = fields.Dict( - keys=fields.Str(), - values=UnionField([OutputBindingStr, NestedField(OutputSchema)]), - allow_none=False + keys=fields.Str(), values=UnionField([OutputBindingStr, NestedField(OutputSchema)]), allow_none=False ) @validates("inputs") def inputs_key(self, value): - raise ValidationError(f"inputs field is not a valid filed in task type " - f"{DataTransferTaskType.IMPORT_DATA}.") + raise ValidationError(f"inputs field is not a valid filed in task type " f"{DataTransferTaskType.IMPORT_DATA}.") @validates("outputs") def outputs_key(self, value): if len(value) != 1 or list(value.keys())[0] != "sink": - raise ValidationError(f"outputs field only support one output called sink in task type " - f"{DataTransferTaskType.IMPORT_DATA}.") + raise ValidationError( + f"outputs field only support one output called sink in task type " + f"{DataTransferTaskType.IMPORT_DATA}." + ) @post_load def make(self, data, **kwargs) -> "DataTransferImport": @@ -504,13 +503,16 @@ class DataTransferExportSchema(BaseNodeSchema): @validates("inputs") def inputs_key(self, value): if len(value) != 1 or list(value.keys())[0] != "source": - raise ValidationError(f"inputs field only support one input called source in task type " - f"{DataTransferTaskType.EXPORT_DATA}.") + raise ValidationError( + f"inputs field only support one input called source in task type " + f"{DataTransferTaskType.EXPORT_DATA}." + ) @validates("outputs") def outputs_key(self, value): - raise ValidationError(f"outputs field is not a valid filed in task type " - f"{DataTransferTaskType.EXPORT_DATA}.") + raise ValidationError( + f"outputs field is not a valid filed in task type " f"{DataTransferTaskType.EXPORT_DATA}." + ) @post_load def make(self, data, **kwargs) -> "DataTransferExport": diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/control_flow_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/control_flow_job.py index 69661d289333..4f47960864d9 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/control_flow_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/control_flow_job.py @@ -106,7 +106,7 @@ def load_items(self, data, **kwargs): # pylint: disable=no-self-use, unused-arg if isinstance(items, str): items = json.loads(items) data["items"] = items - except Exception: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except pass return data diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_component.py index 1bc5b6ee3bb1..ba529d1862ae 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_component.py @@ -41,8 +41,11 @@ from azure.ai.ml._schema.pipeline.pipeline_import_job import PipelineImportJobSchema from azure.ai.ml._schema.pipeline.pipeline_parallel_job import PipelineParallelJobSchema from azure.ai.ml._schema.pipeline.pipeline_spark_job import PipelineSparkJobSchema -from azure.ai.ml._schema.pipeline.pipeline_datatransfer_job import PipelineDataTransferCopyJobSchema, \ - PipelineDataTransferImportJobSchema, PipelineDataTransferExportJobSchema +from azure.ai.ml._schema.pipeline.pipeline_datatransfer_job import ( + PipelineDataTransferCopyJobSchema, + PipelineDataTransferImportJobSchema, + PipelineDataTransferExportJobSchema, +) from azure.ai.ml._utils.utils import is_private_preview_enabled from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY, AzureMLResourceType from azure.ai.ml.constants._component import ( @@ -133,9 +136,7 @@ def _post_load_pipeline_jobs(context, data: dict) -> dict: job_type = job_instance.get("type") if job_type == ControlFlowType.IF_ELSE: # Convert to if-else node. - job_instance = ConditionNode._create_instance_from_schema_dict( - loaded_data=job_instance - ) + job_instance = ConditionNode._create_instance_from_schema_dict(loaded_data=job_instance) elif job_instance.get("type") == ControlFlowType.DO_WHILE: # Convert to do-while node. job_instance = DoWhile._create_instance_from_schema_dict( @@ -156,8 +157,9 @@ def _post_load_pipeline_jobs(context, data: dict) -> dict: context=context, pipeline_job_dict=data, ) - if not (job_instance.type == NodeType.DATA_TRANSFER and job_instance.task != - DataTransferTaskType.COPY_DATA): + if not ( + job_instance.type == NodeType.DATA_TRANSFER and job_instance.task != DataTransferTaskType.COPY_DATA + ): job_instance.component._source = ComponentSource.YAML_JOB job_instance._source = job_instance.component._source jobs[key] = job_instance diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_datatransfer_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_datatransfer_job.py index ffe4b6c394ec..b20b949e4ec6 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_datatransfer_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_datatransfer_job.py @@ -11,8 +11,11 @@ from azure.ai.ml._schema.core.fields import NestedField, UnionField from azure.ai.ml._schema.job.input_output_entry import OutputSchema -from azure.ai.ml._schema.job.data_transfer_job import DataTransferCopyJobSchema, DataTransferImportJobSchema, \ - DataTransferExportJobSchema +from azure.ai.ml._schema.job.data_transfer_job import ( + DataTransferCopyJobSchema, + DataTransferImportJobSchema, + DataTransferExportJobSchema, +) module_logger = logging.getLogger(__name__) @@ -44,7 +47,6 @@ def make(self, data: Any, **kwargs: Any): class PipelineDataTransferExportJobSchema(DataTransferExportJobSchema): - @post_load def make(self, data: Any, **kwargs: Any): from azure.ai.ml.entities._job.data_transfer.data_transfer_job import DataTransferExportJob diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_job_io.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_job_io.py index 93b080a0db9f..ecfc02e9a22b 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_job_io.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/pipeline/pipeline_job_io.py @@ -40,8 +40,13 @@ def _serialize(self, value, attr, obj, **kwargs): raise ValidationError(f"Invalid output binding string '{value}' passed") def _deserialize(self, value, attr, data, **kwargs): - if isinstance(value, dict) and "path" in value and "mode" not in value and \ - 'name' not in value and 'version' not in value: + if ( + isinstance(value, dict) + and "path" in value + and "mode" not in value + and "name" not in value + and "version" not in value + ): value = value["path"] if isinstance(value, str) and re.match(ComponentJobConstants.OUTPUT_PATTERN, value): return value diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/identity.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/identity.py index fcfbdc004bd6..88f57643eccb 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/identity.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/identity.py @@ -48,7 +48,8 @@ def predump(self, data, **kwargs): @post_load def make(self, data, **kwargs): - data["user_assigned_identities"] = self.uai_dict2list(data.pop("user_assigned_identities")) + if data.get("user_assigned_identities", False): + data["user_assigned_identities"] = self.uai_dict2list(data.pop("user_assigned_identities")) data["type"] = snake_to_camel(data.pop("type")) return IdentityConfiguration(**data) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/networking.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/networking.py new file mode 100644 index 000000000000..e61974ab3449 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/networking.py @@ -0,0 +1,124 @@ +# --------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# --------------------------------------------------------- + +# pylint: disable=unused-argument,no-self-use,no-else-return + +from marshmallow import fields +from marshmallow.decorators import post_load, pre_dump +from azure.ai.ml._schema.core.schema_meta import PatchedSchemaMeta +from azure.ai.ml._schema.core.fields import StringTransformedEnum +from azure.ai.ml._schema.core.fields import NestedField +from azure.ai.ml.entities._workspace.networking import ( + ManagedNetwork, + OutboundRule, + FqdnDestination, + ServiceTagDestination, + PrivateEndpointDestination, +) +from azure.ai.ml.constants._workspace import IsolationMode, OutboundRuleCategory, OutboundRuleType +from azure.ai.ml._utils.utils import camel_to_snake, _snake_to_camel + +from azure.ai.ml._utils._experimental import experimental + + +@experimental +class DestinationSchema(metaclass=PatchedSchemaMeta): + service_resource_id = fields.Str() + subresource_target = fields.Str() + spark_enabled = fields.Bool() + service_tag = fields.Str() + protocol = fields.Str() + port_ranges = fields.Str() + + +@experimental +class OutboundRuleSchema(metaclass=PatchedSchemaMeta): + type = StringTransformedEnum( + allowed_values=[OutboundRuleType.FQDN, OutboundRuleType.PRIVATE_ENDPOINT, OutboundRuleType.SERVICE_TAG], + casing_transform=camel_to_snake, + metadata={"description": "outbound rule type."}, + ) + destination = fields.Raw(required=True) + category = StringTransformedEnum( + allowed_values=[ + OutboundRuleCategory.REQUIRED, + OutboundRuleCategory.RECOMMENDED, + OutboundRuleCategory.USER_DEFINED, + ], + casing_transform=camel_to_snake, + metadata={"description": "outbound rule category."}, + ) + + @pre_dump + def predump(self, data, **kwargs): + if data and isinstance(data, FqdnDestination): + data.destination = self.fqdn_dest2dict(data.destination) + if data and isinstance(data, PrivateEndpointDestination): + data.destination = self.pe_dest2dict(data.service_resource_id, data.subresource_target, data.spark_enabled) + if data and isinstance(data, ServiceTagDestination): + data.destination = self.service_tag_dest2dict(data.service_tag, data.protocol, data.port_ranges) + return data + + @post_load + def createdestobject(self, data, **kwargs): + dest = data.get("destination", False) + category = data.get("category", OutboundRuleCategory.USER_DEFINED) + if dest: + if isinstance(dest, str): + return FqdnDestination(dest, _snake_to_camel(category)) + else: + if dest.get("subresource_target", False): + return PrivateEndpointDestination( + dest["service_resource_id"], + dest["subresource_target"], + dest["spark_enabled"], + _snake_to_camel(category), + ) + if dest.get("service_tag", False): + return ServiceTagDestination( + dest["service_tag"], dest["protocol"], dest["port_ranges"], _snake_to_camel(category) + ) + return OutboundRule(data) + + def fqdn_dest2dict(self, fqdndest): + res = fqdndest + return res + + def pe_dest2dict(self, service_resource_id, subresource_target, spark_enabled): + pedest = {} + pedest["service_resource_id"] = service_resource_id + pedest["subresource_target"] = subresource_target + pedest["spark_enabled"] = spark_enabled + return pedest + + def service_tag_dest2dict(self, service_tag, protocol, port_ranges): + service_tag_dest = {} + service_tag_dest["service_tag"] = service_tag + service_tag_dest["protocol"] = protocol + service_tag_dest["port_ranges"] = port_ranges + return service_tag_dest + + +@experimental +class ManagedNetworkSchema(metaclass=PatchedSchemaMeta): + isolation_mode = StringTransformedEnum( + allowed_values=[ + IsolationMode.DISABLED, + IsolationMode.ALLOW_INTERNET_OUTBOUND, + IsolationMode.ALLOW_ONLY_APPROVED_OUTBOUND, + ], + casing_transform=camel_to_snake, + metadata={"description": "isolation mode for the workspace managed network."}, + ) + outbound_rules = fields.Dict( + keys=fields.Str(required=True), values=NestedField(OutboundRuleSchema, allow_none=False), allow_none=True + ) + network_id = fields.Str(required=False) + + @post_load + def make(self, data, **kwargs): + if data.get("outbound_rules", False): + return ManagedNetwork(_snake_to_camel(data["isolation_mode"]), data["outbound_rules"]) + else: + return ManagedNetwork(_snake_to_camel(data["isolation_mode"])) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/workspace.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/workspace.py index 37ab37860d3a..fab939ca3fbd 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/workspace.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/workspace.py @@ -11,7 +11,9 @@ from azure.ai.ml._schema.workspace.identity import IdentitySchema from azure.ai.ml._utils.utils import snake_to_pascal from azure.ai.ml.constants._common import PublicNetworkAccess +from azure.ai.ml._schema.workspace.networking import ManagedNetworkSchema +from azure.ai.ml._schema import ExperimentalField class WorkspaceSchema(PathAwareSchema): name = fields.Str(required=True) @@ -36,3 +38,4 @@ class WorkspaceSchema(PathAwareSchema): ) identity = NestedField(IdentitySchema) primary_user_assigned_identity = fields.Str() + managed_network = ExperimentalField(NestedField(ManagedNetworkSchema)) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_appinsights_utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_appinsights_utils.py index 67d5ffd33556..2d6bd0914e4c 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_appinsights_utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_appinsights_utils.py @@ -69,7 +69,9 @@ def get_default_resource_group_deployment(deployment_name: str, location: str, s "properties": { "mode": "Incremental", "template": { - "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "$schema": ( + "https://schema.management.azure.com/schemas/2018-05-01/" + "subscriptionDeploymentTemplate.json#" + ), "contentVersion": "1.0.0.1", "parameters": {}, "variables": {}, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py index f4185346bb1e..7f4d58f51c92 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py @@ -439,8 +439,7 @@ def get_directory_size(root: os.PathLike, ignore_file: IgnoreFile = IgnoreFile(N # ensure we're counting the size of the linked file # os.readlink returns a file path relative to dirpath, and must be # re-joined to get a workable result - path_size = os.path.getsize(os.path.join(dirpath, - os.readlink(convert_windows_path_to_unix(full_path)))) + path_size = os.path.getsize(os.path.join(dirpath, os.readlink(convert_windows_path_to_unix(full_path)))) size_list[full_path] = path_size total_size += path_size return total_size, size_list @@ -709,6 +708,7 @@ def _get_next_version_from_container( version = "1" return version + def _get_latest_version_from_container( asset_name: str, container_operation: Any, @@ -740,21 +740,22 @@ def _get_latest_version_from_container( f"Asset {asset_name} does not exist in registry {registry_name}." if registry_name else f"Asset {asset_name} does not exist in workspace {workspace_name}." - ) + ) no_personal_data_message = ( "Asset {asset_name} does not exist in registry {registry_name}." if registry_name else "Asset {asset_name} does not exist in workspace {workspace_name}." - ) + ) raise ValidationException( message=message, no_personal_data_message=no_personal_data_message, target=ErrorTarget.ASSET, error_category=ErrorCategory.USER_ERROR, - error_type=ValidationErrorType.RESOURCE_NOT_FOUND + error_type=ValidationErrorType.RESOURCE_NOT_FOUND, ) return version + def _get_latest( asset_name: str, version_operation: Any, @@ -801,12 +802,12 @@ def _get_latest( f"Asset {asset_name} does not exist in registry {registry_name}." if registry_name else f"Asset {asset_name} does not exist in workspace {workspace_name}." - ) + ) no_personal_data_message = ( "Asset {asset_name} does not exist in registry {registry_name}." if registry_name else "Asset {asset_name} does not exist in workspace {workspace_name}." - ) + ) raise ValidationException( message=message, no_personal_data_message=no_personal_data_message, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_cache_utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_cache_utils.py index 545edf03966b..463ea88983a0 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_cache_utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_cache_utils.py @@ -15,8 +15,12 @@ from typing import List, Dict, Optional, Union, Callable from azure.ai.ml._utils._asset_utils import get_object_hash -from azure.ai.ml._utils.utils import is_on_disk_cache_enabled, is_concurrent_component_registration_enabled, \ - is_private_preview_enabled, write_to_shared_file +from azure.ai.ml._utils.utils import ( + is_on_disk_cache_enabled, + is_concurrent_component_registration_enabled, + is_private_preview_enabled, + write_to_shared_file, +) from azure.ai.ml.constants._common import AzureMLResourceType, AZUREML_COMPONENT_REGISTRATION_MAX_WORKERS from azure.ai.ml.entities import Component from azure.ai.ml.entities._builders import BaseNode @@ -98,9 +102,7 @@ def __init__( self._cache: Dict[str, _CacheContent] = {} self._nodes_to_resolve: List[BaseNode] = [] - self._client_hash = self._get_client_hash( - subscription_id, resource_group_name, workspace_name, registry_name - ) + self._client_hash = self._get_client_hash(subscription_id, resource_group_name, workspace_name, registry_name) # the same client share 1 lock self._lock = _node_resolution_lock[self._client_hash] @@ -141,7 +143,7 @@ def _get_component_registration_max_workers(): "Please reset the value to an integer.", AZUREML_COMPONENT_REGISTRATION_MAX_WORKERS, os.environ.get(AZUREML_COMPONENT_REGISTRATION_MAX_WORKERS), - default_max_workers + default_max_workers, ) max_workers = default_max_workers return max_workers @@ -208,6 +210,7 @@ def _get_on_disk_hash_for_component(component: Component, in_memory_hash: str) - def _on_disk_cache_dir(self) -> Path: """Get the base path for on disk cache.""" from azure.ai.ml._version import VERSION + return Path(tempfile.gettempdir()).joinpath( ".azureml", "azure-ai-ml", @@ -254,8 +257,7 @@ def _save_to_on_disk_cache(self, on_disk_hash: str, arm_id: str) -> None: ) def _resolve_cache_contents(self, cache_contents_to_resolve: List[_CacheContent], resolver): - """Resolve all components to resolve and save the results in cache. - """ + """Resolve all components to resolve and save the results in cache.""" _components = list(map(lambda x: x.component_ref, cache_contents_to_resolve)) _map_func = partial(resolver, azureml_type=AzureMLResourceType.COMPONENT) @@ -297,10 +299,7 @@ def _prepare_items_to_resolve(self): self._nodes_to_resolve.clear() return dict_of_nodes_to_resolve, cache_contents_to_resolve - def _resolve_cache_contents_from_disk( - self, - cache_contents_to_resolve: List[_CacheContent] - ) -> List[_CacheContent]: + def _resolve_cache_contents_from_disk(self, cache_contents_to_resolve: List[_CacheContent]) -> List[_CacheContent]: """Check on-disk cache to resolve cache contents in cache_contents_to_resolve and return unresolved cache contents. """ @@ -308,8 +307,7 @@ def _resolve_cache_contents_from_disk( # we can't assume that the code folder won't change among dependency resolution for cache_content in cache_contents_to_resolve: cache_content.on_disk_hash = self._get_on_disk_hash_for_component( - cache_content.component_ref, - cache_content.in_memory_hash + cache_content.component_ref, cache_content.in_memory_hash ) left_cache_contents_to_resolve = [] @@ -342,16 +340,14 @@ def _resolve_nodes(self): self._fill_back_component_to_nodes(dict_of_nodes_to_resolve) def register_node_for_lazy_resolution(self, node: BaseNode): - """Register a node with its component to resolve. - """ + """Register a node with its component to resolve.""" component = node._component # pylint: disable=protected-access # directly resolve node and skip registration if the resolution involves no remote call # so that all node will be skipped when resolving a subgraph recursively if isinstance(component, str): node._component = self._resolver( # pylint: disable=protected-access - component, - azureml_type=AzureMLResourceType.COMPONENT + component, azureml_type=AzureMLResourceType.COMPONENT ) return if component.id is not None: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_func_utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_func_utils.py index de8775b0388a..1d263085566f 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_func_utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_func_utils.py @@ -18,7 +18,7 @@ class PersistentLocalsFunctionBuilder(abc.ABC): "not_callable": "func must be a function or a callable object", "conflict_argument": "Injected param name __self conflicts with function args {args}", "not_all_template_separators_used": "Not all template separators are used, " - "please switch to a compatible version of Python.", + "please switch to a compatible version of Python.", } injected_param = "__self" @@ -43,10 +43,10 @@ def call(self, func, _all_kwargs) -> Tuple[Any, dict]: """ if isinstance(func, (FunctionType, MethodType)): pass - elif hasattr(func, '__call__'): + elif hasattr(func, "__call__"): func = func.__call__ else: - raise TypeError(self.make_error('not_callable')) + raise TypeError(self.make_error("not_callable")) if self.injected_param in func.__code__.co_varnames: raise ValueError(self.make_error("conflict_argument", args=list(func.__code__.co_varnames))) @@ -94,7 +94,6 @@ def _call(self, func, _all_kwargs): try: from bytecode import Bytecode, Instr - class PersistentLocalsFunction(object): def __init__(self, _func, *, _self: Optional[Any] = None, skip_locals: Optional[List[str]] = None): """ @@ -121,18 +120,15 @@ def __call__(__self, *args, **kwargs): # pylint: disable=no-self-argument for skip_local in __self._skip_locals: __self.locals.pop(skip_local, None) - def _source_template_func(mock_arg): return mock_arg - def _target_template_func(__self, mock_arg): try: return mock_arg finally: __self.locals = locals().copy() - class PersistentLocalsFunctionBytecodeBuilder(PersistentLocalsFunctionBuilder): def __init__(self): self._template_separators = self.get_instructions(_source_template_func) @@ -178,12 +174,7 @@ def _create_code(self, instructions: List[Instr], base_func: Union[FunctionType, # endregion - def _split_instructions( - self, - instructions, - *, - skip_body_instr=False - ) -> List[List[Any]]: + def _split_instructions(self, instructions, *, skip_body_instr=False) -> List[List[Any]]: """Split instructions into several pieces by template separators. For example, in Python 3.11, the template separators will be: [ @@ -247,12 +238,9 @@ def func(__self, *func_args): generated_instructions = [] for template_piece, input_piece, separator in zip( - self._template_body, - self._split_instructions( - self.get_instructions(func), - skip_body_instr=True - ), - self._template_separators, + self._template_body, + self._split_instructions(self.get_instructions(func), skip_body_instr=True), + self._template_separators, ): generated_instructions.extend(template_piece) generated_instructions.extend(input_piece) @@ -265,7 +253,7 @@ def func(__self, *func_args): func.__globals__, func.__name__, func.__defaults__, - func.__closure__ + func.__closure__, ) return PersistentLocalsFunction( generated_func, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/azure_resource_utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/azure_resource_utils.py index 006854b866a9..80409062df5c 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/azure_resource_utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/azure_resource_utils.py @@ -9,8 +9,9 @@ from azure.core.credentials import TokenCredential -def get_resources_from_subscriptions(strQuery: str, credential: TokenCredential, - subscription_list: Optional[List[str]] = None): +def get_resources_from_subscriptions( + strQuery: str, credential: TokenCredential, subscription_list: Optional[List[str]] = None +): # If a subscription list is passed in, use it. Otherwise, get all subscriptions subsList = [] @@ -19,7 +20,7 @@ def get_resources_from_subscriptions(strQuery: str, credential: TokenCredential, else: subsClient = SubscriptionClient(credential) for sub in subsClient.subscriptions.list(): - subsList.append(sub.as_dict().get('subscription_id')) + subsList.append(sub.as_dict().get("subscription_id")) # Create Azure Resource Graph client and set options argClient = arg.ResourceGraphClient(credential) @@ -35,8 +36,9 @@ def get_resources_from_subscriptions(strQuery: str, credential: TokenCredential, return argClient.resources(argQuery) -def get_virtual_clusters_from_subscriptions(credential: TokenCredential, - subscription_list: Optional[List[str]] = None) -> List[Dict]: +def get_virtual_clusters_from_subscriptions( + credential: TokenCredential, subscription_list: Optional[List[str]] = None +) -> List[Dict]: # cspell:ignore tolower strQuery = """resources @@ -47,16 +49,19 @@ def get_virtual_clusters_from_subscriptions(credential: TokenCredential, return get_resources_from_subscriptions(strQuery, credential, subscription_list).data -def get_generic_resource_by_id(arm_id: str, credential: TokenCredential, - subscription_id: str, api_version: Optional[str] = None) -> Dict: +def get_generic_resource_by_id( + arm_id: str, credential: TokenCredential, subscription_id: str, api_version: Optional[str] = None +) -> Dict: resource_client = ResourceManagementClient(credential, subscription_id) generic_resource = resource_client.resources.get_by_id(arm_id, api_version) return generic_resource.as_dict() -def get_virtual_cluster_by_id(name: str, resource_group: str, - subscription_id: str, credential: TokenCredential) -> Dict: + +def get_virtual_cluster_by_id( + name: str, resource_group: str, subscription_id: str, credential: TokenCredential +) -> Dict: arm_id = ( f"/subscriptions/{subscription_id}/resourceGroups/{resource_group}" diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/utils.py index e096fdb806e7..e77a824af9e7 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/utils.py @@ -927,12 +927,7 @@ def write_to_shared_file(file_path: Union[str, PathLike], content: str): def _get_valid_dot_keys_with_wildcard_impl( - left_reversed_parts, - root, - *, - validate_func=None, - cur_node=None, - processed_parts=None + left_reversed_parts, root, *, validate_func=None, cur_node=None, processed_parts=None ): if len(left_reversed_parts) == 0: if validate_func is None or validate_func(root, processed_parts): @@ -953,12 +948,14 @@ def _get_valid_dot_keys_with_wildcard_impl( if not isinstance(next_key, str): continue processed_parts.append(next_key) - result.extend(_get_valid_dot_keys_with_wildcard_impl( - left_reversed_parts, - root, - validate_func=validate_func, - cur_node=cur_node[next_key], - processed_parts=processed_parts) + result.extend( + _get_valid_dot_keys_with_wildcard_impl( + left_reversed_parts, + root, + validate_func=validate_func, + cur_node=cur_node[next_key], + processed_parts=processed_parts, + ) ) processed_parts.pop() elif key in cur_node: @@ -968,13 +965,14 @@ def _get_valid_dot_keys_with_wildcard_impl( root, validate_func=validate_func, cur_node=cur_node[key], - processed_parts=processed_parts + processed_parts=processed_parts, ) processed_parts.pop() left_reversed_parts.append(key) return result + def get_valid_dot_keys_with_wildcard( root: Dict[str, Any], dot_key_wildcard: str, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_vendor/azure_resources/flatten_json/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_vendor/azure_resources/flatten_json/__init__.py index bf53b8fa9889..d180645c4bc6 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_vendor/azure_resources/flatten_json/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_vendor/azure_resources/flatten_json/__init__.py @@ -28,10 +28,7 @@ def check_if_numbers_are_consecutive(list_): :param list_: list of integers :return: Boolean """ - return all( - True if second - first == 1 else False - for first, second in zip(list_[:-1], list_[1:]) - ) + return all(True if second - first == 1 else False for first, second in zip(list_[:-1], list_[1:])) def _construct_key(previous_key, separator, new_key, replace_separators=None): @@ -48,16 +45,12 @@ def _construct_key(previous_key, separator, new_key, replace_separators=None): if replace_separators is not None: new_key = str(new_key).replace(separator, replace_separators) if previous_key: - return u"{}{}{}".format(previous_key, separator, new_key) + return "{}{}{}".format(previous_key, separator, new_key) else: return new_key -def flatten( - nested_dict, - separator="_", - root_keys_to_ignore=None, - replace_separators=None): +def flatten(nested_dict, separator="_", root_keys_to_ignore=None, replace_separators=None): """ Flattens a dictionary with nested structure to a dictionary with no hierarchy @@ -102,20 +95,11 @@ def _flatten(object_, key): if not (not key and object_key in root_keys_to_ignore): _flatten( object_[object_key], - _construct_key( - key, - separator, - object_key, - replace_separators=replace_separators)) + _construct_key(key, separator, object_key, replace_separators=replace_separators), + ) elif isinstance(object_, (list, set, tuple)): for index, item in enumerate(object_): - _flatten( - item, - _construct_key( - key, - separator, - index, - replace_separators=replace_separators)) + _flatten(item, _construct_key(key, separator, index, replace_separators=replace_separators)) # Anything left take as is else: flattened_dict[key] = object_ @@ -127,10 +111,9 @@ def _flatten(object_, key): flatten_json = flatten -def flatten_preserve_lists(nested_dict, separator="_", - root_keys_to_ignore=None, - max_list_index=3, max_depth=3, - replace_separators=None): +def flatten_preserve_lists( + nested_dict, separator="_", root_keys_to_ignore=None, max_list_index=3, max_depth=3, replace_separators=None +): """ Flattens a dictionary with nested structure to a dictionary with no hierarchy @@ -153,8 +136,7 @@ def flatten_preserve_lists(nested_dict, separator="_", """ assert isinstance(nested_dict, dict), "flatten requires a dictionary input" - assert isinstance(separator, six.string_types), \ - "separator must be a string" + assert isinstance(separator, six.string_types), "separator must be a string" if root_keys_to_ignore is None: root_keys_to_ignore = set() @@ -191,16 +173,12 @@ def _flatten(object_, key): if not (not key and object_key in root_keys_to_ignore): _flatten( object_[object_key], - _construct_key( - key, - separator, - object_key, - replace_separators=replace_separators)) + _construct_key(key, separator, object_key, replace_separators=replace_separators), + ) elif isinstance(object_, (list, set, tuple)): for index, item in enumerate(object_): - key = _construct_key(key, separator, index, - replace_separators=replace_separators) + key = _construct_key(key, separator, index, replace_separators=replace_separators) _flatten(item, key) else: @@ -221,16 +199,14 @@ def _flatten_low_entropy(object_, key, cur_depth, max_depth_inner): # write latest child as value if max_depth exceeded if cur_depth > max_depth_inner: - global_max_record = int(max(list( - list_prebuilt_flattened_dict.keys()))) + global_max_record = int(max(list(list_prebuilt_flattened_dict.keys()))) for d in list_prebuilt_flattened_dict[str(global_max_record)]: d[key] = object_ else: # Empty object can't be iterated, take as is if not object_: - global_max_record = int(max(list( - list_prebuilt_flattened_dict.keys()))) + global_max_record = int(max(list(list_prebuilt_flattened_dict.keys()))) for d in list_prebuilt_flattened_dict[str(global_max_record)]: d[key] = object_ @@ -240,54 +216,40 @@ def _flatten_low_entropy(object_, key, cur_depth, max_depth_inner): first_key = list(object_.keys())[0] # if only 1 child value, and child value # not a dict or list, flatten immediately - if len(object_) == 1 \ - and not (isinstance(object_[first_key], dict) - or isinstance(object_[first_key], list)): - global_max_record = int(max(list( - list_prebuilt_flattened_dict.keys()))) - - for d in list_prebuilt_flattened_dict[ - str(global_max_record) - ]: + if len(object_) == 1 and not ( + isinstance(object_[first_key], dict) or isinstance(object_[first_key], list) + ): + global_max_record = int(max(list(list_prebuilt_flattened_dict.keys()))) + + for d in list_prebuilt_flattened_dict[str(global_max_record)]: d[key] = object_[first_key] else: - for object_key, val in \ - sorted(object_.items(), - key=lambda x: - (str(type(x[1])), len(str(x[1]))), - reverse=False): + for object_key, val in sorted( + object_.items(), key=lambda x: (str(type(x[1])), len(str(x[1]))), reverse=False + ): if not (not key and object_key in root_keys_to_ignore): _flatten_low_entropy( object_[object_key], - _construct_key( - key, - separator, - object_key, - replace_separators=replace_separators), + _construct_key(key, separator, object_key, replace_separators=replace_separators), cur_depth, - max_depth_inner) + max_depth_inner, + ) # lists could go into rows, like in a relational database elif isinstance(object_, list) or isinstance(object_, set): if debug: - print("\nparent key of list:", - key, "| length: ", - str(len(object_))) + print("\nparent key of list:", key, "| length: ", str(len(object_))) # need to remember global list state when we entered # this recursion - global_max_record_start = int(max(list( - list_prebuilt_flattened_dict.keys()))) - entry = copy.deepcopy(list_prebuilt_flattened_dict[ - str(global_max_record_start) - ]) + global_max_record_start = int(max(list(list_prebuilt_flattened_dict.keys()))) + entry = copy.deepcopy(list_prebuilt_flattened_dict[str(global_max_record_start)]) for index, item in enumerate(object_): if debug: - print(" list key:", key, - " index: " + str(index), "vals: ", item) + print(" list key:", key, " index: " + str(index), "vals: ", item) sub = -1 if isinstance(item, dict): @@ -298,25 +260,20 @@ def _flatten_low_entropy(object_, key, cur_depth, max_depth_inner): if not isnan(sub) and index < max_list_index: # start from second element, 1st element is like column if index > 0: - global_max_record = int(max(list( - list_prebuilt_flattened_dict.keys()))) + global_max_record = int(max(list(list_prebuilt_flattened_dict.keys()))) - list_prebuilt_flattened_dict[ - str(global_max_record + 1) - ] = copy.deepcopy(entry) + list_prebuilt_flattened_dict[str(global_max_record + 1)] = copy.deepcopy(entry) - _flatten_low_entropy(item, key, cur_depth, - max_depth_inner) + _flatten_low_entropy(item, key, cur_depth, max_depth_inner) else: pass - list_prebuilt_flattened_dict['0'] = \ - [subel for k, v in - sorted(list_prebuilt_flattened_dict.items()) - for idx, subel in enumerate(v)] + list_prebuilt_flattened_dict["0"] = [ + subel for k, v in sorted(list_prebuilt_flattened_dict.items()) for idx, subel in enumerate(v) + ] for key in list(sorted(list_prebuilt_flattened_dict.keys())): - if key != '0': + if key != "0": del list_prebuilt_flattened_dict[key] if debug: print("collapsed global list") @@ -326,8 +283,7 @@ def _flatten_low_entropy(object_, key, cur_depth, max_depth_inner): # in this case, there may be # a list of prebuilt_flattened_dict by now # so need to update them all. - global_max_record = int(max(list( - list_prebuilt_flattened_dict.keys()))) + global_max_record = int(max(list(list_prebuilt_flattened_dict.keys()))) for d in list_prebuilt_flattened_dict[str(global_max_record)]: d[key] = object_ @@ -340,34 +296,34 @@ def _flatten_low_entropy(object_, key, cur_depth, max_depth_inner): # get unique column names, without the integers # TODO: potential issue: what if column names have digits naturally? reskeys = list(flattened_dict.keys()) - unique_integers = list(set([separator + char for key - in reskeys for char in key if char.isdigit()])) - regex = '|'.join(unique_integers) + unique_integers = list(set([separator + char for key in reskeys for char in key if char.isdigit()])) + regex = "|".join(unique_integers) regex += "|" + regex.replace(".", "") - unique_columns = list(set([re.sub("(" + regex + ")", "", key) - for key in reskeys])) + unique_columns = list(set([re.sub("(" + regex + ")", "", key) for key in reskeys])) # create global dict, now with unique column names prebuilt_flattened_dict = {column: None for column in unique_columns} # initialize global record list - list_prebuilt_flattened_dict = {'0': [prebuilt_flattened_dict]} + list_prebuilt_flattened_dict = {"0": [prebuilt_flattened_dict]} - _flatten_low_entropy(nested_dict, None, cur_depth=0, - max_depth_inner=max_depth) + _flatten_low_entropy(nested_dict, None, cur_depth=0, max_depth_inner=max_depth) - return list_prebuilt_flattened_dict['0'] + return list_prebuilt_flattened_dict["0"] def _unflatten_asserts(flat_dict, separator): assert isinstance(flat_dict, dict), "un_flatten requires dictionary input" assert isinstance(separator, six.string_types), "separator must be string" - assert all((not value or not isinstance(value, Iterable) or - isinstance(value, six.string_types) - for value in flat_dict.values())), "provided dict is not flat" + assert all( + ( + not value or not isinstance(value, Iterable) or isinstance(value, six.string_types) + for value in flat_dict.values() + ) + ), "provided dict is not flat" -def unflatten(flat_dict, separator='_'): +def unflatten(flat_dict, separator="_"): """ Creates a hierarchical dictionary from a flattened dictionary Assumes no lists are present @@ -392,18 +348,16 @@ def _unflatten(dic, keys, value): split_key = item.split(separator) next_split_key = list_keys[i + 1].split(separator) if not split_key == next_split_key[:-1]: - _unflatten(unflattened_dict, item.split(separator), - flat_dict[item]) + _unflatten(unflattened_dict, item.split(separator), flat_dict[item]) else: pass # if key contained in next key, json will be invalid. else: # last element - _unflatten(unflattened_dict, item.split(separator), - flat_dict[item]) + _unflatten(unflattened_dict, item.split(separator), flat_dict[item]) return unflattened_dict -def unflatten_list(flat_dict, separator='_'): +def unflatten_list(flat_dict, separator="_"): """ Unflattens a dictionary, first assuming no lists exist and then tries to identify lists and replaces them @@ -435,10 +389,13 @@ def _convert_dict_to_list(object_, parent_object, parent_object_key): keys = [] keys_len = len(keys) - if (keys_len > 0 and sum(keys) == - int(((keys_len - 1) * keys_len) / 2) and keys[0] == 0 and - keys[-1] == keys_len - 1 and - check_if_numbers_are_consecutive(keys)): + if ( + keys_len > 0 + and sum(keys) == int(((keys_len - 1) * keys_len) / 2) + and keys[0] == 0 + and keys[-1] == keys_len - 1 + and check_if_numbers_are_consecutive(keys) + ): # The dictionary looks like a list so we're going to replace it parent_object[parent_object_key] = [] @@ -446,9 +403,9 @@ def _convert_dict_to_list(object_, parent_object, parent_object_key): parent_object[parent_object_key].append(object_[str(key)]) # The list item we just added might be a list itself # https://github.com/amirziai/flatten/issues/15 - _convert_dict_to_list(parent_object[parent_object_key][-1], - parent_object[parent_object_key], - key_index) + _convert_dict_to_list( + parent_object[parent_object_key][-1], parent_object[parent_object_key], key_index + ) _convert_dict_to_list(unflattened_dict, None, None) return unflattened_dict @@ -458,9 +415,9 @@ def cli(input_stream=sys.stdin, output_stream=sys.stdout): raw = input_stream.read() input_json = json.loads(raw) output = json.dumps(flatten(input_json)) - output_stream.write('{}\n'.format(output)) + output_stream.write("{}\n".format(output)) output_stream.flush() -if __name__ == '__main__': - cli() \ No newline at end of file +if __name__ == "__main__": + cli() diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py index 3b75b7701907..191a1602fec8 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py @@ -597,6 +597,7 @@ class IdentityType: USER_IDENTITY = "user_identity" MANAGED_IDENTITY = "managed_identity" + class Boolean: TRUE = "true" FALSE = "false" diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_component.py index c757cae8eeec..056d094220de 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_component.py @@ -37,7 +37,6 @@ class ControlFlowType(object): CONTROL_FLOW_TYPES = [getattr(ControlFlowType, k) for k in dir(ControlFlowType) if k.isupper()] - class DataTransferTaskType(object): COPY_DATA = "copy_data" IMPORT_DATA = "import_data" diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_compute.py index 0b95b37ee779..2b1d2e22cd39 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_compute.py @@ -32,6 +32,7 @@ class ComputeDefaults: IDLE_TIME = 1800 PRIORITY = "Dedicated" + class CustomApplicationDefaults: TARGET_PORT = "target_port" PUBLISHED_PORT = "published_port" @@ -40,5 +41,6 @@ class CustomApplicationDefaults: DOCKER = "docker" ENDPOINT_NAME = "connect" + DUPLICATE_APPLICATION_ERROR = "Value of {} must be unique across all custom applications." INVALID_VALUE_ERROR = "Value of {} must be between {} and {}." diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_deployment.py b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_deployment.py index 3197cf9d53cb..de6e05fff5bc 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_deployment.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_deployment.py @@ -24,4 +24,6 @@ class EndpointDeploymentLogContainerType(object): INFERENCE_SERVER = "inference-server" STORAGE_INITIALIZER = "storage-initializer" + SmallSKUs = ["standard_ds1_v2", "standard_ds2_v2"] +DEFAULT_MDC_PATH = "azureml://datastores/workspaceblobstore/paths/modelDataCollector" diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_workspace.py b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_workspace.py index 2d192509ffa1..86ff0d4c8188 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_workspace.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_workspace.py @@ -18,3 +18,27 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class IsolationMode: + """IsolationMode for the workspace managed network.""" + + DISABLED = "Disabled" + ALLOW_INTERNET_OUTBOUND = "AllowInternetOutbound" + ALLOW_ONLY_APPROVED_OUTBOUND = "AllowOnlyApprovedOutbound" + + +class OutboundRuleCategory: + """Category for a managed network outbound rule.""" + + REQUIRED = "Required" + RECOMMENDED = "Recommended" + USER_DEFINED = "UserDefined" + + +class OutboundRuleType: + """Type of managed network outbound rule.""" + + FQDN = "FQDN" + PRIVATE_ENDPOINT = "PrivateEndpoint" + SERVICE_TAG = "ServiceTag" diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/data_transfer/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/data_transfer/__init__.py index 41fe13ef90e4..60323726e663 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/data_transfer/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/data_transfer/__init__.py @@ -4,10 +4,4 @@ from azure.ai.ml.entities._inputs_outputs.external_data import Database, FileSystem from azure.ai.ml.entities._builders.data_transfer_func import copy_data, import_data, export_data -__all__ = [ - "import_data", - "export_data", - "copy_data", - "Database", - "FileSystem" -] +__all__ = ["import_data", "export_data", "copy_data", "Database", "FileSystem"] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_component_func.py b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_component_func.py index d3f99def4c18..067cccd836e8 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_component_func.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_component_func.py @@ -52,6 +52,7 @@ def to_component_func(entity: ComponentEntity, component_creation_func) -> Calla flattened_group_keys = [] # Flatten all group parameters, for function parameter validation. from azure.ai.ml.entities._inputs_outputs import GroupInput + for name, item in entity.inputs.items(): if isinstance(item, GroupInput): flattened_group_keys.extend(list(item.flatten(group_parameter_name=name).keys())) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_dynamic.py b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_dynamic.py index fa1cc79d3ea9..2e1c5ff545c1 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_dynamic.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_dynamic.py @@ -123,9 +123,7 @@ def create_kw_function_from_parameters( def f(**kwargs): # We need to make sure all keys of kwargs are valid. # Merge valid group keys with original keys. - _assert_arg_valid( - kwargs, [*list(default_kwargs.keys()), *flattened_group_keys], func_name=func_name - ) + _assert_arg_valid(kwargs, [*list(default_kwargs.keys()), *flattened_group_keys], func_name=func_name) # We need to put the default args to the kwargs before invoking the original function. _update_dct_if_not_exist(kwargs, default_kwargs) return func(**kwargs) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_mldesigner/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_mldesigner/__init__.py index f3ca8ca911d0..08fcefc98a98 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_mldesigner/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_mldesigner/__init__.py @@ -13,10 +13,10 @@ from azure.ai.ml.entities._component.component_factory import component_factory from azure.ai.ml.entities._job.pipeline._load_component import _generate_component_function from azure.ai.ml.entities._inputs_outputs import _get_param_with_standard_annotation -from azure.ai.ml._internal.entities._additional_includes import _AdditionalIncludes # pylint: disable=unused-import +from azure.ai.ml._internal.entities._additional_includes import _AdditionalIncludes # pylint: disable=unused-import from azure.ai.ml._utils._asset_utils import get_ignore_file from azure.ai.ml._utils.utils import try_enable_internal_components -from azure.ai.ml._internal.entities import InternalComponent # pylint: disable=unused-import +from azure.ai.ml._internal.entities import InternalComponent # pylint: disable=unused-import from azure.ai.ml.dsl._condition import condition from azure.ai.ml.dsl._do_while import do_while from azure.ai.ml.dsl._group_decorator import group @@ -31,7 +31,6 @@ "condition", "do_while", "group", - # must keep "get_ignore_file", "_get_param_with_standard_annotation", diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_component_builder.py b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_component_builder.py index 146a6cbc12cb..b9e5c3b7c8e6 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_component_builder.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_component_builder.py @@ -13,11 +13,9 @@ from azure.ai.ml._utils._func_utils import get_outputs_and_locals from azure.ai.ml._utils.utils import ( - get_all_enum_values_iter, is_valid_node_name, parse_args_description_from_docstring, ) -from azure.ai.ml.constants import AssetTypes from azure.ai.ml.constants._component import ComponentSource, IOConstants from azure.ai.ml.constants._job.pipeline import COMPONENT_IO_KEYWORDS from azure.ai.ml.dsl._utils import _sanitize_python_variable_name @@ -30,6 +28,7 @@ from azure.ai.ml.entities._job.automl.automl_job import AutoMLJob from azure.ai.ml.entities._job.pipeline._attr_dict import has_attr_safe from azure.ai.ml.entities._job.pipeline._io import NodeOutput, PipelineInput, PipelineOutput, _GroupAttrDict +from azure.ai.ml.entities._util import copy_output_setting # We need to limit the depth of pipeline to avoid the built graph goes too deep and prevent potential # stack overflow in dsl.pipeline. @@ -203,7 +202,7 @@ def build( pipeline_component._outputs = self._build_pipeline_outputs(outputs) return pipeline_component - def _validate_group_annotation(self, name:str, val:GroupInput): + def _validate_group_annotation(self, name: str, val: GroupInput): for k, v in val.values.items(): if isinstance(v, GroupInput): self._validate_group_annotation(k, v) @@ -259,34 +258,33 @@ def _build_pipeline_outputs(self, outputs: typing.Dict[str, NodeOutput]): is_control=value.is_control, ) - # hack: map component output type to valid pipeline output type - def _map_type(_meta): + # Hack: map internal output type to pipeline output type + def _map_internal_output_type(_meta): + """Map component output type to valid pipeline output type.""" if type(_meta).__name__ != "InternalOutput": return _meta.type - if _meta.type in list(get_all_enum_values_iter(AssetTypes)): - return _meta.type - if _meta.type in ["AnyFile"]: - return AssetTypes.URI_FILE - return AssetTypes.URI_FOLDER + return _meta.map_pipeline_output_type() # Note: Here we set PipelineOutput as Pipeline's output definition as we need output binding. output_meta = Output( - type=_map_type(meta), description=meta.description, mode=meta.mode, is_control=meta.is_control + type=_map_internal_output_type(meta), + description=meta.description, + mode=meta.mode, + is_control=meta.is_control, ) pipeline_output = PipelineOutput( port_name=key, data=None, + # meta is used to create pipeline component, store it here to make sure pipeline component and inner + # node output type are consistent meta=output_meta, owner="pipeline", description=self._args_description.get(key, None), ) - value._owner.outputs[value._port_name]._data = PipelineOutput( - port_name=key, - data=value._data, - meta=None, - owner="pipeline", - description=self._args_description.get(key, None), - ) + # copy node level output setting to pipeline output + copy_output_setting(source=value._owner.outputs[value._port_name], target=pipeline_output) + + value._owner.outputs[value._port_name]._data = pipeline_output output_dict[key] = pipeline_output output_meta_dict[key] = output_meta._to_dict() @@ -439,7 +437,7 @@ def _get_output_annotation(cls, func): if not isinstance(val, Output): raise UserErrorException( message="Invalid output annotation. " - f"Only Output annotation in return annotation is supported. Got {type(val)}." + f"Only Output annotation in return annotation is supported. Got {type(val)}." ) output_annotations[key] = val._to_dict() return output_annotations @@ -469,8 +467,12 @@ def _validate_inferred_outputs(self, output_meta_dict: dict, output_dict: dict): f"{key}: pipeline component output: {actual_output} != annotation output {expected_output}" ) if expected_description: + output_dict[key]._meta.description = expected_description + # also copy the description to pipeline job output_dict[key].description = expected_description if expected_mode: + output_dict[key]._meta.mode = expected_mode + # also copy the mode to pipeline job output_dict[key].mode = expected_mode if unmatched_outputs: @@ -481,16 +483,22 @@ def _validate_keyword_in_node_io(node: Union[BaseNode, AutoMLJob]): if has_attr_safe(node, "inputs"): for input_name in set(node.inputs) & COMPONENT_IO_KEYWORDS: module_logger.warning( - "Reserved word \"%s\" is used as input name in node \"%s\", " + 'Reserved word "%s" is used as input name in node "%s", ' "can only be accessed with '%s.inputs[\"%s\"]'", - input_name, node.name, node.name, input_name + input_name, + node.name, + node.name, + input_name, ) if has_attr_safe(node, "outputs"): for output_name in set(node.outputs) & COMPONENT_IO_KEYWORDS: module_logger.warning( - "Reserved word \"%s\" is used as output name in node \"%s\", " + 'Reserved word "%s" is used as output name in node "%s", ' "can only be accessed with '%s.outputs[\"%s\"]'", - output_name, node.name, node.name, output_name + output_name, + node.name, + node.name, + output_name, ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_decorator.py b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_decorator.py index aa9494caefb0..c7bec73530d6 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_decorator.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_decorator.py @@ -30,6 +30,7 @@ from ._pipeline_component_builder import PipelineComponentBuilder, _is_inside_dsl_pipeline_func from ._settings import _dsl_settings_stack from ._utils import _resolve_source_file +from ..entities._builders import BaseNode _TFunc = TypeVar("_TFunc", bound=Callable[..., Any]) @@ -277,6 +278,17 @@ def _is_supported_data_type(_data): for pipeline_input_name in provided_args: data = provided_args[pipeline_input_name] + # for input_key, input_value in kwargs.items(): + if isinstance(data, BaseNode): + if len(data.outputs) != 1: + raise ValueError( + "Provided input {} is not a single output node, cannot be used as a node input.".format( + pipeline_input_name + ) + ) + data = next(iter(data.outputs.values())) + provided_args[pipeline_input_name] = data + if data is not None and not _is_supported_data_type(data) and pipeline_input_name not in non_pipeline_inputs: msg = ( "Pipeline input expected an azure.ai.ml.Input or primitive types (str, bool, int or float), " diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/__init__.py index ad0508389fba..38b74baaf576 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/__init__.py @@ -79,7 +79,7 @@ from ._job.job import Job from ._job.job_limits import CommandJobLimits from ._job.job_resource_configuration import JobResourceConfiguration -from ._job.job_service import JobService, SshJobService,JupyterLabJobService, TensorBoardJobService, VsCodeJobService +from ._job.job_service import JobService, SshJobService, JupyterLabJobService, TensorBoardJobService, VsCodeJobService from ._job.parallel.parallel_task import ParallelTask from ._job.parallel.retry_settings import RetrySettings from ._job.parameterized_command import ParameterizedCommand @@ -123,6 +123,10 @@ DiagnoseResult, DiagnoseWorkspaceParameters, ) +from ._workspace.networking import ( + OutboundRule, ManagedNetwork, FqdnDestination, ServiceTagDestination, + PrivateEndpointDestination +) from ._workspace.private_endpoint import EndpointConnection, PrivateEndpoint from ._workspace.workspace import Workspace from ._workspace.workspace_keys import ContainerRegistryCredential, NotebookAccessKeys, WorkspaceKeys @@ -190,6 +194,11 @@ "DiagnoseResponseResultValue", "DiagnoseWorkspaceParameters", "PrivateEndpoint", + "OutboundRule", + "ManagedNetwork", + "FqdnDestination", + "ServiceTagDestination", + "PrivateEndpointDestination", "EndpointConnection", "CustomerManagedKey", "Datastore", diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/_artifacts/data.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/_artifacts/data.py index 6225fdfbd048..f5ae03e9f09e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/_artifacts/data.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/_artifacts/data.py @@ -213,7 +213,7 @@ def _update_path(self, asset_artifact: ArtifactStorageInfo) -> None: # datastore_arm_id is null for registry scenario, so capture the full_storage_path if not asset_artifact.datastore_arm_id and asset_artifact.full_storage_path: self.path = asset_artifact.full_storage_path - else : + else: groups = re.search(regex, asset_artifact.datastore_arm_id) if groups: datastore_name = groups.group(1) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/__init__.py index 3ca6987aa5bb..95dfca0a7af4 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/__init__.py @@ -11,5 +11,18 @@ from .sweep import Sweep from .data_transfer import DataTransfer, DataTransferCopy, DataTransferImport, DataTransferExport -__all__ = ["BaseNode", "Sweep", "Parallel", "Command", "Import", "Spark", "Pipeline", "parse_inputs_outputs", - "DoWhile", "DataTransfer", "DataTransferCopy", "DataTransferImport", "DataTransferExport"] +__all__ = [ + "BaseNode", + "Sweep", + "Parallel", + "Command", + "Import", + "Spark", + "Pipeline", + "parse_inputs_outputs", + "DoWhile", + "DataTransfer", + "DataTransferCopy", + "DataTransferImport", + "DataTransferExport", +] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/base_node.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/base_node.py index 915b6857212d..2cfe658f2d6d 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/base_node.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/base_node.py @@ -365,6 +365,7 @@ def _from_rest_object(cls, obj: dict) -> "BaseNode": obj[CommonYamlFields.TYPE] = NodeType.COMMAND from azure.ai.ml.entities._job.pipeline._load_component import pipeline_node_factory + # todo: refine Hard code for now to support different task type for DataTransfer node _type = obj[CommonYamlFields.TYPE] if _type == NodeType.DATA_TRANSFER: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/condition_node.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/condition_node.py index d71d65c9f7a7..912d78d22935 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/condition_node.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/condition_node.py @@ -71,15 +71,17 @@ def _validate_params(self, raise_error=True) -> MutableValidationResult: # check if condition is valid binding if isinstance(self.condition, str) and not is_data_binding_expression( - self.condition, ["parent"], is_singular=False): + self.condition, ["parent"], is_singular=False + ): error_tail = "for example, ${{parent.jobs.xxx.outputs.output}}" validation_result.append_error( yaml_path="condition", message=f"'condition' of dsl.condition has invalid binding expression: {self.condition}, {error_tail}", ) - error_msg = "{!r} of dsl.condition node must be an instance of " \ - f"{BaseNode}, {AutoMLJob} or {str}," "got {!r}." + error_msg = ( + "{!r} of dsl.condition node must be an instance of " f"{BaseNode}, {AutoMLJob} or {str}," "got {!r}." + ) if self.true_block is not None and not isinstance(self.true_block, (BaseNode, AutoMLJob, str)): validation_result.append_error( yaml_path="true_block", message=error_msg.format("true_block", type(self.true_block)) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer.py index 958fd5c5e53f..3d1366dbb2f4 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer.py @@ -10,15 +10,25 @@ from marshmallow import Schema from azure.ai.ml._restclient.v2022_10_01_preview.models import JobBase -from azure.ai.ml._schema.job.data_transfer_job import DataTransferCopyJobSchema, DataTransferImportJobSchema, \ - DataTransferExportJobSchema -from azure.ai.ml.constants._component import NodeType, ExternalDataType, DataTransferTaskType -from azure.ai.ml.entities._component.datatransfer_component import DataTransferCopyComponent, \ - DataTransferImportComponent, DataTransferExportComponent, DataTransferComponent +from azure.ai.ml._schema.job.data_transfer_job import ( + DataTransferCopyJobSchema, + DataTransferImportJobSchema, + DataTransferExportJobSchema, +) +from azure.ai.ml.constants._component import NodeType, ExternalDataType, DataTransferTaskType +from azure.ai.ml.entities._component.datatransfer_component import ( + DataTransferCopyComponent, + DataTransferImportComponent, + DataTransferExportComponent, + DataTransferComponent, +) from azure.ai.ml.entities._component.component import Component from azure.ai.ml.entities._inputs_outputs import Input, Output -from azure.ai.ml.entities._job.data_transfer.data_transfer_job import DataTransferCopyJob, DataTransferImportJob, \ - DataTransferExportJob +from azure.ai.ml.entities._job.data_transfer.data_transfer_job import ( + DataTransferCopyJob, + DataTransferImportJob, + DataTransferExportJob, +) from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY from azure.ai.ml.exceptions import ErrorCategory, ErrorTarget, ValidationErrorType, ValidationException from azure.ai.ml.entities._inputs_outputs.external_data import Database, FileSystem @@ -52,8 +62,9 @@ def _build_source_sink(io_dict: Union[Dict, Database, FileSystem]): msg = "Source or sink only support type {} and {}, currently got {}." raise ValidationException( message=msg.format(ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, data_type), - no_personal_data_message=msg.format(ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, - "data_type"), + no_personal_data_message=msg.format( + ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, "data_type" + ), target=ErrorTarget.COMPONENT, error_category=ErrorCategory.USER_ERROR, error_type=ValidationErrorType.INVALID_VALUE, @@ -68,6 +79,7 @@ class DataTransfer(BaseNode): You should not instantiate this class directly. """ + def __init__( self, *, @@ -194,10 +206,7 @@ def _picked_fields_from_dict_to_rest_object(cls) -> List[str]: def _to_rest_object(self, **kwargs) -> dict: rest_obj = super()._to_rest_object(**kwargs) - for key, value in { - "componentId": self._get_component_id(), - "data_copy_mode": self.data_copy_mode - }.items(): + for key, value in {"componentId": self._get_component_id(), "data_copy_mode": self.data_copy_mode}.items(): if value is not None: rest_obj[key] = value return convert_ordered_dict_to_dict(rest_obj) @@ -225,7 +234,7 @@ def _to_job(self) -> DataTransferCopyJob: services=self.services, compute=self.compute, task=self.task, - data_copy_mode=self.data_copy_mode + data_copy_mode=self.data_copy_mode, ) def __call__(self, *args, **kwargs) -> "DataTransferCopy": @@ -251,8 +260,7 @@ def __call__(self, *args, **kwargs) -> "DataTransferCopy": # Pass through the display name only if the display name is not system generated. node.display_name = self.display_name if self.display_name != self.name else None return node - msg = "copy_data can be called as a function only when referenced component is {}, " \ - "currently got {}." + msg = "copy_data can be called as a function only when referenced component is {}, currently got {}." raise ValidationException( message=msg.format(type(Component), self._component), no_personal_data_message=msg.format(type(Component), "self._component"), diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer_func.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer_func.py index bbbbd5e255e3..2c572202d9fa 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer_func.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/data_transfer_func.py @@ -5,11 +5,18 @@ from typing import Optional, Dict, Union, Callable, Tuple -from azure.ai.ml.entities._component.datatransfer_component import DataTransferCopyComponent, \ - DataTransferImportComponent, DataTransferExportComponent +from azure.ai.ml.entities._component.datatransfer_component import ( + DataTransferCopyComponent, + DataTransferImportComponent, + DataTransferExportComponent, +) from azure.ai.ml.constants._common import AssetTypes, LegacyAssetTypes -from azure.ai.ml.constants._component import ComponentSource, ExternalDataType, DataTransferBuiltinComponentUri, \ - DataTransferTaskType +from azure.ai.ml.constants._component import ( + ComponentSource, + ExternalDataType, + DataTransferBuiltinComponentUri, + DataTransferTaskType, +) from azure.ai.ml.entities._inputs_outputs.external_data import Database, FileSystem from azure.ai.ml.entities._inputs_outputs import Output, Input from azure.ai.ml.entities._job.pipeline._io import PipelineInput, NodeOutput @@ -44,7 +51,7 @@ def _parse_input(input_value): if input_type in SUPPORTED_INPUTS: job_input = Input(**input_value) component_input = Input(**input_value) - elif isinstance(input_value, str): + elif isinstance(input_value, str): # Input bindings component_input = ComponentTranslatableMixin._to_input_builder_function(input_value) job_input = input_value @@ -57,8 +64,10 @@ def _parse_input(input_value): component_input, _ = _parse_input(data) job_input = input_value else: - msg = f"Unsupported input type: {type(input_value)}, only Input, dict, str, PipelineInput and NodeOutput are " \ - f"supported." + msg = ( + f"Unsupported input type: {type(input_value)}, only Input, dict, str, PipelineInput and NodeOutput are " + f"supported." + ) raise ValidationException( message=msg, no_personal_data_message=msg, @@ -105,19 +114,19 @@ def _parse_inputs_outputs(io_dict: Dict, parse_func: Callable) -> Tuple[Dict, Di def copy_data( - *, - name: Optional[str] = None, - description: Optional[str] = None, - tags: Optional[Dict] = None, - display_name: Optional[str] = None, - experiment_name: Optional[str] = None, - compute: Optional[str] = None, - inputs: Optional[Dict] = None, - outputs: Optional[Dict] = None, - is_deterministic: bool = True, - task: Optional[str] = DataTransferTaskType.COPY_DATA, - data_copy_mode: Optional[str] = None, - **kwargs, + *, + name: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[Dict] = None, + display_name: Optional[str] = None, + experiment_name: Optional[str] = None, + compute: Optional[str] = None, + inputs: Optional[Dict] = None, + outputs: Optional[Dict] = None, + is_deterministic: bool = True, + task: Optional[str] = DataTransferTaskType.COPY_DATA, + data_copy_mode: Optional[str] = None, + **kwargs, ) -> DataTransferCopy: """Create a DataTransferCopy object which can be used inside dsl.pipeline as a function. @@ -187,18 +196,18 @@ def copy_data( @pipeline_node_decorator def import_data( - *, - name: Optional[str] = None, - description: Optional[str] = None, - tags: Optional[Dict] = None, - display_name: Optional[str] = None, - experiment_name: Optional[str] = None, - compute: Optional[str] = None, - source: Optional[Union[Dict, Database, FileSystem]] = None, - outputs: Optional[Dict] = None, - is_deterministic: bool = True, - task: Optional[str] = DataTransferTaskType.IMPORT_DATA, - **kwargs, + *, + name: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[Dict] = None, + display_name: Optional[str] = None, + experiment_name: Optional[str] = None, + compute: Optional[str] = None, + source: Optional[Union[Dict, Database, FileSystem]] = None, + outputs: Optional[Dict] = None, + is_deterministic: bool = True, + task: Optional[str] = DataTransferTaskType.IMPORT_DATA, + **kwargs, ) -> DataTransferImport: """Create a DataTransferImport object which can be used inside dsl.pipeline. @@ -229,7 +238,7 @@ def import_data( :type task: str """ source = _build_source_sink(source) - outputs = outputs or {'sink': Output(type=AssetTypes.MLTABLE)} + outputs = outputs or {"sink": Output(type=AssetTypes.MLTABLE)} # # job inputs can not be None # job_inputs = {k: v for k, v in job_inputs.items() if v is not None} component_outputs, job_outputs = _parse_inputs_outputs(outputs, parse_func=_parse_output) @@ -271,18 +280,18 @@ def import_data( @pipeline_node_decorator def export_data( - *, - name: Optional[str] = None, - description: Optional[str] = None, - tags: Optional[Dict] = None, - display_name: Optional[str] = None, - experiment_name: Optional[str] = None, - compute: Optional[str] = None, - sink: Optional[Union[Dict, Database, FileSystem]] = None, - inputs: Optional[Dict] = None, - is_deterministic: bool = True, - task: Optional[str] = DataTransferTaskType.EXPORT_DATA, - **kwargs, + *, + name: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[Dict] = None, + display_name: Optional[str] = None, + experiment_name: Optional[str] = None, + compute: Optional[str] = None, + sink: Optional[Union[Dict, Database, FileSystem]] = None, + inputs: Optional[Dict] = None, + is_deterministic: bool = True, + task: Optional[str] = DataTransferTaskType.EXPORT_DATA, + **kwargs, ) -> DataTransferExport: """Create a DataTransferExport object which can be used inside dsl.pipeline. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/parallel_for.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/parallel_for.py index 37bd784ce4b3..29047497b898 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/parallel_for.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/parallel_for.py @@ -125,7 +125,7 @@ def _to_rest_item(cls, item: dict) -> dict: **cls._input_entity_to_rest_inputs(input_entity=asset_inputs), # primitive inputs has primitive type value like this # {"int_param": 1} - **primitive_inputs + **primitive_inputs, } @classmethod @@ -153,10 +153,7 @@ def _to_rest_object(self, **kwargs) -> dict: # pylint: disable=unused-argument rest_node = super(ParallelFor, self)._to_rest_object(**kwargs) # convert items to rest object rest_items = self._to_rest_items(items=self.items) - rest_node.update(dict( - items=rest_items, - outputs=self._to_rest_outputs() - )) + rest_node.update(dict(items=rest_items, outputs=self._to_rest_outputs())) return convert_ordered_dict_to_dict(rest_node) @classmethod @@ -168,10 +165,7 @@ def _from_rest_item(cls, rest_item): asset_inputs[key] = val else: primitive_inputs[key] = val - return { - **cls._from_rest_inputs(inputs=asset_inputs), - **primitive_inputs - } + return {**cls._from_rest_inputs(inputs=asset_inputs), **primitive_inputs} @classmethod def _from_rest_items(cls, rest_items: str) -> Union[dict, list, str]: @@ -247,7 +241,7 @@ def _validate_items(cls, items, raise_error=True, body_component=None): if not is_data_binding_expression(items, ["parent"]): validation_result.append_error( yaml_path="items", - message=f"Items is neither a valid JSON string due to {e} or a binding string." + message=f"Items is neither a valid JSON string due to {e} or a binding string.", ) if isinstance(items, dict): # Validate dict keys @@ -256,9 +250,7 @@ def _validate_items(cls, items, raise_error=True, body_component=None): if len(items) > 0: cls._validate_items_list(items, validation_result, body_component=body_component) else: - validation_result.append_error( - yaml_path="items", - message="Items is an empty list/dict.") + validation_result.append_error(yaml_path="items", message="Items is an empty list/dict.") else: validation_result.append_error( yaml_path="items", @@ -280,7 +272,7 @@ def _validate_items_list(cls, items: list, validation_result, body_component=Non if not isinstance(item, dict): validation_result.append_error( yaml_path="items", - message=f"Items has to be list/dict of dict as value, " f"but got {type(item)} for {item}." + message=f"Items has to be list/dict of dict as value, " f"but got {type(item)} for {item}.", ) else: # item has to have matched meta @@ -289,17 +281,11 @@ def _validate_items_list(cls, items: list, validation_result, body_component=Non meta = item else: msg = f"Items should have same keys with body inputs, but got {item.keys()} and {meta.keys()}." - validation_result.append_error( - yaml_path="items", - message=msg - ) + validation_result.append_error(yaml_path="items", message=msg) # items' keys should appear in body's inputs if isinstance(body_component, Component) and (not item.keys() <= body_component.inputs.keys()): msg = f"Item {item} got unmatched inputs with loop body component inputs {body_component.inputs}." - validation_result.append_error( - yaml_path="items", - message=msg - ) + validation_result.append_error(yaml_path="items", message=msg) # validate item value type cls._validate_item_value_type(item=item, validation_result=validation_result) @@ -313,7 +299,7 @@ def _validate_item_value_type(cls, item: dict, validation_result): yaml_path="items", message="Unsupported type {} in parallel_for items. Supported types are: {}".format( type(val), supported_types - ) + ), ) if isinstance(val, Input): cls._validate_input_item_value(entry=val, validation_result=validation_result) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/pipeline.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/pipeline.py index 96180e4ab16f..cffeb07b02d8 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/pipeline.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/pipeline.py @@ -12,7 +12,7 @@ from ..._schema import PathAwareSchema from .._job.pipeline.pipeline_job_settings import PipelineJobSettings -from .._util import convert_ordered_dict_to_dict, validate_attribute_type +from .._util import convert_ordered_dict_to_dict, validate_attribute_type, copy_output_setting from .base_node import BaseNode module_logger = logging.getLogger(__name__) @@ -72,6 +72,8 @@ def __init__( outputs=outputs, **kwargs, ) + # copy pipeline component output's setting to node level + self._copy_pipeline_component_out_setting_to_node() self._settings = None self.settings = settings @@ -183,3 +185,13 @@ def _create_schema_for_validation(cls, context) -> Union[PathAwareSchema, Schema from azure.ai.ml._schema.pipeline.pipeline_component import PipelineSchema return PipelineSchema(context=context) + + def _copy_pipeline_component_out_setting_to_node(self): + """Copy pipeline component output's setting to node level.""" + from azure.ai.ml.entities import PipelineComponent + + if not isinstance(self.component, PipelineComponent): + return + for key, val in self.component.outputs.items(): + node_output = self.outputs.get(key) + copy_output_setting(source=val, target=node_output) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component.py index de2111c8a0f6..74b896cc1b23 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component.py @@ -515,11 +515,15 @@ def __call__(self, *args, **kwargs) -> [..., Union["Command", "Parallel"]]: if args: # raise clear error message for unsupported positional args if self._func._has_parameters: - msg = f"Component function doesn't support positional arguments, got {args} for {self.name}. " \ - f"Please use keyword arguments like: {self._func._func_calling_example}." + msg = ( + f"Component function doesn't support positional arguments, got {args} for {self.name}. " + f"Please use keyword arguments like: {self._func._func_calling_example}." + ) else: - msg = "Component function doesn't has any parameters, " \ - f"please make sure component {self.name} has inputs. " + msg = ( + "Component function doesn't has any parameters, " + f"please make sure component {self.name} has inputs. " + ) raise ValidationException( message=msg, target=ErrorTarget.COMPONENT, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component_factory.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component_factory.py index 8a859802e118..7551d230fe15 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component_factory.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/component_factory.py @@ -18,8 +18,11 @@ from azure.ai.ml.entities._component.parallel_component import ParallelComponent from azure.ai.ml.entities._component.pipeline_component import PipelineComponent from azure.ai.ml.entities._component.spark_component import SparkComponent -from azure.ai.ml.entities._component.datatransfer_component import DataTransferCopyComponent, \ - DataTransferImportComponent, DataTransferExportComponent +from azure.ai.ml.entities._component.datatransfer_component import ( + DataTransferCopyComponent, + DataTransferImportComponent, + DataTransferExportComponent, +) from azure.ai.ml.entities._util import get_type_from_spec diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/datatransfer_component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/datatransfer_component.py index 151a6055d324..03ab93a70d2e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/datatransfer_component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/datatransfer_component.py @@ -6,8 +6,11 @@ from marshmallow import Schema -from azure.ai.ml._schema.component.data_transfer_component import DataTransferCopyComponentSchema, \ - DataTransferImportComponentSchema, DataTransferExportComponentSchema +from azure.ai.ml._schema.component.data_transfer_component import ( + DataTransferCopyComponentSchema, + DataTransferImportComponentSchema, + DataTransferExportComponentSchema, +) from azure.ai.ml.constants._common import COMPONENT_TYPE, AssetTypes from azure.ai.ml.constants._component import NodeType, DataTransferTaskType, ExternalDataType from azure.ai.ml.exceptions import ErrorCategory, ErrorTarget, ValidationException, ValidationErrorType @@ -91,8 +94,9 @@ def _build_source_sink(cls, io_dict: Union[Dict, Database, FileSystem]): msg = "Source or sink only support type {} and {}, currently got {}." raise ValidationException( message=msg.format(ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, data_type), - no_personal_data_message=msg.format(ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, - "data_type"), + no_personal_data_message=msg.format( + ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, "data_type" + ), target=ErrorTarget.COMPONENT, error_category=ErrorCategory.USER_ERROR, error_type=ValidationErrorType.INVALID_VALUE, @@ -163,8 +167,9 @@ def _validate_input_output_mapping(self): outputs_count = len(self.outputs) if outputs_count != 1: msg = "Only support single output in {}, but there're {} outputs." - validation_result.append_error(message=msg.format(DataTransferTaskType.COPY_DATA, outputs_count), - yaml_path="outputs") + validation_result.append_error( + message=msg.format(DataTransferTaskType.COPY_DATA, outputs_count), yaml_path="outputs" + ) else: input_type = None output_type = None @@ -175,18 +180,18 @@ def _validate_input_output_mapping(self): output_type = output_data.type if input_type is None or output_type is None or input_type != output_type: msg = "Input type {} doesn't exactly match with output type {} in task {}" - validation_result.append_error(message=msg.format(input_type, output_type, - DataTransferTaskType.COPY_DATA), - yaml_path="outputs") + validation_result.append_error( + message=msg.format(input_type, output_type, DataTransferTaskType.COPY_DATA), yaml_path="outputs" + ) elif inputs_count > 1: for _, output_data in self.outputs.items(): output_type = output_data.type if output_type is None or output_type != AssetTypes.URI_FOLDER: msg = "output type {} need to be {} in task {}" - validation_result.append_error(message=msg.format(output_type, - AssetTypes.URI_FOLDER, - DataTransferTaskType.COPY_DATA), - yaml_path="outputs") + validation_result.append_error( + message=msg.format(output_type, AssetTypes.URI_FOLDER, DataTransferTaskType.COPY_DATA), + yaml_path="outputs", + ) else: msg = "Inputs must be set in task {}." validation_result.append_error(message=msg.format(DataTransferTaskType.COPY_DATA), yaml_path="outputs") @@ -215,7 +220,7 @@ def __init__( **kwargs, ): - outputs = outputs or {'sink': Output(type=AssetTypes.MLTABLE)} + outputs = outputs or {"sink": Output(type=AssetTypes.MLTABLE)} super().__init__( task=task, outputs=outputs, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/pipeline_component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/pipeline_component.py index 450b14f0f005..2672000e2143 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/pipeline_component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/pipeline_component.py @@ -307,16 +307,19 @@ def _get_anonymous_hash(self) -> str: # command component), so we just use rest object to generate hash for pipeline component, # which doesn't have reuse issue. component_interface_dict = self._to_rest_object().properties.component_spec - hash_value = hash_dict(component_interface_dict, keys_to_omit=[ - # omit name since anonymous component will have same name - "name", - # omit _source since it doesn't impact component's uniqueness - "_source", - # omit id since it will be set after component is registered - "id", - # omit version since it will be set to this hash later - "version" - ]) + hash_value = hash_dict( + component_interface_dict, + keys_to_omit=[ + # omit name since anonymous component will have same name + "name", + # omit _source since it doesn't impact component's uniqueness + "_source", + # omit id since it will be set after component is registered + "id", + # omit version since it will be set to this hash later + "version", + ], + ) return hash_value def _get_flattened_inputs(self): @@ -354,7 +357,7 @@ def _resolve_sub_nodes(cls, rest_jobs): # TODO: Remove this ad-hoc fix after unified arm id format in object component_id = node.get("componentId", "") if isinstance(component_id, str) and re.match(ASSET_ARM_ID_REGEX_FORMAT, component_id): - node["componentId"] = component_id[len(ARM_ID_PREFIX):] + node["componentId"] = component_id[len(ARM_ID_PREFIX) :] if not LoopNode._is_loop_node_dict(node): # skip resolve LoopNode first since it may reference other nodes # use node factory instead of BaseNode._from_rest_object here as AutoMLJob is not a BaseNode diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/_custom_applications.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/_custom_applications.py index 626f0f344229..7f339fc1e576 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/_custom_applications.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/_custom_applications.py @@ -55,9 +55,7 @@ class EndpointsSettings: """ def __init__(self, *, target: int, published: int): - EndpointsSettings._validate_endpoint_settings( - target=target, published=published - ) + EndpointsSettings._validate_endpoint_settings(target=target, published=published) self.target = target self.published = published @@ -165,9 +163,7 @@ def _to_rest_object(self): environment_variables = None if self.environment_variables: environment_variables = { - name: RestEnvironmentVariable( - type=RestEnvironmentVariableType.LOCAL, value=value - ) + name: RestEnvironmentVariable(type=RestEnvironmentVariableType.LOCAL, value=value) for name, value in self.environment_variables.items() } @@ -181,11 +177,7 @@ def _to_rest_object(self): endpoints=endpoints, environment_variables=environment_variables, volumes=volumes, - docker=( - Docker(privileged=True) - if self.type == CustomApplicationDefaults.DOCKER - else None - ), + docker=(Docker(privileged=True) if self.type == CustomApplicationDefaults.DOCKER else None), additional_properties=self.additional_properties, ) @@ -228,9 +220,7 @@ def validate_custom_applications(custom_apps: List[CustomApplications]): error_category=ErrorCategory.USER_ERROR, ) - published_ports = [ - endpoint.published for app in custom_apps for endpoint in app.endpoints - ] + published_ports = [endpoint.published for app in custom_apps for endpoint in app.endpoints] if len(set(published_ports)) != len(published_ports): raise ValidationException( diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/aml_compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/aml_compute.py index 9918fe8015a1..becec566b4f5 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/aml_compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/aml_compute.py @@ -80,6 +80,8 @@ class AmlCompute(Compute): :type description: str, optional :param size: Compute Size, defaults to None. :type size: str, optional + :param tags: A set of tags. Contains resource tags defined as key/value pairs. + :type tags: Optional[dict[str, str]] :param ssh_settings: SSH settings to access the AzureML compute cluster. :type ssh_settings: AmlComputeSshSettings, optional :param network_settings: Virtual network settings for the AzureML compute cluster. @@ -114,6 +116,7 @@ def __init__( name: str, description: Optional[str] = None, size: Optional[str] = None, + tags: Optional[dict] = None, ssh_public_access_enabled: Optional[bool] = None, ssh_settings: Optional[AmlComputeSshSettings] = None, min_instances: Optional[int] = None, @@ -130,6 +133,7 @@ def __init__( name=name, description=description, location=kwargs.pop("location", None), + tags=tags, **kwargs, ) self.size = size @@ -165,6 +169,7 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "AmlCompute": id=rest_obj.id, description=prop.description, location=rest_obj.location, + tags=rest_obj.tags if rest_obj.tags else None, provisioning_state=prop.provisioning_state, provisioning_errors=prop.provisioning_errors[0].error.code if (prop.provisioning_errors and len(prop.provisioning_errors) > 0) @@ -239,4 +244,5 @@ def _to_rest_object(self) -> ComputeResource: location=self.location, properties=aml_comp, identity=(self.identity._to_compute_rest_object() if self.identity else None), + tags=self.tags, ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute.py index 7c5722d8ef95..24d98eccaa6e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute.py @@ -34,6 +34,8 @@ class Compute(Resource, RestTranslatableMixin): :type description: Optional[str], optional :param resource_id: ARM resource id of the underlying compute. :type resource_id: str, optional + :param tags: A set of tags. Contains resource tags defined as key/value pairs. + :type tags: Optional[dict[str, str]] """ def __init__( @@ -42,6 +44,7 @@ def __init__( location: Optional[str] = None, description: Optional[str] = None, resource_id: Optional[str] = None, + tags: Optional[dict] = None, **kwargs, ): self._type = kwargs.pop("type", None) @@ -55,6 +58,7 @@ def __init__( super().__init__(name=name, description=description, **kwargs) self.resource_id = resource_id self.location = location + self.tags = tags @property def type(self) -> Optional[str]: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py index 0f48fed8532d..dadc529e5d51 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py @@ -107,6 +107,8 @@ class ComputeInstance(Compute): :type description: Optional[str], optional :param size: Compute Size, defaults to None :type size: Optional[str], optional + :param tags: A set of tags. Contains resource tags defined as key/value pairs. + :type tags: Optional[dict[str, str]] :param create_on_behalf_of: defaults to None :type create_on_behalf_of: Optional[AssignedUserConfiguration], optional :ivar state: defaults to None @@ -157,6 +159,7 @@ def __init__( name: str, description: Optional[str] = None, size: Optional[str] = None, + tags: Optional[dict] = None, ssh_public_access_enabled: Optional[bool] = None, create_on_behalf_of: Optional[AssignedUserConfiguration] = None, network_settings: Optional[NetworkSettings] = None, @@ -180,6 +183,7 @@ def __init__( location=kwargs.pop("location", None), resource_id=kwargs.pop("resource_id", None), description=description, + tags=tags, **kwargs, ) self.size = size @@ -239,9 +243,7 @@ def _to_rest_object(self) -> ComputeResource: subnet_resource = ResourceId(id=self.subnet) else: subnet_resource = None - if self.ssh_public_access_enabled and not ( - self.ssh_settings and self.ssh_settings.ssh_key_value - ): + if self.ssh_public_access_enabled and not (self.ssh_settings and self.ssh_settings.ssh_key_value): msg = "ssh_key_value is required when ssh_public_access_enabled = True." raise ValidationException( message=msg, @@ -255,9 +257,7 @@ def _to_rest_object(self) -> ComputeResource: admin_public_key=self.ssh_settings.ssh_key_value, ) if self.ssh_public_access_enabled is not None: - ssh_settings.ssh_public_access = ( - "Enabled" if self.ssh_public_access_enabled else "Disabled" - ) + ssh_settings.ssh_public_access = "Enabled" if self.ssh_public_access_enabled else "Disabled" else: ssh_settings.ssh_public_access = "NotSpecified" personal_compute_instance_settings = None @@ -288,12 +288,8 @@ def _to_rest_object(self) -> ComputeResource: idle_time_before_shutdown=idle_time_before_shutdown, enable_node_public_ip=self.enable_node_public_ip, ) - compute_instance_prop.schedules = ( - self.schedules._to_rest_object() if self.schedules else None - ) - compute_instance_prop.setup_scripts = ( - self.setup_scripts._to_rest_object() if self.setup_scripts else None - ) + compute_instance_prop.schedules = self.schedules._to_rest_object() if self.schedules else None + compute_instance_prop.setup_scripts = self.setup_scripts._to_rest_object() if self.setup_scripts else None if self.custom_applications: validate_custom_applications(self.custom_applications) compute_instance_prop.custom_services = [] @@ -307,9 +303,8 @@ def _to_rest_object(self) -> ComputeResource: return ComputeResource( location=self.location, properties=compute_instance, - identity=( - self.identity._to_compute_rest_object() if self.identity else None - ), + identity=(self.identity._to_compute_rest_object() if self.identity else None), + tags=self.tags, ) def _to_dict(self) -> Dict: @@ -356,12 +351,10 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "ComputeInstance": network_settings = NetworkSettings( subnet=prop.properties.subnet.id if prop.properties.subnet else None, public_ip_address=prop.properties.connectivity_endpoints.public_ip_address - if prop.properties.connectivity_endpoints - and prop.properties.connectivity_endpoints.public_ip_address + if prop.properties.connectivity_endpoints and prop.properties.connectivity_endpoints.public_ip_address else None, private_ip_address=prop.properties.connectivity_endpoints.private_ip_address - if prop.properties.connectivity_endpoints - and prop.properties.connectivity_endpoints.private_ip_address + if prop.properties.connectivity_endpoints and prop.properties.connectivity_endpoints.private_ip_address else None, ) os_image_metadata = None @@ -371,12 +364,8 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "ComputeInstance": is_latest_os_image_version=metadata.is_latest_os_image_version if metadata.is_latest_os_image_version is not None else None, - current_image_version=metadata.current_image_version - if metadata.current_image_version - else None, - latest_image_version=metadata.latest_image_version - if metadata.latest_image_version - else None, + current_image_version=metadata.current_image_version if metadata.current_image_version else None, + latest_image_version=metadata.latest_image_version if metadata.latest_image_version else None, ) idle_time_before_shutdown = None @@ -388,9 +377,7 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "ComputeInstance": pattern=idle_time_before_shutdown_pattern, string=idle_time_before_shutdown, ) - idle_time_before_shutdown_minutes = ( - int(idle_time_match[1]) if idle_time_match else None - ) + idle_time_before_shutdown_minutes = int(idle_time_match[1]) if idle_time_match else None custom_applications = None if prop.properties and prop.properties.custom_services: custom_applications = [] @@ -403,6 +390,7 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "ComputeInstance": description=prop.description, location=rest_obj.location, resource_id=prop.resource_id, + tags=rest_obj.tags if rest_obj.tags else None, provisioning_state=prop.provisioning_state, provisioning_errors=prop.provisioning_errors[0].error.code if (prop.provisioning_errors and len(prop.provisioning_errors) > 0) @@ -419,23 +407,13 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "ComputeInstance": create_on_behalf_of=create_on_behalf_of, network_settings=network_settings, ssh_settings=ssh_settings, - ssh_public_access_enabled=_ssh_public_access_to_bool( - prop.properties.ssh_settings.ssh_public_access - ) - if ( - prop.properties - and prop.properties.ssh_settings - and prop.properties.ssh_settings.ssh_public_access - ) + ssh_public_access_enabled=_ssh_public_access_to_bool(prop.properties.ssh_settings.ssh_public_access) + if (prop.properties and prop.properties.ssh_settings and prop.properties.ssh_settings.ssh_public_access) else None, schedules=ComputeSchedules._from_rest_object(prop.properties.schedules) - if prop.properties - and prop.properties.schedules - and prop.properties.schedules.compute_start_stop - else None, - identity=IdentityConfiguration._from_compute_rest_object(rest_obj.identity) - if rest_obj.identity + if prop.properties and prop.properties.schedules and prop.properties.schedules.compute_start_stop else None, + identity=IdentityConfiguration._from_compute_rest_object(rest_obj.identity) if rest_obj.identity else None, setup_scripts=SetupScripts._from_rest_object(prop.properties.setup_scripts) if prop.properties and prop.properties.setup_scripts else None, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/kubernetes_compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/kubernetes_compute.py index c575d30618c5..72237f93eb4a 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/kubernetes_compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/kubernetes_compute.py @@ -24,6 +24,8 @@ class KubernetesCompute(Compute): :type location: Optional[str], optional :param description: Description of the resource. :type description: Optional[str], optional + :param tags: A set of tags. Contains resource tags defined as key/value pairs. + :type tags: Optional[dict[str, str]] :param resource_id: ARM resource id of the underlying compute, defaults to None :type resource_id: Optional[str], optional :param created_on: defaults to None @@ -63,6 +65,7 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "KubernetesCompute": description=prop.description, location=rest_obj.location, resource_id=prop.resource_id, + tags=rest_obj.tags if rest_obj.tags else None, provisioning_state=prop.provisioning_state, provisioning_errors=prop.provisioning_errors[0].error.code if (prop.provisioning_errors and len(prop.provisioning_errors) > 0) @@ -101,4 +104,5 @@ def _to_rest_object(self) -> ComputeResource: properties=kubernetes_comp, name=self.name, identity=(self.identity._to_compute_rest_object() if self.identity else None), + tags=self.tags, ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/synapsespark_compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/synapsespark_compute.py index 9669a29aa9f2..4a8349d240c7 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/synapsespark_compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/synapsespark_compute.py @@ -97,6 +97,8 @@ class SynapseSparkCompute(Compute): :type description: Optional[str], optional :param resource_id: ARM resource id of the underlying compute, defaults to None :type resource_id: Optional[str], optional + :param tags: A set of tags. Contains resource tags defined as key/value pairs. + :type tags: Optional[dict[str, str]] :param identity: The identity configuration, identities that are associated with the compute cluster. :type identity: IdentityConfiguration, optional """ @@ -106,6 +108,7 @@ def __init__( *, name: str, description: Optional[str] = None, + tags: Optional[dict] = None, node_count: Optional[int] = None, node_family: Optional[str] = None, node_size: Optional[str] = None, @@ -116,7 +119,7 @@ def __init__( **kwargs, ): kwargs[TYPE] = ComputeType.SYNAPSESPARK - super().__init__(name=name, description=description, location=kwargs.pop("location", None), **kwargs) + super().__init__(name=name, description=description, location=kwargs.pop("location", None), tags=tags, **kwargs) self.identity = identity self.node_count = node_count self.node_family = node_family @@ -148,6 +151,7 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "SynapseSparkCompute": description=prop.description, location=rest_obj.location, resource_id=prop.resource_id, + tags=rest_obj.tags if rest_obj.tags else None, created_on=prop.created_on if prop.properties else None, node_count=prop.properties.node_count if prop.properties else None, node_family=prop.properties.node_size_family if prop.properties else None, @@ -189,4 +193,5 @@ def _to_rest_object(self) -> ComputeResource: if self.identity else None ), + tags=self.tags, ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/unsupported_compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/unsupported_compute.py index 64d0b445aea3..41df22cc2ead 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/unsupported_compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/unsupported_compute.py @@ -32,6 +32,7 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "UnsupportedCompute": description=prop.description, location=rest_obj.location, resource_id=prop.resource_id, + tags=prop.tags, provisioning_state=prop.provisioning_state, created_on=prop.additional_properties.get("createdOn", None), ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/virtual_machine_compute.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/virtual_machine_compute.py index 3221a923ef2b..b616f5ab9410 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/virtual_machine_compute.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/virtual_machine_compute.py @@ -55,6 +55,8 @@ class VirtualMachineCompute(Compute): :type description: Optional[str], optional :param resource_id: ARM resource id of the underlying compute :type resource_id: str + :param tags: A set of tags. Contains resource tags defined as key/value pairs. + :type tags: Optional[dict[str, str]] :param ssh_settings: SSH settings. :type ssh_settings: VirtualMachineSshSettings, optional """ @@ -65,6 +67,7 @@ def __init__( name: str, description: Optional[str] = None, resource_id: str, + tags: Optional[dict] = None, ssh_settings: Optional[VirtualMachineSshSettings] = None, **kwargs, ): @@ -75,6 +78,7 @@ def __init__( location=kwargs.pop("location", None), description=description, resource_id=resource_id, + tags=tags, **kwargs, ) self.ssh_settings = ssh_settings @@ -105,6 +109,7 @@ def _load_from_rest(cls, rest_obj: ComputeResource) -> "VirtualMachineCompute": description=prop.description, location=rest_obj.location, resource_id=prop.resource_id, + tags=rest_obj.tags if rest_obj.tags else None, public_key_data=credentials.public_key_data if credentials else None, provisioning_state=prop.provisioning_state, provisioning_errors=prop.provisioning_errors[0].error.code @@ -141,5 +146,5 @@ def _to_rest_object(self) -> ComputeResource: resource_id=self.resource_id, description=self.description, ) - resource = ComputeResource(name=self.name, location=self.location, properties=vm_compute) + resource = ComputeResource(name=self.name, location=self.location, tags=self.tags, properties=vm_compute) return resource diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/data_asset.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/data_asset.py index 4aeefdfb3ed3..fb1a0a4a0d2b 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/data_asset.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/data_asset.py @@ -13,6 +13,8 @@ class DataAsset: """Data Asset entity + :param data_id: Arm id of registered data asset + :param data_id: str :param name: Name of data asset :type name: str :param path: Path where the data asset is stored. @@ -24,11 +26,13 @@ class DataAsset: def __init__( self, + data_id: Optional[str] = None, name: Optional[str] = None, path: Optional[str] = None, version: Optional[int] = None, **kwargs, ): # pylint: disable=unused-argument + self.data_id = data_id self.name = name self.path = path self.version = version diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/destination.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/destination.py index 6121cfa6818f..a205e5540671 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/destination.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/destination.py @@ -20,10 +20,7 @@ class Destination: """ # pylint: disable=unused-argument,no-self-use - def __init__( - self, path: Optional[str] = None, - event_hub: Optional[EventHub] = None, - **kwargs): + def __init__(self, path: Optional[str] = None, event_hub: Optional[EventHub] = None, **kwargs): self.path = path self.event_hub = event_hub diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/event_hub.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/event_hub.py index dbb8977e1ef5..efb23b6e8414 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/event_hub.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/event_hub.py @@ -21,10 +21,7 @@ class EventHub: # pylint: disable=unused-argument,no-self-use def __init__( - self, - namespace: Optional[str] = None, - oversize_data_config: Optional[OversizeDataConfig] = None, - **kwargs + self, namespace: Optional[str] = None, oversize_data_config: Optional[OversizeDataConfig] = None, **kwargs ): self.namespace = namespace self.oversize_data_config = oversize_data_config diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/online_deployment.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/online_deployment.py index 799f8496eacc..7ac89d23cca3 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/online_deployment.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/online_deployment.py @@ -53,7 +53,7 @@ module_logger = logging.getLogger(__name__) -#pylint: disable=too-many-instance-attributes +# pylint: disable=too-many-instance-attributes class OnlineDeployment(Deployment): """Online endpoint deployment entity @@ -327,9 +327,8 @@ def _filter_datastore_to_rest_object(self): @classmethod def _filter_datastore_from_rest_object( - cls, - entity: "OnlineDeployment", - deployment: RestOnlineDeploymentDetails) -> "OnlineDeployment": + cls, entity: "OnlineDeployment", deployment: RestOnlineDeploymentDetails + ) -> "OnlineDeployment": # Data collector is private preview. If Private Preview environment variable is not enable # data collector will be removed from tags. Data Collector values will be stored in tags # until data collector is added to the contract. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/_endpoint_helpers.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/_endpoint_helpers.py index fc00729ca245..4abbe98750d5 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/_endpoint_helpers.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/_endpoint_helpers.py @@ -15,10 +15,7 @@ def validate_endpoint_or_deployment_name(name: str, is_deployment: bool = False) """ type_str = "a deployment" if is_deployment else "an endpoint" target = ErrorTarget.DEPLOYMENT if is_deployment else ErrorTarget.ENDPOINT - if ( - len(name) < EndpointConfigurations.MIN_NAME_LENGTH - or len(name) > EndpointConfigurations.MAX_NAME_LENGTH - ): + if len(name) < EndpointConfigurations.MIN_NAME_LENGTH or len(name) > EndpointConfigurations.MAX_NAME_LENGTH: msg = f"The name for {type_str} must be at least 3 and at most 32 characters long (inclusive of both limits)." raise ValidationException( message=msg, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/__init__.py index fd1444cb7431..062c162cf470 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/__init__.py @@ -61,5 +61,13 @@ def some_pipeline( from .utils import _get_param_with_standard_annotation, is_group from .external_data import Database, FileSystem -__all__ = ["Input", "Output", "EnumInput", "GroupInput", "is_group", "_get_param_with_standard_annotation", - "Database", "FileSystem"] +__all__ = [ + "Input", + "Output", + "EnumInput", + "GroupInput", + "is_group", + "_get_param_with_standard_annotation", + "Database", + "FileSystem", +] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/external_data.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/external_data.py index 1324a9dfbe71..10be493fefd2 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/external_data.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/external_data.py @@ -27,7 +27,7 @@ def __init__( *, name: Optional[str] = None, value: Optional[str] = None, - type: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, # pylint: disable=redefined-builtin ): self.type = type self.name = name @@ -141,6 +141,7 @@ class FileSystem(DictMixin, RestTranslatableMixin): # pylint: disable=too-many- :raises ~azure.ai.ml.exceptions.ValidationException: Raised if Source cannot be successfully validated. Details will be provided in the error message. """ + _EMPTY = Parameter.empty def __init__( diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/output.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/output.py index 5523ae8c06cd..c672c10f73c3 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/output.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_inputs_outputs/output.py @@ -88,8 +88,8 @@ def __init__(self, *, type=AssetTypes.URI_FOLDER, path=None, mode=None, descript super(Output, self).__init__(type=type) # As an annotation, it is not allowed to initialize the _port_name. self._port_name = None - self.name = kwargs.pop('name', None) - self.version = kwargs.pop('version', None) + self.name = kwargs.pop("name", None) + self.version = kwargs.pop("version", None) self._is_primitive_type = self.type in IOConstants.PRIMITIVE_STR_2_TYPE self.description = description self.path = path @@ -108,8 +108,7 @@ def _get_hint(self, new_line_style=False): def _to_dict(self): """Convert the Output object to a dict.""" - keys = ["name", "version", "path", "type", "mode", - "description", "is_control", "early_available"] + keys = ["name", "version", "path", "type", "mode", "description", "is_control", "early_available"] result = {key: getattr(self, key) for key in keys} return _remove_empty_values(result) @@ -142,6 +141,6 @@ def _assert_name_and_version(self): raise UserErrorException( f"The output name {self.name} can only contain alphanumeric characters, dashes and underscores, " f"with a limit of 255 characters." - ) + ) if self.version and not self.name: raise UserErrorException("Output name is required when output version is specified.") diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/data_transfer/data_transfer_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/data_transfer/data_transfer_job.py index 8868b245f899..f8398c7bca93 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/data_transfer/data_transfer_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/data_transfer/data_transfer_job.py @@ -9,12 +9,19 @@ from typing import Dict, Optional, Union from azure.ai.ml._restclient.v2022_10_01_preview.models import JobBase -from azure.ai.ml._schema.job.data_transfer_job import DataTransferCopyJobSchema, DataTransferImportJobSchema, \ - DataTransferExportJobSchema +from azure.ai.ml._schema.job.data_transfer_job import ( + DataTransferCopyJobSchema, + DataTransferImportJobSchema, + DataTransferExportJobSchema, +) from azure.ai.ml.constants import JobType from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY, TYPE -from azure.ai.ml.constants._component import ExternalDataType, DataTransferBuiltinComponentUri, ComponentSource, \ - DataTransferTaskType +from azure.ai.ml.constants._component import ( + ExternalDataType, + DataTransferBuiltinComponentUri, + ComponentSource, + DataTransferTaskType, +) from azure.ai.ml.entities._inputs_outputs import Input, Output from azure.ai.ml.entities._util import load_from_dict from azure.ai.ml.exceptions import ErrorCategory, ErrorTarget, ValidationErrorType, ValidationException @@ -113,8 +120,9 @@ def _build_source_sink(cls, io_dict: Union[Dict, Database, FileSystem]): msg = "Source or sink only support type {} and {}, currently got {}." raise ValidationException( message=msg.format(ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, data_type), - no_personal_data_message=msg.format(ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, - "data_type"), + no_personal_data_message=msg.format( + ExternalDataType.DATABASE, ExternalDataType.FILE_SYSTEM, "data_type" + ), target=ErrorTarget.COMPONENT, error_category=ErrorCategory.USER_ERROR, error_type=ValidationErrorType.INVALID_VALUE, @@ -169,7 +177,7 @@ def _to_component(self, context: Optional[Dict] = None, **kwargs): inputs=self._to_inputs(inputs=self.inputs, pipeline_job_dict=pipeline_job_dict), outputs=self._to_outputs(outputs=self.outputs, pipeline_job_dict=pipeline_job_dict), task=self.task, - data_copy_mode=self.data_copy_mode + data_copy_mode=self.data_copy_mode, ) def _to_node(self, context: Optional[Dict] = None, **kwargs): diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/base.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/base.py index a46a9aeb581a..35ee44948877 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/base.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/base.py @@ -56,6 +56,9 @@ def _data_to_input(data): class InputOutputBase(ABC): + # TODO: refine this code, always use _data to store builder level settings and use _meta to store definition + # TODO: when _data missing, return value from _meta + def __init__(self, meta: Union[Input, Output], data, default_data=None, **kwargs): """Base class of input & output. @@ -415,7 +418,7 @@ def name(self, name): raise UserErrorException( f"We support self._data of Input, Output, InputOutputBase, NodeOutput and NodeInput," f"but got type: {type(self._data)}." - ) + ) @property def version(self) -> str: @@ -437,14 +440,37 @@ def version(self, version): raise UserErrorException( f"We support self._data of Input, Output, InputOutputBase, NodeOutput and NodeInput," f"but got type: {type(self._data)}." - ) + ) + + @property + def path(self) -> Optional[str]: + # For node output path, + if hasattr(self._data, "path"): + return self._data.path + return None + + @path.setter + def path(self, path): + # For un-configured output, we build a default data entry for them. + self._build_default_data() + if hasattr(self._data, "path"): + self._data.path = path + else: + # YAML job will have string output binding and do not support setting path for it. + msg = f"{type(self._data)} does not support setting path." + raise ValidationException( + message=msg, + no_personal_data_message=msg, + target=ErrorTarget.PIPELINE, + error_category=ErrorCategory.USER_ERROR, + ) def _assert_name_and_version(self): if self.name and not (re.match("^[A-Za-z0-9_-]*$", self.name) and len(self.name) <= 255): raise UserErrorException( f"The output name {self.name} can only contain alphanumeric characters, dashes and underscores, " f"with a limit of 255 characters." - ) + ) if self.version and not self.name: raise UserErrorException("Output name is required when output version is specified.") @@ -487,7 +513,7 @@ def _to_job_output(self): is_control=is_control, name=self.name, version=self.version, - description=self.description + description=self.description, ) else: msg = "Got unexpected type for output: {}." diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/mixin.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/mixin.py index 2500aa13dc1c..4b4e50bcecb9 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/mixin.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_io/mixin.py @@ -9,6 +9,7 @@ from azure.ai.ml._restclient.v2022_12_01_preview.models import JobOutput as RestJobOutput from azure.ai.ml.constants._component import ComponentJobConstants from azure.ai.ml.entities._inputs_outputs import GroupInput, Input, Output +from azure.ai.ml.entities._util import copy_output_setting from azure.ai.ml.exceptions import ErrorTarget, ValidationException from ..._input_output_helpers import ( @@ -206,10 +207,10 @@ def _to_rest_outputs(self) -> Dict[str, Dict]: rest_output_bindings[key].update({"version": binding["version"]}) def _rename_name_and_version(output_dict): - if 'asset_name' in output_dict.keys(): - output_dict['name'] = output_dict.pop('asset_name') - if 'asset_version' in output_dict.keys(): - output_dict['version'] = output_dict.pop('asset_version') + if "asset_name" in output_dict.keys(): + output_dict["name"] = output_dict.pop("asset_name") + if "asset_version" in output_dict.keys(): + output_dict["version"] = output_dict.pop("asset_version") return output_dict rest_data_outputs = {name: _rename_name_and_version(val.as_dict()) for name, val in rest_data_outputs.items()} @@ -320,11 +321,6 @@ def _build_input(self, name, meta: Input, data) -> "PipelineInput": def _build_output(self, name, meta: Output, data) -> "PipelineOutput": # TODO: settings data to None for un-configured outputs so we won't passing extra fields(eg: default mode) result = PipelineOutput(port_name=name, meta=meta, data=data, owner=self) - # copy mode & description from meta so they won't loss when transform from a pipeline component to pipeline job - if meta and meta.description: - result.description = meta.description - if meta and meta.mode: - result.mode = meta.mode return result def _build_inputs_dict_without_meta(self, inputs: Dict[str, Union[Input, str, bool, int, float]]) -> InputsAttrDict: @@ -332,6 +328,46 @@ def _build_inputs_dict_without_meta(self, inputs: Dict[str, Union[Input, str, bo input_dict = GroupInput.restore_flattened_inputs(input_dict) return InputsAttrDict(input_dict) + def _build_output_for_pipeline(self, name, data) -> "PipelineOutput": + """Build an output object for pipeline and copy settings from source output. + + :param name: Output name. + :param meta: Output metadata. + :param data: Output data. + :return: Built output object. + """ + # pylint: disable=protected-access + if data is None: + # For None output, build an empty output builder + output_val = self._build_output(name=name, meta=None, data=None) + elif isinstance(data, Output): + # For output entity, build an output builder with data points to it + output_val = self._build_output(name=name, meta=data, data=data) + elif isinstance(data, NodeOutput): + # For output builder, build a new output builder and copy settings from it + output_val = self._build_output(name=name, meta=data._meta, data=None) + copy_output_setting(source=data, target=output_val) + else: + message = "Unsupported output type: {} for pipeline output: {}: {}" + raise ValidationException( + message=message.format(type(data), name, data), + no_personal_data_message=message, + target=ErrorTarget.PIPELINE, + ) + return output_val + + def _build_pipeline_outputs_dict(self, outputs: Dict[str, Union[Output, NodeOutput]]) -> OutputsAttrDict: + """Build an output attribute dict without output definition metadata. + For pipeline outputs, its setting should be copied from node level outputs. + + :param outputs: Node output dict or pipeline component's outputs. + :return: Built dynamic output attribute dict. + """ + output_dict = {} + for key, val in outputs.items(): + output_dict[key] = self._build_output_for_pipeline(name=key, data=val) + return OutputsAttrDict(output_dict) + def _build_outputs(self) -> Dict[str, Output]: """Build outputs of this pipeline to a dict which maps output to actual value. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_load_component.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_load_component.py index fa76aadae2ba..648dda99d2fc 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_load_component.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_load_component.py @@ -15,8 +15,17 @@ from azure.ai.ml.constants._compute import ComputeType from azure.ai.ml.dsl._component_func import to_component_func from azure.ai.ml.dsl._overrides_definition import OverrideDefinition -from azure.ai.ml.entities._builders import BaseNode, Command, Import, Parallel, Spark, Sweep, DataTransferCopy, \ - DataTransferImport, DataTransferExport +from azure.ai.ml.entities._builders import ( + BaseNode, + Command, + Import, + Parallel, + Spark, + Sweep, + DataTransferCopy, + DataTransferImport, + DataTransferExport, +) from azure.ai.ml.entities._builders.condition_node import ConditionNode from azure.ai.ml.entities._builders.control_flow_node import ControlFlowNode from azure.ai.ml.entities._builders.do_while import DoWhile diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_pipeline_job_helpers.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_pipeline_job_helpers.py index cf41ee29b295..49f9d543b506 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_pipeline_job_helpers.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_pipeline_job_helpers.py @@ -45,8 +45,8 @@ def process_sdk_component_job_io( if isinstance(io_value, (Input, Output)) and isinstance(io_value.path, str): mode = io_value.mode path = io_value.path - name = io_value.name if hasattr(io_value, 'name') else None - version = io_value.version if hasattr(io_value, 'version') else None + name = io_value.name if hasattr(io_value, "name") else None + version = io_value.version if hasattr(io_value, "version") else None if any([re.match(item, path) for item in io_binding_regex_list]): # Yaml syntax requires using ${{}} to enclose inputs and outputs bindings # io_bindings[io_name] = io_value @@ -127,7 +127,7 @@ def from_dict_to_rest_io( io_bindings[key].update({"mode": INPUT_MOUNT_MAPPING_FROM_REST[io_mode]}) # add name and version for binding input if io_name or io_version: - assert rest_object_class.__name__ == 'JobOutput' + assert rest_object_class.__name__ == "JobOutput" # current code only support dump name and version for JobOutput # this assert can be deleted if we need to dump name/version for JobInput if io_name: @@ -137,13 +137,13 @@ def from_dict_to_rest_io( if not io_mode and not io_name and not io_version: io_bindings[key] = io_value else: - if rest_object_class.__name__ == 'JobOutput': + if rest_object_class.__name__ == "JobOutput": # current code only support dump name and version for JobOutput # this condition can be deleted if we need to dump name/version for JobInput - if 'name' in val.keys(): - val['asset_name'] = val.pop('name') - if 'version' in val.keys(): - val['asset_version'] = val.pop('version') + if "name" in val.keys(): + val["asset_name"] = val.pop("name") + if "version" in val.keys(): + val["asset_version"] = val.pop("version") rest_obj = rest_object_class.from_dict(val) rest_io_objects[key] = rest_obj else: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/pipeline_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/pipeline_job.py index 056e510e02de..31cf583fc4a1 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/pipeline_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/pipeline_job.py @@ -126,12 +126,15 @@ def __init__( ComponentSource.YAML_COMPONENT, ]: self._inputs = self._build_inputs_dict(component.inputs, inputs) - # Build the outputs from entity output definition - self._outputs = self._build_outputs_dict(component.outputs, outputs) + # for pipeline component created pipeline jobs, + # it's output should have same value with the component outputs + self._outputs = self._build_pipeline_outputs_dict(component.outputs) else: # Build inputs/outputs dict without meta when definition not available self._inputs = self._build_inputs_dict_without_meta(inputs) - self._outputs = self._build_outputs_dict_without_meta(outputs) + # for node created pipeline jobs, + # it's output should have same value with the given outputs + self._outputs = self._build_pipeline_outputs_dict(outputs=outputs) source = kwargs.pop("_source", ComponentSource.CLASS) if component is None: component = PipelineComponent( diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_schedule/trigger.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_schedule/trigger.py index 4386a388af19..1d406a4a5414 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_schedule/trigger.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_schedule/trigger.py @@ -8,10 +8,10 @@ from typing import List, Optional, Union from azure.ai.ml._restclient.v2022_12_01_preview.models import CronTrigger as RestCronTrigger -from azure.ai.ml._restclient.v2022_12_01_preview.models import RecurrenceSchedule as RestRecurrencePattern +from azure.ai.ml._restclient.v2022_12_01_preview.models import RecurrenceSchedule as RestRecurrencePattern from azure.ai.ml._restclient.v2022_12_01_preview.models import RecurrenceTrigger as RestRecurrenceTrigger -from azure.ai.ml._restclient.v2022_12_01_preview.models import TriggerBase as RestTriggerBase -from azure.ai.ml._restclient.v2022_12_01_preview.models import TriggerType as RestTriggerType +from azure.ai.ml._restclient.v2022_12_01_preview.models import TriggerBase as RestTriggerBase +from azure.ai.ml._restclient.v2022_12_01_preview.models import TriggerType as RestTriggerType from azure.ai.ml._utils.utils import camel_to_snake, snake_to_camel from azure.ai.ml.constants import TimeZone from azure.ai.ml.entities._mixins import RestTranslatableMixin diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_util.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_util.py index f9ba5d5ddd07..42b8553e086e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_util.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_util.py @@ -1,6 +1,7 @@ # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- +import copy import hashlib import json import os @@ -458,3 +459,16 @@ def get_type_from_spec(data: dict, *, valid_keys: Iterable[str]) -> str: error_category=ErrorCategory.USER_ERROR, ) return extract_label(_type)[0] + + +def copy_output_setting(source: Union["Output", "NodeOutput"], target: "NodeOutput"): + """Copy node output setting from source to target. + Currently only path, name, version will be copied.""" + # pylint: disable=protected-access + from azure.ai.ml.entities._job.pipeline._io import NodeOutput + + if not isinstance(source, NodeOutput): + # Only copy when source is an output builder + return + if source._data: + target._data = copy.deepcopy(source._data) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/diagnose.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/diagnose.py index 5d720ecd9e84..62b7ab597bc7 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/diagnose.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/diagnose.py @@ -3,15 +3,15 @@ # --------------------------------------------------------- from typing import Any, Dict, List, Optional -from azure.ai.ml._restclient.v2022_10_01_preview.models import ( +from azure.ai.ml._restclient.v2022_12_01_preview.models import ( DiagnoseRequestProperties as RestDiagnoseRequestProperties, ) -from azure.ai.ml._restclient.v2022_10_01_preview.models import DiagnoseResponseResult as RestDiagnoseResponseResult -from azure.ai.ml._restclient.v2022_10_01_preview.models import ( +from azure.ai.ml._restclient.v2022_12_01_preview.models import DiagnoseResponseResult as RestDiagnoseResponseResult +from azure.ai.ml._restclient.v2022_12_01_preview.models import ( DiagnoseResponseResultValue as RestDiagnoseResponseResultValue, ) -from azure.ai.ml._restclient.v2022_10_01_preview.models import DiagnoseResult as RestDiagnoseResult -from azure.ai.ml._restclient.v2022_10_01_preview.models import ( +from azure.ai.ml._restclient.v2022_12_01_preview.models import DiagnoseResult as RestDiagnoseResult +from azure.ai.ml._restclient.v2022_12_01_preview.models import ( DiagnoseWorkspaceParameters as RestDiagnoseWorkspaceParameters, ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/networking.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/networking.py new file mode 100644 index 000000000000..f0750ffe9b57 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/networking.py @@ -0,0 +1,170 @@ +# --------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# --------------------------------------------------------- + +from typing import Any, Dict, Optional + +from azure.ai.ml._restclient.v2022_12_01_preview.models import ( + ManagedNetworkSettings as RestManagedNetwork, + FqdnOutboundRule as RestFqdnOutboundRule, + PrivateEndpointOutboundRule as RestPrivateEndpointOutboundRule, + PrivateEndpointOutboundRuleDestination as RestPrivateEndpointOutboundRuleDestination, + ServiceTagOutboundRule as RestServiceTagOutboundRule, + ServiceTagOutboundRuleDestination as RestServiceTagOutboundRuleDestination, +) +from azure.ai.ml.constants._workspace import IsolationMode, OutboundRuleCategory, OutboundRuleType + +from azure.ai.ml._utils._experimental import experimental + + +@experimental +class OutboundRule: + def __init__( + self, type: str = None, category: str = OutboundRuleCategory.USER_DEFINED # pylint: disable=redefined-builtin + ) -> None: + self.type = type + self.category = category + + @classmethod + def _from_rest_object(cls, rest_obj: Any) -> "OutboundRule": + if isinstance(rest_obj, RestFqdnOutboundRule): + rule = FqdnDestination(destination=rest_obj.destination) + rule.category = rest_obj.category + return rule + if isinstance(rest_obj, RestPrivateEndpointOutboundRule): + rule = PrivateEndpointDestination( + service_resource_id=rest_obj.destination.service_resource_id, + subresource_target=rest_obj.destination.subresource_target, + spark_enabled=rest_obj.destination.spark_enabled, + ) + rule.category = rest_obj.category + return rule + if isinstance(rest_obj, RestServiceTagOutboundRule): + rule = ServiceTagDestination( + service_tag=rest_obj.destination.service_tag, + protocol=rest_obj.destination.protocol, + port_ranges=rest_obj.destination.port_ranges, + ) + rule.category = rest_obj.category + return rule + + +@experimental +class FqdnDestination(OutboundRule): + def __init__(self, destination: str, category: str = OutboundRuleCategory.USER_DEFINED) -> None: + self.destination = destination + OutboundRule.__init__(self, type=OutboundRuleType.FQDN, category=category) + + def _to_rest_object(self) -> RestFqdnOutboundRule: + return RestFqdnOutboundRule(type=self.type, category=self.category, destination=self.destination) + + def _to_dict(self) -> Dict: + return {"type": OutboundRuleType.FQDN, "category": self.category, "destination": self.destination} + + +@experimental +class PrivateEndpointDestination(OutboundRule): + def __init__( + self, + service_resource_id: str, + subresource_target: str, + spark_enabled: bool = False, + category: str = OutboundRuleCategory.USER_DEFINED, + ) -> None: + self.service_resource_id = service_resource_id + self.subresource_target = subresource_target + self.spark_enabled = spark_enabled + OutboundRule.__init__(self, OutboundRuleType.PRIVATE_ENDPOINT, category=category) + + def _to_rest_object(self) -> RestPrivateEndpointOutboundRule: + return RestPrivateEndpointOutboundRule( + type=self.type, + category=self.category, + destination=RestPrivateEndpointOutboundRuleDestination( + service_resource_id=self.service_resource_id, + subresource_target=self.subresource_target, + spark_enabled=self.spark_enabled, + ), + ) + + def _to_dict(self) -> Dict: + return { + "type": OutboundRuleType.PRIVATE_ENDPOINT, + "category": self.category, + "destination": { + "service_resource_id": self.service_resource_id, + "subresource_target": self.subresource_target, + "spark_enabled": self.spark_enabled, + }, + } + + +@experimental +class ServiceTagDestination(OutboundRule): + def __init__( + self, service_tag: str, protocol: str, port_ranges: str, category: str = OutboundRuleCategory.USER_DEFINED + ) -> None: + self.service_tag = service_tag + self.protocol = protocol + self.port_ranges = port_ranges + OutboundRule.__init__(self, OutboundRuleType.SERVICE_TAG, category=category) + + def _to_rest_object(self) -> RestServiceTagOutboundRule: + return RestServiceTagOutboundRule( + type=self.type, + category=self.category, + destination=RestServiceTagOutboundRuleDestination( + service_tag=self.service_tag, protocol=self.protocol, port_ranges=self.port_ranges + ), + ) + + def _to_dict(self) -> Dict: + return { + "type": OutboundRuleType.SERVICE_TAG, + "category": self.category, + "destination": { + "service_tag": self.service_tag, + "protocol": self.protocol, + "port_ranges": self.port_ranges, + }, + } + + +@experimental +class ManagedNetwork: + def __init__( + self, + isolation_mode: str = IsolationMode.DISABLED, + outbound_rules: Optional[Dict[str, OutboundRule]] = None, + network_id: Optional[str] = None, + ) -> None: + self.isolation_mode = isolation_mode + self.network_id = network_id + self.outbound_rules = outbound_rules + + def _to_rest_object(self) -> RestManagedNetwork: + rest_outbound_rules = ( + { + rule_name: self.outbound_rules[rule_name]._to_rest_object() # pylint: disable=protected-access + for rule_name in self.outbound_rules + } + if self.outbound_rules + else None + ) + return RestManagedNetwork(isolation_mode=self.isolation_mode, outbound_rules=rest_outbound_rules) + + @classmethod + def _from_rest_object(cls, obj: RestManagedNetwork) -> "ManagedNetwork": + from_rest_outbound_rules = ( + { + rule_name: OutboundRule._from_rest_object( # pylint: disable=protected-access + obj.outbound_rules[rule_name] + ) + for rule_name in obj.outbound_rules + } + if obj.outbound_rules + else {} + ) + return ManagedNetwork( + isolation_mode=obj.isolation_mode, outbound_rules=from_rest_outbound_rules, network_id=obj.network_id + ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/workspace.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/workspace.py index 1f47b59cf65f..4ad913d400fb 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/workspace.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/workspace.py @@ -8,8 +8,9 @@ from pathlib import Path from typing import IO, AnyStr, Dict, Optional, Union -from azure.ai.ml._restclient.v2022_10_01_preview.models import ManagedServiceIdentity as RestManagedServiceIdentity -from azure.ai.ml._restclient.v2022_10_01_preview.models import Workspace as RestWorkspace +from azure.ai.ml._restclient.v2022_12_01_preview.models import ManagedServiceIdentity as RestManagedServiceIdentity +from azure.ai.ml._restclient.v2022_12_01_preview.models import Workspace as RestWorkspace +from azure.ai.ml._restclient.v2022_12_01_preview.models import ManagedNetworkSettings as RestManagedNetwork from azure.ai.ml._schema.workspace.workspace import WorkspaceSchema from azure.ai.ml._utils.utils import dump_yaml_to_file from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY, PARAMS_OVERRIDE_KEY, WorkspaceResourceConstants @@ -18,6 +19,7 @@ from azure.ai.ml.entities._util import load_from_dict from .customer_managed_key import CustomerManagedKey +from .networking import ManagedNetwork class Workspace(Resource): @@ -40,6 +42,7 @@ def __init__( public_network_access: Optional[str] = None, identity: Optional[IdentityConfiguration] = None, primary_user_assigned_identity: Optional[str] = None, + managed_network: Optional[ManagedNetwork] = None, **kwargs, ): @@ -86,6 +89,8 @@ def __init__( :type identity: IdentityConfiguration :param primary_user_assigned_identity: The workspace's primary user assigned identity :type primary_user_assigned_identity: str + :param managed_network: workspace's Managed Network configuration + :type managed_network: ManagedNetwork :param kwargs: A dictionary of additional configuration parameters. :type kwargs: dict """ @@ -106,6 +111,7 @@ def __init__( self.public_network_access = public_network_access self.identity = identity self.primary_user_assigned_identity = primary_user_assigned_identity + self.managed_network = managed_network @property def discovery_url(self) -> str: @@ -181,6 +187,14 @@ def _from_rest_object(cls, rest_obj: RestWorkspace) -> "Workspace": if hasattr(rest_obj, "ml_flow_tracking_uri"): mlflow_tracking_uri = rest_obj.ml_flow_tracking_uri + # TODO: remove this once it is included in API response + managed_network = None + if hasattr(rest_obj, "managed_network"): + if rest_obj.managed_network and isinstance(rest_obj.managed_network, RestManagedNetwork): + managed_network = ManagedNetwork._from_rest_object( # pylint: disable=protected-access + rest_obj.managed_network + ) + armid_parts = str(rest_obj.id).split("/") group = None if len(armid_parts) < 4 else armid_parts[4] identity = None @@ -208,6 +222,7 @@ def _from_rest_object(cls, rest_obj: RestWorkspace) -> "Workspace": mlflow_tracking_uri=mlflow_tracking_uri, identity=identity, primary_user_assigned_identity=rest_obj.primary_user_assigned_identity, + managed_network=managed_network, ) def _to_rest_object(self) -> RestWorkspace: @@ -228,4 +243,7 @@ def _to_rest_object(self) -> RestWorkspace: image_build_compute=self.image_build_compute, public_network_access=self.public_network_access, primary_user_assigned_identity=self.primary_user_assigned_identity, + managed_network=self.managed_network._to_rest_object() # pylint: disable=protected-access + if self.managed_network + else None, # pylint: disable=protected-access ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/exceptions.py b/sdk/ml/azure-ai-ml/azure/ai/ml/exceptions.py index 658f2bcf09b3..43afd3ffd591 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/exceptions.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/exceptions.py @@ -487,7 +487,7 @@ def __init__( message, no_personal_data_message=None, error_category=ErrorCategory.USER_ERROR, - target: ErrorTarget = ErrorTarget.PIPELINE + target: ErrorTarget = ErrorTarget.PIPELINE, ): super().__init__( message=message, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/__init__.py index 60519a17524c..63f4a76bd047 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/__init__.py @@ -23,6 +23,7 @@ from ._schedule_operations import ScheduleOperations from ._workspace_connections_operations import WorkspaceConnectionsOperations from ._workspace_operations import WorkspaceOperations +from ._workspace_outbound_rule_operations import WorkspaceOutboundRuleOperations from ._virtual_cluster_operations import VirtualClusterOperations __all__ = [ @@ -31,6 +32,7 @@ "JobOperations", "ModelOperations", "WorkspaceOperations", + "WorkspaceOutboundRuleOperations", "RegistryOperations", "OnlineEndpointOperations", "BatchEndpointOperations", diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_batch_deployment_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_batch_deployment_operations.py index 777b5f856e7d..08be83c0cc9b 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_batch_deployment_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_batch_deployment_operations.py @@ -277,21 +277,23 @@ def _validate_component(self, deployment: Deployment, orchestrators: OperationOr deployment.job_definition.name = name deployment.job_definition.component_id = component_id elif isinstance(deployment.job_definition.job, str): - job_component = PipelineComponent(source_job_id= deployment.job_definition.job) + job_component = PipelineComponent(source_job_id=deployment.job_definition.job) component = self._component_operations.create_or_update( - name = job_component.name, + name=job_component.name, resource_group_name=self._resource_group_name, workspace_name=self._workspace_name, - body = job_component._to_rest_object(), - version= job_component.version, - **self._init_kwargs + body=job_component._to_rest_object(), + version=job_component.version, + **self._init_kwargs, ) if not deployment.job_definition.description and component.properties.description: deployment.job_definition.description = component.properties.description if not deployment.job_definition.tags and component.properties.tags: deployment.job_definition.tags = component.properties.tags # pylint: disable=line-too-long - if isinstance(deployment.job_definition.job, str) or isinstance(deployment.job_definition.component, PipelineComponent): + if isinstance(deployment.job_definition.job, str) or isinstance( + deployment.job_definition.component, PipelineComponent + ): deployment.job_definition.component = None deployment.job_definition.job = None deployment.job_definition.component_id = component.id diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_component_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_component_operations.py index 7c28f31773b7..2f43b265f2a3 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_component_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_component_operations.py @@ -477,9 +477,7 @@ def _try_resolve_environment_for_component(cls, component, _: str, resolver: Cal not isinstance(component.environment, dict) and not type(component.environment).__name__ == "InternalEnvironment" ): - component.environment = resolver( - component.environment, azureml_type=AzureMLResourceType.ENVIRONMENT - ) + component.environment = resolver(component.environment, azureml_type=AzureMLResourceType.ENVIRONMENT) def _resolve_arm_id_or_upload_dependencies(self, component: Component) -> None: if isinstance(component, AutoMLComponent): @@ -577,6 +575,7 @@ def _try_resolve_node_level_task_for_parallel_node(cls, node: BaseNode, _: str, The ideal solution should be done after PRS team decides how to handle parallel.task.code """ from azure.ai.ml.entities import Parallel, ParallelComponent + if not isinstance(node, Parallel): return component = node._component # pylint: disable=protected-access @@ -592,9 +591,7 @@ def _try_resolve_node_level_task_for_parallel_node(cls, node: BaseNode, _: str, ) node.task.code = component.code if node.task.environment: - node.task.environment = resolver( - component.environment, azureml_type=AzureMLResourceType.ENVIRONMENT - ) + node.task.environment = resolver(component.environment, azureml_type=AzureMLResourceType.ENVIRONMENT) @classmethod def _set_default_display_name_for_anonymous_component_in_node(cls, node: BaseNode, default_name: str): @@ -610,12 +607,12 @@ def _set_default_display_name_for_anonymous_component_in_node(cls, node: BaseNod # TODO: the same anonymous component with different node name will have different anonymous hash # as their display name will be different. if ( - isinstance(component, Component) - # check if component is anonymous and not created based on its id. We can't directly check - # node._component._is_anonymous as it will be set to True on component creation, - # which is later than this check - and not component.id - and not component.display_name + isinstance(component, Component) + # check if component is anonymous and not created based on its id. We can't directly check + # node._component._is_anonymous as it will be set to True on component creation, + # which is later than this check + and not component.id + and not component.display_name ): component.display_name = default_name @@ -634,11 +631,7 @@ def _try_resolve_compute_for_node(cls, node: BaseNode, _: str, resolver): node.compute_name = resolver(node.compute_name, azureml_type=AzureMLResourceType.COMPUTE) @classmethod - def _divide_nodes_to_resolve_into_layers( - cls, - component: PipelineComponent, - extra_operations: List[Callable] - ): + def _divide_nodes_to_resolve_into_layers(cls, component: PipelineComponent, extra_operations: List[Callable]): """Traverse the pipeline component and divide nodes to resolve into layers. For example, for below pipeline component, assuming that all nodes need to be resolved: A @@ -676,7 +669,7 @@ def _divide_nodes_to_resolve_into_layers( if isinstance(job_instance, BaseNode) and isinstance(job_instance._component, PipelineComponent): if cur_layer + 1 == len(layers): layers.append([]) - layers[cur_layer+1].extend(job_instance.component.jobs.items()) + layers[cur_layer + 1].extend(job_instance.component.jobs.items()) if cur_layer_head == len(layers[cur_layer]): cur_layer += 1 @@ -689,11 +682,7 @@ def _divide_nodes_to_resolve_into_layers( return layers def _resolve_dependencies_for_pipeline_component_jobs( - self, - component: Union[Component, str], - resolver: Callable, - *, - resolve_inputs: bool = True + self, component: Union[Component, str], resolver: Callable, *, resolve_inputs: bool = True ): """Resolve dependencies for pipeline component jobs. Will directly return if component is not a pipeline component. @@ -725,7 +714,7 @@ def _resolve_dependencies_for_pipeline_component_jobs( partial(self._try_resolve_environment_for_component, resolver=resolver), partial(self._try_resolve_compute_for_node, resolver=resolver), # should we resolve code here after we do extra operations concurrently? - ] + ], ) # cache anonymous component only for now diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py index 1ca829a67c80..c80487191f5d 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py @@ -115,7 +115,7 @@ def begin_create_or_update(self, compute: Compute) -> LROPoller[Compute]: module_logger.warning( "Warning: 'Location' is not supported for compute type %s and will not be used.", compute.type, - ) + ) compute.location = self._get_workspace_location() if not compute.location: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_data_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_data_operations.py index c1d612695f86..5b704780c9e8 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_data_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_data_operations.py @@ -22,7 +22,9 @@ from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationScope, _ScopeDependentOperations from azure.ai.ml._restclient.v2021_10_01_dataplanepreview import ( - AzureMachineLearningWorkspaces as ServiceClient102021Dataplane, ) + AzureMachineLearningWorkspaces as ServiceClient102021Dataplane, +) + # from azure.ai.ml._telemetry import ActivityType, monitor_with_activity from azure.ai.ml._utils._asset_utils import ( _archive_or_restore, @@ -62,13 +64,11 @@ class DataOperations(_ScopeDependentOperations): - def __init__( self, operation_scope: OperationScope, operation_config: OperationConfig, - service_client: Union[ServiceClient102022, - ServiceClient102021Dataplane], + service_client: Union[ServiceClient102022, ServiceClient102021Dataplane], datastore_operations: DatastoreOperations, **kwargs: Dict, ): @@ -103,65 +103,76 @@ def list( :rtype: ~azure.core.paging.ItemPaged[Data] """ if name: - return (self._operation.list( - name=name, + return ( + self._operation.list( + name=name, + registry_name=self._registry_name, + cls=lambda objs: [Data._from_rest_object(obj) for obj in objs], + list_view_type=list_view_type, + **self._scope_kwargs, + ) + if self._registry_name + else self._operation.list( + name=name, + workspace_name=self._workspace_name, + cls=lambda objs: [Data._from_rest_object(obj) for obj in objs], + list_view_type=list_view_type, + **self._scope_kwargs, + ) + ) + return ( + self._container_operation.list( registry_name=self._registry_name, - cls=lambda objs: [Data._from_rest_object(obj) for obj in objs], + cls=lambda objs: [Data._from_container_rest_object(obj) for obj in objs], list_view_type=list_view_type, **self._scope_kwargs, - ) if self._registry_name else self._operation.list( - name=name, + ) + if self._registry_name + else self._container_operation.list( workspace_name=self._workspace_name, - cls=lambda objs: [Data._from_rest_object(obj) for obj in objs], + cls=lambda objs: [Data._from_container_rest_object(obj) for obj in objs], list_view_type=list_view_type, **self._scope_kwargs, - )) - return (self._container_operation.list( - registry_name=self._registry_name, - cls=lambda objs: - [Data._from_container_rest_object(obj) for obj in objs], - list_view_type=list_view_type, - **self._scope_kwargs, - ) if self._registry_name else self._container_operation.list( - workspace_name=self._workspace_name, - cls=lambda objs: - [Data._from_container_rest_object(obj) for obj in objs], - list_view_type=list_view_type, - **self._scope_kwargs, - )) + ) + ) def _get(self, name: str, version: Optional[str] = None) -> Data: if version: - return (self._operation.get( + return ( + self._operation.get( + name=name, + version=version, + registry_name=self._registry_name, + **self._scope_kwargs, + **self._init_kwargs, + ) + if self._registry_name + else self._operation.get( + resource_group_name=self._resource_group_name, + workspace_name=self._workspace_name, + name=name, + version=version, + **self._init_kwargs, + ) + ) + return ( + self._container_operation.get( name=name, - version=version, registry_name=self._registry_name, **self._scope_kwargs, **self._init_kwargs, - ) if self._registry_name else self._operation.get( + ) + if self._registry_name + else self._container_operation.get( resource_group_name=self._resource_group_name, workspace_name=self._workspace_name, name=name, - version=version, **self._init_kwargs, - )) - return (self._container_operation.get( - name=name, - registry_name=self._registry_name, - **self._scope_kwargs, - **self._init_kwargs, - ) if self._registry_name else self._container_operation.get( - resource_group_name=self._resource_group_name, - workspace_name=self._workspace_name, - name=name, - **self._init_kwargs, - )) + ) + ) # @monitor_with_activity(logger, "Data.Get", ActivityType.PUBLICAPI) - def get(self, - name: str, - version: Optional[str] = None, - label: Optional[str] = None) -> Data: + def get(self, name: str, version: Optional[str] = None, label: Optional[str] = None) -> Data: """Get the specified data asset. :param name: Name of data asset. @@ -241,22 +252,18 @@ def create_or_update(self, data: Data) -> Data: version=version, resource_group=self._resource_group_name, registry=self._registry_name, - body=get_asset_body_for_registry_storage( - self._registry_name, "data", name, version), + body=get_asset_body_for_registry_storage(self._registry_name, "data", name, version), ) if not sas_uri: - module_logger.debug( - "Getting the existing asset name: %s, version: %s", - name, version) + module_logger.debug("Getting the existing asset name: %s, version: %s", name, version) return self.get(name=name, version=version) referenced_uris = self._validate(data) if referenced_uris: data._referenced_uris = referenced_uris - data, _ = _check_and_upload_path(artifact=data, - asset_operations=self, - sas_uri=sas_uri, - artifact_type=ErrorTarget.DATA) + data, _ = _check_and_upload_path( + artifact=data, asset_operations=self, sas_uri=sas_uri, artifact_type=ErrorTarget.DATA + ) data_version_resource = data._to_rest_object() auto_increment_version = data._auto_increment_version @@ -271,20 +278,23 @@ def create_or_update(self, data: Data) -> Data: **self._init_kwargs, ) else: - result = (self._operation.begin_create_or_update( - name=name, - version=version, - registry_name=self._registry_name, - body=data_version_resource, - **self._scope_kwargs, - ).result() if self._registry_name else - self._operation.create_or_update( - name=name, - version=version, - workspace_name=self._workspace_name, - body=data_version_resource, - **self._scope_kwargs, - )) + result = ( + self._operation.begin_create_or_update( + name=name, + version=version, + registry_name=self._registry_name, + body=data_version_resource, + **self._scope_kwargs, + ).result() + if self._registry_name + else self._operation.create_or_update( + name=name, + version=version, + workspace_name=self._workspace_name, + body=data_version_resource, + **self._scope_kwargs, + ) + ) if not result and self._registry_name: result = self._get(name=name, version=version) @@ -431,12 +441,8 @@ def _get_latest_version(self, name: str) -> Data: recently updated. """ latest_version = _get_latest_version_from_container( - name, - self._container_operation, - self._resource_group_name, - self._workspace_name, - self._registry_name - ) + name, self._container_operation, self._resource_group_name, self._workspace_name, self._registry_name + ) return self.get(name, version=latest_version) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_datastore_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_datastore_operations.py index 78fa5afe5cb1..8b66e83e986e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_datastore_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_datastore_operations.py @@ -13,7 +13,7 @@ from azure.ai.ml._restclient.v2022_10_01.models import ( Datastore as DatastoreData, DatastoreSecrets, - NoneDatastoreCredentials + NoneDatastoreCredentials, ) from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationScope, _ScopeDependentOperations @@ -41,8 +41,7 @@ def __init__( serviceclient_2022_10_01: ServiceClient2022_10_01, **kwargs: Dict ): - super(DatastoreOperations, self).__init__( - operation_scope, operation_config) + super(DatastoreOperations, self).__init__(operation_scope, operation_config) # ops_logger.update_info(kwargs) self._operation = serviceclient_2022_10_01.datastores self._credential = serviceclient_2022_10_01._config.credential @@ -66,8 +65,7 @@ def _list_helper(datastore_resource, include_secrets: bool): return self._operation.list( resource_group_name=self._operation_scope.resource_group_name, workspace_name=self._workspace_name, - cls=lambda objs: [_list_helper( - obj, include_secrets) for obj in objs], + cls=lambda objs: [_list_helper(obj, include_secrets) for obj in objs], **self._init_kwargs ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_model_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_model_operations.py index 845d85170c9f..4978074db6ff 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_model_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_model_operations.py @@ -30,9 +30,9 @@ # from azure.ai.ml._telemetry import ActivityType, monitor_with_activity from azure.ai.ml._utils._asset_utils import ( _archive_or_restore, - _create_or_update_autoincrement, _get_latest, _resolve_label_to_asset, + _get_next_version_from_container, ) from azure.ai.ml._utils._logger_utils import OpsLogger from azure.ai.ml._utils._registry_utils import ( @@ -105,15 +105,15 @@ def create_or_update( """ try: name = model.name - if not model.version and self._registry_name: - msg = "Model version is required for registry" - raise ValidationException( - message=msg, - no_personal_data_message=msg, - target=ErrorTarget.MODEL, - error_category=ErrorCategory.USER_ERROR, - error_type=ValidationErrorType.MISSING_FIELD, + if not model.version and model._auto_increment_version: + model.version = _get_next_version_from_container( + name=model.name, + container_operation=self._model_container_operation, + resource_group_name=self._operation_scope.resource_group_name, + workspace_name=self._workspace_name, + registry_name=self._registry_name, ) + version = model.version sas_uri = None @@ -172,33 +172,23 @@ def create_or_update( model_version_resource = model._to_rest_object() auto_increment_version = model._auto_increment_version try: - if auto_increment_version: - result = _create_or_update_autoincrement( - name=model.name, + result = ( + self._model_versions_operation.begin_create_or_update( + name=name, + version=version, + body=model_version_resource, + registry_name=self._registry_name, + **self._scope_kwargs, + ).result() + if self._registry_name + else self._model_versions_operation.create_or_update( + name=name, + version=version, body=model_version_resource, - version_operation=self._model_versions_operation, - container_operation=self._model_container_operation, workspace_name=self._workspace_name, **self._scope_kwargs, ) - else: - result = ( - self._model_versions_operation.begin_create_or_update( - name=name, - version=version, - body=model_version_resource, - registry_name=self._registry_name, - **self._scope_kwargs, - ).result() - if self._registry_name - else self._model_versions_operation.create_or_update( - name=name, - version=version, - body=model_version_resource, - workspace_name=self._workspace_name, - **self._scope_kwargs, - ) - ) + ) if not result and self._registry_name: result = self._get(name=model.name, version=model.version) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_online_deployment_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_online_deployment_operations.py index 1cc4c704e162..318d7aedd009 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_online_deployment_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_online_deployment_operations.py @@ -27,8 +27,9 @@ from azure.ai.ml._utils._endpoint_utils import upload_dependencies, validate_scoring_script from azure.ai.ml._utils._logger_utils import OpsLogger from azure.ai.ml.constants._common import ARM_ID_PREFIX, AzureMLResourceType, LROConfigurations -from azure.ai.ml.constants._deployment import EndpointDeploymentLogContainerType, SmallSKUs -from azure.ai.ml.entities import OnlineDeployment +from azure.ai.ml.constants._deployment import EndpointDeploymentLogContainerType, SmallSKUs, DEFAULT_MDC_PATH +from azure.ai.ml.entities import OnlineDeployment, Data +from azure.ai.ml.entities._deployment.data_asset import DataAsset from azure.ai.ml.exceptions import ( ErrorCategory, ErrorTarget, @@ -126,12 +127,12 @@ def begin_create_or_update( deployment=deployment, local_endpoint_mode=self._get_local_endpoint_mode(vscode_debug), ) - if (deployment and deployment.instance_type and deployment.instance_type.lower() in SmallSKUs): + if deployment and deployment.instance_type and deployment.instance_type.lower() in SmallSKUs: module_logger.warning( - "Instance type %s may be too small for compute resources. " # pylint: disable=line-too-long - "Minimum recommended compute SKU is Standard_DS3_v2 for general purpose endpoints. Learn more about SKUs here: " # pylint: disable=line-too-long + "Instance type %s may be too small for compute resources. " # pylint: disable=line-too-long + "Minimum recommended compute SKU is Standard_DS3_v2 for general purpose endpoints. Learn more about SKUs here: " # pylint: disable=line-too-long "https://learn.microsoft.com/en-us/azure/machine-learning/referencemanaged-online-endpoints-vm-sku-list", - deployment.instance_type # pylint: disable=line-too-long + deployment.instance_type, # pylint: disable=line-too-long ) if ( not skip_script_validation @@ -160,6 +161,8 @@ def begin_create_or_update( operation_scope=self._operation_scope, operation_config=self._operation_config, ) + if deployment.data_collector: + self._register_collection_data_assets(deployment=deployment) upload_dependencies(deployment, orchestrators) try: @@ -343,3 +346,18 @@ def _get_workspace_location(self) -> str: def _get_local_endpoint_mode(self, vscode_debug): return LocalEndpointMode.VSCodeDevContainer if vscode_debug else LocalEndpointMode.DetachedContainer + + def _register_collection_data_assets(self, deployment: OnlineDeployment) -> None: + for collection in deployment.data_collector.collections: + data_name = deployment.endpoint_name + "-" + deployment.name + "-" + collection + data_object = Data( + name=data_name, + path=deployment.data_collector.destination.path + if deployment.data_collector.destination and deployment.data_collector.destination.path + else DEFAULT_MDC_PATH, + is_anonymous=True, + ) + result = self._all_operations._all_operations[AzureMLResourceType.DATA].create_or_update(data_object) + deployment.data_collector.collections[collection].data = DataAsset( + data_id=result.id, path=result.path, name=result.name, version=result.version + ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_operation_orchestrator.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_operation_orchestrator.py index dba998f3c822..454e75e7aaa5 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_operation_orchestrator.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_operation_orchestrator.py @@ -144,9 +144,10 @@ def get_asset_arm_id( if azureml_type == AzureMLResourceType.ENVIRONMENT: azureml_prefix = "azureml:" # return the same value if resolved result is passed in - _asset = asset[len(azureml_prefix):] if asset.startswith(azureml_prefix) else asset + _asset = asset[len(azureml_prefix) :] if asset.startswith(azureml_prefix) else asset if _asset.startswith(CURATED_ENV_PREFIX) or re.match( - REGISTRY_VERSION_PATTERN, f"{azureml_prefix}{_asset}"): + REGISTRY_VERSION_PATTERN, f"{azureml_prefix}{_asset}" + ): return f"{azureml_prefix}{_asset}" name, label = parse_name_label(asset) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_virtual_cluster_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_virtual_cluster_operations.py index a301d22fe3dc..be355b3a6b19 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_virtual_cluster_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_virtual_cluster_operations.py @@ -18,7 +18,7 @@ module_logger = ops_logger.module_logger -class VirtualClusterOperations(): +class VirtualClusterOperations: """VirtualClusterOperations. You should not instantiate this class directly. Instead, you should @@ -70,6 +70,9 @@ def get(self, name: str) -> Dict: :rtype: Dict """ - - return get_virtual_cluster_by_id(name=name, resource_group=self._resource_group_name, - subscription_id=self._subscription_id, credential=self._credentials) + return get_virtual_cluster_by_id( + name=name, + resource_group=self._resource_group_name, + subscription_id=self._subscription_id, + credential=self._credentials, + ) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py index 28f3806314b9..d6e757b1515d 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py @@ -9,12 +9,14 @@ from azure.ai.ml._arm_deployments import ArmDeploymentExecutor from azure.ai.ml._arm_deployments.arm_helper import get_template -from azure.ai.ml._restclient.v2022_10_01_preview import AzureMachineLearningWorkspaces as ServiceClient102022Preview -from azure.ai.ml._restclient.v2022_10_01_preview.models import ( +from azure.ai.ml._restclient.v2022_12_01_preview import AzureMachineLearningWorkspaces as ServiceClient122022Preview +from azure.ai.ml._restclient.v2022_12_01_preview.models import ( EncryptionKeyVaultUpdateProperties, EncryptionUpdateProperties, WorkspaceUpdateParameters, ) +from azure.ai.ml.entities._workspace.networking import ManagedNetwork +from azure.ai.ml.constants._workspace import IsolationMode from azure.ai.ml._scope_dependent_operations import OperationsContainer, OperationScope # from azure.ai.ml._telemetry import ActivityType, monitor_with_activity @@ -66,7 +68,7 @@ class WorkspaceOperations: def __init__( self, operation_scope: OperationScope, - service_client: ServiceClient102022Preview, + service_client: ServiceClient122022Preview, all_operations: OperationsContainer, credentials: Optional[TokenCredential] = None, **kwargs: Dict, @@ -268,6 +270,12 @@ def begin_update( rest_user_assigned_identities[uai.resource_id] = None identity.user_assigned_identities = rest_user_assigned_identities + managed_network = kwargs.get("managed_network", workspace.managed_network) + if isinstance(managed_network, str): + managed_network = ManagedNetwork(managed_network)._to_rest_object() + elif isinstance(managed_network, ManagedNetwork): + managed_network = workspace.managed_network._to_rest_object() + container_registry = kwargs.get("container_registry", workspace.container_registry) # Empty string is for erasing the value of container_registry, None is to be ignored value if ( @@ -316,6 +324,7 @@ def begin_update( primary_user_assigned_identity=kwargs.get( "primary_user_assigned_identity", workspace.primary_user_assigned_identity ), + managed_network=managed_network, ) update_param.container_registry = container_registry or None update_param.application_insights = application_insights or None @@ -593,6 +602,13 @@ def _populate_arm_paramaters(self, workspace: Workspace) -> Tuple[dict, dict, di if workspace.primary_user_assigned_identity: _set_val(param["primaryUserAssignedIdentity"], workspace.primary_user_assigned_identity) + managed_network = None + if workspace.managed_network: + managed_network = workspace.managed_network._to_rest_object() + else: + managed_network = ManagedNetwork(IsolationMode.DISABLED)._to_rest_object() + _set_val(param["managedNetwork"], managed_network) + resources_being_deployed[workspace.name] = (ArmConstants.WORKSPACE, None) return template, param, resources_being_deployed diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_outbound_rule_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_outbound_rule_operations.py new file mode 100644 index 000000000000..814fec876069 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_outbound_rule_operations.py @@ -0,0 +1,91 @@ +# --------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# --------------------------------------------------------- + +from typing import Dict +from azure.ai.ml._restclient.v2022_12_01_preview import AzureMachineLearningWorkspaces as ServiceClient122022Preview +from azure.ai.ml._restclient.v2022_12_01_preview.models import ( + FqdnOutboundRule, + PrivateEndpointOutboundRule, + PrivateEndpointOutboundRuleDestination, + ServiceTagOutboundRule, + ServiceTagOutboundRuleDestination, +) +from azure.ai.ml._scope_dependent_operations import OperationsContainer, OperationScope + +# from azure.ai.ml._telemetry import ActivityType, monitor_with_activity +from azure.ai.ml._utils._logger_utils import OpsLogger +from azure.ai.ml.entities._workspace.networking import OutboundRule +from azure.ai.ml.constants._workspace import ( + OutboundRuleCategory, OutboundRuleType +) +from azure.ai.ml.exceptions import ErrorCategory, ErrorTarget, ValidationException +from azure.core.credentials import TokenCredential +from azure.core.polling import LROPoller + +from azure.ai.ml._utils.utils import _snake_to_camel + +ops_logger = OpsLogger(__name__) +module_logger = ops_logger.module_logger + + +class WorkspaceOutboundRuleOperations: + def __init__( + self, + operation_scope: OperationScope, + service_client: ServiceClient122022Preview, + all_operations: OperationsContainer, + credentials: TokenCredential = None, + **kwargs: Dict, + ): + self._subscription_id = operation_scope.subscription_id + self._resource_group_name = operation_scope.resource_group_name + self._default_workspace_name = operation_scope.workspace_name + self._all_operations = all_operations + self._rule_operation = service_client.managed_network_settings_rule + self._network_operation = service_client.managed_network_settings + self._credentials = credentials + self._init_kwargs = kwargs + + def show(self, resource_group: str, ws_name: str, outbound_rule_name: str, **kwargs) -> OutboundRule: + workspace_name = self._check_workspace_name(ws_name) + resource_group = kwargs.get("resource_group") or self._resource_group_name + + obj = self._rule_operation.get(resource_group, workspace_name, outbound_rule_name) + return OutboundRule._from_rest_object(obj) # pylint: disable=protected-access + + def list(self, resource_group: str, ws_name: str, **kwargs) -> Dict[str, OutboundRule]: + workspace_name = self._check_workspace_name(ws_name) + resource_group = kwargs.get("resource_group") or self._resource_group_name + + rest_rules = self._rule_operation.list(resource_group, workspace_name) + + result = { + rule_name: OutboundRule._from_rest_object(rest_rules[rule_name]) # pylint: disable=protected-access + for rule_name in rest_rules.keys() + } + return result + + def remove(self, resource_group: str, ws_name: str, outbound_rule_name: str, **kwargs) -> LROPoller: + workspace_name = self._check_workspace_name(ws_name) + resource_group = kwargs.get("resource_group") or self._resource_group_name + + poller = self._rule_operation.begin_delete( + resource_group_name=resource_group, + workspace_name=workspace_name, + rule_name=outbound_rule_name, + ) + module_logger.info("Delete request initiated for outbound rule: %s\n", outbound_rule_name) + return poller + + def _check_workspace_name(self, name) -> str: + workspace_name = name or self._default_workspace_name + if not workspace_name: + msg = "Please provide a workspace name or use a MLClient with a workspace name set." + raise ValidationException( + message=msg, + target=ErrorTarget.WORKSPACE, + no_personal_data_message=msg, + error_category=ErrorCategory.USER_ERROR, + ) + return workspace_name diff --git a/sdk/ml/azure-ai-ml/pyproject.toml b/sdk/ml/azure-ai-ml/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/ml/azure-ai-ml/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/ml/azure-ai-ml/samples/ml_samples_authentication_sovereign_cloud.py b/sdk/ml/azure-ai-ml/samples/ml_samples_authentication_sovereign_cloud.py index bc4191028dae..436b9bb1d180 100644 --- a/sdk/ml/azure-ai-ml/samples/ml_samples_authentication_sovereign_cloud.py +++ b/sdk/ml/azure-ai-ml/samples/ml_samples_authentication_sovereign_cloud.py @@ -25,7 +25,6 @@ class MLClientSamples(object): - def ml_auth_azure_default_credential(self): # [START create_ml_client_default_credential] # Get a credential for authentication @@ -48,14 +47,14 @@ def ml_auth_azure_default_credential(self): # AzureAuthorityHosts.AZURE_CHINA or AzureAuthorityHosts.AZURE_GOVERNMENT # credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_CHINA) credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_PUBLIC_CLOUD) - + # When using sovereign domains (that is, any cloud other than AZURE_PUBLIC_CLOUD), # you must pass in the cloud name in kwargs. Default cloud is AzureCloud kwargs = {"cloud": "AzureCloud"} # get a handle to the subscription ml_client = MLClient(credential, subscription_id, resource_group, **kwargs) # [END create_ml_client_default_credential] - + from azure.ai.ml.entities import Workspace # Get a list of workspaces in a resource group @@ -63,6 +62,6 @@ def ml_auth_azure_default_credential(self): print(ws.name, ":", ws.location, ":", ws.description) -if __name__ == '__main__': +if __name__ == "__main__": sample = MLClientSamples() sample.ml_auth_azure_default_credential() diff --git a/sdk/ml/azure-ai-ml/scripts/regenerate_restclient.py b/sdk/ml/azure-ai-ml/scripts/regenerate_restclient.py index e36bb82b5965..2bf4e554ddf9 100644 --- a/sdk/ml/azure-ai-ml/scripts/regenerate_restclient.py +++ b/sdk/ml/azure-ai-ml/scripts/regenerate_restclient.py @@ -131,7 +131,6 @@ def regenerate_restclient(api_tag, verbose): ) - if __name__ == "__main__": parser = ArgumentParser() diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/machineLearningServices.json b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/machineLearningServices.json index 88cfc36a85c6..9f495fb6043d 100644 --- a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/machineLearningServices.json +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/machineLearningServices.json @@ -1970,6 +1970,295 @@ } } } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork": { + "get": { + "tags": [ + "ManagedNetwork" + ], + "operationId": "ManagedNetworkSettings_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/ManagedNetworkSettings" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get ManagedNetworkSettings": { + "$ref": "./examples/ManagedNetwork/get.json" + } + } + }, + "patch": { + "tags": [ + "ManagedNetwork" + ], + "operationId": "ManagedNetworkSettings_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ManagedNetworkDto" + } + } + ], + "responses": { + "202": { + "description": "Success" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Update ManagedNetworkSettings": { + "$ref": "./examples/ManagedNetwork/patch.json" + } + }, + "x-ms-long-running-operation": true + }, + "put": { + "tags": [ + "ManagedNetwork" + ], + "operationId": "ManagedNetworkSettings_CreateOrUpdate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ManagedNetworkDto" + } + } + ], + "responses": { + "202": { + "description": "Success" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "CreateOrUpdate ManagedNetworkSettings": { + "$ref": "./examples/ManagedNetwork/put.json" + } + }, + "x-ms-long-running-operation": true + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules": { + "get": { + "tags": [ + "ManagedNetwork" + ], + "operationId": "ManagedNetworkSettingsRule_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/OutboundRule" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List ManagedNetworkSettingsRule": { + "$ref": "./examples/ManagedNetwork/listRule.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/managedNetwork/outboundRules/{ruleName}": { + "delete": { + "tags": [ + "ManagedNetwork" + ], + "operationId": "ManagedNetworkSettingsRule_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "in": "path", + "name": "ruleName", + "required": true, + "type": "string" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Success" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete ManagedNetworkSettingsRule": { + "$ref": "./examples/ManagedNetwork/deleteRule.json" + } + }, + "x-ms-long-running-operation": true + }, + "get": { + "tags": [ + "ManagedNetwork" + ], + "operationId": "ManagedNetworkSettingsRule_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "in": "path", + "name": "ruleName", + "required": true, + "type": "string" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/OutboundRule" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get ManagedNetworkSettingsRule": { + "$ref": "./examples/ManagedNetwork/getRule.json" + } + } + } } }, "parameters": { @@ -2340,6 +2629,15 @@ "featureStoreSettings": { "description": "Settings for feature store type workspace.", "$ref": "#/definitions/FeatureStoreSettings" + }, + "managedNetwork": { + "description": "Managed network settings.", + "allOf": [ + { + "$ref": "#/definitions/ManagedNetworkSettings" + } + ], + "x-nullable": true } } }, @@ -2417,6 +2715,10 @@ "$ref": "#/definitions/EncryptionUpdateProperties", "description": "The encryption settings of the workspace." }, + "managedNetwork": { + "description": "Managed network settings.", + "$ref": "#/definitions/ManagedNetworkSettings" + }, "featureStoreSettings": { "description": "Settings for feature store type workspace.", "$ref": "#/definitions/FeatureStoreSettings" @@ -6260,6 +6562,197 @@ } } }, + "ManagedNetworkDto": { + "type": "object", + "properties": { + "isolationMode": { + "type": "string", + "allOf": [ + { + "$ref": "#/definitions/IsolationMode" + } + ] + }, + "outboundRules": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/OutboundRule" + }, + "x-nullable": true + } + } + }, + "ManagedNetworkSettings": { + "type": "object", + "properties": { + "isolationMode": { + "type": "string", + "allOf": [ + { + "$ref": "#/definitions/IsolationMode" + } + ] + }, + "networkId": { + "format": "uuid", + "type": "string" + }, + "outboundRules": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/OutboundRule" + }, + "x-nullable": true + } + } + }, + "IsolationMode": { + "enum": [ + "Disabled", + "AllowInternetOutbound", + "AllowOnlyApprovedOutbound" + ], + "type": "string", + "x-ms-enum": { + "name": "IsolationMode", + "modelAsString": true + } + }, + "OutboundRule": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "allOf": [ + { + "$ref": "#/definitions/RuleType" + } + ] + }, + "category": { + "type": "string", + "allOf": [ + { + "$ref": "#/definitions/RuleCategory" + } + ] + } + }, + "discriminator": "type" + }, + "RuleType": { + "enum": [ + "FQDN", + "PrivateEndpoint", + "ServiceTag" + ], + "type": "string", + "x-ms-enum": { + "name": "RuleType", + "modelAsString": true + } + }, + "RuleCategory": { + "enum": [ + "Required", + "Recommended", + "UserDefined" + ], + "type": "string", + "x-ms-enum": { + "name": "RuleCategory", + "modelAsString": true + } + }, + "FqdnOutboundRule": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/OutboundRule" + } + ], + "properties": { + "destination": { + "type": "string", + "x-nullable": true + } + }, + "x-ms-discriminator-value": "FQDN" + }, + "PrivateEndpointOutboundRule": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/OutboundRule" + } + ], + "properties": { + "destination": { + "allOf": [ + { + "$ref": "#/definitions/PrivateEndpointDestination" + } + ], + "x-nullable": true + } + }, + "x-ms-discriminator-value": "PrivateEndpoint" + }, + "PrivateEndpointDestination": { + "type": "object", + "properties": { + "serviceResourceId": { + "type": "string", + "x-nullable": true + }, + "subresourceTarget": { + "type": "string", + "x-nullable": true + }, + "sparkEnabled": { + "type": "boolean" + } + } + }, + "ServiceTagOutboundRule": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/OutboundRule" + } + ], + "properties": { + "destination": { + "allOf": [ + { + "$ref": "#/definitions/ServiceTagDestination" + } + ], + "x-nullable": true + } + }, + "x-ms-discriminator-value": "ServiceTag" + }, + "ServiceTagDestination": { + "type": "object", + "properties": { + "serviceTag": { + "type": "string", + "x-nullable": true + }, + "protocol": { + "type": "string", + "x-nullable": true + }, + "portRanges": { + "type": "string", + "x-nullable": true + } + } + }, "ComputeRuntimeDto": { "type": "object", "properties": { diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification.py index 0b428ef68426..4647c039590f 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification.py @@ -23,10 +23,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestAutoMLImageClassification(AzureRecordedTestCase): def _create_jsonl_multiclass(self, client, train_path, val_path): @@ -137,4 +134,6 @@ def test_image_classification_multiclass_run( assert_final_job_status(submitted_job_sweep, client, ImageClassificationJob, JobStatus.COMPLETED, deadline=3600) # Assert completion of Automode job - assert_final_job_status(submitted_job_automode, client, ImageClassificationJob, JobStatus.COMPLETED, deadline=3600) + assert_final_job_status( + submitted_job_automode, client, ImageClassificationJob, JobStatus.COMPLETED, deadline=3600 + ) diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification_multilabel.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification_multilabel.py index 53666586a977..e0743407c504 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification_multilabel.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_classification_multilabel.py @@ -27,10 +27,7 @@ "mock_asset_name", "mock_code_hash", ) -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestAutoMLImageClassificationMultilabel(AzureRecordedTestCase): def _create_jsonl_multilabel(self, client: MLClient, train_path: str, val_path: str): src_images = "./multilabelFridgeObjects/" @@ -144,7 +141,11 @@ def test_image_classification_multilabel_run( submitted_job_automode = client.jobs.create_or_update(image_classification_multilabel_job_automode) # Assert completion of regular sweep job - assert_final_job_status(submitted_job_sweep, client, ImageClassificationMultilabelJob, JobStatus.COMPLETED, deadline=3600) + assert_final_job_status( + submitted_job_sweep, client, ImageClassificationMultilabelJob, JobStatus.COMPLETED, deadline=3600 + ) # Assert completion of Automode job - assert_final_job_status(submitted_job_automode, client, ImageClassificationMultilabelJob, JobStatus.COMPLETED, deadline=3600) + assert_final_job_status( + submitted_job_automode, client, ImageClassificationMultilabelJob, JobStatus.COMPLETED, deadline=3600 + ) diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_object_detection.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_object_detection.py index b244ebacfb49..99a4c17e767f 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_object_detection.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_object_detection.py @@ -23,10 +23,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestAutoMLImageObjectDetection(AzureRecordedTestCase): def _create_jsonl_object_detection(self, client, train_path, val_path): import xml.etree.ElementTree as ET @@ -168,7 +165,11 @@ def test_image_object_detection_run( submitted_job_automode = client.jobs.create_or_update(image_object_detection_job_automode) # Assert completion of regular sweep job - assert_final_job_status(submitted_job_sweep, client, ImageObjectDetectionJob, JobStatus.COMPLETED, deadline=3600) + assert_final_job_status( + submitted_job_sweep, client, ImageObjectDetectionJob, JobStatus.COMPLETED, deadline=3600 + ) # Assert completion of Automode job - assert_final_job_status(submitted_job_automode, client, ImageObjectDetectionJob, JobStatus.COMPLETED, deadline=3600) + assert_final_job_status( + submitted_job_automode, client, ImageObjectDetectionJob, JobStatus.COMPLETED, deadline=3600 + ) diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_segmentation.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_segmentation.py index edcd100acc19..605dde03f616 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_segmentation.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_automl_image_segmentation.py @@ -24,7 +24,7 @@ @pytest.mark.usefixtures("recorded_test") @pytest.mark.skipif( condition=not is_live() or platform.python_implementation() == "PyPy", - reason="Datasets downloaded by test are too large to record reliably" + reason="Datasets downloaded by test are too large to record reliably", ) class TestAutoMLImageSegmentation(AzureRecordedTestCase): def _create_jsonl_segmentation(self, client, train_path, val_path): @@ -36,6 +36,7 @@ def _create_jsonl_segmentation(self, client, train_path, val_path): data_path_uri = client.data.create_or_update(fridge_data) import os + train_annotations_file = os.path.join(train_path, "train_annotations.jsonl") validation_annotations_file = os.path.join(val_path, "validation_annotations.jsonl") @@ -60,7 +61,7 @@ def _update_jsonl_path(self, remote_path, file_path): # Update image url json_line["image_url"] = remote_path + old_url[result + len(data_path) :] jsonl_file_write.write(json.dumps(json_line) + "\n") - + def test_image_segmentation_run(self, image_segmentation_dataset: Tuple[Input, Input], client: MLClient) -> None: # Note: this test launches two jobs in order to avoid calling the dataset fixture more than once. Ideally, it # would have sufficed to mark the fixture with session scope, but pytest-xdist breaks this functionality: @@ -118,7 +119,11 @@ def test_image_segmentation_run(self, image_segmentation_dataset: Tuple[Input, I submitted_job_automode = client.jobs.create_or_update(image_instance_segmentation_job_automode) # Assert completion of regular sweep job - assert_final_job_status(submitted_job_sweep, client, ImageInstanceSegmentationJob, JobStatus.COMPLETED, deadline=3600) + assert_final_job_status( + submitted_job_sweep, client, ImageInstanceSegmentationJob, JobStatus.COMPLETED, deadline=3600 + ) # Assert completion of Automode job - assert_final_job_status(submitted_job_automode, client, ImageInstanceSegmentationJob, JobStatus.COMPLETED, deadline=3600) + assert_final_job_status( + submitted_job_automode, client, ImageInstanceSegmentationJob, JobStatus.COMPLETED, deadline=3600 + ) diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_classification.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_classification.py index 8128606c50a0..7d6e27f3e50e 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_classification.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_classification.py @@ -1,4 +1,3 @@ - # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- @@ -18,10 +17,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestAutoMLClassification(AzureRecordedTestCase): def get_classification_task( self, dataset: Tuple[Input, Input, str], experiment_name: str, add_validation: bool = False diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_forecasting.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_forecasting.py index 8a4acc0d8821..1643a1b20543 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_forecasting.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_forecasting.py @@ -17,10 +17,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestAutoMLForecasting(AzureRecordedTestCase): def get_forecasting_task( self, diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_regression.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_regression.py index 6d67a7ca3316..9e6e77807cd7 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_regression.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_regression.py @@ -17,10 +17,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestAutoMLRegression(AzureRecordedTestCase): def get_regression_task( self, dataset: Tuple[Input, str], experiment_name: str, add_validation: bool = False diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification.py index 7b05d2bea898..24c5c38be9b4 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification.py @@ -17,10 +17,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestTextClassification(AzureRecordedTestCase): def test_remote_run_text_classification( self, diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification_multilabel.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification_multilabel.py index 738c6ada295c..26c2af9a03e0 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification_multilabel.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_classification_multilabel.py @@ -17,10 +17,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestTextClassificationMultilabel(AzureRecordedTestCase): def test_remote_run_text_classification_multilabel( self, paper_categorization: Tuple[Input, Input, str], client: MLClient diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_ner.py b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_ner.py index 2d0996cf32a3..4297815e08ca 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_ner.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/e2etests/test_remote_text_ner.py @@ -17,10 +17,7 @@ @pytest.mark.automl_test @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="Datasets downloaded by test are too large to record reliably" -) +@pytest.mark.skipif(condition=not is_live(), reason="Datasets downloaded by test are too large to record reliably") class TestTextNer(AzureRecordedTestCase): def test_remote_run_text_ner( self, diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_schema.py b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_schema.py index f56a6edf6787..3961b759102c 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_schema.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_schema.py @@ -164,8 +164,7 @@ def expected_image_search_space_settings() -> List[RestImageClassificationSearch learning_rate="uniform(0.005,0.05)", model_name="choice('vitb16r224','vits16r224')", number_of_epochs="choice(15,30)", - ams_gradient="choice(True,False)" - + ams_gradient="choice(True,False)", ), RestImageClassificationSearchSpace( learning_rate="uniform(0.005,0.05)", @@ -173,7 +172,7 @@ def expected_image_search_space_settings() -> List[RestImageClassificationSearch training_crop_size="choice(224,256)", validation_crop_size="choice(224,256)", validation_resize_size="choice(288,320,352)", - ams_gradient="False" + ams_gradient="False", ), ] @@ -691,13 +690,18 @@ def test_image_classification_schema_validation(self, tmp_path: Path): with pytest.raises(ValidationError, match="Value 'random_lr_scheduler1' passed is not in set"): load_job(test_yaml_path) - test_config_copy["search_space"][0]["learning_rate_scheduler"] = f"{camel_to_snake(LearningRateScheduler.WARMUP_COSINE)}" + test_config_copy["search_space"][0][ + "learning_rate_scheduler" + ] = f"{camel_to_snake(LearningRateScheduler.WARMUP_COSINE)}" dump_yaml_to_file(test_yaml_path, test_config_copy) assert isinstance(load_job(test_yaml_path), image_classification_job.ImageClassificationJob) test_config_copy["search_space"][0]["learning_rate_scheduler"] = { "type": "choice", - "values": [f"{camel_to_snake(LearningRateScheduler.WARMUP_COSINE)}", f"{camel_to_snake(LearningRateScheduler.STEP)}"], + "values": [ + f"{camel_to_snake(LearningRateScheduler.WARMUP_COSINE)}", + f"{camel_to_snake(LearningRateScheduler.STEP)}", + ], } dump_yaml_to_file(test_yaml_path, test_config_copy) assert isinstance(load_job(test_yaml_path), image_classification_job.ImageClassificationJob) diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_sweep_setting.py b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_sweep_setting.py index e0fe5113e2cc..ad9ac47b18a6 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_sweep_setting.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_image_sweep_setting.py @@ -23,15 +23,15 @@ class TestImageSweepSettings: _EARLY_TERMINATION_POLICY_OPTIONS = [ - None, + None, EarlyTerminationPolicyType.BANDIT, - EarlyTerminationPolicyType.MEDIAN_STOPPING, - EarlyTerminationPolicyType.TRUNCATION_SELECTION + EarlyTerminationPolicyType.MEDIAN_STOPPING, + EarlyTerminationPolicyType.TRUNCATION_SELECTION, ] _SAMPLING_ALGORITHM_OPTIONS = [ - SamplingAlgorithmType.GRID, - SamplingAlgorithmType.BAYESIAN, - SamplingAlgorithmType.RANDOM + SamplingAlgorithmType.GRID, + SamplingAlgorithmType.BAYESIAN, + SamplingAlgorithmType.RANDOM, ] _EARLY_TERM_POLICY_AND_SAMPLING_ALG_OPTIONS = list( product(_EARLY_TERMINATION_POLICY_OPTIONS, _SAMPLING_ALGORITHM_OPTIONS) @@ -41,95 +41,82 @@ class TestImageSweepSettings: "early_termination_name,sampling_algorithm_name", _EARLY_TERM_POLICY_AND_SAMPLING_ALG_OPTIONS ) def test_image_sweep_settings_from_rest( - self, - early_termination_name: Optional[EarlyTerminationPolicyType], - sampling_algorithm_name: SamplingAlgorithmType + self, + early_termination_name: Optional[EarlyTerminationPolicyType], + sampling_algorithm_name: SamplingAlgorithmType, ) -> None: - image_sweep_settings_rest = self._get_rest_obj( - early_termination_name, sampling_algorithm_name - ) - expected_image_sweep_settings_obj = self._get_entity_obj( - early_termination_name, sampling_algorithm_name - ) + image_sweep_settings_rest = self._get_rest_obj(early_termination_name, sampling_algorithm_name) + expected_image_sweep_settings_obj = self._get_entity_obj(early_termination_name, sampling_algorithm_name) image_sweep_settings_obj = ImageSweepSettings._from_rest_object(image_sweep_settings_rest) - assert image_sweep_settings_obj == expected_image_sweep_settings_obj, \ - f"actual: {image_sweep_settings_obj}, expected: {expected_image_sweep_settings_obj}" + assert ( + image_sweep_settings_obj == expected_image_sweep_settings_obj + ), f"actual: {image_sweep_settings_obj}, expected: {expected_image_sweep_settings_obj}" @pytest.mark.parametrize( "early_termination_name,sampling_algorithm_name", _EARLY_TERM_POLICY_AND_SAMPLING_ALG_OPTIONS ) def test_image_sweep_settings_to_rest( - self, - early_termination_name: Optional[EarlyTerminationPolicyType], - sampling_algorithm_name: SamplingAlgorithmType + self, + early_termination_name: Optional[EarlyTerminationPolicyType], + sampling_algorithm_name: SamplingAlgorithmType, ) -> None: - image_sweep_settings_obj = self._get_entity_obj( - early_termination_name, sampling_algorithm_name - ) - expected_image_sweep_settings_rest = self._get_rest_obj( - early_termination_name, sampling_algorithm_name - ) + image_sweep_settings_obj = self._get_entity_obj(early_termination_name, sampling_algorithm_name) + expected_image_sweep_settings_rest = self._get_rest_obj(early_termination_name, sampling_algorithm_name) image_sweep_settings_rest = image_sweep_settings_obj._to_rest_object() - assert image_sweep_settings_rest == expected_image_sweep_settings_rest, \ - f"actual: {image_sweep_settings_rest}, expected: {expected_image_sweep_settings_rest}" + assert ( + image_sweep_settings_rest == expected_image_sweep_settings_rest + ), f"actual: {image_sweep_settings_rest}, expected: {expected_image_sweep_settings_rest}" @pytest.mark.parametrize( "early_termination_name,sampling_algorithm_name", _EARLY_TERM_POLICY_AND_SAMPLING_ALG_OPTIONS ) def test_equality( - self, - early_termination_name: Optional[EarlyTerminationPolicyType], - sampling_algorithm_name: SamplingAlgorithmType + self, + early_termination_name: Optional[EarlyTerminationPolicyType], + sampling_algorithm_name: SamplingAlgorithmType, ) -> None: image_sweep_settings_obj = self._get_entity_obj(early_termination_name, sampling_algorithm_name) # serialize and deserialize to ensure equality image_sweep_settings_rest = ImageSweepSettings._to_rest_object(image_sweep_settings_obj) image_sweep_settings_obj_2 = ImageSweepSettings._from_rest_object(image_sweep_settings_rest) - assert image_sweep_settings_obj == image_sweep_settings_obj_2, \ - f"actual: {image_sweep_settings_obj}, expected: {image_sweep_settings_obj_2}" + assert ( + image_sweep_settings_obj == image_sweep_settings_obj_2 + ), f"actual: {image_sweep_settings_obj}, expected: {image_sweep_settings_obj_2}" def _get_rest_obj( - self, + self, early_termination_name: Optional[EarlyTerminationPolicyType] = None, - sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID + sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID, ) -> RestImageSweepSettings: if early_termination_name == EarlyTerminationPolicyType.BANDIT: rest_early_termination_name = RestBanditPolicy(evaluation_interval=10, slack_factor=0.2) elif early_termination_name == EarlyTerminationPolicyType.MEDIAN_STOPPING: - rest_early_termination_name = RestMedianStoppingPolicy(delay_evaluation = 5, evaluation_interval = 1) + rest_early_termination_name = RestMedianStoppingPolicy(delay_evaluation=5, evaluation_interval=1) elif early_termination_name == EarlyTerminationPolicyType.TRUNCATION_SELECTION: rest_early_termination_name = RestTruncationSelectionPolicy( - evaluation_interval=1, - truncation_percentage=20, - delay_evaluation=5 + evaluation_interval=1, truncation_percentage=20, delay_evaluation=5 ) else: rest_early_termination_name = None - + return RestImageSweepSettings( - sampling_algorithm=sampling_algorithm_name, - early_termination=rest_early_termination_name + sampling_algorithm=sampling_algorithm_name, early_termination=rest_early_termination_name ) def _get_entity_obj( - self, + self, early_termination_name: Optional[EarlyTerminationPolicyType] = None, - sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID + sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID, ) -> ImageSweepSettings: if early_termination_name == EarlyTerminationPolicyType.BANDIT: early_termination_name = BanditPolicy(evaluation_interval=10, slack_factor=0.2) elif early_termination_name == EarlyTerminationPolicyType.MEDIAN_STOPPING: - early_termination_name = MedianStoppingPolicy(delay_evaluation = 5, evaluation_interval = 1) + early_termination_name = MedianStoppingPolicy(delay_evaluation=5, evaluation_interval=1) elif early_termination_name == EarlyTerminationPolicyType.TRUNCATION_SELECTION: early_termination_name = TruncationSelectionPolicy( - evaluation_interval=1, - truncation_percentage=20, - delay_evaluation=5 + evaluation_interval=1, truncation_percentage=20, delay_evaluation=5 ) else: early_termination_name = None - - return ImageSweepSettings( - sampling_algorithm=sampling_algorithm_name, - early_termination=early_termination_name - ) + + return ImageSweepSettings(sampling_algorithm=sampling_algorithm_name, early_termination=early_termination_name) diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_schema.py b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_schema.py index 5d168db02449..6afe697a168d 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_schema.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_schema.py @@ -81,7 +81,7 @@ def nlp_sweep_settings_expected() -> RestNlpSweepSettings: early_termination=RestBanditPolicy( slack_amount=0.02, evaluation_interval=10, - ) + ), ) @@ -99,13 +99,13 @@ def nlp_search_space_expected() -> List[RestNlpParameterSubspace]: RestNlpParameterSubspace( model_name="choice('bert-base-cased','bert-base-uncased')", learning_rate="uniform(0.000005,0.00005)", - learning_rate_scheduler="choice('linear','cosine_with_restarts')" + learning_rate_scheduler="choice('linear','cosine_with_restarts')", ), RestNlpParameterSubspace( model_name="choice('roberta-base','roberta-large')", learning_rate="uniform(0.000002,0.000008)", - gradient_accumulation_steps="choice(1,2,3)" - ) + gradient_accumulation_steps="choice(1,2,3)", + ), ] @@ -245,9 +245,8 @@ def _get_rest_automl_job(automl_task, name, compute_id): @pytest.fixture def loaded_text_classification_job( - mock_machinelearning_client: OperationScope, - run_type: str, - tmp_path: Path) -> AutoMLJob: + mock_machinelearning_client: OperationScope, run_type: str, tmp_path: Path +) -> AutoMLJob: return _load_automl_job_from_path( mock_machinelearning_client, @@ -259,9 +258,8 @@ def loaded_text_classification_job( @pytest.fixture def loaded_text_classification_multilabel_job( - mock_machinelearning_client: OperationScope, - run_type: str, - tmp_path: Path) -> AutoMLJob: + mock_machinelearning_client: OperationScope, run_type: str, tmp_path: Path +) -> AutoMLJob: return _load_automl_job_from_path( mock_machinelearning_client, run_type, @@ -271,10 +269,7 @@ def loaded_text_classification_multilabel_job( @pytest.fixture -def loaded_text_ner_job( - mock_machinelearning_client: OperationScope, - run_type: str, - tmp_path: Path) -> AutoMLJob: +def loaded_text_ner_job(mock_machinelearning_client: OperationScope, run_type: str, tmp_path: Path) -> AutoMLJob: return _load_automl_job_from_path( mock_machinelearning_client, run_type, @@ -284,10 +279,8 @@ def loaded_text_ner_job( def _load_automl_job_from_path( - mock_machinelearning_client: OperationScope, - run_type: str, - tmp_path: Path, - schema_path: Path) -> AutoMLJob: + mock_machinelearning_client: OperationScope, run_type: str, tmp_path: Path, schema_path: Path +) -> AutoMLJob: test_config = load_yaml(schema_path) if run_type == "single": test_config["limits"]["max_trials"] = 1 diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_sweep_settings.py b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_sweep_settings.py index 53f9abd0262d..6fac96a39a5d 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_sweep_settings.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_automl_nlp_sweep_settings.py @@ -31,46 +31,49 @@ class TestNlpSweepSettings: EARLY_TERM_SAMPL_ALG_PAIRS = list(product(ALL_TERMINATION_POLICIES, ALL_SAMPLING_ALGORITHMS)) - @pytest.mark.parametrize( - "early_termination_name,sampling_algorithm_name", EARLY_TERM_SAMPL_ALG_PAIRS - ) - def test_nlp_sweep_settings_from_rest(self, - early_termination_name: Optional[EarlyTerminationPolicyType], - sampling_algorithm_name: SamplingAlgorithmType) -> None: + @pytest.mark.parametrize("early_termination_name,sampling_algorithm_name", EARLY_TERM_SAMPL_ALG_PAIRS) + def test_nlp_sweep_settings_from_rest( + self, + early_termination_name: Optional[EarlyTerminationPolicyType], + sampling_algorithm_name: SamplingAlgorithmType, + ) -> None: nlp_sweep_settings_rest = self._get_rest_obj(early_termination_name, sampling_algorithm_name) expected_nlp_sweep_settings_obj = self._get_entity_obj(early_termination_name, sampling_algorithm_name) nlp_sweep_settings_obj = NlpSweepSettings._from_rest_object(nlp_sweep_settings_rest) - assert nlp_sweep_settings_obj == expected_nlp_sweep_settings_obj, \ - f"expected: {expected_nlp_sweep_settings_obj}, actual: {nlp_sweep_settings_obj}" + assert ( + nlp_sweep_settings_obj == expected_nlp_sweep_settings_obj + ), f"expected: {expected_nlp_sweep_settings_obj}, actual: {nlp_sweep_settings_obj}" - @pytest.mark.parametrize( - "early_termination_name,sampling_algorithm_name", EARLY_TERM_SAMPL_ALG_PAIRS - ) - def test_nlp_sweep_settings_to_rest(self, - early_termination_name: Optional[EarlyTerminationPolicyType], - sampling_algorithm_name: SamplingAlgorithmType) -> None: + @pytest.mark.parametrize("early_termination_name,sampling_algorithm_name", EARLY_TERM_SAMPL_ALG_PAIRS) + def test_nlp_sweep_settings_to_rest( + self, + early_termination_name: Optional[EarlyTerminationPolicyType], + sampling_algorithm_name: SamplingAlgorithmType, + ) -> None: expected_nlp_sweep_settings_rest = self._get_rest_obj(early_termination_name, sampling_algorithm_name) nlp_sweep_settings_obj = self._get_entity_obj(early_termination_name, sampling_algorithm_name) nlp_sweep_settings_rest = nlp_sweep_settings_obj._to_rest_object() - assert nlp_sweep_settings_rest == expected_nlp_sweep_settings_rest, \ - f"expected: {expected_nlp_sweep_settings_rest}, actual: {nlp_sweep_settings_rest}" + assert ( + nlp_sweep_settings_rest == expected_nlp_sweep_settings_rest + ), f"expected: {expected_nlp_sweep_settings_rest}, actual: {nlp_sweep_settings_rest}" - @pytest.mark.parametrize( - "early_termination_name,sampling_algorithm_name", EARLY_TERM_SAMPL_ALG_PAIRS - ) - def test_nlp_sweep_settings_round_trip(self, - early_termination_name: Optional[EarlyTerminationPolicyType], - sampling_algorithm_name: SamplingAlgorithmType) -> None: + @pytest.mark.parametrize("early_termination_name,sampling_algorithm_name", EARLY_TERM_SAMPL_ALG_PAIRS) + def test_nlp_sweep_settings_round_trip( + self, + early_termination_name: Optional[EarlyTerminationPolicyType], + sampling_algorithm_name: SamplingAlgorithmType, + ) -> None: expected_nlp_sweep_settings_obj = self._get_entity_obj(early_termination_name, sampling_algorithm_name) rest_sweep_settings_obj = expected_nlp_sweep_settings_obj._to_rest_object() round_trip_nlp_sweep_settings_obj = NlpSweepSettings._from_rest_object(rest_sweep_settings_obj) - assert round_trip_nlp_sweep_settings_obj == expected_nlp_sweep_settings_obj, \ - f"expected: {expected_nlp_sweep_settings_obj}, actual: {round_trip_nlp_sweep_settings_obj}" + assert ( + round_trip_nlp_sweep_settings_obj == expected_nlp_sweep_settings_obj + ), f"expected: {expected_nlp_sweep_settings_obj}, actual: {round_trip_nlp_sweep_settings_obj}" def _get_entity_obj( - self, - early_termination_name: Optional[EarlyTerminationPolicyType], - sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID + self, + early_termination_name: Optional[EarlyTerminationPolicyType], + sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID, ) -> NlpSweepSettings: early_termination_policy = None if early_termination_name == EarlyTerminationPolicyType.BANDIT: @@ -78,24 +81,25 @@ def _get_entity_obj( elif early_termination_name == EarlyTerminationPolicyType.MEDIAN_STOPPING: early_termination_policy = MedianStoppingPolicy(delay_evaluation=5, evaluation_interval=1) elif early_termination_name == EarlyTerminationPolicyType.TRUNCATION_SELECTION: - early_termination_policy = TruncationSelectionPolicy(evaluation_interval=1, - truncation_percentage=20, - delay_evaluation=5) - return NlpSweepSettings(early_termination=early_termination_policy, - sampling_algorithm=sampling_algorithm_name) + early_termination_policy = TruncationSelectionPolicy( + evaluation_interval=1, truncation_percentage=20, delay_evaluation=5 + ) + return NlpSweepSettings(early_termination=early_termination_policy, sampling_algorithm=sampling_algorithm_name) def _get_rest_obj( - self, - early_termination_name: Optional[EarlyTerminationPolicyType] = None, - sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID) -> RestNlpSweepSettings: + self, + early_termination_name: Optional[EarlyTerminationPolicyType] = None, + sampling_algorithm_name: SamplingAlgorithmType = SamplingAlgorithmType.GRID, + ) -> RestNlpSweepSettings: early_termination_policy = None if early_termination_name == EarlyTerminationPolicyType.BANDIT: early_termination_policy = RestBanditPolicy(evaluation_interval=10, slack_factor=0.2) elif early_termination_name == EarlyTerminationPolicyType.MEDIAN_STOPPING: early_termination_policy = RestMedianStoppingPolicy(delay_evaluation=5, evaluation_interval=1) elif early_termination_name == EarlyTerminationPolicyType.TRUNCATION_SELECTION: - early_termination_policy = RestTruncationSelectionPolicy(evaluation_interval=1, - truncation_percentage=20, - delay_evaluation=5) - return RestNlpSweepSettings(sampling_algorithm=sampling_algorithm_name, - early_termination=early_termination_policy) + early_termination_policy = RestTruncationSelectionPolicy( + evaluation_interval=1, truncation_percentage=20, delay_evaluation=5 + ) + return RestNlpSweepSettings( + sampling_algorithm=sampling_algorithm_name, early_termination=early_termination_policy + ) diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_job.py b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_job.py index 2cd9eb8fddc3..0a9916e4e13e 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_job.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_job.py @@ -81,16 +81,17 @@ def test_automl_nlp_text_classification_init(self, run_type): ) if run_type == "sweep": - job.set_limits(max_concurrent_trials=2, - max_trials=1, - timeout_minutes=30, - trial_timeout_minutes=10, - max_nodes=4) + job.set_limits( + max_concurrent_trials=2, max_trials=1, timeout_minutes=30, trial_timeout_minutes=10, max_nodes=4 + ) early_termination_policy = BanditPolicy(evaluation_interval=10, slack_amount=0.02) - job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=early_termination_policy) - job.extend_search_space([SearchSpace(model_name="bert-base-cased", learning_rate=Uniform(5e-6, 5e-5)), - SearchSpace(model_name="bert-large-cased", number_of_epochs=Choice([3, 4, 5]))]) + job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, early_termination=early_termination_policy) + job.extend_search_space( + [ + SearchSpace(model_name="bert-base-cased", learning_rate=Uniform(5e-6, 5e-5)), + SearchSpace(model_name="bert-large-cased", number_of_epochs=Choice([3, 4, 5])), + ] + ) else: job.set_limits(timeout_minutes=30) job.set_training_parameters(training_batch_size=16) @@ -180,21 +181,27 @@ def test_automl_nlp_text_classification_to_rest_object(self, run_type): primary_metric=primary_metric, log_verbosity=log_verbosity, ) - job.set_limits(max_concurrent_trials=max_concurrent_trials, - max_trials=max_trials, - max_nodes=max_nodes, - timeout_minutes=timeout) + job.set_limits( + max_concurrent_trials=max_concurrent_trials, + max_trials=max_trials, + max_nodes=max_nodes, + timeout_minutes=timeout, + ) job.set_featurization(dataset_language=dataset_language) job.set_training_parameters(weight_decay=0.01) rest_sweep = None rest_search_space = None if run_type == "sweep": - job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2)) + job.set_sweep( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) job.extend_search_space([SearchSpace(model_name=Choice(["bert-base-cased", "distilbert-base-cased"]))]) - rest_sweep = NlpSweepSettings(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2)) + rest_sweep = NlpSweepSettings( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) rest_search_space = [NlpParameterSubspace(model_name="choice('bert-base-cased','distilbert-base-cased')")] expected = TextClassification( @@ -207,7 +214,7 @@ def test_automl_nlp_text_classification_to_rest_object(self, run_type): max_concurrent_trials=max_concurrent_trials, max_trials=max_trials, max_nodes=max_nodes, - timeout=to_iso_duration_format_mins(timeout) + timeout=to_iso_duration_format_mins(timeout), ), fixed_parameters=NlpFixedParameters(weight_decay=0.01), sweep_settings=rest_sweep, @@ -265,23 +272,29 @@ def test_automl_nlp_text_classification_from_rest_object(self, run_type): tags={"foo_tag": "bar"}, identity=identity, ) - expected_job.set_limits(max_concurrent_trials=max_concurrent_trials, - max_trials=max_trials, - max_nodes=max_nodes, - timeout_minutes=timeout) + expected_job.set_limits( + max_concurrent_trials=max_concurrent_trials, + max_trials=max_trials, + max_nodes=max_nodes, + timeout_minutes=timeout, + ) expected_job.set_featurization(dataset_language=dataset_language) expected_job.set_training_parameters(weight_decay=0.01) rest_sweep = None rest_search_space = None if run_type == "sweep": - expected_job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2)) - expected_job.extend_search_space([SearchSpace(model_name=Choice(["bert-base-cased", - "distilbert-base-cased"]))]) - rest_sweep = NlpSweepSettings(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=RestBanditPolicy(slack_factor=0.2, - evaluation_interval=2)) + expected_job.set_sweep( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) + expected_job.extend_search_space( + [SearchSpace(model_name=Choice(["bert-base-cased", "distilbert-base-cased"]))] + ) + rest_sweep = NlpSweepSettings( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) rest_search_space = [NlpParameterSubspace(model_name="choice(bert-base-cased, distilbert-base-cased)")] task_details = TextClassification( @@ -299,7 +312,7 @@ def test_automl_nlp_text_classification_from_rest_object(self, run_type): featurization_settings=NlpVerticalFeaturizationSettings(dataset_language=dataset_language), fixed_parameters=NlpFixedParameters(weight_decay=0.01), sweep_settings=rest_sweep, - search_space=rest_search_space + search_space=rest_search_space, ) job_data = JobBase(properties=RestAutoMLJob(task_details=task_details, identity=identity._to_job_rest_object())) # Test converting REST object to Job diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_multilabel_job.py b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_multilabel_job.py index c2e9d78f3ab4..90d0e97e147e 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_multilabel_job.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_classification_multilabel_job.py @@ -82,16 +82,17 @@ def test_automl_nlp_text_classification_multilabel_init(self, run_type): ) if run_type == "sweep": - job.set_limits(max_concurrent_trials=2, - max_trials=1, - timeout_minutes=30, - trial_timeout_minutes=10, - max_nodes=4) + job.set_limits( + max_concurrent_trials=2, max_trials=1, timeout_minutes=30, trial_timeout_minutes=10, max_nodes=4 + ) early_termination_policy = BanditPolicy(evaluation_interval=10, slack_amount=0.02) - job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=early_termination_policy) - job.extend_search_space([SearchSpace(model_name="bert-base-cased", learning_rate=Uniform(5e-6, 5e-5)), - SearchSpace(model_name="bert-large-cased", number_of_epochs=Choice([3, 4, 5]))]) + job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, early_termination=early_termination_policy) + job.extend_search_space( + [ + SearchSpace(model_name="bert-base-cased", learning_rate=Uniform(5e-6, 5e-5)), + SearchSpace(model_name="bert-large-cased", number_of_epochs=Choice([3, 4, 5])), + ] + ) else: job.set_limits(timeout_minutes=30) job.set_training_parameters(training_batch_size=16) @@ -107,7 +108,7 @@ def test_automl_nlp_text_classification_multilabel_init(self, run_type): assert job.sweep.sampling_algorithm == SamplingAlgorithmType.GRID assert job.sweep.early_termination == early_termination_policy - assert job.search_space[0].model_name == 'bert-base-cased' + assert job.search_space[0].model_name == "bert-base-cased" assert job.search_space[0].learning_rate == Uniform(5e-6, 5e-5) assert job.search_space[1].model_name == "bert-large-cased" @@ -181,21 +182,27 @@ def test_automl_nlp_text_classification_multilabel_to_rest_object(self, run_type training_data=Input(type=AssetTypes.MLTABLE, path=training_data_uri), validation_data=Input(type=AssetTypes.MLTABLE, path=validation_data_uri), ) - job.set_limits(max_concurrent_trials=max_concurrent_trials, - max_trials=max_trials, - max_nodes=max_nodes, - timeout_minutes=timeout) + job.set_limits( + max_concurrent_trials=max_concurrent_trials, + max_trials=max_trials, + max_nodes=max_nodes, + timeout_minutes=timeout, + ) job.set_featurization(dataset_language=dataset_language) job.set_training_parameters(weight_decay=0.01) rest_sweep = None rest_search_space = None if run_type == "sweep": - job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2)) + job.set_sweep( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) job.extend_search_space([SearchSpace(model_name=Choice(["bert-base-cased", "distilbert-base-cased"]))]) - rest_sweep = NlpSweepSettings(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2)) + rest_sweep = NlpSweepSettings( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) rest_search_space = [NlpParameterSubspace(model_name="choice('bert-base-cased','distilbert-base-cased')")] expected = TextClassificationMultilabel( @@ -208,7 +215,7 @@ def test_automl_nlp_text_classification_multilabel_to_rest_object(self, run_type max_concurrent_trials=max_concurrent_trials, max_trials=max_trials, max_nodes=max_nodes, - timeout=to_iso_duration_format_mins(timeout) + timeout=to_iso_duration_format_mins(timeout), ), fixed_parameters=NlpFixedParameters(weight_decay=0.01), sweep_settings=rest_sweep, @@ -265,23 +272,29 @@ def test_automl_nlp_text_classification_multilabel_from_rest_object(self, run_ty tags={"foo_tag": "bar"}, identity=identity, ) - expected_job.set_limits(max_concurrent_trials=max_concurrent_trials, - max_trials=max_trials, - max_nodes=max_nodes, - timeout_minutes=timeout) + expected_job.set_limits( + max_concurrent_trials=max_concurrent_trials, + max_trials=max_trials, + max_nodes=max_nodes, + timeout_minutes=timeout, + ) expected_job.set_featurization(dataset_language=dataset_language) expected_job.set_training_parameters(weight_decay=0.01) rest_sweep = None rest_search_space = None if run_type == "sweep": - expected_job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2)) - expected_job.extend_search_space([SearchSpace(model_name=Choice(["bert-base-cased", - "distilbert-base-cased"]))]) - rest_sweep = NlpSweepSettings(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=RestBanditPolicy(slack_factor=0.2, - evaluation_interval=2)) + expected_job.set_sweep( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) + expected_job.extend_search_space( + [SearchSpace(model_name=Choice(["bert-base-cased", "distilbert-base-cased"]))] + ) + rest_sweep = NlpSweepSettings( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) rest_search_space = [NlpParameterSubspace(model_name="choice(bert-base-cased, distilbert-base-cased)")] task_details = TextClassificationMultilabel( @@ -293,12 +306,12 @@ def test_automl_nlp_text_classification_multilabel_from_rest_object(self, run_ty max_concurrent_trials=max_concurrent_trials, max_trials=max_trials, max_nodes=max_nodes, - timeout=to_iso_duration_format_mins(timeout) + timeout=to_iso_duration_format_mins(timeout), ), featurization_settings=NlpVerticalFeaturizationSettings(dataset_language=dataset_language), fixed_parameters=NlpFixedParameters(weight_decay=0.01), sweep_settings=rest_sweep, - search_space=rest_search_space + search_space=rest_search_space, ) job_data = JobBase(properties=RestAutoMLJob(task_details=task_details, identity=identity._to_job_rest_object())) # Test converting REST object to Job diff --git a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_ner_job.py b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_ner_job.py index 723a42eff9cc..f4b8e2edbeb6 100644 --- a/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_ner_job.py +++ b/sdk/ml/azure-ai-ml/tests/automl_job/unittests/test_text_ner_job.py @@ -74,16 +74,17 @@ def test_automl_nlp_text_ner_init(self, run_type): ) if run_type == "sweep": - job.set_limits(max_concurrent_trials=2, - max_trials=1, - timeout_minutes=30, - trial_timeout_minutes=10, - max_nodes=4) + job.set_limits( + max_concurrent_trials=2, max_trials=1, timeout_minutes=30, trial_timeout_minutes=10, max_nodes=4 + ) early_termination_policy = BanditPolicy(evaluation_interval=10, slack_amount=0.02) - job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=early_termination_policy) - job.extend_search_space([SearchSpace(model_name="bert-base-cased", learning_rate=Uniform(5e-6, 5e-5)), - SearchSpace(model_name="bert-large-cased", number_of_epochs=Choice([3, 4, 5]))]) + job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, early_termination=early_termination_policy) + job.extend_search_space( + [ + SearchSpace(model_name="bert-base-cased", learning_rate=Uniform(5e-6, 5e-5)), + SearchSpace(model_name="bert-large-cased", number_of_epochs=Choice([3, 4, 5])), + ] + ) else: job.set_limits(timeout_minutes=30) job.set_training_parameters(training_batch_size=16) @@ -169,21 +170,27 @@ def test_automl_nlp_text_ner_to_rest_object(self, run_type): log_verbosity=log_verbosity, identity=identity, ) - job.set_limits(max_concurrent_trials=max_concurrent_trials, - max_trials=max_trials, - max_nodes=max_nodes, - timeout_minutes=timeout) + job.set_limits( + max_concurrent_trials=max_concurrent_trials, + max_trials=max_trials, + max_nodes=max_nodes, + timeout_minutes=timeout, + ) job.set_featurization(dataset_language=dataset_language) job.set_training_parameters(weight_decay=0.01) rest_sweep = None rest_search_space = None if run_type == "sweep": - job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2)) + job.set_sweep( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) job.extend_search_space([SearchSpace(model_name=Choice(["bert-base-cased", "distilbert-base-cased"]))]) - rest_sweep = NlpSweepSettings(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2)) + rest_sweep = NlpSweepSettings( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) rest_search_space = [NlpParameterSubspace(model_name="choice('bert-base-cased','distilbert-base-cased')")] expected = TextNer( @@ -195,7 +202,7 @@ def test_automl_nlp_text_ner_to_rest_object(self, run_type): max_concurrent_trials=max_concurrent_trials, max_trials=max_trials, max_nodes=max_nodes, - timeout=to_iso_duration_format_mins(timeout) + timeout=to_iso_duration_format_mins(timeout), ), fixed_parameters=NlpFixedParameters(weight_decay=0.01), sweep_settings=rest_sweep, @@ -250,23 +257,29 @@ def test_automl_nlp_text_ner_from_rest_object(self, run_type): tags={"foo_tag": "bar"}, identity=identity, ) - expected_job.set_limits(max_concurrent_trials=max_concurrent_trials, - max_trials=max_trials, - max_nodes=max_nodes, - timeout_minutes=timeout) + expected_job.set_limits( + max_concurrent_trials=max_concurrent_trials, + max_trials=max_trials, + max_nodes=max_nodes, + timeout_minutes=timeout, + ) expected_job.set_featurization(dataset_language=dataset_language) expected_job.set_training_parameters(weight_decay=0.01) rest_sweep = None rest_search_space = None if run_type == "sweep": - expected_job.set_sweep(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2)) - expected_job.extend_search_space([SearchSpace(model_name=Choice(["bert-base-cased", - "distilbert-base-cased"]))]) - rest_sweep = NlpSweepSettings(sampling_algorithm=SamplingAlgorithmType.GRID, - early_termination=RestBanditPolicy(slack_factor=0.2, - evaluation_interval=2)) + expected_job.set_sweep( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=BanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) + expected_job.extend_search_space( + [SearchSpace(model_name=Choice(["bert-base-cased", "distilbert-base-cased"]))] + ) + rest_sweep = NlpSweepSettings( + sampling_algorithm=SamplingAlgorithmType.GRID, + early_termination=RestBanditPolicy(slack_factor=0.2, evaluation_interval=2), + ) rest_search_space = [NlpParameterSubspace(model_name="choice(bert-base-cased, distilbert-base-cased)")] task_details = TextNer( @@ -277,12 +290,12 @@ def test_automl_nlp_text_ner_from_rest_object(self, run_type): max_concurrent_trials=max_concurrent_trials, max_trials=max_trials, max_nodes=max_nodes, - timeout=to_iso_duration_format_mins(timeout) + timeout=to_iso_duration_format_mins(timeout), ), featurization_settings=NlpVerticalFeaturizationSettings(dataset_language=dataset_language), fixed_parameters=NlpFixedParameters(weight_decay=0.01), sweep_settings=rest_sweep, - search_space=rest_search_space + search_space=rest_search_space, ) job_data = JobBase(properties=RestAutoMLJob(task_details=task_details, identity=identity._to_job_rest_object())) # Test converting REST object to Job diff --git a/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_deployment.py b/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_deployment.py index cc011e66f886..cc3c07aa3f48 100644 --- a/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_deployment.py +++ b/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_deployment.py @@ -72,7 +72,13 @@ def test_batch_deployment(self, client: MLClient, data_with_2_versions: str) -> ) client.batch_endpoints.begin_delete(name=endpoint.name) - def test_batch_deployment_dependency_label_resolution(self, client: MLClient, randstr: Callable[[], str], rand_batch_name: Callable[[], str], rand_batch_deployment_name: Callable[[], str]) -> None: + def test_batch_deployment_dependency_label_resolution( + self, + client: MLClient, + randstr: Callable[[], str], + rand_batch_name: Callable[[], str], + rand_batch_deployment_name: Callable[[], str], + ) -> None: endpoint_yaml = "./tests/test_configs/endpoints/batch/batch_endpoint_mlflow_new.yaml" name = rand_batch_name("name") deployment_yaml = "./tests/test_configs/deployments/batch/batch_deployment_mlflow_new.yaml" @@ -129,7 +135,13 @@ def test_batch_deployment_dependency_label_resolution(self, client: MLClient, ra ) assert resolved_model.asset_name == model_name and resolved_model.asset_version == model_versions[-1] - def test_batch_job_download(self, client: MLClient, tmp_path: Path, rand_batch_name: Callable[[], str], rand_batch_deployment_name: Callable[[], str]) -> str: + def test_batch_job_download( + self, + client: MLClient, + tmp_path: Path, + rand_batch_name: Callable[[], str], + rand_batch_deployment_name: Callable[[], str], + ) -> str: endpoint_name = rand_batch_name("name") endpoint = load_batch_endpoint( "./tests/test_configs/endpoints/batch/batch_endpoint_mlflow_new.yaml", diff --git a/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_endpoint.py b/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_endpoint.py index ef9dcd7f390c..c2f9346d5d06 100644 --- a/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_endpoint.py +++ b/sdk/ml/azure-ai-ml/tests/batch_services/e2etests/test_batch_endpoint.py @@ -12,9 +12,7 @@ @pytest.mark.usefixtures("recorded_test") @pytest.mark.production_experiences_test class TestBatchEndpoint(AzureRecordedTestCase): - def test_batch_endpoint_create( - self, client: MLClient, rand_batch_name: Callable[[], str] - ) -> None: + def test_batch_endpoint_create(self, client: MLClient, rand_batch_name: Callable[[], str]) -> None: endpoint_yaml = "./tests/test_configs/endpoints/batch/batch_endpoint.yaml" name = rand_batch_name("name") # Bug in MFE that batch endpoint properties are not preserved, uncomment below after it's fixed in MFE @@ -41,9 +39,10 @@ def test_batch_endpoint_create( raise Exception(f"Batch endpoint {name} is supposed to be deleted.") - @pytest.mark.usefixtures("light_gbm_model") - def test_mlflow_batch_endpoint_create_and_update(self, client: MLClient, rand_batch_name: Callable[[], str]) -> None: + def test_mlflow_batch_endpoint_create_and_update( + self, client: MLClient, rand_batch_name: Callable[[], str] + ) -> None: # light_gbm_model fixture is not used directly, but it makes sure the model being used by the batch endpoint exists endpoint_yaml = "./tests/test_configs/endpoints/batch/batch_endpoint_mlflow.yaml" @@ -68,8 +67,9 @@ def test_mlflow_batch_endpoint_create_and_update(self, client: MLClient, rand_ba raise Exception(f"Batch endpoint {name} is supposed to be deleted.") - - def test_batch_invoke(self, client: MLClient, rand_batch_name: Callable[[], str], rand_batch_deployment_name: Callable[[], str]) -> None: + def test_batch_invoke( + self, client: MLClient, rand_batch_name: Callable[[], str], rand_batch_deployment_name: Callable[[], str] + ) -> None: endpoint_yaml = "./tests/test_configs/endpoints/batch/simple_batch_endpoint.yaml" endpoint_name = rand_batch_name("endpoint_name") endpoint = load_batch_endpoint(endpoint_yaml) @@ -90,29 +90,27 @@ def test_batch_invoke(self, client: MLClient, rand_batch_name: Callable[[], str] # Invoke using inputs: Dict[str, Input] input_1 = Input( type="uri_folder", - path='https://pipelinedata.blob.core.windows.net/sampledata/mnist', + path="https://pipelinedata.blob.core.windows.net/sampledata/mnist", ) batchjob = client.batch_endpoints.invoke( - endpoint_name=endpoint_name, - deployment_name=deployment_name, - inputs = {"input1": input_1} + endpoint_name=endpoint_name, deployment_name=deployment_name, inputs={"input1": input_1} ) assert batchjob # Invoke using deprecated input: Input batchjob_input = client.batch_endpoints.invoke( - endpoint_name=endpoint_name, - deployment_name=deployment_name, - input = input_1 + endpoint_name=endpoint_name, deployment_name=deployment_name, input=input_1 ) assert batchjob_input @pytest.mark.skipif( condition=not is_live(), - reason="Update operation is not valid. If we use the same endpoint/deployment this will throw an error" + reason="Update operation is not valid. If we use the same endpoint/deployment this will throw an error", ) - def test_batch_component(self, client: MLClient, rand_batch_name: Callable[[], str], rand_batch_deployment_name: Callable[[], str]) -> None: + def test_batch_component( + self, client: MLClient, rand_batch_name: Callable[[], str], rand_batch_deployment_name: Callable[[], str] + ) -> None: endpoint_yaml = "./tests/test_configs/endpoints/batch/batch_endpoint_deployment_component.yaml" endpoint_name = rand_batch_name("endpoint_name") endpoint = load_batch_endpoint(endpoint_yaml) @@ -130,21 +128,27 @@ def test_batch_component(self, client: MLClient, rand_batch_name: Callable[[], s endpoint = client.batch_endpoints.begin_create_or_update(endpoint).result() # create a deployment client.batch_deployments.begin_create_or_update(deployment).result() - + # Batch endpoint invoke using different supported inputs inputs_dict = { "input_1": Input(path="azureml:list_data_v2_test:2", type="uri_folder"), - "input_2": Input(path="azureml:list_data_v2_test:2", type="uri_folder") + "input_2": Input(path="azureml:list_data_v2_test:2", type="uri_folder"), } job = client.batch_endpoints.invoke( endpoint_name=endpoint.name, deployment_name=deployment.name, - inputs = inputs_dict, + inputs=inputs_dict, ) assert job - def test_batch_invoke_outputs(self, client: MLClient, rand_batch_name: Callable[[], str], rand_batch_deployment_name: Callable[[], str], randstr: Callable[[str], str]) -> None: + def test_batch_invoke_outputs( + self, + client: MLClient, + rand_batch_name: Callable[[], str], + rand_batch_deployment_name: Callable[[], str], + randstr: Callable[[str], str], + ) -> None: endpoint_yaml = "./tests/test_configs/endpoints/batch/simple_batch_endpoint.yaml" endpoint_name = rand_batch_name("endpoint_name") endpoint = load_batch_endpoint(endpoint_yaml) @@ -165,23 +169,25 @@ def test_batch_invoke_outputs(self, client: MLClient, rand_batch_name: Callable[ # Invoke using inputs: Dict[str, Input] input_1 = Input( type="uri_folder", - path='https://pipelinedata.blob.core.windows.net/sampledata/mnist', + path="https://pipelinedata.blob.core.windows.net/sampledata/mnist", ) # Invoke using outputs: Dict[str, Output] output_file_name = randstr("output_file") output_1 = Output( type="uri_file", - path='azureml://datastores/workspaceblobstore/paths/batchendpointinvoke/mnistOutput/' + output_file_name +'.csv', + path="azureml://datastores/workspaceblobstore/paths/batchendpointinvoke/mnistOutput/" + + output_file_name + + ".csv", ) batchjob = client.batch_endpoints.invoke( endpoint_name=endpoint_name, deployment_name=deployment_name, - inputs = {"input1": input_1}, - outputs = {"output": output_1} + inputs={"input1": input_1}, + outputs={"output": output_1}, ) assert batchjob delete_res = client.batch_endpoints.begin_delete(name=endpoint_name) - delete_res = delete_res.result() \ No newline at end of file + delete_res = delete_res.result() diff --git a/sdk/ml/azure-ai-ml/tests/code_asset/e2etests/test_code.py b/sdk/ml/azure-ai-ml/tests/code_asset/e2etests/test_code.py index 4640032df6a5..205a34573749 100644 --- a/sdk/ml/azure-ai-ml/tests/code_asset/e2etests/test_code.py +++ b/sdk/ml/azure-ai-ml/tests/code_asset/e2etests/test_code.py @@ -56,10 +56,7 @@ def test_asset_path_update( code_entity.path = code_asset_path client._code.create_or_update(code_entity) - @pytest.mark.skipif( - condition=not is_live(), - reason="registry tests do not record properly. Investigate later." - ) + @pytest.mark.skipif(condition=not is_live(), reason="registry tests do not record properly. Investigate later.") def test_create_and_get_from_registry( self, registry_client: MLClient, diff --git a/sdk/ml/azure-ai-ml/tests/command_job/e2etests/test_command_job.py b/sdk/ml/azure-ai-ml/tests/command_job/e2etests/test_command_job.py index 86b389dc9f81..892d336b2f80 100644 --- a/sdk/ml/azure-ai-ml/tests/command_job/e2etests/test_command_job.py +++ b/sdk/ml/azure-ai-ml/tests/command_job/e2etests/test_command_job.py @@ -420,18 +420,16 @@ def test_command_job_parsing_error(self, randstr: Callable[[], str]) -> None: assert "Error while parsing yaml file" in e.value.message @pytest.mark.e2etest - def test_command_job_register_output( - self, randstr: Callable[[str], str], client: MLClient - ) -> None: + def test_command_job_register_output(self, randstr: Callable[[str], str], client: MLClient) -> None: job: CommandJob = load_job( source="./tests/test_configs/command_job/command_job_register_output.yml", params_override=[{"name": randstr("job_name")}], ) job = client.jobs.create_or_update(job=job) - assert job.outputs.test2.name == 'test2_output' - assert job.outputs.test2.version == '2' - assert job.outputs.test3.name == 'test3_output' - assert job.outputs.test3.version == '3' + assert job.outputs.test2.name == "test2_output" + assert job.outputs.test2.version == "2" + assert job.outputs.test3.name == "test3_output" + assert job.outputs.test3.version == "3" def check_tid_in_url(client: MLClient, job: Job) -> None: diff --git a/sdk/ml/azure-ai-ml/tests/component/e2etests/test_component.py b/sdk/ml/azure-ai-ml/tests/component/e2etests/test_component.py index a13505f1c619..036bfd5bf214 100644 --- a/sdk/ml/azure-ai-ml/tests/component/e2etests/test_component.py +++ b/sdk/ml/azure-ai-ml/tests/component/e2etests/test_component.py @@ -81,6 +81,7 @@ def create_tensorflow_distribution(has_strs: bool = False): return create_tensorflow_distribution + # previous bodiless_matcher fixture doesn't take effect because of typo, please add it in method level if needed @@ -143,7 +144,7 @@ def test_command_component(self, client: MLClient, randstr: Callable[[str], str] "optional": True, "type": "number", }, - "component_in_path": {"description": "A path", "type": "uri_folder", 'optional': False}, + "component_in_path": {"description": "A path", "type": "uri_folder", "optional": False}, }, "is_deterministic": True, "outputs": {"component_out_path": {"type": "uri_folder"}}, @@ -169,11 +170,17 @@ def test_parallel_component(self, client: MLClient, randstr: Callable[[str], str "error_threshold": 10, "input_data": "${{inputs.score_input}}", "inputs": { - "label": {"description": "Other reference data for batch scoring, " "e.g. labels.", - "type": "uri_file", 'optional': False}, - "score_input": {"description": "The data to be split and scored in " "parallel.", "type": "mltable", - 'optional': False}, - "score_model": {"description": "The model for batch score.", "type": "custom_model", 'optional': False}, + "label": { + "description": "Other reference data for batch scoring, " "e.g. labels.", + "type": "uri_file", + "optional": False, + }, + "score_input": { + "description": "The data to be split and scored in " "parallel.", + "type": "mltable", + "optional": False, + }, + "score_model": {"description": "The model for batch score.", "type": "custom_model", "optional": False}, }, "is_deterministic": True, "max_concurrency_per_instance": 12, @@ -232,21 +239,23 @@ def test_automl_component(self, client: MLClient, registry_client: MLClient, ran def test_spark_component(self, client: MLClient, randstr: Callable[[], str]) -> None: expected_dict = { - '$schema': 'https://azuremlschemas.azureedge.net/latest/sparkComponent.schema.json', - 'args': '--file_input ${{inputs.file_input}} --output ${{outputs.output}}', - 'conf': {'spark.driver.cores': 2, - 'spark.driver.memory': '1g', - 'spark.executor.cores': 1, - 'spark.executor.instances': 1, - 'spark.executor.memory': '1g'}, - 'description': 'Aml Spark dataset test module', - 'display_name': 'Aml Spark dataset test module', - 'entry': {'file': 'kmeans_example.py'}, - 'inputs': {'file_input': {'type': 'uri_file', 'optional': False}}, - 'is_deterministic': True, - 'outputs': {'output': {'type': 'uri_folder'}}, - 'type': 'spark', - 'version': '1' + "$schema": "https://azuremlschemas.azureedge.net/latest/sparkComponent.schema.json", + "args": "--file_input ${{inputs.file_input}} --output ${{outputs.output}}", + "conf": { + "spark.driver.cores": 2, + "spark.driver.memory": "1g", + "spark.executor.cores": 1, + "spark.executor.instances": 1, + "spark.executor.memory": "1g", + }, + "description": "Aml Spark dataset test module", + "display_name": "Aml Spark dataset test module", + "entry": {"file": "kmeans_example.py"}, + "inputs": {"file_input": {"type": "uri_file", "optional": False}}, + "is_deterministic": True, + "outputs": {"output": {"type": "uri_folder"}}, + "type": "spark", + "version": "1", } assert_component_basic_workflow( client=client, @@ -263,10 +272,10 @@ def test_datatransfer_copy_urifolder_component(self, client: MLClient, randstr: "display_name": "Data Transfer Component copy-files", "type": "data_transfer", "task": "copy_data", - 'inputs': {'folder1': {'type': 'uri_folder', 'optional': False}}, - 'outputs': {'output_folder': {'type': 'uri_folder'}}, - 'is_deterministic': True, - 'version': '1' + "inputs": {"folder1": {"type": "uri_folder", "optional": False}}, + "outputs": {"output_folder": {"type": "uri_folder"}}, + "is_deterministic": True, + "version": "1", } assert_component_basic_workflow( client=client, @@ -283,10 +292,10 @@ def test_datatransfer_copy_urifile_component(self, client: MLClient, randstr: Ca "display_name": "Data Transfer Component copy uri files", "type": "data_transfer", "task": "copy_data", - 'inputs': {'folder1': {'type': 'uri_file', 'optional': False}}, - 'outputs': {'output_folder': {'type': 'uri_file'}}, - 'is_deterministic': True, - 'version': '1' + "inputs": {"folder1": {"type": "uri_file", "optional": False}}, + "outputs": {"output_folder": {"type": "uri_file"}}, + "is_deterministic": True, + "version": "1", } assert_component_basic_workflow( client=client, @@ -303,11 +312,13 @@ def test_datatransfer_copy_2urifolder_component(self, client: MLClient, randstr: "display_name": "Data Transfer Component merge-files", "type": "data_transfer", "task": "copy_data", - 'inputs': {'folder1': {'type': 'uri_folder', 'optional': False}, - 'folder2': {'type': 'uri_folder', 'optional': False}}, - 'outputs': {'output_folder': {'type': 'uri_folder'}}, - 'is_deterministic': True, - 'version': '1' + "inputs": { + "folder1": {"type": "uri_folder", "optional": False}, + "folder2": {"type": "uri_folder", "optional": False}, + }, + "outputs": {"output_folder": {"type": "uri_folder"}}, + "is_deterministic": True, + "version": "1", } assert_component_basic_workflow( client=client, @@ -324,12 +335,14 @@ def test_datatransfer_copy_mixtype_component(self, client: MLClient, randstr: Ca "display_name": "Data Transfer Component merge mix type files", "type": "data_transfer", "task": "copy_data", - 'inputs': {'input1': {'type': 'uri_file', 'optional': False}, - 'input2': {'type': 'uri_file', 'optional': False}, - 'input3': {'type': 'mltable', 'optional': False}}, - 'outputs': {'output_folder': {'type': 'uri_folder'}}, - 'is_deterministic': True, - 'version': '1' + "inputs": { + "input1": {"type": "uri_file", "optional": False}, + "input2": {"type": "uri_file", "optional": False}, + "input3": {"type": "mltable", "optional": False}, + }, + "outputs": {"output_folder": {"type": "uri_folder"}}, + "is_deterministic": True, + "version": "1", } assert_component_basic_workflow( client=client, @@ -367,8 +380,9 @@ def test_command_component_create_input_output_types( # server side will remove \n from the code now. Skip them given it's not targeted to check in this test # server side will return optional False for optional None input omit_fields = ["id", "command", "environment", "inputs.*.optional"] - assert omit_with_wildcard(component_entity._to_dict(), *omit_fields) == \ - omit_with_wildcard(target_entity._to_dict(), *omit_fields) + assert omit_with_wildcard(component_entity._to_dict(), *omit_fields) == omit_with_wildcard( + target_entity._to_dict(), *omit_fields + ) def test_command_component_with_code(self, client: MLClient, randstr: Callable[[str], str]) -> None: component_name = randstr("component_name") @@ -422,7 +436,7 @@ def test_component_update(self, client: MLClient, randstr: Callable[[str], str]) "creation_context", "resources", "id", - "inputs.component_in_path.optional" # backend will return component inputs as optional:False + "inputs.component_in_path.optional", # backend will return component inputs as optional:False ) expected_dict = pydash.omit( dict(target_entity._to_dict()), @@ -806,9 +820,7 @@ def test_simple_pipeline_component_create(self, client: MLClient, randstr: Calla ) # Assert binding on compute not changed after resolve dependencies client.components._resolve_dependencies_for_pipeline_component_jobs( - component, - resolver=client.components._orchestrators.get_asset_arm_id, - resolve_inputs=False + component, resolver=client.components._orchestrators.get_asset_arm_id, resolve_inputs=False ) assert component.jobs["component_a_job"].compute == "${{parent.inputs.node_compute}}" # Assert E2E @@ -884,8 +896,11 @@ def test_helloworld_nested_pipeline_component(self, client: MLClient, randstr: C "display_name": "Hello World Pipeline Component", "is_deterministic": False, "inputs": { - "component_in_path": {"type": "uri_folder", "description": "A path for pipeline component", - "optional": False}, + "component_in_path": { + "type": "uri_folder", + "description": "A path for pipeline component", + "optional": False, + }, "component_in_number": { "type": "number", "optional": True, @@ -943,25 +958,28 @@ def test_command_component_with_properties_e2e_flow(self, client: MLClient, rand source="./tests/test_configs/components/helloworld_component_with_properties.yml", ) expected_dict = { - '$schema': 'https://azuremlschemas.azureedge.net/development/commandComponent.schema.json', - '_source': 'YAML.COMPONENT', - 'command': 'echo Hello World & echo $[[${{inputs.component_in_number}}]] & ' - 'echo ${{inputs.component_in_path}} & echo ' - '${{outputs.component_out_path}} > ' - '${{outputs.component_out_path}}/component_in_number', - 'description': 'This is the basic command component', - 'display_name': 'CommandComponentBasic', - 'inputs': {'component_in_number': {'default': '10.99', - 'description': 'A number', - 'optional': True, - 'type': 'number'}, - 'component_in_path': {'description': 'A path', - 'type': 'uri_folder'}}, - 'is_deterministic': True, - 'outputs': {'component_out_path': {'type': 'uri_folder'}}, - 'properties': {'azureml.pipelines.dynamic': 'true'}, - 'tags': {'owner': 'sdkteam', 'tag': 'tagvalue'}, - 'type': 'command', + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json", + "_source": "YAML.COMPONENT", + "command": "echo Hello World & echo $[[${{inputs.component_in_number}}]] & " + "echo ${{inputs.component_in_path}} & echo " + "${{outputs.component_out_path}} > " + "${{outputs.component_out_path}}/component_in_number", + "description": "This is the basic command component", + "display_name": "CommandComponentBasic", + "inputs": { + "component_in_number": { + "default": "10.99", + "description": "A number", + "optional": True, + "type": "number", + }, + "component_in_path": {"description": "A path", "type": "uri_folder"}, + }, + "is_deterministic": True, + "outputs": {"component_out_path": {"type": "uri_folder"}}, + "properties": {"azureml.pipelines.dynamic": "true"}, + "tags": {"owner": "sdkteam", "tag": "tagvalue"}, + "type": "command", } omit_fields = ["name", "creation_context", "id", "code", "environment", "version"] rest_component = pydash.omit( diff --git a/sdk/ml/azure-ai-ml/tests/component/unittests/test_command_component_entity.py b/sdk/ml/azure-ai-ml/tests/component/unittests/test_command_component_entity.py index 960e09169be9..3704a1131533 100644 --- a/sdk/ml/azure-ai-ml/tests/component/unittests/test_command_component_entity.py +++ b/sdk/ml/azure-ai-ml/tests/component/unittests/test_command_component_entity.py @@ -384,13 +384,19 @@ def test_sweep_early_termination_setter(self): sampling_algorithm="random", ) sweep_job1.early_termination = { - 'type': "bandit", 'evaluation_interval': 100, 'delay_evaluation': 200, 'slack_factor': 40.0 - } + "type": "bandit", + "evaluation_interval": 100, + "delay_evaluation": 200, + "slack_factor": 40.0, + } from azure.ai.ml.entities._job.sweep.early_termination_policy import BanditPolicy + assert isinstance(sweep_job1.early_termination, BanditPolicy) - assert [sweep_job1.early_termination.evaluation_interval, - sweep_job1.early_termination.delay_evaluation, - sweep_job1.early_termination.slack_factor] == [100, 200, 40.0] + assert [ + sweep_job1.early_termination.evaluation_interval, + sweep_job1.early_termination.delay_evaluation, + sweep_job1.early_termination.slack_factor, + ] == [100, 200, 40.0] def test_invalid_component_inputs(self) -> None: yaml_path = "./tests/test_configs/components/invalid/helloworld_component_conflict_input_names.yml" @@ -506,9 +512,7 @@ def test_component_code_asset_ignoring_pycache(self) -> None: with build_temp_folder( source_base_dir="./tests/test_configs/components", relative_files_to_copy=["helloworld_component.yml"], - extra_files_to_create={ - "__pycache__/a.pyc": None - } + extra_files_to_create={"__pycache__/a.pyc": None}, ) as temp_dir: # resolve and test for ignore_file's is_file_excluded component.code = temp_dir @@ -524,12 +528,12 @@ def test_component_code_asset_ignoring_pycache(self) -> None: def test_normalized_arm_id_in_component_dict(self): component_dict = { "code": "azureml:/subscriptions/123ABC_+-=/resourceGroups/123ABC_+-=/providers/Microsoft.MachineLearningServices/workspaces/123ABC_+-=/codes/xxx", - "environment": "azureml:/subscriptions/123ABC_+-=/resourceGroups/123ABC_+-=/providers/Microsoft.MachineLearningServices/workspaces/123ABC_+-=/environments/xxx" + "environment": "azureml:/subscriptions/123ABC_+-=/resourceGroups/123ABC_+-=/providers/Microsoft.MachineLearningServices/workspaces/123ABC_+-=/environments/xxx", } normalized_arm_id_in_object(component_dict) expected_dict = { - 'code': 'azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/xxx', - 'environment': 'azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/environments/xxx' + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/xxx", + "environment": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/environments/xxx", } assert component_dict == expected_dict diff --git a/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_operations.py b/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_operations.py index f9cb245843f7..78286ad635e7 100644 --- a/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_operations.py +++ b/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_operations.py @@ -23,7 +23,7 @@ def mock_component_operation( mock_workspace_scope: OperationScope, mock_operation_config: OperationConfig, mock_aml_services_2022_05_01: Mock, - mock_machinelearning_client: Mock + mock_machinelearning_client: Mock, ) -> ComponentOperations: yield ComponentOperations( operation_scope=mock_workspace_scope, diff --git a/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_schema.py b/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_schema.py index c68b109599df..e9bac0ff39e4 100644 --- a/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_schema.py +++ b/sdk/ml/azure-ai-ml/tests/component/unittests/test_component_schema.py @@ -315,7 +315,7 @@ def test_component_factory(self): data=component_entity._to_dict(), context={ "source_path": test_path, - } + }, ) assert recreated_component._to_dict() == component_entity._to_dict() @@ -328,6 +328,21 @@ def test_dump_with_non_existent_base_path(self): component_entity._base_path = "/non/existent/path" component_entity._to_dict() + def test_arm_code_from_rest_object(self): + arm_code = ( + "azureml:/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.MachineLearningServices/" + "workspaces/zzz/codes/90b33c11-365d-4ee4-aaa1-224a042deb41/versions/1" + ) + yaml_path = "./tests/test_configs/components/helloworld_component.yml" + yaml_component = load_component(yaml_path) + + from azure.ai.ml.entities import Component + + rest_object = yaml_component._to_rest_object() + rest_object.properties.component_spec["code"] = arm_code + component = Component._from_rest_object(rest_object) + assert component.code == arm_code[8:] + @pytest.mark.timeout(_COMPONENT_TIMEOUT_SECOND) @pytest.mark.unittest diff --git a/sdk/ml/azure-ai-ml/tests/component/unittests/test_data_transfer_component_entity.py b/sdk/ml/azure-ai-ml/tests/component/unittests/test_data_transfer_component_entity.py index 0b3985639072..b5f376791880 100644 --- a/sdk/ml/azure-ai-ml/tests/component/unittests/test_data_transfer_component_entity.py +++ b/sdk/ml/azure-ai-ml/tests/component/unittests/test_data_transfer_component_entity.py @@ -3,8 +3,11 @@ from azure.ai.ml import MLClient from azure.ai.ml import load_component -from azure.ai.ml.entities._component.datatransfer_component import DataTransferCopyComponent, \ - DataTransferImportComponent, DataTransferExportComponent +from azure.ai.ml.entities._component.datatransfer_component import ( + DataTransferCopyComponent, + DataTransferImportComponent, + DataTransferExportComponent, +) from azure.ai.ml.constants._component import DataCopyMode, DataTransferTaskType from .test_component_schema import load_component_entity_from_rest_json, load_component_entity_from_yaml from .._util import _COMPONENT_TIMEOUT_SECOND @@ -16,8 +19,9 @@ class TestDataTransferComponentEntity: def test_serialize_deserialize_copy_task_component(self, mock_machinelearning_client: MLClient): test_path = "./tests/test_configs/components/data_transfer/copy_files.yaml" - component_entity = load_component_entity_from_yaml(test_path, mock_machinelearning_client, - _type="data_transfer") + component_entity = load_component_entity_from_yaml( + test_path, mock_machinelearning_client, _type="data_transfer" + ) assert isinstance(component_entity, DataTransferCopyComponent) rest_path = "./tests/test_configs/components/data_transfer/copy_files.json" @@ -28,7 +32,7 @@ def test_serialize_deserialize_copy_task_component(self, mock_machinelearning_cl display_name="Data Transfer Component copy-files", inputs={"folder1": {"type": "uri_folder"}}, outputs={"output_folder": {"type": "uri_folder"}}, - data_copy_mode= DataCopyMode.MERGE_WITH_OVERWRITE, + data_copy_mode=DataCopyMode.MERGE_WITH_OVERWRITE, base_path="./tests/test_configs/components/data_transfer", ) @@ -43,8 +47,9 @@ def test_serialize_deserialize_copy_task_component(self, mock_machinelearning_cl def test_serialize_deserialize_merge_task_component(self, mock_machinelearning_client: MLClient): test_path = "./tests/test_configs/components/data_transfer/merge_files.yaml" - component_entity = load_component_entity_from_yaml(test_path, mock_machinelearning_client, - _type="data_transfer") + component_entity = load_component_entity_from_yaml( + test_path, mock_machinelearning_client, _type="data_transfer" + ) assert isinstance(component_entity, DataTransferCopyComponent) rest_path = "./tests/test_configs/components/data_transfer/merge_files.json" rest_entity = load_component_entity_from_rest_json(rest_path) @@ -54,14 +59,22 @@ def test_serialize_deserialize_merge_task_component(self, mock_machinelearning_c display_name="Data Transfer Component merge-files", inputs={"folder1": {"type": "uri_folder"}, "folder2": {"type": "uri_folder"}}, outputs={"output_folder": {"type": "uri_folder"}}, - data_copy_mode= DataCopyMode.MERGE_WITH_OVERWRITE, + data_copy_mode=DataCopyMode.MERGE_WITH_OVERWRITE, base_path="./tests/test_configs/components/data_transfer", ) # data_copy_mode is a run time config, cannot be decided in registering progress. So won't be returned from # backend. - omit_fields = ["name", "id", "$schema", "data_copy_mode", "inputs.folder1.optional", "version", - "inputs.folder2.optional", "inputs.folder3.optional"] + omit_fields = [ + "name", + "id", + "$schema", + "data_copy_mode", + "inputs.folder1.optional", + "version", + "inputs.folder2.optional", + "inputs.folder3.optional", + ] yaml_dict = pydash.omit(dict(component_entity._to_dict()), *omit_fields) rest_dict = pydash.omit(dict(rest_entity._to_dict()), *omit_fields) sdk_dict = pydash.omit(dict(data_transfer_copy_component._to_dict()), *omit_fields) @@ -70,8 +83,9 @@ def test_serialize_deserialize_merge_task_component(self, mock_machinelearning_c def test_serialize_deserialize_import_task_component(self, mock_machinelearning_client: MLClient): test_path = "./tests/test_configs/components/data_transfer/import_file_to_blob.yaml" - component_entity = load_component_entity_from_yaml(test_path, mock_machinelearning_client, - _type="data_transfer") + component_entity = load_component_entity_from_yaml( + test_path, mock_machinelearning_client, _type="data_transfer" + ) assert isinstance(component_entity, DataTransferImportComponent) data_transfer_copy_component = DataTransferImportComponent( @@ -90,8 +104,9 @@ def test_serialize_deserialize_import_task_component(self, mock_machinelearning_ def test_serialize_deserialize_export_task_component(self, mock_machinelearning_client: MLClient): test_path = "./tests/test_configs/components/data_transfer/export_blob_to_database.yaml" - component_entity = load_component_entity_from_yaml(test_path, mock_machinelearning_client, - _type="data_transfer") + component_entity = load_component_entity_from_yaml( + test_path, mock_machinelearning_client, _type="data_transfer" + ) assert isinstance(component_entity, DataTransferExportComponent) data_transfer_copy_component = DataTransferExportComponent( @@ -119,7 +134,7 @@ def test_copy_task_component_entity(self): outputs={ "output_folder": {"type": "uri_folder"}, }, - data_copy_mode= DataCopyMode.MERGE_WITH_OVERWRITE, + data_copy_mode=DataCopyMode.MERGE_WITH_OVERWRITE, base_path="./tests/test_configs/components/data_transfer", ) omit_fields = [ @@ -136,4 +151,3 @@ def test_copy_task_component_entity(self): yaml_component_dict = pydash.omit(yaml_component_dict, *omit_fields) assert component_dict == yaml_component_dict - diff --git a/sdk/ml/azure-ai-ml/tests/component/unittests/test_parallel_component_operations.py b/sdk/ml/azure-ai-ml/tests/component/unittests/test_parallel_component_operations.py index 0da1ce479284..0fed40889e7e 100644 --- a/sdk/ml/azure-ai-ml/tests/component/unittests/test_parallel_component_operations.py +++ b/sdk/ml/azure-ai-ml/tests/component/unittests/test_parallel_component_operations.py @@ -62,9 +62,7 @@ def test_create(self, mock_component_operation: ComponentOperations) -> None: workspace_name=mock_component_operation._workspace_name, ) - def test_create_autoincrement( - self, mock_component_operation: ComponentOperations - ) -> None: + def test_create_autoincrement(self, mock_component_operation: ComponentOperations) -> None: task = { "type": "run_function", "model": {"name": "sore_model", "type": "mlflow_model"}, @@ -83,8 +81,8 @@ def test_create_autoincrement( ) assert component._auto_increment_version with patch.object(ComponentOperations, "_resolve_arm_id_or_upload_dependencies") as mock_thing, patch( - "azure.ai.ml.operations._component_operations.Component._from_rest_object", - return_value=component, + "azure.ai.ml.operations._component_operations.Component._from_rest_object", + return_value=component, ): mock_component_operation.create_or_update(component) mock_thing.assert_called_once() diff --git a/sdk/ml/azure-ai-ml/tests/component/unittests/test_pipeline_component_entity.py b/sdk/ml/azure-ai-ml/tests/component/unittests/test_pipeline_component_entity.py index 0c02c012c9ec..619cecd81b3a 100644 --- a/sdk/ml/azure-ai-ml/tests/component/unittests/test_pipeline_component_entity.py +++ b/sdk/ml/azure-ai-ml/tests/component/unittests/test_pipeline_component_entity.py @@ -401,30 +401,37 @@ def test_simple_jobs_from_rest(self) -> None: test_path = "./tests/test_configs/components/pipeline_component_jobs_rest_data.json" with open(test_path, "r") as f: json_in_file = yaml.safe_load(f) - job_dict = copy.deepcopy(json_in_file['properties']['component_spec']['jobs']) + job_dict = copy.deepcopy(json_in_file["properties"]["component_spec"]["jobs"]) jobs = PipelineComponent._resolve_sub_nodes(job_dict) - node_dict = {key: node._to_rest_object() for key, node in jobs.items()}['component_a_job'] - assert node_dict['computeId'] == '${{parent.inputs.node_compute}}' - assert node_dict['outputs'] == { - 'output_binding': {'type': 'literal', 'value': '${{parent.outputs.output}}'}, - 'output_binding2': {'type': 'literal', 'value': '${{parent.outputs.output}}'}, - 'output_data': {'job_output_type': 'uri_folder', 'mode': 'Upload'}, - 'output_data_legacy': {'job_output_type': 'uri_folder', 'mode': 'Upload'}} - assert node_dict['inputs'] == { - 'binding_input': {'job_input_type': 'literal', 'value': '${{parent.inputs.component_in_path}}'}, - 'data_input': {'job_input_type': 'uri_file', - 'mode': 'Download', - 'uri': 'https://my-blob/path/to/data'}, - 'data_input_legacy': {'job_input_type': 'uri_file', - 'mode': 'Download', - 'uri': 'https://my-blob/path/to/data'}, - 'literal_input': {'job_input_type': 'literal', 'value': '11'}, - 'literal_input2': {'job_input_type': 'literal', 'value': '12'}} - assert node_dict['resources'] == {'instance_count': 1, 'properties': { - 'target_selector': {'my_resource_only': 'false', 'allow_spot_vm': 'true'}}, 'shm_size': '2g'} + node_dict = {key: node._to_rest_object() for key, node in jobs.items()}["component_a_job"] + assert node_dict["computeId"] == "${{parent.inputs.node_compute}}" + assert node_dict["outputs"] == { + "output_binding": {"type": "literal", "value": "${{parent.outputs.output}}"}, + "output_binding2": {"type": "literal", "value": "${{parent.outputs.output}}"}, + "output_data": {"job_output_type": "uri_folder", "mode": "Upload"}, + "output_data_legacy": {"job_output_type": "uri_folder", "mode": "Upload"}, + } + assert node_dict["inputs"] == { + "binding_input": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + "data_input": {"job_input_type": "uri_file", "mode": "Download", "uri": "https://my-blob/path/to/data"}, + "data_input_legacy": { + "job_input_type": "uri_file", + "mode": "Download", + "uri": "https://my-blob/path/to/data", + }, + "literal_input": {"job_input_type": "literal", "value": "11"}, + "literal_input2": {"job_input_type": "literal", "value": "12"}, + } + assert node_dict["resources"] == { + "instance_count": 1, + "properties": {"target_selector": {"my_resource_only": "false", "allow_spot_vm": "true"}}, + "shm_size": "2g", + } rest_obj = ComponentVersionData.from_dict(json.loads(json.dumps(json_in_file))) pipeline_component = Component._from_rest_object(rest_obj) assert pipeline_component.jobs - obj_node_dict = {key: node._to_rest_object() for key, node in pipeline_component.jobs.items()}['component_a_job'] + obj_node_dict = {key: node._to_rest_object() for key, node in pipeline_component.jobs.items()}[ + "component_a_job" + ] assert obj_node_dict == node_dict diff --git a/sdk/ml/azure-ai-ml/tests/compute/e2etests/test_compute.py b/sdk/ml/azure-ai-ml/tests/compute/e2etests/test_compute.py index f722e2d73430..4bc60198bde4 100644 --- a/sdk/ml/azure-ai-ml/tests/compute/e2etests/test_compute.py +++ b/sdk/ml/azure-ai-ml/tests/compute/e2etests/test_compute.py @@ -77,7 +77,7 @@ def test_compute_instance_create_and_delete( "Test takes 5 minutes in automation. " "Already have unit tests verifying correct _restclient method is called. " "Can be validated in live build only." - ) + ), ) def test_compute_instance_stop_start_restart( self, client: MLClient, rand_compute_name: Callable[[str], str] diff --git a/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_entity.py b/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_entity.py index 747ea9d31dc9..ba69bab41748 100644 --- a/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_entity.py +++ b/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_entity.py @@ -26,7 +26,9 @@ def test_compute_from_rest(self): with open("tests/test_configs/compute/compute-kubernetes.yaml", "r") as f: data = yaml.safe_load(f) resource_id = "/subscriptions/dummy/resourceGroups/dummy/providers/Microsoft.Kubernetes/connectedClusters/dummy" - uai_resource_id = "/subscriptions/dummy/resourceGroups/dummy/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dummy" + uai_resource_id = ( + "/subscriptions/dummy/resourceGroups/dummy/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dummy" + ) context = { "base_path": "./", "params_override": [ @@ -45,9 +47,7 @@ def test_compute_from_rest(self): compute._to_rest_object() assert compute.type == "kubernetes" assert compute.identity.type == "user_assigned" - assert ( - compute.identity.user_assigned_identities[0].resource_id == uai_resource_id - ) + assert compute.identity.user_assigned_identities[0].resource_id == uai_resource_id def _test_loaded_compute(self, compute: AmlCompute): assert compute.name == "banchaml" @@ -64,12 +64,11 @@ def test_compute_from_yaml(self): rest_intermediate = compute._to_rest_object() assert rest_intermediate.properties.compute_type == "AmlCompute" - assert ( - rest_intermediate.properties.properties.user_account_credentials.admin_user_name - == "azureuser" - ) + assert rest_intermediate.properties.properties.user_account_credentials.admin_user_name == "azureuser" assert rest_intermediate.properties.properties.enable_node_public_ip assert rest_intermediate.location == compute.location + assert rest_intermediate.tags is not None + assert rest_intermediate.tags["test"] == "true" serializer = Serializer({"ComputeResource": ComputeResource}) body = serializer.body(rest_intermediate, "ComputeResource") @@ -82,51 +81,28 @@ def test_compute_from_yaml(self): def test_compute_vm_from_yaml(self): resource_id = "/subscriptions/13e50845-67bc-4ac5-94db-48d493a6d9e8/resourceGroups/myrg/providers/Microsoft.Compute/virtualMachines/myvm" fake_key = "myfakekey" - compute: VirtualMachineCompute = load_compute( - "tests/test_configs/compute/compute-vm.yaml" - ) + compute: VirtualMachineCompute = load_compute("tests/test_configs/compute/compute-vm.yaml") assert compute.name == "banchcivm" assert compute.ssh_settings.admin_username == "azureuser" assert compute.ssh_settings.admin_password == "azureuserpassword" assert compute.ssh_settings.ssh_port == 8888 assert compute.resource_id == resource_id - assert ( - compute.ssh_settings.ssh_private_key_file - == "tests/test_configs/compute/ssh_fake_key.txt" - ) + assert compute.ssh_settings.ssh_private_key_file == "tests/test_configs/compute/ssh_fake_key.txt" rest_intermediate = compute._to_rest_object() assert rest_intermediate.properties.resource_id == resource_id assert rest_intermediate.properties.properties.ssh_port == 8888 - assert ( - rest_intermediate.properties.properties.administrator_account.password - == "azureuserpassword" - ) - assert ( - rest_intermediate.properties.properties.administrator_account.username - == "azureuser" - ) - assert ( - rest_intermediate.properties.properties.administrator_account.private_key_data - == fake_key - ) + assert rest_intermediate.properties.properties.administrator_account.password == "azureuserpassword" + assert rest_intermediate.properties.properties.administrator_account.username == "azureuser" + assert rest_intermediate.properties.properties.administrator_account.private_key_data == fake_key serializer = Serializer({"ComputeResource": ComputeResource}) body = serializer.body(rest_intermediate, "ComputeResource") assert body["properties"]["resourceId"] == resource_id assert body["properties"]["properties"]["sshPort"] == 8888 - assert ( - body["properties"]["properties"]["administratorAccount"]["username"] - == "azureuser" - ) - assert ( - body["properties"]["properties"]["administratorAccount"]["password"] - == "azureuserpassword" - ) - assert ( - body["properties"]["properties"]["administratorAccount"]["privateKeyData"] - == fake_key - ) + assert body["properties"]["properties"]["administratorAccount"]["username"] == "azureuser" + assert body["properties"]["properties"]["administratorAccount"]["password"] == "azureuserpassword" + assert body["properties"]["properties"]["administratorAccount"]["privateKeyData"] == fake_key def test_compute_from_constructor(self): compute = ComputeInstance(name="comp", type="computeinstance") @@ -136,9 +112,7 @@ def test_compute_from_constructor(self): compute._to_dict() assert compute.type == "kubernetes" - def _uai_list_to_dict( - self, value: List[ManagedIdentityConfiguration] - ) -> Union[str, ManagedIdentityConfiguration]: + def _uai_list_to_dict(self, value: List[ManagedIdentityConfiguration]) -> Union[str, ManagedIdentityConfiguration]: uai_dict = {} for item in value: @@ -148,17 +122,20 @@ def _uai_list_to_dict( def test_compute_instance_load_from_rest(self): compute_instance: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-unit.yaml" + source="tests/test_configs/compute/compute-ci-unit.yaml", + params_override=[{"tags.test1": "test"}, {"tags.test2": "true"}, {"tags.test3": "0"}], ) - + compute_instance._set_full_subnet_name("subscription_id", "resource_group_name") compute_resource = compute_instance._to_rest_object() - compute_instance2: ComputeInstance = ComputeInstance._load_from_rest( - compute_resource - ) + compute_instance2: ComputeInstance = ComputeInstance._load_from_rest(compute_resource) assert compute_instance2.last_operation == compute_instance.last_operation assert compute_instance2.services == compute_instance.services + assert compute_instance2.tags is not None + assert compute_instance2.tags["test1"] == "test" + assert compute_instance2.tags["test2"] == "true" + assert compute_instance2.tags["test3"] == "0" def test_compute_instance_with_image_metadata(self): os_image_metadata = ImageMetadata( @@ -166,81 +143,38 @@ def test_compute_instance_with_image_metadata(self): latest_image_version="22.08.20", is_latest_os_image_version=False, ) - compute_instance: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-unit.yaml" - ) + compute_instance: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci-unit.yaml") compute_resource = compute_instance._to_rest_object() compute_resource.properties.properties.os_image_metadata = os_image_metadata - compute_instance2: ComputeInstance = ComputeInstance._load_from_rest( - compute_resource - ) + compute_instance2: ComputeInstance = ComputeInstance._load_from_rest(compute_resource) os_image_metadata2 = compute_instance2.os_image_metadata assert os_image_metadata2 is not None - assert ( - os_image_metadata2.current_image_version - == os_image_metadata.current_image_version - ) - assert ( - os_image_metadata2.latest_image_version - == os_image_metadata.latest_image_version - ) - assert ( - os_image_metadata2.is_latest_os_image_version - == os_image_metadata.is_latest_os_image_version - ) + assert os_image_metadata2.current_image_version == os_image_metadata.current_image_version + assert os_image_metadata2.latest_image_version == os_image_metadata.latest_image_version + assert os_image_metadata2.is_latest_os_image_version == os_image_metadata.is_latest_os_image_version def test_compute_instance_schedules_from_yaml(self): - compute_instance: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-schedules.yaml" - ) + compute_instance: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci-schedules.yaml") assert len(compute_instance.schedules.compute_start_stop) == 2 compute_resource = compute_instance._to_rest_object() - compute_instance2: ComputeInstance = ComputeInstance._load_from_rest( - compute_resource - ) + compute_instance2: ComputeInstance = ComputeInstance._load_from_rest(compute_resource) assert len(compute_instance2.schedules.compute_start_stop) == 2 assert compute_instance2.schedules.compute_start_stop[0].action == "stop" assert compute_instance2.schedules.compute_start_stop[0].trigger.type == "Cron" - assert ( - compute_instance2.schedules.compute_start_stop[0].trigger.start_time - == "2021-03-10T21:21:07" - ) - assert ( - compute_instance2.schedules.compute_start_stop[0].trigger.time_zone - == "Pacific Standard Time" - ) - assert ( - compute_instance2.schedules.compute_start_stop[0].trigger.expression - == "0 18 * * *" - ) + assert compute_instance2.schedules.compute_start_stop[0].trigger.start_time == "2021-03-10T21:21:07" + assert compute_instance2.schedules.compute_start_stop[0].trigger.time_zone == "Pacific Standard Time" + assert compute_instance2.schedules.compute_start_stop[0].trigger.expression == "0 18 * * *" assert compute_instance2.schedules.compute_start_stop[1].action == "start" - assert ( - compute_instance2.schedules.compute_start_stop[1].trigger.type - == "Recurrence" - ) - assert ( - compute_instance2.schedules.compute_start_stop[1].trigger.start_time - == "2021-03-10T21:21:07" - ) - assert ( - compute_instance2.schedules.compute_start_stop[1].trigger.time_zone - == "Pacific Standard Time" - ) - assert ( - compute_instance2.schedules.compute_start_stop[1].trigger.frequency - == "week" - ) + assert compute_instance2.schedules.compute_start_stop[1].trigger.type == "Recurrence" + assert compute_instance2.schedules.compute_start_stop[1].trigger.start_time == "2021-03-10T21:21:07" + assert compute_instance2.schedules.compute_start_stop[1].trigger.time_zone == "Pacific Standard Time" + assert compute_instance2.schedules.compute_start_stop[1].trigger.frequency == "week" assert compute_instance2.schedules.compute_start_stop[1].trigger.interval == 1 - assert ( - compute_instance2.schedules.compute_start_stop[1].trigger.schedule - is not None - ) + assert compute_instance2.schedules.compute_start_stop[1].trigger.schedule is not None def test_compute_instance_idle_shutdown_from_yaml(self): - compute_instance: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-idle-shutdown.yaml" - ) + compute_instance: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci-idle-shutdown.yaml") assert compute_instance.idle_time_before_shutdown == "PT20M" assert compute_instance.idle_time_before_shutdown_minutes == 15 @@ -250,46 +184,26 @@ def test_compute_instance_idle_shutdown_from_yaml(self): == f"PT{compute_instance.idle_time_before_shutdown_minutes}M" ) - compute_instance2: ComputeInstance = ComputeInstance._load_from_rest( - compute_resource - ) - assert ( - compute_instance2.idle_time_before_shutdown - == f"PT{compute_instance.idle_time_before_shutdown_minutes}M" - ) - assert ( - compute_instance2.idle_time_before_shutdown_minutes - == compute_instance.idle_time_before_shutdown_minutes - ) + compute_instance2: ComputeInstance = ComputeInstance._load_from_rest(compute_resource) + assert compute_instance2.idle_time_before_shutdown == f"PT{compute_instance.idle_time_before_shutdown_minutes}M" + assert compute_instance2.idle_time_before_shutdown_minutes == compute_instance.idle_time_before_shutdown_minutes def test_compute_instance_setup_scripts_from_yaml(self): - loaded_instance: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-setup-scripts.yaml" - ) + loaded_instance: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci-setup-scripts.yaml") compute_resource: ComputeResource = loaded_instance._to_rest_object() - compute_instance: ComputeInstance = ComputeInstance._load_from_rest( - compute_resource - ) + compute_instance: ComputeInstance = ComputeInstance._load_from_rest(compute_resource) assert compute_instance.setup_scripts is not None assert compute_instance.setup_scripts.creation_script is not None - assert ( - compute_instance.setup_scripts.creation_script.path - == "Users/test/creation-script.sh" - ) + assert compute_instance.setup_scripts.creation_script.path == "Users/test/creation-script.sh" assert compute_instance.setup_scripts.creation_script.timeout_minutes == "20" assert compute_instance.setup_scripts.startup_script is not None - assert ( - compute_instance.setup_scripts.startup_script.path - == "Users/test/startup-script.sh" - ) + assert compute_instance.setup_scripts.startup_script.path == "Users/test/startup-script.sh" assert compute_instance.setup_scripts.startup_script.command == "ls" assert compute_instance.setup_scripts.startup_script.timeout_minutes == "15" def test_compute_instance_uai_from_yaml(self): - compute: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-uai.yaml" - ) + compute: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci-uai.yaml") assert compute.name == "banchci" assert compute.type == "computeinstance" assert compute.identity.type == "user_assigned" @@ -306,8 +220,7 @@ def test_compute_instance_uai_from_yaml(self): assert len(compute_resource.identity.user_assigned_identities) == 1 for k in compute_resource.identity.user_assigned_identities.keys(): assert ( - k - == "/subscriptions/4faaaf21-663f-4391-96fd-47197c630979/resourceGroups/test-rg" + k == "/subscriptions/4faaaf21-663f-4391-96fd-47197c630979/resourceGroups/test-rg" "-centraluseuap-v2-t-2021W35/providers/Microsoft.ManagedIdentity" "/userAssignedIdentities/x" ) @@ -324,9 +237,7 @@ def test_compute_instance_uai_from_yaml(self): ) def test_compute_instance_sai_from_yaml(self): - compute: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci.yaml" - ) + compute: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci.yaml") assert compute.name == "banchci" assert compute.type == "computeinstance" assert compute.identity.type == "system_assigned" @@ -339,13 +250,9 @@ def test_compute_instance_sai_from_yaml(self): assert compute_from_rest.identity.type == "system_assigned" def test_compute_no_public_ip_from_yaml(self): - compute_instance: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-no-public-ip.yaml" - ) + compute_instance: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci-no-public-ip.yaml") - aml_compute: AmlCompute = load_compute( - "tests/test_configs/compute/compute-aml-no-public-ip.yaml" - ) + aml_compute: AmlCompute = load_compute("tests/test_configs/compute/compute-aml-no-public-ip.yaml") def validate_no_public_ip(compute: Compute): assert compute.enable_node_public_ip == False @@ -356,11 +263,9 @@ def validate_no_public_ip(compute: Compute): validate_no_public_ip(compute=compute_instance) validate_no_public_ip(compute=aml_compute) - + def test_compute_instance_with_custom_app(self): - compute_instance: ComputeInstance = load_compute( - "tests/test_configs/compute/compute-ci-custom-app.yaml" - ) + compute_instance: ComputeInstance = load_compute("tests/test_configs/compute/compute-ci-custom-app.yaml") assert compute_instance.custom_applications is not None assert len(compute_instance.custom_applications) == 2 @@ -418,9 +323,7 @@ def test_synapse_compute_from_rest(self): assert compute.type == "synapsespark" def test_synapsespark_compute_from_yaml(self): - compute: SynapseSparkCompute = load_compute( - "tests/test_configs/compute/compute-synapsespark-identity.yaml" - ) + compute: SynapseSparkCompute = load_compute("tests/test_configs/compute/compute-synapsespark-identity.yaml") assert compute.name == "testidentity" assert compute.identity.type == "user_assigned" diff --git a/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_operations.py b/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_operations.py index 1aebc2420ab5..2e80dfdb6e21 100644 --- a/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_operations.py +++ b/sdk/ml/azure-ai-ml/tests/compute/unittests/test_compute_operations.py @@ -21,7 +21,9 @@ @pytest.fixture def mock_compute_operation( - mock_workspace_scope: OperationScope, mock_operation_config: OperationConfig, mock_aml_services_2022_10_01_preview: Mock + mock_workspace_scope: OperationScope, + mock_operation_config: OperationConfig, + mock_aml_services_2022_10_01_preview: Mock, ) -> ComputeOperations: yield ComputeOperations( operation_scope=mock_workspace_scope, @@ -46,9 +48,7 @@ def test_list(self, mock_compute_operation: ComputeOperations) -> None: sys.version_info[1] == 11, reason=f"This test is not compatible with Python 3.11, skip in CI.", ) - def test_create_compute_instance( - self, mock_compute_operation: ComputeOperations, mocker: MockFixture - ) -> None: + def test_create_compute_instance(self, mock_compute_operation: ComputeOperations, mocker: MockFixture) -> None: mocker.patch( "azure.ai.ml._restclient.v2022_10_01_preview.workspaces.get", return_value=funny(), @@ -66,9 +66,7 @@ def test_create_compute_instance( sys.version_info[1] == 11, reason=f"This test is not compatible with Python 3.11, skip in CI.", ) - def test_create_aml_compute( - self, mock_compute_operation: ComputeOperations, mocker: MockFixture - ) -> None: + def test_create_aml_compute(self, mock_compute_operation: ComputeOperations, mocker: MockFixture) -> None: mocker.patch("azure.ai.ml._restclient.v2022_10_01_preview.workspaces.get", return_value=funny()) compute = load_compute("./tests/test_configs/compute/compute-aml.yaml") mock_compute_operation.begin_create_or_update(compute=compute) @@ -94,9 +92,7 @@ def test_restart(self, mock_compute_operation: ComputeOperations) -> None: mock_compute_operation.begin_restart("randstr") mock_compute_operation._operation.begin_restart.assert_called_once() - def test_update_aml_compute( - self, mock_compute_operation: ComputeOperations, mocker: MockFixture - ) -> None: + def test_update_aml_compute(self, mock_compute_operation: ComputeOperations, mocker: MockFixture) -> None: compute = AmlCompute( name="name", tags={"key1": "value1", "key2": "value2"}, diff --git a/sdk/ml/azure-ai-ml/tests/conftest.py b/sdk/ml/azure-ai-ml/tests/conftest.py index 3391abcfc90e..39bef1a6b3f8 100644 --- a/sdk/ml/azure-ai-ml/tests/conftest.py +++ b/sdk/ml/azure-ai-ml/tests/conftest.py @@ -219,10 +219,12 @@ def mock_aml_services_2021_10_01_dataplanepreview(mocker: MockFixture) -> Mock: def mock_aml_services_2022_10_01_preview(mocker: MockFixture) -> Mock: return mocker.patch("azure.ai.ml._restclient.v2022_10_01_preview") + @pytest.fixture def mock_aml_services_2022_12_01_preview(mocker: MockFixture) -> Mock: return mocker.patch("azure.ai.ml._restclient.v2022_12_01_preview") + @pytest.fixture def mock_aml_services_run_history(mocker: MockFixture) -> Mock: return mocker.patch("azure.ai.ml._restclient.runhistory") @@ -343,6 +345,7 @@ def registry_client(e2e_ws_scope: OperationScope, auth: ClientSecretCredential) registry_name="testFeed", ) + @pytest.fixture def data_asset_registry_client(e2e_ws_scope: OperationScope, auth: ClientSecretCredential) -> MLClient: """return a machine learning client using default e2e testing workspace""" diff --git a/sdk/ml/azure-ai-ml/tests/dataset/e2etests/test_data.py b/sdk/ml/azure-ai-ml/tests/dataset/e2etests/test_data.py index d04e80cf4b77..adf514216b47 100644 --- a/sdk/ml/azure-ai-ml/tests/dataset/e2etests/test_data.py +++ b/sdk/ml/azure-ai-ml/tests/dataset/e2etests/test_data.py @@ -175,20 +175,15 @@ def test_create_mltable(self, client: MLClient, tmp_path: Path, randstr: Callabl assert data_version.id == generate_data_arm_id(client._operation_scope, name, version) assert data_version.path.endswith("/tmp_folder/") - @pytest.mark.skipif(condition=not is_live(), - reason="Auth issue in Registry") + @pytest.mark.skipif(condition=not is_live(), reason="Auth issue in Registry") def test_create_data_asset_in_registry( - self, data_asset_registry_client: MLClient, - randstr: Callable[[], str]) -> None: + self, data_asset_registry_client: MLClient, randstr: Callable[[], str] + ) -> None: name = randstr("name") version = "1" data_asset = load_data( source="./tests/test_configs/dataset/data_file.yaml", - params_override=[{ - "name": name - }, { - "version": version - }], + params_override=[{"name": name}, {"version": version}], ) sleep_if_live(3) obj = data_asset_registry_client.data.create_or_update(data_asset) @@ -210,16 +205,13 @@ def test_list(self, client: MLClient, data_with_2_versions: str) -> None: # use a set since ordering of elements returned from list isn't guaranteed assert {"1", "2"} == {data.version for data in data_list} - @pytest.mark.skipif(condition=not is_live(), - reason="Auth issue in Registry") - def test_list_data_in_registry( - self, data_asset_registry_client: MLClient) -> None: + @pytest.mark.skipif(condition=not is_live(), reason="Auth issue in Registry") + def test_list_data_in_registry(self, data_asset_registry_client: MLClient) -> None: data_iterator = data_asset_registry_client.data.list() assert data_iterator assert isinstance(data_iterator, ItemPaged) - def test_data_get_latest_label(self, client: MLClient, - randstr: Callable[[], str]) -> None: + def test_data_get_latest_label(self, client: MLClient, randstr: Callable[[], str]) -> None: name = randstr("name") versions = ["foo", "bar", "baz", "foobar"] @@ -227,35 +219,28 @@ def test_data_get_latest_label(self, client: MLClient, client.data.create_or_update( load_data( source="./tests/test_configs/dataset/data_file.yaml", - params_override=[{ - "name": name - }, { - "version": version - }], - )) + params_override=[{"name": name}, {"version": version}], + ) + ) sleep_if_live(3) assert client.data.get(name, label="latest").version == version - @pytest.mark.skipif(condition=not is_live(), - reason="Auth issue in Registry") + @pytest.mark.skipif(condition=not is_live(), reason="Auth issue in Registry") def test_data_get_latest_label_in_registry( - self, data_asset_registry_client: MLClient, randstr: Callable[[], - str]) -> None: + self, data_asset_registry_client: MLClient, randstr: Callable[[], str] + ) -> None: name = randstr("name") versions = ["foo", "bar", "baz", "foobar"] for version in versions: data_asset_registry_client.data.create_or_update( load_data( source="./tests/test_configs/dataset/data_file.yaml", - params_override=[{ - "name": name - }, { - "version": version - }], - )) + params_override=[{"name": name}, {"version": version}], + ) + ) sleep_if_live(3) - assert data_asset_registry_client.data.get(name, - label="latest").version == version + assert data_asset_registry_client.data.get(name, label="latest").version == version + @pytest.mark.e2etest def test_data_archive_restore_version(self, client: MLClient, randstr: Callable[[], str]) -> None: name = randstr("name") diff --git a/sdk/ml/azure-ai-ml/tests/dataset/unittests/test_data_operations.py b/sdk/ml/azure-ai-ml/tests/dataset/unittests/test_data_operations.py index 75e8fb639abb..60033355b559 100644 --- a/sdk/ml/azure-ai-ml/tests/dataset/unittests/test_data_operations.py +++ b/sdk/ml/azure-ai-ml/tests/dataset/unittests/test_data_operations.py @@ -29,9 +29,8 @@ @pytest.fixture def mock_datastore_operation( - mock_workspace_scope: OperationScope, - mock_operation_config: OperationConfig, - mock_aml_services_2022_10_01: Mock) -> DatastoreOperations: + mock_workspace_scope: OperationScope, mock_operation_config: OperationConfig, mock_aml_services_2022_10_01: Mock +) -> DatastoreOperations: yield DatastoreOperations( operation_scope=mock_workspace_scope, operation_config=mock_operation_config, @@ -79,8 +78,7 @@ def mock_artifact_storage(_one, _two, _three, **kwargs) -> Mock: name="testFileData", version="3", relative_path="path", - datastore_arm_id= - "/subscriptions/mock/resourceGroups/mock/providers/Microsoft.MachineLearningServices/workspaces/mock/datastores/datastore_id", + datastore_arm_id="/subscriptions/mock/resourceGroups/mock/providers/Microsoft.MachineLearningServices/workspaces/mock/datastores/datastore_id", container_name="containerName", ) @@ -88,37 +86,27 @@ def mock_artifact_storage(_one, _two, _three, **kwargs) -> Mock: # @pytest.fixture def mock_sas_uri(**kwargs) -> Mock: return "test_sas_uri" + + @pytest.mark.unittest -@patch("azure.ai.ml._artifacts._artifact_utilities._upload_to_datastore", - new=mock_artifact_storage) -@patch("azure.ai.ml._utils._registry_utils.get_sas_uri_for_registry_asset", - new=mock_sas_uri) +@patch("azure.ai.ml._artifacts._artifact_utilities._upload_to_datastore", new=mock_artifact_storage) +@patch("azure.ai.ml._utils._registry_utils.get_sas_uri_for_registry_asset", new=mock_sas_uri) @patch.object(Data, "_from_rest_object", new=Mock()) @patch.object(Data, "_from_container_rest_object", new=Mock()) @pytest.mark.data_experiences_test class TestDataOperations: - def test_list(self, mock_data_operations: DataOperations) -> None: - mock_data_operations._operation.list.return_value = [ - Mock(Data) for _ in range(10) - ] - mock_data_operations._container_operation.list.return_value = [ - Mock(Data) for _ in range(10) - ] + mock_data_operations._operation.list.return_value = [Mock(Data) for _ in range(10)] + mock_data_operations._container_operation.list.return_value = [Mock(Data) for _ in range(10)] result = mock_data_operations.list() assert isinstance(result, Iterable) mock_data_operations._container_operation.list.assert_called_once() mock_data_operations.list(name="random_name") mock_data_operations._operation.list.assert_called_once() - def test_list_in_registry( - self, mock_data_operations_in_registry: DataOperations) -> None: - mock_data_operations_in_registry._operation.list.return_value = [ - Mock(Data) for _ in range(10) - ] - mock_data_operations_in_registry._container_operation.list.return_value = [ - Mock(Data) for _ in range(10) - ] + def test_list_in_registry(self, mock_data_operations_in_registry: DataOperations) -> None: + mock_data_operations_in_registry._operation.list.return_value = [Mock(Data) for _ in range(10)] + mock_data_operations_in_registry._container_operation.list.return_value = [Mock(Data) for _ in range(10)] mock_data_operations_in_registry.list(name="random_name") mock_data_operations_in_registry._operation.list.assert_called_once_with( name="random_name", @@ -128,14 +116,9 @@ def test_list_in_registry( cls=ANY, ) - def test_list_in_registry_no_name( - self, mock_data_operations_in_registry: DataOperations) -> None: - mock_data_operations_in_registry._operation.list.return_value = [ - Mock(Data) for _ in range(10) - ] - mock_data_operations_in_registry._container_operation.list.return_value = [ - Mock(Data) for _ in range(10) - ] + def test_list_in_registry_no_name(self, mock_data_operations_in_registry: DataOperations) -> None: + mock_data_operations_in_registry._operation.list.return_value = [Mock(Data) for _ in range(10)] + mock_data_operations_in_registry._container_operation.list.return_value = [Mock(Data) for _ in range(10)] mock_data_operations_in_registry.list() mock_data_operations_in_registry._container_operation.list.assert_called_once_with( resource_group_name=Test_Resource_Group, @@ -144,40 +127,27 @@ def test_list_in_registry_no_name( cls=ANY, ) - def test_get_with_version(self, - mock_data_operations: DataOperations) -> None: + def test_get_with_version(self, mock_data_operations: DataOperations) -> None: name_only = "some_name" version = "1" data_asset = Data(name=name_only, version=version) - with patch.object(ItemPaged, - "next"), patch.object(Data, - "_from_rest_object", - return_value=data_asset): + with patch.object(ItemPaged, "next"), patch.object(Data, "_from_rest_object", return_value=data_asset): mock_data_operations.get(name_only, version) mock_data_operations._operation.get.assert_called_once_with( - name=name_only, - version=version, - resource_group_name=Test_Resource_Group, - workspace_name=Test_Workspace_Name) + name=name_only, version=version, resource_group_name=Test_Resource_Group, workspace_name=Test_Workspace_Name + ) - def test_get_in_registry_with_version( - self, mock_data_operations_in_registry: DataOperations) -> None: + def test_get_in_registry_with_version(self, mock_data_operations_in_registry: DataOperations) -> None: name_only = "some_name" version = "1" data_asset = Data(name=name_only, version=version) - with patch.object(ItemPaged, - "next"), patch.object(Data, - "_from_rest_object", - return_value=data_asset): + with patch.object(ItemPaged, "next"), patch.object(Data, "_from_rest_object", return_value=data_asset): mock_data_operations_in_registry.get(name_only, version) mock_data_operations_in_registry._operation.get.assert_called_once_with( - name=name_only, - version=version, - resource_group_name=Test_Resource_Group, - registry_name=Test_Registry_Name) + name=name_only, version=version, resource_group_name=Test_Resource_Group, registry_name=Test_Registry_Name + ) - def test_get_no_version(self, - mock_data_operations: DataOperations) -> None: + def test_get_no_version(self, mock_data_operations: DataOperations) -> None: name = "random_name" with pytest.raises(Exception) as ex: mock_data_operations.get(name=name) @@ -190,18 +160,17 @@ def test_create_with_spec_file( ) -> None: data_path = "./tests/test_configs/dataset/data_local_path.yaml" with patch( - "azure.ai.ml._artifacts._artifact_utilities._upload_to_datastore", - return_value=ArtifactStorageInfo( - name="testFileData", - version="3", - relative_path="path", - datastore_arm_id= - "/subscriptions/mock/resourceGroups/mock/providers/Microsoft.MachineLearningServices/workspaces/mock/datastores/datastore_id", - container_name="containerName", - ), + "azure.ai.ml._artifacts._artifact_utilities._upload_to_datastore", + return_value=ArtifactStorageInfo( + name="testFileData", + version="3", + relative_path="path", + datastore_arm_id="/subscriptions/mock/resourceGroups/mock/providers/Microsoft.MachineLearningServices/workspaces/mock/datastores/datastore_id", + container_name="containerName", + ), ) as mock_thing, patch( - "azure.ai.ml.operations._data_operations.Data._from_rest_object", - return_value=None, + "azure.ai.ml.operations._data_operations.Data._from_rest_object", + return_value=None, ): data = load_data(source=data_path) path = Path(data._base_path, data.path).resolve() @@ -220,8 +189,7 @@ def test_create_with_spec_file( ignore_file=None, ) mock_data_operations._operation.create_or_update.assert_called_once() - assert "version='1'" in str( - mock_data_operations._operation.create_or_update.call_args) + assert "version='1'" in str(mock_data_operations._operation.create_or_update.call_args) def test_create_or_update_in_registry( self, @@ -233,14 +201,11 @@ def test_create_or_update_in_registry( data_path = "./tests/test_configs/dataset/data_local_path.yaml" data = load_data(source=data_path) with patch( - "azure.ai.ml.operations._data_operations._check_and_upload_path", - return_value=(data, "indicatorfile.txt"), - ), patch( - "azure.ai.ml.operations._data_operations.Data._from_rest_object", - return_value=data - ), patch( - "azure.ai.ml.operations._data_operations.get_sas_uri_for_registry_asset", - return_value="test_sas_uri") as mock_sas_uri: + "azure.ai.ml.operations._data_operations._check_and_upload_path", + return_value=(data, "indicatorfile.txt"), + ), patch("azure.ai.ml.operations._data_operations.Data._from_rest_object", return_value=data), patch( + "azure.ai.ml.operations._data_operations.get_sas_uri_for_registry_asset", return_value="test_sas_uri" + ) as mock_sas_uri: mock_data_operations_in_registry.create_or_update(data) mock_sas_uri.assert_called_once() mock_data_operations_in_registry._operation.begin_create_or_update.assert_called_once_with( @@ -248,7 +213,8 @@ def test_create_or_update_in_registry( version="1", registry_name=Test_Registry_Name, resource_group_name=Test_Resource_Group, - body=ANY) + body=ANY, + ) def test_create_with_mltable_pattern_path( self, @@ -304,7 +270,9 @@ def test_create_or_update_missing_path(self, mock_data_operations: DataOperation with pytest.raises(Exception) as ex: load_data("tests/test_configs/dataset/data_missing_path_test.yml") - assert REF_DOC_YAML_SCHEMA_ERROR_MSG_FORMAT.format(YAMLRefDocSchemaNames.DATA, YAMLRefDocLinks.DATA) in str(ex.value) + assert REF_DOC_YAML_SCHEMA_ERROR_MSG_FORMAT.format(YAMLRefDocSchemaNames.DATA, YAMLRefDocLinks.DATA) in str( + ex.value + ) @patch("azure.ai.ml.operations._data_operations.read_local_mltable_metadata_contents") @patch("azure.ai.ml.operations._data_operations.read_remote_mltable_metadata_contents") diff --git a/sdk/ml/azure-ai-ml/tests/datastore/unittests/test_datastore_operations.py b/sdk/ml/azure-ai-ml/tests/datastore/unittests/test_datastore_operations.py index 1d13154bd783..caf56f32e401 100644 --- a/sdk/ml/azure-ai-ml/tests/datastore/unittests/test_datastore_operations.py +++ b/sdk/ml/azure-ai-ml/tests/datastore/unittests/test_datastore_operations.py @@ -29,22 +29,16 @@ def test_list(self, mock_from_rest, mock_datastore_operation: DatastoreOperation mock_datastore_operation._operation.list.assert_called_once() mock_datastore_operation._operation.list_secrets.assert_not_called() - def test_delete( - self, mock_from_rest, mock_datastore_operation: DatastoreOperations - ) -> None: + def test_delete(self, mock_from_rest, mock_datastore_operation: DatastoreOperations) -> None: mock_datastore_operation.delete("random_name") mock_datastore_operation._operation.delete.assert_called_once() - def test_get_no_secrets( - self, mock_from_rest, mock_datastore_operation: DatastoreOperations - ) -> None: + def test_get_no_secrets(self, mock_from_rest, mock_datastore_operation: DatastoreOperations) -> None: mock_datastore_operation.get("random_name") mock_datastore_operation._operation.get.assert_called_once() mock_datastore_operation._operation.list_secrets.assert_not_called() - def test_get_no_secrets_with_secrets( - self, mock_from_rest, mock_datastore_operation: DatastoreOperations - ) -> None: + def test_get_no_secrets_with_secrets(self, mock_from_rest, mock_datastore_operation: DatastoreOperations) -> None: mock_datastore_operation.get("random_name", include_secrets=True) mock_datastore_operation._operation.get.assert_called_once() mock_datastore_operation._operation.list_secrets.assert_called_once() diff --git a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_controlflow_pipeline.py b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_controlflow_pipeline.py index ac83d2bb74ca..f24530a10089 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_controlflow_pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_controlflow_pipeline.py @@ -1,8 +1,9 @@ import pytest +from azure.ai.ml.dsl._group_decorator import group from devtools_testutils import AzureRecordedTestCase, is_live from test_utilities.utils import _PYTEST_TIMEOUT_METHOD, assert_job_cancel, omit_with_wildcard -from azure.ai.ml import Input, MLClient, load_component +from azure.ai.ml import Input, MLClient, load_component, Output from azure.ai.ml.dsl import pipeline from azure.ai.ml.dsl._condition import condition from azure.ai.ml.dsl._do_while import do_while @@ -70,7 +71,7 @@ def condition_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { "conditionnode": { - '_source': 'DSL', + "_source": "DSL", "condition": "${{parent.jobs.result.outputs.output}}", "false_block": "${{parent.jobs.node1}}", "true_block": "${{parent.jobs.node2}}", @@ -115,22 +116,25 @@ def condition_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(rest_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'conditionnode': { - '_source': 'DSL', - 'condition': True, - 'false_block': '${{parent.jobs.node1}}', - 'true_block': '${{parent.jobs.node2}}', - 'type': 'if_else'}, - 'node1': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}}, - 'name': 'node1', - 'type': 'command'}, - 'node2': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '2'}}, - 'name': 'node2', - 'type': 'command'} + "conditionnode": { + "_source": "DSL", + "condition": True, + "false_block": "${{parent.jobs.node1}}", + "true_block": "${{parent.jobs.node2}}", + "type": "if_else", + }, + "node1": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": {"component_in_number": {"job_input_type": "literal", "value": "1"}}, + "name": "node1", + "type": "command", + }, + "node2": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": {"component_in_number": {"job_input_type": "literal", "value": "2"}}, + "name": "node2", + "type": "command", + }, } def test_dsl_condition_pipeline_with_one_branch(self, client: MLClient): @@ -151,16 +155,18 @@ def condition_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(rest_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'conditionnode': { - '_source': 'DSL', - 'condition': True, - 'false_block': '${{parent.jobs.node1}}', - 'type': 'if_else'}, - 'node1': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}}, - 'name': 'node1', - 'type': 'command'} + "conditionnode": { + "_source": "DSL", + "condition": True, + "false_block": "${{parent.jobs.node1}}", + "type": "if_else", + }, + "node1": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": {"component_in_number": {"job_input_type": "literal", "value": "1"}}, + "name": "node1", + "type": "command", + }, } def test_registered_component_is_control(self, client: MLClient): @@ -171,12 +177,36 @@ def test_registered_component_is_control(self, client: MLClient): registered_component = client.components.create_or_update(primitive_component_with_normal_input_output_v2) rest_dict = registered_component._to_dict() # Assert is_control with correct bool type - assert rest_dict["outputs"] == { + expected_dict = { "output_data": {"type": "uri_folder"}, "bool_param_output": {"type": "boolean", "is_control": True, "early_available": True}, "int_param_output": {"type": "integer", "is_control": True}, "float_param_output": {"type": "number", "is_control": True}, - "str_param_output": {"type": "string", "is_control": True}} + "str_param_output": {"type": "string", "is_control": True}, + } + assert rest_dict["outputs"] == expected_dict + + # Assert on pipeline component + @group + class ControlOutputGroup: + output_data: Output(type="uri_folder") + float_param_output: Output(type="number", is_control=True) + int_param_output: Output(type="integer", is_control=True) + bool_param_output: Output(type="boolean", is_control=True) + str_param_output: Output(type="string", is_control=True) + + @pipeline() + def test_pipeline_component_control_output() -> ControlOutputGroup: + node = primitive_component_with_normal_input_output_v2( + input_data=test_input, parambool=True, paramint=2, paramfloat=2.2, paramstr="test" + ) + return node.outputs + + registered_pipeline_component = client.components.create_or_update(test_pipeline_component_control_output) + rest_dict = registered_pipeline_component._to_dict() + # Update expected dict, early_available will be removed for subgraph output. + expected_dict["bool_param_output"] = {"type": "boolean", "is_control": True} + assert rest_dict["outputs"] == expected_dict def test_do_while_combined_if_else(self, client: MLClient): do_while_body_component = load_component( @@ -194,7 +224,8 @@ def test_pipeline(input_data, int_param, bool_param, float_param, str_param): int_param=int_param, bool_param=bool_param, float_param=float_param, - str_param=str_param) + str_param=str_param, + ) do_while( body=do_while_body_func, @@ -215,64 +246,81 @@ def test_pipeline(input_data, int_param, bool_param, float_param, str_param): parambool=do_while_body_func.outputs.bool_param_output, paramint=do_while_body_func.outputs.int_param_output, paramfloat=do_while_body_func.outputs.float_param_output, - paramstr=do_while_body_func.outputs.str_param_output) + paramstr=do_while_body_func.outputs.str_param_output, + ) condition(condition=do_while_body_func.outputs.condition, true_block=primitive_output_component_true) - pipeline_job = test_pipeline(input_data=test_input, int_param=4, bool_param=True, float_param=22.0, - str_param="string_param_no_space") + pipeline_job = test_pipeline( + input_data=test_input, int_param=4, bool_param=True, float_param=22.0, str_param="string_param_no_space" + ) with include_private_preview_nodes_in_pipeline(): rest_job = assert_job_cancel(pipeline_job, client) dsl_pipeline_job_dict = omit_with_wildcard(rest_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'conditionnode': { - '_source': 'DSL', - 'condition': '${{parent.jobs.do_while_body_func.outputs.condition}}', - 'true_block': '${{parent.jobs.primitive_output_component_true}}', - 'type': 'if_else'}, - 'do_while_body_func': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'bool_param': {'job_input_type': 'literal', - 'value': '${{parent.inputs.bool_param}}'}, - 'float_param': {'job_input_type': 'literal', - 'value': '${{parent.inputs.float_param}}'}, - 'input_1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.input_data}}'}, - 'input_2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.input_data}}'}, - 'int_param': {'job_input_type': 'literal', - 'value': '${{parent.inputs.int_param}}'}, - 'str_param': {'job_input_type': 'literal', - 'value': '${{parent.inputs.str_param}}'}}, - 'name': 'do_while_body_func', - 'type': 'command'}, - 'dowhile': { - '_source': 'DSL', - 'body': '${{parent.jobs.do_while_body_func}}', - 'condition': 'condition', - 'limits': {'max_iteration_count': 3}, - 'mapping': {'bool_param_output': ['bool_param'], - 'float_param_output': ['float_param'], - 'int_param_output': ['int_param'], - 'output_1': ['input_1'], - 'output_2': ['input_2'], - 'str_param_output': ['str_param']}, - 'type': 'do_while'}, - 'primitive_output_component_true': { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'input_data': {'job_input_type': 'literal', - 'value': '${{parent.jobs.do_while_body_func.outputs.output_1}}'}, - 'parambool': {'job_input_type': 'literal', - 'value': '${{parent.jobs.do_while_body_func.outputs.bool_param_output}}'}, - 'paramfloat': {'job_input_type': 'literal', - 'value': '${{parent.jobs.do_while_body_func.outputs.float_param_output}}'}, - 'paramint': {'job_input_type': 'literal', - 'value': '${{parent.jobs.do_while_body_func.outputs.int_param_output}}'}, - 'paramstr': {'job_input_type': 'literal', - 'value': '${{parent.jobs.do_while_body_func.outputs.str_param_output}}'}}, - 'name': 'primitive_output_component_true', - 'type': 'command'} + "conditionnode": { + "_source": "DSL", + "condition": "${{parent.jobs.do_while_body_func.outputs.condition}}", + "true_block": "${{parent.jobs.primitive_output_component_true}}", + "type": "if_else", + }, + "do_while_body_func": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": { + "bool_param": {"job_input_type": "literal", "value": "${{parent.inputs.bool_param}}"}, + "float_param": {"job_input_type": "literal", "value": "${{parent.inputs.float_param}}"}, + "input_1": {"job_input_type": "literal", "value": "${{parent.inputs.input_data}}"}, + "input_2": {"job_input_type": "literal", "value": "${{parent.inputs.input_data}}"}, + "int_param": {"job_input_type": "literal", "value": "${{parent.inputs.int_param}}"}, + "str_param": {"job_input_type": "literal", "value": "${{parent.inputs.str_param}}"}, + }, + "name": "do_while_body_func", + "type": "command", + }, + "dowhile": { + "_source": "DSL", + "body": "${{parent.jobs.do_while_body_func}}", + "condition": "condition", + "limits": {"max_iteration_count": 3}, + "mapping": { + "bool_param_output": ["bool_param"], + "float_param_output": ["float_param"], + "int_param_output": ["int_param"], + "output_1": ["input_1"], + "output_2": ["input_2"], + "str_param_output": ["str_param"], + }, + "type": "do_while", + }, + "primitive_output_component_true": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": { + "input_data": { + "job_input_type": "literal", + "value": "${{parent.jobs.do_while_body_func.outputs.output_1}}", + }, + "parambool": { + "job_input_type": "literal", + "value": "${{parent.jobs.do_while_body_func.outputs.bool_param_output}}", + }, + "paramfloat": { + "job_input_type": "literal", + "value": "${{parent.jobs.do_while_body_func.outputs.float_param_output}}", + }, + "paramint": { + "job_input_type": "literal", + "value": "${{parent.jobs.do_while_body_func.outputs.int_param_output}}", + }, + "paramstr": { + "job_input_type": "literal", + "value": "${{parent.jobs.do_while_body_func.outputs.str_param_output}}", + }, + }, + "name": "primitive_output_component_true", + "type": "command", + }, } @@ -283,9 +331,7 @@ def test_pipeline(input_data, int_param, bool_param, float_param, str_param): # ) class TestParallelForPipeline(TestControlFlowPipeline): def test_simple_dsl_parallel_for_pipeline(self, client: MLClient): - hello_world_component = load_component( - source="./tests/test_configs/components/helloworld_component.yml" - ) + hello_world_component = load_component(source="./tests/test_configs/components/helloworld_component.yml") @pipeline def parallel_for_pipeline(): @@ -295,7 +341,7 @@ def parallel_for_pipeline(): items=[ {"component_in_number": 1}, {"component_in_number": 2}, - ] + ], ) after_node = hello_world_component( component_in_path=parallel_node.outputs.component_out_path, @@ -310,31 +356,39 @@ def parallel_for_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'after_node': { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'computeId': 'cpu-cluster', - 'inputs': {'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.jobs.parallel_node.outputs.component_out_path}}'}}, - 'name': 'after_node', - 'type': 'command'}, - 'parallel_body': { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'component_in_path': {'job_input_type': 'uri_file', - 'uri': 'https://dprepdata.blob.core.windows.net/demo/Titanic.csv'}}, - 'name': 'parallel_body', - 'type': 'command'}, - 'parallel_node': { - '_source': 'DSL', - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, ' - '{"component_in_number": 2}]', - 'type': 'parallel_for'} + "after_node": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "computeId": "cpu-cluster", + "inputs": { + "component_in_path": { + "job_input_type": "literal", + "value": "${{parent.jobs.parallel_node.outputs.component_out_path}}", + } + }, + "name": "after_node", + "type": "command", + }, + "parallel_body": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": { + "component_in_path": { + "job_input_type": "uri_file", + "uri": "https://dprepdata.blob.core.windows.net/demo/Titanic.csv", + } + }, + "name": "parallel_body", + "type": "command", + }, + "parallel_node": { + "_source": "DSL", + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, ' '{"component_in_number": 2}]', + "type": "parallel_for", + }, } def test_dsl_parallel_for_pipeline_unprovided_input(self, client: MLClient): - hello_world_component = load_component( - source="./tests/test_configs/components/helloworld_component_alt1.yml" - ) + hello_world_component = load_component(source="./tests/test_configs/components/helloworld_component_alt1.yml") @pipeline def parallel_for_pipeline(): @@ -344,11 +398,10 @@ def parallel_for_pipeline(): items=[ {"component_in_number": 1}, {"component_in_number": 2}, - ] + ], ) after_node = hello_world_component( - component_in_path=parallel_node.outputs.component_out_path, - component_in_number=1 + component_in_path=parallel_node.outputs.component_out_path, component_in_number=1 ) after_node.compute = "cpu-cluster" @@ -359,40 +412,45 @@ def parallel_for_pipeline(): pipeline_job = assert_job_cancel(pipeline_job, client) dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'after_node': { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'computeId': 'cpu-cluster', - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.jobs.parallel_node.outputs.component_out_path}}'}}, - 'name': 'after_node', - 'type': 'command'}, - 'parallel_body': { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'component_in_path': {'job_input_type': 'uri_file', - 'uri': 'https://dprepdata.blob.core.windows.net/demo/Titanic.csv'}}, - 'name': 'parallel_body', - 'type': 'command'}, - 'parallel_node': { - '_source': 'DSL', - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, ' - '{"component_in_number": 2}]', - 'type': 'parallel_for'} + "after_node": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "computeId": "cpu-cluster", + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": { + "job_input_type": "literal", + "value": "${{parent.jobs.parallel_node.outputs.component_out_path}}", + }, + }, + "name": "after_node", + "type": "command", + }, + "parallel_body": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": { + "component_in_path": { + "job_input_type": "uri_file", + "uri": "https://dprepdata.blob.core.windows.net/demo/Titanic.csv", + } + }, + "name": "parallel_body", + "type": "command", + }, + "parallel_node": { + "_source": "DSL", + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, ' '{"component_in_number": 2}]', + "type": "parallel_for", + }, } def test_parallel_for_pipeline_with_subgraph(self, client: MLClient): - hello_world_component = load_component( - source="./tests/test_configs/components/helloworld_component.yml" - ) + hello_world_component = load_component(source="./tests/test_configs/components/helloworld_component.yml") @pipeline def sub_graph(component_in_number: int = 10): node = hello_world_component(component_in_path=test_input, component_in_number=component_in_number) - return { - "component_out_path": node.outputs.component_out_path - } + return {"component_out_path": node.outputs.component_out_path} @pipeline def parallel_for_pipeline(): @@ -402,7 +460,7 @@ def parallel_for_pipeline(): items=[ {"component_in_number": 1}, {"component_in_number": 2}, - ] + ], ) after_node = hello_world_component( component_in_path=parallel_node.outputs.component_out_path, @@ -417,35 +475,34 @@ def parallel_for_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'after_node': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'computeId': 'cpu-cluster', - 'inputs': {'component_in_path': { - 'job_input_type': 'literal', - 'value': '${{parent.jobs.parallel_node.outputs.component_out_path}}'}}, - 'name': 'after_node', - 'type': 'command'}, - 'parallel_body': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'name': 'parallel_body', - 'type': 'pipeline'}, - 'parallel_node': { - '_source': 'DSL', - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, ' - '{"component_in_number": 2}]', - 'type': 'parallel_for'} + "after_node": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "computeId": "cpu-cluster", + "inputs": { + "component_in_path": { + "job_input_type": "literal", + "value": "${{parent.jobs.parallel_node.outputs.component_out_path}}", + } + }, + "name": "after_node", + "type": "command", + }, + "parallel_body": {"_source": "REMOTE.WORKSPACE.COMPONENT", "name": "parallel_body", "type": "pipeline"}, + "parallel_node": { + "_source": "DSL", + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, ' '{"component_in_number": 2}]', + "type": "parallel_for", + }, } def test_parallel_for_pipeline_subgraph_unprovided_input(self, client: MLClient): - hello_world_component = load_component( - source="./tests/test_configs/components/helloworld_component.yml" - ) + hello_world_component = load_component(source="./tests/test_configs/components/helloworld_component.yml") @pipeline def sub_graph(component_in_number: int): node = hello_world_component(component_in_path=test_input, component_in_number=component_in_number) - return { - "component_out_path": node.outputs.component_out_path - } + return {"component_out_path": node.outputs.component_out_path} @pipeline def parallel_for_pipeline(): @@ -455,7 +512,7 @@ def parallel_for_pipeline(): items=[ {"component_in_number": 1}, {"component_in_number": 2}, - ] + ], ) after_node = hello_world_component( component_in_path=parallel_node.outputs.component_out_path, @@ -470,34 +527,39 @@ def parallel_for_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'after_node': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'computeId': 'cpu-cluster', - 'inputs': {'component_in_path': { - 'job_input_type': 'literal', - 'value': '${{parent.jobs.parallel_node.outputs.component_out_path}}'}}, - 'name': 'after_node', - 'type': 'command'}, - 'parallel_body': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'name': 'parallel_body', - 'type': 'pipeline'}, - 'parallel_node': { - '_source': 'DSL', - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, ' - '{"component_in_number": 2}]', - 'type': 'parallel_for'} + "after_node": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "computeId": "cpu-cluster", + "inputs": { + "component_in_path": { + "job_input_type": "literal", + "value": "${{parent.jobs.parallel_node.outputs.component_out_path}}", + } + }, + "name": "after_node", + "type": "command", + }, + "parallel_body": {"_source": "REMOTE.WORKSPACE.COMPONENT", "name": "parallel_body", "type": "pipeline"}, + "parallel_node": { + "_source": "DSL", + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, ' '{"component_in_number": 2}]', + "type": "parallel_for", + }, } def test_parallel_for_pipeline_with_port_outputs(self, client: MLClient): hello_world_component = load_component( source="./tests/test_configs/components/helloworld_component.yml", params_override=[ - {"outputs": { - "component_out_path": {"type": "uri_folder"}, - "component_out_file": {"type": "uri_file"}, - "component_out_table": {"type": "mltable"}, - }} - ] + { + "outputs": { + "component_out_path": {"type": "uri_folder"}, + "component_out_file": {"type": "uri_file"}, + "component_out_table": {"type": "mltable"}, + } + } + ], ) @pipeline @@ -508,7 +570,7 @@ def parallel_for_pipeline(): items=[ {"component_in_number": 3}, {"component_in_number": 4}, - ] + ], ) return { "component_out_path": parallel_node.outputs.component_out_path, @@ -524,33 +586,33 @@ def parallel_for_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'parallel_body': {'_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'component_in_path': { - 'job_input_type': 'uri_file', - 'uri': 'https://dprepdata.blob.core.windows.net/demo/Titanic.csv'}}, - 'name': 'parallel_body', - 'type': 'command'}, - 'parallel_node': { - '_source': 'DSL', - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 3}, ' - '{"component_in_number": 4}]', - 'type': 'parallel_for', - 'outputs': {'component_out_file': {'type': 'literal', - 'value': '${{parent.outputs.component_out_file}}'}, - 'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.component_out_path}}'}, - 'component_out_table': {'type': 'literal', - 'value': '${{parent.outputs.component_out_table}}'}}, - } + "parallel_body": { + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": { + "component_in_path": { + "job_input_type": "uri_file", + "uri": "https://dprepdata.blob.core.windows.net/demo/Titanic.csv", + } + }, + "name": "parallel_body", + "type": "command", + }, + "parallel_node": { + "_source": "DSL", + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 3}, ' '{"component_in_number": 4}]', + "type": "parallel_for", + "outputs": { + "component_out_file": {"type": "literal", "value": "${{parent.outputs.component_out_file}}"}, + "component_out_path": {"type": "literal", "value": "${{parent.outputs.component_out_path}}"}, + "component_out_table": {"type": "literal", "value": "${{parent.outputs.component_out_table}}"}, + }, + }, } assert dsl_pipeline_job_dict["properties"]["outputs"] == { - 'component_out_file': {'job_output_type': 'mltable', - 'mode': 'ReadWriteMount'}, - 'component_out_path': {'job_output_type': 'mltable', - 'mode': 'ReadWriteMount'}, - 'component_out_table': {'job_output_type': 'mltable', - 'mode': 'ReadWriteMount'} + "component_out_file": {"job_output_type": "mltable", "mode": "ReadWriteMount"}, + "component_out_path": {"job_output_type": "mltable", "mode": "ReadWriteMount"}, + "component_out_table": {"job_output_type": "mltable", "mode": "ReadWriteMount"}, } # parallel for pipeline component is correctly generated @@ -563,21 +625,20 @@ def parent_pipeline(): rest_pipeline_component = pipeline_job.jobs["parallel_for_pipeline"].component._to_rest_object().as_dict() assert rest_pipeline_component["properties"]["component_spec"]["outputs"] == { - 'component_out_file': {'type': 'mltable'}, - 'component_out_path': {'type': 'mltable'}, - 'component_out_table': {'type': 'mltable'} + "component_out_file": {"type": "mltable"}, + "component_out_path": {"type": "mltable"}, + "component_out_table": {"type": "mltable"}, } assert rest_pipeline_component["properties"]["component_spec"]["jobs"]["parallel_node"] == { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 3}, {"component_in_number": 4}]', - 'outputs': {'component_out_file': {'type': 'literal', - 'value': '${{parent.outputs.component_out_file}}'}, - 'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.component_out_path}}'}, - 'component_out_table': {'type': 'literal', - 'value': '${{parent.outputs.component_out_table}}'}}, - 'type': 'parallel_for', - '_source': 'DSL', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 3}, {"component_in_number": 4}]', + "outputs": { + "component_out_file": {"type": "literal", "value": "${{parent.outputs.component_out_file}}"}, + "component_out_path": {"type": "literal", "value": "${{parent.outputs.component_out_path}}"}, + "component_out_table": {"type": "literal", "value": "${{parent.outputs.component_out_table}}"}, + }, + "type": "parallel_for", + "_source": "DSL", } with include_private_preview_nodes_in_pipeline(): @@ -587,12 +648,14 @@ def test_parallel_for_pipeline_with_primitive_outputs(self, client: MLClient): hello_world_component = load_component( source="./tests/test_configs/components/helloworld_component.yml", params_override=[ - {"outputs": { - "component_out_path": {"type": "uri_folder"}, - "component_out_number": {"type": "number"}, - "component_out_boolean": {"type": "boolean", "is_control": True}, - }} - ] + { + "outputs": { + "component_out_path": {"type": "uri_folder"}, + "component_out_number": {"type": "number"}, + "component_out_boolean": {"type": "boolean", "is_control": True}, + } + } + ], ) @pipeline @@ -603,7 +666,7 @@ def parallel_for_pipeline(): items=[ {"component_in_number": 1}, {"component_in_number": 2}, - ] + ], ) return { "component_out_path": parallel_node.outputs.component_out_path, @@ -620,22 +683,21 @@ def parent_pipeline(): rest_pipeline_component = pipeline_job.jobs["parallel_for_pipeline"].component._to_rest_object().as_dict() assert rest_pipeline_component["properties"]["component_spec"]["outputs"] == { - 'component_out_boolean': {'is_control': True, 'type': 'string'}, - 'component_out_number': {'type': 'string'}, - 'component_out_path': {'type': 'mltable'} + "component_out_boolean": {"is_control": True, "type": "string"}, + "component_out_number": {"type": "string"}, + "component_out_path": {"type": "mltable"}, } assert rest_pipeline_component["properties"]["component_spec"]["jobs"]["parallel_node"] == { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, {"component_in_number": 2}]', - 'outputs': {'component_out_boolean': {'type': 'literal', - 'value': '${{parent.outputs.component_out_boolean}}'}, - 'component_out_number': {'type': 'literal', - 'value': '${{parent.outputs.component_out_number}}'}, - 'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.component_out_path}}'}}, - 'type': 'parallel_for', - '_source': 'DSL', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, {"component_in_number": 2}]', + "outputs": { + "component_out_boolean": {"type": "literal", "value": "${{parent.outputs.component_out_boolean}}"}, + "component_out_number": {"type": "literal", "value": "${{parent.outputs.component_out_number}}"}, + "component_out_path": {"type": "literal", "value": "${{parent.outputs.component_out_path}}"}, + }, + "type": "parallel_for", + "_source": "DSL", } # parallel for pipeline component is correctly generated @@ -653,10 +715,7 @@ def parallel_for_pipeline(): foreach_config = {} for i in range(10): foreach_config[f"silo_{i}"] = {} - parallel_node = parallel_for( - body=parallel_body, - items=foreach_config - ) + parallel_node = parallel_for(body=parallel_body, items=foreach_config) return { "component_out_path": parallel_node.outputs.component_out_path, } @@ -669,25 +728,23 @@ def parallel_for_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"] == { - 'parallel_body': {'_source': 'YAML.COMPONENT', - 'name': 'parallel_body', - 'type': 'command'}, - 'parallel_node': { - '_source': 'DSL', - 'body': '${{parent.jobs.parallel_body}}', - 'items': '{"silo_0": {}, "silo_1": {}, "silo_2": {}, ' - '"silo_3": {}, "silo_4": {}, "silo_5": {}, ' - '"silo_6": {}, "silo_7": {}, "silo_8": {}, ' - '"silo_9": {}}', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.component_out_path}}'}}, - 'type': 'parallel_for'} + "parallel_body": {"_source": "YAML.COMPONENT", "name": "parallel_body", "type": "command"}, + "parallel_node": { + "_source": "DSL", + "body": "${{parent.jobs.parallel_body}}", + "items": '{"silo_0": {}, "silo_1": {}, "silo_2": {}, ' + '"silo_3": {}, "silo_4": {}, "silo_5": {}, ' + '"silo_6": {}, "silo_7": {}, "silo_8": {}, ' + '"silo_9": {}}', + "outputs": { + "component_out_path": {"type": "literal", "value": "${{parent.outputs.component_out_path}}"} + }, + "type": "parallel_for", + }, } def test_parallel_for_pipeline_with_asset_items(self, client: MLClient): - hello_world_component = load_component( - source="./tests/test_configs/components/helloworld_component.yml" - ) + hello_world_component = load_component(source="./tests/test_configs/components/helloworld_component.yml") @pipeline def parallel_for_pipeline(): @@ -697,7 +754,7 @@ def parallel_for_pipeline(): items=[ {"component_in_number": 1, "component_in_path": test_input}, {"component_in_number": 2, "component_in_path": test_input}, - ] + ], ) after_node = hello_world_component( component_in_path=parallel_node.outputs.component_out_path, @@ -711,15 +768,15 @@ def parallel_for_pipeline(): dsl_pipeline_job_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict(), *omit_fields) assert dsl_pipeline_job_dict["properties"]["jobs"]["parallel_node"] == { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_path": {"uri": ' - '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' - '"job_input_type": "uri_file"}, ' - '"component_in_number": 1}, {"component_in_path": ' - '{"uri": ' - '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' - '"job_input_type": "uri_file"}, ' - '"component_in_number": 2}]', - 'type': 'parallel_for', - '_source': 'DSL', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_path": {"uri": ' + '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' + '"job_input_type": "uri_file"}, ' + '"component_in_number": 1}, {"component_in_path": ' + '{"uri": ' + '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' + '"job_input_type": "uri_file"}, ' + '"component_in_number": 2}]', + "type": "parallel_for", + "_source": "DSL", } diff --git a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline.py b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline.py index 8d6e040cbcb1..600ec37c79fb 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline.py @@ -645,8 +645,7 @@ def sample_pipeline(job_in_file, sample_rate): }, "name": "node1", "outputs": {"output1": {"type": "literal", "value": "${{parent.outputs.pipeline_output}}"}}, - 'resources': {'instance_type': 'standard_e4s_v3', - 'runtime_version': '3.1.0'}, + "resources": {"instance_type": "standard_e4s_v3", "runtime_version": "3.1.0"}, "type": "spark", } }, @@ -991,7 +990,7 @@ def pipeline_missing_type( in e.value.message ) - @dsl.pipeline(non_pipeline_inputs=['param']) + @dsl.pipeline(non_pipeline_inputs=["param"]) def pipeline_with_non_pipeline_inputs( required_input: Input, required_param: str, @@ -1004,14 +1003,13 @@ def pipeline_with_non_pipeline_inputs( with pytest.raises(ValidationException) as e: client.components.create_or_update(pipeline_with_non_pipeline_inputs) - assert "Cannot register pipeline component 'pipeline_with_non_pipeline_inputs' with non_pipeline_inputs." in e.value.message + assert ( + "Cannot register pipeline component 'pipeline_with_non_pipeline_inputs' with non_pipeline_inputs." + in e.value.message + ) @dsl.pipeline() - def pipeline_with_variable_inputs( - required_input: Input, - required_param: str, - *args, **kwargs - ): + def pipeline_with_variable_inputs(required_input: Input, required_param: str, *args, **kwargs): default_optional_func( required_input=required_input, required_param=required_param, @@ -1019,7 +1017,10 @@ def pipeline_with_variable_inputs( with pytest.raises(ValidationException) as e: client.components.create_or_update(pipeline_with_variable_inputs) - assert "Cannot register the component pipeline_with_variable_inputs with variable inputs ['args', 'kwargs']" in e.value.message + assert ( + "Cannot register the component pipeline_with_variable_inputs with variable inputs ['args', 'kwargs']" + in e.value.message + ) def test_create_pipeline_component_by_dsl(self, caplog, client: MLClient): default_optional_func = load_component(source=str(components_dir / "default_optional_component.yml")) @@ -1049,9 +1050,7 @@ def valid_pipeline_func( # Assert binding on compute not changed after resolve dependencies client.components._resolve_dependencies_for_pipeline_component_jobs( - component, - resolver=client.components._orchestrators.get_asset_arm_id, - resolve_inputs=False + component, resolver=client.components._orchestrators.get_asset_arm_id, resolve_inputs=False ) assert component.jobs["node2"].compute == "${{parent.inputs.node_compute}}" @@ -1487,7 +1486,7 @@ def pipeline_distribution_components(job_in_number, job_in_path): # continue_on_step_failure can't be set in create_or_update assert created_job.settings.continue_on_step_failure is False assert created_job.jobs["hello_world_component_mpi"].component.startswith(ANONYMOUS_COMPONENT_NAME) - assert created_job.jobs["helloworld_component"].component == 'microsoftsamples_command_component_basic:0.0.1' + assert created_job.jobs["helloworld_component"].component == "microsoftsamples_command_component_basic:0.0.1" assert hello_world_func._is_anonymous is False assert origin_id == hello_world_func.id @@ -1818,7 +1817,8 @@ def parallel_in_pipeline(job_data_path): assert expected_job == actual_job def test_multi_parallel_components_with_file_input_pipeline_output( - self, client: MLClient, randstr: Callable[[str], str]) -> None: + self, client: MLClient, randstr: Callable[[str], str] + ) -> None: components_dir = tests_root_dir / "test_configs/dsl_pipeline/parallel_component_with_file_input" batch_inference1 = load_component(source=str(components_dir / "score.yml")) batch_inference2 = load_component(source=str(components_dir / "score.yml")) @@ -2031,6 +2031,7 @@ def test_dsl_pipeline_with_only_setting_pipeline_level(self, client: MLClient): } assert expected_job == actual_job + @pytest.mark.skipif(condition=not is_live(), reason="TODO(2177353): investigate why this test fails.") def test_dsl_pipeline_with_only_setting_binding_node(self, client: MLClient): # Todo: checkout run priority when backend is ready from test_configs.dsl_pipeline.pipeline_with_set_binding_output_input.pipeline import ( @@ -2082,11 +2083,13 @@ def test_dsl_pipeline_with_only_setting_binding_node(self, client: MLClient): }, } }, - "outputs": {"trained_model": {"mode": "ReadWriteMount", "job_output_type": "uri_folder"}}, + # mode will be copied to pipeline level + "outputs": {"trained_model": {"mode": "Upload", "job_output_type": "uri_folder"}}, "settings": {}, } assert expected_job == actual_job + @pytest.mark.skipif(condition=not is_live(), reason="TODO(2177353): investigate why this test fails.") def test_dsl_pipeline_with_setting_binding_node_and_pipeline_level(self, client: MLClient) -> None: from test_configs.dsl_pipeline.pipeline_with_set_binding_output_input.pipeline import ( pipeline_with_setting_binding_node_and_pipeline_level, @@ -2137,6 +2140,7 @@ def test_dsl_pipeline_with_setting_binding_node_and_pipeline_level(self, client: }, } }, + # pipeline level output setting taking effect "outputs": {"trained_model": {"mode": "ReadWriteMount", "job_output_type": "uri_folder"}}, "settings": {}, } @@ -2314,27 +2318,36 @@ def pipeline_with_group(group: ParamClass): component_in_boolean=group.bool_param, component_in_ranged_integer=group.sub.int_param, ) + component = client.components.create_or_update(pipeline_with_group) # Assert key not exists - match = "(.*)unexpected keyword argument 'group.not_exist'(.*)valid keywords: " \ - "'group', 'group.sub.int_param', 'group.str_param', 'group.bool_param', 'group.number_param'" + match = ( + "(.*)unexpected keyword argument 'group.not_exist'(.*)valid keywords: " + "'group', 'group.sub.int_param', 'group.str_param', 'group.bool_param', 'group.number_param'" + ) with pytest.raises(UnexpectedKeywordError, match=match): - component(**{ - "group.number_param": 4.0, "group.str_param": "testing", - "group.sub.int_param": 4, "group.not_exist": 4, - }) + component( + **{ + "group.number_param": 4.0, + "group.str_param": "testing", + "group.sub.int_param": 4, + "group.not_exist": 4, + } + ) # Assert conflict assignment with pytest.raises(Exception, match="Conflict parameter key 'group' and 'group.number_param'"): - pipeline = component(**{ - "group.number_param": 4.0, "group.str_param": "testing", - "group.sub.int_param": 4, "group": ParamClass(sub=SubParamClass(int_param=1)) - }) + pipeline = component( + **{ + "group.number_param": 4.0, + "group.str_param": "testing", + "group.sub.int_param": 4, + "group": ParamClass(sub=SubParamClass(int_param=1)), + } + ) pipeline.settings.default_compute = "cpu-cluster" client.jobs.create_or_update(pipeline) # Assert happy path - inputs = { - "group.number_param": 4.0, "group.str_param": "testing", "group.sub.int_param": 4 - } + inputs = {"group.number_param": 4.0, "group.str_param": "testing", "group.sub.int_param": 4} pipeline = component(**inputs) pipeline.settings.default_compute = "cpu-cluster" rest_pipeline_job = client.jobs.create_or_update(pipeline) @@ -2368,50 +2381,47 @@ def test_pipeline_node_identity_with_component(self, client: MLClient): @dsl.pipeline def pipeline_func(component_in_path): - node1 = component_func( - component_in_number=1, component_in_path=component_in_path - ) + node1 = component_func(component_in_number=1, component_in_path=component_in_path) node1.identity = AmlTokenConfiguration() - node2 = component_func( - component_in_number=1, component_in_path=component_in_path - ) + node2 = component_func(component_in_number=1, component_in_path=component_in_path) node2.identity = UserIdentityConfiguration() - node3 = component_func( - component_in_number=1, component_in_path=component_in_path - ) + node3 = component_func(component_in_number=1, component_in_path=component_in_path) node3.identity = ManagedIdentityConfiguration() pipeline = pipeline_func(component_in_path=job_input) pipeline_job = client.jobs.create_or_update(pipeline, compute="cpu-cluster") - omit_fields = [ - "jobs.*.componentId", - "jobs.*._source" - ] + omit_fields = ["jobs.*.componentId", "jobs.*._source"] actual_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict()["properties"], *omit_fields) assert actual_dict["jobs"] == { - 'node1': {'identity': {'type': 'aml_token'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path}}'}}, - 'name': 'node1', - 'type': 'command'}, - 'node2': {'identity': {'type': 'user_identity'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path}}'}}, - 'name': 'node2', - 'type': 'command'}, - 'node3': {'identity': {'type': 'managed_identity'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path}}'}}, - 'name': 'node3', - 'type': 'command'} + "node1": { + "identity": {"type": "aml_token"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + }, + "name": "node1", + "type": "command", + }, + "node2": { + "identity": {"type": "user_identity"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + }, + "name": "node2", + "type": "command", + }, + "node3": { + "identity": {"type": "managed_identity"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + }, + "name": "node3", + "type": "command", + }, } def test_default_pipeline_job_services(self, client: MLClient, randstr: Callable[[str], str]) -> None: @@ -2460,8 +2470,8 @@ def my_pipeline() -> Outputs: pipeline_job = my_pipeline() # overwrite group outputs mode will appear in pipeline job&component level - expected_outputs = {'output1': {'description': 'new description', 'type': 'uri_folder'}} - expected_job_outputs = {'output1': {'description': 'new description', 'job_output_type': 'uri_folder'}} + expected_outputs = {"output1": {"description": "new description", "type": "uri_folder"}} + expected_job_outputs = {"output1": {"description": "new description", "job_output_type": "uri_folder"}} rest_job_dict = pipeline_job._to_rest_object().as_dict() # assert pipeline job level mode overwrite @@ -2494,8 +2504,8 @@ def my_pipeline() -> Outputs: pipeline_job = my_pipeline() # overwrite group outputs mode will appear in pipeline job&component level - expected_job_outputs = {'output1': {'mode': 'Upload', 'job_output_type': 'uri_folder'}} - expected_outputs = {'output1': {'mode': 'upload', 'type': 'uri_folder'}} + expected_job_outputs = {"output1": {"mode": "Upload", "job_output_type": "uri_folder"}} + expected_outputs = {"output1": {"mode": "upload", "type": "uri_folder"}} rest_job_dict = pipeline_job._to_rest_object().as_dict() # assert pipeline job level mode overwrite assert rest_job_dict["properties"]["outputs"] == expected_job_outputs @@ -2524,28 +2534,44 @@ def my_pipeline(): assert_job_cancel(pipeline_job, client) def test_register_output_sdk(self, client: MLClient): - from azure.ai.ml.sweep import BanditPolicy, Choice, LogNormal, LogUniform, Normal, QLogNormal, QLogUniform, QNormal, QUniform, Randint, Uniform + from azure.ai.ml.sweep import ( + BanditPolicy, + Choice, + LogNormal, + LogUniform, + Normal, + QLogNormal, + QLogUniform, + QNormal, + QUniform, + Randint, + Uniform, + ) component = load_component(source="./tests/test_configs/components/helloworld_component.yml") - component_input = Input(type='uri_file', path='https://dprepdata.blob.core.windows.net/demo/Titanic.csv') + component_input = Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv") spark_component = load_component(source="./tests/test_configs/spark_component/component.yml") - parallel_component = load_component(source="./tests/test_configs/components/parallel_component_with_file_input.yml") + parallel_component = load_component( + source="./tests/test_configs/components/parallel_component_with_file_input.yml" + ) sweep_component = load_component(source="./tests/test_configs/components/helloworld_component_for_sweep.yml") @dsl.pipeline() def register_node_output(): node = component(component_in_path=component_input) - node.outputs.component_out_path.name = 'a_output' - node.outputs.component_out_path.version = '1' + node.outputs.component_out_path.name = "a_output" + node.outputs.component_out_path.version = "1" spark_node = spark_component(file_input=component_input) spark_node.compute = "cpu-cluster" - spark_node.outputs.output.name = 'spark_output' - spark_node.outputs.output.version = '1' + spark_node.outputs.output.name = "spark_output" + spark_node.outputs.output.version = "1" - parallel_node = parallel_component(job_data_path=Input(type='mltable', path='https://dprepdata.blob.core.windows.net/demo/Titanic.csv')) + parallel_node = parallel_component( + job_data_path=Input(type="mltable", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv") + ) parallel_node.outputs.job_output_path.name = "parallel_output" - parallel_node.outputs.job_output_path.version = '123_parallel' + parallel_node.outputs.job_output_path.version = "123_parallel" cmd_node1 = sweep_component( batch_size=Choice([25, 35]), @@ -2572,62 +2598,58 @@ def register_node_output(): sweep_node.compute = "cpu-cluster" sweep_node.set_limits(max_total_trials=2, max_concurrent_trials=3, timeout=600) sweep_node.early_termination = BanditPolicy(evaluation_interval=2, slack_factor=0.1, delay_evaluation=1) - sweep_node.outputs.trained_model_dir.name = 'sweep_output' - sweep_node.outputs.trained_model_dir.version = 'sweep_2' + sweep_node.outputs.trained_model_dir.name = "sweep_output" + sweep_node.outputs.trained_model_dir.version = "sweep_2" pipeline = register_node_output() pipeline.settings.default_compute = "azureml:cpu-cluster" pipeline_job = assert_job_cancel(pipeline, client) - output = pipeline_job.jobs['node'].outputs.component_out_path - assert output.name == 'a_output' - assert output.version == '1' - output = pipeline_job.jobs['spark_node'].outputs.output - assert output.name == 'spark_output' - assert output.version == '1' - output = pipeline_job.jobs['parallel_node'].outputs.job_output_path - assert output.name == 'parallel_output' - assert output.version == '123_parallel' - output = pipeline_job.jobs['sweep_node'].outputs.trained_model_dir - assert output.name == 'sweep_output' - assert output.version == 'sweep_2' + output = pipeline_job.jobs["node"].outputs.component_out_path + assert output.name == "a_output" + assert output.version == "1" + output = pipeline_job.jobs["spark_node"].outputs.output + assert output.name == "spark_output" + assert output.version == "1" + output = pipeline_job.jobs["parallel_node"].outputs.job_output_path + assert output.name == "parallel_output" + assert output.version == "123_parallel" + output = pipeline_job.jobs["sweep_node"].outputs.trained_model_dir + assert output.name == "sweep_output" + assert output.version == "sweep_2" @dsl.pipeline() def register_pipeline_output(): node = component(component_in_path=component_input) - return { - 'pipeine_a_output': node.outputs.component_out_path - } + return {"pipeine_a_output": node.outputs.component_out_path} pipeline = register_pipeline_output() - pipeline.outputs.pipeine_a_output.name = 'a_output' - pipeline.outputs.pipeine_a_output.version = '1' + pipeline.outputs.pipeine_a_output.name = "a_output" + pipeline.outputs.pipeine_a_output.version = "1" pipeline.settings.default_compute = "azureml:cpu-cluster" pipeline_job = assert_job_cancel(pipeline, client) output = pipeline_job.outputs.pipeine_a_output - assert output.name == 'a_output' - assert output.version == '1' + assert output.name == "a_output" + assert output.version == "1" @dsl.pipeline() def register_both_output(): node = component(component_in_path=component_input) - node.outputs.component_out_path.name = 'a_output' - node.outputs.component_out_path.version = '1' - return { - 'pipeine_a_output': node.outputs.component_out_path - } + node.outputs.component_out_path.name = "a_output" + node.outputs.component_out_path.version = "1" + return {"pipeine_a_output": node.outputs.component_out_path} pipeline = register_both_output() - pipeline.outputs.pipeine_a_output.name = 'b_output' - pipeline.outputs.pipeine_a_output.version = '2' + pipeline.outputs.pipeine_a_output.name = "b_output" + pipeline.outputs.pipeine_a_output.version = "2" pipeline.settings.default_compute = "azureml:cpu-cluster" pipeline_job = assert_job_cancel(pipeline, client) pipeline_output = pipeline_job.outputs.pipeine_a_output - assert pipeline_output.name == 'b_output' - assert pipeline_output.version == '2' - node_output = pipeline_job.jobs['node'].outputs.component_out_path - assert node_output.name == 'a_output' - assert node_output.version == '1' + assert pipeline_output.name == "b_output" + assert pipeline_output.version == "2" + node_output = pipeline_job.jobs["node"].outputs.component_out_path + assert node_output.name == "a_output" + assert node_output.version == "1" @pytest.mark.skipif(condition=is_live(), reason="need worskspace with datafactory compute") def test_dsl_pipeline_with_data_transfer_copy_2urifolder(self, client: MLClient) -> None: @@ -2642,69 +2664,141 @@ def test_dsl_pipeline_with_data_transfer_copy_2urifolder(self, client: MLClient) actual_job = omit_with_wildcard(pipeline_job._to_rest_object().properties.as_dict(), *common_omit_fields) expected_job = { - 'description': 'submit a pipeline with data transfer copy job', - 'inputs': {'cosmos_folder': {'job_input_type': 'uri_folder', - 'mode': 'ReadOnlyMount'}, - 'cosmos_folder_dup': {'job_input_type': 'uri_folder', - 'mode': 'ReadOnlyMount'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'merge_files': {'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder_dup}}'}}, - 'name': 'merge_files', - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer'}}, - 'outputs': {'merged_blob': {'job_output_type': 'uri_folder', - 'mode': 'ReadWriteMount'}}, - 'settings': {'default_compute': 'adftest'}, - 'tags': {} + "description": "submit a pipeline with data transfer copy job", + "inputs": { + "cosmos_folder": {"job_input_type": "uri_folder", "mode": "ReadOnlyMount"}, + "cosmos_folder_dup": {"job_input_type": "uri_folder", "mode": "ReadOnlyMount"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "merge_files": { + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder_dup}}"}, + }, + "name": "merge_files", + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", + } + }, + "outputs": {"merged_blob": {"job_output_type": "uri_folder", "mode": "ReadWriteMount"}}, + "settings": {"default_compute": "adftest"}, + "tags": {}, } assert expected_job == actual_job + def test_output_setting_path(self, client: MLClient) -> None: + component_yaml = components_dir / "helloworld_component.yml" + component_func1 = load_component(source=component_yaml) + + # case 1: only node level has setting + @dsl.pipeline() + def pipeline(): + node1 = component_func1(component_in_number=1, component_in_path=job_input) + node1.outputs.component_out_path.path = "azureml://datastores/workspaceblobstore/paths/outputs/1" + return node1.outputs + + pipeline_job = pipeline() + pipeline_job.settings.default_compute = "cpu-cluster" + pipeline_job = assert_job_cancel(pipeline_job, client) + job_dict = pipeline_job._to_dict() + expected_node_output_dict = { + "component_out_path": "${{parent.outputs.component_out_path}}", + } + expected_pipeline_output_dict = { + "component_out_path": { + # default mode added by mt, default type added by SDK + "mode": "rw_mount", + "type": "uri_folder", + # node level config will be copied to pipeline level + "path": "azureml://datastores/workspaceblobstore/paths/outputs/1", + } + } + assert job_dict["jobs"]["node1"]["outputs"] == expected_node_output_dict + assert job_dict["outputs"] == expected_pipeline_output_dict + + def test_pipeline_component_output_setting(self, client: MLClient) -> None: + component_yaml = components_dir / "helloworld_component.yml" + component_func1 = load_component(source=component_yaml) + + @dsl.pipeline() + def inner_pipeline(): + node1 = component_func1(component_in_number=1, component_in_path=job_input) + node1.outputs.component_out_path.path = "azureml://datastores/workspaceblobstore/paths/outputs/1" + # node1's output setting will be copied to pipeline's setting + return node1.outputs + + @dsl.pipeline() + def outer_pipeline(): + # inner_pipeline's output setting will be copied to node1's setting + node1 = inner_pipeline() + # node1's output setting will be copied to pipeline's setting + return node1.outputs + + pipeline_job = outer_pipeline() + pipeline_job_dict = pipeline_job._to_dict() + assert pipeline_job_dict["outputs"] == { + "component_out_path": {"path": "azureml://datastores/workspaceblobstore/paths/outputs/1"} + } + pipeline_component = pipeline_job.jobs["node1"].component + pipeline_component_dict = pipeline_component._to_dict() + assert pipeline_component_dict["outputs"] == {"component_out_path": {"type": "uri_folder"}} + assert pipeline_component_dict["jobs"]["node1"]["outputs"] == { + "component_out_path": "${{parent.outputs.component_out_path}}" + } + + pipeline_job.settings.default_compute = "cpu-cluster" + pipeline_job = client.jobs.create_or_update(pipeline_job) + client.jobs.begin_cancel(pipeline_job.name) + job_dict = pipeline_job._to_dict() + # outer pipeline's node1 should have the output setting + assert job_dict["jobs"]["node1"]["outputs"] == {"component_out_path": "${{parent.outputs.component_out_path}}"} + assert job_dict["outputs"] == { + "component_out_path": { + "mode": "rw_mount", + "type": "uri_folder", + # node level config will be copied to pipeline level + "path": "azureml://datastores/workspaceblobstore/paths/outputs/1", + } + } @pytest.mark.disable_mock_code_hash def test_register_output_sdk_succeed(self, client: MLClient): component = load_component(source="./tests/test_configs/components/helloworld_component.yml") - component_input = Input(type='uri_file', path='https://dprepdata.blob.core.windows.net/demo/Titanic.csv') + component_input = Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv") @dsl.pipeline() def sub_pipeline(): node = component(component_in_path=component_input) - node.outputs.component_out_path.name = 'sub_pipeline_output' - node.outputs.component_out_path.version = 'v1' - return { - 'sub_pipeine_a_output': node.outputs.component_out_path - } + node.outputs.component_out_path.name = "sub_pipeline_output" + node.outputs.component_out_path.version = "v1" + return {"sub_pipeine_a_output": node.outputs.component_out_path} @dsl.pipeline() def register_both_output(): # register NodeOutput which is binding to PipelineOutput node = component(component_in_path=component_input) - node.outputs.component_out_path.name = 'n1_output' - node.outputs.component_out_path.version = 'v1' + node.outputs.component_out_path.name = "n1_output" + node.outputs.component_out_path.version = "v1" # register NodeOutput which isn't binding to PipelineOutput node_2 = component(component_in_path=component_input) - node_2.outputs.component_out_path.name = 'n2_output' - node_2.outputs.component_out_path.version = 'v1' + node_2.outputs.component_out_path.name = "n2_output" + node_2.outputs.component_out_path.version = "v1" # register NodeOutput of subgraph sub_node = sub_pipeline() - sub_node.outputs.sub_pipeine_a_output.name = 'sub_pipeline' - sub_node.outputs.sub_pipeine_a_output.version = 'v1' + sub_node.outputs.sub_pipeine_a_output.name = "sub_pipeline" + sub_node.outputs.sub_pipeine_a_output.version = "v1" - return { - 'pipeine_a_output': node.outputs.component_out_path - } + return {"pipeine_a_output": node.outputs.component_out_path} pipeline = register_both_output() - pipeline.outputs.pipeine_a_output.name = 'p1_output' - pipeline.outputs.pipeine_a_output.version = 'v1' + pipeline.outputs.pipeine_a_output.name = "p1_output" + pipeline.outputs.pipeine_a_output.version = "v1" pipeline.settings.default_compute = "cpu-cluster" pipeline_job = client.jobs.create_or_update(pipeline) client.jobs.stream(pipeline_job.name) @@ -2714,6 +2808,10 @@ def check_name_version_and_register_succeed(output, output_name, output_version) assert output.version == output_version assert client.data.get(name=output_name, version=output_version) - check_name_version_and_register_succeed(pipeline_job.outputs.pipeine_a_output, 'p1_output', 'v1') - check_name_version_and_register_succeed(pipeline_job.jobs['node_2'].outputs.component_out_path, 'n2_output', 'v1') - check_name_version_and_register_succeed(pipeline_job.jobs['sub_node'].outputs.sub_pipeine_a_output, 'sub_pipeline', 'v1') + check_name_version_and_register_succeed(pipeline_job.outputs.pipeine_a_output, "p1_output", "v1") + check_name_version_and_register_succeed( + pipeline_job.jobs["node_2"].outputs.component_out_path, "n2_output", "v1" + ) + check_name_version_and_register_succeed( + pipeline_job.jobs["sub_node"].outputs.sub_pipeine_a_output, "sub_pipeline", "v1" + ) diff --git a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_on_registry.py b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_on_registry.py index 4f97e2616578..e4947a8a97aa 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_on_registry.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_on_registry.py @@ -30,7 +30,7 @@ def score_pipeline(model_input, test_data): class TestDSLPipelineOnRegistry(AzureRecordedTestCase): test_data = Input( type=AssetTypes.URI_FILE, - path="./tests/test_configs/pipeline_jobs/job_with_registry_model_as_input/data/sample1.csv" + path="./tests/test_configs/pipeline_jobs/job_with_registry_model_as_input/data/sample1.csv", ) def test_pipeline_job_create_with_registered_component_on_registry(self, pipelines_registry_client: MLClient): @@ -86,9 +86,7 @@ def test_pipeline_with_registry_component_and_model_as_input( ): # load_component score_component_name, component_version = "score_component", "2" - score_func = pipelines_registry_client.components.get( - name=score_component_name, version=component_version - ) + score_func = pipelines_registry_client.components.get(name=score_component_name, version=component_version) pipeline_score_model = Input( type="mlflow_model", path="azureml://registries/sdk-test/models/iris_model/versions/1" diff --git a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_samples.py b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_samples.py index 5d4f7322c1fe..69488ead6425 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_samples.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_samples.py @@ -332,21 +332,28 @@ def test_spark_job_with_multiple_node_in_pipeline(self, client: MLClient) -> Non assert_job_cancel(pipeline, client) @pytest.mark.e2etest - def test_spark_job_with_builder_in_pipeline_without_entry(self, client: MLClient,) -> None: + def test_spark_job_with_builder_in_pipeline_without_entry( + self, + client: MLClient, + ) -> None: from test_configs.dsl_pipeline.spark_job_in_pipeline.invalid_pipeline import ( generate_dsl_pipeline_from_builder_without_entry as spark_job_in_pipeline, ) + pipeline = spark_job_in_pipeline() with pytest.raises(Exception) as ex: created_job = client.jobs.create_or_update(pipeline) - assert '{\n "result": "Failed",\n "errors": [\n {\n "message": "Missing data for required field.",' \ - '\n "path": "jobs.add_greeting_column.component.entry",\n "value": null\n }\n ]\n}' == str(ex.value) - + assert ( + '{\n "result": "Failed",\n "errors": [\n {\n "message": "Missing data for required field.",' + '\n "path": "jobs.add_greeting_column.component.entry",\n "value": null\n }\n ]\n}' + == str(ex.value) + ) + validation_result = client.jobs.validate(pipeline) assert validation_result.passed is False assert validation_result.error_messages == { - "jobs.add_greeting_column.component.entry": 'Missing data for required field.', + "jobs.add_greeting_column.component.entry": "Missing data for required field.", } @pytest.mark.skipif(condition=is_live(), reason="need worskspace with datafactory compute") @@ -365,6 +372,7 @@ def test_data_transfer_copy_2urifolder_job_with_builder_in_pipeline(self, client from test_configs.dsl_pipeline.data_transfer_job_in_pipeline.copy_data.pipeline import ( generate_dsl_pipeline_from_builder as data_transfer_job_in_pipeline, ) + pipeline = data_transfer_job_in_pipeline() assert_job_cancel(pipeline, client) diff --git a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_with_specific_nodes.py b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_with_specific_nodes.py index 35f82e4d9a8e..bd96388f43e1 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_with_specific_nodes.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_dsl_pipeline_with_specific_nodes.py @@ -10,8 +10,12 @@ from pytest_mock import MockFixture from azure.ai.ml.operations._operation_orchestrator import OperationOrchestrator -from test_utilities.utils import _PYTEST_TIMEOUT_METHOD, assert_job_cancel, submit_and_cancel_new_dsl_pipeline, \ - omit_with_wildcard +from test_utilities.utils import ( + _PYTEST_TIMEOUT_METHOD, + assert_job_cancel, + submit_and_cancel_new_dsl_pipeline, + omit_with_wildcard, +) from azure.ai.ml import ( Input, @@ -79,15 +83,20 @@ def pipeline_leaf(component_in_path: Input): component_func1 = load_component(source=path) component_func1(component_in_path=component_in_path, component_in_number=1) - component_func2 = load_component(source=path, params_override=[{ - "name": "another_component_name", - "version": "another_component_version", - }]) + component_func2 = load_component( + source=path, + params_override=[ + { + "name": "another_component_name", + "version": "another_component_version", + } + ], + ) component_func2(component_in_path=component_in_path, component_in_number=1) - component_func3 = load_component(source=path, params_override=[{ - "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:2" - }]) + component_func3 = load_component( + source=path, params_override=[{"environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:2"}] + ) component_func3(component_in_path=component_in_path, component_in_number=1) component_func4 = load_component(source=path) @@ -103,6 +112,7 @@ def pipeline_mid(job_in_path: Input): def pipeline_root(job_in_path: Input): pipeline_mid(job_in_path) pipeline_mid(job_in_path) + return pipeline_root @staticmethod @@ -221,9 +231,7 @@ def test_dsl_pipeline_component_cache_in_resolver(self, client: MLClient) -> Non pipeline_root = self._generate_multi_layer_pipeline_func() _submit_and_cancel = partial( - submit_and_cancel_new_dsl_pipeline, - client=client, - job_in_path=Input(path=input_data_path) + submit_and_cancel_new_dsl_pipeline, client=client, job_in_path=Input(path=input_data_path) ) def _mock_get_component_arm_id(_component: Component) -> str: @@ -236,18 +244,14 @@ def _mock_get_component_arm_id(_component: Component) -> str: return _component.id with mock.patch.object( - OperationOrchestrator, - "_get_component_arm_id", - side_effect=_mock_get_component_arm_id + OperationOrchestrator, "_get_component_arm_id", side_effect=_mock_get_component_arm_id ) as mock_resolve: _submit_and_cancel(pipeline_root) # pipeline_leaf, pipeline_mid and 3 command components will be resolved assert mock_resolve.call_count == 5 with mock.patch.object( - OperationOrchestrator, - "_get_component_arm_id", - side_effect=_mock_get_component_arm_id + OperationOrchestrator, "_get_component_arm_id", side_effect=_mock_get_component_arm_id ) as mock_resolve: _submit_and_cancel(pipeline_root) # no more requests to resolve components as local cache is hit @@ -258,9 +262,7 @@ def _mock_get_component_arm_id(_component: Component) -> str: leaf_subgraph = pipeline_job.jobs["pipeline_mid"].component.jobs["pipeline_leaf"].component leaf_subgraph.jobs["another_component_name"].component.command += " & echo updated2" with mock.patch.object( - OperationOrchestrator, - "_get_component_arm_id", - side_effect=_mock_get_component_arm_id + OperationOrchestrator, "_get_component_arm_id", side_effect=_mock_get_component_arm_id ) as mock_resolve: assert_job_cancel(pipeline_job, client) # updated command component and its parents (pipeline_leaf and pipeline_mid) will be resolved @@ -293,11 +295,11 @@ def test_dsl_pipeline_concurrent_component_registration(self, client: MLClient, # TODO: test with multiple pipelines after server-side return jobs for pipeline component for _ in range(0, 0): assert omit_with_wildcard(base._to_dict(), *omit_fields) == omit_with_wildcard( - treat._to_dict(), *omit_fields) + treat._to_dict(), *omit_fields + ) base = _get_component_in_first_child(base, client) treat = _get_component_in_first_child(treat, client) # The last layer contains the command components omit_fields.pop() - assert omit_with_wildcard(base._to_dict(), *omit_fields) == omit_with_wildcard( - treat._to_dict(), *omit_fields) + assert omit_with_wildcard(base._to_dict(), *omit_fields) == omit_with_wildcard(treat._to_dict(), *omit_fields) diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_command_builder.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_command_builder.py index d784c531ed83..972e580c8cee 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_command_builder.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_command_builder.py @@ -20,7 +20,13 @@ from azure.ai.ml.dsl import pipeline from azure.ai.ml.entities import CommandJobLimits, JobResourceConfiguration from azure.ai.ml.entities._builders import Command -from azure.ai.ml.entities._job.job_service import JobService, JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService +from azure.ai.ml.entities._job.job_service import ( + JobService, + JupyterLabJobService, + SshJobService, + TensorBoardJobService, + VsCodeJobService, +) from azure.ai.ml.entities._job.pipeline._component_translatable import ComponentTranslatableMixin from azure.ai.ml.exceptions import JobException, ValidationException @@ -744,9 +750,9 @@ def test_executor_instances_is_mandatory_when_dynamic_allocation_disabled(self): ) node._to_rest_object() assert ( - ve.message - == "spark.driver.cores, spark.driver.memory, spark.executor.cores, spark.executor.memory and " - "spark.executor.instances are mandatory fields." + ve.message + == "spark.driver.cores, spark.driver.memory, spark.executor.cores, spark.executor.memory and " + "spark.executor.instances are mandatory fields." ) def test_executor_instances_is_specified_as_min_executor_if_unset(self): @@ -921,9 +927,7 @@ def test_command_services(self) -> None: def test_command_services_subtypes(self) -> None: services = { "my_ssh": SshJobService(), - "my_tensorboard": TensorBoardJobService( - log_dir="~/tblog" - ), + "my_tensorboard": TensorBoardJobService(log_dir="~/tblog"), "my_jupyterlab": JupyterLabJobService(), "my_vscode": VsCodeJobService(), } @@ -936,7 +940,7 @@ def test_command_services_subtypes(self) -> None: }, }, "my_jupyterlab": {"job_service_type": "JupyterLab"}, - "my_vscode": { "job_service_type": "VSCode"}, + "my_vscode": {"job_service_type": "VSCode"}, } node = command( name="interactive-command-job", @@ -953,7 +957,6 @@ def test_command_services_subtypes(self) -> None: assert isinstance(node_services.get("my_jupyterlab"), JupyterLabJobService) assert isinstance(node_services.get("my_vscode"), VsCodeJobService) - command_job_services = node._to_job().services assert isinstance(command_job_services.get("my_ssh"), SshJobService) assert isinstance(command_job_services.get("my_tensorboard"), TensorBoardJobService) @@ -1023,15 +1026,17 @@ def my_pipeline(): def test_set_identity(self, test_command): from azure.ai.ml.entities._credentials import AmlTokenConfiguration + node1 = test_command() node2 = node1() node2.identity = AmlTokenConfiguration() node3 = node1() - node3.identity = {'type': 'AMLToken'} + node3.identity = {"type": "AMLToken"} assert node2.identity == node3.identity def test_sweep_set_search_space(self, test_command): from azure.ai.ml.entities._job.sweep.search_space import Choice + node1 = test_command() command_node_to_sweep_1 = node1() sweep_node_1 = command_node_to_sweep_1.sweep( @@ -1039,7 +1044,7 @@ def test_sweep_set_search_space(self, test_command): goal="maximize", sampling_algorithm="random", ) - sweep_node_1.search_space = {'batch_size': {'type': 'choice', 'values': [25, 35]}} + sweep_node_1.search_space = {"batch_size": {"type": "choice", "values": [25, 35]}} command_node_to_sweep_2 = node1() sweep_node_2 = command_node_to_sweep_2.sweep( @@ -1047,13 +1052,15 @@ def test_sweep_set_search_space(self, test_command): goal="maximize", sampling_algorithm="random", ) - sweep_node_2.search_space = {'batch_size': Choice(values=[25, 35])} + sweep_node_2.search_space = {"batch_size": Choice(values=[25, 35])} assert sweep_node_1.search_space == sweep_node_2.search_space def test_unsupported_positional_args(self, test_command): with pytest.raises(ValidationException) as e: test_command(1) - msg = "Component function doesn't support positional arguments, got (1,) " \ - "for my_job. Please use keyword arguments like: " \ - "component_func(float=xxx, integer=xxx, string=xxx, boolean=xxx, uri_folder=xxx, uri_file=xxx)." + msg = ( + "Component function doesn't support positional arguments, got (1,) " + "for my_job. Please use keyword arguments like: " + "component_func(float=xxx, integer=xxx, string=xxx, boolean=xxx, uri_folder=xxx, uri_file=xxx)." + ) assert msg in str(e.value) diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_component_func.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_component_func.py index d6e8c9f90e12..277888516ec0 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_component_func.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_component_func.py @@ -69,9 +69,7 @@ def test_generate_component_function(self) -> None: # hint user when component func don't take any parameters. with pytest.raises(ValidationException) as error_info: new_func(10) - assert ( - "Component function doesn't has any parameters" - ) in str(error_info.value) + assert ("Component function doesn't has any parameters") in str(error_info.value) def test_required_component_inputs_missing(self): component_func = load_component(source="./tests/test_configs/components/helloworld_component.yml") @@ -183,9 +181,8 @@ def test_component_outputs(self): # non-existent output with pytest.raises( - UnexpectedAttributeError, - match="Got an unexpected attribute 'component_out_path_non', " - "valid attributes: 'component_out_path'." + UnexpectedAttributeError, + match="Got an unexpected attribute 'component_out_path_non', " "valid attributes: 'component_out_path'.", ): component.outputs["component_out_path_non"].path = test_output_path @@ -196,7 +193,9 @@ def test_component_outputs(self): assert component._build_outputs() == {"component_out_path": output_data} # set output via output binding - component.outputs.component_out_path._data = PipelineOutput(port_name="pipeline_output", owner="pipeline", meta=None) + component.outputs.component_out_path._data = PipelineOutput( + port_name="pipeline_output", owner="pipeline", meta=None + ) assert component._build_outputs() == { "component_out_path": Output(path="${{parent.outputs.pipeline_output}}", type="uri_folder", mode=None) } diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_controlflow_pipeline.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_controlflow_pipeline.py index a624b8a464f2..8fa267fdc4da 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_controlflow_pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_controlflow_pipeline.py @@ -12,7 +12,7 @@ @pytest.mark.usefixtures( "enable_pipeline_private_preview_features", "enable_private_preview_schema_features", - "enable_private_preview_pipeline_node_types" + "enable_private_preview_pipeline_node_types", ) @pytest.mark.timeout(_DSL_TIMEOUT_SECOND) @pytest.mark.unittest @@ -29,7 +29,8 @@ class TestParallelForPipelineUT(TestControlFlowPipelineUT): def test_dsl_parallel_for_pipeline_illegal_cases(self): # body unsupported parallel_component = load_component( - source="./tests/test_configs/dsl_pipeline/parallel_component_with_file_input/score.yml") + source="./tests/test_configs/dsl_pipeline/parallel_component_with_file_input/score.yml" + ) basic_component = load_component( source="./tests/test_configs/components/component_with_conditional_output/spec.yaml" @@ -40,19 +41,15 @@ def invalid_pipeline(test_path1, test_path2): body = parallel_component() parallel_for( body=body, - items=[ - {"job_data_path": test_path1}, - {"job_data_path": test_path2} - ], + items=[{"job_data_path": test_path1}, {"job_data_path": test_path2}], ) with pytest.raises(ValidationException) as e: - invalid_pipeline( - test_path1=Input(path="test_path1"), - test_path2=Input(path="test_path2") - ) - assert "Expecting (, " \ - ") for body" in str(e.value) + invalid_pipeline(test_path1=Input(path="test_path1"), test_path2=Input(path="test_path2")) + assert ( + "Expecting (, " + ") for body" in str(e.value) + ) # items with invalid type @@ -73,64 +70,58 @@ def invalid_pipeline(): "items, error_message", [ ( - # items with invalid content type - {"a": 1}, - "but got for 1.", + # items with invalid content type + {"a": 1}, + "but got for 1.", ), ( - # items with empty dict as content - [], - "Items is an empty list/dict" - + # items with empty dict as content + [], + "Items is an empty list/dict", ), ( - # item meta not match - [ - {"component_in_path": "test_path1"}, - {"component_in_path": "test_path2", "component_in_number": 1} - ], - "Items should have same keys with body inputs, but got " + # item meta not match + [{"component_in_path": "test_path1"}, {"component_in_path": "test_path2", "component_in_number": 1}], + "Items should have same keys with body inputs, but got ", ), ( - # item inputs not exist in body - [ - {"job_data_path": "test_path1"}, - ], - "Item {\'job_data_path\': \'test_path1\'} got unmatched inputs " + # item inputs not exist in body + [ + {"job_data_path": "test_path1"}, + ], + "Item {'job_data_path': 'test_path1'} got unmatched inputs ", ), ( - # invalid JSON string items - '[{"component_in_number": 1}, {}]', - "Items should have same keys with body inputs" + # invalid JSON string items + '[{"component_in_number": 1}, {}]', + "Items should have same keys with body inputs", ), ( - # unsupported item value type - [ - {"component_in_number": CustomizedObject()}, - ], - "Unsupported type" + # unsupported item value type + [ + {"component_in_number": CustomizedObject()}, + ], + "Unsupported type", ), ( - # local file input - [{"component_in_path": Input(path="./tests/test_configs/components/helloworld_component.yml")}], - "Local file input" + # local file input + [{"component_in_path": Input(path="./tests/test_configs/components/helloworld_component.yml")}], + "Local file input", ), ( - # empty path - [{"component_in_path": Input(path=None)}], - "Input path not provided" + # empty path + [{"component_in_path": Input(path=None)}], + "Input path not provided", ), ( - # dict Input - [{"component_in_path": {"job_input_path": "azureml://path/to/file"}}], - "Unsupported type" + # dict Input + [{"component_in_path": {"job_input_path": "azureml://path/to/file"}}], + "Unsupported type", ), ], ) def test_dsl_parallel_for_pipeline_illegal_items_content(self, items, error_message): - basic_component = load_component( - source="./tests/test_configs/components/helloworld_component.yml" - ) + basic_component = load_component(source="./tests/test_configs/components/helloworld_component.yml") @pipeline def invalid_pipeline(): @@ -153,9 +144,7 @@ def invalid_pipeline(): ), ) def test_dsl_parallel_for_pipeline_legal_items_content(self, items): - basic_component = load_component( - source="./tests/test_configs/components/helloworld_component.yml" - ) + basic_component = load_component(source="./tests/test_configs/components/helloworld_component.yml") @pipeline def valid_pipeline(): @@ -170,12 +159,8 @@ def valid_pipeline(): def test_dsl_parallel_for_pipeline_items(self): # TODO: submit those pipelines - basic_component = load_component( - source="./tests/test_configs/components/helloworld_component.yml" - ) - complex_component = load_component( - source="./tests/test_configs/components/input_types_component.yml" - ) + basic_component = load_component(source="./tests/test_configs/components/helloworld_component.yml") + complex_component = load_component(source="./tests/test_configs/components/input_types_component.yml") # binding in items @@ -184,32 +169,22 @@ def my_pipeline(test_path1, test_path2): body = basic_component() parallel_for( body=body, - items=[ - {"component_in_path": test_path1}, - {"component_in_path": test_path2} - ], + items=[{"component_in_path": test_path1}, {"component_in_path": test_path2}], ) - my_job = my_pipeline( - test_path1=Input(path="test_path1"), - test_path2=Input(path="test_path2") - ) + my_job = my_pipeline(test_path1=Input(path="test_path1"), test_path2=Input(path="test_path2")) rest_job = my_job._to_rest_object().as_dict() rest_items = rest_job["properties"]["jobs"]["parallelfor"]["items"] - assert rest_items == '[{"component_in_path": "${{parent.inputs.test_path1}}"}, ' \ - '{"component_in_path": "${{parent.inputs.test_path2}}"}]' + assert ( + rest_items == '[{"component_in_path": "${{parent.inputs.test_path1}}"}, ' + '{"component_in_path": "${{parent.inputs.test_path2}}"}]' + ) # dict items @pipeline def my_pipeline(): body = basic_component(component_in_path=Input(path="test_path1")) - parallel_for( - body=body, - items={ - "iter1": {"component_in_number": 1}, - "iter2": {"component_in_number": 2} - } - ) + parallel_for(body=body, items={"iter1": {"component_in_number": 1}, "iter2": {"component_in_number": 2}}) my_job = my_pipeline() rest_job = my_job._to_rest_object().as_dict() @@ -220,10 +195,7 @@ def my_pipeline(): @pipeline def my_pipeline(pipeline_input: str): body = basic_component(component_in_path=Input(path="test_path1")) - parallel_for( - body=body, - items=pipeline_input - ) + parallel_for(body=body, items=pipeline_input) my_job = my_pipeline(pipeline_input='[{"component_in_number": 1}, {"component_in_number": 2}]') rest_job = my_job._to_rest_object().as_dict() @@ -234,10 +206,7 @@ def my_pipeline(pipeline_input: str): @pipeline def my_pipeline(): body = basic_component(component_in_path=Input(path="test_path1")) - parallel_for( - body=body, - items='[{"component_in_number": 1}, {"component_in_number": 2}]' - ) + parallel_for(body=body, items='[{"component_in_number": 1}, {"component_in_number": 2}]') my_job = my_pipeline() rest_job = my_job._to_rest_object().as_dict() @@ -256,25 +225,25 @@ def my_pipeline(): component_in_ranged_integer=10, component_in_enum="world", component_in_boolean=True, - component_in_ranged_number=5.5), - ] + component_in_ranged_number=5.5, + ), + ], ) my_job = my_pipeline() rest_job = my_job._to_rest_object().as_dict() rest_items = rest_job["properties"]["jobs"]["parallelfor"]["items"] - assert rest_items == '[{"component_in_string": "component_in_string", ' \ - '"component_in_ranged_integer": 10, "component_in_enum": "world", ' \ - '"component_in_boolean": true, "component_in_ranged_number": 5.5}]' + assert ( + rest_items == '[{"component_in_string": "component_in_string", ' + '"component_in_ranged_integer": 10, "component_in_enum": "world", ' + '"component_in_boolean": true, "component_in_ranged_number": 5.5}]' + ) # JSON string items @pipeline def my_pipeline(): body = basic_component(component_in_path=Input(path="test_path1")) - parallel_for( - body=body, - items='[{"component_in_number": 1}, {"component_in_number": 2}]' - ) + parallel_for(body=body, items='[{"component_in_number": 1}, {"component_in_number": 2}]') my_job = my_pipeline() rest_job = my_job._to_rest_object().as_dict() @@ -284,25 +253,23 @@ def my_pipeline(): @pytest.mark.parametrize( "output_dict, pipeline_out_dict, component_out_dict, check_pipeline_job", [ - ({"type": "uri_file"}, {'job_output_type': 'mltable'}, {'type': 'mltable'}, True), - ({"type": "uri_folder"}, {'job_output_type': 'mltable'}, {'type': 'mltable'}, True), - ({"type": "mltable"}, {'job_output_type': 'mltable'}, {'type': 'mltable'}, True), - ({"type": "mlflow_model"}, {'job_output_type': 'mltable'}, {'type': 'mltable'}, True), - ({"type": "triton_model"}, {'job_output_type': 'mltable'}, {'type': 'mltable'}, True), - ({"type": "custom_model"}, {'job_output_type': 'mltable'}, {'type': 'mltable'}, True), - ({"type": "path"}, {'job_output_type': 'mltable'}, {'type': 'mltable'}, True), - ({"type": "number"}, {}, {'type': 'string'}, False), - ({"type": "string", "is_control": True}, {}, {'type': 'string', "is_control": True}, False), - ({"type": "boolean", "is_control": True}, {}, {'type': 'string', "is_control": True}, False), - ({"type": "integer"}, {}, {'type': 'string'}, False), - ] + ({"type": "uri_file"}, {"job_output_type": "mltable"}, {"type": "mltable"}, True), + ({"type": "uri_folder"}, {"job_output_type": "mltable"}, {"type": "mltable"}, True), + ({"type": "mltable"}, {"job_output_type": "mltable"}, {"type": "mltable"}, True), + ({"type": "mlflow_model"}, {"job_output_type": "mltable"}, {"type": "mltable"}, True), + ({"type": "triton_model"}, {"job_output_type": "mltable"}, {"type": "mltable"}, True), + ({"type": "custom_model"}, {"job_output_type": "mltable"}, {"type": "mltable"}, True), + ({"type": "path"}, {"job_output_type": "mltable"}, {"type": "mltable"}, True), + ({"type": "number"}, {}, {"type": "string"}, False), + ({"type": "string", "is_control": True}, {}, {"type": "string", "is_control": True}, False), + ({"type": "boolean", "is_control": True}, {}, {"type": "string", "is_control": True}, False), + ({"type": "integer"}, {}, {"type": "string"}, False), + ], ) def test_parallel_for_outputs(self, output_dict, pipeline_out_dict, component_out_dict, check_pipeline_job): basic_component = load_component( source="./tests/test_configs/components/helloworld_component.yml", - params_override=[ - {"outputs.component_out_path": output_dict} - ] + params_override=[{"outputs.component_out_path": output_dict}], ) @pipeline @@ -310,26 +277,20 @@ def my_pipeline(): body = basic_component(component_in_path=Input(path="test_path1")) foreach_node = parallel_for( - body=body, - items={ - "iter1": {"component_in_number": 1}, - "iter2": {"component_in_number": 2} - } + body=body, items={"iter1": {"component_in_number": 1}, "iter2": {"component_in_number": 2}} ) - return { - "output": foreach_node.outputs.component_out_path - } + return {"output": foreach_node.outputs.component_out_path} my_job = my_pipeline() if check_pipeline_job: rest_job = my_job._to_rest_object().as_dict() rest_outputs = rest_job["properties"]["outputs"] - assert rest_outputs == {'output': pipeline_out_dict} + assert rest_outputs == {"output": pipeline_out_dict} pipeline_component = my_job.component rest_component = pipeline_component._to_rest_object().as_dict() - assert rest_component["properties"]["component_spec"]["outputs"] == {'output': component_out_dict} + assert rest_component["properties"]["component_spec"]["outputs"] == {"output": component_out_dict} def test_parallel_for_source(self): basic_component = load_component( @@ -341,11 +302,7 @@ def my_pipeline(): body = basic_component(component_in_path=Input(path="test_path1")) foreach_node = parallel_for( - body=body, - items={ - "iter1": {"component_in_number": 1}, - "iter2": {"component_in_number": 2} - } + body=body, items={"iter1": {"component_in_number": 1}, "iter2": {"component_in_number": 2}} ) my_job = my_pipeline() diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_group.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_group.py index 726b646308a9..18831f266f50 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_group.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_group.py @@ -16,10 +16,7 @@ from .._util import _DSL_TIMEOUT_SECOND -@pytest.mark.usefixtures( - "enable_pipeline_private_preview_features", - "enable_private_preview_schema_features" -) +@pytest.mark.usefixtures("enable_pipeline_private_preview_features", "enable_private_preview_schema_features") @pytest.mark.timeout(_DSL_TIMEOUT_SECOND) @pytest.mark.unittest @pytest.mark.pipeline_test @@ -80,9 +77,8 @@ class MixedGroup: sys.stdout = stdout_str_IO = StringIO() help(MixedGroup.__init__) assert ( - "__init__(self,*,int_param:int=None,str_param:str=None,enum_param:str=None," - "str_default_param:str='test',optional_int_param:int=5)->None" in stdout_str_IO.getvalue().replace(" ", - "") + "__init__(self,*,int_param:int=None,str_param:str=None,enum_param:str=None," + "str_default_param:str='test',optional_int_param:int=5)->None" in stdout_str_IO.getvalue().replace(" ", "") ) sys.stdout = original_out @@ -91,8 +87,8 @@ class MixedGroup: int_param=1, str_param="test-str", enum_param=EnumOps.Option1, str_default_param="op2", optional_int_param=4 ) assert ( - "MixedGroup(int_param=1,str_param='test-str',enum_param=," - "str_default_param='op2',optional_int_param=4)".replace(" ", "") in var.__repr__().replace(" ", "") + "MixedGroup(int_param=1,str_param='test-str',enum_param=," + "str_default_param='op2',optional_int_param=4)".replace(" ", "") in var.__repr__().replace(" ", "") ) # __set_attribute__ func test @@ -131,6 +127,7 @@ class SubGroup: param: int = 1 with pytest.raises(ValueError) as e: + @group class ItemGroup: group_param: SubGroup = "str" @@ -156,6 +153,7 @@ class Group: param: Input(type="uri_folder") with pytest.raises(UserErrorException) as e: + @pipeline def my_pipeline(param: Group): pass @@ -167,18 +165,22 @@ class Group: param: Output with pytest.raises(UserErrorException) as e: + @pipeline def my_pipeline(param: Group): pass + assert "Output annotation cannot be used in @pipeline." in str(e.value) class CustomizedObj: pass with pytest.raises(UserErrorException) as e: + @group class Group: param: CustomizedObj + assert "Unsupported annotation type" in str(e.value) def test_group_inherit(self): @@ -342,8 +344,8 @@ def str_param_pipeline(str_param, group: ParamClass): pipeline_job.inputs.str_param = ParamClass() # Note: this is the expected behavior. assert ( - pipeline_job._to_dict()["inputs"]["str_param"] - == "TestDSLGroup.test_assign_group_invalid..ParamClass(str_param='string_by_default')" + pipeline_job._to_dict()["inputs"]["str_param"] + == "TestDSLGroup.test_assign_group_invalid..ParamClass(str_param='string_by_default')" ) pipeline_job.inputs.str_param = "test" @@ -360,9 +362,11 @@ class PortOutputs: output2: Output(type="uri_folder") with pytest.raises(UserErrorException) as e: + @pipeline def my_pipeline(my_inputs: PortOutputs): pass + assert "Output annotation cannot be used in @pipeline." in str(e.value) @group @@ -373,9 +377,11 @@ class PrimitiveOutputs: output4: Output(type="boolean", is_control=True) with pytest.raises(UserErrorException) as e: + @pipeline def my_pipeline(my_inputs: PrimitiveOutputs): pass + assert "Output annotation cannot be used in @pipeline." in str(e.value) def test_group_port_inputs(self): @@ -407,14 +413,14 @@ class MixedGroup: sys.stdout = stdout_str_IO = StringIO() help(MixedGroup.__init__) assert ( - "__init__(self,*," - "int_param:int=None," - "str_default_param:str='test'," - "str_param:str=None," - "input_folder:{'type':'uri_folder'}=None," - "optional_int_param:int=5," - "output_folder:{'type':'uri_folder'}=None)" - "->None" in stdout_str_IO.getvalue().replace(" ", "") + "__init__(self,*," + "int_param:int=None," + "str_default_param:str='test'," + "str_param:str=None," + "input_folder:{'type':'uri_folder'}=None," + "optional_int_param:int=5," + "output_folder:{'type':'uri_folder'}=None)" + "->None" in stdout_str_IO.getvalue().replace(" ", "") ) sys.stdout = original_out @@ -423,13 +429,13 @@ class MixedGroup: int_param=1, str_param="test-str", input_folder=Input(path="input"), output_folder=Output(path="output") ) assert ( - "MixedGroup(" - "int_param=1," - "str_default_param='test'," - "str_param='test-str'," - "input_folder={'type':'uri_folder','path':'input'}," - "optional_int_param=5," - "output_folder={'type':'uri_folder','path':'output'})" in var.__repr__().replace(" ", "") + "MixedGroup(" + "int_param=1," + "str_default_param='test'," + "str_param='test-str'," + "input_folder={'type':'uri_folder','path':'input'}," + "optional_int_param=5," + "output_folder={'type':'uri_folder','path':'output'})" in var.__repr__().replace(" ", "") ) # __set_attribute__ func test @@ -439,17 +445,21 @@ class MixedGroup: def test_group_port_defaults(self): # input with pytest.raises(UserErrorException) as e: + @group class SubGroup: int_param0: Input int_param1: Input = Input(path="in1") + assert "Default value of Input 'int_param1' cannot be set" in str(e.value) with pytest.raises(UserErrorException) as e: + @group class SubGroup: out_param0: Output out_param1: Output = Output(path="out2") + assert "Default value of Output 'out_param1' cannot be set" in str(e.value) @pytest.mark.skip(reason="Input group item .result() is not supported currently.") @@ -478,14 +488,9 @@ def pipeline_with_group(group: ParamClass, int_param: int): component_in_path=group.str_param.result(), component_in_number=int_param.result() ) - return { - "output1": node1.outputs.component_out_path, - "output2": node2.outputs.component_out_path - } + return {"output1": node1.outputs.component_out_path, "output2": node2.outputs.component_out_path} - pipeline_job1 = pipeline_with_group( - group=ParamClass(str_param="str_1"), int_param=1 - ) + pipeline_job1 = pipeline_with_group(group=ParamClass(str_param="str_1"), int_param=1) common_omit_fields = [ "jobs.*.componentId", @@ -493,18 +498,18 @@ def pipeline_with_group(group: ParamClass, int_param: int): "jobs.*.properties", ] - rest_pipeline_job = omit_with_wildcard(pipeline_job1._to_rest_object().properties.as_dict(), - *common_omit_fields) + rest_pipeline_job = omit_with_wildcard( + pipeline_job1._to_rest_object().properties.as_dict(), *common_omit_fields + ) expected_pipeline_job1 = {} assert rest_pipeline_job == expected_pipeline_job1 - pipeline_job2 = pipeline_with_group( - group=ParamClass(str_param="str_2"), int_param=1 - ) + pipeline_job2 = pipeline_with_group(group=ParamClass(str_param="str_2"), int_param=1) - rest_pipeline_job = omit_with_wildcard(pipeline_job2._to_rest_object().properties.as_dict(), - *common_omit_fields) + rest_pipeline_job = omit_with_wildcard( + pipeline_job2._to_rest_object().properties.as_dict(), *common_omit_fields + ) expected_pipeline_job2 = {} assert rest_pipeline_job == expected_pipeline_job2 @@ -521,10 +526,7 @@ class PortOutputs: def my_pipeline_dict_return() -> PortOutputs: node1 = hello_world_component_func(component_in_number=1, component_in_path=Input(path="/a/path/on/ds")) node2 = hello_world_component_func(component_in_number=1, component_in_path=Input(path="/a/path/on/ds")) - return { - "output1": node1.outputs.component_out_path, - "output2": node2.outputs.component_out_path - } + return {"output1": node1.outputs.component_out_path, "output2": node2.outputs.component_out_path} pipeline_job1 = my_pipeline_dict_return() @@ -569,7 +571,7 @@ def pipeline_type_mismatch() -> SinglePortOutput: with pytest.raises(UserErrorException) as e: pipeline_type_mismatch() - assert "{\'type\': \'uri_folder\'} != annotation output {\'type\': \'mltable\'}" in str(e.value) + assert "{'type': 'uri_folder'} != annotation output {'type': 'mltable'}" in str(e.value) basic_component = load_component( source="./tests/test_configs/components/component_with_conditional_output/spec.yaml" @@ -595,7 +597,7 @@ def pipeline_is_control_mismatch() -> PrimitiveOutputs1: with pytest.raises(UserErrorException) as e: pipeline_is_control_mismatch() - assert "{\'type\': \'boolean\', 'is_control': True} != annotation output" in str(e.value) + assert "{'type': 'boolean', 'is_control': True} != annotation output" in str(e.value) def test_group_outputs_unsupported_annotation(self): @group @@ -611,18 +613,22 @@ class ParentOutputs: hello_world_component_func = load_component(source=hello_world_component_yaml) with pytest.raises(UserErrorException) as e: + @pipeline def my_pipeline() -> ParentOutputs: node1 = hello_world_component_func(component_in_number=1) return { "output1": node1.outputs.component_out_path, } + assert "Nested group annotation is not supported in pipeline output." in str(e.value) with pytest.raises(UserErrorException) as e: + @group class GroupOutputs: output1: PipelineInput + assert "Unsupported annotation type" in str(e.value) def test_input_in_output_group(self): @@ -641,5 +647,4 @@ def my_pipeline() -> Outputs: ) pipeline_job = my_pipeline() - assert pipeline_job._to_dict()["outputs"] == {'output1': {'type': 'uri_folder'}} - + assert pipeline_job._to_dict()["outputs"] == {"output1": {"type": "uri_folder"}} diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline.py index a73acfa978c0..f1b121acff90 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline.py @@ -54,10 +54,7 @@ components_dir = tests_root_dir / "test_configs/components/" -@pytest.mark.usefixtures( - "enable_pipeline_private_preview_features", - "enable_private_preview_schema_features" -) +@pytest.mark.usefixtures("enable_pipeline_private_preview_features", "enable_private_preview_schema_features") @pytest.mark.timeout(_DSL_TIMEOUT_SECOND) @pytest.mark.unittest @pytest.mark.pipeline_test @@ -230,18 +227,15 @@ def pipeline(number, path): "component_in_path": Input(path="${{parent.inputs.path}}", type="uri_folder", mode=None), } - @pytest.mark.parametrize( - "output_type", - ["uri_file", "mltable", "mlflow_model", "triton_model", "custom_model"] - ) + @pytest.mark.parametrize("output_type", ["uri_file", "mltable", "mlflow_model", "triton_model", "custom_model"]) def test_dsl_pipeline_output_type(self, output_type): yaml_file = "./tests/test_configs/components/helloworld_component.yml" @dsl.pipeline() def pipeline(number, path): - component_func = load_component(source=yaml_file, params_override=[ - {"outputs.component_out_path.type": output_type} - ]) + component_func = load_component( + source=yaml_file, params_override=[{"outputs.component_out_path.type": output_type}] + ) node1 = component_func(component_in_number=number, component_in_path=path) return {"pipeline_output": node1.outputs.component_out_path} @@ -254,21 +248,21 @@ def test_dsl_pipeline_complex_input_output(self) -> None: @dsl.pipeline() def pipeline( - job_in_data_name_version_def_mode, - job_in_data_name_version_mode_mount, - job_in_data_name_version_mode_download, - job_in_data_by_name, - job_in_data_by_armid, - job_in_data_by_store_path, - job_in_data_by_path_default_store, - job_in_data_by_store_path_and_mount, - job_in_data_by_store_path_and_download, - job_in_data_by_blob_dir, - job_in_data_by_blob_file, - job_in_data_local_dir, - job_in_data_local_file, - job_in_data_local_yaml_definition, - job_in_data_uri, + job_in_data_name_version_def_mode, + job_in_data_name_version_mode_mount, + job_in_data_name_version_mode_download, + job_in_data_by_name, + job_in_data_by_armid, + job_in_data_by_store_path, + job_in_data_by_path_default_store, + job_in_data_by_store_path_and_mount, + job_in_data_by_store_path_and_download, + job_in_data_by_blob_dir, + job_in_data_by_blob_file, + job_in_data_local_dir, + job_in_data_local_file, + job_in_data_local_yaml_definition, + job_in_data_uri, ): component_func = load_component(source=yaml_file) multiple_data_component = component_func( @@ -782,8 +776,8 @@ def pipeline(component_in_number, component_in_path): with pytest.raises(UserErrorException) as ex: pipeline(10, test_job_input) assert ( - "Pipeline input expected an azure.ai.ml.Input or primitive types (str, bool, int or float), but got type ." - in ex.__str__() + "Pipeline input expected an azure.ai.ml.Input or primitive types (str, bool, int or float), but got type ." + in ex.__str__() ) def test_dsl_pipeline_multi_times(self): @@ -818,8 +812,8 @@ def mock_add_to_builder(component): _add_component_to_current_definition_builder(component) with mock.patch( - "azure.ai.ml.dsl._pipeline_component_builder._add_component_to_current_definition_builder", - side_effect=mock_add_to_builder, + "azure.ai.ml.dsl._pipeline_component_builder._add_component_to_current_definition_builder", + side_effect=mock_add_to_builder, ) as mocker: # DSL yaml_file = "./tests/test_configs/components/helloworld_component.yml" @@ -923,12 +917,12 @@ def mock_from_rest(*args, **kwargs): component_names = set() with mock.patch( - "azure.ai.ml.operations._operation_orchestrator.OperationOrchestrator.get_asset_arm_id", - side_effect=mock_arm_id, + "azure.ai.ml.operations._operation_orchestrator.OperationOrchestrator.get_asset_arm_id", + side_effect=mock_arm_id, ): with mock.patch( - "azure.ai.ml._restclient.v2022_10_01.operations.ComponentVersionsOperations.create_or_update", - side_effect=mock_create, + "azure.ai.ml._restclient.v2022_10_01.operations.ComponentVersionsOperations.create_or_update", + side_effect=mock_create, ): with mock.patch.object(Component, "_from_rest_object", side_effect=mock_from_rest): for _, job in pipeline.jobs.items(): @@ -1099,56 +1093,56 @@ def pipeline(number, path): with patch("sys.stdout", new=StringIO()) as std_out: print(pipeline1) assert ( - "display_name: pipeline\ntype: pipeline\ninputs:\n number: 10\n path:\n type: uri_folder" - in std_out.getvalue() + "display_name: pipeline\ntype: pipeline\ninputs:\n number: 10\n path:\n type: uri_folder" + in std_out.getvalue() ) @pytest.mark.parametrize( "target_yml, target_dsl_pipeline", [ ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/input_basic.yml", - data_binding_expression.input_basic(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/input_basic.yml", + data_binding_expression.input_basic(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/input_literal_cross_type.yml", - data_binding_expression.input_literal_cross_type(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/input_literal_cross_type.yml", + data_binding_expression.input_literal_cross_type(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/input_literal_meta.yml", - data_binding_expression.input_literal_meta(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/input_literal_meta.yml", + data_binding_expression.input_literal_meta(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/input_path_concatenate.yml", - data_binding_expression.input_path_concatenate(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/input_path_concatenate.yml", + data_binding_expression.input_path_concatenate(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/input_reason_expression.yml", - data_binding_expression.input_reason_expression(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/input_reason_expression.yml", + data_binding_expression.input_reason_expression(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/input_string_concatenate.yml", - data_binding_expression.input_string_concatenate(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/input_string_concatenate.yml", + data_binding_expression.input_string_concatenate(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_compute.yml", - data_binding_expression.run_settings_compute(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_compute.yml", + data_binding_expression.run_settings_compute(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/input_path.yml", - data_binding_expression.input_path(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/input_path.yml", + data_binding_expression.input_path(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_sweep_choice.yml", - data_binding_expression.run_settings_sweep_choice(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_sweep_choice.yml", + data_binding_expression.run_settings_sweep_choice(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_sweep_limits.yml", - data_binding_expression.run_settings_sweep_limits(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_sweep_limits.yml", + data_binding_expression.run_settings_sweep_limits(), ), ( - "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_sweep_literal.yml", - data_binding_expression.run_settings_sweep_literal(), + "./tests/test_configs/dsl_pipeline/data_binding_expression/run_settings_sweep_literal.yml", + data_binding_expression.run_settings_sweep_literal(), ), ], ) @@ -1360,7 +1354,7 @@ def test_dsl_pipeline_with_only_setting_binding_node(self) -> None: }, } }, - "outputs": {"trained_model": {"job_output_type": "uri_folder"}}, + "outputs": {"trained_model": {"job_output_type": "uri_folder", "mode": "Upload"}}, "settings": {}, } } @@ -1515,7 +1509,7 @@ def root_pipeline(component_in_number: int, component_in_path: str): "type": "pipeline", }, }, - 'outputs': {'sub_pipeline_out': {'type': 'uri_folder'}} + "outputs": {"sub_pipeline_out": {"type": "uri_folder"}}, } actual_dict = pipeline._to_dict() actual_dict = pydash.omit(actual_dict, *omit_fields) @@ -1704,9 +1698,9 @@ def concatenation_in_pipeline(str_param: str): pipeline = concatenation_in_pipeline(str_param="string value") for node_name, expected_value in ( - ("microsoft_samples_echo_string", "${{parent.inputs.str_param}} right"), - ("microsoft_samples_echo_string_1", "left ${{parent.inputs.str_param}}"), - ("microsoft_samples_echo_string_2", "${{parent.inputs.str_param}}${{parent.inputs.str_param}}"), + ("microsoft_samples_echo_string", "${{parent.inputs.str_param}} right"), + ("microsoft_samples_echo_string_1", "left ${{parent.inputs.str_param}}"), + ("microsoft_samples_echo_string_2", "${{parent.inputs.str_param}}${{parent.inputs.str_param}}"), ): assert pipeline.jobs[node_name].inputs.component_in_string._data == expected_value @@ -1787,7 +1781,7 @@ def root_pipeline(component_in_number: int, component_in_path: str): "type": "pipeline", }, }, - 'outputs': {'sub_pipeline_out': {'type': 'uri_folder'}} + "outputs": {"sub_pipeline_out": {"type": "uri_folder"}}, } actual_dict = pydash.omit(pipeline._to_dict(), *omit_fields) assert actual_dict == expected_root_dict @@ -1863,7 +1857,7 @@ def root_pipeline(component_in_number: int, component_in_path: str): "type": "pipeline", }, }, - 'outputs': {'sub_pipeline_out': {'type': 'uri_folder'}} + "outputs": {"sub_pipeline_out": {"type": "uri_folder"}}, } actual_dict = pydash.omit( pipeline._to_dict(), @@ -1935,50 +1929,47 @@ def test_pipeline_node_identity_with_component(self): @dsl.pipeline def pipeline_func(component_in_path): - node1 = component_func( - component_in_number=1, component_in_path=component_in_path - ) + node1 = component_func(component_in_number=1, component_in_path=component_in_path) node1.identity = AmlTokenConfiguration() - node2 = component_func( - component_in_number=1, component_in_path=component_in_path - ) + node2 = component_func(component_in_number=1, component_in_path=component_in_path) node2.identity = UserIdentityConfiguration() - node3 = component_func( - component_in_number=1, component_in_path=component_in_path - ) + node3 = component_func(component_in_number=1, component_in_path=component_in_path) node3.identity = ManagedIdentityConfiguration() pipeline = pipeline_func(component_in_path=Data(name="test", version="1", type=AssetTypes.MLTABLE)) - omit_fields = [ - "jobs.*.componentId", - "jobs.*._source" - ] + omit_fields = ["jobs.*.componentId", "jobs.*._source"] actual_dict = omit_with_wildcard(pipeline._to_rest_object().as_dict()["properties"], *omit_fields) assert actual_dict["jobs"] == { - 'node1': {'identity': {'type': 'aml_token'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path}}'}}, - 'name': 'node1', - 'type': 'command'}, - 'node2': {'identity': {'type': 'user_identity'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path}}'}}, - 'name': 'node2', - 'type': 'command'}, - 'node3': {'identity': {'type': 'managed_identity'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path}}'}}, - 'name': 'node3', - 'type': 'command'} + "node1": { + "identity": {"type": "aml_token"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + }, + "name": "node1", + "type": "command", + }, + "node2": { + "identity": {"type": "user_identity"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + }, + "name": "node2", + "type": "command", + }, + "node3": { + "identity": {"type": "managed_identity"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + }, + "name": "node3", + "type": "command", + }, } def test_pipeline_with_non_pipeline_inputs(self): @@ -1986,10 +1977,17 @@ def test_pipeline_with_non_pipeline_inputs(self): component_func1 = load_component(source=component_yaml, params_override=[{"name": "component_name_1"}]) component_func2 = load_component(source=component_yaml, params_override=[{"name": "component_name_2"}]) - @dsl.pipeline(non_pipeline_inputs=["other_params", "is_add_component", - "param_with_annotation", "param_with_default"]) - def pipeline_func(job_in_number, job_in_path, other_params, is_add_component, - param_with_annotation: Dict[str, str], param_with_default: int = 1): + @dsl.pipeline( + non_pipeline_inputs=["other_params", "is_add_component", "param_with_annotation", "param_with_default"] + ) + def pipeline_func( + job_in_number, + job_in_path, + other_params, + is_add_component, + param_with_annotation: Dict[str, str], + param_with_default: int = 1, + ): assert param_with_default == 1 assert param_with_annotation == {"mock": "dict"} component_func1(component_in_number=job_in_number, component_in_path=job_in_path) @@ -2017,7 +2015,6 @@ def pipeline_func(job_in_number, job_in_path, other_params, is_add_component): assert len(pipeline.jobs) == 3 def test_pipeline_with_invalid_non_pipeline_inputs(self): - @dsl.pipeline(non_pipeline_inputs=[123]) def pipeline_func(): pass @@ -2032,7 +2029,10 @@ def pipeline_func(): with pytest.raises(ParamValueNotExistsError) as error_info: pipeline_func() - assert "pipeline_func() got unexpected params in non_pipeline_inputs ['non_exist_param1', 'non_exist_param2']" in str(error_info) + assert ( + "pipeline_func() got unexpected params in non_pipeline_inputs ['non_exist_param1', 'non_exist_param2']" + in str(error_info) + ) def test_component_func_as_non_pipeline_inputs(self): component_yaml = components_dir / "helloworld_component.yml" @@ -2045,9 +2045,8 @@ def pipeline_func(job_in_number, job_in_path, component_func): component_func(component_in_number=job_in_number, component_in_path=job_in_path) pipeline = pipeline_func( - job_in_number=10, - job_in_path=Input(path="/a/path/on/ds"), - component_func=component_func2) + job_in_number=10, job_in_path=Input(path="/a/path/on/ds"), component_func=component_func2 + ) assert len(pipeline.jobs) == 2 assert component_func2.name in pipeline.jobs @@ -2058,8 +2057,9 @@ def test_pipeline_with_variable_inputs(self): @dsl.pipeline def pipeline_with_variable_args(**kwargs): - node_kwargs = component_func1(component_in_number=kwargs["component_in_number1"], - component_in_path=kwargs["component_in_path1"]) + node_kwargs = component_func1( + component_in_number=kwargs["component_in_number1"], component_in_path=kwargs["component_in_path1"] + ) @dsl.pipeline def root_pipeline(component_in_number: int, component_in_path: Input, **kwargs): @@ -2076,21 +2076,19 @@ def root_pipeline(component_in_number: int, component_in_path: Input, **kwargs): args_0: args_0 description """ node = component_func1(component_in_number=component_in_number, component_in_path=component_in_path) - node_kwargs = component_func1(component_in_number=kwargs["component_in_number1"], - component_in_path=kwargs["component_in_path1"]) + node_kwargs = component_func1( + component_in_number=kwargs["component_in_number1"], component_in_path=kwargs["component_in_path1"] + ) node_with_arg_kwarg = pipeline_with_variable_args(**kwargs) pipeline = root_pipeline(10, data, component_in_number1=12, component_in_path1=data) - assert pipeline.component.inputs['component_in_number'].description == "component_in_number description" - assert pipeline.component.inputs['component_in_path'].description == "component_in_path description" - assert pipeline.component.inputs['component_in_number1'].description == "component_in_number1 description" - assert pipeline.component.inputs['component_in_path1'].description == "component_in_path1 description" + assert pipeline.component.inputs["component_in_number"].description == "component_in_number description" + assert pipeline.component.inputs["component_in_path"].description == "component_in_path description" + assert pipeline.component.inputs["component_in_number1"].description == "component_in_number1 description" + assert pipeline.component.inputs["component_in_path1"].description == "component_in_path1 description" - omit_fields = [ - "jobs.*.componentId", - "jobs.*._source" - ] + omit_fields = ["jobs.*.componentId", "jobs.*._source"] actual_dict = omit_with_wildcard(pipeline._to_rest_object().as_dict()["properties"], *omit_fields) assert actual_dict["inputs"] == { @@ -2100,50 +2098,51 @@ def root_pipeline(component_in_number: int, component_in_path: Input, **kwargs): "component_in_path1": {"uri": "test:1", "job_input_type": "mltable"}, } assert actual_dict["jobs"] == { - 'node': { - 'name': 'node', 'type': 'command', 'inputs': { - 'component_in_number': { - 'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_number}}' + "node": { + "name": "node", + "type": "command", + "inputs": { + "component_in_number": { + "job_input_type": "literal", + "value": "${{parent.inputs.component_in_number}}", }, - 'component_in_path': { - 'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path}}' - } - } + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"}, + }, }, - 'node_kwargs': { - 'name': 'node_kwargs', - 'type': 'command', - 'inputs': { - 'component_in_number': { - 'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_number1}}' + "node_kwargs": { + "name": "node_kwargs", + "type": "command", + "inputs": { + "component_in_number": { + "job_input_type": "literal", + "value": "${{parent.inputs.component_in_number1}}", }, - 'component_in_path': { - 'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path1}}' - } - } + "component_in_path": { + "job_input_type": "literal", + "value": "${{parent.inputs.component_in_path1}}", + }, + }, }, - 'node_with_arg_kwarg': { - 'name': 'node_with_arg_kwarg', - 'type': 'pipeline', - 'inputs': { - 'component_in_number1': { - 'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_number1}}' + "node_with_arg_kwarg": { + "name": "node_with_arg_kwarg", + "type": "pipeline", + "inputs": { + "component_in_number1": { + "job_input_type": "literal", + "value": "${{parent.inputs.component_in_number1}}", }, - 'component_in_path1': { - 'job_input_type': 'literal', - 'value': '${{parent.inputs.component_in_path1}}' - } - } - } + "component_in_path1": { + "job_input_type": "literal", + "value": "${{parent.inputs.component_in_path1}}", + }, + }, + }, } - with pytest.raises(UnsupportedParameterKindError, - match="dsl pipeline does not accept \*custorm_args as parameters\."): + with pytest.raises( + UnsupportedParameterKindError, match="dsl pipeline does not accept \*custorm_args as parameters\." + ): + @dsl.pipeline def pipeline_with_variable_args(*custorm_args): pass @@ -2151,18 +2150,19 @@ def pipeline_with_variable_args(*custorm_args): pipeline_with_variable_args(1, 2, 3) with mock.patch("azure.ai.ml.dsl._pipeline_decorator.is_private_preview_enabled", return_value=False): - with pytest.raises(UnsupportedParameterKindError, - match="dsl pipeline does not accept \*args or \*\*kwargs as parameters\."): + with pytest.raises( + UnsupportedParameterKindError, match="dsl pipeline does not accept \*args or \*\*kwargs as parameters\." + ): root_pipeline(10, data, 11, data, component_in_number1=11, component_in_path1=data) def test_pipeline_with_dumplicate_variable_inputs(self): - @dsl.pipeline def pipeline_with_variable_args(key_1: int, **kargs): pass - with pytest.raises(MultipleValueError, - match="pipeline_with_variable_args\(\) got multiple values for argument 'key_1'\."): + with pytest.raises( + MultipleValueError, match="pipeline_with_variable_args\(\) got multiple values for argument 'key_1'\." + ): pipeline_with_variable_args(10, key_1=10) def test_pipeline_with_output_binding_in_dynamic_args(self): @@ -2199,7 +2199,7 @@ def pipeline_func_consume_expression(int_param: int): pipeline_job = pipeline_func_consume_expression(int_param=1) assert pipeline_job.jobs["control_node"]._to_rest_object() == { - '_source': 'DSL', + "_source": "DSL", "type": "if_else", "condition": "${{parent.jobs.expression_component.outputs.output}}", "true_block": "${{parent.jobs.node1}}", @@ -2326,9 +2326,7 @@ def spark_pipeline_from_yaml(iris_data): } def test_dsl_pipeline_with_data_transfer_copy_node(self) -> None: - merge_files = load_component( - "./tests/test_configs/components/data_transfer/copy_files.yaml" - ) + merge_files = load_component("./tests/test_configs/components/data_transfer/copy_files.yaml") @dsl.pipeline(description="submit a pipeline with data transfer copy job") def data_transfer_copy_pipeline_from_yaml(folder1): @@ -2353,38 +2351,42 @@ def data_transfer_copy_pipeline_from_yaml(folder1): data_transfer_copy_node_dict_from_rest = regenerated_data_transfer_copy_node._to_dict() omit_fields = [] - assert pydash.omit(data_transfer_copy_node_dict, *omit_fields) == pydash.omit(data_transfer_copy_node_dict_from_rest, *omit_fields) + assert pydash.omit(data_transfer_copy_node_dict, *omit_fields) == pydash.omit( + data_transfer_copy_node_dict_from_rest, *omit_fields + ) omit_fields = [ "jobs.copy_files_node.componentId", ] actual_job = pydash.omit(dsl_pipeline._to_rest_object().properties.as_dict(), *omit_fields) assert actual_job == { - 'description': 'submit a pipeline with data transfer copy job', - 'display_name': 'data_transfer_copy_pipeline_from_yaml', - 'inputs': {'folder1': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'copy_files_node': {'_source': 'YAML.COMPONENT', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.folder1}}'}}, - 'name': 'copy_files_node', - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.output}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer'}}, - 'outputs': {'output': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/my_blob/paths/merged_blob'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {} + "description": "submit a pipeline with data transfer copy job", + "display_name": "data_transfer_copy_pipeline_from_yaml", + "inputs": { + "folder1": {"job_input_type": "uri_folder", "uri": "azureml://datastores/my_cosmos/paths/source_cosmos"} + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "copy_files_node": { + "_source": "YAML.COMPONENT", + "data_copy_mode": "merge_with_overwrite", + "inputs": {"folder1": {"job_input_type": "literal", "value": "${{parent.inputs.folder1}}"}}, + "name": "copy_files_node", + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.output}}"}}, + "task": "copy_data", + "type": "data_transfer", + } + }, + "outputs": { + "output": {"job_output_type": "uri_folder", "uri": "azureml://datastores/my_blob/paths/merged_blob"} + }, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, } def test_dsl_pipeline_with_data_transfer_merge_node(self) -> None: - merge_files = load_component( - "./tests/test_configs/components/data_transfer/merge_files.yaml" - ) + merge_files = load_component("./tests/test_configs/components/data_transfer/merge_files.yaml") @dsl.pipeline(description="submit a pipeline with data transfer copy job") def data_transfer_copy_pipeline_from_yaml(folder1, folder2): @@ -2413,36 +2415,48 @@ def data_transfer_copy_pipeline_from_yaml(folder1, folder2): data_transfer_copy_node_dict_from_rest = regenerated_data_transfer_copy_node._to_dict() omit_fields = [] - assert pydash.omit(data_transfer_copy_node_dict, *omit_fields) == pydash.omit(data_transfer_copy_node_dict_from_rest, *omit_fields) + assert pydash.omit(data_transfer_copy_node_dict, *omit_fields) == pydash.omit( + data_transfer_copy_node_dict_from_rest, *omit_fields + ) omit_fields = [ "jobs.merge_files_node.componentId", ] actual_job = pydash.omit(dsl_pipeline._to_rest_object().properties.as_dict(), *omit_fields) assert actual_job == { - 'description': 'submit a pipeline with data transfer copy job', - 'display_name': 'data_transfer_copy_pipeline_from_yaml', - 'inputs': {'folder1': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}, - 'folder2': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'merge_files_node': {'_source': 'YAML.COMPONENT', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.folder1}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.folder2}}'}}, - 'name': 'merge_files_node', - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.output}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer'}}, - 'outputs': {'output': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/my_blob/paths/merged_blob'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {} + "description": "submit a pipeline with data transfer copy job", + "display_name": "data_transfer_copy_pipeline_from_yaml", + "inputs": { + "folder1": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + "folder2": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "merge_files_node": { + "_source": "YAML.COMPONENT", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.folder1}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.folder2}}"}, + }, + "name": "merge_files_node", + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.output}}"}}, + "task": "copy_data", + "type": "data_transfer", + } + }, + "outputs": { + "output": {"job_output_type": "uri_folder", "uri": "azureml://datastores/my_blob/paths/merged_blob"} + }, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, } def test_node_sweep_with_optional_input(self) -> None: @@ -2488,8 +2502,7 @@ def pipeline_func(required_input: int, optional_input: int = 2): pipeline_job.settings.default_compute = "cpu-cluster" validate_result = pipeline_job._validate() assert validate_result.error_messages == { - 'inputs.required_input': "Required input 'required_input' for pipeline " - "'pipeline_func' not provided." + "inputs.required_input": "Required input 'required_input' for pipeline " "'pipeline_func' not provided." } validate_result = pipeline_job.component._validate() @@ -2497,8 +2510,8 @@ def pipeline_func(required_input: int, optional_input: int = 2): # pipeline component has required inputs assert pipeline_job.component._to_dict()["inputs"] == { - 'optional_input': {'default': '2', 'optional': True, 'type': 'integer'}, - 'required_input': {'type': 'integer'} + "optional_input": {"default": "2", "optional": True, "type": "integer"}, + "required_input": {"type": "integer"}, } # setting _validate_required_input_not_provided to False will skip the unprovided input check @@ -2532,8 +2545,10 @@ def pipeline_func(optional_input: Input(optional=True, type="uri_file")): # optional pipeline parameter binding to optional node parameter @dsl.pipeline() - def pipeline_func(optional_param: Input(optional=True, type="string"), - optional_param_duplicate: Input(optional=True, type="string")): + def pipeline_func( + optional_param: Input(optional=True, type="string"), + optional_param_duplicate: Input(optional=True, type="string"), + ): component_func( required_input=Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv"), required_param="def", @@ -2562,14 +2577,15 @@ def pipeline_func(required_input: Input(optional=False, type="uri_file")): pipeline_job.settings.default_compute = "cpu-cluster" validate_result = pipeline_job._validate() assert validate_result.error_messages == { - 'inputs.required_input': "Required input 'required_input' for pipeline " - "'pipeline_func' not provided." + "inputs.required_input": "Required input 'required_input' for pipeline " "'pipeline_func' not provided." } # required pipeline parameter binding to optional node parameter @dsl.pipeline() - def pipeline_func(required_param: Input(optional=False, type="string"), - required_param_duplicate: Input(optional=False, type="string")): + def pipeline_func( + required_param: Input(optional=False, type="string"), + required_param_duplicate: Input(optional=False, type="string"), + ): component_func( required_input=Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv"), required_param="def", @@ -2581,10 +2597,9 @@ def pipeline_func(required_param: Input(optional=False, type="string"), pipeline_job.settings.default_compute = "cpu-cluster" validate_result = pipeline_job._validate() assert validate_result.error_messages == { - 'inputs.required_param': "Required input 'required_param' for pipeline " - "'pipeline_func' not provided.", - 'inputs.required_param_duplicate': "Required input 'required_param_duplicate' for pipeline " - "'pipeline_func' not provided." + "inputs.required_param": "Required input 'required_param' for pipeline " "'pipeline_func' not provided.", + "inputs.required_param_duplicate": "Required input 'required_param_duplicate' for pipeline " + "'pipeline_func' not provided.", } # required pipeline parameter with default value binding to optional node parameter @@ -2616,8 +2631,7 @@ def subgraph_pipeline(optional_input: Input(optional=True, type="uri_file")): @dsl.pipeline() def root_pipeline(): - subgraph_node = subgraph_pipeline( - ) + subgraph_node = subgraph_pipeline() pipeline_job = root_pipeline() pipeline_job.settings.default_compute = "cpu-cluster" @@ -2626,8 +2640,10 @@ def root_pipeline(): # optional pipeline parameter binding to optional node parameter @dsl.pipeline() - def subgraph_pipeline(optional_parameter: Input(optional=True, type="string"), - optional_parameter_duplicate: Input(optional=True, type="string")): + def subgraph_pipeline( + optional_parameter: Input(optional=True, type="string"), + optional_parameter_duplicate: Input(optional=True, type="string"), + ): component_func( required_input=Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv"), required_param="def", @@ -2637,8 +2653,7 @@ def subgraph_pipeline(optional_parameter: Input(optional=True, type="string"), @dsl.pipeline() def root_pipeline(): - subgraph_node = subgraph_pipeline( - ) + subgraph_node = subgraph_pipeline() pipeline_job = root_pipeline() pipeline_job.settings.default_compute = "cpu-cluster" @@ -2654,33 +2669,30 @@ def subgraph_pipeline(required_input: Input(optional=False, type="uri_file")): component_func( required_input=Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv"), required_param="def", - optional_input=required_input + optional_input=required_input, ) @dsl.pipeline() def root_pipeline(): - subgraph_node = subgraph_pipeline( - ) + subgraph_node = subgraph_pipeline() pipeline_job = root_pipeline() pipeline_job.settings.default_compute = "cpu-cluster" validate_result = pipeline_job._validate() assert validate_result.error_messages == { - 'jobs.subgraph_node.inputs.required_input': "Required input 'required_input' for component 'subgraph_node'" - " not provided." + "jobs.subgraph_node.inputs.required_input": "Required input 'required_input' for component 'subgraph_node'" + " not provided." } @dsl.pipeline() def root_pipeline(required_input: Input(optional=False, type="uri_file")): - subgraph_node = subgraph_pipeline( - required_input=required_input - ) + subgraph_node = subgraph_pipeline(required_input=required_input) pipeline_job = root_pipeline() pipeline_job.settings.default_compute = "cpu-cluster" validate_result = pipeline_job._validate() assert validate_result.error_messages == { - 'inputs.required_input': "Required input 'required_input' for pipeline 'root_pipeline' not provided." + "inputs.required_input": "Required input 'required_input' for pipeline 'root_pipeline' not provided." } # required pipeline parameter binding to optional node parameter @@ -2689,20 +2701,19 @@ def subgraph_pipeline(required_parameter: Input(optional=False, type="string")): component_func( required_input=Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv"), required_param="def", - optional_param=required_parameter + optional_param=required_parameter, ) @dsl.pipeline() def root_pipeline(): - subgraph_node = subgraph_pipeline( - ) + subgraph_node = subgraph_pipeline() pipeline_job = root_pipeline() pipeline_job.settings.default_compute = "cpu-cluster" validate_result = pipeline_job._validate() assert validate_result.error_messages == { - 'jobs.subgraph_node.inputs.required_parameter': "Required input 'required_parameter' for component " - "'subgraph_node' not provided." + "jobs.subgraph_node.inputs.required_parameter": "Required input 'required_parameter' for component " + "'subgraph_node' not provided." } # required pipeline parameter with default value binding to optional node parameter @@ -2711,13 +2722,12 @@ def subgraph_pipeline(required_parameter: Input(optional=False, type="string", d component_func( required_input=Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv"), required_param="def", - optional_param=required_parameter + optional_param=required_parameter, ) @dsl.pipeline() def root_pipeline(): - subgraph_node = subgraph_pipeline( - ) + subgraph_node = subgraph_pipeline() pipeline_job = root_pipeline() pipeline_job.settings.default_compute = "cpu-cluster" @@ -2734,9 +2744,9 @@ def my_pipeline() -> Output(type="uri_folder", description="new description", mo return {"output": node.outputs.component_out_path} pipeline_job = my_pipeline() - expected_outputs = {'output': { - 'description': 'new description', 'job_output_type': 'uri_folder', 'mode': 'Upload' - }} + expected_outputs = { + "output": {"description": "new description", "job_output_type": "uri_folder", "mode": "Upload"} + } assert pipeline_job._to_rest_object().as_dict()["properties"]["outputs"] == expected_outputs def test_dsl_pipeline_run_settings(self) -> None: @@ -2757,30 +2767,28 @@ def my_pipeline() -> Output(type="uri_folder", description="new description", mo PipelineConstants.DEFAULT_COMPUTE: "cpu-cluster", PipelineConstants.CONTINUE_ON_STEP_FAILURE: True, PipelineConstants.CONTINUE_RUN_ON_FAILED_OPTIONAL_INPUT: False, - "_source": "DSL" + "_source": "DSL", } def test_register_output_without_name_sdk(self): component = load_component(source="./tests/test_configs/components/helloworld_component.yml") - component_input = Input(type='uri_file', path='https://dprepdata.blob.core.windows.net/demo/Titanic.csv') + component_input = Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv") @dsl.pipeline() def register_node_output(): node = component(component_in_path=component_input) node.outputs.component_out_path.version = 1 - + pipeline = register_node_output() pipeline.settings.default_compute = "azureml:cpu-cluster" - with pytest.raises(UserErrorException) as e: + with pytest.raises(UserErrorException) as e: pipeline._validate() assert "Output name is required when output version is specified." in str(e.value) @dsl.pipeline() def register_pipeline_output(): node = component(component_in_path=component_input) - return { - 'pipeine_a_output': node.outputs.component_out_path - } + return {"pipeine_a_output": node.outputs.component_out_path} pipeline = register_pipeline_output() pipeline.outputs.pipeine_a_output.version = 1 @@ -2791,19 +2799,167 @@ def register_pipeline_output(): def test_register_output_with_invalid_name_sdk(self): component = load_component(source="./tests/test_configs/components/helloworld_component.yml") - component_input = Input(type='uri_file', path='https://dprepdata.blob.core.windows.net/demo/Titanic.csv') + component_input = Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv") @dsl.pipeline() def register_node_output(): node = component(component_in_path=component_input) - node.outputs.component_out_path.name = '@' - node.outputs.component_out_path.version = '1' + node.outputs.component_out_path.name = "@" + node.outputs.component_out_path.version = "1" pipeline = register_node_output() pipeline.settings.default_compute = "azureml:cpu-cluster" with pytest.raises(UserErrorException) as e: pipeline._validate() - assert 'The output name @ can only contain alphanumeric characters, dashes and underscores, with a limit of 255 characters.' in str(e.value) + assert ( + "The output name @ can only contain alphanumeric characters, dashes and underscores, with a limit of 255 characters." + in str(e.value) + ) + + def test_pipeline_output_settings_copy(self): + component_yaml = components_dir / "helloworld_component.yml" + component_func1 = load_component(source=component_yaml) + + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + node1.outputs.component_out_path.path = "path1" + return node1.outputs + + pipeline_job1 = my_pipeline() + pipeline_job2 = my_pipeline() + + pipeline_job1.outputs.component_out_path.path = "new_path" + + # modified pipeline output setting won't affect pipeline component or other nodes. + assert pipeline_job1.outputs.component_out_path.path == "new_path" + assert pipeline_job1.component.outputs["component_out_path"].path == "path1" + assert pipeline_job2.outputs.component_out_path.path == "path1" + assert pipeline_job2.component.outputs["component_out_path"].path == "path1" + + # newly create pipeline job instance won't be affected + pipeline_job3 = my_pipeline() + assert pipeline_job3.outputs.component_out_path.path == "path1" + assert pipeline_job3.component.outputs["component_out_path"].path == "path1" + + def test_node_path_promotion(self): + component_yaml = components_dir / "helloworld_component.yml" + component_func1 = load_component(source=component_yaml) + + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + node1.outputs.component_out_path = Output( + # the following settings will be copied to pipeline level + path="path", + ) + return node1.outputs + + pipeline_job1 = my_pipeline() + assert pipeline_job1.outputs.component_out_path.path == "path" + + @dsl.pipeline() + def outer_pipeline(): + node1 = my_pipeline() + assert node1.outputs.component_out_path.path == "path" + node1.outputs.component_out_path.path = "new_path" + assert node1.outputs.component_out_path.path == "new_path" + return node1.outputs + + pipeline_job2 = outer_pipeline() + assert pipeline_job2.outputs.component_out_path.path == "new_path" + + def test_node_output_type_promotion(self): + component_yaml = components_dir / "helloworld_component.yml" + params_override = [{"outputs": {"component_out_path": {"type": "uri_file"}}}] + component_func1 = load_component(source=component_yaml, params_override=params_override) + + # without node level setting, node should have same type with component + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + assert node1.outputs.component_out_path.type == "uri_file" + return node1.outputs + + pipeline_job1 = my_pipeline() + assert pipeline_job1.outputs.component_out_path.type == "uri_file" + pipeline_dict = pipeline_job1._to_rest_object().as_dict()["properties"] + assert pipeline_dict["outputs"]["component_out_path"]["job_output_type"] == "uri_file" + + # when node level has setting, node should respect the setting + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + assert node1.outputs.component_out_path.type == "uri_file" + node1.outputs.component_out_path.type = "mlflow_model" + assert node1.outputs.component_out_path.type == "mlflow_model" + return node1.outputs + + pipeline_job1 = my_pipeline() + # assert pipeline_job1.outputs.component_out_path.type == "mlflow_model" + pipeline_dict = pipeline_job1._to_rest_object().as_dict()["properties"] + assert pipeline_dict["outputs"]["component_out_path"]["job_output_type"] == "mlflow_model" + + # when pipeline level has setting, node should respect the setting + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + assert node1.outputs.component_out_path.type == "uri_file" + node1.outputs.component_out_path.type = "mlflow_model" + assert node1.outputs.component_out_path.type == "mlflow_model" + return node1.outputs + + pipeline_job1 = my_pipeline() + pipeline_job1.outputs.component_out_path.type = "custom_model" + assert pipeline_job1.outputs.component_out_path.type == "custom_model" + pipeline_dict = pipeline_job1._to_rest_object().as_dict()["properties"] + assert pipeline_dict["outputs"]["component_out_path"]["job_output_type"] == "custom_model" + + def test_node_output_mode_promotion(self): + component_yaml = components_dir / "helloworld_component.yml" + params_override = [{"outputs": {"component_out_path": {"mode": "mount", "type": "uri_file"}}}] + component_func1 = load_component(source=component_yaml, params_override=params_override) + + # without node level setting, node should have same type with component + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + # assert node1.outputs.component_out_path.mode == "mount" + return node1.outputs + + pipeline_job1 = my_pipeline() + # assert pipeline_job1.outputs.component_out_path.mode == "mount" + pipeline_dict = pipeline_job1._to_rest_object().as_dict()["properties"] + assert pipeline_dict["outputs"]["component_out_path"]["mode"] == "ReadWriteMount" + + # when node level has setting, node should respect the setting + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + # assert node1.outputs.component_out_path.mode == "mount" + node1.outputs.component_out_path.mode = "upload" + assert node1.outputs.component_out_path.mode == "upload" + return node1.outputs + + pipeline_job1 = my_pipeline() + # assert pipeline_job1.outputs.component_out_path.mode == "upload" + pipeline_dict = pipeline_job1._to_rest_object().as_dict()["properties"] + assert pipeline_dict["outputs"]["component_out_path"]["mode"] == "Upload" + + # when pipeline level has setting, node should respect the setting + @dsl.pipeline() + def my_pipeline(): + node1 = component_func1(component_in_number=1) + # assert node1.outputs.component_out_path.mode == "mount" + node1.outputs.component_out_path.mode = "upload" + assert node1.outputs.component_out_path.mode == "upload" + return node1.outputs + + pipeline_job1 = my_pipeline() + pipeline_job1.outputs.component_out_path.mode = "direct" + assert pipeline_job1.outputs.component_out_path.mode == "direct" + pipeline_dict = pipeline_job1._to_rest_object().as_dict()["properties"] + assert pipeline_dict["outputs"]["component_out_path"]["mode"] == "Direct" def test_validate_pipeline_node_io_name_has_keyword(self, caplog): # Refresh logger for pytest to capture log, otherwise the result is empty. @@ -2817,7 +2973,7 @@ def test_validate_pipeline_node_io_name_has_keyword(self, caplog): assert pipeline_job._customized_validate().passed warning_template = ( - "Reserved word \"{io_name}\" is used as {io} name in node \"{node_name}\", " + 'Reserved word "{io_name}" is used as {io} name in node "{node_name}", ' "can only be accessed with '{node_name}.{io}s[\"{io_name}\"]'" ) assert caplog.messages == [ diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_component.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_component.py index 08a08c6957cf..49797aabeabd 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_component.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_component.py @@ -10,10 +10,7 @@ components_dir = tests_root_dir / "test_configs/components/" -@pytest.mark.usefixtures( - "enable_pipeline_private_preview_features", - "enable_private_preview_schema_features" -) +@pytest.mark.usefixtures("enable_pipeline_private_preview_features", "enable_private_preview_schema_features") @pytest.mark.timeout(_DSL_TIMEOUT_SECOND) @pytest.mark.unittest @pytest.mark.pipeline_test @@ -39,12 +36,12 @@ def pipeline_func(job_in_path): ) assert not validation_result.passed assert validation_result.error_messages == { - "inputs.component_in_path": 'Parameter type unknown, ' - 'please add type annotation or specify input default value.', + "inputs.component_in_path": "Parameter type unknown, " + "please add type annotation or specify input default value.", } assert mock_machinelearning_client.jobs.validate(pipeline_job).error_messages == { - 'jobs.pipeline_no_arg.inputs.component_in_path': 'Parameter type unknown, please add type annotation' - ' or specify input default value.', - 'jobs.pipeline_no_arg.jobs.microsoftsamples_command_component_basic.compute': 'Compute not set' + "jobs.pipeline_no_arg.inputs.component_in_path": "Parameter type unknown, please add type annotation" + " or specify input default value.", + "jobs.pipeline_no_arg.jobs.microsoftsamples_command_component_basic.compute": "Compute not set", } diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_with_specific_nodes.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_with_specific_nodes.py index 5835934cea7d..82d5ef63646c 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_with_specific_nodes.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline_with_specific_nodes.py @@ -15,8 +15,11 @@ from azure.ai.ml.entities._builders import Command, Parallel, Spark, Sweep, DataTransferImport from azure.ai.ml.entities._component.parallel_component import ParallelComponent from azure.ai.ml.entities._job.automl.tabular import ClassificationJob -from azure.ai.ml.entities._job.data_transfer.data_transfer_job import DataTransferCopyJob, DataTransferImportJob, \ - DataTransferExportJob +from azure.ai.ml.entities._job.data_transfer.data_transfer_job import ( + DataTransferCopyJob, + DataTransferImportJob, + DataTransferExportJob, +) from azure.ai.ml.entities._job.job_service import ( JobService, JupyterLabJobService, @@ -222,17 +225,16 @@ def train_with_sweep_in_pipeline(raw_data): pytorch_node_rest = pytorch_node._to_rest_object() omit_fields = ["trial"] pydash.omit(pytorch_node_rest, *omit_fields) == { - 'limits': {'max_total_trials': 10}, - 'sampling_algorithm': 'random', - 'objective': {'goal': 'maximize', 'primary_metric': 'AUC'}, - 'search_space': {'component_in_number': {'values': [2, 3, 4, 5], 'type': 'choice'}}, - 'name': 'sweep_job', - 'type': 'sweep', - 'computeId': 'test-aks-large', - 'inputs': {'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.raw_data}}'}}, - '_source': 'YAML.COMPONENT', - 'resources': {'instance_type': 'cpularge'}, + "limits": {"max_total_trials": 10}, + "sampling_algorithm": "random", + "objective": {"goal": "maximize", "primary_metric": "AUC"}, + "search_space": {"component_in_number": {"values": [2, 3, 4, 5], "type": "choice"}}, + "name": "sweep_job", + "type": "sweep", + "computeId": "test-aks-large", + "inputs": {"component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.raw_data}}"}}, + "_source": "YAML.COMPONENT", + "resources": {"instance_type": "cpularge"}, } def test_dsl_pipeline_with_parallel(self) -> None: @@ -313,54 +315,63 @@ def spark_pipeline_from_yaml(iris_data): ] actual_job = pydash.omit(dsl_pipeline._to_rest_object().properties.as_dict(), *omit_fields) assert actual_job == { - 'description': 'submit a pipeline with spark job', - 'display_name': 'spark_pipeline_from_yaml', - 'inputs': {'iris_data': {'job_input_type': 'uri_file', - 'mode': 'Direct', - 'uri': 'https://azuremlexamples.blob.core.windows.net/datasets/iris.csv'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'add_greeting_column': {'_source': 'YAML.COMPONENT', - 'args': '--file_input ${{inputs.file_input}}', - 'computeId': 'spark31', - 'conf': {'spark.driver.cores': 2, - 'spark.driver.memory': '1g', - 'spark.executor.cores': 1, - 'spark.executor.instances': 1, - 'spark.executor.memory': '1g'}, - 'entry': {'file': 'add_greeting_column.py', - 'spark_job_entry_type': 'SparkJobPythonEntry'}, - 'files': ['my_files.txt'], - 'identity': {'identity_type': 'Managed'}, - 'inputs': {'file_input': {'job_input_type': 'literal', - 'value': '${{parent.inputs.iris_data}}'}}, - 'name': 'add_greeting_column', - 'py_files': ['utils.zip'], - 'type': 'spark'}, - 'count_by_row': {'_source': 'YAML.COMPONENT', - 'args': '--file_input ${{inputs.file_input}} ' - '--output ${{outputs.output}}', - 'computeId': 'spark31', - 'conf': {'spark.driver.cores': 2, - 'spark.driver.memory': '1g', - 'spark.executor.cores': 1, - 'spark.executor.instances': 1, - 'spark.executor.memory': '1g'}, - 'entry': {'file': 'count_by_row.py', - 'spark_job_entry_type': 'SparkJobPythonEntry'}, - 'files': ['my_files.txt'], - 'identity': {'identity_type': 'Managed'}, - 'inputs': {'file_input': {'job_input_type': 'literal', - 'value': '${{parent.inputs.iris_data}}'}}, - 'jars': ['scalaproj.jar'], - 'name': 'count_by_row', - 'outputs': {'output': {'type': 'literal', - 'value': '${{parent.outputs.output}}'}}, - 'type': 'spark'}}, - 'outputs': {'output': {'job_output_type': 'uri_folder', 'mode': 'Direct'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "description": "submit a pipeline with spark job", + "display_name": "spark_pipeline_from_yaml", + "inputs": { + "iris_data": { + "job_input_type": "uri_file", + "mode": "Direct", + "uri": "https://azuremlexamples.blob.core.windows.net/datasets/iris.csv", + } + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "add_greeting_column": { + "_source": "YAML.COMPONENT", + "args": "--file_input ${{inputs.file_input}}", + "computeId": "spark31", + "conf": { + "spark.driver.cores": 2, + "spark.driver.memory": "1g", + "spark.executor.cores": 1, + "spark.executor.instances": 1, + "spark.executor.memory": "1g", + }, + "entry": {"file": "add_greeting_column.py", "spark_job_entry_type": "SparkJobPythonEntry"}, + "files": ["my_files.txt"], + "identity": {"identity_type": "Managed"}, + "inputs": {"file_input": {"job_input_type": "literal", "value": "${{parent.inputs.iris_data}}"}}, + "name": "add_greeting_column", + "py_files": ["utils.zip"], + "type": "spark", + }, + "count_by_row": { + "_source": "YAML.COMPONENT", + "args": "--file_input ${{inputs.file_input}} " "--output ${{outputs.output}}", + "computeId": "spark31", + "conf": { + "spark.driver.cores": 2, + "spark.driver.memory": "1g", + "spark.executor.cores": 1, + "spark.executor.instances": 1, + "spark.executor.memory": "1g", + }, + "entry": {"file": "count_by_row.py", "spark_job_entry_type": "SparkJobPythonEntry"}, + "files": ["my_files.txt"], + "identity": {"identity_type": "Managed"}, + "inputs": {"file_input": {"job_input_type": "literal", "value": "${{parent.inputs.iris_data}}"}}, + "jars": ["scalaproj.jar"], + "name": "count_by_row", + "outputs": {"output": {"type": "literal", "value": "${{parent.outputs.output}}"}}, + "type": "spark", + }, + }, + "outputs": {"output": {"job_output_type": "uri_folder", "mode": "Direct"}}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } def test_pipeline_with_command_function(self): # component func @@ -425,59 +436,75 @@ def pipeline(number, path): pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'experiment_name': 'test_pipeline_with_command_function', - 'inputs': {'number': {'job_input_type': 'literal', - 'value': '10'}, - 'path': {'job_input_type': 'uri_folder', - 'mode': 'ReadOnlyMount', - 'uri': '/a/path/on/ds'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'YAML.COMPONENT', - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.path}}'}}, - 'name': 'node1', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output1}}'}}, - 'type': 'command'}, - 'node2': {'_source': 'CLASS', - 'distribution': {'distribution_type': 'PyTorch', - 'process_count_per_instance': 2}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node1.outputs.component_out_path}}'}}, - 'name': 'node2', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output2}}'}}, - 'resources': {'instance_count': 2}, - 'type': 'command'}, - 'node3': {'_source': 'BUILDER', - 'display_name': 'my-evaluate-job', - 'distribution': {'distribution_type': 'PyTorch', - 'process_count_per_instance': 2}, - 'environment_variables': {'key': 'val'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node2.outputs.component_out_path}}'}}, - 'name': 'node3', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output3}}'}}, - 'resources': {'instance_count': 2}, - 'type': 'command'}}, - 'outputs': {'pipeline_output1': {'job_output_type': 'uri_folder'}, - 'pipeline_output2': {'job_output_type': 'mlflow_model'}, - 'pipeline_output3': {'job_output_type': 'mlflow_model'}}, - 'properties': {}, - 'settings': {}, - 'tags': {} - } + "properties": { + "display_name": "pipeline", + "experiment_name": "test_pipeline_with_command_function", + "inputs": { + "number": {"job_input_type": "literal", "value": "10"}, + "path": {"job_input_type": "uri_folder", "mode": "ReadOnlyMount", "uri": "/a/path/on/ds"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "YAML.COMPONENT", + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.number}}"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.path}}"}, + }, + "name": "node1", + "outputs": { + "component_out_path": {"type": "literal", "value": "${{parent.outputs.pipeline_output1}}"} + }, + "type": "command", + }, + "node2": { + "_source": "CLASS", + "distribution": {"distribution_type": "PyTorch", "process_count_per_instance": 2}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.number}}"}, + "component_in_path": { + "job_input_type": "literal", + "value": "${{parent.jobs.node1.outputs.component_out_path}}", + }, + }, + "name": "node2", + "outputs": { + "component_out_path": {"type": "literal", "value": "${{parent.outputs.pipeline_output2}}"} + }, + "resources": {"instance_count": 2}, + "type": "command", + }, + "node3": { + "_source": "BUILDER", + "display_name": "my-evaluate-job", + "distribution": {"distribution_type": "PyTorch", "process_count_per_instance": 2}, + "environment_variables": {"key": "val"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.number}}"}, + "component_in_path": { + "job_input_type": "literal", + "value": "${{parent.jobs.node2.outputs.component_out_path}}", + }, + }, + "name": "node3", + "outputs": { + "component_out_path": {"type": "literal", "value": "${{parent.outputs.pipeline_output3}}"} + }, + "resources": {"instance_count": 2}, + "type": "command", + }, + }, + "outputs": { + "pipeline_output1": {"job_output_type": "uri_folder"}, + "pipeline_output2": {"job_output_type": "mlflow_model"}, + "pipeline_output3": {"job_output_type": "mlflow_model", "mode": "ReadWriteMount"}, + }, + "properties": {}, + "settings": {}, + "tags": {}, } + } def test_pipeline_with_data_transfer_copy_function(self): # component func @@ -533,59 +560,84 @@ def pipeline(folder1, folder2): pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'folder1': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}, - 'folder2': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'YAML.COMPONENT', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.folder1}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.folder2}}'}}, - 'name': 'node1', - 'task': 'copy_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'CLASS', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node1.outputs.output_folder}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node1.outputs.output_folder}}'}}, - 'name': 'node2', - 'task': 'copy_data', - 'type': 'data_transfer'}, - 'node3': {'_source': 'BUILDER', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node2.outputs.output}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node2.outputs.output}}'}}, - 'name': 'node3', - 'outputs': {'output': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer'}}, - 'outputs': {'pipeline_output': {'job_output_type': 'uri_folder'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}}} + "properties": { + "display_name": "pipeline", + "inputs": { + "folder1": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + "folder2": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "YAML.COMPONENT", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.folder1}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.folder2}}"}, + }, + "name": "node1", + "task": "copy_data", + "type": "data_transfer", + }, + "node2": { + "_source": "CLASS", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": { + "job_input_type": "literal", + "value": "${{parent.jobs.node1.outputs.output_folder}}", + }, + "folder2": { + "job_input_type": "literal", + "value": "${{parent.jobs.node1.outputs.output_folder}}", + }, + }, + "name": "node2", + "task": "copy_data", + "type": "data_transfer", + }, + "node3": { + "_source": "BUILDER", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.jobs.node2.outputs.output}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.jobs.node2.outputs.output}}"}, + }, + "name": "node3", + "outputs": {"output": {"type": "literal", "value": "${{parent.outputs.pipeline_output}}"}}, + "task": "copy_data", + "type": "data_transfer", + }, + }, + "outputs": { + "pipeline_output": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/my_blob/paths/merged_blob", + } + }, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } + } def test_pipeline_with_data_transfer_import_database_function(self): - query_source_snowflake = 'SELECT * FROM my_table' - connection_target_azuresql = 'azureml:my_azuresql_connection' + query_source_snowflake = "SELECT * FROM my_table" + connection_target_azuresql = "azureml:my_azuresql_connection" outputs = {"sink": Output(type=AssetTypes.MLTABLE)} - source = {'type': 'database', 'connection': 'azureml:my_snowflake_connection', - 'query': query_source_snowflake} + source = {"type": "database", "connection": "azureml:my_snowflake_connection", "query": query_source_snowflake} data_transfer_job = DataTransferImportJob( source=source, outputs=outputs, task=DataTransferTaskType.IMPORT_DATA, - compute='adf_compute1', + compute="adf_compute1", ) data_transfer_job_func = to_component(job=data_transfer_job) @@ -604,56 +656,79 @@ def pipeline(query_source_snowflake, connection_target_azuresql): pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target_azuresql': {'job_input_type': 'literal', - 'value': 'azureml:my_azuresql_connection'}, - 'query_source_snowflake': {'job_input_type': 'literal', - 'value': 'SELECT * FROM ' - 'my_table'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'name': 'node1', - 'source': {'connection': 'azureml:my_snowflake_connection', - 'query': 'SELECT * FROM my_table', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'name': 'node2', - 'outputs': {'sink': {'job_output_type': 'mltable'}}, - 'source': {'connection': 'azureml:my_snowflake_connection', - 'query': 'SELECT * FROM my_table', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node3': {'_source': 'BUILTIN', - 'name': 'node3', - 'source': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'query': '${{parent.inputs.query_source_snowflake}}', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node4': {'_source': 'BUILTIN', - 'name': 'node4', - 'outputs': {'sink': {'job_output_type': 'mltable'}}, - 'source': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'query': '${{parent.inputs.query_source_snowflake}}', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target_azuresql": { + "job_input_type": "literal", + "value": "azureml:my_azuresql_connection", + }, + "query_source_snowflake": {"job_input_type": "literal", "value": "SELECT * FROM " "my_table"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "name": "node1", + "source": { + "connection": "azureml:my_snowflake_connection", + "query": "SELECT * FROM my_table", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "name": "node2", + "outputs": {"sink": {"job_output_type": "mltable"}}, + "source": { + "connection": "azureml:my_snowflake_connection", + "query": "SELECT * FROM my_table", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node3": { + "_source": "BUILTIN", + "name": "node3", + "source": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "query": "${{parent.inputs.query_source_snowflake}}", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node4": { + "_source": "BUILTIN", + "name": "node4", + "outputs": {"sink": {"job_output_type": "mltable"}}, + "source": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "query": "${{parent.inputs.query_source_snowflake}}", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } for key, _ in pipeline1.jobs.items(): data_transfer_import_node = pipeline1.jobs[key] data_transfer_import_node_dict = data_transfer_import_node._to_dict() data_transfer_import_node_rest_obj = data_transfer_import_node._to_rest_object() - regenerated_data_transfer_import_node = DataTransferImport._from_rest_object(data_transfer_import_node_rest_obj) + regenerated_data_transfer_import_node = DataTransferImport._from_rest_object( + data_transfer_import_node_rest_obj + ) data_transfer_import_node_dict_from_rest = regenerated_data_transfer_import_node._to_dict() @@ -661,16 +736,22 @@ def pipeline(query_source_snowflake, connection_target_azuresql): # regenerated_data_transfer_import_node will only keep component id when call _to_rest_object() omit_fields = ["component"] - assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == \ - pydash.omit(data_transfer_import_node_dict_from_rest, *omit_fields) + assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == pydash.omit( + data_transfer_import_node_dict_from_rest, *omit_fields + ) def test_pipeline_with_data_transfer_import_stored_database_function(self): - stored_procedure = 'SelectEmployeeByJobAndDepartment' - stored_procedure_params = [{'name': 'job', 'value': 'Engineer', 'type': 'String'}, - {'name': 'department', 'value': 'Engineering', 'type': 'String'}] + stored_procedure = "SelectEmployeeByJobAndDepartment" + stored_procedure_params = [ + {"name": "job", "value": "Engineer", "type": "String"}, + {"name": "department", "value": "Engineering", "type": "String"}, + ] outputs = {"sink": Output(type=AssetTypes.MLTABLE)} - source = {'type': 'database', 'stored_procedure': stored_procedure, - 'stored_procedure_params': stored_procedure_params} + source = { + "type": "database", + "stored_procedure": stored_procedure, + "stored_procedure_params": stored_procedure_params, + } data_transfer_job = DataTransferImportJob( source=source, outputs=outputs, @@ -688,47 +769,56 @@ def pipeline(): pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'name': 'node1', - 'source': {'stored_procedure': 'SelectEmployeeByJobAndDepartment', - 'stored_procedure_params': [{'name': 'job', - 'type': 'String', - 'value': 'Engineer'}, - {'name': 'department', - 'type': 'String', - 'value': 'Engineering'}], - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'name': 'node2', - 'outputs': {'sink': {'job_output_type': 'mltable'}}, - 'source': {'stored_procedure': 'SelectEmployeeByJobAndDepartment', - 'stored_procedure_params': [{'name': 'job', - 'type': 'String', - 'value': 'Engineer'}, - {'name': 'department', - 'type': 'String', - 'value': 'Engineering'}], - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": {}, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "name": "node1", + "source": { + "stored_procedure": "SelectEmployeeByJobAndDepartment", + "stored_procedure_params": [ + {"name": "job", "type": "String", "value": "Engineer"}, + {"name": "department", "type": "String", "value": "Engineering"}, + ], + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "name": "node2", + "outputs": {"sink": {"job_output_type": "mltable"}}, + "source": { + "stored_procedure": "SelectEmployeeByJobAndDepartment", + "stored_procedure_params": [ + {"name": "job", "type": "String", "value": "Engineer"}, + {"name": "department", "type": "String", "value": "Engineering"}, + ], + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } for key, _ in pipeline1.jobs.items(): data_transfer_import_node = pipeline1.jobs[key] data_transfer_import_node_dict = data_transfer_import_node._to_dict() data_transfer_import_node_rest_obj = data_transfer_import_node._to_rest_object() - regenerated_data_transfer_import_node = DataTransferImport._from_rest_object(data_transfer_import_node_rest_obj) + regenerated_data_transfer_import_node = DataTransferImport._from_rest_object( + data_transfer_import_node_rest_obj + ) data_transfer_import_node_dict_from_rest = regenerated_data_transfer_import_node._to_dict() @@ -736,14 +826,15 @@ def pipeline(): # regenerated_data_transfer_import_node will only keep component id when call _to_rest_object() omit_fields = ["component"] - assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == \ - pydash.omit(data_transfer_import_node_dict_from_rest, *omit_fields) + assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == pydash.omit( + data_transfer_import_node_dict_from_rest, *omit_fields + ) def test_pipeline_with_data_transfer_import_file_system_function(self): - path_source_s3 = 's3://my_bucket/my_folder' - connection_target = 'azureml:my_s3_connection' + path_source_s3 = "s3://my_bucket/my_folder" + connection_target = "azureml:my_s3_connection" outputs = {"sink": Output(type=AssetTypes.URI_FOLDER, path="azureml://datastores/managed/paths/some_path")} - source = {'type': 'file_system', 'connection': connection_target, 'path': path_source_s3} + source = {"type": "file_system", "connection": connection_target, "path": path_source_s3} data_transfer_job = DataTransferImportJob( source=source, outputs=outputs, @@ -756,7 +847,6 @@ def pipeline(path_source_s3, connection_target): node1 = data_transfer_job_func(source=FileSystem(**source)) node2 = import_data(source=FileSystem(**source), outputs=outputs) - source_snowflake = FileSystem(path=path_source_s3, connection=connection_target) node3 = data_transfer_job_func(source=source_snowflake) node4 = import_data(source=source_snowflake, outputs=outputs) @@ -767,57 +857,86 @@ def pipeline(path_source_s3, connection_target): pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target': {'job_input_type': 'literal', - 'value': 'azureml:my_s3_connection'}, - 'path_source_s3': {'job_input_type': 'literal', - 'value': 's3://my_bucket/my_folder'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'name': 'node1', - 'source': {'connection': 'azureml:my_s3_connection', - 'path': 's3://my_bucket/my_folder', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'name': 'node2', - 'outputs': {'sink': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/managed/paths/some_path'}}, - 'source': {'connection': 'azureml:my_s3_connection', - 'path': 's3://my_bucket/my_folder', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node3': {'_source': 'BUILTIN', - 'name': 'node3', - 'source': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node4': {'_source': 'BUILTIN', - 'name': 'node4', - 'outputs': {'sink': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/managed/paths/some_path'}}, - 'source': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target": {"job_input_type": "literal", "value": "azureml:my_s3_connection"}, + "path_source_s3": {"job_input_type": "literal", "value": "s3://my_bucket/my_folder"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "name": "node1", + "source": { + "connection": "azureml:my_s3_connection", + "path": "s3://my_bucket/my_folder", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "name": "node2", + "outputs": { + "sink": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/managed/paths/some_path", + } + }, + "source": { + "connection": "azureml:my_s3_connection", + "path": "s3://my_bucket/my_folder", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node3": { + "_source": "BUILTIN", + "name": "node3", + "source": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node4": { + "_source": "BUILTIN", + "name": "node4", + "outputs": { + "sink": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/managed/paths/some_path", + } + }, + "source": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } for key, _ in pipeline1.jobs.items(): data_transfer_import_node = pipeline1.jobs[key] data_transfer_import_node_dict = data_transfer_import_node._to_dict() data_transfer_import_node_rest_obj = data_transfer_import_node._to_rest_object() - regenerated_data_transfer_import_node = DataTransferImport._from_rest_object(data_transfer_import_node_rest_obj) + regenerated_data_transfer_import_node = DataTransferImport._from_rest_object( + data_transfer_import_node_rest_obj + ) data_transfer_import_node_dict_from_rest = regenerated_data_transfer_import_node._to_dict() @@ -825,15 +944,16 @@ def pipeline(path_source_s3, connection_target): # regenerated_data_transfer_import_node will only keep component id when call _to_rest_object() omit_fields = ["component"] - assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == \ - pydash.omit(data_transfer_import_node_dict_from_rest, *omit_fields) + assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == pydash.omit( + data_transfer_import_node_dict_from_rest, *omit_fields + ) def test_pipeline_with_data_transfer_export_database_function(self): - connection_target_azuresql = 'azureml:my_azuresql_connection' + connection_target_azuresql = "azureml:my_azuresql_connection" table_name = "merged_table" cosmos_folder = Input(type=AssetTypes.URI_FILE, path="azureml://datastores/my_cosmos/paths/source_cosmos") inputs = {"source": cosmos_folder} - sink = {'type': 'database', 'connection': connection_target_azuresql, 'table_name': table_name} + sink = {"type": "database", "connection": connection_target_azuresql, "table_name": table_name} data_transfer_job = DataTransferExportJob( inputs=inputs, sink=sink, @@ -858,61 +978,101 @@ def pipeline(table_name, connection_target_azuresql): pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target_azuresql': {'job_input_type': 'literal', - 'value': 'azureml:my_azuresql_connection'}, - 'table_name': {'job_input_type': 'literal', - 'value': 'merged_table'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'uri_file', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 'node1', - 'sink': {'connection': 'azureml:my_azuresql_connection', - 'table_name': 'merged_table', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'uri_file', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 'node2', - 'sink': {'connection': 'azureml:my_azuresql_connection', - 'table_name': 'merged_table', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node3': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'uri_file', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 'node3', - 'sink': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'table_name': '${{parent.inputs.table_name}}', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node4': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'uri_file', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 'node4', - 'sink': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'table_name': '${{parent.inputs.table_name}}', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target_azuresql": { + "job_input_type": "literal", + "value": "azureml:my_azuresql_connection", + }, + "table_name": {"job_input_type": "literal", "value": "merged_table"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "inputs": { + "source": { + "job_input_type": "uri_file", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "node1", + "sink": { + "connection": "azureml:my_azuresql_connection", + "table_name": "merged_table", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "inputs": { + "source": { + "job_input_type": "uri_file", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "node2", + "sink": { + "connection": "azureml:my_azuresql_connection", + "table_name": "merged_table", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node3": { + "_source": "BUILTIN", + "inputs": { + "source": { + "job_input_type": "uri_file", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "node3", + "sink": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "table_name": "${{parent.inputs.table_name}}", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node4": { + "_source": "BUILTIN", + "inputs": { + "source": { + "job_input_type": "uri_file", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "node4", + "sink": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "table_name": "${{parent.inputs.table_name}}", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } for key, _ in pipeline1.jobs.items(): data_transfer_import_node = pipeline1.jobs[key] data_transfer_import_node_dict = data_transfer_import_node._to_dict() data_transfer_import_node_rest_obj = data_transfer_import_node._to_rest_object() - regenerated_data_transfer_import_node = DataTransferImport._from_rest_object(data_transfer_import_node_rest_obj) + regenerated_data_transfer_import_node = DataTransferImport._from_rest_object( + data_transfer_import_node_rest_obj + ) data_transfer_import_node_dict_from_rest = regenerated_data_transfer_import_node._to_dict() @@ -920,16 +1080,17 @@ def pipeline(table_name, connection_target_azuresql): # regenerated_data_transfer_import_node will only keep component id when call _to_rest_object() omit_fields = ["component"] - assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == \ - pydash.omit(data_transfer_import_node_dict_from_rest, *omit_fields) + assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == pydash.omit( + data_transfer_import_node_dict_from_rest, *omit_fields + ) def test_pipeline_with_data_transfer_export_file_system_function(self): - path_source_s3 = 's3://my_bucket/my_folder' - connection_target = 'azureml:my_s3_connection' + path_source_s3 = "s3://my_bucket/my_folder" + connection_target = "azureml:my_s3_connection" my_cosmos_folder = Input(type=AssetTypes.URI_FOLDER, path="azureml://datastores/my_cosmos/paths/source_cosmos") inputs = {"source": my_cosmos_folder} - sink = {'type': 'file_system', 'connection': connection_target, 'path': path_source_s3} + sink = {"type": "file_system", "connection": connection_target, "path": path_source_s3} data_transfer_job = DataTransferExportJob( inputs=inputs, sink=sink, @@ -941,7 +1102,7 @@ def test_pipeline_with_data_transfer_export_file_system_function(self): def pipeline(path_source_s3, connection_target, cosmos_folder, my_cosmos_folder): node1 = data_transfer_job_func(source=my_cosmos_folder) node1.sink = sink - node2 = export_data(inputs = {"source": my_cosmos_folder}, sink=sink) + node2 = export_data(inputs={"source": my_cosmos_folder}, sink=sink) source_snowflake = FileSystem(path=path_source_s3, connection=connection_target) node3 = data_transfer_job_func(source=cosmos_folder) @@ -954,64 +1115,90 @@ def pipeline(path_source_s3, connection_target, cosmos_folder, my_cosmos_folder) pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target': {'job_input_type': 'literal', - 'value': 'azureml:my_s3_connection'}, - 'path_source_s3': {'job_input_type': 'literal', - 'value': 's3://my_bucket/my_folder'}, - 'cosmos_folder': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}, - }, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.my_cosmos_folder}}'}}, - 'name': 'node1', - 'sink': {'connection': 'azureml:my_s3_connection', - 'path': 's3://my_bucket/my_folder', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.my_cosmos_folder}}'}}, - 'name': 'node2', - 'sink': {'connection': 'azureml:my_s3_connection', - 'path': 's3://my_bucket/my_folder', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node3': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'name': 'node3', - 'sink': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node4': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'name': 'node4', - 'sink': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target": {"job_input_type": "literal", "value": "azureml:my_s3_connection"}, + "path_source_s3": {"job_input_type": "literal", "value": "s3://my_bucket/my_folder"}, + "cosmos_folder": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "inputs": { + "source": {"job_input_type": "literal", "value": "${{parent.inputs.my_cosmos_folder}}"} + }, + "name": "node1", + "sink": { + "connection": "azureml:my_s3_connection", + "path": "s3://my_bucket/my_folder", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "inputs": { + "source": {"job_input_type": "literal", "value": "${{parent.inputs.my_cosmos_folder}}"} + }, + "name": "node2", + "sink": { + "connection": "azureml:my_s3_connection", + "path": "s3://my_bucket/my_folder", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node3": { + "_source": "BUILTIN", + "inputs": { + "source": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"} + }, + "name": "node3", + "sink": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node4": { + "_source": "BUILTIN", + "inputs": { + "source": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"} + }, + "name": "node4", + "sink": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } for key, _ in pipeline1.jobs.items(): data_transfer_import_node = pipeline1.jobs[key] data_transfer_import_node_dict = data_transfer_import_node._to_dict() data_transfer_import_node_rest_obj = data_transfer_import_node._to_rest_object() - regenerated_data_transfer_import_node = DataTransferImport._from_rest_object(data_transfer_import_node_rest_obj) + regenerated_data_transfer_import_node = DataTransferImport._from_rest_object( + data_transfer_import_node_rest_obj + ) data_transfer_import_node_dict_from_rest = regenerated_data_transfer_import_node._to_dict() @@ -1019,8 +1206,9 @@ def pipeline(path_source_s3, connection_target, cosmos_folder, my_cosmos_folder) # regenerated_data_transfer_import_node will only keep component id when call _to_rest_object() omit_fields = ["component"] - assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == \ - pydash.omit(data_transfer_import_node_dict_from_rest, *omit_fields) + assert pydash.omit(data_transfer_import_node_dict, *omit_fields) == pydash.omit( + data_transfer_import_node_dict_from_rest, *omit_fields + ) def test_pipeline_with_spark_function(self): # component func @@ -1099,91 +1287,104 @@ def pipeline(iris_data, sample_rate): pipeline_job1 = pipeline1._to_rest_object().as_dict() pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'experiment_name': 'test_pipeline_with_spark_function', - 'inputs': {'iris_data': {'job_input_type': 'uri_file', - 'mode': 'Direct', - 'uri': './tests/test_configs/dsl_pipeline/spark_job_in_pipeline/dataset/shakespeare.txt'}, - 'sample_rate': {'job_input_type': 'literal', - 'value': '0.01'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'YAML.COMPONENT', - 'args': '--input1 ${{inputs.input1}} ' - '--output2 ${{outputs.output1}} ' - '--my_sample_rate ' - '${{inputs.sample_rate}}', - 'computeId': 'rezas-synapse-10', - 'conf': {'spark.driver.cores': 1, - 'spark.driver.memory': '2g', - 'spark.dynamicAllocation.enabled': True, - 'spark.dynamicAllocation.maxExecutors': 4, - 'spark.dynamicAllocation.minExecutors': 1, - 'spark.executor.cores': 2, - 'spark.executor.instances': 1, - 'spark.executor.memory': '2g'}, - 'entry': {'file': 'sampleword.py', - 'spark_job_entry_type': 'SparkJobPythonEntry'}, - 'identity': {'identity_type': 'Managed'}, - 'inputs': {'input1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.iris_data}}'}, - 'sample_rate': {'job_input_type': 'literal', - 'value': '${{parent.inputs.sample_rate}}'}}, - 'name': 'node1', - 'outputs': {'output1': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output1}}'}}, - 'type': 'spark'}, - 'node2': {'_source': 'CLASS', - 'args': '--input1 ${{inputs.input1}} ' - '--output2 ${{outputs.output1}} ' - '--my_sample_rate ' - '${{inputs.sample_rate}}', - 'computeId': 'rezas-synapse-10', - 'conf': {'spark.driver.cores': 2, - 'spark.driver.memory': '1g', - 'spark.executor.cores': 1, - 'spark.executor.instances': 1, - 'spark.executor.memory': '1g'}, - 'entry': {'file': 'sampleword.py', - 'spark_job_entry_type': 'SparkJobPythonEntry'}, - 'identity': {'identity_type': 'Managed'}, - 'inputs': {'input1': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node1.outputs.output1}}'}, - 'sample_rate': {'job_input_type': 'literal', - 'value': '${{parent.inputs.sample_rate}}'}}, - 'name': 'node2', - 'outputs': {'output1': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output2}}'}}, - 'type': 'spark'}, - 'node3': {'_source': 'BUILDER', - 'args': '--input1 ${{inputs.input1}} ' - '--output2 ${{outputs.output1}} ' - '--my_sample_rate ' - '${{inputs.sample_rate}}', - 'computeId': 'rezas-synapse-10', - 'conf': {'spark.driver.cores': 2, - 'spark.driver.memory': '1g', - 'spark.executor.cores': 1, - 'spark.executor.instances': 1, - 'spark.executor.memory': '1g'}, - 'entry': {'file': 'sampleword.py', - 'spark_job_entry_type': 'SparkJobPythonEntry'}, - 'identity': {'identity_type': 'Managed'}, - 'inputs': {'input1': {'job_input_type': 'literal', - 'value': '${{parent.jobs.node2.outputs.output1}}'}, - 'sample_rate': {'job_input_type': 'literal', - 'value': '${{parent.inputs.sample_rate}}'}}, - 'name': 'node3', - 'outputs': {'output1': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output3}}'}}, - 'type': 'spark'}}, - 'outputs': {'pipeline_output1': {'job_output_type': 'uri_file'}, - 'pipeline_output2': {'job_output_type': 'uri_folder'}, - 'pipeline_output3': {'job_output_type': 'uri_folder'}}, - 'properties': {}, - 'settings': {}, - 'tags': {} + "properties": { + "display_name": "pipeline", + "experiment_name": "test_pipeline_with_spark_function", + "inputs": { + "iris_data": { + "job_input_type": "uri_file", + "mode": "Direct", + "uri": "./tests/test_configs/dsl_pipeline/spark_job_in_pipeline/dataset/shakespeare.txt", + }, + "sample_rate": {"job_input_type": "literal", "value": "0.01"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "YAML.COMPONENT", + "args": "--input1 ${{inputs.input1}} " + "--output2 ${{outputs.output1}} " + "--my_sample_rate " + "${{inputs.sample_rate}}", + "computeId": "rezas-synapse-10", + "conf": { + "spark.driver.cores": 1, + "spark.driver.memory": "2g", + "spark.dynamicAllocation.enabled": True, + "spark.dynamicAllocation.maxExecutors": 4, + "spark.dynamicAllocation.minExecutors": 1, + "spark.executor.cores": 2, + "spark.executor.instances": 1, + "spark.executor.memory": "2g", + }, + "entry": {"file": "sampleword.py", "spark_job_entry_type": "SparkJobPythonEntry"}, + "identity": {"identity_type": "Managed"}, + "inputs": { + "input1": {"job_input_type": "literal", "value": "${{parent.inputs.iris_data}}"}, + "sample_rate": {"job_input_type": "literal", "value": "${{parent.inputs.sample_rate}}"}, + }, + "name": "node1", + "outputs": {"output1": {"type": "literal", "value": "${{parent.outputs.pipeline_output1}}"}}, + "type": "spark", + }, + "node2": { + "_source": "CLASS", + "args": "--input1 ${{inputs.input1}} " + "--output2 ${{outputs.output1}} " + "--my_sample_rate " + "${{inputs.sample_rate}}", + "computeId": "rezas-synapse-10", + "conf": { + "spark.driver.cores": 2, + "spark.driver.memory": "1g", + "spark.executor.cores": 1, + "spark.executor.instances": 1, + "spark.executor.memory": "1g", + }, + "entry": {"file": "sampleword.py", "spark_job_entry_type": "SparkJobPythonEntry"}, + "identity": {"identity_type": "Managed"}, + "inputs": { + "input1": {"job_input_type": "literal", "value": "${{parent.jobs.node1.outputs.output1}}"}, + "sample_rate": {"job_input_type": "literal", "value": "${{parent.inputs.sample_rate}}"}, + }, + "name": "node2", + "outputs": {"output1": {"type": "literal", "value": "${{parent.outputs.pipeline_output2}}"}}, + "type": "spark", + }, + "node3": { + "_source": "BUILDER", + "args": "--input1 ${{inputs.input1}} " + "--output2 ${{outputs.output1}} " + "--my_sample_rate " + "${{inputs.sample_rate}}", + "computeId": "rezas-synapse-10", + "conf": { + "spark.driver.cores": 2, + "spark.driver.memory": "1g", + "spark.executor.cores": 1, + "spark.executor.instances": 1, + "spark.executor.memory": "1g", + }, + "entry": {"file": "sampleword.py", "spark_job_entry_type": "SparkJobPythonEntry"}, + "identity": {"identity_type": "Managed"}, + "inputs": { + "input1": {"job_input_type": "literal", "value": "${{parent.jobs.node2.outputs.output1}}"}, + "sample_rate": {"job_input_type": "literal", "value": "${{parent.inputs.sample_rate}}"}, + }, + "name": "node3", + "outputs": {"output1": {"type": "literal", "value": "${{parent.outputs.pipeline_output3}}"}}, + "type": "spark", + }, + }, + "outputs": { + "pipeline_output1": {"job_output_type": "uri_file", "mode": "Direct"}, + "pipeline_output2": {"job_output_type": "uri_folder"}, + "pipeline_output3": {"job_output_type": "uri_folder", "mode": "Direct"}, + }, + "properties": {}, + "settings": {}, + "tags": {}, } } @@ -1359,9 +1560,9 @@ def pipeline(iris_data, sample_rate): }, }, "outputs": { - "pipeline_output1": {"job_output_type": "uri_file"}, + "pipeline_output1": {"job_output_type": "uri_file", "mode": "Direct"}, "pipeline_output2": {"job_output_type": "uri_folder"}, - "pipeline_output3": {"job_output_type": "uri_folder"}, + "pipeline_output3": {"job_output_type": "uri_folder", "mode": "Direct"}, }, "properties": {}, "settings": {}, @@ -1557,6 +1758,7 @@ def pipeline(folder1, folder2): return { "pipeline_output": data_transfer_node.outputs.output, } + pipeline1 = pipeline(folder1, folder2) pipeline_rest_obj = pipeline1._to_rest_object() pipeline_job1 = pipeline_rest_obj.as_dict() @@ -1565,46 +1767,53 @@ def pipeline(folder1, folder2): pipeline1_dict = pipeline1._to_dict() assert pipeline1_dict == pipeline_regenerated_from_rest._to_dict() - omit_fields = [ - "properties.jobs.data_transfer_node.componentId", - "properties.experiment_name" - ] + omit_fields = ["properties.jobs.data_transfer_node.componentId", "properties.experiment_name"] pipeline_job1 = pydash.omit(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'folder1': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}, - 'folder2': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'data_transfer_node': {'_source': 'CLASS', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.folder1}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.folder2}}'}}, - 'name': 'data_transfer_node', - 'outputs': {'output': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer'}}, - 'outputs': {'pipeline_output': {'job_output_type': 'uri_folder'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}}} + "properties": { + "display_name": "pipeline", + "inputs": { + "folder1": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + "folder2": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "data_transfer_node": { + "_source": "CLASS", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.folder1}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.folder2}}"}, + }, + "name": "data_transfer_node", + "outputs": {"output": {"type": "literal", "value": "${{parent.outputs.pipeline_output}}"}}, + "task": "copy_data", + "type": "data_transfer", + } + }, + "outputs": {"pipeline_output": {"job_output_type": "uri_folder"}}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } + } def test_pipeline_with_data_transfer_import_database_job(self): - query_source_snowflake = 'SELECT * FROM my_table' - connection_target_azuresql = 'azureml:my_azuresql_connection' + query_source_snowflake = "SELECT * FROM my_table" + connection_target_azuresql = "azureml:my_azuresql_connection" # outputs = {"sink": Output(type=AssetTypes.MLTABLE)} - source = {'type': 'database', 'connection': 'azureml:my_snowflake_connection', - 'query': query_source_snowflake} + source = {"type": "database", "connection": "azureml:my_snowflake_connection", "query": query_source_snowflake} data_transfer_job = DataTransferImportJob( source=source, task=DataTransferTaskType.IMPORT_DATA, - compute='adf_compute1', + compute="adf_compute1", ) data_transfer_job_func = to_component(job=data_transfer_job) @@ -1628,54 +1837,70 @@ def pipeline(query_source_snowflake, connection_target_azuresql): # pipeline_regenerated_from_rest will only keep component id after call _to_rest_object() omit_fields = ["jobs.*.component"] pipeline1_dict = omit_with_wildcard(pipeline1._to_dict(), *omit_fields) - pipeline_regenerated_from_rest_dict = omit_with_wildcard(pipeline_regenerated_from_rest._to_dict(), *omit_fields) + pipeline_regenerated_from_rest_dict = omit_with_wildcard( + pipeline_regenerated_from_rest._to_dict(), *omit_fields + ) assert pipeline1_dict == pipeline_regenerated_from_rest_dict - omit_fields = [ - "properties.jobs.*.componentId", - "properties.experiment_name" - ] + omit_fields = ["properties.jobs.*.componentId", "properties.experiment_name"] pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target_azuresql': {'job_input_type': 'literal', - 'value': 'azureml:my_azuresql_connection'}, - 'query_source_snowflake': {'job_input_type': 'literal', - 'value': 'SELECT * FROM ' - 'my_table'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'name': 'node1', - 'source': {'connection': 'azureml:my_snowflake_connection', - 'query': 'SELECT * FROM my_table', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'name': 'node2', - 'outputs': {'sink': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output}}'}}, - 'source': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'query': '${{parent.inputs.query_source_snowflake}}', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {'pipeline_output': {'job_output_type': 'mltable'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target_azuresql": { + "job_input_type": "literal", + "value": "azureml:my_azuresql_connection", + }, + "query_source_snowflake": {"job_input_type": "literal", "value": "SELECT * FROM " "my_table"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "name": "node1", + "source": { + "connection": "azureml:my_snowflake_connection", + "query": "SELECT * FROM my_table", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "name": "node2", + "outputs": {"sink": {"type": "literal", "value": "${{parent.outputs.pipeline_output}}"}}, + "source": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "query": "${{parent.inputs.query_source_snowflake}}", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": {"pipeline_output": {"job_output_type": "mltable"}}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } def test_pipeline_with_data_transfer_import_stored_database_job(self): - stored_procedure = 'SelectEmployeeByJobAndDepartment' - stored_procedure_params = [{'name': 'job', 'value': 'Engineer', 'type': 'String'}, - {'name': 'department', 'value': 'Engineering', 'type': 'String'}] + stored_procedure = "SelectEmployeeByJobAndDepartment" + stored_procedure_params = [ + {"name": "job", "value": "Engineer", "type": "String"}, + {"name": "department", "value": "Engineering", "type": "String"}, + ] outputs = {"sink": Output(type=AssetTypes.MLTABLE)} - source = {'type': 'database', 'stored_procedure': stored_procedure, - 'stored_procedure_params': stored_procedure_params} + source = { + "type": "database", + "stored_procedure": stored_procedure, + "stored_procedure_params": stored_procedure_params, + } data_transfer_job = DataTransferImportJob( source=source, outputs=outputs, @@ -1701,47 +1926,50 @@ def pipeline(query_source_snowflake, connection_target_azuresql): # pipeline_regenerated_from_rest will only keep component id after call _to_rest_object() omit_fields = ["jobs.*.component"] pipeline1_dict = omit_with_wildcard(pipeline1._to_dict(), *omit_fields) - pipeline_regenerated_from_rest_dict = omit_with_wildcard(pipeline_regenerated_from_rest._to_dict(), *omit_fields) + pipeline_regenerated_from_rest_dict = omit_with_wildcard( + pipeline_regenerated_from_rest._to_dict(), *omit_fields + ) assert pipeline1_dict == pipeline_regenerated_from_rest_dict - omit_fields = [ - "properties.jobs.*.componentId", - "properties.experiment_name" - ] + omit_fields = ["properties.jobs.*.componentId", "properties.experiment_name"] pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'name': 'node1', - 'outputs': {'sink': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output}}'}}, - 'source': {'stored_procedure': 'SelectEmployeeByJobAndDepartment', - 'stored_procedure_params': [{'name': 'job', - 'type': 'String', - 'value': 'Engineer'}, - {'name': 'department', - 'type': 'String', - 'value': 'Engineering'}], - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {'pipeline_output': {'job_output_type': 'mltable'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": {}, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "name": "node1", + "outputs": {"sink": {"type": "literal", "value": "${{parent.outputs.pipeline_output}}"}}, + "source": { + "stored_procedure": "SelectEmployeeByJobAndDepartment", + "stored_procedure_params": [ + {"name": "job", "type": "String", "value": "Engineer"}, + {"name": "department", "type": "String", "value": "Engineering"}, + ], + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + } + }, + "outputs": {"pipeline_output": {"job_output_type": "mltable"}}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } def test_pipeline_with_data_transfer_export_database_job(self): - connection_target_azuresql = 'azureml:my_azuresql_connection' + connection_target_azuresql = "azureml:my_azuresql_connection" table_name = "merged_table" cosmos_folder = Input(type=AssetTypes.URI_FILE, path="azureml://datastores/my_cosmos/paths/source_cosmos") inputs = {"source": cosmos_folder} - sink = {'type': 'database', 'connection': connection_target_azuresql, 'table_name': table_name} + sink = {"type": "database", "connection": connection_target_azuresql, "table_name": table_name} data_transfer_job = DataTransferExportJob( inputs=inputs, sink=sink, @@ -1768,53 +1996,74 @@ def pipeline(table_name, connection_target_azuresql): # pipeline_regenerated_from_rest will only keep component id after call _to_rest_object() omit_fields = ["jobs.*.component"] pipeline1_dict = omit_with_wildcard(pipeline1._to_dict(), *omit_fields) - pipeline_regenerated_from_rest_dict = omit_with_wildcard(pipeline_regenerated_from_rest._to_dict(), *omit_fields) + pipeline_regenerated_from_rest_dict = omit_with_wildcard( + pipeline_regenerated_from_rest._to_dict(), *omit_fields + ) assert pipeline1_dict == pipeline_regenerated_from_rest_dict - omit_fields = [ - "properties.jobs.*.componentId", - "properties.experiment_name" - ] + omit_fields = ["properties.jobs.*.componentId", "properties.experiment_name"] pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target_azuresql': {'job_input_type': 'literal', - 'value': 'azureml:my_azuresql_connection'}, - 'table_name': {'job_input_type': 'literal', - 'value': 'merged_table'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'uri_file', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 'node1', - 'sink': {'connection': 'azureml:my_azuresql_connection', - 'table_name': 'merged_table', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'uri_file', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 'node2', - 'sink': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'table_name': '${{parent.inputs.table_name}}', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target_azuresql": { + "job_input_type": "literal", + "value": "azureml:my_azuresql_connection", + }, + "table_name": {"job_input_type": "literal", "value": "merged_table"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "inputs": { + "source": { + "job_input_type": "uri_file", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "node1", + "sink": { + "connection": "azureml:my_azuresql_connection", + "table_name": "merged_table", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "inputs": { + "source": { + "job_input_type": "uri_file", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "node2", + "sink": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "table_name": "${{parent.inputs.table_name}}", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } def test_pipeline_with_data_transfer_import_file_system_job(self): - path_source_s3 = 's3://my_bucket/my_folder' - connection_target = 'azureml:my_s3_connection' + path_source_s3 = "s3://my_bucket/my_folder" + connection_target = "azureml:my_s3_connection" outputs = {"sink": Output(type=AssetTypes.URI_FOLDER, path="azureml://datastores/managed/paths/some_path")} - source = {'type': 'file_system', 'connection': connection_target, 'path': path_source_s3} + source = {"type": "file_system", "connection": connection_target, "path": path_source_s3} data_transfer_job = DataTransferImportJob( source=source, outputs=outputs, @@ -1841,52 +2090,61 @@ def pipeline(path_source_s3, connection_target): # pipeline_regenerated_from_rest will only keep component id after call _to_rest_object() omit_fields = ["jobs.*.component"] pipeline1_dict = omit_with_wildcard(pipeline1._to_dict(), *omit_fields) - pipeline_regenerated_from_rest_dict = omit_with_wildcard(pipeline_regenerated_from_rest._to_dict(), *omit_fields) + pipeline_regenerated_from_rest_dict = omit_with_wildcard( + pipeline_regenerated_from_rest._to_dict(), *omit_fields + ) assert pipeline1_dict == pipeline_regenerated_from_rest_dict - omit_fields = [ - "properties.jobs.*.componentId", - "properties.experiment_name" - ] + omit_fields = ["properties.jobs.*.componentId", "properties.experiment_name"] pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target': {'job_input_type': 'literal', - 'value': 'azureml:my_s3_connection'}, - 'path_source_s3': {'job_input_type': 'literal', - 'value': 's3://my_bucket/my_folder'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'name': 'node1', - 'source': {'connection': 'azureml:my_s3_connection', - 'path': 's3://my_bucket/my_folder', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'name': 'node2', - 'outputs': {'sink': {'type': 'literal', - 'value': '${{parent.outputs.pipeline_output}}'}}, - 'source': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {'pipeline_output': {'job_output_type': 'uri_folder'}}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target": {"job_input_type": "literal", "value": "azureml:my_s3_connection"}, + "path_source_s3": {"job_input_type": "literal", "value": "s3://my_bucket/my_folder"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "name": "node1", + "source": { + "connection": "azureml:my_s3_connection", + "path": "s3://my_bucket/my_folder", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "name": "node2", + "outputs": {"sink": {"type": "literal", "value": "${{parent.outputs.pipeline_output}}"}}, + "source": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": {"pipeline_output": {"job_output_type": "uri_folder"}}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } def test_pipeline_with_data_transfer_export_file_system_job(self): - path_source_s3 = 's3://my_bucket/my_folder' - connection_target = 'azureml:my_s3_connection' + path_source_s3 = "s3://my_bucket/my_folder" + connection_target = "azureml:my_s3_connection" my_cosmos_folder = Input(type=AssetTypes.URI_FOLDER, path="azureml://datastores/my_cosmos/paths/source_cosmos") inputs = {"source": my_cosmos_folder} - sink = {'type': 'file_system', 'connection': connection_target, 'path': path_source_s3} + sink = {"type": "file_system", "connection": connection_target, "path": path_source_s3} data_transfer_job = DataTransferExportJob( inputs=inputs, @@ -1914,48 +2172,65 @@ def pipeline(path_source_s3, connection_target, cosmos_folder): # pipeline_regenerated_from_rest will only keep component id after call _to_rest_object() omit_fields = ["jobs.*.component"] pipeline1_dict = omit_with_wildcard(pipeline1._to_dict(), *omit_fields) - pipeline_regenerated_from_rest_dict = omit_with_wildcard(pipeline_regenerated_from_rest._to_dict(), *omit_fields) + pipeline_regenerated_from_rest_dict = omit_with_wildcard( + pipeline_regenerated_from_rest._to_dict(), *omit_fields + ) assert pipeline1_dict == pipeline_regenerated_from_rest_dict - omit_fields = [ - "properties.jobs.*.componentId", - "properties.experiment_name" - ] + omit_fields = ["properties.jobs.*.componentId", "properties.experiment_name"] pipeline_job1 = omit_with_wildcard(pipeline_job1, *omit_fields) assert pipeline_job1 == { - 'properties': { - 'display_name': 'pipeline', - 'inputs': {'connection_target': {'job_input_type': 'literal', - 'value': 'azureml:my_s3_connection'}, - 'cosmos_folder': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}, - 'path_source_s3': {'job_input_type': 'literal', - 'value': 's3://my_bucket/my_folder'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'node1': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 'node1', - 'sink': {'connection': 'azureml:my_s3_connection', - 'path': 's3://my_bucket/my_folder', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'node2': {'_source': 'BUILTIN', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'name': 'node2', - 'sink': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'DSL'}, - 'tags': {}} + "properties": { + "display_name": "pipeline", + "inputs": { + "connection_target": {"job_input_type": "literal", "value": "azureml:my_s3_connection"}, + "cosmos_folder": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + "path_source_s3": {"job_input_type": "literal", "value": "s3://my_bucket/my_folder"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "node1": { + "_source": "BUILTIN", + "inputs": { + "source": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "node1", + "sink": { + "connection": "azureml:my_s3_connection", + "path": "s3://my_bucket/my_folder", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + "node2": { + "_source": "BUILTIN", + "inputs": { + "source": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"} + }, + "name": "node2", + "sink": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "DSL"}, + "tags": {}, + } } def test_pipeline_with_parallel_job(self): @@ -2194,8 +2469,8 @@ def pipeline(path): }, }, "outputs": { - "pipeline_output1": {"job_output_type": "uri_folder"}, - "pipeline_output2": {"job_output_type": "uri_folder"}, + "pipeline_output1": {"job_output_type": "uri_folder", "mode": "ReadWriteMount"}, + "pipeline_output2": {"job_output_type": "uri_folder", "mode": "ReadWriteMount"}, }, "properties": {}, "settings": {"_source": "DSL"}, @@ -2291,8 +2566,8 @@ def pipeline(number, path): }, }, "outputs": { - "pipeline_output1": {"job_output_type": "mlflow_model"}, - "pipeline_output2": {"job_output_type": "mlflow_model"}, + "pipeline_output1": {"job_output_type": "mlflow_model", "mode": "ReadWriteMount"}, + "pipeline_output2": {"job_output_type": "mlflow_model", "mode": "ReadWriteMount"}, }, "properties": {}, "settings": {"_source": "DSL"}, @@ -2628,8 +2903,8 @@ def train_with_automl_in_pipeline(training_data, target_column_name_input: str): "type": "automl", } }, - # default to uri folder with rwmount - "outputs": {"pipeline_job_out_best_model": {"job_output_type": "uri_folder"}}, + # pipeline level will copy node level type + "outputs": {"pipeline_job_out_best_model": {"job_output_type": "mlflow_model"}}, "properties": {}, "settings": {"_source": "DSL"}, "tags": {}, @@ -2637,7 +2912,6 @@ def train_with_automl_in_pipeline(training_data, target_column_name_input: str): assert pipeline_dict1 == expected_dict # in order to get right type, user need to specify it on pipeline level - pipeline1.outputs.pipeline_job_out_best_model.type = "mlflow_model" pipeline1.outputs.pipeline_job_out_best_model.mode = "rw_mount" pipeline_dict2 = pipeline1._to_rest_object().as_dict() pipeline_dict2 = pydash.omit( diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_io_builder.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_io_builder.py index c4d7c63daf6b..a5215bd5bd75 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_io_builder.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_io_builder.py @@ -63,63 +63,60 @@ def my_pipeline(job_in_number, job_in_path): node1 = component_func(component_in_number=job_in_number, component_in_path=job_in_path) # calling result() will convert pipeline input to actual value node2 = component_func(component_in_number=job_in_number.result(), component_in_path=job_in_path.result()) - return { - "output1": node1.outputs.component_out_path, - "output2": node2.outputs.component_out_path - } + return {"output1": node1.outputs.component_out_path, "output2": node2.outputs.component_out_path} - pipeline_job1 = my_pipeline( - job_in_number=1, job_in_path=Input(path="fake_path1") - ) + pipeline_job1 = my_pipeline(job_in_number=1, job_in_path=Input(path="fake_path1")) - rest_pipeline_job = omit_with_wildcard(pipeline_job1._to_rest_object().properties.as_dict(), - *common_omit_fields) + rest_pipeline_job = omit_with_wildcard( + pipeline_job1._to_rest_object().properties.as_dict(), *common_omit_fields + ) expected_pipeline_job1 = { - 'node1': { - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_path}}'}}, - 'name': 'node1', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.output1}}'}}, - 'type': 'command'}, - 'node2': { - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}, - 'component_in_path': {'job_input_type': 'uri_folder', - 'uri': 'fake_path1'}}, - 'name': 'node2', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.output2}}'}}, - 'type': 'command'} + "node1": { + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_number}}"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"}, + }, + "name": "node1", + "outputs": {"component_out_path": {"type": "literal", "value": "${{parent.outputs.output1}}"}}, + "type": "command", + }, + "node2": { + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "1"}, + "component_in_path": {"job_input_type": "uri_folder", "uri": "fake_path1"}, + }, + "name": "node2", + "outputs": {"component_out_path": {"type": "literal", "value": "${{parent.outputs.output2}}"}}, + "type": "command", + }, } assert rest_pipeline_job["jobs"] == expected_pipeline_job1 - pipeline_job2 = my_pipeline( - job_in_number=2, job_in_path=Input(path="fake_path2") - ) + pipeline_job2 = my_pipeline(job_in_number=2, job_in_path=Input(path="fake_path2")) - rest_pipeline_job = omit_with_wildcard(pipeline_job2._to_rest_object().properties.as_dict(), - *common_omit_fields) + rest_pipeline_job = omit_with_wildcard( + pipeline_job2._to_rest_object().properties.as_dict(), *common_omit_fields + ) expected_pipeline_job2 = { - 'node1': {'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_path}}'}}, - 'name': 'node1', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.output1}}'}}, - 'type': 'command'}, - 'node2': {'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '2'}, - 'component_in_path': {'job_input_type': 'uri_folder', - 'uri': 'fake_path2'}}, - 'name': 'node2', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.output2}}'}}, - 'type': 'command'} + "node1": { + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_number}}"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"}, + }, + "name": "node1", + "outputs": {"component_out_path": {"type": "literal", "value": "${{parent.outputs.output1}}"}}, + "type": "command", + }, + "node2": { + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "2"}, + "component_in_path": {"job_input_type": "uri_folder", "uri": "fake_path2"}, + }, + "name": "node2", + "outputs": {"component_out_path": {"type": "literal", "value": "${{parent.outputs.output2}}"}}, + "type": "command", + }, } assert rest_pipeline_job["jobs"] == expected_pipeline_job2 @@ -127,8 +124,9 @@ def my_pipeline(job_in_number, job_in_path): pipeline_job1.jobs["node2"].inputs["component_in_number"] == 1 pipeline_job1.jobs["node2"].inputs["component_in_path"].path == "fake_path1" - rest_pipeline_job = omit_with_wildcard(pipeline_job1._to_rest_object().properties.as_dict(), - *common_omit_fields) + rest_pipeline_job = omit_with_wildcard( + pipeline_job1._to_rest_object().properties.as_dict(), *common_omit_fields + ) assert rest_pipeline_job["jobs"] == expected_pipeline_job1 def test_pipeline_input_result_multiple_levle(self): @@ -153,28 +151,29 @@ def my_pipeline_level_2(job_in_number, job_in_path): my_pipeline_level_1(job_in_number=job_in_number, job_in_path=job_in_path) component_func(component_in_number=job_in_number, component_in_path=job_in_path) - pipeline_job2 = my_pipeline_level_2( - job_in_number=2, job_in_path=Input(path="fake_path2") - ) + pipeline_job2 = my_pipeline_level_2(job_in_number=2, job_in_path=Input(path="fake_path2")) - rest_pipeline_job = omit_with_wildcard(pipeline_job2._to_rest_object().properties.as_dict(), - *common_omit_fields) + rest_pipeline_job = omit_with_wildcard( + pipeline_job2._to_rest_object().properties.as_dict(), *common_omit_fields + ) expected_pipeline_job = { - 'microsoftsamples_command_component_basic': { - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_path}}'}}, - 'name': 'microsoftsamples_command_component_basic', - 'type': 'command'}, - 'my_pipeline_level_1': { - 'inputs': {'job_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_number}}'}, - 'job_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_path}}'}}, - 'name': 'my_pipeline_level_1', - 'type': 'pipeline'} + "microsoftsamples_command_component_basic": { + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_number}}"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"}, + }, + "name": "microsoftsamples_command_component_basic", + "type": "command", + }, + "my_pipeline_level_1": { + "inputs": { + "job_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_number}}"}, + "job_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"}, + }, + "name": "my_pipeline_level_1", + "type": "pipeline", + }, } assert rest_pipeline_job["jobs"] == expected_pipeline_job diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_mldesigner_imports.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_mldesigner_imports.py index 09200bfb97d1..664c25b94b9c 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_mldesigner_imports.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_mldesigner_imports.py @@ -1,12 +1,12 @@ import pytest from azure.ai.ml import Input -from azure.ai.ml.entities import( +from azure.ai.ml.entities import ( Component, CommandComponent, PipelineComponent, ValidationResult, ) -from azure.ai.ml.dsl._mldesigner import( +from azure.ai.ml.dsl._mldesigner import ( _AdditionalIncludes, InternalComponent, ) @@ -24,6 +24,7 @@ class TestMldesignerImports: The attributes are needed for a certain version of mldesigner package, modifying or deleting any of them will cause compatibility issues. If there are new dependencies for mldesigner package, add new assertions in this file. """ + def test_necessay_attributes(self): assert hasattr(Component, "_customized_validate") assert hasattr(Component, "_source_path") @@ -63,4 +64,4 @@ def test_class_names(self): assert GroupInput.__name__ == "GroupInput" assert PipelineInput.__name__ == "PipelineInput" assert NodeInput.__name__ == "NodeInput" - assert NodeOutput.__name__ == "NodeOutput" \ No newline at end of file + assert NodeOutput.__name__ == "NodeOutput" diff --git a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_pipeline_builder.py b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_pipeline_builder.py index 0ce9e8f02fd8..cc9caaf6f846 100644 --- a/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_pipeline_builder.py +++ b/sdk/ml/azure-ai-ml/tests/dsl/unittests/test_pipeline_builder.py @@ -10,7 +10,7 @@ @pytest.mark.unittest @pytest.mark.pipeline_test -class TestPersistentLocals: +class TestPipelineBuilder: def test_simple(self): component_yaml = components_dir / "helloworld_component_optional_input.yml" component_func = load_component(component_yaml) @@ -20,7 +20,7 @@ def pipeline_func(required_input: int, optional_input: int = 2): named_step = component_func(required_input=required_input, optional_input=optional_input) pipeline_job = pipeline_func(1, 2) - assert 'named_step' in pipeline_job.jobs + assert "named_step" in pipeline_job.jobs def test_raise_exception(self): @dsl.pipeline @@ -45,6 +45,116 @@ def pipeline_func(self, required_input: int, optional_input: int = 2): mock_obj = MockClass("./some/path") pipeline_job = mock_obj.pipeline_func(1, 2) - assert 'named_step' in pipeline_job.jobs - assert 'self' in pipeline_job.inputs - assert pipeline_job.inputs['self'].path == "./some/path" + assert "named_step" in pipeline_job.jobs + assert "self" in pipeline_job.inputs + assert pipeline_job.inputs["self"].path == "./some/path" + + def test_node_as_input_output(self): + component_yaml = components_dir / "helloworld_component.yml" + component_func = load_component(component_yaml) + + @dsl.pipeline + def base_pipeline_func(input_path: Input, input_number: float = 0.5): + node1 = component_func(component_in_path=input_path, component_in_number=input_number) + node2 = component_func( + component_in_path=node1.outputs["component_out_path"], + component_in_number=input_number, + ) + # return { + # 'component_out_path': node2.outputs['component_out_path'], + # } + + @dsl.pipeline + def pipeline_func(input_path: Input, input_number: float = 0.5): + node1 = component_func(component_in_path=input_path, component_in_number=input_number) + # single output node as node input + node2 = component_func( + component_in_path=node1, + component_in_number=input_number, + ) + # single output node as pipeline output + # return node2 + + base_pipeline_job = base_pipeline_func(Input(path="./tests/test_configs/data"), 0.5) + pipeline_job = pipeline_func(Input(path="./tests/test_configs/data"), 0.5) + pipeline_job.display_name = base_pipeline_job.display_name + assert ( + pipeline_job._to_rest_object().properties.as_dict() + == base_pipeline_job._to_rest_object().properties.as_dict() + ) + + def test_node_as_sub_pipeline_input(self): + component_yaml = components_dir / "helloworld_component.yml" + component_func = load_component(component_yaml) + + @dsl.pipeline + def sub_pipeline_func(input_path: Input, input_number: float = 0.5): + node1 = component_func(component_in_path=input_path, component_in_number=input_number) + node2 = component_func( + component_in_path=node1.outputs["component_out_path"], + component_in_number=input_number, + ) + return { + "component_out_path": node2.outputs["component_out_path"], + } + + @dsl.pipeline + def base_pipeline_func(input_path: Input, input_number: float = 0.5): + node1 = component_func(component_in_path=input_path, component_in_number=input_number) + node2 = sub_pipeline_func( + input_path=node1.outputs["component_out_path"], + input_number=input_number, + ) + # return { + # 'component_out_path': node2.outputs['component_out_path'], + # } + + @dsl.pipeline + def pipeline_func(input_path: Input, input_number: float = 0.5): + node1 = component_func(component_in_path=input_path, component_in_number=input_number) + # single output node as node input + node2 = sub_pipeline_func( + input_path=node1, + input_number=input_number, + ) + # single output node as pipeline output + # return node2 + + base_pipeline_job = base_pipeline_func(Input(path="./tests/test_configs/data"), 0.5) + pipeline_job = pipeline_func(Input(path="./tests/test_configs/data"), 0.5) + pipeline_job.display_name = base_pipeline_job.display_name + assert ( + pipeline_job._to_rest_object().properties.as_dict() + == base_pipeline_job._to_rest_object().properties.as_dict() + ) + + def test_node_as_sub_pipeline_input_error(self): + single_output_component_func = load_component(components_dir / "helloworld_component.yml") + multi_output_component_func = load_component(components_dir / "helloworld_component_multi_outputs.yml") + + @dsl.pipeline + def sub_pipeline_func(input_path: Input, input_number: float = 0.5): + node1 = single_output_component_func(component_in_path=input_path, component_in_number=input_number) + node2 = single_output_component_func( + component_in_path=node1.outputs["component_out_path"], + component_in_number=input_number, + ) + return { + "component_out_path": node2.outputs["component_out_path"], + } + + @dsl.pipeline + def pipeline_func(input_path: Input, input_number: float = 0.5): + node1 = multi_output_component_func(component_in_path=input_path, component_in_number=input_number) + # single output node as node input + node2 = sub_pipeline_func( + input_path=node1, + input_number=input_number, + ) + # single output node as pipeline output + # return node2 + + with pytest.raises( + ValueError, match="Provided input input_path is not a single output node, cannot be used as a node input." + ): + pipeline_func(Input(path="./tests/test_configs/data"), 0.5) diff --git a/sdk/ml/azure-ai-ml/tests/environment/e2etests/test_environment.py b/sdk/ml/azure-ai-ml/tests/environment/e2etests/test_environment.py index 3d0072ac3d7f..950bea06a234 100644 --- a/sdk/ml/azure-ai-ml/tests/environment/e2etests/test_environment.py +++ b/sdk/ml/azure-ai-ml/tests/environment/e2etests/test_environment.py @@ -142,20 +142,6 @@ def test_environment_create_or_update_docker_context_and_image( assert "Docker image or Dockerfile should be provided not both" in str(error.value) - def test_create_autoincrement(self, client: MLClient, env_name: Callable[[str], str]) -> None: - env = load_environment(source="./tests/test_configs/environment/environment_no_version.yml") - - env.name = env_name("name") - assert env.version is None - assert env._auto_increment_version - - created_env = client.environments.create_or_update(env) - assert created_env.version == "1" - assert created_env._auto_increment_version is False - - next_env_asset = client.environments.create_or_update(env) - assert next_env_asset._auto_increment_version is False - def test_environment_list(self, client: MLClient) -> None: environment_list = client._environments.list() assert environment_list diff --git a/sdk/ml/azure-ai-ml/tests/environment/unittests/test_env_entity.py b/sdk/ml/azure-ai-ml/tests/environment/unittests/test_env_entity.py index 0b07bf8f1541..71487decddbc 100644 --- a/sdk/ml/azure-ai-ml/tests/environment/unittests/test_env_entity.py +++ b/sdk/ml/azure-ai-ml/tests/environment/unittests/test_env_entity.py @@ -51,7 +51,7 @@ def test_rest_object(self) -> None: assert env == env_from_rest_object assert env.properties == env_from_rest_object.properties assert env != diff_env - + def test_conda_file_deserialize_and_serialize(self) -> None: # Tests that conda file is deserialized same way if using load_environment() or Environment() conda_file_path = "tests/test_configs/environment/environment_files/environment.yml" @@ -110,17 +110,17 @@ def test_anonymous_environment_version_changes_with_inference_config(self): inference_conf_obj = json.loads(inference_conf) env_no_inference_config = Environment( - conda_file=tests_root_dir / "test_configs/deployments/model-1/environment/conda.yml", - image="mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1" - ) + conda_file=tests_root_dir / "test_configs/deployments/model-1/environment/conda.yml", + image="mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1", + ) env_with_inference_config = Environment( - conda_file=tests_root_dir / "test_configs/deployments/model-1/environment/conda.yml", - image="mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1", - inference_config=inference_conf_obj - ) + conda_file=tests_root_dir / "test_configs/deployments/model-1/environment/conda.yml", + image="mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1", + inference_config=inference_conf_obj, + ) assert env_no_inference_config.name == env_no_inference_config.name == ANONYMOUS_ENV_NAME assert env_no_inference_config.version != env_with_inference_config.version assert env_no_inference_config.version == "71fccbc128a554b5c3e23330ded8963b" - assert env_with_inference_config.version == "f223fcd33d34c386cf763b856300f3ce" \ No newline at end of file + assert env_with_inference_config.version == "f223fcd33d34c386cf763b856300f3ce" diff --git a/sdk/ml/azure-ai-ml/tests/environment/unittests/test_environment_operations.py b/sdk/ml/azure-ai-ml/tests/environment/unittests/test_environment_operations.py index 33642516bf54..8a410c560468 100644 --- a/sdk/ml/azure-ai-ml/tests/environment/unittests/test_environment_operations.py +++ b/sdk/ml/azure-ai-ml/tests/environment/unittests/test_environment_operations.py @@ -13,8 +13,7 @@ from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationScope from azure.ai.ml.constants._common import ARM_ID_PREFIX from azure.ai.ml.entities._assets import Environment -from azure.ai.ml.operations import DatastoreOperations, EnvironmentOperations -from azure.ai.ml.operations._code_operations import CodeOperations +from azure.ai.ml.operations import EnvironmentOperations from azure.core.exceptions import ResourceNotFoundError @@ -23,13 +22,13 @@ def mock_environment_operation_reg( mock_registry_scope: OperationScope, mock_operation_config: OperationConfig, mock_aml_services_2021_10_01_dataplanepreview: Mock, - mock_machinelearning_client: Mock, + mock_machinelearning_registry_client: Mock, ) -> EnvironmentOperations: yield EnvironmentOperations( operation_scope=mock_registry_scope, operation_config=mock_operation_config, service_client=mock_aml_services_2021_10_01_dataplanepreview, - all_operations=mock_machinelearning_client._operation_container, + all_operations=mock_machinelearning_registry_client._operation_container, ) @@ -37,14 +36,14 @@ def mock_environment_operation_reg( def mock_environment_operation( mock_workspace_scope: OperationScope, mock_operation_config: OperationConfig, - mock_machinelearning_registry_client: Mock, + mock_machinelearning_client: Mock, mock_aml_services_2022_05_01: Mock, ) -> EnvironmentOperations: yield EnvironmentOperations( operation_scope=mock_workspace_scope, operation_config=mock_operation_config, service_client=mock_aml_services_2022_05_01, - all_operations=mock_machinelearning_registry_client._operation_container, + all_operations=mock_machinelearning_client._operation_container, ) diff --git a/sdk/ml/azure-ai-ml/tests/import_job/e2etests/test_import_job.py b/sdk/ml/azure-ai-ml/tests/import_job/e2etests/test_import_job.py index dc24e23e22e1..c6d1dcdf6b29 100644 --- a/sdk/ml/azure-ai-ml/tests/import_job/e2etests/test_import_job.py +++ b/sdk/ml/azure-ai-ml/tests/import_job/e2etests/test_import_job.py @@ -69,11 +69,7 @@ def check_before_cancel(_import_job: ImportJob) -> True: assert import_job_2.status in [JobStatus.COMPLETED, JobStatus.FAILED, JobStatus.RUNNING, JobStatus.STARTING] return True - import_job = assert_job_cancel( - job, - client, - check_before_cancelled=check_before_cancel - ) + import_job = assert_job_cancel(job, client, check_before_cancelled=check_before_cancel) assert import_job.type == JobType.IMPORT assert import_job.source.type == "azuresqldb" @@ -122,9 +118,7 @@ def sample_pipeline(): self.validate_test_import_pipepine_submit_cancel(pipeline, client, is_dsl=True) @classmethod - def validate_test_import_pipepine_submit_cancel( - cls, pipeline: PipelineJob, client: MLClient, is_dsl: bool - ) -> None: + def validate_test_import_pipepine_submit_cancel(cls, pipeline: PipelineJob, client: MLClient, is_dsl: bool) -> None: import_pipeline: PipelineJob = assert_job_cancel(job=pipeline, client=client) diff --git a/sdk/ml/azure-ai-ml/tests/internal/_utils.py b/sdk/ml/azure-ai-ml/tests/internal/_utils.py index 76db2aecd666..f7e972d89d82 100644 --- a/sdk/ml/azure-ai-ml/tests/internal/_utils.py +++ b/sdk/ml/azure-ai-ml/tests/internal/_utils.py @@ -185,10 +185,14 @@ ] # this is to shorten the test name -TEST_CASE_NAME_ENUMERATE = list(enumerate(map( - lambda params: Path(params[0]).name, - PARAMETERS_TO_TEST, -))) +TEST_CASE_NAME_ENUMERATE = list( + enumerate( + map( + lambda params: Path(params[0]).name, + PARAMETERS_TO_TEST, + ) + ) +) def get_expected_runsettings_items(runsettings_dict, client=None): @@ -208,11 +212,13 @@ def get_expected_runsettings_items(runsettings_dict, client=None): expected_values[dot_key] = "PT5M" # hack: compute_name for hdinsight will be transformed into arm str if dot_key == "compute_name" and client is not None: - expected_values[dot_key] = f"/subscriptions/{client.subscription_id}/" \ - f"resourceGroups/{client.resource_group_name}/" \ - f"providers/Microsoft.MachineLearningServices/" \ - f"workspaces/{client.workspace_name}/" \ - f"computes/{expected_values[dot_key]}" + expected_values[dot_key] = ( + f"/subscriptions/{client.subscription_id}/" + f"resourceGroups/{client.resource_group_name}/" + f"providers/Microsoft.MachineLearningServices/" + f"workspaces/{client.workspace_name}/" + f"computes/{expected_values[dot_key]}" + ) return expected_values.items() @@ -220,12 +226,12 @@ def get_expected_runsettings_items(runsettings_dict, client=None): ( "simple-command/powershell_copy.yaml", # Please DO NOT change the expected snapshot id unless you are sure you have changed the component spec - "75c43313-4777-b2e9-fe3a-3b98cabfaa77" + "75c43313-4777-b2e9-fe3a-3b98cabfaa77", ), ( "additional-includes/component_spec.yaml", # Please DO NOT change the expected snapshot id unless you are sure you have changed the component spec - "a0083afd-fee4-9c0d-65c2-ec75d0d5f048" + "1dc8271a-9184-df03-c9a5-afac8dcdcf26", ), # TODO(2076035): skip tests related to zip additional includes for now # ( diff --git a/sdk/ml/azure-ai-ml/tests/internal/e2etests/test_component.py b/sdk/ml/azure-ai-ml/tests/internal/e2etests/test_component.py index 9146820cd7c8..513b53082594 100644 --- a/sdk/ml/azure-ai-ml/tests/internal/e2etests/test_component.py +++ b/sdk/ml/azure-ai-ml/tests/internal/e2etests/test_component.py @@ -46,6 +46,7 @@ def load_registered_component( component_rest_object = component_entity._to_rest_object() return pydash.omit(component_rest_object.properties.component_spec, *omit_fields) + # previous bodiless_matcher fixture doesn't take effect because of typo, please add it in method level if needed @@ -93,7 +94,7 @@ def test_component_load( loaded_dict = load_registered_component(client, component_name, component_resource.version, omit_fields) base_dir = "./tests/test_configs/internal" - json_path = (yaml_path.rsplit(".", 1)[0] + ".json") + json_path = yaml_path.rsplit(".", 1)[0] + ".json" json_path = os.path.join(base_dir, "loaded_from_rest", os.path.relpath(json_path, base_dir)) os.makedirs(os.path.dirname(json_path), exist_ok=True) if not os.path.isfile(json_path): @@ -105,9 +106,7 @@ def test_component_load( # default value for datatransfer if expected_dict["type"] == "DataTransferComponent" and "datatransfer" not in expected_dict: - expected_dict["datatransfer"] = { - 'allow_overwrite': 'True' - } + expected_dict["datatransfer"] = {"allow_overwrite": "True"} # TODO: check if loaded environment is expected to be an ordered dict assert pydash.omit(loaded_dict, *omit_fields) == pydash.omit(expected_dict, *omit_fields) diff --git a/sdk/ml/azure-ai-ml/tests/internal/unittests/test_component.py b/sdk/ml/azure-ai-ml/tests/internal/unittests/test_component.py index 0034ba064fab..ddc51179811a 100644 --- a/sdk/ml/azure-ai-ml/tests/internal/unittests/test_component.py +++ b/sdk/ml/azure-ai-ml/tests/internal/unittests/test_component.py @@ -32,6 +32,7 @@ class AdditionalIncludesCheckFunc(enum.Enum): """Enum for additional includes check function""" + SKIP = 0 SELF_IS_FILE = 1 PARENT_EXISTS = 2 @@ -50,12 +51,15 @@ def test_load_v2_component(self): def test_validate_internal_component(self): yaml_path = r"./tests/test_configs/internal/component_with_code/component_spec.yaml" from azure.ai.ml.entities._validate_funcs import validate_component + validation_result = validate_component(yaml_path) assert validation_result.passed, repr(validation_result) def test_component_inputs_with_bool_and_date_value(self): - yaml_path = r"tests/test_configs/internal/command-component/command-linux/" \ - r"component_with_bool_and_data_input/component.yaml" + yaml_path = ( + r"tests/test_configs/internal/command-component/command-linux/" + r"component_with_bool_and_data_input/component.yaml" + ) component = load_component(yaml_path) assert component.inputs["bool_input"].default == "true" assert component.inputs["enum_input"].default == "true" @@ -159,12 +163,12 @@ def test_load_from_registered_internal_scope_component_rest_obj(self): "inputs": { "TextData": { "type": "AnyFile", - 'optional': False, + "optional": False, "description": "relative path on ADLS storage", }, "ExtractionClause": { "type": "string", - 'optional': False, + "optional": False, "description": 'the extraction clause,something like "column1:string, column2:int"', }, }, @@ -221,11 +225,22 @@ def test_component_serialization(self, yaml_path): for input_port_name in expected_dict.get("inputs", {}): input_port = expected_dict["inputs"][input_port_name] # enum will be transformed to string - if isinstance(input_port["type"], str) and input_port["type"].lower() in ["string", "enum", "float", "integer"]: + if isinstance(input_port["type"], str) and input_port["type"].lower() in [ + "string", + "enum", + "float", + "integer", + ]: if "enum" in input_port: - input_port["enum"] = list(map(lambda x: str(x).lower() if isinstance(x, bool) else str(x), input_port["enum"])) + input_port["enum"] = list( + map(lambda x: str(x).lower() if isinstance(x, bool) else str(x), input_port["enum"]) + ) if "default" in input_port: - input_port["default"] = str(input_port["default"]).lower() if isinstance(input_port["default"], bool) else str(input_port["default"]) + input_port["default"] = ( + str(input_port["default"]).lower() + if isinstance(input_port["default"], bool) + else str(input_port["default"]) + ) # code will be dumped as absolute path if "code" in expected_dict: @@ -251,7 +266,7 @@ def test_component_serialization(self, yaml_path): [ ("preview_command_component.yaml", "1-preview"), ("legacy_distributed_component.yaml", "1-legacy"), - ] + ], ) def test_command_mode_command_component(self, yaml_path: str, label: str): component = load_component("./tests/test_configs/internal/command-mode/{}".format(yaml_path)) @@ -389,8 +404,16 @@ def test_additional_includes(self) -> None: [ pytest.param( [ - ("component_with_additional_includes/.amlignore", "test_ignore/*\nlibrary1/ignore.py", AdditionalIncludesCheckFunc.SELF_IS_FILE), - ("component_with_additional_includes/test_ignore/a.py", None, AdditionalIncludesCheckFunc.NO_PARENT), + ( + "component_with_additional_includes/.amlignore", + "test_ignore/*\nlibrary1/ignore.py", + AdditionalIncludesCheckFunc.SELF_IS_FILE, + ), + ( + "component_with_additional_includes/test_ignore/a.py", + None, + AdditionalIncludesCheckFunc.NO_PARENT, + ), # will be saved to library1/ignore.py, should be ignored ("additional_includes/library1/ignore.py", None, AdditionalIncludesCheckFunc.NOT_EXISTS), # will be saved to library1/ignore.py/a.py, should be ignored @@ -404,9 +427,21 @@ def test_additional_includes(self) -> None: pytest.param( [ # additional_includes for other spec, should be kept - ("component_with_additional_includes/x.additional_includes", None, AdditionalIncludesCheckFunc.SELF_IS_FILE), - ("additional_includes/library1/x.additional_includes", None, AdditionalIncludesCheckFunc.SELF_IS_FILE), - ("additional_includes/library1/test/x.additional_includes", None, AdditionalIncludesCheckFunc.SELF_IS_FILE), + ( + "component_with_additional_includes/x.additional_includes", + None, + AdditionalIncludesCheckFunc.SELF_IS_FILE, + ), + ( + "additional_includes/library1/x.additional_includes", + None, + AdditionalIncludesCheckFunc.SELF_IS_FILE, + ), + ( + "additional_includes/library1/test/x.additional_includes", + None, + AdditionalIncludesCheckFunc.SELF_IS_FILE, + ), # additional_includes in a different level, should be kept ( "component_with_additional_includes/library2/helloworld_additional_includes.additional_includes", @@ -430,17 +465,32 @@ def test_additional_includes(self) -> None: pytest.param( [ ("component_with_additional_includes/hello.py", None, AdditionalIncludesCheckFunc.SELF_IS_FILE), - ("component_with_additional_includes/test_code/.amlignore", "hello.py", AdditionalIncludesCheckFunc.SELF_IS_FILE), - ("component_with_additional_includes/test_code/hello.py", None, AdditionalIncludesCheckFunc.NOT_EXISTS), + ( + "component_with_additional_includes/test_code/.amlignore", + "hello.py", + AdditionalIncludesCheckFunc.SELF_IS_FILE, + ), + ( + "component_with_additional_includes/test_code/hello.py", + None, + AdditionalIncludesCheckFunc.NOT_EXISTS, + ), # shall we keep the empty folder? - ("component_with_additional_includes/test_code/a/hello.py", None, AdditionalIncludesCheckFunc.NO_PARENT), + ( + "component_with_additional_includes/test_code/a/hello.py", + None, + AdditionalIncludesCheckFunc.NO_PARENT, + ), ], id="amlignore_subfolder", ), pytest.param( [ - ("additional_includes/library1/.amlignore", "test_ignore\nignore.py", - AdditionalIncludesCheckFunc.SELF_IS_FILE), + ( + "additional_includes/library1/.amlignore", + "test_ignore\nignore.py", + AdditionalIncludesCheckFunc.SELF_IS_FILE, + ), # will be saved to library1/ignore.py, should be ignored ("additional_includes/library1/ignore.py", None, AdditionalIncludesCheckFunc.NOT_EXISTS), # will be saved to library1/ignore.py/a.py, should be ignored @@ -453,38 +503,57 @@ def test_additional_includes(self) -> None: ), pytest.param( [ - ("additional_includes/library1/test_ignore/.amlignore", "ignore.py", - AdditionalIncludesCheckFunc.SELF_IS_FILE), + ( + "additional_includes/library1/test_ignore/.amlignore", + "ignore.py", + AdditionalIncludesCheckFunc.SELF_IS_FILE, + ), # will be saved to library1/ignore.py, should be ignored - ("additional_includes/library1/test_ignore/ignore.py", None, AdditionalIncludesCheckFunc.NOT_EXISTS), ( - "additional_includes/library1/test_ignore/ignore.py", None, AdditionalIncludesCheckFunc.NOT_EXISTS), + "additional_includes/library1/test_ignore/ignore.py", + None, + AdditionalIncludesCheckFunc.NOT_EXISTS, + ), + ( + "additional_includes/library1/test_ignore/ignore.py", + None, + AdditionalIncludesCheckFunc.NOT_EXISTS, + ), ], id="amlignore_in_additional_includes_subfolder", ), pytest.param( [ - ("component_with_additional_includes/__pycache__/a.pyc", None, - AdditionalIncludesCheckFunc.NO_PARENT), - ("component_with_additional_includes/test/__pycache__/a.pyc", None, - AdditionalIncludesCheckFunc.NO_PARENT), + ( + "component_with_additional_includes/__pycache__/a.pyc", + None, + AdditionalIncludesCheckFunc.NO_PARENT, + ), + ( + "component_with_additional_includes/test/__pycache__/a.pyc", + None, + AdditionalIncludesCheckFunc.NO_PARENT, + ), ("additional_includes/library1/__pycache__/a.pyc", None, AdditionalIncludesCheckFunc.NO_PARENT), - ("additional_includes/library1/test/__pycache__/a.pyc", None, AdditionalIncludesCheckFunc.NO_PARENT), + ( + "additional_includes/library1/test/__pycache__/a.pyc", + None, + AdditionalIncludesCheckFunc.NO_PARENT, + ), ], id="pycache", ), - ] + ], ) def test_additional_includes_advanced(self, test_files) -> None: with build_temp_folder( source_base_dir="./tests/test_configs/internal/", - relative_dirs_to_copy=[ - "component_with_additional_includes", - "additional_includes" - ], - extra_files_to_create={file: content for file, content, _ in test_files} + relative_dirs_to_copy=["component_with_additional_includes", "additional_includes"], + extra_files_to_create={file: content for file, content, _ in test_files}, ) as test_configs_dir: - yaml_path = Path(test_configs_dir) / "component_with_additional_includes" / "helloworld_additional_includes.yml" + yaml_path = ( + Path(test_configs_dir) / "component_with_additional_includes" / "helloworld_additional_includes.yml" + ) component: InternalComponent = load_component(source=yaml_path) @@ -563,8 +632,9 @@ def test_additional_includes_with_code_specified(self, yaml_path: str, has_addit assert code_path.resolve() == specified_code_path.resolve() def test_docker_file_in_additional_includes(self): - yaml_path = "./tests/test_configs/internal/component_with_dependency_" \ - "in_additional_includes/with_docker_file.yml" + yaml_path = ( + "./tests/test_configs/internal/component_with_dependency_" "in_additional_includes/with_docker_file.yml" + ) docker_file_path = "./tests/test_configs/internal/additional_includes/docker/DockerFile" with open(docker_file_path, "r") as docker_file: @@ -584,8 +654,9 @@ def test_docker_file_in_additional_includes(self): } def test_conda_pip_in_additional_includes(self): - yaml_path = "./tests/test_configs/internal/component_with_dependency_" \ - "in_additional_includes/with_conda_pip.yml" + yaml_path = ( + "./tests/test_configs/internal/component_with_dependency_" "in_additional_includes/with_conda_pip.yml" + ) conda_file_path = "./tests/test_configs/internal/env-conda-dependencies/conda.yaml" with open(conda_file_path, "r") as conda_file: @@ -616,27 +687,42 @@ def mock_get_artifacts(**kwargs): (artifact / f"file_{version}").touch(exist_ok=True) return str(artifact) - mocker.patch("azure.ai.ml._internal.entities._artifact_cache.ArtifactCache.get", - side_effect=mock_get_artifacts) + mocker.patch( + "azure.ai.ml._internal.entities._artifact_cache.ArtifactCache.get", side_effect=mock_get_artifacts + ) from azure.ai.ml._internal.entities._artifact_cache import ArtifactCache + yaml_path = "./tests/test_configs/internal/component_with_additional_includes/with_artifacts.yml" component: InternalComponent = load_component(source=yaml_path) assert component._validate().passed, repr(component._validate()) with component._resolve_local_code() as code: code_path = code.path assert code_path.is_dir() - for path in ['version_1/', 'version_1/file', 'version_2/', 'version_2/file', - 'file_version_1', 'file_version_2', 'DockerFile']: + for path in [ + "version_1/", + "version_1/file", + "version_2/", + "version_2/file", + "file_version_1", + "file_version_2", + "DockerFile", + ]: assert (code_path / path).exists() - yaml_path = "./tests/test_configs/internal/component_with_additional_includes/" \ - "artifacts_additional_includes_with_conflict.yml" + yaml_path = ( + "./tests/test_configs/internal/component_with_additional_includes/" + "artifacts_additional_includes_with_conflict.yml" + ) component: InternalComponent = load_component(source=yaml_path) validation_result = component._validate() assert validation_result.passed is False assert "There are conflict files in additional include" in validation_result.error_messages["*"] - assert 'test_additional_include:version_1 in component-sdk-test-feed' in validation_result.error_messages["*"] - assert 'test_additional_include:version_3 in component-sdk-test-feed' in validation_result.error_messages["*"] + assert ( + "test_additional_include:version_1 in component-sdk-test-feed" in validation_result.error_messages["*"] + ) + assert ( + "test_additional_include:version_3 in component-sdk-test-feed" in validation_result.error_messages["*"] + ) @pytest.mark.parametrize( "yaml_path,expected_error_msg_prefix", @@ -713,13 +799,13 @@ def test_component_input_with_attrs(self) -> None: "param_string_with_quote_yes_value": {"default": "yes", "type": "string"}, }, "outputs": { - 'output_data_path': { - 'datastore_mode': 'mount', - 'description': 'Path to the data', - 'is_link_mode': True, - 'type': 'path' + "output_data_path": { + "datastore_mode": "mount", + "description": "Path to the data", + "is_link_mode": True, + "type": "path", } - } + }, } assert component._to_rest_object().properties.component_spec["inputs"] == expected_inputs["inputs"] assert component._to_rest_object().properties.component_spec["outputs"] == expected_inputs["outputs"] @@ -737,12 +823,12 @@ def test_component_output_with_attrs(self) -> None: expected_outputs = { "path_with_optional": { # unknown field optional will be ignored - "type": 'AnyDirectory', + "type": "AnyDirectory", }, "primitive_is_control": { "is_control": True, "type": "boolean", - } + }, } assert component._to_rest_object().properties.component_spec["outputs"] == expected_outputs assert component._validate().passed is True, repr(component._validate()) @@ -785,8 +871,7 @@ def test_anonymous_component_reuse(self, relative_yaml_path: str, expected_snaps code.name = expected_snapshot_id with pytest.raises( - AttributeError, - match="InternalCode name are calculated based on its content and cannot be changed.*" + AttributeError, match="InternalCode name are calculated based on its content and cannot be changed.*" ): code.name = expected_snapshot_id + "1" @@ -794,8 +879,7 @@ def test_snapshot_id_calculation(self): origin_test_configs_dir = Path("./tests/test_configs/internal/") with tempfile.TemporaryDirectory() as test_configs_dir: shutil.copytree( - origin_test_configs_dir / "component-reuse/simple-command", - Path(test_configs_dir) / "simple-command" + origin_test_configs_dir / "component-reuse/simple-command", Path(test_configs_dir) / "simple-command" ) yaml_path = Path(test_configs_dir) / "simple-command" / "powershell_copy.yaml" @@ -817,34 +901,19 @@ def test_component_serialization_corner_case(self): assert component rest_object = component._to_rest_object() assert rest_object.properties.component_spec == { - '$schema': 'https://componentsdk.azureedge.net/jsonschema/CommandComponent.json', - '_source': 'YAML.COMPONENT', - 'command': 'echo {inputs.input_float} && echo {inputs.delimiter}', - 'display_name': 'Hello Command', - 'environment': {'name': 'AzureML-Designer', 'os': 'Linux'}, - 'inputs': { - 'input_float': { - 'default': '1', # previously this is 1.0 - 'optional': False, - 'type': 'Float' - }, - 'input_boolean': { - 'default': 'False', - 'optional': False, - 'type': 'Boolean' - }, - 'delimiter': { - 'default': '\t', - 'optional': True, - 'type': 'String' - }, + "$schema": "https://componentsdk.azureedge.net/jsonschema/CommandComponent.json", + "_source": "YAML.COMPONENT", + "command": "echo {inputs.input_float} && echo {inputs.delimiter}", + "display_name": "Hello Command", + "environment": {"name": "AzureML-Designer", "os": "Linux"}, + "inputs": { + "input_float": {"default": "1", "optional": False, "type": "Float"}, # previously this is 1.0 + "input_boolean": {"default": "False", "optional": False, "type": "Boolean"}, + "delimiter": {"default": "\t", "optional": True, "type": "String"}, }, - 'is_deterministic': True, - 'name': 'hello_command', - 'type': 'CommandComponent', - 'version': '0.10', # previously this is 0.1 - "datatransfer": { - "cloud_type": "aether" - } + "is_deterministic": True, + "name": "hello_command", + "type": "CommandComponent", + "version": "0.10", # previously this is 0.1 + "datatransfer": {"cloud_type": "aether"}, } - diff --git a/sdk/ml/azure-ai-ml/tests/internal/unittests/test_pipeline_job.py b/sdk/ml/azure-ai-ml/tests/internal/unittests/test_pipeline_job.py index 52d444e94962..aea328d81b90 100644 --- a/sdk/ml/azure-ai-ml/tests/internal/unittests/test_pipeline_job.py +++ b/sdk/ml/azure-ai-ml/tests/internal/unittests/test_pipeline_job.py @@ -280,9 +280,7 @@ def test_gjd_internal_component_in_pipeline(self): } def test_elastic_component_in_pipeline(self): - yaml_path = ( - "./tests/test_configs/internal/command-component-ls/ls_command_component.yaml" # itp & elastic are based on CommandComponent - ) + yaml_path = "./tests/test_configs/internal/command-component-ls/ls_command_component.yaml" # itp & elastic are based on CommandComponent node_func: CommandComponent = load_component(yaml_path) node = node_func() configuration = ITPConfiguration( @@ -337,9 +335,7 @@ def test_elastic_component_in_pipeline(self): } def test_singularity_component_in_pipeline(self): - yaml_path = ( - "./tests/test_configs/internal/command-component-ls/ls_command_component.yaml" # singularity is based on CommandComponent - ) + yaml_path = "./tests/test_configs/internal/command-component-ls/ls_command_component.yaml" # singularity is based on CommandComponent node_func: CommandComponent = load_component(yaml_path) node = node_func() configuration = AISuperComputerConfiguration( @@ -567,6 +563,7 @@ def pipeline_func(compute_name: str = "cpu-cluster", environment_name: str = "Az ) node.compute = compute_name node.environment = environment_name + pipeline_job = pipeline_func() assert pipeline_job._validate().passed, repr(pipeline_job._validate()) rest_object = pipeline_job._to_rest_object().properties.jobs["node"] diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/e2etests/test_upload_download.py b/sdk/ml/azure-ai-ml/tests/internal_utils/e2etests/test_upload_download.py index 981da3eaaa72..91f05acc20ed 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/e2etests/test_upload_download.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/e2etests/test_upload_download.py @@ -90,10 +90,7 @@ def artifact_path_dir(tmpdir_factory, variable_recorder) -> str: # type: ignore @pytest.mark.e2etest @pytest.mark.usefixtures("recorded_test") -@pytest.mark.skipif( - condition=not is_live(), - reason="test are flaky in playback" -) +@pytest.mark.skipif(condition=not is_live(), reason="test are flaky in playback") @pytest.mark.core_sdk_test class TestUpload(AzureRecordedTestCase): def test_upload_file_blob( diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cache_utils.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cache_utils.py index b9c1fab95938..949ed5fde1d7 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cache_utils.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cache_utils.py @@ -76,4 +76,4 @@ def test_on_disk_cache_share_among_users(self, mock_machinelearning_client: MLCl self.register_target_node_and_resolve(resolver) assert target_cache_path.exists() - assert stat.filemode(target_cache_path.stat().st_mode) == '-rw-rw-rw-' + assert stat.filemode(target_cache_path.stat().st_mode) == "-rw-rw-rw-" diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py index 93f0df644dee..9666e937e13d 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py @@ -15,52 +15,46 @@ _get_storage_endpoint_from_metadata, _set_cloud, ) -from azure.ai.ml.constants._common import ArmConstants, AZUREML_CLOUD_ENV_NAME +from azure.ai.ml.constants._common import ArmConstants, AZUREML_CLOUD_ENV_NAME from azure.mgmt.core import ARMPipelineClient + def mocked_send_request_get(*args, **kwargs): class MockResponse: def __init__(self): self.status_code = 201 + def __enter__(self): return self + def __exit__(self, exc_type, exc_value, traceback): return + def json(self): return [ { - "name": "TEST_ENV", - "portal": "testportal.azure.com", + "name": "TEST_ENV", + "portal": "testportal.azure.com", "resourceManager": "testresourcemanager.azure.com", - "authentication": { - "loginEndpoint": "testdirectoryendpoint.azure.com" - }, - "suffixes": { - "storage": "teststorageendpoint" - } + "authentication": {"loginEndpoint": "testdirectoryendpoint.azure.com"}, + "suffixes": {"storage": "teststorageendpoint"}, }, { - "name": "TEST_ENV2", - "portal": "testportal.azure.windows.net", + "name": "TEST_ENV2", + "portal": "testportal.azure.windows.net", "resourceManager": "testresourcemanager.azure.com", - "authentication": { - "loginEndpoint": "testdirectoryendpoint.azure.com" - }, - "suffixes": { - "storage": "teststorageendpoint" - } + "authentication": {"loginEndpoint": "testdirectoryendpoint.azure.com"}, + "suffixes": {"storage": "teststorageendpoint"}, }, - { - "name": "MISCONFIGURED" - } + {"name": "MISCONFIGURED"}, ] + return MockResponse() @pytest.mark.unittest @pytest.mark.core_sdk_test class TestCloudEnvironments: - @mock.patch.dict(os.environ, {AZUREML_CLOUD_ENV_NAME: AzureEnvironments.ENV_DEFAULT}, clear=True) def test_set_valid_cloud_details_china(self): cloud_environment = AzureEnvironments.ENV_CHINA @@ -112,13 +106,13 @@ def test_get_default_cloud(self): with mock.patch("os.environ", {AZUREML_CLOUD_ENV_NAME: "yadadada"}): cloud_name = _get_default_cloud_name() assert cloud_name == "yadadada" - + def test_get_registry_endpoint_from_public(self): cloud_environment = AzureEnvironments.ENV_DEFAULT _set_cloud(cloud_environment) base_url = _get_registry_discovery_endpoint_from_metadata(cloud_environment) assert "https://eastus.api.azureml.ms/" in base_url - + def test_get_registry_endpoint_from_china(self): cloud_environment = AzureEnvironments.ENV_CHINA _set_cloud(cloud_environment) @@ -134,8 +128,8 @@ def test_get_registry_endpoint_from_us_gov(self): @mock.patch.dict(os.environ, {}, clear=True) @mock.patch("azure.mgmt.core.ARMPipelineClient.send_request", side_effect=mocked_send_request_get) def test_get_cloud_from_arm(self, mock_arm_pipeline_client_send_request): - - _set_cloud('TEST_ENV') + + _set_cloud("TEST_ENV") cloud_details = _get_cloud_information_from_metadata("TEST_ENV") assert cloud_details.get("cloud") == "TEST_ENV" @@ -143,7 +137,7 @@ def test_get_cloud_from_arm(self, mock_arm_pipeline_client_send_request): @mock.patch("azure.mgmt.core.ARMPipelineClient.send_request", side_effect=mocked_send_request_get) def test_all_endpointurls_used(self, mock_get): cloud_details = _get_cloud_details("TEST_ENV") - endpoint_urls = [a for a in dir(EndpointURLS) if not a.startswith('__')] + endpoint_urls = [a for a in dir(EndpointURLS) if not a.startswith("__")] for url in endpoint_urls: try: cloud_details[EndpointURLS.__dict__[url]] @@ -155,8 +149,11 @@ def test_all_endpointurls_used(self, mock_get): @mock.patch("azure.mgmt.core.ARMPipelineClient.send_request", side_effect=mocked_send_request_get) def test_metadata_registry_endpoint(self, mock_get): cloud_details = _get_cloud_details("TEST_ENV2") - assert cloud_details.get(EndpointURLS.REGISTRY_DISCOVERY_ENDPOINT) == "https://test_env2west.api.azureml.windows.net/" - + assert ( + cloud_details.get(EndpointURLS.REGISTRY_DISCOVERY_ENDPOINT) + == "https://test_env2west.api.azureml.windows.net/" + ) + @mock.patch.dict(os.environ, {}, clear=True) @mock.patch("azure.mgmt.core.ARMPipelineClient.send_request", side_effect=mocked_send_request_get) def test_arm_misconfigured(self, mock_get): diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_ml_client.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_ml_client.py index d734e7c3f805..a1e78f481e5e 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_ml_client.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_ml_client.py @@ -421,7 +421,9 @@ def test_ml_client_with_invalid_cloud(self, mock_credential): assert ml_client._kwargs["cloud"] == "SomeInvalidCloudName" assert "Unknown cloud environment supplied" in str(e) - def test_ml_client_with_both_workspace_registry_names_throws(self, e2e_ws_scope: OperationScope, auth: ClientSecretCredential) -> None: + def test_ml_client_with_both_workspace_registry_names_throws( + self, e2e_ws_scope: OperationScope, auth: ClientSecretCredential + ) -> None: with pytest.raises(ValidationException) as exception: MLClient( credential=auth, @@ -429,7 +431,4 @@ def test_ml_client_with_both_workspace_registry_names_throws(self, e2e_ws_scope: registry_name="testfeed", ) message = exception.value.args[0] - assert ( - message - == "Both workspace_name and registry_name cannot be used together, for the ml_client." - ) + assert message == "Both workspace_name and registry_name cannot be used together, for the ml_client." diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_operation_orchestrator.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_operation_orchestrator.py index 601d9104fa60..cd16e1b25bc3 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_operation_orchestrator.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_operation_orchestrator.py @@ -187,8 +187,8 @@ def create_yaml_inline_model(tmp_path: Path, resource_group_name: str) -> Path: @pytest.mark.core_sdk_test class TestOperationOrchestration: def test_registry_environment(self, operation_orchestrator: OperationOrchestrator) -> None: - test_input = '//registries/my-registry/environments/conda_name_version_e2e/versions/1.0.2' - expected = 'azureml://registries/my-registry/environments/conda_name_version_e2e/versions/1.0.2' + test_input = "//registries/my-registry/environments/conda_name_version_e2e/versions/1.0.2" + expected = "azureml://registries/my-registry/environments/conda_name_version_e2e/versions/1.0.2" actual = operation_orchestrator.get_asset_arm_id(test_input, azureml_type=AzureMLResourceType.ENVIRONMENT) assert actual == expected @@ -197,8 +197,10 @@ def test_get_asset_arm_id_when_model_already_created(self, operation_orchestrato model = Model(id=test_id, name="some_name", version="1") actual = operation_orchestrator.get_asset_arm_id(model, azureml_type=AzureMLResourceType.MODEL) assert actual == test_id - - def test_get_asset_arm_id_when_environment_already_created(self, operation_orchestrator: OperationOrchestrator) -> None: + + def test_get_asset_arm_id_when_environment_already_created( + self, operation_orchestrator: OperationOrchestrator + ) -> None: test_id = "azureml://registries/my-registry/environments/env-base/versions/1" environment = Environment(id=test_id, name="some_name", version="1") actual = operation_orchestrator.get_asset_arm_id(environment, azureml_type=AzureMLResourceType.ENVIRONMENT) diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_persistent_locals.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_persistent_locals.py index aa6fd038fb10..4db1d36ece0e 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_persistent_locals.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_persistent_locals.py @@ -2,8 +2,10 @@ import pytest -from azure.ai.ml._utils._func_utils import PersistentLocalsFunctionBytecodeBuilder, \ - PersistentLocalsFunctionProfilerBuilder +from azure.ai.ml._utils._func_utils import ( + PersistentLocalsFunctionBytecodeBuilder, + PersistentLocalsFunctionProfilerBuilder, +) class MockClass: @@ -47,12 +49,12 @@ def mock_function(mock_arg): outputs, _locals = self.get_outputs_and_locals(mock_function, {"mock_arg": 1}) assert outputs == (1, 1) - assert set(_locals.keys()) == {'mock_arg', 'mock_local_variable'} + assert set(_locals.keys()) == {"mock_arg", "mock_local_variable"} def test_func_with_named_self_argument(self): outputs, _locals = self.get_outputs_and_locals(mock_function_with_self, {"self": 1}) assert outputs == 1 - assert set(_locals.keys()) == {'self'} + assert set(_locals.keys()) == {"self"} def test_raise_exception(self): def mock_error_exception(): @@ -66,28 +68,28 @@ def test_instance_func(self): mock_obj = MockClass(1) outputs, _locals = self.get_outputs_and_locals(mock_obj.mock_instance_func, {"arg": 1}) assert outputs == 2 - assert set(_locals.keys()) == {'result', 'arg', 'self'} + assert set(_locals.keys()) == {"result", "arg", "self"} def test_class_method(self): mock_obj = MockClass(1) outputs, _locals = self.get_outputs_and_locals(mock_obj.mock_class_method, {"arg": 1}) assert outputs == 3 - assert set(_locals.keys()) == {'result', 'arg', 'cls'} + assert set(_locals.keys()) == {"result", "arg", "cls"} def test_instance_call(self): mock_obj = MockClass(1) outputs, _locals = self.get_outputs_and_locals(mock_obj, {"arg": 1}) assert outputs == 2 - assert set(_locals.keys()) == {'result', 'arg', 'self'} + assert set(_locals.keys()) == {"result", "arg", "self"} def test_invalid_passed_func(self): - with pytest.raises(TypeError, match='func must be a function or a callable object'): + with pytest.raises(TypeError, match="func must be a function or a callable object"): self.get_outputs_and_locals(1, {"arg": 1}) def test_param_conflict(self): with pytest.raises( ValueError, - match=re.escape('Injected param name __self conflicts with function args [\'__self\']'), + match=re.escape("Injected param name __self conflicts with function args ['__self']"), ): self.get_outputs_and_locals(mock_conflict_function, {"arg": 1}) @@ -100,6 +102,8 @@ def get_outputs_and_locals(self, func, injected_params): import bytecode except ImportError: import subprocess - subprocess.check_call(['pip', 'install', 'bytecode']) + + subprocess.check_call(["pip", "install", "bytecode"]) import bytecode + return PersistentLocalsFunctionBytecodeBuilder().call(func, injected_params) diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_storage_utils.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_storage_utils.py index 7a09a6161d01..4b1a71cf86fd 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_storage_utils.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_storage_utils.py @@ -1,4 +1,3 @@ - import pytest from azure.ai.ml._utils._storage_utils import get_ds_name_and_path_prefix @@ -10,36 +9,35 @@ def test_storage_uri_to_prefix( self, ) -> None: # These are the asset storage patterns supported for download - reg_uri_1 = 'https://ccccccccddddd345.blob.core.windows.net/demoregist-16d33653-20bf-549b-a3c1-17d975359581/ExperimentRun/dcid.5823bbb4-bb28-497c-b9f2-1ff3a0778b10/model' - reg_uri_2 = 'https://ccccccccccc1978ccc.blob.core.windows.net/demoregist-b46fb119-d3f8-5994-a971-a9c730227846/LocalUpload/0c225a0230907e61c00ea33eac35a54d/model.pkl' - reg_uri_3 = 'https://ccccccccddr546ddd.blob.core.windows.net/some-reg-9717e928-33c2-50c2-90f5-f410b12b8727/sklearn_regression_model.pkl' - workspace_uri_1 = 'azureml://subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/000000000000000/workspaces/some_test_3/datastores/workspaceblobstore/paths/LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model' - - assert get_ds_name_and_path_prefix(reg_uri_1, "registry_name") == (None,'ExperimentRun/dcid.5823bbb4-bb28-497c-b9f2-1ff3a0778b10/model') - assert get_ds_name_and_path_prefix(reg_uri_2, "registry_name") == (None, 'LocalUpload/0c225a0230907e61c00ea33eac35a54d/model.pkl') - assert get_ds_name_and_path_prefix(reg_uri_3, "registry_name") == (None, 'sklearn_regression_model.pkl') - assert get_ds_name_and_path_prefix(workspace_uri_1) == ('workspaceblobstore','LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model') + reg_uri_1 = "https://ccccccccddddd345.blob.core.windows.net/demoregist-16d33653-20bf-549b-a3c1-17d975359581/ExperimentRun/dcid.5823bbb4-bb28-497c-b9f2-1ff3a0778b10/model" + reg_uri_2 = "https://ccccccccccc1978ccc.blob.core.windows.net/demoregist-b46fb119-d3f8-5994-a971-a9c730227846/LocalUpload/0c225a0230907e61c00ea33eac35a54d/model.pkl" + reg_uri_3 = "https://ccccccccddr546ddd.blob.core.windows.net/some-reg-9717e928-33c2-50c2-90f5-f410b12b8727/sklearn_regression_model.pkl" + workspace_uri_1 = "azureml://subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/000000000000000/workspaces/some_test_3/datastores/workspaceblobstore/paths/LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model" + + assert get_ds_name_and_path_prefix(reg_uri_1, "registry_name") == ( + None, + "ExperimentRun/dcid.5823bbb4-bb28-497c-b9f2-1ff3a0778b10/model", + ) + assert get_ds_name_and_path_prefix(reg_uri_2, "registry_name") == ( + None, + "LocalUpload/0c225a0230907e61c00ea33eac35a54d/model.pkl", + ) + assert get_ds_name_and_path_prefix(reg_uri_3, "registry_name") == (None, "sklearn_regression_model.pkl") + assert get_ds_name_and_path_prefix(workspace_uri_1) == ( + "workspaceblobstore", + "LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model", + ) - def test_storage_uri_to_prefix_malformed( self, ) -> None: - reg_uri_bad = 'https://ccccccccddd4512d.blob.core.windows.net/5823bbb4-bb28-497c-b9f2-1ff3a0778b10' - workspace_uri_bad = 'azureml://subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/000000000000000/workspaces/some_test_3/datastores/workspaceblobstore/path/LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model' + reg_uri_bad = "https://ccccccccddd4512d.blob.core.windows.net/5823bbb4-bb28-497c-b9f2-1ff3a0778b10" + workspace_uri_bad = "azureml://subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/000000000000000/workspaces/some_test_3/datastores/workspaceblobstore/path/LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model" with pytest.raises(Exception) as e: get_ds_name_and_path_prefix(reg_uri_bad, "registry_name") - assert ( - 'Registry asset URI could not be parsed.' - in str(e.value) - ) + assert "Registry asset URI could not be parsed." in str(e.value) with pytest.raises(Exception) as e: get_ds_name_and_path_prefix(workspace_uri_bad) - assert ( - 'Workspace asset URI could not be parsed.' - in str(e.value) - ) - - - \ No newline at end of file + assert "Workspace asset URI could not be parsed." in str(e.value) diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_utils.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_utils.py index 2d3a9ce9fc0d..2be815c7df65 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_utils.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_utils.py @@ -81,6 +81,7 @@ def test_open_with_int_mode(self): def get_int_mode(file_path: str) -> str: int_mode = os.stat(file_path).st_mode & 0o777 return oct(int_mode) + with tempfile.TemporaryDirectory() as temp_dir: target_file_path = temp_dir + "/test.txt" with open(target_file_path, "w") as f: @@ -103,7 +104,7 @@ def test_get_valid_dot_keys_with_wildcard(self): "l1_2": { "l2": 3, }, - } + }, } assert get_valid_dot_keys_with_wildcard(root, "simple") == ["simple"] assert get_valid_dot_keys_with_wildcard(root, "deep.l1.l2") == ["deep.l1.l2"] diff --git a/sdk/ml/azure-ai-ml/tests/job_common/unittests/test_job_operations.py b/sdk/ml/azure-ai-ml/tests/job_common/unittests/test_job_operations.py index d8f949dc92a4..847a8a7c38b0 100644 --- a/sdk/ml/azure-ai-ml/tests/job_common/unittests/test_job_operations.py +++ b/sdk/ml/azure-ai-ml/tests/job_common/unittests/test_job_operations.py @@ -189,14 +189,16 @@ def test_user_identity_get_aml_token(self, mock_method, mock_job_operation: JobO with patch.object(mock_job_operation._credential, "get_token") as mock_get_token: mock_get_token.return_value = AccessToken( - token=jwt.encode({"aud": aml_resource_id}, key="utf-8"), expires_on=1234) + token=jwt.encode({"aud": aml_resource_id}, key="utf-8"), expires_on=1234 + ) mock_job_operation.create_or_update(job=job) mock_job_operation._operation_2022_12_preview.create_or_update.assert_called_once() mock_job_operation._credential.get_token.assert_called_once_with(azure_ml_scopes[0]) with patch.object(mock_job_operation._credential, "get_token") as mock_get_token: mock_get_token.return_value = AccessToken( - token=jwt.encode({"aud": "https://management.azure.com"}, key="utf-8"), expires_on=1234) + token=jwt.encode({"aud": "https://management.azure.com"}, key="utf-8"), expires_on=1234 + ) with pytest.raises(Exception): mock_job_operation.create_or_update(job=job) diff --git a/sdk/ml/azure-ai-ml/tests/local_endpoint/unittests/test_local_endpoint_validator.py b/sdk/ml/azure-ai-ml/tests/local_endpoint/unittests/test_local_endpoint_validator.py index a9c3f305de68..0c3fdeac4068 100644 --- a/sdk/ml/azure-ai-ml/tests/local_endpoint/unittests/test_local_endpoint_validator.py +++ b/sdk/ml/azure-ai-ml/tests/local_endpoint/unittests/test_local_endpoint_validator.py @@ -52,9 +52,7 @@ def test_environment_does_not_contain_local_docker_fails(self): def test_environment_contains_base_image_succeeds(self): environment = Environment(docker_image="ubuntu:latest") deployment = ManagedOnlineDeployment(name="deployment", environment=environment) - (base_image, dockerfile) = get_local_environment_artifacts( - endpoint_name="test-endpoint", deployment=deployment - ) + (base_image, dockerfile) = get_local_environment_artifacts(endpoint_name="test-endpoint", deployment=deployment) assert "ubuntu:latest" == base_image assert dockerfile is None @@ -64,9 +62,7 @@ def test_environment_contains_dockerfile_succeeds(self): name="deployment", environment=environment, ) - (base_image, dockerfile) = get_local_environment_artifacts( - endpoint_name="test-endpoint", deployment=deployment - ) + (base_image, dockerfile) = get_local_environment_artifacts(endpoint_name="test-endpoint", deployment=deployment) assert base_image is None assert "file:./Dockerfile" == dockerfile diff --git a/sdk/ml/azure-ai-ml/tests/model/e2etests/test_model.py b/sdk/ml/azure-ai-ml/tests/model/e2etests/test_model.py index b553021e2ead..cf75fbb758d8 100644 --- a/sdk/ml/azure-ai-ml/tests/model/e2etests/test_model.py +++ b/sdk/ml/azure-ai-ml/tests/model/e2etests/test_model.py @@ -29,6 +29,7 @@ def artifact_path(tmpdir_factory) -> str: # type: ignore file_name.write("content") return str(file_name) + # previous bodiless_matcher fixture doesn't take effect because of typo, please add it in method level if needed @@ -68,25 +69,6 @@ def test_crud_file(self, client: MLClient, randstr: Callable[[], str], tmp_path: # with pytest.raises(Exception): # client.models.get(name=model.name, version="3") - def test_create_autoincrement(self, client: MLClient, randstr: Callable[[], str], tmp_path: Path) -> None: - path = Path("./tests/test_configs/model/model_no_version.yml") - model_name = randstr("model_name") - - model = load_model(path) - model.name = model_name - assert model.version is None - assert model._auto_increment_version - - created_model = client.models.create_or_update(model) - assert created_model.version == "1" - assert created_model.type == "custom_model" - assert created_model._auto_increment_version is False - - next_model_asset = client.models.create_or_update(model) - assert next_model_asset.version == "2" - assert next_model_asset.type == "custom_model" - assert next_model_asset._auto_increment_version is False - def test_list_no_name(self, client: MLClient) -> None: models = client.models.list() assert isinstance(models, Iterator) @@ -145,10 +127,7 @@ def get_model_list(): client.models.restore(name=name) assert name in get_model_list() - @pytest.mark.skipif( - condition=not is_live(), - reason="Registry uploads do not record well. Investigate later" - ) + @pytest.mark.skipif(condition=not is_live(), reason="Registry uploads do not record well. Investigate later") def test_create_get_download_model_registry(self, registry_client: MLClient, randstr: Callable[[], str]) -> None: model_path = Path("./tests/test_configs/model/model_full.yml") model_name = randstr("model_name") @@ -175,10 +154,7 @@ def test_create_get_download_model_registry(self, registry_client: MLClient, ran assert os.path.exists(wd) assert os.path.exists(f"{wd}/lightgbm_mlflow_model/MLmodel") - @pytest.mark.skipif( - condition=not is_live(), - reason="Registry uploads do not record well. Investigate later" - ) + @pytest.mark.skipif(condition=not is_live(), reason="Registry uploads do not record well. Investigate later") def test_list_model_registry(self, registry_client: MLClient, randstr: Callable[[], str]) -> None: model_path = Path("./tests/test_configs/model/model_full.yml") model_name = randstr("model_name") @@ -197,10 +173,7 @@ def test_list_model_registry(self, registry_client: MLClient, randstr: Callable[ model_list = [m.name for m in model_list if m is not None] assert model.name in model_list - @pytest.mark.skipif( - condition=not is_live(), - reason="Registry uploads do not record well. Investigate later" - ) + @pytest.mark.skipif(condition=not is_live(), reason="Registry uploads do not record well. Investigate later") def test_promote_model(self, randstr: Callable[[], str], client: MLClient, registry_client: MLClient) -> None: # Create model in workspace model_path = Path("./tests/test_configs/model/model_full.yml") @@ -221,4 +194,4 @@ def test_promote_model(self, randstr: Callable[[], str], client: MLClient, regis # 4. Check that model has been promoted model = registry_client.models.get(name=model_name, version=model_version) assert model.name == model_name - assert model.version == model_version \ No newline at end of file + assert model.version == model_version diff --git a/sdk/ml/azure-ai-ml/tests/model/unittests/test_model_operations.py b/sdk/ml/azure-ai-ml/tests/model/unittests/test_model_operations.py index 88bfa4c1c4c6..cbc702d84912 100644 --- a/sdk/ml/azure-ai-ml/tests/model/unittests/test_model_operations.py +++ b/sdk/ml/azure-ai-ml/tests/model/unittests/test_model_operations.py @@ -118,8 +118,6 @@ def test_create_autoincrement( tmp_path: Path, ) -> None: - mock_model_operation._model_container_operation.get.return_value = Mock(ModelContainerDetails()) - model_name = f"model_random_string" p = tmp_path / "model_full.yml" model_path = tmp_path / "model.pkl" @@ -130,31 +128,29 @@ def test_create_autoincrement( path: ./model.pkl""" ) model = load_model(source=p) + assert model._auto_increment_version model.version = None - with patch( + with patch("azure.ai.ml.operations._model_operations.Model._from_rest_object", return_value=None), patch( + "azure.ai.ml.operations._model_operations._get_next_version_from_container", return_value="version" + ) as mock_nextver, patch( "azure.ai.ml.operations._model_operations._check_and_upload_path", return_value=(model, "indicatorfile.txt"), - ), patch("azure.ai.ml.operations._model_operations.Model._from_rest_object", return_value=model), patch( - "azure.ai.ml.operations._model_operations._get_default_datastore_info", return_value=None ), patch( - "azure.ai.ml.operations._model_operations._update_metadata", return_value=None - ) as mock_update: + "azure.ai.ml.operations._model_operations.Model._from_rest_object", return_value=model + ), patch( + "azure.ai.ml.operations._model_operations._get_default_datastore_info", return_value=None + ): mock_model_operation.create_or_update(model) - mock_model_operation._model_versions_operation.create_or_update.assert_called_once() - mock_model_operation._model_container_operation.get.assert_called_once_with( - name=model.name, - resource_group_name=mock_workspace_scope.resource_group_name, - workspace_name=mock_workspace_scope.workspace_name, - ) + mock_nextver.assert_called_once() + mock_model_operation._model_versions_operation.create_or_update.assert_called_once_with( body=model._to_rest_object(), name=model.name, - version=mock_model_operation._model_container_operation.get().properties.next_version, + version=mock_nextver.return_value, resource_group_name=mock_workspace_scope.resource_group_name, workspace_name=mock_workspace_scope.workspace_name, ) - mock_update.assert_called_once() def test_get_name_and_version(self, mock_model_operation: ModelOperations) -> None: mock_model_operation._model_container_operation.get.return_value = None diff --git a/sdk/ml/azure-ai-ml/tests/online_services/e2etests/test_online_deployment.py b/sdk/ml/azure-ai-ml/tests/online_services/e2etests/test_online_deployment.py index bd954abe6b46..b5b6638c0559 100644 --- a/sdk/ml/azure-ai-ml/tests/online_services/e2etests/test_online_deployment.py +++ b/sdk/ml/azure-ai-ml/tests/online_services/e2etests/test_online_deployment.py @@ -14,7 +14,9 @@ class TestOnlineDeployment(AzureRecordedTestCase): @pytest.mark.skip( reason="Tests failing in internal automation due to lack of quota. Cannot record or run in live mode." ) - def test_online_deployment(self, client: MLClient, rand_online_name: Callable[[], str], rand_online_deployment_name: Callable[[], str]) -> None: + def test_online_deployment( + self, client: MLClient, rand_online_name: Callable[[], str], rand_online_deployment_name: Callable[[], str] + ) -> None: endpoint_yaml = "tests/test_configs/deployments/online/simple_online_endpoint_mir.yaml" deployment_yaml = "tests/test_configs/deployments/online/online_deployment_1.yaml" name = rand_online_name("name") @@ -52,7 +54,9 @@ def test_online_deployment(self, client: MLClient, rand_online_name: Callable[[] client.online_endpoints.begin_delete(name=endpoint.name) @pytest.mark.skip(reason="Known failure") - def test_online_deployment_skip_script_validation(self, client: MLClient, rand_online_name: Callable[[], str], rand_online_deployment_name: Callable[[], str]) -> None: + def test_online_deployment_skip_script_validation( + self, client: MLClient, rand_online_name: Callable[[], str], rand_online_deployment_name: Callable[[], str] + ) -> None: online_endpoint_name = rand_online_name("online_endpoint_name") online_deployment_name = rand_online_deployment_name("online_deployment_name") @@ -88,4 +92,4 @@ def test_online_deployment_skip_script_validation(self, client: MLClient, rand_o except Exception as ex: raise ex finally: - client.online_endpoints.begin_delete(name=online_endpoint_name) \ No newline at end of file + client.online_endpoints.begin_delete(name=online_endpoint_name) diff --git a/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_deployments.py b/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_deployments.py index d642b2067458..d18300338c17 100644 --- a/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_deployments.py +++ b/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_deployments.py @@ -139,7 +139,7 @@ def mock_online_deployment_operations( class TestOnlineDeploymentOperations: @pytest.mark.skipif( condition=platform.python_implementation == "PyPy", - reason="writing dumped entity back to file does not work on PyPy" + reason="writing dumped entity back to file does not work on PyPy", ) def test_online_deployment_k8s_create( self, diff --git a/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_endpoints.py b/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_endpoints.py index 6ab93d260819..4cbeb221ca52 100644 --- a/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_endpoints.py +++ b/sdk/ml/azure-ai-ml/tests/online_services/unittests/test_online_endpoints.py @@ -393,20 +393,16 @@ def test_online_invoke( mock_online_endpoint_operations._online_operation.get.assert_called_once() mock_online_endpoint_operations._online_operation.list_keys.assert_called_once() - def test_create_no_file_throw_exception( - self, mock_online_endpoint_operations: OnlineEndpointOperations - ) -> None: + def test_create_no_file_throw_exception(self, mock_online_endpoint_operations: OnlineEndpointOperations) -> None: with pytest.raises(Exception): mock_online_endpoint_operations.begin_create(name="random_name", file=None) - def test_create_no_type_throw_exception( - self, mock_online_endpoint_operations: OnlineEndpointOperations - ) -> None: + def test_create_no_type_throw_exception(self, mock_online_endpoint_operations: OnlineEndpointOperations) -> None: with pytest.raises(Exception): mock_online_endpoint_operations.begin_create(name="random_name", file=None) def test_create_no_type_in_file_throw_exception( - self, mock_online_endpoint_operations: OnlineEndpointOperations, create_yaml_no_type + self, mock_online_endpoint_operations: OnlineEndpointOperations, create_yaml_no_type ) -> None: with pytest.raises(Exception): mock_online_endpoint_operations.begin_create(name="random_name", file=None) @@ -430,9 +426,7 @@ def test_online_regenerate_keys( mock_online_endpoint_operations._online_operation.begin_regenerate_keys.assert_called_once() mock_online_endpoint_operations._online_operation.get.assert_called_once() - def test_regenerate_invalid_key_type( - self, mock_online_endpoint_operations: OnlineEndpointOperations - ) -> None: + def test_regenerate_invalid_key_type(self, mock_online_endpoint_operations: OnlineEndpointOperations) -> None: with pytest.raises(Exception): mock_online_endpoint_operations.begin_regenerate_keys(name="random_name", key_type="invalid key type") diff --git a/sdk/ml/azure-ai-ml/tests/pipeline_job/_util.py b/sdk/ml/azure-ai-ml/tests/pipeline_job/_util.py index e0c96844b71e..9a3b9d42e487 100644 --- a/sdk/ml/azure-ai-ml/tests/pipeline_job/_util.py +++ b/sdk/ml/azure-ai-ml/tests/pipeline_job/_util.py @@ -52,10 +52,14 @@ ] # this is to shorten the test name -DATABINDING_EXPRESSION_TEST_CASE_ENUMERATE = list(enumerate(map( - lambda params: Path(params[0]).name, - DATABINDING_EXPRESSION_TEST_CASES, -))) +DATABINDING_EXPRESSION_TEST_CASE_ENUMERATE = list( + enumerate( + map( + lambda params: Path(params[0]).name, + DATABINDING_EXPRESSION_TEST_CASES, + ) + ) +) SERVERLESS_COMPUTE_TEST_PARAMETERS = [ diff --git a/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_control_flow_pipeline.py b/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_control_flow_pipeline.py index 94c372f2f97c..5b003f07e68a 100644 --- a/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_control_flow_pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_control_flow_pipeline.py @@ -53,19 +53,23 @@ def test_happy_path_if_else(self, client: MLClient, randstr: Callable[[str], str pipeline_job_dict = omit_with_wildcard(pipeline_job_dict, *omit_fields) assert pipeline_job_dict["properties"]["jobs"] == { - 'conditionnode': {'condition': '${{parent.jobs.result.outputs.output}}', - 'false_block': '${{parent.jobs.node1}}', - 'true_block': '${{parent.jobs.node2}}', - 'type': 'if_else'}, - 'node1': {'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}}, - 'name': 'node1', - 'type': 'command'}, - 'node2': {'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '2'}}, - 'name': 'node2', - 'type': 'command'}, - 'result': {'name': 'result', 'type': 'command'} + "conditionnode": { + "condition": "${{parent.jobs.result.outputs.output}}", + "false_block": "${{parent.jobs.node1}}", + "true_block": "${{parent.jobs.node2}}", + "type": "if_else", + }, + "node1": { + "inputs": {"component_in_number": {"job_input_type": "literal", "value": "1"}}, + "name": "node1", + "type": "command", + }, + "node2": { + "inputs": {"component_in_number": {"job_input_type": "literal", "value": "2"}}, + "name": "node2", + "type": "command", + }, + "result": {"name": "result", "type": "command"}, } def test_if_else_one_branch(self, client: MLClient, randstr: Callable[[str], str]) -> None: @@ -80,14 +84,17 @@ def test_if_else_one_branch(self, client: MLClient, randstr: Callable[[str], str pipeline_job_dict = omit_with_wildcard(pipeline_job_dict, *omit_fields) assert pipeline_job_dict["properties"]["jobs"] == { - 'conditionnode': {'condition': '${{parent.jobs.result.outputs.output}}', - 'true_block': '${{parent.jobs.node1}}', - 'type': 'if_else'}, - 'node1': {'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}}, - 'name': 'node1', - 'type': 'command'}, - 'result': {'name': 'result', 'type': 'command'} + "conditionnode": { + "condition": "${{parent.jobs.result.outputs.output}}", + "true_block": "${{parent.jobs.node1}}", + "type": "if_else", + }, + "node1": { + "inputs": {"component_in_number": {"job_input_type": "literal", "value": "1"}}, + "name": "node1", + "type": "command", + }, + "result": {"name": "result", "type": "command"}, } def test_if_else_literal_condition(self, client: MLClient, randstr: Callable[[str], str]) -> None: @@ -102,13 +109,12 @@ def test_if_else_literal_condition(self, client: MLClient, randstr: Callable[[st pipeline_job_dict = omit_with_wildcard(pipeline_job_dict, *omit_fields) assert pipeline_job_dict["properties"]["jobs"] == { - 'conditionnode': {'condition': True, - 'true_block': '${{parent.jobs.node1}}', - 'type': 'if_else'}, - 'node1': {'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '1'}}, - 'name': 'node1', - 'type': 'command'} + "conditionnode": {"condition": True, "true_block": "${{parent.jobs.node1}}", "type": "if_else"}, + "node1": { + "inputs": {"component_in_number": {"job_input_type": "literal", "value": "1"}}, + "name": "node1", + "type": "command", + }, } def test_if_else_invalid_case(self, client: MLClient) -> None: @@ -180,10 +186,10 @@ class TestParallelFor(TestConditionalNodeInPipeline): def test_simple_foreach_string_item(self, client: MLClient, randstr: Callable): source = "./tests/test_configs/pipeline_jobs/helloworld_parallel_for_pipeline_job.yaml" expected_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, {"component_in_number": 2}]', - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, {"component_in_number": 2}]', + "type": "parallel_for", + "_source": "YAML.JOB", } assert_foreach(client, randstr("job_name"), source, expected_node) @@ -191,93 +197,89 @@ def test_simple_foreach_string_item(self, client: MLClient, randstr: Callable): def test_simple_foreach_list_item(self, client: MLClient, randstr: Callable): source = "./tests/test_configs/pipeline_jobs/helloworld_parallel_for_pipeline_job_list_input.yaml" expected_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, {"component_in_number": 2}]', - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, {"component_in_number": 2}]', + "type": "parallel_for", + "_source": "YAML.JOB", } assert_foreach(client, randstr("job_name"), source, expected_node) def test_simple_foreach_dict_item(self, client: MLClient, randstr: Callable): source = "./tests/test_configs/pipeline_jobs/helloworld_parallel_for_pipeline_job_dict_input.yaml" expected_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '{"branch1": {"component_in_number": 1}, "branch2": ' - '{"component_in_number": 2}}', - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "body": "${{parent.jobs.parallel_body}}", + "items": '{"branch1": {"component_in_number": 1}, "branch2": ' '{"component_in_number": 2}}', + "type": "parallel_for", + "_source": "YAML.JOB", } assert_foreach(client, randstr("job_name"), source, expected_node) def test_output_binding_foreach_node(self, client: MLClient, randstr: Callable): source = "./tests/test_configs/pipeline_jobs/helloworld_parallel_for_pipeline_job_output_binding.yaml" expected_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, {"component_in_number": 2}]', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.component_out_path}}'}}, - 'type': 'parallel_for', - '_source': 'YAML.JOB' + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, {"component_in_number": 2}]', + "outputs": {"component_out_path": {"type": "literal", "value": "${{parent.outputs.component_out_path}}"}}, + "type": "parallel_for", + "_source": "YAML.JOB", } yaml_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_number": 1}, {"component_in_number": 2}]', - 'outputs': {'component_out_path': '${{parent.outputs.component_out_path}}'}, - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_number": 1}, {"component_in_number": 2}]', + "outputs": {"component_out_path": "${{parent.outputs.component_out_path}}"}, + "type": "parallel_for", + "_source": "YAML.JOB", } assert_foreach(client, randstr("job_name"), source, expected_node, yaml_node) def test_assets_in_items(self, client: MLClient, randstr: Callable): source = "./tests/test_configs/pipeline_jobs/control_flow/parallel_for/assets_items.yaml" expected_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_path": {"uri": ' - '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' - '"job_input_type": "uri_file"}}, {"component_in_path": {"uri": ' - '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' - '"job_input_type": "uri_file"}}]', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.component_out_path}}'}}, - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_path": {"uri": ' + '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' + '"job_input_type": "uri_file"}}, {"component_in_path": {"uri": ' + '"https://dprepdata.blob.core.windows.net/demo/Titanic.csv", ' + '"job_input_type": "uri_file"}}]', + "outputs": {"component_out_path": {"type": "literal", "value": "${{parent.outputs.component_out_path}}"}}, + "type": "parallel_for", + "_source": "YAML.JOB", } yaml_node = { - 'body': '${{parent.jobs.parallel_body}}', + "body": "${{parent.jobs.parallel_body}}", # items will become json string when dump to avoid removal of empty inputs - 'items': '[{"component_in_path": "{\'type\': \'uri_file\', \'path\': ' - '\'https://dprepdata.blob.core.windows.net/demo/Titanic.csv\'}"}, ' - '{"component_in_path": "{\'type\': \'uri_file\', \'path\': ' - '\'https://dprepdata.blob.core.windows.net/demo/Titanic.csv\'}"}]', - 'outputs': {'component_out_path': '${{parent.outputs.component_out_path}}'}, - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "items": "[{\"component_in_path\": \"{'type': 'uri_file', 'path': " + "'https://dprepdata.blob.core.windows.net/demo/Titanic.csv'}\"}, " + "{\"component_in_path\": \"{'type': 'uri_file', 'path': " + "'https://dprepdata.blob.core.windows.net/demo/Titanic.csv'}\"}]", + "outputs": {"component_out_path": "${{parent.outputs.component_out_path}}"}, + "type": "parallel_for", + "_source": "YAML.JOB", } assert_foreach(client, randstr("job_name"), source, expected_node, yaml_node) def test_path_on_datastore_in_items(self, client: MLClient, randstr: Callable): source = "./tests/test_configs/pipeline_jobs/control_flow/parallel_for/path_on_ds_items.yaml" expected_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_path": {"uri": ' - '"azureml://datastores/workspaceblobstore/paths/path/on/datastore/1", ' - '"job_input_type": "uri_folder"}}, {"component_in_path": {"uri": ' - '"azureml://datastores/workspaceblobstore/paths/path/on/datastore/2", ' - '"job_input_type": "uri_folder"}}]', - 'outputs': {'component_out_path': {'type': 'literal', - 'value': '${{parent.outputs.component_out_path}}'}}, - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "body": "${{parent.jobs.parallel_body}}", + "items": '[{"component_in_path": {"uri": ' + '"azureml://datastores/workspaceblobstore/paths/path/on/datastore/1", ' + '"job_input_type": "uri_folder"}}, {"component_in_path": {"uri": ' + '"azureml://datastores/workspaceblobstore/paths/path/on/datastore/2", ' + '"job_input_type": "uri_folder"}}]', + "outputs": {"component_out_path": {"type": "literal", "value": "${{parent.outputs.component_out_path}}"}}, + "type": "parallel_for", + "_source": "YAML.JOB", } yaml_node = { - 'body': '${{parent.jobs.parallel_body}}', - 'items': '[{"component_in_path": "{\'type\': \'uri_folder\', \'path\': ' - '\'azureml://datastores/workspaceblobstore/paths/path/on/datastore/1\'}"}, ' - '{"component_in_path": "{\'type\': \'uri_folder\', \'path\': ' - '\'azureml://datastores/workspaceblobstore/paths/path/on/datastore/2\'}"}]', - 'outputs': {'component_out_path': '${{parent.outputs.component_out_path}}'}, - 'type': 'parallel_for', - '_source': 'YAML.JOB', + "body": "${{parent.jobs.parallel_body}}", + "items": "[{\"component_in_path\": \"{'type': 'uri_folder', 'path': " + "'azureml://datastores/workspaceblobstore/paths/path/on/datastore/1'}\"}, " + "{\"component_in_path\": \"{'type': 'uri_folder', 'path': " + "'azureml://datastores/workspaceblobstore/paths/path/on/datastore/2'}\"}]", + "outputs": {"component_out_path": "${{parent.outputs.component_out_path}}"}, + "type": "parallel_for", + "_source": "YAML.JOB", } assert_foreach(client, randstr("job_name"), source, expected_node, yaml_node) @@ -300,22 +302,20 @@ def test_if_else(self, client: MLClient, randstr: Callable[[], str]): assert_control_flow_in_pipeline_component( client=client, component_path="./if_else/simple_pipeline.yml", - pipeline_path="./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml" + pipeline_path="./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml", ) - @pytest.mark.skip( - reason="TODO(2177353): check why recorded tests failure." - ) + @pytest.mark.skip(reason="TODO(2177353): check why recorded tests failure.") def test_do_while(self, client: MLClient, randstr: Callable[[], str]): assert_control_flow_in_pipeline_component( client=client, component_path="./do_while/pipeline_component.yml", - pipeline_path="./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml" + pipeline_path="./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml", ) def test_foreach(self, client: MLClient, randstr: Callable[[], str]): assert_control_flow_in_pipeline_component( client=client, component_path="./parallel_for/simple_pipeline.yml", - pipeline_path="./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml" + pipeline_path="./tests/test_configs/pipeline_jobs/control_flow/control_flow_with_pipeline_component.yml", ) diff --git a/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_pipeline_job.py b/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_pipeline_job.py index b5253ef37d23..5585ee9cf5a4 100644 --- a/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_pipeline_job.py +++ b/sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_pipeline_job.py @@ -77,9 +77,7 @@ def test_pipeline_job_create( assert updated_job.tags[new_tag_name] == new_tag_value @pytest.mark.skipif(condition=not is_live(), reason="registry test, may fail in playback mode") - def test_pipeline_job_create_with_registries( - self, client: MLClient, randstr: Callable[[str], str] - ) -> None: + def test_pipeline_job_create_with_registries(self, client: MLClient, randstr: Callable[[str], str]) -> None: params_override = [{"name": randstr("name")}] pipeline_job = load_job( source="./tests/test_configs/pipeline_jobs/hello_pipeline_job_with_registries.yml", @@ -1364,341 +1362,320 @@ def test_pipeline_job_with_singularity_compute(self, client: MLClient, randstr: assert created_pipeline_job.settings.default_compute == singularity_compute_id assert created_pipeline_job.jobs["hello_job"].compute == singularity_compute_id - def test_register_output_yaml(self, client: MLClient, randstr: Callable[[str], str],): + def test_register_output_yaml( + self, + client: MLClient, + randstr: Callable[[str], str], + ): # only register pipeline output - register_pipeline_output_path = "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_output_name_version.yaml" + register_pipeline_output_path = ( + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_output_name_version.yaml" + ) pipeline = load_job(source=register_pipeline_output_path) pipeline_job = assert_job_cancel(pipeline, client) output = pipeline_job.outputs.component_out_path - assert output.name == 'pipeline_output' - assert output.version == '1' + assert output.name == "pipeline_output" + assert output.version == "1" # only register node output - register_node_output_path = "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_node_output_name_version.yaml" + register_node_output_path = ( + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_node_output_name_version.yaml" + ) pipeline = load_job(source=register_node_output_path) pipeline_job = assert_job_cancel(pipeline, client) - output = pipeline_job.jobs['parallel_body'].outputs.component_out_path - assert output.name == 'node_output' - assert output.version == '1' + output = pipeline_job.jobs["parallel_body"].outputs.component_out_path + assert output.name == "node_output" + assert output.version == "1" # register node output and pipeline output while the node output isn't binding to pipeline output - register_both_output_path = "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_and_node_output.yaml" + register_both_output_path = ( + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_and_node_output.yaml" + ) pipeline = load_job(source=register_both_output_path) pipeline_job = assert_job_cancel(pipeline, client) pipeline_output = pipeline_job.outputs.pipeline_out_path - assert pipeline_output.name == 'pipeline_output' - assert pipeline_output.version == '2' - node_output = pipeline_job.jobs['parallel_body'].outputs.component_out_path - assert node_output.name == 'node_output' - assert node_output.version == '1' + assert pipeline_output.name == "pipeline_output" + assert pipeline_output.version == "2" + node_output = pipeline_job.jobs["parallel_body"].outputs.component_out_path + assert node_output.name == "node_output" + assert node_output.version == "1" # register node output and pipeline output while the node output is binding to pipeline output - register_both_output_binding_path = "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_and_node_binding_output.yaml" + register_both_output_binding_path = ( + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_and_node_binding_output.yaml" + ) pipeline = load_job(source=register_both_output_binding_path) pipeline_job = assert_job_cancel(pipeline, client) pipeline_output = pipeline_job.outputs.pipeline_out_path - assert pipeline_output.name == 'pipeline_output' - assert pipeline_output.version == '2' - node_output = pipeline_job.jobs['parallel_body'].outputs.component_out_path - assert node_output.name == 'node_output' - assert node_output.version == '1' + assert pipeline_output.name == "pipeline_output" + assert pipeline_output.version == "2" + node_output = pipeline_job.jobs["parallel_body"].outputs.component_out_path + assert node_output.name == "node_output" + assert node_output.version == "1" # register spark node output - register_spark_output_path = "./tests/test_configs/dsl_pipeline/spark_job_in_pipeline/pipeline_inline_job_register_output.yml" + register_spark_output_path = ( + "./tests/test_configs/dsl_pipeline/spark_job_in_pipeline/pipeline_inline_job_register_output.yml" + ) pipeline = load_job(source=register_spark_output_path) pipeline_job = assert_job_cancel(pipeline, client) - node_output = pipeline_job.jobs['count_by_row'].outputs.output - assert node_output.name == 'spark_output' - assert node_output.version == '12' + node_output = pipeline_job.jobs["count_by_row"].outputs.output + assert node_output.name == "spark_output" + assert node_output.version == "12" # register sweep node output - register_sweep_output_path = "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_sweep_node_register_output.yml" - pipeline = load_job(source=register_sweep_output_path, params_override=[{'name': randstr("job_name")}]) + register_sweep_output_path = ( + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_sweep_node_register_output.yml" + ) + pipeline = load_job(source=register_sweep_output_path, params_override=[{"name": randstr("job_name")}]) pipeline_job = assert_job_cancel(pipeline, client) - node_output = pipeline_job.jobs['hello_sweep_inline_file_trial'].outputs.trained_model_dir - assert node_output.name == 'sweep_output' - assert node_output.version == '123_sweep' + node_output = pipeline_job.jobs["hello_sweep_inline_file_trial"].outputs.trained_model_dir + assert node_output.name == "sweep_output" + assert node_output.version == "123_sweep" # register parallel node output - register_parallel_output_path ="./tests/test_configs/dsl_pipeline/parallel_component_with_file_input/pipeline_register_output.yml" + register_parallel_output_path = ( + "./tests/test_configs/dsl_pipeline/parallel_component_with_file_input/pipeline_register_output.yml" + ) pipeline = load_job(source=register_parallel_output_path) pipeline_job = assert_job_cancel(pipeline, client) - node_output = pipeline_job.jobs['convert_data_node'].outputs.file_output_data - assert node_output.name == 'convert_data_node_output' - assert node_output.version == '1' + node_output = pipeline_job.jobs["convert_data_node"].outputs.file_output_data + assert node_output.name == "convert_data_node_output" + assert node_output.version == "1" @pytest.mark.skipif(condition=is_live(), reason="need worskspace with datafactory compute") - def test_pipeline_job_with_data_transfer_copy_urifolder( - self, client: MLClient, randstr: Callable[[str], str] - ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/copy_files.yaml" - ) + def test_pipeline_job_with_data_transfer_copy_urifolder(self, client: MLClient, randstr: Callable[[str], str]): + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/copy_files.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["copy_files"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["copy_files"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "data_copy_mode": "merge_with_overwrite", + "inputs": {"folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}}, + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", } @pytest.mark.skipif(condition=is_live(), reason="need worskspace with datafactory compute") - def test_pipeline_job_with_data_transfer_copy_urifile( - self, client: MLClient, randstr: Callable[[str], str] - ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/copy_uri_files.yaml" - ) + def test_pipeline_job_with_data_transfer_copy_urifile(self, client: MLClient, randstr: Callable[[str], str]): + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/copy_uri_files.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["copy_files"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["copy_files"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'data_copy_mode': 'fail_if_conflict', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "data_copy_mode": "fail_if_conflict", + "inputs": {"folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}}, + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", } @pytest.mark.skipif(condition=is_live(), reason="need worskspace with datafactory compute") - def test_pipeline_job_with_data_transfer_copy_2urifolder( - self, client: MLClient, randstr: Callable[[str], str] - ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/merge_files.yaml" - ) + def test_pipeline_job_with_data_transfer_copy_2urifolder(self, client: MLClient, randstr: Callable[[str], str]): + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/merge_files.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["merge_files"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["merge_files"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder_dup}}'} - }, - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder_dup}}"}, + }, + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", } @pytest.mark.skipif(condition=is_live(), reason="need worskspace with datafactory compute") def test_pipeline_job_with_inline_data_transfer_copy_2urifolder( self, client: MLClient, randstr: Callable[[str], str] ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/merge_files_job.yaml" - ) + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/merge_files_job.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["merge_files_job"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["merge_files_job"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder_dup}}'} - }, - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder_dup}}"}, + }, + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", } @pytest.mark.skipif(condition=is_live(), reason="need worskspace with datafactory compute") def test_pipeline_job_with_inline_data_transfer_copy_mixtype_file( self, client: MLClient, randstr: Callable[[str], str] ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/merge_mixtype_files.yaml" - ) + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/merge_mixtype_files.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["merge_files"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["merge_files"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'input1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.input1}}'}, - 'input2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.input2}}'}, - 'input3': {'job_input_type': 'literal', - 'value': '${{parent.inputs.input3}}'} - }, - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "input1": {"job_input_type": "literal", "value": "${{parent.inputs.input1}}"}, + "input2": {"job_input_type": "literal", "value": "${{parent.inputs.input2}}"}, + "input3": {"job_input_type": "literal", "value": "${{parent.inputs.input3}}"}, + }, + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", } @pytest.mark.skip(reason="need worskspace with datafactory compute, and builtin components") - def test_pipeline_job_with_data_transfer_import_filesystem( - self, client: MLClient, randstr: Callable[[str], str] - ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/import_file_system_to_blob.yaml" - ) + def test_pipeline_job_with_data_transfer_import_filesystem(self, client: MLClient, randstr: Callable[[str], str]): + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/import_file_system_to_blob.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["s3_blob"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["s3_blob"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'outputs': {'sink': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/workspaceblobstore/paths/importjob/${{name}}/output_dir/s3//'}}, - 'source': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "outputs": { + "sink": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/workspaceblobstore/paths/importjob/${{name}}/output_dir/s3//", + } + }, + "source": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", } @pytest.mark.skip(reason="need worskspace with datafactory compute, and builtin components") - def test_pipeline_job_with_data_transfer_import_sql_database( - self, client: MLClient, randstr: Callable[[str], str] - ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/import_sql_database_to_blob.yaml" - ) + def test_pipeline_job_with_data_transfer_import_sql_database(self, client: MLClient, randstr: Callable[[str], str]): + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/import_sql_database_to_blob.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["snowflake_blob"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["snowflake_blob"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'computeId': 'adftest', - 'outputs': {'sink': {'job_output_type': 'mltable'}}, - 'source': {'connection': 'azureml:my_azuresqldb_connection', - 'query': '${{parent.inputs.query_source_snowflake}}', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "computeId": "adftest", + "outputs": {"sink": {"job_output_type": "mltable"}}, + "source": { + "connection": "azureml:my_azuresqldb_connection", + "query": "${{parent.inputs.query_source_snowflake}}", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", } @pytest.mark.skip(reason="need worskspace with datafactory compute, and builtin components") def test_pipeline_job_with_data_transfer_import_snowflake_database( self, client: MLClient, randstr: Callable[[str], str] ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/import_database_to_blob.yaml" - ) + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/import_database_to_blob.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["snowflake_blob"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["snowflake_blob"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'computeId': 'adftest', - 'outputs': {'sink': {'job_output_type': 'mltable', - 'uri': 'azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/'}}, - 'source': {'connection': 'azureml:my_snowflake_connection', - 'query': '${{parent.inputs.query_source_snowflake}}', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "computeId": "adftest", + "outputs": { + "sink": { + "job_output_type": "mltable", + "uri": "azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/", + } + }, + "source": { + "connection": "azureml:my_snowflake_connection", + "query": "${{parent.inputs.query_source_snowflake}}", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", } @pytest.mark.skip(reason="need worskspace with datafactory compute, and builtin components") - def test_pipeline_job_with_data_transfer_export_sql_database( - self, client: MLClient, randstr: Callable[[str], str] - ): - test_path = ( - "./tests/test_configs/pipeline_jobs/data_transfer/export_database_to_blob.yaml" - ) + def test_pipeline_job_with_data_transfer_export_sql_database(self, client: MLClient, randstr: Callable[[str], str]): + test_path = "./tests/test_configs/pipeline_jobs/data_transfer/export_database_to_blob.yaml" pipeline: PipelineJob = load_job(source=test_path, params_override=[{"name": randstr("name")}]) created_pipeline = assert_job_cancel(pipeline, client) pipeline_dict = created_pipeline._to_rest_object().as_dict() fields_to_omit = ["name", "display_name", "experiment_name", "properties", "componentId"] - actual_dict = pydash.omit( - pipeline_dict["properties"]["jobs"]["blob_azuresql"], fields_to_omit - ) + actual_dict = pydash.omit(pipeline_dict["properties"]["jobs"]["blob_azuresql"], fields_to_omit) assert actual_dict == { - '_source': 'REMOTE.WORKSPACE.COMPONENT', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'sink': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'table_name': '${{parent.inputs.table_name}}', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer' + "_source": "REMOTE.WORKSPACE.COMPONENT", + "inputs": {"source": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}}, + "sink": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "table_name": "${{parent.inputs.table_name}}", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", } - - def test_register_output_yaml_succeed(self, client: MLClient, randstr: Callable[[str], str],): - register_pipeline_path = "./tests/test_configs/dsl_pipeline/pipeline_with_pipeline_component/pipeline_register_output.yml" + def test_register_output_yaml_succeed( + self, + client: MLClient, + randstr: Callable[[str], str], + ): + register_pipeline_path = ( + "./tests/test_configs/dsl_pipeline/pipeline_with_pipeline_component/pipeline_register_output.yml" + ) pipeline = load_job(source=register_pipeline_path) # overwrite version random_version = randstr("version") pipeline.outputs.pipeline_job_best_model.version = random_version - pipeline.jobs['train_and_evaludate_model1'].outputs.trained_model.version = random_version - pipeline.jobs['compare'].outputs.best_model.version = random_version - pipeline.jobs['compare'].outputs.best_result.version = random_version - pipeline.jobs['compare_2'].outputs.best_model.version = random_version - pipeline.jobs['compare_2'].outputs.best_result.version = random_version + pipeline.jobs["train_and_evaludate_model1"].outputs.trained_model.version = random_version + pipeline.jobs["compare"].outputs.best_model.version = random_version + pipeline.jobs["compare"].outputs.best_result.version = random_version + pipeline.jobs["compare_2"].outputs.best_model.version = random_version + pipeline.jobs["compare_2"].outputs.best_result.version = random_version pipeline_job = client.jobs.create_or_update(pipeline) client.jobs.stream(pipeline_job.name) @@ -1708,14 +1685,16 @@ def check_name_version_and_register_succeed(output, asset_name): assert output.version == random_version assert client.data.get(name=asset_name, version=random_version) - check_name_version_and_register_succeed(pipeline_job.outputs.pipeline_job_best_model, 'pipeline_output_a') - check_name_version_and_register_succeed(pipeline_job.jobs['train_and_evaludate_model1'].outputs.trained_model, 'model1_output') - check_name_version_and_register_succeed(pipeline_job.jobs['compare_2'].outputs.best_model, 'best_model_2') - check_name_version_and_register_succeed(pipeline_job.jobs['compare_2'].outputs.best_result, 'best_result_2') + check_name_version_and_register_succeed(pipeline_job.outputs.pipeline_job_best_model, "pipeline_output_a") + check_name_version_and_register_succeed( + pipeline_job.jobs["train_and_evaludate_model1"].outputs.trained_model, "model1_output" + ) + check_name_version_and_register_succeed(pipeline_job.jobs["compare_2"].outputs.best_model, "best_model_2") + check_name_version_and_register_succeed(pipeline_job.jobs["compare_2"].outputs.best_result, "best_result_2") # name and version are not rewritten, but the display content in page is the PipelineOutput - assert pipeline_job.jobs['compare'].outputs.best_model.name == 'best_model' - assert pipeline_job.jobs['compare'].outputs.best_model.version == random_version + assert pipeline_job.jobs["compare"].outputs.best_model.name == "best_model" + assert pipeline_job.jobs["compare"].outputs.best_model.version == random_version @pytest.mark.usefixtures("enable_pipeline_private_preview_features") @@ -1725,6 +1704,7 @@ def check_name_version_and_register_succeed(output, asset_name): @pytest.mark.timeout(timeout=_PIPELINE_JOB_LONG_RUNNING_TIMEOUT_SECOND, method=_PYTEST_TIMEOUT_METHOD) class TestPipelineJobLongRunning: """Long-running tests that require pipeline job completed.""" + def test_pipeline_job_get_child_run(self, client: MLClient, randstr: Callable[[str], str]): pipeline_job = load_job( source="./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_quick_with_output.yml", @@ -1742,9 +1722,7 @@ def test_pipeline_job_get_child_run(self, client: MLClient, randstr: Callable[[s assert isinstance(retrieved_child_run, Job) assert retrieved_child_run.name == child_job.name - def test_pipeline_job_download( - self, client: MLClient, randstr: Callable[[str], str], tmp_path: Path - ) -> None: + def test_pipeline_job_download(self, client: MLClient, randstr: Callable[[str], str], tmp_path: Path) -> None: job = client.jobs.create_or_update( load_job( source="./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_quick_with_output.yml", diff --git a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_controlflow_pipeline_job.py b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_controlflow_pipeline_job.py index 03a1f9133e28..3026402ecc77 100644 --- a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_controlflow_pipeline_job.py +++ b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_controlflow_pipeline_job.py @@ -64,7 +64,6 @@ def test_do_while_pipeline_illegal_cases(self): class TestParallelForPipelineJobUT(TestControlFlowPipelineJobUT): - @pytest.mark.parametrize( "exception_cls, yaml_path, msg, location", [ @@ -72,52 +71,52 @@ class TestParallelForPipelineJobUT(TestControlFlowPipelineJobUT): ( ValidationError, "./tests/test_configs/pipeline_jobs/invalid/parallel_for/items_invalid_value_type.yml", - 'Not a valid mapping type.', - '"path": "jobs.parallelfor.items",' + "Not a valid mapping type.", + '"path": "jobs.parallelfor.items",', ), # # items with empty dict as content ( ValidationException, "./tests/test_configs/pipeline_jobs/invalid/parallel_for/items_empty.yml", "Items is an empty list/dict.", - '"path": "jobs.parallelfor.items",' + '"path": "jobs.parallelfor.items",', ), # item meta not match ( ValidationException, "./tests/test_configs/pipeline_jobs/invalid/parallel_for/items_meta_mismatch.yml", '"message": "Items should have same keys', - '"path": "jobs.parallelfor.items"' + '"path": "jobs.parallelfor.items"', ), # items not exist ( ValidationException, "./tests/test_configs/pipeline_jobs/invalid/parallel_for/items_not_exist.yml", - 'got unmatched inputs with loop body component', - '"path": "jobs.parallelfor.items"' + "got unmatched inputs with loop body component", + '"path": "jobs.parallelfor.items"', ), # items invalid json ( ValidationException, "./tests/test_configs/pipeline_jobs/invalid/parallel_for/items_invalid_json.yml", '"message": "Items is neither a valid JSON', - '"path": "jobs.parallelfor.items"' + '"path": "jobs.parallelfor.items"', ), # required field unprovided ( ValidationError, "./tests/test_configs/pipeline_jobs/invalid/parallel_for/items_unprovided.yml", '"message": "Missing data for required field', - 'items_unprovided.yml#line 7' + "items_unprovided.yml#line 7", ), # body unsupported ( ValidationException, "./tests/test_configs/pipeline_jobs/invalid/parallel_for/body_not_supported.yml", " got instead.", - '' + "", ), - ] + ], ) def test_dsl_parallel_for_pipeline_illegal_cases(self, exception_cls, yaml_path, msg, location): with pytest.raises(exception_cls) as e: diff --git a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_entity.py b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_entity.py index d71ba14b30f5..8d19ab53d42e 100644 --- a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_entity.py +++ b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_entity.py @@ -162,16 +162,16 @@ def test_automl_node_in_pipeline_forecasting(self, mock_machinelearning_client: "rest_job_file, node_name", [ ( - "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_regression.json", - "hello_automl_regression", + "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_regression.json", + "hello_automl_regression", ), ( - "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/rest_pipeline_with_automl_output_binding.json", - "classification_node", + "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/rest_pipeline_with_automl_output_binding.json", + "classification_node", ), ( - "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/rest_pipeline_with_automl_output.json", - "hello_automl_regression", + "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/rest_pipeline_with_automl_output.json", + "hello_automl_regression", ), ], ) @@ -209,9 +209,9 @@ def test_command_job_with_invalid_mode_type_in_pipeline_deserialize(self): "hello_python_world_job": { "inputs": { "sample_input_data": { - 'mode': "ro_mount", + "mode": "ro_mount", "type": "uri_folder", - 'path': "azureml://datastores/workspaceblobstore/paths/LocalUpload/22fd2a62-9759-4843-ab92-5bd79c35f6f0/data/", + "path": "azureml://datastores/workspaceblobstore/paths/LocalUpload/22fd2a62-9759-4843-ab92-5bd79c35f6f0/data/", }, "sample_input_string": { "mode": "ro_mount", @@ -219,7 +219,7 @@ def test_command_job_with_invalid_mode_type_in_pipeline_deserialize(self): }, }, "outputs": {"sample_output_data": "${{parent.outputs.pipeline_sample_output_data}}"}, - 'component': "azureml:/subscriptions/96aede12-2f73-41cb-b983-6d11a904839b/resourceGroups/chenyin-test-eastus/providers/Microsoft.MachineLearningServices/workspaces/sdk_vnext_cli/components/azureml_anonymous/versions/9904ff48-9cb2-4733-ad1c-eb1eb9940a19", + "component": "azureml:/subscriptions/96aede12-2f73-41cb-b983-6d11a904839b/resourceGroups/chenyin-test-eastus/providers/Microsoft.MachineLearningServices/workspaces/sdk_vnext_cli/components/azureml_anonymous/versions/9904ff48-9cb2-4733-ad1c-eb1eb9940a19", "type": "command", "compute": "azureml:cpu-cluster", } @@ -335,7 +335,7 @@ def test_pipeline_job_automl_regression_output(self, mock_machinelearning_client } def test_automl_node_in_pipeline_text_classification( - self, mock_machinelearning_client: MLClient, mocker: MockFixture + self, mock_machinelearning_client: MLClient, mocker: MockFixture ): test_path = "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_text_classification.yml" job = load_job(source=test_path) @@ -367,7 +367,7 @@ def test_automl_node_in_pipeline_text_classification( } def test_automl_node_in_pipeline_text_classification_multilabel( - self, mock_machinelearning_client: MLClient, mocker: MockFixture + self, mock_machinelearning_client: MLClient, mocker: MockFixture ): test_path = ( "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_text_classification_multilabel.yml" @@ -431,11 +431,11 @@ def test_automl_node_in_pipeline_text_ner(self, mock_machinelearning_client: MLC @pytest.mark.parametrize("run_type", ["single", "sweep", "automode"]) def test_automl_node_in_pipeline_image_multiclass_classification( - self, - mock_machinelearning_client: MLClient, - mocker: MockFixture, - run_type: str, - tmp_path: Path, + self, + mock_machinelearning_client: MLClient, + mocker: MockFixture, + run_type: str, + tmp_path: Path, ): test_path = "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_image_multiclass_classification.yml" @@ -508,11 +508,11 @@ def test_automl_node_in_pipeline_image_multiclass_classification( @pytest.mark.parametrize("run_type", ["single", "sweep", "automode"]) def test_automl_node_in_pipeline_image_multilabel_classification( - self, - mock_machinelearning_client: MLClient, - mocker: MockFixture, - run_type: str, - tmp_path: Path, + self, + mock_machinelearning_client: MLClient, + mocker: MockFixture, + run_type: str, + tmp_path: Path, ): test_path = "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_image_multilabel_classification.yml" @@ -585,7 +585,7 @@ def test_automl_node_in_pipeline_image_multilabel_classification( @pytest.mark.parametrize("run_type", ["single", "sweep", "automode"]) def test_automl_node_in_pipeline_image_object_detection( - self, mock_machinelearning_client: MLClient, mocker: MockFixture, run_type: str, tmp_path: Path + self, mock_machinelearning_client: MLClient, mocker: MockFixture, run_type: str, tmp_path: Path ): test_path = "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_image_object_detection.yml" @@ -659,11 +659,11 @@ def test_automl_node_in_pipeline_image_object_detection( @pytest.mark.parametrize("run_type", ["single", "sweep", "automode"]) def test_automl_node_in_pipeline_image_instance_segmentation( - self, - mock_machinelearning_client: MLClient, - mocker: MockFixture, - run_type: str, - tmp_path: Path, + self, + mock_machinelearning_client: MLClient, + mocker: MockFixture, + run_type: str, + tmp_path: Path, ): test_path = ( "./tests/test_configs/pipeline_jobs/jobs_with_automl_nodes/onejob_automl_image_instance_segmentation.yml" @@ -773,7 +773,7 @@ def test_spark_node_in_pipeline(self, mock_machinelearning_client: MLClient, moc "inputs": {"file_input": {"job_input_type": "literal", "value": "${{parent.inputs.iris_data}}"}}, "name": "add_greeting_column", "py_files": ["utils.zip"], - 'resources': {'instance_type': 'standard_e4s_v3', 'runtime_version': '3.1.0'}, + "resources": {"instance_type": "standard_e4s_v3", "runtime_version": "3.1.0"}, "type": "spark", } assert actual_dict == expected_dict @@ -799,7 +799,7 @@ def test_spark_node_in_pipeline(self, mock_machinelearning_client: MLClient, moc "jars": ["scalaproj.jar"], "name": "count_by_row", "outputs": {"output": {"type": "literal", "value": "${{parent.outputs.output}}"}}, - 'resources': {'instance_type': 'standard_e4s_v3', 'runtime_version': '3.1.0'}, + "resources": {"instance_type": "standard_e4s_v3", "runtime_version": "3.1.0"}, "type": "spark", } assert actual_dict == expected_dict @@ -829,14 +829,12 @@ def test_data_transfer_copy_node_in_pipeline(self, mock_machinelearning_client: "_source": "YAML.COMPONENT", "componentId": "", "computeId": "", - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'name': 'copy_files', - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer' + "data_copy_mode": "merge_with_overwrite", + "inputs": {"folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}}, + "name": "copy_files", + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", } assert actual_dict == expected_dict @@ -865,20 +863,21 @@ def test_data_transfer_merge_node_in_pipeline(self, mock_machinelearning_client: "_source": "YAML.COMPONENT", "componentId": "", "computeId": "", - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder_dup}}'}}, - 'name': 'merge_files', - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer' + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder_dup}}"}, + }, + "name": "merge_files", + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", } assert actual_dict == expected_dict - def test_inline_data_transfer_merge_node_in_pipeline(self, mock_machinelearning_client: MLClient, mocker: MockFixture): + def test_inline_data_transfer_merge_node_in_pipeline( + self, mock_machinelearning_client: MLClient, mocker: MockFixture + ): test_path = "./tests/test_configs/pipeline_jobs/data_transfer/merge_files_job.yaml" job = load_job(test_path) @@ -900,23 +899,24 @@ def test_inline_data_transfer_merge_node_in_pipeline(self, mock_machinelearning_ actual_dict = pydash.omit(rest_job_dict["properties"]["jobs"]["merge_files_job"], *omit_fields) expected_dict = { - 'data_copy_mode': 'merge_with_overwrite', + "data_copy_mode": "merge_with_overwrite", "_source": "YAML.JOB", "componentId": "", "computeId": "", - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder_dup}}'}}, - 'name': 'merge_files_job', - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'type': 'data_transfer', - 'task': 'copy_data', + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"}, + "folder2": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder_dup}}"}, + }, + "name": "merge_files_job", + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "type": "data_transfer", + "task": "copy_data", } assert actual_dict == expected_dict - def test_inline_data_transfer_import_database_node_in_pipeline(self, mock_machinelearning_client: MLClient, mocker: MockFixture): + def test_inline_data_transfer_import_database_node_in_pipeline( + self, mock_machinelearning_client: MLClient, mocker: MockFixture + ): test_path = "./tests/test_configs/pipeline_jobs/data_transfer/import_database_to_blob.yaml" job = load_job(test_path) @@ -940,41 +940,65 @@ def test_inline_data_transfer_import_database_node_in_pipeline(self, mock_machin rest_job_dict = pydash.omit(job._to_rest_object().as_dict(), *omit_fields) assert rest_job_dict == { - 'properties': { - 'compute_id': '', - 'description': 'pipeline with data transfer components', - 'inputs': {'query_source_snowflake': {'job_input_type': 'literal', - 'value': 'select * from TPCH_SF1000.PARTSUPP limit 10'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'snowflake_blob': {'_source': 'BUILTIN', - 'computeId': '', - 'name': 'snowflake_blob', - 'outputs': {'sink': {'job_output_type': 'mltable', - 'uri': 'azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/'}}, - 'source': {'connection': 'azureml:my_snowflake_connection', - 'query': '${{parent.inputs.query_source_snowflake}}', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'snowflake_blob_node_input': {'_source': 'BUILTIN', - 'computeId': '', - 'name': 'snowflake_blob_node_input', - 'outputs': {'sink': {'job_output_type': 'mltable', - 'uri': 'azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/'}}, - 'source': {'connection': 'azureml:my_snowflake_connection', - 'query': 'select * from TPCH_SF1000.PARTSUPP limit 10', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'YAML.JOB', - 'default_compute': '', - 'default_datastore': ''}, - 'tags': {}}} - - def test_inline_data_transfer_import_stored_database_node_in_pipeline(self, mock_machinelearning_client: MLClient, mocker: MockFixture): + "properties": { + "compute_id": "", + "description": "pipeline with data transfer components", + "inputs": { + "query_source_snowflake": { + "job_input_type": "literal", + "value": "select * from TPCH_SF1000.PARTSUPP limit 10", + } + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "snowflake_blob": { + "_source": "BUILTIN", + "computeId": "", + "name": "snowflake_blob", + "outputs": { + "sink": { + "job_output_type": "mltable", + "uri": "azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/", + } + }, + "source": { + "connection": "azureml:my_snowflake_connection", + "query": "${{parent.inputs.query_source_snowflake}}", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + "snowflake_blob_node_input": { + "_source": "BUILTIN", + "computeId": "", + "name": "snowflake_blob_node_input", + "outputs": { + "sink": { + "job_output_type": "mltable", + "uri": "azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/", + } + }, + "source": { + "connection": "azureml:my_snowflake_connection", + "query": "select * from TPCH_SF1000.PARTSUPP limit 10", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "YAML.JOB", "default_compute": "", "default_datastore": ""}, + "tags": {}, + } + } + + def test_inline_data_transfer_import_stored_database_node_in_pipeline( + self, mock_machinelearning_client: MLClient, mocker: MockFixture + ): test_path = "./tests/test_configs/pipeline_jobs/data_transfer/import_stored_database_to_blob.yaml" job = load_job(test_path) @@ -997,36 +1021,41 @@ def test_inline_data_transfer_import_stored_database_node_in_pipeline(self, mock rest_job_dict = pydash.omit(job._to_rest_object().as_dict(), *omit_fields) assert rest_job_dict == { - 'properties': { - 'compute_id': '', - 'description': 'pipeline with data transfer components', - 'inputs': {}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'snowflake_blob': {'_source': 'BUILTIN', - 'computeId': '', - 'name': 'snowflake_blob', - 'outputs': {'sink': {'job_output_type': 'mltable'}}, - 'source': {'connection': 'azureml:my_sql_connection', - 'stored_procedure': 'SelectEmployeeByJobAndDepartment', - 'stored_procedure_params': [{'name': 'job', - 'type': 'String', - 'value': 'Engineer'}, - {'name': 'department', - 'type': 'String', - 'value': 'Engineering'}], - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'YAML.JOB', - 'default_compute': '', - 'default_datastore': ''}, - 'tags': {}} + "properties": { + "compute_id": "", + "description": "pipeline with data transfer components", + "inputs": {}, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "snowflake_blob": { + "_source": "BUILTIN", + "computeId": "", + "name": "snowflake_blob", + "outputs": {"sink": {"job_output_type": "mltable"}}, + "source": { + "connection": "azureml:my_sql_connection", + "stored_procedure": "SelectEmployeeByJobAndDepartment", + "stored_procedure_params": [ + {"name": "job", "type": "String", "value": "Engineer"}, + {"name": "department", "type": "String", "value": "Engineering"}, + ], + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + } + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "YAML.JOB", "default_compute": "", "default_datastore": ""}, + "tags": {}, + } } - def test_inline_data_transfer_import_file_system_node_in_pipeline(self, mock_machinelearning_client: MLClient, mocker: MockFixture): + def test_inline_data_transfer_import_file_system_node_in_pipeline( + self, mock_machinelearning_client: MLClient, mocker: MockFixture + ): test_path = "./tests/test_configs/pipeline_jobs/data_transfer/import_file_system_to_blob.yaml" job = load_job(test_path) @@ -1050,44 +1079,59 @@ def test_inline_data_transfer_import_file_system_node_in_pipeline(self, mock_mac rest_job_dict = pydash.omit(job._to_rest_object().as_dict(), *omit_fields) assert rest_job_dict == { - 'properties': { - 'compute_id': '', - 'description': 'pipeline with data transfer components', - 'inputs': {'connection_target': {'job_input_type': 'literal', - 'value': 'azureml:my-s3-connection'}, - 'path_source_s3': {'job_input_type': 'literal', - 'value': 'test1/*'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'s3_blob': {'_source': 'BUILTIN', - 'computeId': '', - 'name': 's3_blob', - 'outputs': {'sink': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/workspaceblobstore/paths/importjob/${{name}}/output_dir/s3//'}}, - 'source': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 's3_blob_input': {'_source': 'BUILTIN', - 'computeId': '', - 'name': 's3_blob_input', - 'outputs': {'sink': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/workspaceblobstore/paths/importjob/${{name}}/output_dir/s3//'}}, - 'source': {'connection': 'azureml:my-s3-connection', - 'path': 'test1/*', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'YAML.JOB', - 'default_compute': '', - 'default_datastore': ''}, - 'tags': {}} + "properties": { + "compute_id": "", + "description": "pipeline with data transfer components", + "inputs": { + "connection_target": {"job_input_type": "literal", "value": "azureml:my-s3-connection"}, + "path_source_s3": {"job_input_type": "literal", "value": "test1/*"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "s3_blob": { + "_source": "BUILTIN", + "computeId": "", + "name": "s3_blob", + "outputs": { + "sink": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/workspaceblobstore/paths/importjob/${{name}}/output_dir/s3//", + } + }, + "source": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + "s3_blob_input": { + "_source": "BUILTIN", + "computeId": "", + "name": "s3_blob_input", + "outputs": { + "sink": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/workspaceblobstore/paths/importjob/${{name}}/output_dir/s3//", + } + }, + "source": {"connection": "azureml:my-s3-connection", "path": "test1/*", "type": "file_system"}, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "YAML.JOB", "default_compute": "", "default_datastore": ""}, + "tags": {}, + } } - def test_inline_data_transfer_export_database_node_in_pipeline(self, mock_machinelearning_client: MLClient, mocker: MockFixture): + def test_inline_data_transfer_export_database_node_in_pipeline( + self, mock_machinelearning_client: MLClient, mocker: MockFixture + ): test_path = "./tests/test_configs/pipeline_jobs/data_transfer/export_database_to_blob.yaml" job = load_job(test_path) @@ -1111,46 +1155,59 @@ def test_inline_data_transfer_export_database_node_in_pipeline(self, mock_machin rest_job_dict = pydash.omit(job._to_rest_object().as_dict(), *omit_fields) assert rest_job_dict == { - 'properties': { - 'compute_id': '', - 'description': 'pipeline with data transfer components', - 'inputs': {'connection_target_azuresql': {'job_input_type': 'literal', - 'value': 'azureml:my_export_azuresqldb_connection'}, - 'cosmos_folder': {'job_input_type': 'uri_file', - 'uri': 'yyy'}, - 'table_name': {'job_input_type': 'literal', - 'value': 'dbo.Persons'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'blob_azuresql': {'_source': 'BUILTIN', - 'computeId': '', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'name': 'blob_azuresql', - 'sink': {'connection': '${{parent.inputs.connection_target_azuresql}}', - 'table_name': '${{parent.inputs.table_name}}', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'blob_azuresql_node_input': {'_source': 'BUILTIN', - 'computeId': '', - 'inputs': {'source': {'job_input_type': 'uri_file', - 'uri': 'yyy'}}, - 'name': 'blob_azuresql_node_input', - 'sink': {'connection': 'azureml:my_export_azuresqldb_connection', - 'table_name': 'dbo.Persons', - 'type': 'database'}, - 'task': 'export_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'YAML.JOB', - 'default_compute': '', - 'default_datastore': ''}, - 'tags': {}} + "properties": { + "compute_id": "", + "description": "pipeline with data transfer components", + "inputs": { + "connection_target_azuresql": { + "job_input_type": "literal", + "value": "azureml:my_export_azuresqldb_connection", + }, + "cosmos_folder": {"job_input_type": "uri_file", "uri": "yyy"}, + "table_name": {"job_input_type": "literal", "value": "dbo.Persons"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "blob_azuresql": { + "_source": "BUILTIN", + "computeId": "", + "inputs": { + "source": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"} + }, + "name": "blob_azuresql", + "sink": { + "connection": "${{parent.inputs.connection_target_azuresql}}", + "table_name": "${{parent.inputs.table_name}}", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + "blob_azuresql_node_input": { + "_source": "BUILTIN", + "computeId": "", + "inputs": {"source": {"job_input_type": "uri_file", "uri": "yyy"}}, + "name": "blob_azuresql_node_input", + "sink": { + "connection": "azureml:my_export_azuresqldb_connection", + "table_name": "dbo.Persons", + "type": "database", + }, + "task": "export_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "YAML.JOB", "default_compute": "", "default_datastore": ""}, + "tags": {}, + } } - def test_inline_data_transfer_export_file_system_node_in_pipeline(self, mock_machinelearning_client: MLClient, mocker: MockFixture): + def test_inline_data_transfer_export_file_system_node_in_pipeline( + self, mock_machinelearning_client: MLClient, mocker: MockFixture + ): test_path = "./tests/test_configs/pipeline_jobs/data_transfer/export_file_system_to_blob.yaml" job = load_job(test_path) @@ -1174,43 +1231,59 @@ def test_inline_data_transfer_export_file_system_node_in_pipeline(self, mock_mac rest_job_dict = pydash.omit(job._to_rest_object().as_dict(), *omit_fields) assert rest_job_dict == { - 'properties': { - 'compute_id': '', - 'description': 'pipeline with data transfer components', - 'inputs': {'connection_target': {'job_input_type': 'literal', - 'value': 'azureml:my_s3_connection'}, - 'cosmos_folder': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}, - 'path_source_s3': {'job_input_type': 'literal', - 'value': 's3://my_bucket/my_folder'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'s3_blob': {'_source': 'BUILTIN', - 'computeId': '', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.inputs.cosmos_folder}}'}}, - 'name': 's3_blob', - 'sink': {'connection': '${{parent.inputs.connection_target}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 's3_blob_input': {'_source': 'BUILTIN', - 'computeId': '', - 'inputs': {'source': {'job_input_type': 'uri_folder', - 'uri': 'azureml://datastores/my_cosmos/paths/source_cosmos'}}, - 'name': 's3_blob_input', - 'sink': {'connection': 'azureml:my_s3_connection', - 'path': 's3://my_bucket/my_folder', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}}, - 'outputs': {}, - 'properties': {}, - 'settings': {'_source': 'YAML.JOB', - 'default_compute': '', - 'default_datastore': ''}, - 'tags': {}} + "properties": { + "compute_id": "", + "description": "pipeline with data transfer components", + "inputs": { + "connection_target": {"job_input_type": "literal", "value": "azureml:my_s3_connection"}, + "cosmos_folder": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + }, + "path_source_s3": {"job_input_type": "literal", "value": "s3://my_bucket/my_folder"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "s3_blob": { + "_source": "BUILTIN", + "computeId": "", + "inputs": { + "source": {"job_input_type": "literal", "value": "${{parent.inputs.cosmos_folder}}"} + }, + "name": "s3_blob", + "sink": { + "connection": "${{parent.inputs.connection_target}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + "s3_blob_input": { + "_source": "BUILTIN", + "computeId": "", + "inputs": { + "source": { + "job_input_type": "uri_folder", + "uri": "azureml://datastores/my_cosmos/paths/source_cosmos", + } + }, + "name": "s3_blob_input", + "sink": { + "connection": "azureml:my_s3_connection", + "path": "s3://my_bucket/my_folder", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + }, + "outputs": {}, + "properties": {}, + "settings": {"_source": "YAML.JOB", "default_compute": "", "default_datastore": ""}, + "tags": {}, + } } def test_data_transfer_multi_node_in_pipeline(self, mock_machinelearning_client: MLClient, mocker: MockFixture): @@ -1237,65 +1310,94 @@ def test_data_transfer_multi_node_in_pipeline(self, mock_machinelearning_client: actual_dict = omit_with_wildcard(rest_job_dict, *omit_fields) assert actual_dict == { - 'properties': { - 'compute_id': '', - 'description': 'pipeline with data transfer components', - 'inputs': {'connection_target_s3': {'job_input_type': 'literal', - 'value': 'azureml:my_s3_connection'}, - 'path_source_s3': {'job_input_type': 'literal', - 'value': 's3://my_bucket/my_folder'}, - 'query_source_snowflake': {'job_input_type': 'literal', - 'value': 'SELECT * FROM my_table'}}, - 'is_archived': False, - 'job_type': 'Pipeline', - 'jobs': {'blob_s3': {'_source': 'BUILTIN', - 'computeId': '', - 'inputs': {'source': {'job_input_type': 'literal', - 'value': '${{parent.jobs.merge_files.outputs.output_folder}}'}}, - 'name': 'blob_s3', - 'sink': {'connection': '${{parent.inputs.connection_target_s3}}', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'export_data', - 'type': 'data_transfer'}, - 'merge_files': {'_source': 'YAML.COMPONENT', - 'computeId': '', - 'data_copy_mode': 'merge_with_overwrite', - 'inputs': {'folder1': {'job_input_type': 'literal', - 'value': '${{parent.jobs.s3_blob.outputs.sink}}'}, - 'folder2': {'job_input_type': 'literal', - 'value': '${{parent.jobs.snowflake_blob.outputs.sink}}'}}, - 'name': 'merge_files', - 'outputs': {'output_folder': {'type': 'literal', - 'value': '${{parent.outputs.merged_blob}}'}}, - 'task': 'copy_data', - 'type': 'data_transfer'}, - 's3_blob': {'_source': 'BUILTIN', - 'computeId': '', - 'name': 's3_blob', - 'outputs': {'sink': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/managed/paths/some_path'}}, - 'source': {'connection': 'azureml:my_s3_connection', - 'path': '${{parent.inputs.path_source_s3}}', - 'type': 'file_system'}, - 'task': 'import_data', - 'type': 'data_transfer'}, - 'snowflake_blob': {'_source': 'BUILTIN', - 'computeId': '', - 'name': 'snowflake_blob', - 'outputs': {'sink': {'job_output_type': 'mltable'}}, - 'source': {'connection': 'azureml:my_snowflake_connection', - 'query': '${{parent.inputs.query_source_snowflake}}', - 'type': 'database'}, - 'task': 'import_data', - 'type': 'data_transfer'}}, - 'outputs': {'merged_blob': {'job_output_type': 'uri_folder', - 'uri': 'azureml://datastores/my_blob/paths/merged_blob'}}, - 'properties': {}, - 'settings': {'_source': 'YAML.JOB', - 'default_compute': '', - 'default_datastore': ''}, - 'tags': {}}} + "properties": { + "compute_id": "", + "description": "pipeline with data transfer components", + "inputs": { + "connection_target_s3": {"job_input_type": "literal", "value": "azureml:my_s3_connection"}, + "path_source_s3": {"job_input_type": "literal", "value": "s3://my_bucket/my_folder"}, + "query_source_snowflake": {"job_input_type": "literal", "value": "SELECT * FROM my_table"}, + }, + "is_archived": False, + "job_type": "Pipeline", + "jobs": { + "blob_s3": { + "_source": "BUILTIN", + "computeId": "", + "inputs": { + "source": { + "job_input_type": "literal", + "value": "${{parent.jobs.merge_files.outputs.output_folder}}", + } + }, + "name": "blob_s3", + "sink": { + "connection": "${{parent.inputs.connection_target_s3}}", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "export_data", + "type": "data_transfer", + }, + "merge_files": { + "_source": "YAML.COMPONENT", + "computeId": "", + "data_copy_mode": "merge_with_overwrite", + "inputs": { + "folder1": {"job_input_type": "literal", "value": "${{parent.jobs.s3_blob.outputs.sink}}"}, + "folder2": { + "job_input_type": "literal", + "value": "${{parent.jobs.snowflake_blob.outputs.sink}}", + }, + }, + "name": "merge_files", + "outputs": {"output_folder": {"type": "literal", "value": "${{parent.outputs.merged_blob}}"}}, + "task": "copy_data", + "type": "data_transfer", + }, + "s3_blob": { + "_source": "BUILTIN", + "computeId": "", + "name": "s3_blob", + "outputs": { + "sink": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/managed/paths/some_path", + } + }, + "source": { + "connection": "azureml:my_s3_connection", + "path": "${{parent.inputs.path_source_s3}}", + "type": "file_system", + }, + "task": "import_data", + "type": "data_transfer", + }, + "snowflake_blob": { + "_source": "BUILTIN", + "computeId": "", + "name": "snowflake_blob", + "outputs": {"sink": {"job_output_type": "mltable"}}, + "source": { + "connection": "azureml:my_snowflake_connection", + "query": "${{parent.inputs.query_source_snowflake}}", + "type": "database", + }, + "task": "import_data", + "type": "data_transfer", + }, + }, + "outputs": { + "merged_blob": { + "job_output_type": "uri_folder", + "uri": "azureml://datastores/my_blob/paths/merged_blob", + } + }, + "properties": {}, + "settings": {"_source": "YAML.JOB", "default_compute": "", "default_datastore": ""}, + "tags": {}, + } + } def test_default_user_identity_if_empty_identity_input(self): test_path = "./tests/test_configs/pipeline_jobs/shakespear_sample/pipeline.yml" @@ -1332,15 +1434,14 @@ def test_default_user_identity_if_empty_identity_input(self): "input1": {"job_input_type": "literal", "value": "${{parent.jobs.sample_word.outputs.output1}}"} }, "name": "count_word", - 'resources': {'instance_type': 'standard_e4s_v3', - 'runtime_version': '3.1.0'}, + "resources": {"instance_type": "standard_e4s_v3", "runtime_version": "3.1.0"}, "type": "spark", }, "sample_word": { "_source": "YAML.JOB", "args": "--input1 ${{inputs.input1}} --output2 " - "${{outputs.output1}} --my_sample_rate " - "${{inputs.sample_rate}}", + "${{outputs.output1}} --my_sample_rate " + "${{inputs.sample_rate}}", "conf": { "spark.driver.cores": 1, "spark.driver.memory": "2g", @@ -1359,8 +1460,7 @@ def test_default_user_identity_if_empty_identity_input(self): }, "name": "sample_word", "outputs": {"output1": {"type": "literal", "value": "${{parent.outputs.output1}}"}}, - 'resources': {'instance_type': 'standard_e4s_v3', - 'runtime_version': '3.1.0'}, + "resources": {"instance_type": "standard_e4s_v3", "runtime_version": "3.1.0"}, "type": "spark", }, }, @@ -1371,7 +1471,7 @@ def test_default_user_identity_if_empty_identity_input(self): } def test_spark_node_in_pipeline_with_dynamic_allocation_disabled( - self, + self, ): test_path = "./tests/test_configs/pipeline_jobs/invalid/pipeline_job_with_spark_job_with_dynamic_allocation_disabled.yml" job = load_job(test_path) @@ -1380,90 +1480,90 @@ def test_spark_node_in_pipeline_with_dynamic_allocation_disabled( assert ve.message == "Should not specify min or max executors when dynamic allocation is disabled." def test_spark_node_in_pipeline_with_invalid_code( - self, + self, ): test_path = "./tests/test_configs/pipeline_jobs/invalid/pipeline_job_with_spark_job_with_invalid_code.yml" job = load_job(test_path) result = job._validate() - assert 'jobs.hello_world.component.entry' in result.error_messages + assert "jobs.hello_world.component.entry" in result.error_messages def test_spark_node_in_pipeline_with_git_code( - self, + self, ): test_path = "./tests/test_configs/pipeline_jobs/invalid/pipeline_job_with_spark_job_with_git_code.yml" job = load_job(test_path) job._validate() def test_infer_pipeline_output_type_as_node_type( - self, + self, ) -> None: pipeline_job = load_job( source="./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_defaults_with_parallel_job_tabular_input_e2e.yml", ) assert ( - pipeline_job.jobs["hello_world_inline_parallel_tabular_job_1"].outputs["job_output_file"].type - == AssetTypes.URI_FILE + pipeline_job.jobs["hello_world_inline_parallel_tabular_job_1"].outputs["job_output_file"].type + == AssetTypes.URI_FILE ) @pytest.mark.parametrize( "pipeline_job_path, expected_type, expected_components", [ ( - "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_registered_component_literal_output_binding_to_inline_job_input.yml", - "uri_folder", - { - "score_job": { - "_source": "YAML.JOB", - "command": 'echo "hello" && echo "world" && echo "train" > world.txt', - "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", - "inputs": {"model_input": {"type": "uri_folder"}, "test_data": {"type": "uri_folder"}}, - "is_deterministic": True, - "outputs": {"score_output": {"type": "uri_folder"}}, - "type": "command", - "version": "1", - }, + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_registered_component_literal_output_binding_to_inline_job_input.yml", + "uri_folder", + { + "score_job": { + "_source": "YAML.JOB", + "command": 'echo "hello" && echo "world" && echo "train" > world.txt', + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", + "inputs": {"model_input": {"type": "uri_folder"}, "test_data": {"type": "uri_folder"}}, + "is_deterministic": True, + "outputs": {"score_output": {"type": "uri_folder"}}, + "type": "command", + "version": "1", }, + }, ), ( - "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_registered_component_literal_output_binding_to_inline_job_input2.yml", - "mltable", - { - "score_job": { - "_source": "YAML.JOB", - "command": 'echo "hello" && echo "world" && echo "train" > world.txt', - "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", - "inputs": {"model_input": {"type": "mltable"}, "test_data": {"type": "uri_folder"}}, - "is_deterministic": True, - "outputs": {"score_output": {"type": "uri_folder"}}, - "type": "command", - "version": "1", - }, + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_registered_component_literal_output_binding_to_inline_job_input2.yml", + "mltable", + { + "score_job": { + "_source": "YAML.JOB", + "command": 'echo "hello" && echo "world" && echo "train" > world.txt', + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", + "inputs": {"model_input": {"type": "mltable"}, "test_data": {"type": "uri_folder"}}, + "is_deterministic": True, + "outputs": {"score_output": {"type": "uri_folder"}}, + "type": "command", + "version": "1", }, + }, ), ( - "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_registered_component_output_binding_to_inline_job_input.yml", - "uri_folder", - { - "score_job": { - "_source": "YAML.JOB", - "command": 'echo "hello" && echo "world" && echo "train" > world.txt', - "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", - "inputs": {"model_input": {"type": "uri_folder"}, "test_data": {"type": "uri_folder"}}, - "is_deterministic": True, - "outputs": {"score_output": {"type": "uri_folder"}}, - "type": "command", - "version": "1", - }, + "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_registered_component_output_binding_to_inline_job_input.yml", + "uri_folder", + { + "score_job": { + "_source": "YAML.JOB", + "command": 'echo "hello" && echo "world" && echo "train" > world.txt', + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", + "inputs": {"model_input": {"type": "uri_folder"}, "test_data": {"type": "uri_folder"}}, + "is_deterministic": True, + "outputs": {"score_output": {"type": "uri_folder"}}, + "type": "command", + "version": "1", }, + }, ), ], ) def test_pipeline_job_with_inline_command_job_input_binding_to_registered_component_job_output( - self, - client: MLClient, - pipeline_job_path: str, - expected_type, - expected_components, + self, + client: MLClient, + pipeline_job_path: str, + expected_type, + expected_components, ) -> None: pipeline_job = load_job( source=pipeline_job_path, @@ -1534,7 +1634,7 @@ def test_pipeline_without_setting_binding_node(self, mock_machinelearning_client } def test_pipeline_with_only_setting_pipeline_level( - self, mock_machinelearning_client: MLClient, mocker: MockFixture + self, mock_machinelearning_client: MLClient, mocker: MockFixture ): test_path = "./tests/test_configs/dsl_pipeline/pipeline_with_set_binding_output_input/pipeline_with_only_setting_pipeline_level.yml" job = load_job(source=test_path) @@ -1651,7 +1751,7 @@ def test_pipeline_with_only_setting_binding_node(self, mock_machinelearning_clie } def test_pipeline_with_setting_binding_node_and_pipeline_level( - self, mock_machinelearning_client: MLClient, mocker: MockFixture + self, mock_machinelearning_client: MLClient, mocker: MockFixture ): test_path = "./tests/test_configs/dsl_pipeline/pipeline_with_set_binding_output_input/pipeline_with_setting_binding_node_and_pipeline_level.yml" job = load_job(source=test_path) @@ -1713,7 +1813,7 @@ def test_pipeline_with_setting_binding_node_and_pipeline_level( } def test_pipeline_with_inline_job_setting_binding_node_and_pipeline_level( - self, mock_machinelearning_client: MLClient, mocker: MockFixture + self, mock_machinelearning_client: MLClient, mocker: MockFixture ): test_path = "./tests/test_configs/dsl_pipeline/pipeline_with_set_binding_output_input/pipeline_with_inline_job_setting_binding_node_and_pipeline_level.yml" job = load_job(source=test_path) @@ -1891,39 +1991,45 @@ def test_pipeline_node_with_identity(self): test_path = "./tests/test_configs/pipeline_jobs/helloworld_pipeline_job_with_identity.yml" pipeline_job: PipelineJob = load_job(source=test_path) - omit_fields = [ - "jobs.*.componentId", - "jobs.*._source" - ] + omit_fields = ["jobs.*.componentId", "jobs.*._source"] actual_dict = omit_with_wildcard(pipeline_job._to_rest_object().as_dict()["properties"], *omit_fields) assert actual_dict["jobs"] == { - 'hello_world_component': { - 'computeId': 'cpu-cluster', - 'identity': {'type': 'user_identity'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_path}}'}}, - 'name': 'hello_world_component', - 'type': 'command'}, - 'hello_world_component_2': { - 'computeId': 'cpu-cluster', - 'identity': {'type': 'aml_token'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_other_number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_path}}'}}, - 'name': 'hello_world_component_2', - 'type': 'command'}, - 'hello_world_component_3': { - 'computeId': 'cpu-cluster', - 'identity': {'type': 'user_identity'}, - 'inputs': {'component_in_number': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_other_number}}'}, - 'component_in_path': {'job_input_type': 'literal', - 'value': '${{parent.inputs.job_in_path}}'}}, - 'name': 'hello_world_component_3', - 'type': 'command'} + "hello_world_component": { + "computeId": "cpu-cluster", + "identity": {"type": "user_identity"}, + "inputs": { + "component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_number}}"}, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"}, + }, + "name": "hello_world_component", + "type": "command", + }, + "hello_world_component_2": { + "computeId": "cpu-cluster", + "identity": {"type": "aml_token"}, + "inputs": { + "component_in_number": { + "job_input_type": "literal", + "value": "${{parent.inputs.job_in_other_number}}", + }, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"}, + }, + "name": "hello_world_component_2", + "type": "command", + }, + "hello_world_component_3": { + "computeId": "cpu-cluster", + "identity": {"type": "user_identity"}, + "inputs": { + "component_in_number": { + "job_input_type": "literal", + "value": "${{parent.inputs.job_in_other_number}}", + }, + "component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"}, + }, + "name": "hello_world_component_3", + "type": "command", + }, } def test_pipeline_parameter_with_empty_value(self, client: MLClient) -> None: @@ -1939,18 +2045,22 @@ class InputGroup: default_compute="cpu-cluster", description="This is the basic pipeline with empty_value", ) - def empty_value_pipeline(integer: int, boolean: bool, number: float, - str_param: str, empty_str: str, input_group: InputGroup): - input_types_func(component_in_string=str_param, - component_in_ranged_integer=integer, - component_in_boolean=boolean, - component_in_ranged_number=number) + def empty_value_pipeline( + integer: int, boolean: bool, number: float, str_param: str, empty_str: str, input_group: InputGroup + ): + input_types_func( + component_in_string=str_param, + component_in_ranged_integer=integer, + component_in_boolean=boolean, + component_in_ranged_number=number, + ) input_types_func(component_in_string=empty_str) input_types_func(component_in_string=input_group.group_empty_str) input_types_func(component_in_string=input_group.group_none_str) - pipeline = empty_value_pipeline(integer=0, boolean=False, number=0, - str_param="str_param", empty_str="", input_group=InputGroup()) + pipeline = empty_value_pipeline( + integer=0, boolean=False, number=0, str_param="str_param", empty_str="", input_group=InputGroup() + ) rest_obj = pipeline._to_rest_object() # Currently MFE not support pass empty str or None as pipeline input. assert len(rest_obj.properties.inputs) == 4 @@ -1966,19 +2076,19 @@ def test_pipeline_input_as_runsettings_value(self, client: MLClient) -> None: default_compute="cpu-cluster", description="Set pipeline input to runsettings", ) - def empty_value_pipeline(integer: int, boolean: bool, number: float, - str_param: str, shm_size: str): - component = input_types_func(component_in_string=str_param, - component_in_ranged_integer=integer, - component_in_boolean=boolean, - component_in_ranged_number=number) + def empty_value_pipeline(integer: int, boolean: bool, number: float, str_param: str, shm_size: str): + component = input_types_func( + component_in_string=str_param, + component_in_ranged_integer=integer, + component_in_boolean=boolean, + component_in_ranged_number=number, + ) component.resources = JobResourceConfiguration( instance_count=integer, shm_size=shm_size, ) - pipeline = empty_value_pipeline(integer=0, boolean=False, number=0, - str_param="str_param", shm_size="20g") + pipeline = empty_value_pipeline(integer=0, boolean=False, number=0, str_param="str_param", shm_size="20g") rest_obj = pipeline._to_rest_object() - expect_resource = {'instance_count': '${{parent.inputs.integer}}', 'shm_size': '${{parent.inputs.shm_size}}'} - assert rest_obj.properties.jobs["component"]["resources"] == expect_resource \ No newline at end of file + expect_resource = {"instance_count": "${{parent.inputs.integer}}", "shm_size": "${{parent.inputs.shm_size}}"} + assert rest_obj.properties.jobs["component"]["resources"] == expect_resource diff --git a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_schema.py b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_schema.py index c2bb7f98b3b0..d4e8bd29c210 100644 --- a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_schema.py +++ b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_schema.py @@ -34,7 +34,13 @@ validate_pipeline_input_key_contains_allowed_characters, ) from azure.ai.ml.entities._job.automl.search_space_utils import _convert_sweep_dist_dict_to_str_dict -from azure.ai.ml.entities._job.job_service import JobService, JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService +from azure.ai.ml.entities._job.job_service import ( + JobService, + JupyterLabJobService, + SshJobService, + TensorBoardJobService, + VsCodeJobService, +) from azure.ai.ml.entities._job.pipeline._io import PipelineInput, PipelineOutput from azure.ai.ml.exceptions import UserErrorException, ValidationException @@ -586,8 +592,9 @@ def _check_data_output_from_rest_formatting(self, rest_output_data: RestJobOutpu assert from_rest_output.mode == rest_output_data.mode def assert_inline_component(self, component_job, component_dict): - assert isinstance(component_job.component, (CommandComponent, ParallelComponent, SparkComponent, - DataTransferComponent)) + assert isinstance( + component_job.component, (CommandComponent, ParallelComponent, SparkComponent, DataTransferComponent) + ) component = component_job.component or component_job.trial assert component._is_anonymous # hash will be generated before create_or_update, so can't check it in unit tests @@ -623,18 +630,14 @@ def test_pipeline_job_inline_component_file(self): job = load_job(test_path) # make sure inline component is parsed into component entity spark_component = job.jobs["merge_files_job"] - component_dict = load_yaml( - "./tests/test_configs/components/data_transfer/merge_files.yaml" - ) + component_dict = load_yaml("./tests/test_configs/components/data_transfer/merge_files.yaml") self.assert_inline_component(spark_component, component_dict) test_path = "./tests/test_configs/pipeline_jobs/data_transfer/copy_files.yaml" job = load_job(test_path) # make sure inline component is parsed into component entity spark_component = job.jobs["copy_files"] - component_dict = load_yaml( - "./tests/test_configs/components/data_transfer/copy_files.yaml" - ) + component_dict = load_yaml("./tests/test_configs/components/data_transfer/copy_files.yaml") self.assert_inline_component(spark_component, component_dict) def test_pipeline_job_inline_component_file_with_complex_path(self): @@ -1149,9 +1152,13 @@ def test_dump_distribution(self): # msrest has been removed from public interface distribution_obj = TensorFlowDistribution(**distribution_dict) - with pytest.raises(ValidationError, match=r"Cannot dump non-PyTorchDistribution object into PyTorchDistributionSchema"): + with pytest.raises( + ValidationError, match=r"Cannot dump non-PyTorchDistribution object into PyTorchDistributionSchema" + ): _ = PyTorchDistributionSchema(context={"base_path": "./"}).dump(distribution_dict) - with pytest.raises(ValidationError, match=r"Cannot dump non-PyTorchDistribution object into PyTorchDistributionSchema"): + with pytest.raises( + ValidationError, match=r"Cannot dump non-PyTorchDistribution object into PyTorchDistributionSchema" + ): _ = PyTorchDistributionSchema(context={"base_path": "./"}).dump(distribution_obj) after_dump_correct = TensorFlowDistributionSchema(context={"base_path": "./"}).dump(distribution_obj) diff --git a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_validate.py b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_validate.py index 6186905f3db9..edb1b6c99e7c 100644 --- a/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_validate.py +++ b/sdk/ml/azure-ai-ml/tests/pipeline_job/unittests/test_pipeline_job_validate.py @@ -53,8 +53,8 @@ class TestPipelineJobValidate: ), ( "./tests/test_configs/pipeline_jobs/invalid/invalid_pipeline_referencing_component_file.yml", - "In order to specify an existing components, please provide the correct registry" - ) + "In order to specify an existing components, please provide the correct registry", + ), ], ) def test_pipeline_job_validation_on_load(self, pipeline_job_path: str, expected_error: str) -> None: @@ -148,7 +148,7 @@ def test_pipeline_job_type_sensitive_error_message(self): { "path": "jobs.hello_world_no_env.trial", "value": None, - } + }, ], "result": "Failed", } @@ -254,15 +254,15 @@ def test_pipeline_job_diagnostics_location_resolution(self, mock_machinelearning [ ( "tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_output_without_name.yaml", - "Output name is required when output version is specified." + "Output name is required when output version is specified.", ), ( "tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_node_output_without_name.yaml", - "Output name is required when output version is specified." + "Output name is required when output version is specified.", ), ( "tests/test_configs/pipeline_jobs/helloworld_pipeline_job_register_pipeline_output_with_invalid_name.yaml", - "The output name pipeline_output@ can only contain alphanumeric characters, dashes and underscores, with a limit of 255 characters." + "The output name pipeline_output@ can only contain alphanumeric characters, dashes and underscores, with a limit of 255 characters.", ), ], ) @@ -678,7 +678,7 @@ def pipeline_with_compute_binding(compute_name: str): node1.compute = compute_name sub_pipeline_with_compute_binding(compute_name) - pipeline_job = pipeline_with_compute_binding('cpu-cluster') + pipeline_job = pipeline_with_compute_binding("cpu-cluster") # Assert compute binding validate not raise error when validate assert pipeline_job._validate().passed diff --git a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_controlflow_pipeline.pyTestIfElsetest_registered_component_is_control.json b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_controlflow_pipeline.pyTestIfElsetest_registered_component_is_control.json index 9f016573be95..5fc89b323d12 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_controlflow_pipeline.pyTestIfElsetest_registered_component_is_control.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_controlflow_pipeline.pyTestIfElsetest_registered_component_is_control.json @@ -13,26 +13,22 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "1067", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 13 Feb 2023 08:20:22 GMT", + "Date": "Tue, 14 Feb 2023 11:20:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-3cf57177b2626ed96c59aa6c5cfead04-4c6990034acab994-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-7b50c2406ecc52f714f83b9517fe2a75-619983ad6f925323-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": [ - "Accept-Encoding", - "Accept-Encoding" - ], - "x-aml-cluster": "vienna-test-westus2-02", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "903206a0-8181-42c6-8072-d55e11db8d74", - "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-correlation-request-id": "5add93fc-0e4d-4187-b976-1eb3be181fb3", + "x-ms-ratelimit-remaining-subscription-reads": "11998", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20230213T082022Z:903206a0-8181-42c6-8072-d55e11db8d74", - "x-request-time": "0.202" + "x-ms-routing-request-id": "JAPANEAST:20230214T112002Z:5add93fc-0e4d-4187-b976-1eb3be181fb3", + "x-request-time": "0.925" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -77,23 +73,21 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "61", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 13 Feb 2023 08:20:23 GMT", + "Date": "Tue, 14 Feb 2023 11:20:03 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-655afd37017cbee6cbbfca6968112b2b-44511604d4b3458a-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-137b8063fe82574cc55fa3af4d618c14-430d4ace90de94f6-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "89255aa9-8875-47b7-bcb6-2e52909d3724", - "x-ms-ratelimit-remaining-subscription-writes": "1193", + "x-ms-correlation-request-id": "8bacdb26-6a3c-4cc4-8a67-b168baea02c2", + "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20230213T082023Z:89255aa9-8875-47b7-bcb6-2e52909d3724", - "x-request-time": "0.576" + "x-ms-routing-request-id": "JAPANEAST:20230214T112003Z:8bacdb26-6a3c-4cc4-8a67-b168baea02c2", + "x-request-time": "0.634" }, "ResponseBody": { "secretsType": "AccountKey", @@ -108,7 +102,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "User-Agent": "azsdk-python-storage-blob/12.12.0 Python/3.8.13 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Mon, 13 Feb 2023 08:20:23 GMT", + "x-ms-date": "Tue, 14 Feb 2023 11:20:03 GMT", "x-ms-version": "2021-06-08" }, "RequestBody": null, @@ -118,7 +112,7 @@ "Content-Length": "35", "Content-MD5": "L/DnSpFIn\u002BjaQWc\u002BsUQdcw==", "Content-Type": "application/octet-stream", - "Date": "Mon, 13 Feb 2023 08:20:22 GMT", + "Date": "Tue, 14 Feb 2023 11:20:04 GMT", "ETag": "\u00220x8DA9D48E17467D7\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:49:17 GMT", "Server": [ @@ -148,13 +142,13 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "User-Agent": "azsdk-python-storage-blob/12.12.0 Python/3.8.13 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Mon, 13 Feb 2023 08:20:23 GMT", + "x-ms-date": "Tue, 14 Feb 2023 11:20:04 GMT", "x-ms-version": "2021-06-08" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Mon, 13 Feb 2023 08:20:23 GMT", + "Date": "Tue, 14 Feb 2023 11:20:04 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -191,26 +185,22 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "809", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 13 Feb 2023 08:20:27 GMT", + "Date": "Tue, 14 Feb 2023 11:20:09 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-49c9e22ff6c40e8348bb1f808843f790-8e894f9dd32ecc16-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-ee3726b8a90dfd1f35ecf4e74b6a896f-d048001fd8dc0706-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": [ - "Accept-Encoding", - "Accept-Encoding" - ], - "x-aml-cluster": "vienna-test-westus2-02", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "05da81d9-a28b-4a7f-9c1e-a18ee0917874", - "x-ms-ratelimit-remaining-subscription-writes": "1186", + "x-ms-correlation-request-id": "7cd374b4-b46d-4b6a-9b40-86b033de1b41", + "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20230213T082027Z:05da81d9-a28b-4a7f-9c1e-a18ee0917874", - "x-request-time": "0.206" + "x-ms-routing-request-id": "JAPANEAST:20230214T112010Z:7cd374b4-b46d-4b6a-9b40-86b033de1b41", + "x-request-time": "1.233" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", @@ -231,7 +221,7 @@ "createdAt": "2022-09-23T09:49:20.984936\u002B00:00", "createdBy": "Ying Chen", "createdByType": "User", - "lastModifiedAt": "2023-02-13T08:20:27.4274126\u002B00:00", + "lastModifiedAt": "2023-02-14T11:20:09.8080158\u002B00:00", "lastModifiedBy": "Brynn Yin", "lastModifiedByType": "User" } @@ -261,20 +251,20 @@ "Cache-Control": "no-cache", "Content-Length": "1466", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 13 Feb 2023 08:20:29 GMT", + "Date": "Tue, 14 Feb 2023 11:20:12 GMT", "Expires": "-1", "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/environments/CliV2AnonymousEnvironment/versions/6eedff85d2f858b9cd4e12021dbc722e?api-version=2022-05-01", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-ee7bb0139622f1443e98ad8e3675fd3f-08c698313119e44c-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-4bbb02859b02caf579bdf27c6d085cc1-9abdaf6b39693eed-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3f6566ff-4510-4620-9036-ce337f2b0298", - "x-ms-ratelimit-remaining-subscription-writes": "1185", + "x-ms-correlation-request-id": "1617cf39-ea31-4109-88a1-638eeb5b1435", + "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20230213T082029Z:3f6566ff-4510-4620-9036-ce337f2b0298", - "x-request-time": "1.426" + "x-ms-routing-request-id": "JAPANEAST:20230214T112013Z:1617cf39-ea31-4109-88a1-638eeb5b1435", + "x-request-time": "2.407" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/environments/CliV2AnonymousEnvironment/versions/6eedff85d2f858b9cd4e12021dbc722e", @@ -314,26 +304,22 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "652", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 13 Feb 2023 08:20:30 GMT", + "Date": "Tue, 14 Feb 2023 11:20:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-f93f5b30eb48e1f3a9db35f4d043190b-e9c7d4948dbbb73e-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-019d1a7a012ce27d9971d46b73dfcab6-c4b9be6033ed1da5-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": [ - "Accept-Encoding", - "Accept-Encoding" - ], - "x-aml-cluster": "vienna-test-westus2-02", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "2ecaa02f-8bb1-45b1-a7c3-05b9b8209461", - "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-correlation-request-id": "7fe45558-f583-41de-9b0d-0230acdde32a", + "x-ms-ratelimit-remaining-subscription-reads": "11997", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20230213T082030Z:2ecaa02f-8bb1-45b1-a7c3-05b9b8209461", - "x-request-time": "0.149" + "x-ms-routing-request-id": "JAPANEAST:20230214T112014Z:7fe45558-f583-41de-9b0d-0230acdde32a", + "x-request-time": "0.392" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/primitive_component_with_normal_input_output_v2", @@ -345,16 +331,16 @@ "properties": {}, "isArchived": false, "latestVersion": null, - "nextVersion": "2023-02-13-08-20-30-1659288" + "nextVersion": "2023-02-14-11-20-14-3566323" }, "systemData": { "createdAt": "2023-01-17T10:31:19.355959\u002B00:00", - "lastModifiedAt": "2023-02-13T07:54:23.7361426\u002B00:00" + "lastModifiedAt": "2023-02-13T08:20:31.3926387\u002B00:00" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/primitive_component_with_normal_input_output_v2/versions/2023-02-13-08-20-30-1659288?api-version=2022-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/primitive_component_with_normal_input_output_v2/versions/2023-02-14-11-20-14-3566323?api-version=2022-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -432,24 +418,24 @@ "Cache-Control": "no-cache", "Content-Length": "3329", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 13 Feb 2023 08:20:32 GMT", + "Date": "Tue, 14 Feb 2023 11:20:16 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/primitive_component_with_normal_input_output_v2/versions/2023-02-13-08-20-30-1659288?api-version=2022-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/primitive_component_with_normal_input_output_v2/versions/2023-02-14-11-20-14-3566323?api-version=2022-10-01", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-eb8fce5b95612211e3be2fb417a69aae-aa42e20c3b875246-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-b7e1370aafe58a97bb1286548a2e4411-c2e7ccbfebf5c868-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "95b4062a-b366-431c-ab96-15824acfc0cf", - "x-ms-ratelimit-remaining-subscription-writes": "1184", + "x-ms-correlation-request-id": "e70f0e54-47e7-4980-89d4-c11ece41843b", + "x-ms-ratelimit-remaining-subscription-writes": "1197", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20230213T082032Z:95b4062a-b366-431c-ab96-15824acfc0cf", - "x-request-time": "1.484" + "x-ms-routing-request-id": "JAPANEAST:20230214T112016Z:e70f0e54-47e7-4980-89d4-c11ece41843b", + "x-request-time": "2.043" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/primitive_component_with_normal_input_output_v2/versions/2023-02-13-08-20-30-1659288", - "name": "2023-02-13-08-20-30-1659288", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/primitive_component_with_normal_input_output_v2/versions/2023-02-14-11-20-14-3566323", + "name": "2023-02-14-11-20-14-3566323", "type": "Microsoft.MachineLearningServices/workspaces/components/versions", "properties": { "description": null, @@ -461,7 +447,7 @@ "isAnonymous": true, "componentSpec": { "name": "primitive_component_with_normal_input_output_v2", - "version": "2023-02-13-08-20-30-1659288", + "version": "2023-02-14-11-20-14-3566323", "display_name": "primitive_component_with_normal_input_output_v2", "is_deterministic": "True", "type": "command", @@ -522,10 +508,439 @@ } }, "systemData": { - "createdAt": "2023-02-13T08:20:31.1428218\u002B00:00", + "createdAt": "2023-02-14T11:20:15.8485314\u002B00:00", + "createdBy": "Brynn Yin", + "createdByType": "User", + "lastModifiedAt": "2023-02-14T11:20:16.4314479\u002B00:00", + "lastModifiedBy": "Brynn Yin", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e1ac6c0c-bdef-cf2c-8f88-e8573a7e19e7?api-version=2022-10-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1964", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": { + "properties": { + "properties": {}, + "tags": { + "codegenBy": "mldesigner" + }, + "isAnonymous": true, + "isArchived": false, + "componentSpec": { + "command": "mldesigner execute --source entry.py --name primitive_component_with_normal_input_output_v2 --inputs input_data=\u0022${{inputs.input_data}}\u0022 parambool=\u0022${{inputs.parambool}}\u0022 paramint=\u0022${{inputs.paramint}}\u0022 paramfloat=\u0022${{inputs.paramfloat}}\u0022 paramstr=\u0022${{inputs.paramstr}}\u0022 --outputs output_data=\u0022${{outputs.output_data}}\u0022 bool_param_output=\u0022${{outputs.bool_param_output}}\u0022 int_param_output=\u0022${{outputs.int_param_output}}\u0022 float_param_output=\u0022${{outputs.float_param_output}}\u0022 str_param_output=\u0022${{outputs.str_param_output}}\u0022", + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "environment": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/environments/CliV2AnonymousEnvironment/versions/6eedff85d2f858b9cd4e12021dbc722e", + "name": "primitive_component_with_normal_input_output_v2", + "tags": { + "codegenBy": "mldesigner" + }, + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json", + "display_name": "primitive_component_with_normal_input_output_v2", + "is_deterministic": true, + "inputs": { + "input_data": { + "type": "uri_folder" + }, + "parambool": { + "type": "boolean" + }, + "paramint": { + "type": "integer" + }, + "paramfloat": { + "type": "number" + }, + "paramstr": { + "type": "string" + } + }, + "outputs": { + "output_data": { + "type": "uri_folder" + }, + "bool_param_output": { + "type": "boolean", + "is_control": true, + "early_available": true + }, + "int_param_output": { + "type": "integer", + "is_control": true + }, + "float_param_output": { + "type": "number", + "is_control": true + }, + "str_param_output": { + "type": "string", + "is_control": true + } + }, + "type": "command", + "_source": "YAML.COMPONENT" + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "3269", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 11:20:18 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e1ac6c0c-bdef-cf2c-8f88-e8573a7e19e7?api-version=2022-10-01", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-3f8224c191a0e7e25959e085a3f706a8-047a3a33d47af833-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "91ac3689-09b2-464f-aeed-9674a1e1a737", + "x-ms-ratelimit-remaining-subscription-writes": "1196", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230214T112019Z:91ac3689-09b2-464f-aeed-9674a1e1a737", + "x-request-time": "1.254" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/656aad5f-9386-4137-97bb-776d61c0c8c5", + "name": "656aad5f-9386-4137-97bb-776d61c0c8c5", + "type": "Microsoft.MachineLearningServices/workspaces/components/versions", + "properties": { + "description": null, + "tags": { + "codegenBy": "mldesigner" + }, + "properties": {}, + "isArchived": false, + "isAnonymous": true, + "componentSpec": { + "name": "primitive_component_with_normal_input_output_v2", + "display_name": "primitive_component_with_normal_input_output_v2", + "is_deterministic": "True", + "type": "command", + "tags": { + "codegenBy": "mldesigner" + }, + "inputs": { + "input_data": { + "type": "uri_folder", + "optional": "False" + }, + "parambool": { + "type": "boolean", + "optional": "False" + }, + "paramint": { + "type": "integer", + "optional": "False" + }, + "paramfloat": { + "type": "number", + "optional": "False" + }, + "paramstr": { + "type": "string", + "optional": "False" + } + }, + "outputs": { + "output_data": { + "type": "uri_folder" + }, + "bool_param_output": { + "type": "boolean", + "is_control": "True", + "early_available": "True" + }, + "int_param_output": { + "type": "integer", + "is_control": "True" + }, + "float_param_output": { + "type": "number", + "is_control": "True" + }, + "str_param_output": { + "type": "string", + "is_control": "True" + } + }, + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "environment": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/environments/CliV2AnonymousEnvironment/versions/6eedff85d2f858b9cd4e12021dbc722e", + "resources": { + "instance_count": "1" + }, + "command": "mldesigner execute --source entry.py --name primitive_component_with_normal_input_output_v2 --inputs input_data=\u0022${{inputs.input_data}}\u0022 parambool=\u0022${{inputs.parambool}}\u0022 paramint=\u0022${{inputs.paramint}}\u0022 paramfloat=\u0022${{inputs.paramfloat}}\u0022 paramstr=\u0022${{inputs.paramstr}}\u0022 --outputs output_data=\u0022${{outputs.output_data}}\u0022 bool_param_output=\u0022${{outputs.bool_param_output}}\u0022 int_param_output=\u0022${{outputs.int_param_output}}\u0022 float_param_output=\u0022${{outputs.float_param_output}}\u0022 str_param_output=\u0022${{outputs.str_param_output}}\u0022", + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json" + } + }, + "systemData": { + "createdAt": "2023-02-14T11:20:18.6849022\u002B00:00", + "createdBy": "Brynn Yin", + "createdByType": "User", + "lastModifiedAt": "2023-02-14T11:20:18.6849022\u002B00:00", + "lastModifiedBy": "Brynn Yin", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/test_pipeline_component_control_output?api-version=2022-10-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "1089", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 11:20:19 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "ffa49524-26ac-4968-b122-6fa11fb42c3b", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-response-type": "error", + "x-ms-routing-request-id": "JAPANEAST:20230214T112020Z:ffa49524-26ac-4968-b122-6fa11fb42c3b", + "x-request-time": "0.114" + }, + "ResponseBody": { + "error": { + "code": "UserError", + "message": "Not found component test_pipeline_component_control_output.", + "details": [], + "additionalInfo": [ + { + "type": "ComponentName", + "info": { + "value": "managementfrontend" + } + }, + { + "type": "Correlation", + "info": { + "value": { + "operation": "0ebae9d4cdf6a14a5204a263682fab59", + "request": "8988b24cc4882efb" + } + } + }, + { + "type": "Environment", + "info": { + "value": "master" + } + }, + { + "type": "Location", + "info": { + "value": "westus2" + } + }, + { + "type": "Time", + "info": { + "value": "2023-02-14T11:20:20.0772447\u002B00:00" + } + }, + { + "type": "InnerError", + "info": { + "value": { + "code": "NotFound", + "innerError": { + "code": "ComponentNotFound", + "innerError": null + } + } + } + } + ] + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/test_pipeline_component_control_output/versions/1?api-version=2022-10-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1703", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": { + "properties": { + "properties": {}, + "tags": {}, + "isAnonymous": false, + "isArchived": false, + "componentSpec": { + "name": "test_pipeline_component_control_output", + "display_name": "test_pipeline_component_control_output", + "outputs": { + "output_data": { + "type": "uri_folder" + }, + "bool_param_output": { + "type": "boolean", + "is_control": true + }, + "int_param_output": { + "type": "integer", + "is_control": true + }, + "float_param_output": { + "type": "number", + "is_control": true + }, + "str_param_output": { + "type": "string", + "is_control": true + } + }, + "type": "pipeline", + "jobs": { + "node": { + "name": "node", + "type": "command", + "inputs": { + "input_data": { + "uri": "https://dprepdata.blob.core.windows.net/demo/Titanic.csv", + "job_input_type": "uri_file" + }, + "parambool": { + "job_input_type": "literal", + "value": "True" + }, + "paramint": { + "job_input_type": "literal", + "value": "2" + }, + "paramfloat": { + "job_input_type": "literal", + "value": "2.2" + }, + "paramstr": { + "job_input_type": "literal", + "value": "test" + } + }, + "outputs": { + "output_data": { + "value": "${{parent.outputs.output_data}}", + "type": "literal" + }, + "bool_param_output": { + "value": "${{parent.outputs.bool_param_output}}", + "type": "literal" + }, + "int_param_output": { + "value": "${{parent.outputs.int_param_output}}", + "type": "literal" + }, + "float_param_output": { + "value": "${{parent.outputs.float_param_output}}", + "type": "literal" + }, + "str_param_output": { + "value": "${{parent.outputs.str_param_output}}", + "type": "literal" + } + }, + "_source": "YAML.COMPONENT", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/656aad5f-9386-4137-97bb-776d61c0c8c5" + } + }, + "_source": "DSL", + "sourceJobId": null + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "1427", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 11:20:22 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/test_pipeline_component_control_output/versions/1?api-version=2022-10-01", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-7e532682b6027401059d1c35472b88ee-7ebdf7926fec6b17-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "1a2c5d33-02a4-4702-84fc-179904f948d7", + "x-ms-ratelimit-remaining-subscription-writes": "1195", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230214T112023Z:1a2c5d33-02a4-4702-84fc-179904f948d7", + "x-request-time": "3.245" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/test_pipeline_component_control_output/versions/1", + "name": "1", + "type": "Microsoft.MachineLearningServices/workspaces/components/versions", + "properties": { + "description": null, + "tags": {}, + "properties": {}, + "isArchived": false, + "isAnonymous": false, + "componentSpec": { + "name": "test_pipeline_component_control_output", + "version": "1", + "display_name": "test_pipeline_component_control_output", + "is_deterministic": "False", + "type": "pipeline", + "outputs": { + "output_data": { + "type": "uri_folder" + }, + "bool_param_output": { + "type": "boolean", + "is_control": "True" + }, + "int_param_output": { + "type": "integer", + "is_control": "True" + }, + "float_param_output": { + "type": "number", + "is_control": "True" + }, + "str_param_output": { + "type": "string", + "is_control": "True" + } + } + } + }, + "systemData": { + "createdAt": "2023-02-14T11:20:22.9444707\u002B00:00", "createdBy": "Brynn Yin", "createdByType": "User", - "lastModifiedAt": "2023-02-13T08:20:31.7187417\u002B00:00", + "lastModifiedAt": "2023-02-14T11:20:23.446778\u002B00:00", "lastModifiedBy": "Brynn Yin", "lastModifiedByType": "User" } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_command_function.json b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_command_function.json index 1aa652def645..acd0a7b899ba 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_command_function.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_command_function.json @@ -7,7 +7,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15,11 +15,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:40 GMT", + "Date": "Wed, 15 Feb 2023 04:02:42 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-5d5840909b316df67598079b5474418f-0a7d7368417f0f35-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-9c046a051637bf5bcd62f8b5f3f0840f-d56161a603efdcea-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -28,11 +28,11 @@ ], "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "37764f2b-1a80-43ee-90d7-ab183174bd2c", + "x-ms-correlation-request-id": "790d3645-2528-4113-8511-c78473f0beaf", "x-ms-ratelimit-remaining-subscription-reads": "11999", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224740Z:37764f2b-1a80-43ee-90d7-ab183174bd2c", - "x-request-time": "0.227" + "x-ms-routing-request-id": "JAPANEAST:20230215T040242Z:790d3645-2528-4113-8511-c78473f0beaf", + "x-request-time": "0.220" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", @@ -71,7 +71,7 @@ "preemptedNodeCount": 0 }, "allocationState": "Steady", - "allocationStateTransitionTime": "2023-01-06T18:59:34.232\u002B00:00", + "allocationStateTransitionTime": "2023-02-03T15:03:52.027\u002B00:00", "errors": null, "remoteLoginPortPublicAccess": "Enabled", "osType": "Linux", @@ -89,7 +89,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -97,11 +97,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:44 GMT", + "Date": "Wed, 15 Feb 2023 04:02:45 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-2e194abf0b454ba99f29ab453ee90851-b6667c8bba268ac7-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-b7b4f1f772e9f5f4f9e825a04c955961-475ba6c9cc037990-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -110,11 +110,11 @@ ], "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3b6ca9eb-b198-41ec-9c61-d686b6829626", + "x-ms-correlation-request-id": "c47451e8-555c-4524-a70b-53b15ba98167", "x-ms-ratelimit-remaining-subscription-reads": "11998", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224744Z:3b6ca9eb-b198-41ec-9c61-d686b6829626", - "x-request-time": "0.118" + "x-ms-routing-request-id": "JAPANEAST:20230215T040245Z:c47451e8-555c-4524-a70b-53b15ba98167", + "x-request-time": "0.193" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -152,7 +152,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -160,11 +160,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:44 GMT", + "Date": "Wed, 15 Feb 2023 04:02:45 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-a6161cad9f2a070e1dc24a9eb88ba6a9-b0f7dc09ca35a2e4-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-1ae8fec4f8f026d3ef4d6ef393744fc8-803d5bbe53b44b37-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -173,11 +173,11 @@ ], "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "06e90b69-12ee-4ded-931a-5742155d049e", + "x-ms-correlation-request-id": "ab8f558a-32d6-470c-87db-eef824f2e9c0", "x-ms-ratelimit-remaining-subscription-reads": "11999", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224744Z:06e90b69-12ee-4ded-931a-5742155d049e", - "x-request-time": "0.100" + "x-ms-routing-request-id": "JAPANEAST:20230215T040246Z:ab8f558a-32d6-470c-87db-eef824f2e9c0", + "x-request-time": "0.166" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -215,7 +215,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -223,11 +223,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:44 GMT", + "Date": "Wed, 15 Feb 2023 04:02:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-06a9cffb015d2d9942353b3c33cc0dbe-2de0bcdeaebe0d9e-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-f31d37a25c2db12e3ccdc91bec3fbeb0-5ed2dc8a55cb3a04-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -236,11 +236,11 @@ ], "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5cb069a4-4959-4c1d-a4c0-70f7bd49f1c2", - "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-correlation-request-id": "bdbf1ea6-5679-4ac6-b1a6-519fd3371d07", + "x-ms-ratelimit-remaining-subscription-reads": "11998", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224744Z:5cb069a4-4959-4c1d-a4c0-70f7bd49f1c2", - "x-request-time": "0.084" + "x-ms-routing-request-id": "JAPANEAST:20230215T040246Z:bdbf1ea6-5679-4ac6-b1a6-519fd3371d07", + "x-request-time": "0.170" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -279,7 +279,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -287,21 +287,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:45 GMT", + "Date": "Wed, 15 Feb 2023 04:02:45 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-ec0455cd5ad376fc8b50ea7cfc3107ad-6addd1396317bd32-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-f048ce492ef314e8fd1dc37b08df3774-afb0c17cb5a7c43b-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "be729a3a-9bf8-484f-9962-03dd4d659fef", + "x-ms-correlation-request-id": "a74569b2-e846-4c09-aed4-fea8efeb9e04", "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224745Z:be729a3a-9bf8-484f-9962-03dd4d659fef", - "x-request-time": "0.481" + "x-ms-routing-request-id": "JAPANEAST:20230215T040246Z:a74569b2-e846-4c09-aed4-fea8efeb9e04", + "x-request-time": "0.524" }, "ResponseBody": { "secretsType": "AccountKey", @@ -316,7 +316,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -324,21 +324,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:46 GMT", + "Date": "Wed, 15 Feb 2023 04:02:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-2f12d342573cd4e69a358d85b3e3b52d-96be820aed098c26-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-8a84665c14d164979e59bc66a3a30ee1-5f012c7c4abcb5b0-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f309b765-ec0c-4b0f-be84-8d9d5d5bafec", + "x-ms-correlation-request-id": "a98e2cb5-e4f1-400f-8b4e-10b5d976ff04", "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224746Z:f309b765-ec0c-4b0f-be84-8d9d5d5bafec", - "x-request-time": "0.103" + "x-ms-routing-request-id": "JAPANEAST:20230215T040246Z:a98e2cb5-e4f1-400f-8b4e-10b5d976ff04", + "x-request-time": "0.199" }, "ResponseBody": { "secretsType": "AccountKey", @@ -353,7 +353,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -361,21 +361,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:45 GMT", + "Date": "Wed, 15 Feb 2023 04:02:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-ffc589d7d126b54bd6d3b322a4b41d92-c8d48fa08f176a7a-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-fc8e3f86d4b252f820dc9933a8e186a3-b9829d3de3b3b7ff-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "83ec11a4-c481-4e99-8a42-43d6eaeeaf17", + "x-ms-correlation-request-id": "a3a116d3-743b-43d2-baf9-9c7f8b58a9e1", "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224746Z:83ec11a4-c481-4e99-8a42-43d6eaeeaf17", - "x-request-time": "0.139" + "x-ms-routing-request-id": "JAPANEAST:20230215T040247Z:a3a116d3-743b-43d2-baf9-9c7f8b58a9e1", + "x-request-time": "0.167" }, "ResponseBody": { "secretsType": "AccountKey", @@ -389,8 +389,8 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Tue, 17 Jan 2023 22:47:46 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:02:46 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, @@ -400,7 +400,7 @@ "Content-Length": "35", "Content-MD5": "L/DnSpFIn\u002BjaQWc\u002BsUQdcw==", "Content-Type": "application/octet-stream", - "Date": "Tue, 17 Jan 2023 22:47:46 GMT", + "Date": "Wed, 15 Feb 2023 04:02:47 GMT", "ETag": "\u00220x8DA9D48E17467D7\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:49:17 GMT", "Server": [ @@ -429,8 +429,8 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Tue, 17 Jan 2023 22:47:47 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:02:46 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, @@ -440,7 +440,7 @@ "Content-Length": "35", "Content-MD5": "L/DnSpFIn\u002BjaQWc\u002BsUQdcw==", "Content-Type": "application/octet-stream", - "Date": "Tue, 17 Jan 2023 22:47:46 GMT", + "Date": "Wed, 15 Feb 2023 04:02:47 GMT", "ETag": "\u00220x8DA9D48E17467D7\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:49:17 GMT", "Server": [ @@ -469,18 +469,19 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Tue, 17 Jan 2023 22:47:47 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:02:46 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Accept-Ranges": "bytes", + "Connection": "close", "Content-Length": "35", "Content-MD5": "L/DnSpFIn\u002BjaQWc\u002BsUQdcw==", "Content-Type": "application/octet-stream", - "Date": "Tue, 17 Jan 2023 22:47:47 GMT", + "Date": "Wed, 15 Feb 2023 04:02:47 GMT", "ETag": "\u00220x8DA9D48E17467D7\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:49:17 GMT", "Server": [ @@ -509,14 +510,14 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Tue, 17 Jan 2023 22:47:48 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:02:47 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Tue, 17 Jan 2023 22:47:46 GMT", + "Date": "Wed, 15 Feb 2023 04:02:47 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -535,14 +536,14 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Tue, 17 Jan 2023 22:47:48 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:02:47 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Tue, 17 Jan 2023 22:47:47 GMT", + "Date": "Wed, 15 Feb 2023 04:02:47 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -561,14 +562,14 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Tue, 17 Jan 2023 22:47:49 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:02:47 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Tue, 17 Jan 2023 22:47:47 GMT", + "Date": "Wed, 15 Feb 2023 04:02:47 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -589,7 +590,7 @@ "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -607,11 +608,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:50 GMT", + "Date": "Wed, 15 Feb 2023 04:02:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-79aec8e6acbbc6b9489794ba42ef4204-f4bf5b1300776fa6-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-8cd18c40c63faa4a78480aa4e59fd593-bd5c16843701f1fa-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -620,11 +621,11 @@ ], "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ffa30e1c-6f0d-409e-966b-828ad8cc456f", + "x-ms-correlation-request-id": "7c8fa584-2bbd-4a26-b3b6-23427805e60a", "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224751Z:ffa30e1c-6f0d-409e-966b-828ad8cc456f", - "x-request-time": "1.366" + "x-ms-routing-request-id": "JAPANEAST:20230215T040252Z:7c8fa584-2bbd-4a26-b3b6-23427805e60a", + "x-request-time": "1.517" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", @@ -645,8 +646,8 @@ "createdAt": "2022-09-23T09:49:20.984936\u002B00:00", "createdBy": "Ying Chen", "createdByType": "User", - "lastModifiedAt": "2023-01-17T22:47:51.1801611\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-15T04:02:51.8842072\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } @@ -660,7 +661,7 @@ "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -678,24 +679,24 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:51 GMT", + "Date": "Wed, 15 Feb 2023 04:02:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-5c58fa15a90c4f83fc3dd991acc54c64-ddf29eab2487779c-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-1db1f759576365b67250bc43dbdaa41f-6e89291a79457209-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ "Accept-Encoding", "Accept-Encoding" ], - "x-aml-cluster": "vienna-test-westus2-01", + "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5043f7fb-0517-4347-bb07-b152d24f637c", + "x-ms-correlation-request-id": "26ad5314-adfc-4c8b-be55-dc1732f7eac2", "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224751Z:5043f7fb-0517-4347-bb07-b152d24f637c", - "x-request-time": "1.380" + "x-ms-routing-request-id": "JAPANEAST:20230215T040252Z:26ad5314-adfc-4c8b-be55-dc1732f7eac2", + "x-request-time": "1.560" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", @@ -716,8 +717,8 @@ "createdAt": "2022-09-23T09:49:20.984936\u002B00:00", "createdBy": "Ying Chen", "createdByType": "User", - "lastModifiedAt": "2023-01-17T22:47:51.196006\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-15T04:02:52.0062955\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } @@ -731,7 +732,7 @@ "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -749,24 +750,24 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:51 GMT", + "Date": "Wed, 15 Feb 2023 04:02:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-56b680ef958b77f96442a2a2543989c3-62ab5fc5aa16a725-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-f910f4333f8d938c34c76369837ec372-fdc923b674f0dd62-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ "Accept-Encoding", "Accept-Encoding" ], - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0b54c32b-b426-4153-b1f5-69b852fdd732", + "x-ms-correlation-request-id": "aeabf9a3-47c8-40fb-86eb-88c0347a30bc", "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224751Z:0b54c32b-b426-4153-b1f5-69b852fdd732", - "x-request-time": "1.368" + "x-ms-routing-request-id": "JAPANEAST:20230215T040252Z:aeabf9a3-47c8-40fb-86eb-88c0347a30bc", + "x-request-time": "1.264" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", @@ -787,288 +788,285 @@ "createdAt": "2022-09-23T09:49:20.984936\u002B00:00", "createdBy": "Ying Chen", "createdByType": "User", - "lastModifiedAt": "2023-01-17T22:47:51.2455004\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-15T04:02:52.1737635\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e9bbafd7-0097-d5fa-f630-6bb2a83a8a06?api-version=2022-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/2a7566cc-2012-20c3-4bee-ebaaecc821d4?api-version=2022-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "894", + "Content-Length": "1313", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { + "description": "This is the basic command component", "properties": {}, - "tags": {}, + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, "isAnonymous": true, "isArchived": false, "componentSpec": { - "command": "echo \u0022hello world\u0022", + "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", - "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", - "resources": { - "instance_count": 2 - }, - "distribution": { - "type": "pytorch", - "process_count_per_instance": 2 + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:1", + "name": "microsoftsamples_command_component_basic", + "description": "This is the basic command component", + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" }, - "name": "azureml_anonymous", - "version": "1", - "display_name": "command-function-job", + "version": "0.0.1", + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json", + "display_name": "test_command_function_node", "is_deterministic": true, "inputs": { - "component_in_path": { - "type": "uri_folder", - "mode": "ro_mount" - }, "component_in_number": { "type": "number", - "default": "0.01" + "optional": true, + "default": "10.99", + "description": "A number" + }, + "component_in_path": { + "type": "uri_folder", + "description": "A path" } }, "outputs": { "component_out_path": { - "type": "mlflow_model", - "mode": "rw_mount" + "type": "uri_folder" } }, "type": "command", - "_source": "BUILDER" + "_source": "YAML.COMPONENT" } } }, "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "1967", + "Content-Length": "2297", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:54 GMT", + "Date": "Wed, 15 Feb 2023 04:02:55 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e9bbafd7-0097-d5fa-f630-6bb2a83a8a06?api-version=2022-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/2a7566cc-2012-20c3-4bee-ebaaecc821d4?api-version=2022-10-01", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-6444138fc777e5daff0f85d2208d1120-f5494d35d57a7d27-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-1a287383638215f4a41cbbf8e802c91a-184b9dab94cc1176-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-test-westus2-01", + "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9d8db686-1953-402a-9d29-69b48ade6516", + "x-ms-correlation-request-id": "353a4792-3932-4c66-a275-a0c74c1e3829", "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224754Z:9d8db686-1953-402a-9d29-69b48ade6516", - "x-request-time": "1.875" + "x-ms-routing-request-id": "JAPANEAST:20230215T040256Z:353a4792-3932-4c66-a275-a0c74c1e3829", + "x-request-time": "3.142" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/1d40a7f5-387e-4aea-9ca9-924cce0ff18b", - "name": "1d40a7f5-387e-4aea-9ca9-924cce0ff18b", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/0ed383fb-033d-40d6-b9ca-d726e1a65f7c", + "name": "0ed383fb-033d-40d6-b9ca-d726e1a65f7c", "type": "Microsoft.MachineLearningServices/workspaces/components/versions", "properties": { "description": null, - "tags": {}, + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, "properties": {}, "isArchived": false, "isAnonymous": true, "componentSpec": { - "name": "azureml_anonymous", - "version": "1d40a7f5-387e-4aea-9ca9-924cce0ff18b", - "display_name": "command-function-job", + "name": "microsoftsamples_command_component_basic", + "version": "0.0.1", + "display_name": "test_command_function_node", "is_deterministic": "True", "type": "command", + "description": "This is the basic command component", + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, "inputs": { "component_in_path": { "type": "uri_folder", - "optional": "False" + "optional": "False", + "description": "A path" }, "component_in_number": { "type": "number", - "optional": "False", - "default": "0.01" + "optional": "True", + "default": "10.99", + "description": "A number" } }, "outputs": { "component_out_path": { - "type": "mlflow_model" + "type": "uri_folder" } }, "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", - "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/5", + "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/1", "resources": { - "instance_count": "2" - }, - "distribution": { - "process_count_per_instance": "2", - "type": "Pytorch" + "instance_count": "1" }, - "command": "echo \u0022hello world\u0022", - "$schema": "https://componentsdk.azureedge.net/jsonschema/CommandComponent.json" + "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json" } }, "systemData": { - "createdAt": "2022-12-30T01:38:37.6542132\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-15T04:02:55.7258945\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User", - "lastModifiedAt": "2022-12-30T01:38:38.0521426\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-15T04:02:55.7258945\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/2a7566cc-2012-20c3-4bee-ebaaecc821d4?api-version=2022-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/90412f79-fbec-f428-2786-fb770eb33500?api-version=2022-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "1313", + "Content-Length": "832", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { - "description": "This is the basic command component", "properties": {}, - "tags": { - "tag": "tagvalue", - "owner": "sdkteam" - }, + "tags": {}, "isAnonymous": true, "isArchived": false, "componentSpec": { - "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", + "command": "echo \u0022hello world\u0022", "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", - "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:1", - "name": "microsoftsamples_command_component_basic", - "description": "This is the basic command component", - "tags": { - "tag": "tagvalue", - "owner": "sdkteam" + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", + "resources": { + "instance_count": 2 }, - "version": "0.0.1", - "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json", - "display_name": "test_command_function_node", + "distribution": { + "type": "pytorch", + "process_count_per_instance": 2 + }, + "name": "azureml_anonymous", + "version": "1", "is_deterministic": true, "inputs": { - "component_in_number": { - "type": "number", - "optional": true, - "default": "10.99", - "description": "A number" - }, "component_in_path": { "type": "uri_folder", - "description": "A path" + "mode": "ro_mount" + }, + "component_in_number": { + "type": "number", + "default": "0.01" } }, "outputs": { "component_out_path": { - "type": "uri_folder" + "type": "mlflow_model" } }, "type": "command", - "_source": "YAML.COMPONENT" + "_source": "CLASS" } } }, "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "2315", + "Content-Length": "1876", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:53 GMT", + "Date": "Wed, 15 Feb 2023 04:02:55 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/2a7566cc-2012-20c3-4bee-ebaaecc821d4?api-version=2022-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/90412f79-fbec-f428-2786-fb770eb33500?api-version=2022-10-01", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-2bec2f3232b1d63d09605e11d1964c45-2020fab3e45b5840-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-c21f487aa47a47f3feb2e621c5f9e0b4-f600184426ad729c-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a0456828-0720-4628-a37f-490780fe4aa6", + "x-ms-correlation-request-id": "c99b235b-76c5-41b6-a237-797610dead3c", "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224754Z:a0456828-0720-4628-a37f-490780fe4aa6", - "x-request-time": "2.146" + "x-ms-routing-request-id": "JAPANEAST:20230215T040256Z:c99b235b-76c5-41b6-a237-797610dead3c", + "x-request-time": "3.331" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/877ad6cb-8c6c-4ce0-afe3-1a68cb36fc38", - "name": "877ad6cb-8c6c-4ce0-afe3-1a68cb36fc38", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e90b397b-89cb-467b-b9e3-b76ad8182c28", + "name": "e90b397b-89cb-467b-b9e3-b76ad8182c28", "type": "Microsoft.MachineLearningServices/workspaces/components/versions", "properties": { "description": null, - "tags": { - "tag": "tagvalue", - "owner": "sdkteam" - }, + "tags": {}, "properties": {}, "isArchived": false, "isAnonymous": true, "componentSpec": { "name": "azureml_anonymous", - "version": "877ad6cb-8c6c-4ce0-afe3-1a68cb36fc38", - "display_name": "test_command_function_node", + "version": "1", "is_deterministic": "True", "type": "command", - "description": "This is the basic command component", - "tags": { - "tag": "tagvalue", - "owner": "sdkteam" - }, "inputs": { "component_in_path": { "type": "uri_folder", - "optional": "False", - "description": "A path" + "optional": "False" }, "component_in_number": { "type": "number", - "optional": "True", - "default": "10.99", - "description": "A number" + "optional": "False", + "default": "0.01" } }, "outputs": { "component_out_path": { - "type": "uri_folder" + "type": "mlflow_model" } }, "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", - "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/1", + "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/5", "resources": { - "instance_count": "1" + "instance_count": "2" }, - "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", - "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json" + "distribution": { + "process_count_per_instance": "2", + "type": "Pytorch" + }, + "command": "echo \u0022hello world\u0022", + "$schema": "https://componentsdk.azureedge.net/jsonschema/CommandComponent.json" } }, "systemData": { - "createdAt": "2022-12-30T01:38:29.0513662\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-15T04:02:55.7164627\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User", - "lastModifiedAt": "2022-12-30T01:38:29.4644587\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-15T04:02:55.7164627\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/90412f79-fbec-f428-2786-fb770eb33500?api-version=2022-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e9bbafd7-0097-d5fa-f630-6bb2a83a8a06?api-version=2022-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "832", + "Content-Length": "894", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -1089,6 +1087,7 @@ }, "name": "azureml_anonymous", "version": "1", + "display_name": "command-function-job", "is_deterministic": true, "inputs": { "component_in_path": { @@ -1102,37 +1101,38 @@ }, "outputs": { "component_out_path": { - "type": "mlflow_model" + "type": "mlflow_model", + "mode": "rw_mount" } }, "type": "command", - "_source": "CLASS" + "_source": "BUILDER" } } }, "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "1919", + "Content-Length": "1920", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:54 GMT", + "Date": "Wed, 15 Feb 2023 04:02:56 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/90412f79-fbec-f428-2786-fb770eb33500?api-version=2022-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e9bbafd7-0097-d5fa-f630-6bb2a83a8a06?api-version=2022-10-01", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-9c648e5bb486ecc454f837b7fe46c7b5-f66f26bbf6e11df9-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-ff4d968d7e106072afe3e4b3a89d2e7d-8782207696e247ca-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ec00ff3b-3a6a-4673-acb3-715ff8468967", + "x-ms-correlation-request-id": "73caef56-02c7-489e-b67d-c33f7482a6bb", "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224754Z:ec00ff3b-3a6a-4673-acb3-715ff8468967", - "x-request-time": "2.618" + "x-ms-routing-request-id": "JAPANEAST:20230215T040256Z:73caef56-02c7-489e-b67d-c33f7482a6bb", + "x-request-time": "3.748" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/9bb375cc-ce91-4c44-ad90-48dd98fa88fa", - "name": "9bb375cc-ce91-4c44-ad90-48dd98fa88fa", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/c8df95af-47aa-4ad5-8914-c7fb40391dfc", + "name": "c8df95af-47aa-4ad5-8914-c7fb40391dfc", "type": "Microsoft.MachineLearningServices/workspaces/components/versions", "properties": { "description": null, @@ -1142,7 +1142,8 @@ "isAnonymous": true, "componentSpec": { "name": "azureml_anonymous", - "version": "9bb375cc-ce91-4c44-ad90-48dd98fa88fa", + "version": "1", + "display_name": "command-function-job", "is_deterministic": "True", "type": "command", "inputs": { @@ -1175,25 +1176,25 @@ } }, "systemData": { - "createdAt": "2023-01-17T22:47:54.320534\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-15T04:02:55.823113\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User", - "lastModifiedAt": "2023-01-17T22:47:54.320534\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-15T04:02:55.823113\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "2615", + "Content-Length": "2641", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -1204,7 +1205,7 @@ "tag": "tagvalue" }, "computeId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", - "displayName": "test_890121223912", + "displayName": "test_379722877879", "experimentName": "mixed_pipeline", "isArchived": false, "jobType": "Pipeline", @@ -1233,7 +1234,7 @@ } }, "_source": "YAML.COMPONENT", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/877ad6cb-8c6c-4ce0-afe3-1a68cb36fc38" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/0ed383fb-033d-40d6-b9ca-d726e1a65f7c" }, "node2": { "resources": { @@ -1256,7 +1257,7 @@ } }, "_source": "CLASS", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/9bb375cc-ce91-4c44-ad90-48dd98fa88fa" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e90b397b-89cb-467b-b9e3-b76ad8182c28" }, "node3": { "resources": { @@ -1289,11 +1290,12 @@ } }, "_source": "BUILDER", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/1d40a7f5-387e-4aea-9ca9-924cce0ff18b" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/c8df95af-47aa-4ad5-8914-c7fb40391dfc" } }, "outputs": { "pipeline_job_out": { + "mode": "ReadWriteMount", "jobOutputType": "mlflow_model" } }, @@ -1305,22 +1307,22 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "5422", + "Content-Length": "5474", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 17 Jan 2023 22:47:58 GMT", + "Date": "Wed, 15 Feb 2023 04:03:12 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-334d76a9c8703a6f972dfe919eb71574-4235bcb920bd1c61-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-abb343aa6e2d6251f2158cc25b3bafb5-8cea131517f8cf12-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b5d19c02-3282-4738-893f-7c334241688a", + "x-ms-correlation-request-id": "4ea2df4e-0838-4c48-ad3b-cd0f4d98adbb", "x-ms-ratelimit-remaining-subscription-writes": "1197", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "SOUTHEASTASIA:20230117T224759Z:b5d19c02-3282-4738-893f-7c334241688a", - "x-request-time": "3.150" + "x-ms-routing-request-id": "JAPANEAST:20230215T040313Z:4ea2df4e-0838-4c48-ad3b-cd0f4d98adbb", + "x-request-time": "13.273" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000", @@ -1344,7 +1346,7 @@ "azureml.defaultDataStoreName": "workspaceblobstore", "azureml.pipelineComponent": "pipelinerun" }, - "displayName": "test_890121223912", + "displayName": "test_379722877879", "status": "Preparing", "experimentName": "mixed_pipeline", "services": { @@ -1390,7 +1392,7 @@ } }, "_source": "YAML.COMPONENT", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/877ad6cb-8c6c-4ce0-afe3-1a68cb36fc38" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/0ed383fb-033d-40d6-b9ca-d726e1a65f7c" }, "node2": { "resources": { @@ -1413,7 +1415,7 @@ } }, "_source": "CLASS", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/9bb375cc-ce91-4c44-ad90-48dd98fa88fa" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e90b397b-89cb-467b-b9e3-b76ad8182c28" }, "node3": { "resources": { @@ -1446,7 +1448,7 @@ } }, "_source": "BUILDER", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/1d40a7f5-387e-4aea-9ca9-924cce0ff18b" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/c8df95af-47aa-4ad5-8914-c7fb40391dfc" } }, "inputs": { @@ -1466,6 +1468,8 @@ "pipeline_job_out": { "description": null, "uri": null, + "assetName": null, + "assetVersion": null, "mode": "ReadWriteMount", "jobOutputType": "mlflow_model" } @@ -1473,14 +1477,14 @@ "sourceJobId": null }, "systemData": { - "createdAt": "2023-01-17T22:47:58.2986601\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-15T04:03:12.1761394\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User" } } } ], "Variables": { - "pipeline_name": "test_890121223912" + "pipeline_name": "test_379722877879" } } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_only_setting_binding_node.json b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_only_setting_binding_node.json index 33fc5a785426..d954c299cd4f 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_only_setting_binding_node.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_only_setting_binding_node.json @@ -7,7 +7,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15,11 +15,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:08 GMT", + "Date": "Wed, 15 Feb 2023 04:08:12 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-18bcf995fbb2f90e83665b441237436c-9a2a90112b9bae4c-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-78b2154ab93f3a00b894260739a9747e-02ebd6bdf463e6b0-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -28,11 +28,11 @@ ], "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1659b643-b8eb-40f6-a971-51c0281fcf44", - "x-ms-ratelimit-remaining-subscription-reads": "11870", + "x-ms-correlation-request-id": "8b3c1aff-0339-4f3e-b52f-c3640c2932bd", + "x-ms-ratelimit-remaining-subscription-reads": "11976", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014808Z:1659b643-b8eb-40f6-a971-51c0281fcf44", - "x-request-time": "0.244" + "x-ms-routing-request-id": "JAPANEAST:20230215T040812Z:8b3c1aff-0339-4f3e-b52f-c3640c2932bd", + "x-request-time": "0.233" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", @@ -60,32 +60,19 @@ "nodeIdleTimeBeforeScaleDown": "PT2M" }, "subnet": null, - "currentNodeCount": 4, - "targetNodeCount": 3, + "currentNodeCount": 6, + "targetNodeCount": 6, "nodeStateCounts": { "preparingNodeCount": 0, - "runningNodeCount": 1, - "idleNodeCount": 2, + "runningNodeCount": 6, + "idleNodeCount": 0, "unusableNodeCount": 0, - "leavingNodeCount": 1, + "leavingNodeCount": 0, "preemptedNodeCount": 0 }, - "allocationState": "Resizing", - "allocationStateTransitionTime": "2022-12-30T01:46:26.911\u002B00:00", - "errors": [ - { - "error": { - "code": "DiskFull", - "message": "ComputeNode.Id=tvmps_60145e777ca38376f5547ff4c637506809cfb6b23dfd4c19924050c765a96870_d: There is not enough disk space on the node", - "details": [ - { - "code": "Message", - "message": "The VM disk is full. Delete jobs, tasks, or files on the node to free up space and then reboot the node." - } - ] - } - } - ], + "allocationState": "Steady", + "allocationStateTransitionTime": "2023-02-03T15:03:52.027\u002B00:00", + "errors": null, "remoteLoginPortPublicAccess": "Enabled", "osType": "Linux", "virtualMachineImage": null, @@ -96,13 +83,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -110,24 +97,24 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:09 GMT", + "Date": "Wed, 15 Feb 2023 04:08:16 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-f6055287882994fe6684285a2b975ee4-c1328664045d06cc-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-6d0c621f230f5e5cb20855bd05e997bf-2dee44cba3738de8-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ "Accept-Encoding", "Accept-Encoding" ], - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "745dfb19-9e8f-408c-8a23-b23546cf882d", - "x-ms-ratelimit-remaining-subscription-reads": "11869", + "x-ms-correlation-request-id": "2ca3b9a5-2673-4dc8-8e79-bdd1c4164bbe", + "x-ms-ratelimit-remaining-subscription-reads": "11975", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014810Z:745dfb19-9e8f-408c-8a23-b23546cf882d", - "x-request-time": "0.141" + "x-ms-routing-request-id": "JAPANEAST:20230215T040816Z:2ca3b9a5-2673-4dc8-8e79-bdd1c4164bbe", + "x-request-time": "1.025" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -159,14 +146,14 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -174,21 +161,394 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:10 GMT", + "Date": "Wed, 15 Feb 2023 04:08:17 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-401f6bc48d7911b67e78d72d59c4a6d9-edb41b66077ec639-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-af90da540b943b9ab593ed048dbdaf20-27f74fb3734c421c-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "20434810-6680-4670-9c30-71ff5debbb20", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T040817Z:20434810-6680-4670-9c30-71ff5debbb20", + "x-request-time": "0.638" + }, + "ResponseBody": { + "secretsType": "AccountKey", + "key": "dGhpcyBpcyBmYWtlIGtleQ==" + } + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/train_src/train.py", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:08:17 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "1502", + "Content-MD5": "zAix1RSwqgjraik/VOQjSg==", + "Content-Type": "application/octet-stream", + "Date": "Wed, 15 Feb 2023 04:08:18 GMT", + "ETag": "\u00220x8DA9F72C3199CAF\u0022", + "Last-Modified": "Mon, 26 Sep 2022 03:54:07 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-access-tier": "Hot", + "x-ms-access-tier-inferred": "true", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Mon, 26 Sep 2022 03:54:07 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-meta-name": "6bc0f588-42a3-4619-9e1b-e83f4b37c11d", + "x-ms-meta-upload_status": "completed", + "x-ms-meta-version": "1", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/az-ml-artifacts/00000000000000000000000000000000/train_src/train.py", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:08:18 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "Date": "Wed, 15 Feb 2023 04:08:18 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-error-code": "BlobNotFound", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1?api-version=2022-05-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "298", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isAnonymous": true, + "isArchived": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/train_src" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 04:08:23 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-6fe8bbb4ce6f86c978924258e4cef3f6-7c729ce414633798-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "76ca16c1-b1a1-4465-a035-c6f1d44ae1b8", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T040823Z:76ca16c1-b1a1-4465-a035-c6f1d44ae1b8", + "x-request-time": "1.076" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1", + "name": "1", + "type": "Microsoft.MachineLearningServices/workspaces/codes/versions", + "properties": { + "description": null, + "tags": {}, + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isArchived": false, + "isAnonymous": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/train_src" + }, + "systemData": { + "createdAt": "2022-09-26T03:54:09.4771125\u002B00:00", + "createdBy": "Zhengfei Wang", + "createdByType": "User", + "lastModifiedAt": "2023-02-15T04:08:23.1873999\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/4a6f54f7-8677-f9ad-afb5-ab777edfc574?api-version=2022-10-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1248", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "description": "A dummy training component", + "properties": {}, + "tags": {}, + "isAnonymous": true, + "isArchived": false, + "componentSpec": { + "command": "python train.py --training_data ${{inputs.training_data}} $[[--max_epochs ${{inputs.max_epochs}}]] --learning_rate ${{inputs.learning_rate}} --learning_rate_schedule ${{inputs.learning_rate_schedule}} --model_output ${{outputs.model_output}}", + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1", + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", + "name": "train_model", + "description": "A dummy training component", + "version": "0.0.1", + "$schema": "https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json", + "display_name": "Train Model", + "is_deterministic": true, + "inputs": { + "training_data": { + "type": "uri_folder" + }, + "max_epochs": { + "type": "integer", + "optional": true + }, + "learning_rate": { + "type": "number", + "default": "0.01" + }, + "learning_rate_schedule": { + "type": "string", + "default": "time-based" + } + }, + "outputs": { + "model_output": { + "type": "uri_folder" + } + }, + "type": "command", + "_source": "YAML.COMPONENT" + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "2301", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 04:08:27 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/4a6f54f7-8677-f9ad-afb5-ab777edfc574?api-version=2022-10-01", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-4e6ab9f3adaa413120c25d61c1a30169-04bdffbe7dc288de-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "9aca7e91-6bc9-4c53-acc5-369cb4c0cbda", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T040828Z:9aca7e91-6bc9-4c53-acc5-369cb4c0cbda", + "x-request-time": "4.476" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/7cbeffee-0f68-4b73-8a96-5ae0ead31008", + "name": "7cbeffee-0f68-4b73-8a96-5ae0ead31008", + "type": "Microsoft.MachineLearningServices/workspaces/components/versions", + "properties": { + "description": null, + "tags": {}, + "properties": {}, + "isArchived": false, + "isAnonymous": true, + "componentSpec": { + "name": "train_model", + "version": "0.0.1", + "display_name": "Train Model", + "is_deterministic": "True", + "type": "command", + "description": "A dummy training component", + "inputs": { + "training_data": { + "type": "uri_folder", + "optional": "False" + }, + "max_epochs": { + "type": "integer", + "optional": "True" + }, + "learning_rate": { + "type": "number", + "optional": "False", + "default": "0.01" + }, + "learning_rate_schedule": { + "type": "string", + "optional": "False", + "default": "time-based" + } + }, + "outputs": { + "model_output": { + "type": "uri_folder" + } + }, + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1", + "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/5", + "resources": { + "instance_count": "1" + }, + "command": "python train.py --training_data ${{inputs.training_data}} $[[--max_epochs ${{inputs.max_epochs}}]] --learning_rate ${{inputs.learning_rate}} --learning_rate_schedule ${{inputs.learning_rate_schedule}} --model_output ${{outputs.model_output}}", + "$schema": "https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json" + } + }, + "systemData": { + "createdAt": "2023-02-15T04:08:27.7132136\u002B00:00", + "createdBy": "Han Wang", + "createdByType": "User", + "lastModifiedAt": "2023-02-15T04:08:27.7132136\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 04:08:28 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-6e129217afe621c9c619eea7d1ff263b-de55cb4491722368-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3cf209f2-37b7-4956-af35-8ceb7b44d276", - "x-ms-ratelimit-remaining-subscription-writes": "1131", + "x-ms-correlation-request-id": "72948e8b-632a-456f-9d7c-8776fd383d0d", + "x-ms-ratelimit-remaining-subscription-reads": "11974", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014811Z:3cf209f2-37b7-4956-af35-8ceb7b44d276", - "x-request-time": "0.112" + "x-ms-routing-request-id": "JAPANEAST:20230215T040829Z:72948e8b-632a-456f-9d7c-8776fd383d0d", + "x-request-time": "0.122" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", + "name": "workspaceblobstore", + "type": "Microsoft.MachineLearningServices/workspaces/datastores", + "properties": { + "description": null, + "tags": null, + "properties": null, + "isDefault": true, + "credentials": { + "credentialsType": "AccountKey" + }, + "datastoreType": "AzureBlob", + "accountName": "sagvgsoim6nmhbq", + "containerName": "azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8", + "endpoint": "core.windows.net", + "protocol": "https", + "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity" + }, + "systemData": { + "createdAt": "2022-09-22T09:02:03.2629568\u002B00:00", + "createdBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "createdByType": "Application", + "lastModifiedAt": "2022-09-22T09:02:04.166989\u002B00:00", + "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "lastModifiedByType": "Application" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 04:08:29 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-fb7b4b5c4fd52af20c3088a4a7f1306c-991aad74560c5e89-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "10aacd26-1371-43b9-866f-c03223a97ccb", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T040829Z:10aacd26-1371-43b9-866f-c03223a97ccb", + "x-request-time": "0.146" }, "ResponseBody": { "secretsType": "AccountKey", @@ -202,8 +562,8 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:48:11 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:08:29 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, @@ -213,7 +573,7 @@ "Content-Length": "508", "Content-MD5": "dUQjYq1qrTeqLOaZ4N2AUQ==", "Content-Type": "application/octet-stream", - "Date": "Fri, 30 Dec 2022 01:48:10 GMT", + "Date": "Wed, 15 Feb 2023 04:08:29 GMT", "ETag": "\u00220x8DA9D48AFBCE5A6\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:47:53 GMT", "Server": [ @@ -242,14 +602,14 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:48:11 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 04:08:29 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Fri, 30 Dec 2022 01:48:10 GMT", + "Date": "Wed, 15 Feb 2023 04:08:29 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -262,15 +622,15 @@ "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "1779", + "Content-Length": "1797", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -331,11 +691,12 @@ } }, "_source": "YAML.COMPONENT", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/84c1a564-31c6-4305-b5a5-9ec0013da316" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/7cbeffee-0f68-4b73-8a96-5ae0ead31008" } }, "outputs": { "trained_model": { + "mode": "Upload", "jobOutputType": "uri_folder" } }, @@ -347,22 +708,22 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "4405", + "Content-Length": "4449", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:13 GMT", + "Date": "Wed, 15 Feb 2023 04:08:35 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-f786c7730af27b7545d468fd00076afc-52798bc124cb9490-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-7d8e3fd0ddb6705c0d970e141eb0f149-ba3d4d708ce9b7b9-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c0b8ce60-9453-42d2-bebc-d586adf5af10", - "x-ms-ratelimit-remaining-subscription-writes": "1051", + "x-ms-correlation-request-id": "467cc149-3e1f-4c78-b1d4-b20573d00e7a", + "x-ms-ratelimit-remaining-subscription-writes": "1197", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014814Z:c0b8ce60-9453-42d2-bebc-d586adf5af10", - "x-request-time": "2.540" + "x-ms-routing-request-id": "JAPANEAST:20230215T040836Z:467cc149-3e1f-4c78-b1d4-b20573d00e7a", + "x-request-time": "3.716" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000", @@ -445,7 +806,7 @@ } }, "_source": "YAML.COMPONENT", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/84c1a564-31c6-4305-b5a5-9ec0013da316" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/7cbeffee-0f68-4b73-8a96-5ae0ead31008" } }, "inputs": { @@ -475,15 +836,17 @@ "trained_model": { "description": null, "uri": null, - "mode": "ReadWriteMount", + "assetName": null, + "assetVersion": null, + "mode": "Upload", "jobOutputType": "uri_folder" } }, "sourceJobId": null }, "systemData": { - "createdAt": "2022-12-30T01:48:13.5011981\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-15T04:08:35.4345668\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User" } } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_setting_binding_node_and_pipeline_level.json b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_setting_binding_node_and_pipeline_level.json index a2f7489834e6..e19958adbf25 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_setting_binding_node_and_pipeline_level.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_dsl_pipeline_with_setting_binding_node_and_pipeline_level.json @@ -7,7 +7,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15,24 +15,24 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:17 GMT", + "Date": "Wed, 15 Feb 2023 06:06:32 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-d9d56d939b403830aee03b36719f44cd-b47ef355edb5dd0d-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-7bfe18286dfcffebae7d8912b58d97bd-ba0be9ff078c69af-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ "Accept-Encoding", "Accept-Encoding" ], - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "927ca3fd-2087-4858-9494-44599341415e", - "x-ms-ratelimit-remaining-subscription-reads": "11868", + "x-ms-correlation-request-id": "a1748070-d343-44f3-b90e-7bdc9fa38f2c", + "x-ms-ratelimit-remaining-subscription-reads": "11999", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014817Z:927ca3fd-2087-4858-9494-44599341415e", - "x-request-time": "0.243" + "x-ms-routing-request-id": "JAPANEAST:20230215T060632Z:a1748070-d343-44f3-b90e-7bdc9fa38f2c", + "x-request-time": "0.221" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", @@ -60,32 +60,19 @@ "nodeIdleTimeBeforeScaleDown": "PT2M" }, "subnet": null, - "currentNodeCount": 4, - "targetNodeCount": 3, + "currentNodeCount": 6, + "targetNodeCount": 6, "nodeStateCounts": { "preparingNodeCount": 0, - "runningNodeCount": 1, - "idleNodeCount": 2, + "runningNodeCount": 6, + "idleNodeCount": 0, "unusableNodeCount": 0, - "leavingNodeCount": 1, + "leavingNodeCount": 0, "preemptedNodeCount": 0 }, - "allocationState": "Resizing", - "allocationStateTransitionTime": "2022-12-30T01:46:26.911\u002B00:00", - "errors": [ - { - "error": { - "code": "DiskFull", - "message": "ComputeNode.Id=tvmps_60145e777ca38376f5547ff4c637506809cfb6b23dfd4c19924050c765a96870_d: There is not enough disk space on the node", - "details": [ - { - "code": "Message", - "message": "The VM disk is full. Delete jobs, tasks, or files on the node to free up space and then reboot the node." - } - ] - } - } - ], + "allocationState": "Steady", + "allocationStateTransitionTime": "2023-02-03T15:03:52.027\u002B00:00", + "errors": null, "remoteLoginPortPublicAccess": "Enabled", "osType": "Linux", "virtualMachineImage": null, @@ -96,13 +83,386 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 06:06:35 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-e4e9fcb97c87b8aad7580148cc34f3c5-6159aa5cb0be1fa3-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "80771cfc-fc64-4e6f-bd2f-c5b0ce17c20a", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T060636Z:80771cfc-fc64-4e6f-bd2f-c5b0ce17c20a", + "x-request-time": "0.182" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", + "name": "workspaceblobstore", + "type": "Microsoft.MachineLearningServices/workspaces/datastores", + "properties": { + "description": null, + "tags": null, + "properties": null, + "isDefault": true, + "credentials": { + "credentialsType": "AccountKey" + }, + "datastoreType": "AzureBlob", + "accountName": "sagvgsoim6nmhbq", + "containerName": "azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8", + "endpoint": "core.windows.net", + "protocol": "https", + "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity" + }, + "systemData": { + "createdAt": "2022-09-22T09:02:03.2629568\u002B00:00", + "createdBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "createdByType": "Application", + "lastModifiedAt": "2022-09-22T09:02:04.166989\u002B00:00", + "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "lastModifiedByType": "Application" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 06:06:36 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-cb0bf197b3ed69de521dda84380a9ed4-d59ebd0a966dcd68-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "78e6ade5-1bb5-4712-aca8-59bc60f08184", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T060636Z:78e6ade5-1bb5-4712-aca8-59bc60f08184", + "x-request-time": "0.156" + }, + "ResponseBody": { + "secretsType": "AccountKey", + "key": "dGhpcyBpcyBmYWtlIGtleQ==" + } + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/train_src/train.py", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 06:06:36 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "1502", + "Content-MD5": "zAix1RSwqgjraik/VOQjSg==", + "Content-Type": "application/octet-stream", + "Date": "Wed, 15 Feb 2023 06:06:36 GMT", + "ETag": "\u00220x8DA9F72C3199CAF\u0022", + "Last-Modified": "Mon, 26 Sep 2022 03:54:07 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-access-tier": "Hot", + "x-ms-access-tier-inferred": "true", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Mon, 26 Sep 2022 03:54:07 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-meta-name": "6bc0f588-42a3-4619-9e1b-e83f4b37c11d", + "x-ms-meta-upload_status": "completed", + "x-ms-meta-version": "1", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/az-ml-artifacts/00000000000000000000000000000000/train_src/train.py", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 06:06:37 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "Date": "Wed, 15 Feb 2023 06:06:36 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-error-code": "BlobNotFound", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1?api-version=2022-05-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "298", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isAnonymous": true, + "isArchived": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/train_src" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 06:06:41 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-cbcdb2a91f9a69f3aab8371c23609175-1e97c51fbc64b31c-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "50460752-52a4-4811-95df-7f23b6692f97", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T060641Z:50460752-52a4-4811-95df-7f23b6692f97", + "x-request-time": "1.216" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1", + "name": "1", + "type": "Microsoft.MachineLearningServices/workspaces/codes/versions", + "properties": { + "description": null, + "tags": {}, + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isArchived": false, + "isAnonymous": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/train_src" + }, + "systemData": { + "createdAt": "2022-09-26T03:54:09.4771125\u002B00:00", + "createdBy": "Zhengfei Wang", + "createdByType": "User", + "lastModifiedAt": "2023-02-15T06:06:41.3293542\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/4a6f54f7-8677-f9ad-afb5-ab777edfc574?api-version=2022-10-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1248", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "description": "A dummy training component", + "properties": {}, + "tags": {}, + "isAnonymous": true, + "isArchived": false, + "componentSpec": { + "command": "python train.py --training_data ${{inputs.training_data}} $[[--max_epochs ${{inputs.max_epochs}}]] --learning_rate ${{inputs.learning_rate}} --learning_rate_schedule ${{inputs.learning_rate_schedule}} --model_output ${{outputs.model_output}}", + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1", + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:5", + "name": "train_model", + "description": "A dummy training component", + "version": "0.0.1", + "$schema": "https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json", + "display_name": "Train Model", + "is_deterministic": true, + "inputs": { + "training_data": { + "type": "uri_folder" + }, + "max_epochs": { + "type": "integer", + "optional": true + }, + "learning_rate": { + "type": "number", + "default": "0.01" + }, + "learning_rate_schedule": { + "type": "string", + "default": "time-based" + } + }, + "outputs": { + "model_output": { + "type": "uri_folder" + } + }, + "type": "command", + "_source": "YAML.COMPONENT" + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "2301", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 06:06:44 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/4a6f54f7-8677-f9ad-afb5-ab777edfc574?api-version=2022-10-01", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-4c8e645d4e87bf46549694dd5f91ae51-fb662e1ea54867ec-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "1fad4561-1013-47e6-b0d9-93ffc1ee3cb8", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230215T060645Z:1fad4561-1013-47e6-b0d9-93ffc1ee3cb8", + "x-request-time": "2.867" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/7cbeffee-0f68-4b73-8a96-5ae0ead31008", + "name": "7cbeffee-0f68-4b73-8a96-5ae0ead31008", + "type": "Microsoft.MachineLearningServices/workspaces/components/versions", + "properties": { + "description": null, + "tags": {}, + "properties": {}, + "isArchived": false, + "isAnonymous": true, + "componentSpec": { + "name": "train_model", + "version": "0.0.1", + "display_name": "Train Model", + "is_deterministic": "True", + "type": "command", + "description": "A dummy training component", + "inputs": { + "training_data": { + "type": "uri_folder", + "optional": "False" + }, + "max_epochs": { + "type": "integer", + "optional": "True" + }, + "learning_rate": { + "type": "number", + "optional": "False", + "default": "0.01" + }, + "learning_rate_schedule": { + "type": "string", + "optional": "False", + "default": "time-based" + } + }, + "outputs": { + "model_output": { + "type": "uri_folder" + } + }, + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/6bc0f588-42a3-4619-9e1b-e83f4b37c11d/versions/1", + "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/5", + "resources": { + "instance_count": "1" + }, + "command": "python train.py --training_data ${{inputs.training_data}} $[[--max_epochs ${{inputs.max_epochs}}]] --learning_rate ${{inputs.learning_rate}} --learning_rate_schedule ${{inputs.learning_rate_schedule}} --model_output ${{outputs.model_output}}", + "$schema": "https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json" + } + }, + "systemData": { + "createdAt": "2023-02-15T04:08:27.7132136\u002B00:00", + "createdBy": "Han Wang", + "createdByType": "User", + "lastModifiedAt": "2023-02-15T04:08:28.2278558\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -110,24 +470,24 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:18 GMT", + "Date": "Wed, 15 Feb 2023 06:06:45 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-4bb8243bb1824dc69325b9d5f784b8fd-1ba445c51aa6552a-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-85619126dd90a8cc053418d1da3490dc-a774780ce8bd321a-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ "Accept-Encoding", "Accept-Encoding" ], - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "046fcb6e-7a42-42d0-af86-5c36b8f3e4e3", - "x-ms-ratelimit-remaining-subscription-reads": "11867", + "x-ms-correlation-request-id": "57158e3d-822c-4806-a702-4fc21aa7e401", + "x-ms-ratelimit-remaining-subscription-reads": "11997", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014819Z:046fcb6e-7a42-42d0-af86-5c36b8f3e4e3", - "x-request-time": "0.088" + "x-ms-routing-request-id": "JAPANEAST:20230215T060645Z:57158e3d-822c-4806-a702-4fc21aa7e401", + "x-request-time": "0.132" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -159,14 +519,14 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -174,21 +534,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:19 GMT", + "Date": "Wed, 15 Feb 2023 06:06:45 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-ba46323ee5c4dc6318eccf74c589539a-dd8cd6791379ea08-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-838965090f2aa6c12207220b8b7095d5-45dfbcf263d03b79-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "02438b5c-b285-44c8-a8ca-0d88695c480a", - "x-ms-ratelimit-remaining-subscription-writes": "1130", + "x-ms-correlation-request-id": "162a5250-957e-452d-86d2-f6a50a555c8a", + "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014820Z:02438b5c-b285-44c8-a8ca-0d88695c480a", - "x-request-time": "0.125" + "x-ms-routing-request-id": "JAPANEAST:20230215T060646Z:162a5250-957e-452d-86d2-f6a50a555c8a", + "x-request-time": "0.208" }, "ResponseBody": { "secretsType": "AccountKey", @@ -202,8 +562,8 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:48:20 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 06:06:46 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, @@ -213,7 +573,7 @@ "Content-Length": "508", "Content-MD5": "dUQjYq1qrTeqLOaZ4N2AUQ==", "Content-Type": "application/octet-stream", - "Date": "Fri, 30 Dec 2022 01:48:19 GMT", + "Date": "Wed, 15 Feb 2023 06:06:45 GMT", "ETag": "\u00220x8DA9D48AFBCE5A6\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:47:53 GMT", "Server": [ @@ -242,14 +602,14 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:48:20 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Wed, 15 Feb 2023 06:06:46 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Fri, 30 Dec 2022 01:48:19 GMT", + "Date": "Wed, 15 Feb 2023 06:06:45 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -262,7 +622,7 @@ "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -270,7 +630,7 @@ "Connection": "keep-alive", "Content-Length": "1825", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -332,7 +692,7 @@ } }, "_source": "YAML.COMPONENT", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/84c1a564-31c6-4305-b5a5-9ec0013da316" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/7cbeffee-0f68-4b73-8a96-5ae0ead31008" } }, "outputs": { @@ -349,22 +709,22 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "4400", + "Content-Length": "4452", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:48:22 GMT", + "Date": "Wed, 15 Feb 2023 06:06:51 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-075600816f853eac6b2fa4b78e59cada-4c06d1ab888fafa9-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-da308aa7cb99e82c081c67534d53a2b5-30e44b629d8f1911-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-test-westus2-02", + "x-aml-cluster": "vienna-test-westus2-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bd4db807-56c5-4ffb-8d92-edded07ec347", - "x-ms-ratelimit-remaining-subscription-writes": "1050", + "x-ms-correlation-request-id": "4986977a-1fab-4c37-b19b-d79a0dba55ef", + "x-ms-ratelimit-remaining-subscription-writes": "1197", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014823Z:bd4db807-56c5-4ffb-8d92-edded07ec347", - "x-request-time": "2.405" + "x-ms-routing-request-id": "JAPANEAST:20230215T060652Z:4986977a-1fab-4c37-b19b-d79a0dba55ef", + "x-request-time": "3.296" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000", @@ -447,7 +807,7 @@ } }, "_source": "YAML.COMPONENT", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/84c1a564-31c6-4305-b5a5-9ec0013da316" + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/7cbeffee-0f68-4b73-8a96-5ae0ead31008" } }, "inputs": { @@ -477,6 +837,8 @@ "trained_model": { "description": null, "uri": null, + "assetName": null, + "assetVersion": null, "mode": "ReadWriteMount", "jobOutputType": "uri_folder" } @@ -484,8 +846,8 @@ "sourceJobId": null }, "systemData": { - "createdAt": "2022-12-30T01:48:22.6104132\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-15T06:06:51.6561854\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User" } } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_output_setting_path.json b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_output_setting_path.json new file mode 100644 index 000000000000..5dcefee1fdca --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_output_setting_path.json @@ -0,0 +1,614 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 10:12:35 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-d5bb56bf585ddd7cef2b7a58987abf3a-4e4a964e7d021afe-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2f1bcf9f-70c5-4dc3-92a7-55babef72fdd", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T101236Z:2f1bcf9f-70c5-4dc3-92a7-55babef72fdd", + "x-request-time": "0.153" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", + "name": "workspaceblobstore", + "type": "Microsoft.MachineLearningServices/workspaces/datastores", + "properties": { + "description": null, + "tags": null, + "properties": null, + "isDefault": true, + "credentials": { + "credentialsType": "AccountKey" + }, + "datastoreType": "AzureBlob", + "accountName": "sagvgsoim6nmhbq", + "containerName": "azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8", + "endpoint": "core.windows.net", + "protocol": "https", + "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity" + }, + "systemData": { + "createdAt": "2022-09-22T09:02:03.2629568\u002B00:00", + "createdBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "createdByType": "Application", + "lastModifiedAt": "2022-09-22T09:02:04.166989\u002B00:00", + "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "lastModifiedByType": "Application" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 10:12:36 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-b353b3f1220ddcb475629733496398a0-afce99375b2f0b47-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b9de43a7-b2c4-4919-879e-5a6c2d05e260", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T101237Z:b9de43a7-b2c4-4919-879e-5a6c2d05e260", + "x-request-time": "0.436" + }, + "ResponseBody": { + "secretsType": "AccountKey", + "key": "dGhpcyBpcyBmYWtlIGtleQ==" + } + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/COMPONENT_PLACEHOLDER", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Mon, 13 Feb 2023 10:12:36 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "35", + "Content-MD5": "L/DnSpFIn\u002BjaQWc\u002BsUQdcw==", + "Content-Type": "application/octet-stream", + "Date": "Mon, 13 Feb 2023 10:12:37 GMT", + "ETag": "\u00220x8DA9D48E17467D7\u0022", + "Last-Modified": "Fri, 23 Sep 2022 09:49:17 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-access-tier": "Hot", + "x-ms-access-tier-inferred": "true", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Fri, 23 Sep 2022 09:49:16 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-meta-name": "9c9cfba9-82bd-45db-ad06-07009d1d9672", + "x-ms-meta-upload_status": "completed", + "x-ms-meta-version": "1", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/az-ml-artifacts/00000000000000000000000000000000/COMPONENT_PLACEHOLDER", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Mon, 13 Feb 2023 10:12:37 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "Date": "Mon, 13 Feb 2023 10:12:38 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-error-code": "BlobNotFound", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1?api-version=2022-05-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "288", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isAnonymous": true, + "isArchived": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 10:12:41 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-b857d36931b63fb40a5835783c93a2e0-bc2c16078f518b8a-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "65f5cc60-ec1f-4b4e-af45-8e5bc1585045", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T101242Z:65f5cc60-ec1f-4b4e-af45-8e5bc1585045", + "x-request-time": "0.854" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "name": "1", + "type": "Microsoft.MachineLearningServices/workspaces/codes/versions", + "properties": { + "description": null, + "tags": {}, + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isArchived": false, + "isAnonymous": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000" + }, + "systemData": { + "createdAt": "2022-09-23T09:49:20.984936\u002B00:00", + "createdBy": "Ying Chen", + "createdByType": "User", + "lastModifiedAt": "2023-02-13T10:12:42.2432578\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/8c18b842-a49d-2a9d-d6e3-59bf9ed59701?api-version=2022-10-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1308", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "description": "This is the basic command component", + "properties": {}, + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "isAnonymous": true, + "isArchived": false, + "componentSpec": { + "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:1", + "name": "microsoftsamples_command_component_basic", + "description": "This is the basic command component", + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "version": "0.0.1", + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json", + "display_name": "CommandComponentBasic", + "is_deterministic": true, + "inputs": { + "component_in_number": { + "type": "number", + "optional": true, + "default": "10.99", + "description": "A number" + }, + "component_in_path": { + "type": "uri_folder", + "description": "A path" + } + }, + "outputs": { + "component_out_path": { + "type": "uri_folder" + } + }, + "type": "command", + "_source": "YAML.COMPONENT" + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "2292", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 10:12:44 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/8c18b842-a49d-2a9d-d6e3-59bf9ed59701?api-version=2022-10-01", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-14998ec5e8e7748ed67c782ad8253477-99952d93ca4c63fb-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c4952620-ba6c-445b-9c19-77f8158bdc05", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T101245Z:c4952620-ba6c-445b-9c19-77f8158bdc05", + "x-request-time": "2.346" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6ebed39-1f09-4776-b8ef-ea28397a0fa7", + "name": "a6ebed39-1f09-4776-b8ef-ea28397a0fa7", + "type": "Microsoft.MachineLearningServices/workspaces/components/versions", + "properties": { + "description": null, + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "properties": {}, + "isArchived": false, + "isAnonymous": true, + "componentSpec": { + "name": "microsoftsamples_command_component_basic", + "version": "0.0.1", + "display_name": "CommandComponentBasic", + "is_deterministic": "True", + "type": "command", + "description": "This is the basic command component", + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "inputs": { + "component_in_path": { + "type": "uri_folder", + "optional": "False", + "description": "A path" + }, + "component_in_number": { + "type": "number", + "optional": "True", + "default": "10.99", + "description": "A number" + } + }, + "outputs": { + "component_out_path": { + "type": "uri_folder" + } + }, + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/1", + "resources": { + "instance_count": "1" + }, + "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json" + } + }, + "systemData": { + "createdAt": "2023-02-07T07:30:55.6732943\u002B00:00", + "createdBy": "Han Wang", + "createdByType": "User", + "lastModifiedAt": "2023-02-07T07:30:56.0310681\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1121", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "properties": {}, + "tags": {}, + "displayName": "pipeline", + "experimentName": "azure-ai-ml", + "isArchived": false, + "jobType": "Pipeline", + "inputs": {}, + "jobs": { + "node1": { + "name": "node1", + "type": "command", + "inputs": { + "component_in_number": { + "job_input_type": "literal", + "value": "1" + }, + "component_in_path": { + "uri": "https://dprepdata.blob.core.windows.net/demo/Titanic.csv", + "job_input_type": "uri_file" + } + }, + "outputs": { + "component_out_path": { + "value": "${{parent.outputs.component_out_path}}", + "type": "literal" + } + }, + "_source": "YAML.COMPONENT", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6ebed39-1f09-4776-b8ef-ea28397a0fa7" + } + }, + "outputs": { + "component_out_path": { + "uri": "azureml://datastores/workspaceblobstore/paths/outputs/1", + "jobOutputType": "uri_folder" + } + }, + "settings": { + "default_compute": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", + "_source": "DSL" + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "3334", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 10:14:30 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-db15ee02b7c16205bcbdf940d93492c1-302b38388329a368-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "50d66fe7-922e-43c4-b9cc-d08623d2d8d4", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T101431Z:50d66fe7-922e-43c4-b9cc-d08623d2d8d4", + "x-request-time": "3.442" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000", + "name": "000000000000000000000", + "type": "Microsoft.MachineLearningServices/workspaces/jobs", + "properties": { + "description": null, + "tags": {}, + "properties": { + "azureml.DevPlatv2": "true", + "azureml.runsource": "azureml.PipelineRun", + "runSource": "MFE", + "runType": "HTTP", + "azureml.parameters": "{}", + "azureml.continue_on_step_failure": "False", + "azureml.continue_on_failed_optional_input": "True", + "azureml.defaultComputeName": "cpu-cluster", + "azureml.defaultDataStoreName": "workspaceblobstore", + "azureml.pipelineComponent": "pipelinerun" + }, + "displayName": "pipeline", + "status": "Preparing", + "experimentName": "azure-ai-ml", + "services": { + "Tracking": { + "jobServiceType": "Tracking", + "port": null, + "endpoint": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000?", + "status": null, + "errorMessage": null, + "properties": null, + "nodes": null + }, + "Studio": { + "jobServiceType": "Studio", + "port": null, + "endpoint": "https://ml.azure.com/runs/000000000000000000000?wsid=/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/workspaces/00000", + "status": null, + "errorMessage": null, + "properties": null, + "nodes": null + } + }, + "computeId": null, + "isArchived": false, + "identity": null, + "componentId": null, + "jobType": "Pipeline", + "settings": { + "default_compute": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", + "_source": "DSL" + }, + "jobs": { + "node1": { + "name": "node1", + "type": "command", + "inputs": { + "component_in_number": { + "job_input_type": "literal", + "value": "1" + }, + "component_in_path": { + "uri": "https://dprepdata.blob.core.windows.net/demo/Titanic.csv", + "job_input_type": "uri_file" + } + }, + "outputs": { + "component_out_path": { + "value": "${{parent.outputs.component_out_path}}", + "type": "literal" + } + }, + "_source": "YAML.COMPONENT", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6ebed39-1f09-4776-b8ef-ea28397a0fa7" + } + }, + "inputs": {}, + "outputs": { + "component_out_path": { + "description": null, + "uri": "azureml://datastores/workspaceblobstore/paths/outputs/1", + "assetName": null, + "assetVersion": null, + "mode": "ReadWriteMount", + "jobOutputType": "uri_folder" + } + }, + "sourceJobId": null + }, + "systemData": { + "createdAt": "2023-02-13T10:14:30.3007975\u002B00:00", + "createdBy": "Han Wang", + "createdByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000/cancel?api-version=2022-12-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "4", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 10:14:38 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/mfeOperationResults/jc:e61cd5e2-512f-475e-9842-5e2a973993b8:000000000000000000000?api-version=2022-12-01-preview", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-async-operation-timeout": "PT1H", + "x-ms-correlation-request-id": "e8fbdb9a-5afa-4023-9aa3-66684753288f", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T101438Z:e8fbdb9a-5afa-4023-9aa3-66684753288f", + "x-request-time": "0.879" + }, + "ResponseBody": "null" + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/mfeOperationResults/jc:e61cd5e2-512f-475e-9842-5e2a973993b8:000000000000000000000?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Mon, 13 Feb 2023 10:15:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-6e0d35a68a76356accf8f8246cd2d2a9-350093a82dcd670f-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "aff044a0-b8ab-4f70-9b5f-f40cf13085d7", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T101508Z:aff044a0-b8ab-4f70-9b5f-f40cf13085d7", + "x-request-time": "0.071" + }, + "ResponseBody": null + } + ], + "Variables": {} +} diff --git a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_parallel_run_function.json b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_parallel_run_function.json index 5681c8858c4f..0f99ef0ce60a 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_parallel_run_function.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_parallel_run_function.json @@ -1,13 +1,13 @@ { "Entries": [ { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15,11 +15,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:45:28 GMT", + "Date": "Tue, 14 Feb 2023 09:35:03 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-227be4854db94aad48f2e9a7b4998f61-741009b6f8dccf4c-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-72402b289078f0bcdf05fa6c021bde09-7cb7a915e1415021-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -28,11 +28,11 @@ ], "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "69739723-e49a-4b9e-93c6-5ee97aeb5519", - "x-ms-ratelimit-remaining-subscription-reads": "11897", + "x-ms-correlation-request-id": "9a857caa-1603-491e-9b4f-4a5d2a7da84f", + "x-ms-ratelimit-remaining-subscription-reads": "11997", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014528Z:69739723-e49a-4b9e-93c6-5ee97aeb5519", - "x-request-time": "0.094" + "x-ms-routing-request-id": "JAPANEAST:20230214T093504Z:9a857caa-1603-491e-9b4f-4a5d2a7da84f", + "x-request-time": "0.179" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -64,14 +64,14 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -79,21 +79,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:45:28 GMT", + "Date": "Tue, 14 Feb 2023 09:35:05 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-2743e11b8c477012d517b34605900771-9c82b5671eb6c1a8-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-605ba3be5a88c1334078962e7e4fed0b-c30ba33e149f9a3a-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c18e99b8-ef6d-4675-b2d7-a35ff43d2513", - "x-ms-ratelimit-remaining-subscription-writes": "1145", + "x-ms-correlation-request-id": "21ea6b5e-9a87-4654-953d-59fa7a12fdb1", + "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014528Z:c18e99b8-ef6d-4675-b2d7-a35ff43d2513", - "x-request-time": "0.100" + "x-ms-routing-request-id": "JAPANEAST:20230214T093505Z:21ea6b5e-9a87-4654-953d-59fa7a12fdb1", + "x-request-time": "0.641" }, "ResponseBody": { "secretsType": "AccountKey", @@ -107,8 +107,8 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:45:28 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Tue, 14 Feb 2023 09:35:04 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, @@ -118,7 +118,7 @@ "Content-Length": "969", "Content-MD5": "DhunCanKGufSVuPKEYN51w==", "Content-Type": "application/octet-stream", - "Date": "Fri, 30 Dec 2022 01:45:28 GMT", + "Date": "Tue, 14 Feb 2023 09:35:06 GMT", "ETag": "\u00220x8DA9D4A193DC816\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:58:00 GMT", "Server": [ @@ -147,14 +147,14 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:45:29 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Tue, 14 Feb 2023 09:35:05 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Fri, 30 Dec 2022 01:45:28 GMT", + "Date": "Tue, 14 Feb 2023 09:35:06 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -175,7 +175,7 @@ "Connection": "keep-alive", "Content-Length": "292", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -193,11 +193,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:45:29 GMT", + "Date": "Tue, 14 Feb 2023 09:35:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-1fb2325c8dffbef9139c969fb579b28c-227a677d07f9a2c4-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-2550e6c2e8753d7a70ad5193fecff0c6-49fe13e917489540-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -206,11 +206,11 @@ ], "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c9b83140-ca88-4ee1-88d8-82ad1eabe3dd", - "x-ms-ratelimit-remaining-subscription-writes": "1070", + "x-ms-correlation-request-id": "285ee678-783c-4c69-82e2-692e9ea34c3c", + "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014529Z:c9b83140-ca88-4ee1-88d8-82ad1eabe3dd", - "x-request-time": "0.266" + "x-ms-routing-request-id": "JAPANEAST:20230214T093510Z:285ee678-783c-4c69-82e2-692e9ea34c3c", + "x-request-time": "1.352" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/3af49689-e732-4d3f-9854-43df40223df3/versions/1", @@ -231,14 +231,14 @@ "createdAt": "2022-09-23T09:58:01.1651738\u002B00:00", "createdBy": "Ying Chen", "createdByType": "User", - "lastModifiedAt": "2022-12-30T01:45:29.7149964\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-14T09:35:10.7015563\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e6853f12-7a1b-a102-b65c-c36bb36b5d3b?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e6853f12-7a1b-a102-b65c-c36bb36b5d3b?api-version=2022-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -246,7 +246,7 @@ "Connection": "keep-alive", "Content-Length": "1116", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -300,26 +300,26 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "2209", + "Content-Length": "2164", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:45:32 GMT", + "Date": "Tue, 14 Feb 2023 09:35:14 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e6853f12-7a1b-a102-b65c-c36bb36b5d3b?api-version=2022-05-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/e6853f12-7a1b-a102-b65c-c36bb36b5d3b?api-version=2022-10-01", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-b50c30e5ae046276282679718b3d2f97-9605a036ada7a8b2-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-25d9d909121173ac7d86853a91f48081-30d0ed2e013596ab-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c2f52c22-210f-4e09-9bd8-f83d4b9be66f", - "x-ms-ratelimit-remaining-subscription-writes": "1069", + "x-ms-correlation-request-id": "6e809249-4747-4ff3-b867-5e840dea6cc2", + "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014532Z:c2f52c22-210f-4e09-9bd8-f83d4b9be66f", - "x-request-time": "1.900" + "x-ms-routing-request-id": "JAPANEAST:20230214T093515Z:6e809249-4747-4ff3-b867-5e840dea6cc2", + "x-request-time": "3.441" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/d0fbd7e0-8888-4cd4-b930-be1ebba27c92", - "name": "d0fbd7e0-8888-4cd4-b930-be1ebba27c92", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6d9932e-a269-4792-be56-14817a0b110b", + "name": "a6d9932e-a269-4792-be56-14817a0b110b", "type": "Microsoft.MachineLearningServices/workspaces/components/versions", "properties": { "description": null, @@ -329,7 +329,7 @@ "isAnonymous": true, "componentSpec": { "name": "azureml_anonymous", - "version": "d0fbd7e0-8888-4cd4-b930-be1ebba27c92", + "version": "1", "display_name": "my-evaluate-job", "is_deterministic": "True", "type": "parallel", @@ -369,23 +369,23 @@ } }, "systemData": { - "createdAt": "2022-12-30T01:45:31.7042324\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-14T09:35:14.5959618\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User", - "lastModifiedAt": "2022-12-30T01:45:31.7042324\u002B00:00", - "lastModifiedBy": "Xingzhi Zhang", + "lastModifiedAt": "2023-02-14T09:35:14.5959618\u002B00:00", + "lastModifiedBy": "Han Wang", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -393,11 +393,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:45:32 GMT", + "Date": "Tue, 14 Feb 2023 09:35:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-e4c37bab71ebb8ee7ad7ce2096520502-49427f55c8a15615-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-9d8d23305055fde25b060d1acbe45191-f2ac74dd83eac883-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -406,11 +406,11 @@ ], "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "223c28cf-88a8-4527-b4c1-aea261ef4aea", - "x-ms-ratelimit-remaining-subscription-reads": "11896", + "x-ms-correlation-request-id": "f6319474-a1d0-4268-bbdb-bfe18aaff9e1", + "x-ms-ratelimit-remaining-subscription-reads": "11996", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014532Z:223c28cf-88a8-4527-b4c1-aea261ef4aea", - "x-request-time": "0.089" + "x-ms-routing-request-id": "JAPANEAST:20230214T093515Z:f6319474-a1d0-4268-bbdb-bfe18aaff9e1", + "x-request-time": "0.108" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", @@ -442,14 +442,14 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -457,21 +457,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:45:32 GMT", + "Date": "Tue, 14 Feb 2023 09:35:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-4a525c3fd079dd40dd9c19f79602c6fc-48af18dbdd9f3609-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-bafcffa7bf2d2307004379286ce79b24-898b72b4280730a7-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "cc395319-54e7-461b-b5c7-8a1aca620a4d", - "x-ms-ratelimit-remaining-subscription-writes": "1144", + "x-ms-correlation-request-id": "c63fd6ea-45ff-4648-8e7b-effd2107d004", + "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014533Z:cc395319-54e7-461b-b5c7-8a1aca620a4d", - "x-request-time": "0.104" + "x-ms-routing-request-id": "JAPANEAST:20230214T093516Z:c63fd6ea-45ff-4648-8e7b-effd2107d004", + "x-request-time": "0.163" }, "ResponseBody": { "secretsType": "AccountKey", @@ -485,8 +485,8 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:45:33 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Tue, 14 Feb 2023 09:35:15 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, @@ -496,7 +496,7 @@ "Content-Length": "223", "Content-MD5": "yLW2CQQeldeN1S7hH1/5Nw==", "Content-Type": "application/octet-stream", - "Date": "Fri, 30 Dec 2022 01:45:32 GMT", + "Date": "Tue, 14 Feb 2023 09:35:16 GMT", "ETag": "\u00220x8DA9D49DDA8E2B9\u0022", "Last-Modified": "Fri, 23 Sep 2022 09:56:20 GMT", "Server": [ @@ -525,14 +525,14 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.1 Python/3.9.13 (Windows-10-10.0.19045-SP0)", - "x-ms-date": "Fri, 30 Dec 2022 01:45:33 GMT", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Tue, 14 Feb 2023 09:35:15 GMT", "x-ms-version": "2021-08-06" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { - "Date": "Fri, 30 Dec 2022 01:45:32 GMT", + "Date": "Tue, 14 Feb 2023 09:35:16 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -545,15 +545,15 @@ "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "1411", + "Content-Length": "1437", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.3.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.9.13 (Windows-10-10.0.19045-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" }, "RequestBody": { "properties": { @@ -595,13 +595,14 @@ } }, "_source": "BUILDER", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/d0fbd7e0-8888-4cd4-b930-be1ebba27c92", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6d9932e-a269-4792-be56-14817a0b110b", "logging_level": "DEBUG", "mini_batch_size": 5 } }, "outputs": { "pipeline_output": { + "mode": "ReadWriteMount", "jobOutputType": "uri_folder" } }, @@ -614,22 +615,22 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "3696", + "Content-Length": "3748", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 30 Dec 2022 01:45:37 GMT", + "Date": "Tue, 14 Feb 2023 09:35:21 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-10-01-preview", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", - "Server-Timing": "traceparent;desc=\u002200-8132b6aca475fd047b399e5cf88d4e0f-c3c0e4d221432354-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-e5d89105e059adfee81561d198547652-8a1fd2a5721a6879-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-test-westus2-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fb73eb79-ba04-4093-8006-a90bef6d6c75", - "x-ms-ratelimit-remaining-subscription-writes": "1068", + "x-ms-correlation-request-id": "f6aaab48-1f82-4a79-a254-b5ffd4f03c8d", + "x-ms-ratelimit-remaining-subscription-writes": "1197", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "JAPANEAST:20221230T014538Z:fb73eb79-ba04-4093-8006-a90bef6d6c75", - "x-request-time": "2.626" + "x-ms-routing-request-id": "JAPANEAST:20230214T093522Z:f6aaab48-1f82-4a79-a254-b5ffd4f03c8d", + "x-request-time": "3.297" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000", @@ -707,7 +708,7 @@ } }, "_source": "BUILDER", - "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/d0fbd7e0-8888-4cd4-b930-be1ebba27c92", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6d9932e-a269-4792-be56-14817a0b110b", "logging_level": "DEBUG", "mini_batch_size": 5 } @@ -724,6 +725,8 @@ "pipeline_output": { "description": null, "uri": null, + "assetName": null, + "assetVersion": null, "mode": "ReadWriteMount", "jobOutputType": "uri_folder" } @@ -731,8 +734,8 @@ "sourceJobId": null }, "systemData": { - "createdAt": "2022-12-30T01:45:37.1878707\u002B00:00", - "createdBy": "Xingzhi Zhang", + "createdAt": "2023-02-14T09:35:21.4552043\u002B00:00", + "createdBy": "Han Wang", "createdByType": "User" } } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_pipeline_component_output_setting.json b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_pipeline_component_output_setting.json new file mode 100644 index 000000000000..7a5a14dcde57 --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_dsl_pipeline.pyTestDSLPipelinetest_pipeline_component_output_setting.json @@ -0,0 +1,671 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore?api-version=2022-10-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 11:13:42 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-7f8fced448b25beeba685f6f308c3def-29d5a742d0b7760b-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "398e922e-ab4d-47da-badc-7d3d637ec1d4", + "x-ms-ratelimit-remaining-subscription-reads": "11981", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T111343Z:398e922e-ab4d-47da-badc-7d3d637ec1d4", + "x-request-time": "0.166" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore", + "name": "workspaceblobstore", + "type": "Microsoft.MachineLearningServices/workspaces/datastores", + "properties": { + "description": null, + "tags": null, + "properties": null, + "isDefault": true, + "credentials": { + "credentialsType": "AccountKey" + }, + "datastoreType": "AzureBlob", + "accountName": "sagvgsoim6nmhbq", + "containerName": "azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8", + "endpoint": "core.windows.net", + "protocol": "https", + "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity" + }, + "systemData": { + "createdAt": "2022-09-22T09:02:03.2629568\u002B00:00", + "createdBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "createdByType": "Application", + "lastModifiedAt": "2022-09-22T09:02:04.166989\u002B00:00", + "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a", + "lastModifiedByType": "Application" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets?api-version=2022-10-01", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 11:13:43 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-115d655562dc1012986ef14e5ff43195-53e77971160a3718-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8f5461ad-0b94-416f-a57e-55291333868e", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T111344Z:8f5461ad-0b94-416f-a57e-55291333868e", + "x-request-time": "0.469" + }, + "ResponseBody": { + "secretsType": "AccountKey", + "key": "dGhpcyBpcyBmYWtlIGtleQ==" + } + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000/COMPONENT_PLACEHOLDER", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Mon, 13 Feb 2023 11:13:43 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "35", + "Content-MD5": "L/DnSpFIn\u002BjaQWc\u002BsUQdcw==", + "Content-Type": "application/octet-stream", + "Date": "Mon, 13 Feb 2023 11:13:45 GMT", + "ETag": "\u00220x8DA9D48E17467D7\u0022", + "Last-Modified": "Fri, 23 Sep 2022 09:49:17 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-access-tier": "Hot", + "x-ms-access-tier-inferred": "true", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Fri, 23 Sep 2022 09:49:16 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-meta-name": "9c9cfba9-82bd-45db-ad06-07009d1d9672", + "x-ms-meta-upload_status": "completed", + "x-ms-meta-version": "1", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/az-ml-artifacts/00000000000000000000000000000000/COMPONENT_PLACEHOLDER", + "RequestMethod": "HEAD", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.13.1 Python/3.8.13 (Windows-10-10.0.19045-SP0)", + "x-ms-date": "Mon, 13 Feb 2023 11:13:44 GMT", + "x-ms-version": "2021-08-06" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "Date": "Mon, 13 Feb 2023 11:13:45 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-error-code": "BlobNotFound", + "x-ms-version": "2021-08-06" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1?api-version=2022-05-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "288", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isAnonymous": true, + "isArchived": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 11:13:48 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-2dfddb2cc3e7922d62b18c8d320c4c5d-a9cc668849e511f4-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "4c3c01af-6425-4f52-8f86-259da3ca2648", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T111348Z:4c3c01af-6425-4f52-8f86-259da3ca2648", + "x-request-time": "0.368" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "name": "1", + "type": "Microsoft.MachineLearningServices/workspaces/codes/versions", + "properties": { + "description": null, + "tags": {}, + "properties": { + "hash_sha256": "0000000000000", + "hash_version": "0000000000000" + }, + "isArchived": false, + "isAnonymous": false, + "codeUri": "https://sagvgsoim6nmhbq.blob.core.windows.net/azureml-blobstore-e61cd5e2-512f-475e-9842-5e2a973993b8/LocalUpload/00000000000000000000000000000000" + }, + "systemData": { + "createdAt": "2022-09-23T09:49:20.984936\u002B00:00", + "createdBy": "Ying Chen", + "createdByType": "User", + "lastModifiedAt": "2023-02-13T11:13:48.6959403\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/8c18b842-a49d-2a9d-d6e3-59bf9ed59701?api-version=2022-10-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "1308", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "description": "This is the basic command component", + "properties": {}, + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "isAnonymous": true, + "isArchived": false, + "componentSpec": { + "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "environment": "azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:1", + "name": "microsoftsamples_command_component_basic", + "description": "This is the basic command component", + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "version": "0.0.1", + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json", + "display_name": "CommandComponentBasic", + "is_deterministic": true, + "inputs": { + "component_in_number": { + "type": "number", + "optional": true, + "default": "10.99", + "description": "A number" + }, + "component_in_path": { + "type": "uri_folder", + "description": "A path" + } + }, + "outputs": { + "component_out_path": { + "type": "uri_folder" + } + }, + "type": "command", + "_source": "YAML.COMPONENT" + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "2292", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 11:13:49 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/8c18b842-a49d-2a9d-d6e3-59bf9ed59701?api-version=2022-10-01", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-b4d8677c043750068ad32d38d911e6c2-e98e4f5a2d69888e-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f622b79a-c661-4c62-b02e-4be71b326439", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T111350Z:f622b79a-c661-4c62-b02e-4be71b326439", + "x-request-time": "1.226" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6ebed39-1f09-4776-b8ef-ea28397a0fa7", + "name": "a6ebed39-1f09-4776-b8ef-ea28397a0fa7", + "type": "Microsoft.MachineLearningServices/workspaces/components/versions", + "properties": { + "description": null, + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "properties": {}, + "isArchived": false, + "isAnonymous": true, + "componentSpec": { + "name": "microsoftsamples_command_component_basic", + "version": "0.0.1", + "display_name": "CommandComponentBasic", + "is_deterministic": "True", + "type": "command", + "description": "This is the basic command component", + "tags": { + "tag": "tagvalue", + "owner": "sdkteam" + }, + "inputs": { + "component_in_path": { + "type": "uri_folder", + "optional": "False", + "description": "A path" + }, + "component_in_number": { + "type": "number", + "optional": "True", + "default": "10.99", + "description": "A number" + } + }, + "outputs": { + "component_out_path": { + "type": "uri_folder" + } + }, + "code": "azureml:/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/codes/9c9cfba9-82bd-45db-ad06-07009d1d9672/versions/1", + "environment": "azureml://registries/azureml-dev/environments/AzureML-sklearn-0.24-ubuntu18.04-py37-cpu/versions/1", + "resources": { + "instance_count": "1" + }, + "command": "echo Hello World \u0026 echo $[[${{inputs.component_in_number}}]] \u0026 echo ${{inputs.component_in_path}} \u0026 echo ${{outputs.component_out_path}} \u003E ${{outputs.component_out_path}}/component_in_number", + "$schema": "https://azuremlschemas.azureedge.net/development/commandComponent.schema.json" + } + }, + "systemData": { + "createdAt": "2023-02-07T07:30:55.6732943\u002B00:00", + "createdBy": "Han Wang", + "createdByType": "User", + "lastModifiedAt": "2023-02-07T07:30:56.0310681\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/ca53db06-e98d-db9c-78a4-9604b7e07e69?api-version=2022-10-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "902", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "properties": {}, + "tags": {}, + "isAnonymous": true, + "isArchived": false, + "componentSpec": { + "name": "inner_pipeline", + "display_name": "inner_pipeline", + "outputs": { + "component_out_path": { + "type": "uri_folder" + } + }, + "type": "pipeline", + "jobs": { + "node1": { + "name": "node1", + "type": "command", + "inputs": { + "component_in_number": { + "job_input_type": "literal", + "value": "1" + }, + "component_in_path": { + "uri": "https://dprepdata.blob.core.windows.net/demo/Titanic.csv", + "job_input_type": "uri_file" + } + }, + "outputs": { + "component_out_path": { + "value": "${{parent.outputs.component_out_path}}", + "type": "literal" + } + }, + "_source": "YAML.COMPONENT", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/a6ebed39-1f09-4776-b8ef-ea28397a0fa7" + } + }, + "_source": "DSL", + "sourceJobId": null + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "1006", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 11:13:52 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/ca53db06-e98d-db9c-78a4-9604b7e07e69?api-version=2022-10-01", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-15a4078c824c2ff94e43036eb0e0acdf-0bdfe86f294b98b7-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "090d97bf-044b-4988-94e4-ddb4cc90b202", + "x-ms-ratelimit-remaining-subscription-writes": "1197", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T111352Z:090d97bf-044b-4988-94e4-ddb4cc90b202", + "x-request-time": "1.675" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/1b4fe6a6-9f3e-4317-81b1-979bd3a5e6b5", + "name": "1b4fe6a6-9f3e-4317-81b1-979bd3a5e6b5", + "type": "Microsoft.MachineLearningServices/workspaces/components/versions", + "properties": { + "description": null, + "tags": {}, + "properties": {}, + "isArchived": false, + "isAnonymous": true, + "componentSpec": { + "name": "inner_pipeline", + "display_name": "inner_pipeline", + "is_deterministic": "False", + "type": "pipeline", + "outputs": { + "component_out_path": { + "type": "uri_folder" + } + } + } + }, + "systemData": { + "createdAt": "2023-02-13T11:13:52.3850182\u002B00:00", + "createdBy": "Han Wang", + "createdByType": "User", + "lastModifiedAt": "2023-02-13T11:13:52.3850182\u002B00:00", + "lastModifiedBy": "Han Wang", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "917", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": { + "properties": { + "properties": {}, + "tags": {}, + "displayName": "outer_pipeline", + "experimentName": "azure-ai-ml", + "isArchived": false, + "jobType": "Pipeline", + "inputs": {}, + "jobs": { + "node1": { + "name": "node1", + "type": "pipeline", + "outputs": { + "component_out_path": { + "value": "${{parent.outputs.component_out_path}}", + "type": "literal" + } + }, + "_source": "DSL", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/1b4fe6a6-9f3e-4317-81b1-979bd3a5e6b5" + } + }, + "outputs": { + "component_out_path": { + "uri": "azureml://datastores/workspaceblobstore/paths/outputs/1", + "jobOutputType": "uri_folder" + } + }, + "settings": { + "default_compute": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", + "_source": "DSL" + } + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "3020", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 11:13:57 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000?api-version=2022-12-01-preview", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-7232f21d8fcf70499d35fcb3a87d7db2-8d21f09d8f597e24-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "a64a42a3-6cd0-462f-8e93-4efa8cf53a08", + "x-ms-ratelimit-remaining-subscription-writes": "1196", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T111358Z:a64a42a3-6cd0-462f-8e93-4efa8cf53a08", + "x-request-time": "2.470" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000", + "name": "000000000000000000000", + "type": "Microsoft.MachineLearningServices/workspaces/jobs", + "properties": { + "description": null, + "tags": {}, + "properties": { + "azureml.DevPlatv2": "true", + "azureml.runsource": "azureml.PipelineRun", + "runSource": "MFE", + "runType": "HTTP", + "azureml.parameters": "{}", + "azureml.continue_on_step_failure": "False", + "azureml.continue_on_failed_optional_input": "True", + "azureml.defaultComputeName": "cpu-cluster", + "azureml.defaultDataStoreName": "workspaceblobstore", + "azureml.pipelineComponent": "pipelinerun" + }, + "displayName": "outer_pipeline", + "status": "Preparing", + "experimentName": "azure-ai-ml", + "services": { + "Tracking": { + "jobServiceType": "Tracking", + "port": null, + "endpoint": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000?", + "status": null, + "errorMessage": null, + "properties": null, + "nodes": null + }, + "Studio": { + "jobServiceType": "Studio", + "port": null, + "endpoint": "https://ml.azure.com/runs/000000000000000000000?wsid=/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/workspaces/00000", + "status": null, + "errorMessage": null, + "properties": null, + "nodes": null + } + }, + "computeId": null, + "isArchived": false, + "identity": null, + "componentId": null, + "jobType": "Pipeline", + "settings": { + "default_compute": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/computes/cpu-cluster", + "_source": "DSL" + }, + "jobs": { + "node1": { + "name": "node1", + "type": "pipeline", + "outputs": { + "component_out_path": { + "value": "${{parent.outputs.component_out_path}}", + "type": "literal" + } + }, + "_source": "DSL", + "componentId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/components/azureml_anonymous/versions/1b4fe6a6-9f3e-4317-81b1-979bd3a5e6b5" + } + }, + "inputs": {}, + "outputs": { + "component_out_path": { + "description": null, + "uri": "azureml://datastores/workspaceblobstore/paths/outputs/1", + "assetName": null, + "assetVersion": null, + "mode": "ReadWriteMount", + "jobOutputType": "uri_folder" + } + }, + "sourceJobId": null + }, + "systemData": { + "createdAt": "2023-02-13T11:13:57.1744007\u002B00:00", + "createdBy": "Han Wang", + "createdByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/000000000000000000000/cancel?api-version=2022-12-01-preview", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.13 (Windows-10-10.0.19045-SP0)" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "4", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 13 Feb 2023 11:14:00 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/mfeOperationResults/jc:e61cd5e2-512f-475e-9842-5e2a973993b8:000000000000000000000?api-version=2022-12-01-preview", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-async-operation-timeout": "PT1H", + "x-ms-correlation-request-id": "d504c323-2fe4-446e-b917-8845934f5f3c", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "JAPANEAST:20230213T111401Z:d504c323-2fe4-446e-b917-8845934f5f3c", + "x-request-time": "1.127" + }, + "ResponseBody": "null" + } + ], + "Variables": {} +} diff --git a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_uai_workspace_create_update_and_delete.json b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_uai_workspace_create_update_and_delete.json index f42f6a4eb512..525e94616086 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_uai_workspace_create_update_and_delete.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_uai_workspace_create_update_and_delete.json @@ -7,7 +7,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15,27 +15,27 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:17 GMT", + "Date": "Tue, 14 Feb 2023 01:57:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "efbde786-7303-4159-a471-ac315a7eca73", - "x-ms-ratelimit-remaining-subscription-reads": "11940", - "x-ms-routing-request-id": "WESTUS2:20230131T063517Z:efbde786-7303-4159-a471-ac315a7eca73" + "x-ms-correlation-request-id": "7c111f29-e622-4a87-b3da-8e25af4b16cf", + "x-ms-ratelimit-remaining-subscription-reads": "11964", + "x-ms-routing-request-id": "WESTUS:20230214T015739Z:7c111f29-e622-4a87-b3da-8e25af4b16cf" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe", "name": "uai-mhe", "type": "Microsoft.ManagedIdentity/userAssignedIdentities", - "location": "eastus2euap", + "location": "eastus", "tags": {}, "properties": { "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" } } }, @@ -46,7 +46,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -54,58 +54,58 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:17 GMT", + "Date": "Tue, 14 Feb 2023 01:57:39 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e672a9b2-bf6e-4107-ad1b-5690223e5d83", - "x-ms-ratelimit-remaining-subscription-reads": "11939", - "x-ms-routing-request-id": "WESTUS2:20230131T063517Z:e672a9b2-bf6e-4107-ad1b-5690223e5d83" + "x-ms-correlation-request-id": "702f5cfc-1c6b-4627-91d9-dff0bcb4fd74", + "x-ms-ratelimit-remaining-subscription-reads": "11963", + "x-ms-routing-request-id": "WESTUS:20230214T015739Z:702f5cfc-1c6b-4627-91d9-dff0bcb4fd74" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2", "name": "uai-mhe2", "type": "Microsoft.ManagedIdentity/userAssignedIdentities", - "location": "eastus2euap", + "location": "eastus", "tags": {}, "properties": { "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 404, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "246", + "Content-Length": "247", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:19 GMT", + "Date": "Tue, 14 Feb 2023 01:57:40 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "009fd9a8-31cb-47cd-b233-c3045273a36d", + "x-ms-correlation-request-id": "676fa387-e6e1-42e6-b68c-a32b01d48e75", "x-ms-failure-cause": "gateway", - "x-ms-routing-request-id": "WESTUS2:20230131T063519Z:009fd9a8-31cb-47cd-b233-c3045273a36d" + "x-ms-routing-request-id": "WESTUS:20230214T015741Z:676fa387-e6e1-42e6-b68c-a32b01d48e75" }, "ResponseBody": { "error": { "code": "ResourceNotFound", - "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" + "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" } } }, @@ -116,7 +116,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -125,15 +125,15 @@ "Content-Encoding": "gzip", "Content-Length": "272", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:21 GMT", + "Date": "Tue, 14 Feb 2023 01:57:41 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5e8db58b-88ef-4d1a-a596-e00ff006e8eb", - "x-ms-ratelimit-remaining-subscription-reads": "11937", - "x-ms-routing-request-id": "WESTUS2:20230131T063521Z:5e8db58b-88ef-4d1a-a596-e00ff006e8eb" + "x-ms-correlation-request-id": "7a45fe6c-a46a-496c-9890-f13d3cc2b80e", + "x-ms-ratelimit-remaining-subscription-reads": "11961", + "x-ms-routing-request-id": "WESTUS:20230214T015742Z:7a45fe6c-a46a-496c-9890-f13d3cc2b80e" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus", @@ -152,7 +152,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -161,15 +161,15 @@ "Content-Encoding": "gzip", "Content-Length": "322", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:24 GMT", + "Date": "Tue, 14 Feb 2023 01:57:42 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ad0e9367-8b6e-4558-94da-5418ebfeb722", - "x-ms-ratelimit-remaining-subscription-reads": "11936", - "x-ms-routing-request-id": "WESTUS2:20230131T063524Z:ad0e9367-8b6e-4558-94da-5418ebfeb722" + "x-ms-correlation-request-id": "881a2d93-79bd-47ec-8089-45c83282569b", + "x-ms-ratelimit-remaining-subscription-reads": "11960", + "x-ms-routing-request-id": "WESTUS:20230214T015743Z:881a2d93-79bd-47ec-8089-45c83282569b" }, "ResponseBody": { "value": [ @@ -183,15 +183,15 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650?api-version=2020-06-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "19727", + "Content-Length": "20071", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "properties": { @@ -583,6 +583,15 @@ "metadata": { "description": "ARM identifier of primary user assigned managed identity, in case multiple ones are specified. Also the default managed identity for clusterless compute." } + }, + "managedNetwork": { + "type": "object", + "defaultValue": { + "isolationMode": "Disabled" + }, + "metadata": { + "description": "Managed network settings to be used for the workspace. If not specified, isolation mode Disabled is the default" + } } }, "variables": { @@ -741,7 +750,7 @@ { "condition": "[variables(\u0027enablePE\u0027)]", "type": "Microsoft.MachineLearningServices/workspaces", - "apiVersion": "2022-01-01-preview", + "apiVersion": "2022-12-01-preview", "tags": "[parameters(\u0027tagValues\u0027)]", "name": "[parameters(\u0027workspaceName\u0027)]", "location": "[parameters(\u0027location\u0027)]", @@ -774,7 +783,8 @@ "storageAccountArmId": "[parameters(\u0027encryption_storage_resourceid\u0027)]", "SearchAccountArmId": "[parameters(\u0027encryption_search_resourceid\u0027)]" }, - "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]" + "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]", + "managedNetwork": "[parameters(\u0027managedNetwork\u0027)]" } }, { @@ -818,27 +828,27 @@ "value": "eastus2euap" }, "workspaceName": { - "value": "e2etest_test_61875381419" + "value": "e2etest_test_103236817400" }, "resourceGroupName": { "value": "00000" }, "description": { - "value": "e2etest_test_61875381419 description" + "value": "e2etest_test_103236817400 description" }, "friendlyName": { - "value": "e2etest_test_61875381419 display name" + "value": "e2etest_test_103236817400 display name" }, "tagValues": { "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "keyVaultOption": { "value": "new" }, "keyVaultName": { - "value": "e2etesttkeyvault7299b64a" + "value": "e2etesttkeyvault9562d025" }, "keyVaultResourceGroupName": { "value": "00000" @@ -847,7 +857,7 @@ "value": "new" }, "storageAccountName": { - "value": "e2etesttstoragea20bc2d14" + "value": "e2etesttstoragea505f52c3" }, "storageAccountResourceGroupName": { "value": "00000" @@ -856,7 +866,7 @@ "value": "new" }, "applicationInsightsName": { - "value": "e2etesttinsightsaf9d813e" + "value": "e2etesttinsights1203ec5a" }, "applicationInsightsResourceGroupName": { "value": "00000" @@ -938,6 +948,11 @@ }, "primaryUserAssignedIdentity": { "value": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe" + }, + "managedNetwork": { + "value": { + "isolationMode": "Disabled" + } } }, "mode": "incremental" @@ -945,37 +960,37 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "Cache-Control": "no-cache", - "Content-Length": "8313", + "Content-Length": "8393", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:29 GMT", + "Date": "Tue, 14 Feb 2023 01:57:48 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6abf9819-48f1-4598-bffa-e33f7641efec", - "x-ms-ratelimit-remaining-subscription-writes": "1194", - "x-ms-routing-request-id": "WESTUS2:20230131T063529Z:6abf9819-48f1-4598-bffa-e33f7641efec" + "x-ms-correlation-request-id": "7b95e2d3-4ade-463c-bdc0-24229671b50e", + "x-ms-ratelimit-remaining-subscription-writes": "1195", + "x-ms-routing-request-id": "WESTUS:20230214T015748Z:7b95e2d3-4ade-463c-bdc0-24229671b50e" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876", - "name": "e2etest_test_61875381419-3230876", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650", + "name": "e2etest_test_103236817400-7321650", "type": "Microsoft.Resources/deployments", "properties": { - "templateHash": "12037445159745527008", + "templateHash": "4984303229931942319", "parameters": { "workspaceName": { "type": "String", - "value": "e2etest_test_61875381419" + "value": "e2etest_test_103236817400" }, "description": { "type": "String", - "value": "e2etest_test_61875381419 description" + "value": "e2etest_test_103236817400 description" }, "friendlyName": { "type": "String", - "value": "e2etest_test_61875381419 display name" + "value": "e2etest_test_103236817400 display name" }, "location": { "type": "String", @@ -991,7 +1006,7 @@ }, "storageAccountName": { "type": "String", - "value": "e2etesttstoragea20bc2d14" + "value": "e2etesttstoragea505f52c3" }, "storageAccountType": { "type": "String", @@ -1015,7 +1030,7 @@ }, "keyVaultName": { "type": "String", - "value": "e2etesttkeyvault7299b64a" + "value": "e2etesttkeyvault9562d025" }, "keyVaultBehindVNet": { "type": "String", @@ -1035,7 +1050,7 @@ }, "applicationInsightsName": { "type": "String", - "value": "e2etesttinsightsaf9d813e" + "value": "e2etesttinsights1203ec5a" }, "applicationInsightsResourceGroupName": { "type": "String", @@ -1126,7 +1141,7 @@ "tagValues": { "type": "Object", "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "privateEndpointName": { @@ -1178,13 +1193,19 @@ "primaryUserAssignedIdentity": { "type": "String", "value": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "Disabled" + } } }, "mode": "Incremental", "provisioningState": "Accepted", - "timestamp": "2023-01-31T06:35:29.3138902Z", - "duration": "PT0.0004691S", - "correlationId": "6abf9819-48f1-4598-bffa-e33f7641efec", + "timestamp": "2023-02-14T01:57:48.3686221Z", + "duration": "PT0.0001374S", + "correlationId": "7b95e2d3-4ade-463c-bdc0-24229671b50e", "providers": [ { "namespace": "Microsoft.Storage", @@ -1252,9 +1273,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "resourceName": "e2etesttstoragea505f52c3" }, { "dependsOn": [ @@ -1264,9 +1285,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "resourceName": "e2etesttkeyvault9562d025" }, { "dependsOn": [ @@ -1283,19 +1304,19 @@ { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "resourceName": "e2etesttstoragea505f52c3" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "resourceName": "e2etesttkeyvault9562d025" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "resourceName": "e2etesttinsights1203ec5a" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", @@ -1303,16 +1324,16 @@ "resourceName": "name" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" }, { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", @@ -1329,43 +1350,43 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "20", + "Content-Length": "21", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:30 GMT", + "Date": "Tue, 14 Feb 2023 01:57:48 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5c59e751-187f-48a1-bb8f-4433662579ad", - "x-ms-ratelimit-remaining-subscription-reads": "11935", - "x-ms-routing-request-id": "WESTUS2:20230131T063530Z:5c59e751-187f-48a1-bb8f-4433662579ad" + "x-ms-correlation-request-id": "22781588-8329-45c6-805b-360c426a1b28", + "x-ms-ratelimit-remaining-subscription-reads": "11959", + "x-ms-routing-request-id": "WESTUS:20230214T015749Z:22781588-8329-45c6-805b-360c426a1b28" }, "ResponseBody": { - "status": "Running" + "status": "Accepted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1374,28 +1395,28 @@ "Content-Encoding": "gzip", "Content-Length": "12", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:35 GMT", + "Date": "Tue, 14 Feb 2023 01:57:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "af2e911e-1bf8-4cd5-b274-09afb9294545", - "x-ms-ratelimit-remaining-subscription-reads": "11934", - "x-ms-routing-request-id": "WESTUS2:20230131T063535Z:af2e911e-1bf8-4cd5-b274-09afb9294545" + "x-ms-correlation-request-id": "335d921e-5288-4b1f-a267-48942ea0e45f", + "x-ms-ratelimit-remaining-subscription-reads": "11958", + "x-ms-routing-request-id": "WESTUS:20230214T015754Z:335d921e-5288-4b1f-a267-48942ea0e45f" }, "ResponseBody": { "value": [] } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1404,96 +1425,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:35 GMT", + "Date": "Tue, 14 Feb 2023 01:57:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8d6d3b2b-ac78-4797-ba54-84675d410359", - "x-ms-ratelimit-remaining-subscription-reads": "11933", - "x-ms-routing-request-id": "WESTUS2:20230131T063535Z:8d6d3b2b-ac78-4797-ba54-84675d410359" + "x-ms-correlation-request-id": "77acb25c-6ee6-4e32-a35a-ed5e7738f803", + "x-ms-ratelimit-remaining-subscription-reads": "11957", + "x-ms-routing-request-id": "WESTUS:20230214T015754Z:77acb25c-6ee6-4e32-a35a-ed5e7738f803" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2067", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:40 GMT", + "Date": "Tue, 14 Feb 2023 01:57:58 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "539f145e-279a-4ce8-8b87-0abcb1a7cc54", - "x-ms-ratelimit-remaining-subscription-reads": "11932", - "x-ms-routing-request-id": "WESTUS2:20230131T063540Z:539f145e-279a-4ce8-8b87-0abcb1a7cc54" + "x-ms-correlation-request-id": "4dbc0dc8-b823-422e-b466-534523e3d4ba", + "x-ms-ratelimit-remaining-subscription-reads": "11956", + "x-ms-routing-request-id": "WESTUS:20230214T015759Z:4dbc0dc8-b823-422e-b466-534523e3d4ba" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:57:57.3689277Z", + "duration": "PT8.1214239S", + "trackingId": "db570dd9-3534-4c0c-a4c4-54e042215cb4", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:35.9594665Z", - "duration": "PT5.8616726S", - "trackingId": "3dda6b0c-39b1-40f9-a79b-ba6763cf1e7e", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:35.8562982Z", - "duration": "PT5.7585043S", - "trackingId": "d4059ea4-c26d-460c-b8ae-a07ca0c30907", - "statusCode": "OK", + "timestamp": "2023-02-14T01:57:56.5002129Z", + "duration": "PT7.2527091S", + "trackingId": "9b10630d-10ca-416d-8068-b80d40827756", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } } @@ -1501,13 +1522,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1516,131 +1537,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:40 GMT", + "Date": "Tue, 14 Feb 2023 01:57:58 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ffe71934-af98-40c7-a636-18c939837a53", - "x-ms-ratelimit-remaining-subscription-reads": "11931", - "x-ms-routing-request-id": "WESTUS2:20230131T063540Z:ffe71934-af98-40c7-a636-18c939837a53" + "x-ms-correlation-request-id": "3ec072c3-a0b2-4ec3-9fbd-761414e05648", + "x-ms-ratelimit-remaining-subscription-reads": "11955", + "x-ms-routing-request-id": "WESTUS:20230214T015759Z:3ec072c3-a0b2-4ec3-9fbd-761414e05648" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7ddd3d3e-ff21-4fbd-a7cb-fb921ccb16ec?api-version=2022-10-01-preview\u0026type=async", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:40 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-5627af225eea5ce6da48773791310c21-97ad5975c2da0d5c-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9f31836f-fc57-44c9-9b9b-1fa752e35fb1", - "x-ms-ratelimit-remaining-subscription-reads": "11930", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063541Z:9f31836f-fc57-44c9-9b9b-1fa752e35fb1", - "x-request-time": "0.024" - }, - "ResponseBody": { - "status": "InProgress" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2067", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:45 GMT", + "Date": "Tue, 14 Feb 2023 01:58:03 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "94cba22e-dea1-4065-bfc6-247d3d85df81", - "x-ms-ratelimit-remaining-subscription-reads": "11929", - "x-ms-routing-request-id": "WESTUS2:20230131T063545Z:94cba22e-dea1-4065-bfc6-247d3d85df81" + "x-ms-correlation-request-id": "f7c0689d-9db2-4069-9954-5441586ea1d4", + "x-ms-ratelimit-remaining-subscription-reads": "11954", + "x-ms-routing-request-id": "WESTUS:20230214T015804Z:f7c0689d-9db2-4069-9954-5441586ea1d4" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:57:57.3689277Z", + "duration": "PT8.1214239S", + "trackingId": "db570dd9-3534-4c0c-a4c4-54e042215cb4", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:35.9594665Z", - "duration": "PT5.8616726S", - "trackingId": "3dda6b0c-39b1-40f9-a79b-ba6763cf1e7e", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:35.8562982Z", - "duration": "PT5.7585043S", - "trackingId": "d4059ea4-c26d-460c-b8ae-a07ca0c30907", - "statusCode": "OK", + "timestamp": "2023-02-14T01:57:56.5002129Z", + "duration": "PT7.2527091S", + "trackingId": "9b10630d-10ca-416d-8068-b80d40827756", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } } @@ -1648,13 +1634,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1663,28 +1649,28 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:45 GMT", + "Date": "Tue, 14 Feb 2023 01:58:04 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6890a6c3-0edf-4e9e-ac42-1aebf1f7c502", + "x-ms-correlation-request-id": "b81d1444-6347-478e-add6-29e17934c4db", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "WESTUS2:20230131T063545Z:6890a6c3-0edf-4e9e-ac42-1aebf1f7c502" + "x-ms-routing-request-id": "WESTUS:20230214T015804Z:b81d1444-6347-478e-add6-29e17934c4db" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1693,96 +1679,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:50 GMT", + "Date": "Tue, 14 Feb 2023 01:58:09 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9152134e-7521-40d3-a84c-5da04730cccb", - "x-ms-ratelimit-remaining-subscription-reads": "11928", - "x-ms-routing-request-id": "WESTUS2:20230131T063551Z:9152134e-7521-40d3-a84c-5da04730cccb" + "x-ms-correlation-request-id": "a8b08071-7ae8-4492-a1a7-562325e290fd", + "x-ms-ratelimit-remaining-subscription-reads": "11953", + "x-ms-routing-request-id": "WESTUS:20230214T015810Z:a8b08071-7ae8-4492-a1a7-562325e290fd" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2067", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:50 GMT", + "Date": "Tue, 14 Feb 2023 01:58:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f3213936-5e1f-45e1-aa12-1bcbe0bd672f", + "x-ms-correlation-request-id": "5ae06584-96eb-4da7-9167-be61feffafd3", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "WESTUS2:20230131T063551Z:f3213936-5e1f-45e1-aa12-1bcbe0bd672f" + "x-ms-routing-request-id": "WESTUS:20230214T015810Z:5ae06584-96eb-4da7-9167-be61feffafd3" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:57:57.3689277Z", + "duration": "PT8.1214239S", + "trackingId": "db570dd9-3534-4c0c-a4c4-54e042215cb4", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:35.9594665Z", - "duration": "PT5.8616726S", - "trackingId": "3dda6b0c-39b1-40f9-a79b-ba6763cf1e7e", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:35.8562982Z", - "duration": "PT5.7585043S", - "trackingId": "d4059ea4-c26d-460c-b8ae-a07ca0c30907", - "statusCode": "OK", + "timestamp": "2023-02-14T01:57:56.5002129Z", + "duration": "PT7.2527091S", + "trackingId": "9b10630d-10ca-416d-8068-b80d40827756", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } } @@ -1790,13 +1776,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1805,96 +1791,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:56 GMT", + "Date": "Tue, 14 Feb 2023 01:58:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a0955304-0321-4416-ab87-2eeeee1d9888", + "x-ms-correlation-request-id": "bd701539-8d48-407b-9df1-aea76e0d4339", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "WESTUS2:20230131T063556Z:a0955304-0321-4416-ab87-2eeeee1d9888" + "x-ms-routing-request-id": "WESTUS:20230214T015815Z:bd701539-8d48-407b-9df1-aea76e0d4339" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2070", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:56 GMT", + "Date": "Tue, 14 Feb 2023 01:58:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8e60acc7-397c-4058-8d17-c56164de275f", - "x-ms-ratelimit-remaining-subscription-reads": "11927", - "x-ms-routing-request-id": "WESTUS2:20230131T063556Z:8e60acc7-397c-4058-8d17-c56164de275f" + "x-ms-correlation-request-id": "88713e0c-9c56-4d6e-a22a-310ac61ed58a", + "x-ms-ratelimit-remaining-subscription-reads": "11952", + "x-ms-routing-request-id": "WESTUS:20230214T015815Z:88713e0c-9c56-4d6e-a22a-310ac61ed58a" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "timestamp": "2023-02-14T01:58:12.7584585Z", + "duration": "PT23.5109547S", + "trackingId": "979bc1e7-fae7-4edb-84f9-d809790dc427", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:55.9836527Z", - "duration": "PT25.8858588S", - "trackingId": "a84c6e50-81f6-42f1-809f-423e82dd69aa", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:51.5691245Z", - "duration": "PT21.4713306S", - "trackingId": "95c37555-0b6d-470e-a5ad-d42dfd1b6159", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:57:56.5002129Z", + "duration": "PT7.2527091S", + "trackingId": "9b10630d-10ca-416d-8068-b80d40827756", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } } @@ -1902,13 +1888,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1917,113 +1903,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:01 GMT", + "Date": "Tue, 14 Feb 2023 01:58:19 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8eb39782-0bf4-4ad0-aa21-aa11e0ce232f", - "x-ms-ratelimit-remaining-subscription-reads": "11926", - "x-ms-routing-request-id": "WESTUS2:20230131T063601Z:8eb39782-0bf4-4ad0-aa21-aa11e0ce232f" + "x-ms-correlation-request-id": "9fa33588-abbe-4b3c-bf77-b89fa7299bae", + "x-ms-ratelimit-remaining-subscription-reads": "11951", + "x-ms-routing-request-id": "WESTUS:20230214T015820Z:9fa33588-abbe-4b3c-bf77-b89fa7299bae" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2782", + "Content-Length": "2788", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:01 GMT", + "Date": "Tue, 14 Feb 2023 01:58:20 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "100db6bc-ee15-4a5c-ae86-553d05d41ed7", - "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "WESTUS2:20230131T063601Z:100db6bc-ee15-4a5c-ae86-553d05d41ed7" + "x-ms-correlation-request-id": "2f6579e1-50af-446f-bd37-a28f2a54333e", + "x-ms-ratelimit-remaining-subscription-reads": "11950", + "x-ms-routing-request-id": "WESTUS:20230214T015820Z:2f6579e1-50af-446f-bd37-a28f2a54333e" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/8DDB1004A4386BD3", - "operationId": "8DDB1004A4386BD3", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/4D6B8D4FBE183EB3", + "operationId": "4D6B8D4FBE183EB3", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:58.569488Z", - "duration": "PT2.5132185S", - "trackingId": "89849062-5753-4b90-aaca-4358079aaa0c", + "timestamp": "2023-02-14T01:58:19.9622507Z", + "duration": "PT2.0256958S", + "trackingId": "3e0833c5-ea85-4581-b1b7-546262da6650", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "timestamp": "2023-02-14T01:58:12.7584585Z", + "duration": "PT23.5109547S", + "trackingId": "979bc1e7-fae7-4edb-84f9-d809790dc427", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:55.9836527Z", - "duration": "PT25.8858588S", - "trackingId": "a84c6e50-81f6-42f1-809f-423e82dd69aa", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:51.5691245Z", - "duration": "PT21.4713306S", - "trackingId": "95c37555-0b6d-470e-a5ad-d42dfd1b6159", + "timestamp": "2023-02-14T01:58:17.8883547Z", + "duration": "PT28.6408509S", + "trackingId": "daa68f42-31e9-4f6d-839d-cc9478791dc7", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } } @@ -2031,13 +2017,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2046,113 +2032,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:06 GMT", + "Date": "Tue, 14 Feb 2023 01:58:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bdd4536f-09b7-499e-9940-9f46473bde5a", - "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "WESTUS2:20230131T063606Z:bdd4536f-09b7-499e-9940-9f46473bde5a" + "x-ms-correlation-request-id": "c9ddf021-b882-4506-a31e-02aa5cf1376e", + "x-ms-ratelimit-remaining-subscription-reads": "11949", + "x-ms-routing-request-id": "WESTUS:20230214T015825Z:c9ddf021-b882-4506-a31e-02aa5cf1376e" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2782", + "Content-Length": "2788", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:06 GMT", + "Date": "Tue, 14 Feb 2023 01:58:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "625fb794-2141-430c-8b32-c726505ab154", - "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "WESTUS2:20230131T063607Z:625fb794-2141-430c-8b32-c726505ab154" + "x-ms-correlation-request-id": "10aa367a-abef-426d-8e4f-c995213798f0", + "x-ms-ratelimit-remaining-subscription-reads": "11948", + "x-ms-routing-request-id": "WESTUS:20230214T015826Z:10aa367a-abef-426d-8e4f-c995213798f0" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/8DDB1004A4386BD3", - "operationId": "8DDB1004A4386BD3", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/4D6B8D4FBE183EB3", + "operationId": "4D6B8D4FBE183EB3", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:58.569488Z", - "duration": "PT2.5132185S", - "trackingId": "89849062-5753-4b90-aaca-4358079aaa0c", + "timestamp": "2023-02-14T01:58:19.9622507Z", + "duration": "PT2.0256958S", + "trackingId": "3e0833c5-ea85-4581-b1b7-546262da6650", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "timestamp": "2023-02-14T01:58:12.7584585Z", + "duration": "PT23.5109547S", + "trackingId": "979bc1e7-fae7-4edb-84f9-d809790dc427", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:55.9836527Z", - "duration": "PT25.8858588S", - "trackingId": "a84c6e50-81f6-42f1-809f-423e82dd69aa", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:51.5691245Z", - "duration": "PT21.4713306S", - "trackingId": "95c37555-0b6d-470e-a5ad-d42dfd1b6159", + "timestamp": "2023-02-14T01:58:17.8883547Z", + "duration": "PT28.6408509S", + "trackingId": "daa68f42-31e9-4f6d-839d-cc9478791dc7", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } } @@ -2160,165 +2146,128 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7ddd3d3e-ff21-4fbd-a7cb-fb921ccb16ec?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:11 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-c5313cd30e1cc9bfe7577b8a58001ff1-21b4f71d47cf89ad-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-01", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b687700a-7b9a-46e2-8e67-32c9a47a72d4", - "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063611Z:b687700a-7b9a-46e2-8e67-32c9a47a72d4", - "x-request-time": "0.023" - }, - "ResponseBody": { - "status": "Succeeded", - "percentComplete": 100.0 - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Connection": "close", - "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:11 GMT", + "Date": "Tue, 14 Feb 2023 01:58:29 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "24e3e5f6-bbd4-4786-a75a-667d16ee1541", - "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "WESTUS2:20230131T063611Z:24e3e5f6-bbd4-4786-a75a-667d16ee1541" + "x-ms-correlation-request-id": "ad945f5e-d6ee-4aa6-8a5a-e9afa2a93071", + "x-ms-ratelimit-remaining-subscription-reads": "11947", + "x-ms-routing-request-id": "WESTUS:20230214T015830Z:ad945f5e-d6ee-4aa6-8a5a-e9afa2a93071" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2782", + "Content-Length": "2788", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:12 GMT", + "Date": "Tue, 14 Feb 2023 01:58:30 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "623f1cf4-d416-4ec3-9c27-5f379d2e08ca", - "x-ms-ratelimit-remaining-subscription-reads": "11925", - "x-ms-routing-request-id": "WESTUS2:20230131T063612Z:623f1cf4-d416-4ec3-9c27-5f379d2e08ca" + "x-ms-correlation-request-id": "8b7a22dc-5e07-4858-bfef-a6e5023b1e2c", + "x-ms-ratelimit-remaining-subscription-reads": "11946", + "x-ms-routing-request-id": "WESTUS:20230214T015831Z:8b7a22dc-5e07-4858-bfef-a6e5023b1e2c" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/8DDB1004A4386BD3", - "operationId": "8DDB1004A4386BD3", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/4D6B8D4FBE183EB3", + "operationId": "4D6B8D4FBE183EB3", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:35:58.569488Z", - "duration": "PT2.5132185S", - "trackingId": "89849062-5753-4b90-aaca-4358079aaa0c", + "timestamp": "2023-02-14T01:58:19.9622507Z", + "duration": "PT2.0256958S", + "trackingId": "3e0833c5-ea85-4581-b1b7-546262da6650", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "timestamp": "2023-02-14T01:58:12.7584585Z", + "duration": "PT23.5109547S", + "trackingId": "979bc1e7-fae7-4edb-84f9-d809790dc427", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:55.9836527Z", - "duration": "PT25.8858588S", - "trackingId": "a84c6e50-81f6-42f1-809f-423e82dd69aa", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:51.5691245Z", - "duration": "PT21.4713306S", - "trackingId": "95c37555-0b6d-470e-a5ad-d42dfd1b6159", + "timestamp": "2023-02-14T01:58:17.8883547Z", + "duration": "PT28.6408509S", + "trackingId": "daa68f42-31e9-4f6d-839d-cc9478791dc7", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } } @@ -2326,13 +2275,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operationStatuses/08585264599578810839?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operationStatuses/08585252670204051991?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2341,64 +2290,64 @@ "Content-Encoding": "gzip", "Content-Length": "22", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:16 GMT", + "Date": "Tue, 14 Feb 2023 01:58:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "691066f4-22d2-445c-bdd6-44dd9f7a63b1", - "x-ms-ratelimit-remaining-subscription-reads": "11924", - "x-ms-routing-request-id": "WESTUS2:20230131T063617Z:691066f4-22d2-445c-bdd6-44dd9f7a63b1" + "x-ms-correlation-request-id": "c0323bfa-0ae2-4e71-9a59-9dfd5e2ce6e9", + "x-ms-ratelimit-remaining-subscription-reads": "11945", + "x-ms-routing-request-id": "WESTUS:20230214T015836Z:c0323bfa-0ae2-4e71-9a59-9dfd5e2ce6e9" }, "ResponseBody": { "status": "Succeeded" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "8926", + "Content-Length": "9007", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:17 GMT", + "Date": "Tue, 14 Feb 2023 01:58:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e8875913-6f9c-4473-a50f-497b813e5bd7", - "x-ms-ratelimit-remaining-subscription-reads": "11923", - "x-ms-routing-request-id": "WESTUS2:20230131T063617Z:e8875913-6f9c-4473-a50f-497b813e5bd7" + "x-ms-correlation-request-id": "dab299d9-0530-4dbd-8abe-83623ae9da73", + "x-ms-ratelimit-remaining-subscription-reads": "11944", + "x-ms-routing-request-id": "WESTUS:20230214T015836Z:dab299d9-0530-4dbd-8abe-83623ae9da73" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876", - "name": "e2etest_test_61875381419-3230876", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650", + "name": "e2etest_test_103236817400-7321650", "type": "Microsoft.Resources/deployments", "properties": { - "templateHash": "12037445159745527008", + "templateHash": "4984303229931942319", "parameters": { "workspaceName": { "type": "String", - "value": "e2etest_test_61875381419" + "value": "e2etest_test_103236817400" }, "description": { "type": "String", - "value": "e2etest_test_61875381419 description" + "value": "e2etest_test_103236817400 description" }, "friendlyName": { "type": "String", - "value": "e2etest_test_61875381419 display name" + "value": "e2etest_test_103236817400 display name" }, "location": { "type": "String", @@ -2414,7 +2363,7 @@ }, "storageAccountName": { "type": "String", - "value": "e2etesttstoragea20bc2d14" + "value": "e2etesttstoragea505f52c3" }, "storageAccountType": { "type": "String", @@ -2438,7 +2387,7 @@ }, "keyVaultName": { "type": "String", - "value": "e2etesttkeyvault7299b64a" + "value": "e2etesttkeyvault9562d025" }, "keyVaultBehindVNet": { "type": "String", @@ -2458,7 +2407,7 @@ }, "applicationInsightsName": { "type": "String", - "value": "e2etesttinsightsaf9d813e" + "value": "e2etesttinsights1203ec5a" }, "applicationInsightsResourceGroupName": { "type": "String", @@ -2549,7 +2498,7 @@ "tagValues": { "type": "Object", "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "privateEndpointName": { @@ -2601,13 +2550,19 @@ "primaryUserAssignedIdentity": { "type": "String", "value": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "Disabled" + } } }, "mode": "Incremental", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:36:15.2843393Z", - "duration": "PT45.9709182S", - "correlationId": "6abf9819-48f1-4598-bffa-e33f7641efec", + "timestamp": "2023-02-14T01:58:35.7714679Z", + "duration": "PT47.4029832S", + "correlationId": "7b95e2d3-4ade-463c-bdc0-24229671b50e", "providers": [ { "namespace": "Microsoft.Storage", @@ -2675,9 +2630,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "resourceName": "e2etesttstoragea505f52c3" }, { "dependsOn": [ @@ -2687,9 +2642,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "resourceName": "e2etesttkeyvault9562d025" }, { "dependsOn": [ @@ -2706,19 +2661,19 @@ { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "resourceName": "e2etesttstoragea505f52c3" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "resourceName": "e2etesttkeyvault9562d025" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "resourceName": "e2etesttinsights1203ec5a" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", @@ -2726,16 +2681,16 @@ "resourceName": "name" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" }, { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", @@ -2750,126 +2705,126 @@ ], "outputResources": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3" } ] } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "3241", + "Content-Length": "3247", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:17 GMT", + "Date": "Tue, 14 Feb 2023 01:58:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "11830f7a-625a-49f1-93bb-c89ebf24115a", - "x-ms-ratelimit-remaining-subscription-reads": "11922", - "x-ms-routing-request-id": "WESTUS2:20230131T063617Z:11830f7a-625a-49f1-93bb-c89ebf24115a" + "x-ms-correlation-request-id": "799e58e3-3b4b-429a-a803-6bbd5f055d72", + "x-ms-ratelimit-remaining-subscription-reads": "11943", + "x-ms-routing-request-id": "WESTUS:20230214T015836Z:799e58e3-3b4b-429a-a803-6bbd5f055d72" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/8DDB1004A4386BD3", - "operationId": "8DDB1004A4386BD3", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/4D6B8D4FBE183EB3", + "operationId": "4D6B8D4FBE183EB3", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:36:15.1001071Z", - "duration": "PT19.0438376S", - "trackingId": "0efdb0da-e2a1-4e6d-81e6-ffa586e9c4c2", + "timestamp": "2023-02-14T01:58:35.4830183Z", + "duration": "PT17.5464634S", + "trackingId": "45c003a1-66f5-4469-b7e9-3d3bb63af4f5", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "timestamp": "2023-02-14T01:58:12.7584585Z", + "duration": "PT23.5109547S", + "trackingId": "979bc1e7-fae7-4edb-84f9-d809790dc427", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:55.9836527Z", - "duration": "PT25.8858588S", - "trackingId": "a84c6e50-81f6-42f1-809f-423e82dd69aa", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:51.5691245Z", - "duration": "PT21.4713306S", - "trackingId": "95c37555-0b6d-470e-a5ad-d42dfd1b6159", + "timestamp": "2023-02-14T01:58:17.8883547Z", + "duration": "PT28.6408509S", + "trackingId": "daa68f42-31e9-4f6d-839d-cc9478791dc7", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/08585264599578810839", - "operationId": "08585264599578810839", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/08585252670204051991", + "operationId": "08585252670204051991", "properties": { "provisioningOperation": "EvaluateDeploymentOutput", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:36:15.2650053Z", - "duration": "PT19.2087358S", - "trackingId": "ead51d5b-acf4-4c74-8efb-46867403add5", + "timestamp": "2023-02-14T01:58:35.7451818Z", + "duration": "PT17.8086269S", + "trackingId": "d4efd9af-7bb2-49f1-a0df-c704693cac6b", "statusCode": "OK" } } @@ -2877,110 +2832,110 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61875381419-3230876/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_103236817400-7321650/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "3241", + "Content-Length": "3247", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:17 GMT", + "Date": "Tue, 14 Feb 2023 01:58:36 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "aa22a129-6a15-48ed-a0e6-4dd0e7d1b609", - "x-ms-ratelimit-remaining-subscription-reads": "11921", - "x-ms-routing-request-id": "WESTUS2:20230131T063618Z:aa22a129-6a15-48ed-a0e6-4dd0e7d1b609" + "x-ms-correlation-request-id": "0266cbbb-e700-4c39-bf44-b8e24aa13066", + "x-ms-ratelimit-remaining-subscription-reads": "11942", + "x-ms-routing-request-id": "WESTUS:20230214T015837Z:0266cbbb-e700-4c39-bf44-b8e24aa13066" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/8DDB1004A4386BD3", - "operationId": "8DDB1004A4386BD3", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/4D6B8D4FBE183EB3", + "operationId": "4D6B8D4FBE183EB3", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:36:15.1001071Z", - "duration": "PT19.0438376S", - "trackingId": "0efdb0da-e2a1-4e6d-81e6-ffa586e9c4c2", + "timestamp": "2023-02-14T01:58:35.4830183Z", + "duration": "PT17.5464634S", + "trackingId": "45c003a1-66f5-4469-b7e9-3d3bb63af4f5", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_61875381419" + "resourceName": "e2etest_test_103236817400" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/517225A2078A2466", - "operationId": "517225A2078A2466", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/BF2EAD347C7BFD76", + "operationId": "BF2EAD347C7BFD76", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:38.0896775Z", - "duration": "PT8.0398163S", - "trackingId": "fb2c9da4-7305-45c8-9e91-33df33740c39", + "timestamp": "2023-02-14T01:58:12.7584585Z", + "duration": "PT23.5109547S", + "trackingId": "979bc1e7-fae7-4edb-84f9-d809790dc427", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsaf9d813e", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsightsaf9d813e" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault9562d025", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault9562d025" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/B1E02F320FAEE508", - "operationId": "B1E02F320FAEE508", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/AF7BA9617A0E8388", + "operationId": "AF7BA9617A0E8388", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:55.9836527Z", - "duration": "PT25.8858588S", - "trackingId": "a84c6e50-81f6-42f1-809f-423e82dd69aa", + "timestamp": "2023-02-14T01:57:56.960842Z", + "duration": "PT7.7666131S", + "trackingId": "5514a26d-3873-4d5e-a714-bdfb9d6721d2", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea20bc2d14" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights1203ec5a", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights1203ec5a" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/EE203FBEA70B79E6", - "operationId": "EE203FBEA70B79E6", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/C57E97E656DC9765", + "operationId": "C57E97E656DC9765", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:35:51.5691245Z", - "duration": "PT21.4713306S", - "trackingId": "95c37555-0b6d-470e-a5ad-d42dfd1b6159", + "timestamp": "2023-02-14T01:58:17.8883547Z", + "duration": "PT28.6408509S", + "trackingId": "daa68f42-31e9-4f6d-839d-cc9478791dc7", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault7299b64a", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault7299b64a" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstoragea505f52c3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61875381419-3230876/operations/08585264599578810839", - "operationId": "08585264599578810839", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_103236817400-7321650/operations/08585252670204051991", + "operationId": "08585252670204051991", "properties": { "provisioningOperation": "EvaluateDeploymentOutput", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:36:15.2650053Z", - "duration": "PT19.2087358S", - "trackingId": "ead51d5b-acf4-4c74-8efb-46867403add5", + "timestamp": "2023-02-14T01:58:35.7451818Z", + "duration": "PT17.8086269S", + "trackingId": "d4efd9af-7bb2-49f1-a0df-c704693cac6b", "statusCode": "OK" } } @@ -2988,13 +2943,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3002,11 +2957,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:18 GMT", + "Date": "Tue, 14 Feb 2023 01:58:36 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-7c4b15de7eae99d0dd98d92f72fc8cfc-4ffc47dbf93d36ab-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-81cf22f8945ab4903086dd946293c5ac-df2ab3556ad90a22-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -3015,48 +2970,53 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a13f0447-d46d-4609-a5cf-77f8ec056f28", - "x-ms-ratelimit-remaining-subscription-reads": "11920", + "x-ms-correlation-request-id": "454916ea-ff67-4e74-a971-5a9494aa1b98", + "x-ms-ratelimit-remaining-subscription-reads": "11941", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063618Z:a13f0447-d46d-4609-a5cf-77f8ec056f28", - "x-request-time": "0.025" + "x-ms-routing-request-id": "WESTUS:20230214T015837Z:454916ea-ff67-4e74-a971-5a9494aa1b98", + "x-request-time": "0.030" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "name": "e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "name": "e2etest_test_103236817400", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_61875381419 display name", - "description": "e2etest_test_61875381419 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault7299b64a", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsaf9d813e", + "friendlyName": "e2etest_test_103236817400 display name", + "description": "e2etest_test_103236817400 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault9562d025", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights1203ec5a", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "4375e876-090a-4f5b-9749-7dac18890466", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:58:19.0947305Z", "notebookInfo": { - "resourceId": "1f59ad6dc6b7492a80070766d1f65bd0", - "fqdn": "ml-e2etesttest-eastus2euap-1ab87329-7584-40e4-aa86-7501c6f7d9ed.eastus2euap.notebooks.azure.net", + "resourceId": "ac433992e2eb4df4b5deb4d2caf2d713", + "fqdn": "ml-e2etesttest-eastus2euap-4375e876-090a-4f5b-9749-7dac18890466.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "1ab87329-7584-40e4-aa86-7501c6f7d9ed", + "workspaceId": "4375e876-090a-4f5b-9749-7dac18890466", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "primaryUserAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe", "sasGetterUri": "", "enableDataIsolation": false @@ -3067,12 +3027,12 @@ "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe": { - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" }, "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2": { - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, @@ -3082,23 +3042,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:35:57.7432083Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:58:19.0947305Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:35:57.7432083Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:58:19.0947305Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3106,11 +3066,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:18 GMT", + "Date": "Tue, 14 Feb 2023 01:58:37 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-0b722ca931fbf2640dd9c6f4e2ee229c-362e83dd86e394e4-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-822906abbf35c9ff4cec8c92bb3dfd31-f6fade185cea88b5-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -3119,47 +3079,52 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ec226103-fd77-4437-b27a-c9d1dea6d38e", - "x-ms-ratelimit-remaining-subscription-reads": "11919", + "x-ms-correlation-request-id": "3fb1903b-e35d-4411-8347-8641b343cc33", + "x-ms-ratelimit-remaining-subscription-reads": "11940", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063618Z:ec226103-fd77-4437-b27a-c9d1dea6d38e", - "x-request-time": "0.028" + "x-ms-routing-request-id": "WESTUS:20230214T015838Z:3fb1903b-e35d-4411-8347-8641b343cc33", + "x-request-time": "0.038" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "name": "e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "name": "e2etest_test_103236817400", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_61875381419 display name", - "description": "e2etest_test_61875381419 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault7299b64a", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsaf9d813e", + "friendlyName": "e2etest_test_103236817400 display name", + "description": "e2etest_test_103236817400 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault9562d025", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights1203ec5a", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "4375e876-090a-4f5b-9749-7dac18890466", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:58:19.0947305Z", "notebookInfo": { - "resourceId": "1f59ad6dc6b7492a80070766d1f65bd0", - "fqdn": "ml-e2etesttest-eastus2euap-1ab87329-7584-40e4-aa86-7501c6f7d9ed.eastus2euap.notebooks.azure.net", + "resourceId": "ac433992e2eb4df4b5deb4d2caf2d713", + "fqdn": "ml-e2etesttest-eastus2euap-4375e876-090a-4f5b-9749-7dac18890466.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "1ab87329-7584-40e4-aa86-7501c6f7d9ed", + "workspaceId": "4375e876-090a-4f5b-9749-7dac18890466", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "primaryUserAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe", "sasGetterUri": "", @@ -3171,12 +3136,12 @@ "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe": { - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" }, "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2": { - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, @@ -3186,23 +3151,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:35:57.7432083Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:58:19.0947305Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:35:57.7432083Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:58:19.0947305Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3210,11 +3175,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:18 GMT", + "Date": "Tue, 14 Feb 2023 01:58:37 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-f5bb5f2ad27d1483e7acea0594bf747c-647e8ab84b37a0f5-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-df5ce6ef50b62a3c178522d1221d2754-9d6ad4161cd5af11-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -3223,48 +3188,53 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c80ed012-2615-4532-8b43-91af0b4eca4a", - "x-ms-ratelimit-remaining-subscription-reads": "11918", + "x-ms-correlation-request-id": "b68698d4-0571-4b79-b293-9b92901b49c0", + "x-ms-ratelimit-remaining-subscription-reads": "11939", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063619Z:c80ed012-2615-4532-8b43-91af0b4eca4a", - "x-request-time": "0.028" + "x-ms-routing-request-id": "WESTUS:20230214T015838Z:b68698d4-0571-4b79-b293-9b92901b49c0", + "x-request-time": "0.035" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "name": "e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "name": "e2etest_test_103236817400", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_61875381419 display name", - "description": "e2etest_test_61875381419 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault7299b64a", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsaf9d813e", + "friendlyName": "e2etest_test_103236817400 display name", + "description": "e2etest_test_103236817400 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault9562d025", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights1203ec5a", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "4375e876-090a-4f5b-9749-7dac18890466", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:58:19.0947305Z", "notebookInfo": { - "resourceId": "1f59ad6dc6b7492a80070766d1f65bd0", - "fqdn": "ml-e2etesttest-eastus2euap-1ab87329-7584-40e4-aa86-7501c6f7d9ed.eastus2euap.notebooks.azure.net", + "resourceId": "ac433992e2eb4df4b5deb4d2caf2d713", + "fqdn": "ml-e2etesttest-eastus2euap-4375e876-090a-4f5b-9749-7dac18890466.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "1ab87329-7584-40e4-aa86-7501c6f7d9ed", + "workspaceId": "4375e876-090a-4f5b-9749-7dac18890466", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "primaryUserAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe", "sasGetterUri": "", "enableDataIsolation": false @@ -3275,12 +3245,12 @@ "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe": { - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" }, "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2": { - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, @@ -3290,29 +3260,29 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:35:57.7432083Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:58:19.0947305Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:35:57.7432083Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:58:19.0947305Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "896", + "Content-Length": "920", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "identity": { "type": "UserAssigned", @@ -3322,42 +3292,43 @@ } }, "properties": { - "description": "e2etest_test_61875381419 description", - "friendlyName": "e2etest_test_61875381419 display name", + "description": "e2etest_test_103236817400 description", + "friendlyName": "e2etest_test_103236817400 display name", "primaryUserAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2", "publicNetworkAccess": "Enabled", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsaf9d813e" + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights1203ec5a", + "managedNetwork": {} } }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/UFGhE2S6e0LGplQqKS6rlmKVHG4Zbla7hvYJ5g5uKuE?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/9qkvHpGNTYGgR4G-hFVeXaguzrLCsCgueBybeWheAlU?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:36:19 GMT", + "Date": "Tue, 14 Feb 2023 01:58:38 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/UFGhE2S6e0LGplQqKS6rlmKVHG4Zbla7hvYJ5g5uKuE?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/9qkvHpGNTYGgR4G-hFVeXaguzrLCsCgueBybeWheAlU?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e7202da8-a9fc-4fa6-b836-a24edc6cf9f0", - "x-ms-ratelimit-remaining-subscription-writes": "1193", + "x-ms-correlation-request-id": "00ee2025-0255-4081-850e-b3fba0b21798", + "x-ms-ratelimit-remaining-subscription-writes": "1194", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063620Z:e7202da8-a9fc-4fa6-b836-a24edc6cf9f0", - "x-request-time": "0.111" + "x-ms-routing-request-id": "WESTUS:20230214T015839Z:00ee2025-0255-4081-850e-b3fba0b21798", + "x-request-time": "0.170" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/UFGhE2S6e0LGplQqKS6rlmKVHG4Zbla7hvYJ5g5uKuE?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/9qkvHpGNTYGgR4G-hFVeXaguzrLCsCgueBybeWheAlU?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3365,34 +3336,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:20 GMT", + "Date": "Tue, 14 Feb 2023 01:58:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-9c1c55df6dda77ebbdf8ab7a3e7d68af-1340290d0bceac2a-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-2dff85be5702cee6f1b5002cbd5f5f33-836782af70ef37c9-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bedc339a-c783-40ba-8b73-594798b680ac", - "x-ms-ratelimit-remaining-subscription-reads": "11917", + "x-ms-correlation-request-id": "9ba5bab5-37b4-4bf5-a90e-3b3d19265c9f", + "x-ms-ratelimit-remaining-subscription-reads": "11938", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063620Z:bedc339a-c783-40ba-8b73-594798b680ac", - "x-request-time": "0.022" + "x-ms-routing-request-id": "WESTUS:20230214T015839Z:9ba5bab5-37b4-4bf5-a90e-3b3d19265c9f", + "x-request-time": "0.019" }, "ResponseBody": { "status": "InProgress" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/UFGhE2S6e0LGplQqKS6rlmKVHG4Zbla7hvYJ5g5uKuE?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/9qkvHpGNTYGgR4G-hFVeXaguzrLCsCgueBybeWheAlU?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3400,21 +3371,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:50 GMT", + "Date": "Tue, 14 Feb 2023 01:59:09 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-46a9e6b67e1c1c0e87826f2ce91b89a6-a4403144ed43f85f-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-8e21dd3fc0f58fd9ebbfba89fea3df01-fff234efcd0637be-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "525356bb-aa83-4a89-a895-908db8c801fa", - "x-ms-ratelimit-remaining-subscription-reads": "11916", + "x-ms-correlation-request-id": "d82578d7-4b3f-4f5a-ab24-386cd2cf7c76", + "x-ms-ratelimit-remaining-subscription-reads": "11937", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063650Z:525356bb-aa83-4a89-a895-908db8c801fa", - "x-request-time": "0.025" + "x-ms-routing-request-id": "WESTUS:20230214T015909Z:d82578d7-4b3f-4f5a-ab24-386cd2cf7c76", + "x-request-time": "0.021" }, "ResponseBody": { "status": "Succeeded", @@ -3422,13 +3393,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3436,11 +3407,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:50 GMT", + "Date": "Tue, 14 Feb 2023 01:59:09 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-63caf6008dfb6d970a084fd871ea0797-1a850f4503a3379c-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-70780e7d608ef103a1849df13ca6655d-e3da91c2ab1f7476-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -3449,48 +3420,53 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "185fdffa-e776-4dc6-b10a-fb0f7c3ed534", - "x-ms-ratelimit-remaining-subscription-reads": "11915", + "x-ms-correlation-request-id": "9b7035a4-2d7a-4b68-8c82-75f56f9660e3", + "x-ms-ratelimit-remaining-subscription-reads": "11936", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063650Z:185fdffa-e776-4dc6-b10a-fb0f7c3ed534", - "x-request-time": "0.036" + "x-ms-routing-request-id": "WESTUS:20230214T015910Z:9b7035a4-2d7a-4b68-8c82-75f56f9660e3", + "x-request-time": "0.027" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "name": "e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "name": "e2etest_test_103236817400", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_61875381419 display name", - "description": "e2etest_test_61875381419 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault7299b64a", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsaf9d813e", + "friendlyName": "e2etest_test_103236817400 display name", + "description": "e2etest_test_103236817400 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault9562d025", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights1203ec5a", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "4375e876-090a-4f5b-9749-7dac18890466", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:58:19.0947305Z", "notebookInfo": { - "resourceId": "1f59ad6dc6b7492a80070766d1f65bd0", - "fqdn": "ml-e2etesttest-eastus2euap-1ab87329-7584-40e4-aa86-7501c6f7d9ed.eastus2euap.notebooks.azure.net", + "resourceId": "ac433992e2eb4df4b5deb4d2caf2d713", + "fqdn": "ml-e2etesttest-eastus2euap-4375e876-090a-4f5b-9749-7dac18890466.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "1ab87329-7584-40e4-aa86-7501c6f7d9ed", + "workspaceId": "4375e876-090a-4f5b-9749-7dac18890466", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", "primaryUserAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2", "sasGetterUri": "", "enableDataIsolation": false @@ -3501,12 +3477,12 @@ "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe": { - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" }, "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2": { - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, @@ -3516,23 +3492,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:35:57.7432083Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:58:19.0947305Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:36:20.0701286Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:58:39.2582298Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3540,11 +3516,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:36:50 GMT", + "Date": "Tue, 14 Feb 2023 01:59:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-88d1d6d246c27124be487e113b5a4d4b-b5425f643121ae15-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-398eb4db48da7b2942101acb06245550-30a99abda026351f-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -3553,48 +3529,53 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f8d597ea-37e7-479a-b546-18236ccc740f", - "x-ms-ratelimit-remaining-subscription-reads": "11914", + "x-ms-correlation-request-id": "56a58612-dfd1-46b8-b739-fb46b5090cd4", + "x-ms-ratelimit-remaining-subscription-reads": "11935", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063651Z:f8d597ea-37e7-479a-b546-18236ccc740f", - "x-request-time": "0.027" + "x-ms-routing-request-id": "WESTUS:20230214T015910Z:56a58612-dfd1-46b8-b739-fb46b5090cd4", + "x-request-time": "0.030" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "name": "e2etest_test_61875381419", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "name": "e2etest_test_103236817400", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_61875381419 display name", - "description": "e2etest_test_61875381419 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault7299b64a", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsaf9d813e", + "friendlyName": "e2etest_test_103236817400 display name", + "description": "e2etest_test_103236817400 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault9562d025", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights1203ec5a", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "4375e876-090a-4f5b-9749-7dac18890466", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:58:19.0947305Z", "notebookInfo": { - "resourceId": "1f59ad6dc6b7492a80070766d1f65bd0", - "fqdn": "ml-e2etesttest-eastus2euap-1ab87329-7584-40e4-aa86-7501c6f7d9ed.eastus2euap.notebooks.azure.net", + "resourceId": "ac433992e2eb4df4b5deb4d2caf2d713", + "fqdn": "ml-e2etesttest-eastus2euap-4375e876-090a-4f5b-9749-7dac18890466.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "1ab87329-7584-40e4-aa86-7501c6f7d9ed", + "workspaceId": "4375e876-090a-4f5b-9749-7dac18890466", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "primaryUserAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2", "sasGetterUri": "", "enableDataIsolation": false @@ -3605,12 +3586,12 @@ "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe": { - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" }, "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2": { - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, @@ -3620,24 +3601,24 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:35:57.7432083Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:58:19.0947305Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:36:20.0701286Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:58:39.2582298Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsaf9d813e?api-version=2015-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights1203ec5a?api-version=2015-05-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3645,29 +3626,29 @@ "Access-Control-Expose-Headers": "Request-Context", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:36:58 GMT", + "Date": "Tue, 14 Feb 2023 01:59:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:7f83c1fe-8c94-4d55-9337-4ddc696f61ed", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "70af0557-c622-4eb5-afdd-c78782e2adfb", - "x-ms-ratelimit-remaining-subscription-deletes": "14994", - "x-ms-routing-request-id": "WESTUS2:20230131T063658Z:70af0557-c622-4eb5-afdd-c78782e2adfb", + "x-ms-correlation-request-id": "8d20bdf1-7b14-4126-a56d-bbcbf0781893", + "x-ms-ratelimit-remaining-subscription-deletes": "14999", + "x-ms-routing-request-id": "WESTUS:20230214T015915Z:8d20bdf1-7b14-4126-a56d-bbcbf0781893", "X-Powered-By": "ASP.NET" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea20bc2d14?api-version=2019-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea505f52c3?api-version=2019-06-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3675,85 +3656,123 @@ "Cache-Control": "no-cache", "Content-Length": "0", "Content-Type": "text/plain; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:04 GMT", + "Date": "Tue, 14 Feb 2023 01:59:21 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "abc408f5-ade8-4ce6-98b1-09ca1a2c83bd", - "x-ms-ratelimit-remaining-subscription-deletes": "14993", - "x-ms-routing-request-id": "WESTUS2:20230131T063704Z:abc408f5-ade8-4ce6-98b1-09ca1a2c83bd" + "x-ms-correlation-request-id": "292d99d1-b72a-4be8-a6bf-d31af2fca880", + "x-ms-ratelimit-remaining-subscription-deletes": "14998", + "x-ms-routing-request-id": "WESTUS:20230214T015921Z:292d99d1-b72a-4be8-a6bf-d31af2fca880" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault7299b64a?api-version=2019-09-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault9562d025?api-version=2019-09-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:37:09 GMT", + "Date": "Tue, 14 Feb 2023 01:59:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "95c659b7-4358-48bb-a51f-5d95d6613f2f", - "x-ms-keyvault-service-version": "1.5.655.1", - "x-ms-ratelimit-remaining-subscription-deletes": "14992", - "x-ms-routing-request-id": "WESTUS2:20230131T063709Z:95c659b7-4358-48bb-a51f-5d95d6613f2f" + "x-ms-correlation-request-id": "7700629d-14cf-4782-9991-d6061a4779a6", + "x-ms-keyvault-service-version": "1.5.666.2", + "x-ms-ratelimit-remaining-subscription-deletes": "14997", + "x-ms-routing-request-id": "WESTUS:20230214T015925Z:7700629d-14cf-4782-9991-d6061a4779a6" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61875381419?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_103236817400?api-version=2022-12-01-preview", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/0ea047a6-741d-45cc-a9e3-ace2d554a8a4?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/4a229f80-49b4-403b-916a-fac78a6f3d52?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:37:09 GMT", + "Date": "Tue, 14 Feb 2023 01:59:25 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/0ea047a6-741d-45cc-a9e3-ace2d554a8a4?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/4a229f80-49b4-403b-916a-fac78a6f3d52?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3be0e3e9-5151-4a37-8311-6e01ec7ee389", - "x-ms-ratelimit-remaining-subscription-deletes": "14991", + "x-ms-correlation-request-id": "9830f038-f896-4279-bcd2-df7fb91b94d0", + "x-ms-ratelimit-remaining-subscription-deletes": "14996", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063710Z:3be0e3e9-5151-4a37-8311-6e01ec7ee389", - "x-request-time": "0.109" + "x-ms-routing-request-id": "WESTUS:20230214T015925Z:9830f038-f896-4279-bcd2-df7fb91b94d0", + "x-request-time": "0.150" }, "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/0caf7ec9-615a-4491-bad8-64ce023324e1/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/4a229f80-49b4-403b-916a-fac78a6f3d52?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyIsImtpZCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTY3NjMzNjYzMCwibmJmIjoxNjc2MzM2NjMwLCJleHAiOjE2NzYzNDA5MTcsIl9jbGFpbV9uYW1lcyI6eyJncm91cHMiOiJzcmMxIn0sIl9jbGFpbV9zb3VyY2VzIjp7InNyYzEiOnsiZW5kcG9pbnQiOiJodHRwczovL2dyYXBoLndpbmRvd3MubmV0LzcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0Ny91c2Vycy9jMWFmZTY2My05MmU3LTQ5M2MtOWI1Ny0xNDBlZTkxNzQ1NDkvZ2V0TWVtYmVyT2JqZWN0cyJ9fSwiYWNyIjoiMSIsImFpbyI6IkFWUUFxLzhUQUFBQVNHcFJmeEdFVEFmb0Y3Tm1KYTZqcEhwMmRaaUMzYXg3QTllcjUxZ0t0Rmt2cFJoU3ZNczRob2FyVmJRd09IVzZnN05NSmZPSmk1VVZ5U3ZSS0V6Vm5ZeVU0M3RUQ0h0b0J1djMwTUNRdXdvPSIsImFtciI6WyJyc2EiLCJtZmEiXSwiYXBwaWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJhcHBpZGFjciI6IjAiLCJkZXZpY2VpZCI6ImM0YzQ4YTY1LTQ4YjUtNDUyNS1hYjU3LWU0NjljYjcwYTU2ZSIsImZhbWlseV9uYW1lIjoiSGFycmluZ3RvbiIsImdpdmVuX25hbWUiOiJKb3NoIiwiaXBhZGRyIjoiMTMxLjEwNy4xLjI0MiIsIm5hbWUiOiJKb3NoIEhhcnJpbmd0b24iLCJvaWQiOiJjMWFmZTY2My05MmU3LTQ5M2MtOWI1Ny0xNDBlZTkxNzQ1NDkiLCJvbnByZW1fc2lkIjoiUy0xLTUtMjEtMjEyNzUyMTE4NC0xNjA0MDEyOTIwLTE4ODc5Mjc1MjctNTk1OTE1ODgiLCJwdWlkIjoiMTAwMzIwMDIxNUUzOEJCRSIsInJoIjoiMC5BUm9BdjRqNWN2R0dyMEdScXkxODBCSGJSMFpJZjNrQXV0ZFB1a1Bhd2ZqMk1CTWFBTzAuIiwic2NwIjoidXNlcl9pbXBlcnNvbmF0aW9uIiwic3ViIjoiVDM1ZDZtbmotanNZRE9yeVFOeDA0OVVsNXlrazZIdEU0UU9BVUQ4RXpsWSIsInRpZCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsInVuaXF1ZV9uYW1lIjoiam9oYXJyaW5ndG9uQG1pY3Jvc29mdC5jb20iLCJ1cG4iOiJqb2hhcnJpbmd0b25AbWljcm9zb2Z0LmNvbSIsInV0aSI6IldvNTFFdnJOQ1VPQlhjWVIzeUMzQUEiLCJ2ZXIiOiIxLjAiLCJ3aWRzIjpbImI3OWZiZjRkLTNlZjktNDY4OS04MTQzLTc2YjE5NGU4NTUwOSJdLCJ4bXNfY2MiOlsiQ1AxIl0sInhtc190Y2R0IjoxMjg5MjQxNTQ3fQ.L6ABFNDSxUuPwu_WyKO_JhtvoJd16jj6YzjKRDZePk7YJyZxz1h6MU_70aTvDs0hvl_6Kzj5facI7yL8ZJuTOsoyG9s5_I9HHoBbt_960qOFSzwJh5xNS2uSvSmQUUrderAuz7lA5DLAxNEwJE5ej_5BStcbIsGuAjpSiHxR30lgVb_9TruYJ5WyTWB3_xYOvcmHxrnU-qOv__E1WO8e_Px_K_LhsxA8fxxuDoCMqUtZZ1cuZKIh2dQL70bZsEV0PcOgZhRizbqTLIzHzbd1GI8qTish5BhRFPqQoFb--KCX0ChM7yAwmFNTgEJTubnZ4auPEywRm-B_1xhc6Fpz0Q", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)", + "x-ms-client-request-id": "34e761c1-ac0b-11ed-92ee-f42679b37e95" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 01:59:25 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-dad5e66ac25bce78bb5e5550e4ee9730-80db7666cdc3fc93-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-eastus2euap-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "dec5c34f-b5cf-4b1e-81f9-981b1c9a6fe8", + "x-ms-ratelimit-remaining-subscription-reads": "11934", + "x-ms-request-id": "dec5c34f-b5cf-4b1e-81f9-981b1c9a6fe8", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T015925Z:dec5c34f-b5cf-4b1e-81f9-981b1c9a6fe8", + "x-request-time": "0.018" + }, + "ResponseBody": { + "status": "InProgress" + } } ], "Variables": { - "deployment_name": "e2etest_test_61875381419-3230876", - "insights_name": "e2etesttinsightsaf9d813e", - "keyvault_name": "e2etesttkeyvault7299b64a", - "storage_name": "e2etesttstoragea20bc2d14", - "wps_name": "test_61875381419" + "deployment_name": "e2etest_test_103236817400-7321650", + "insights_name": "e2etesttinsights1203ec5a", + "keyvault_name": "e2etesttkeyvault9562d025", + "storage_name": "e2etesttstoragea505f52c3", + "wps_name": "test_103236817400" } } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_update_sai_to_sai_and_uai_workspace_with_uai_deletion.json b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_update_sai_to_sai_and_uai_workspace_with_uai_deletion.json index 277035f75e26..b986d06cec2e 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_update_sai_to_sai_and_uai_workspace_with_uai_deletion.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_update_sai_to_sai_and_uai_workspace_with_uai_deletion.json @@ -1,13 +1,13 @@ { "Entries": [ { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -15,19 +15,19 @@ "Cache-Control": "no-cache", "Content-Length": "247", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:13 GMT", + "Date": "Tue, 14 Feb 2023 01:59:27 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "160353ed-d5ad-4b8c-8036-c04d8d9d014e", + "x-ms-correlation-request-id": "7c8b119d-e76e-4f08-876f-eaadf64c1fda", "x-ms-failure-cause": "gateway", - "x-ms-routing-request-id": "WESTUS2:20230131T063713Z:160353ed-d5ad-4b8c-8036-c04d8d9d014e" + "x-ms-routing-request-id": "WESTUS:20230214T015927Z:7c8b119d-e76e-4f08-876f-eaadf64c1fda" }, "ResponseBody": { "error": { "code": "ResourceNotFound", - "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" + "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" } } }, @@ -38,7 +38,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -47,15 +47,15 @@ "Content-Encoding": "gzip", "Content-Length": "272", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:16 GMT", + "Date": "Tue, 14 Feb 2023 01:59:28 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "dc39620a-d381-4262-94d9-65cb8714856f", - "x-ms-ratelimit-remaining-subscription-reads": "11911", - "x-ms-routing-request-id": "WESTUS2:20230131T063716Z:dc39620a-d381-4262-94d9-65cb8714856f" + "x-ms-correlation-request-id": "0c2061a8-53bc-45f2-9459-71acfaf954f5", + "x-ms-ratelimit-remaining-subscription-reads": "11932", + "x-ms-routing-request-id": "WESTUS:20230214T015928Z:0c2061a8-53bc-45f2-9459-71acfaf954f5" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus", @@ -74,7 +74,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -83,15 +83,15 @@ "Content-Encoding": "gzip", "Content-Length": "322", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:18 GMT", + "Date": "Tue, 14 Feb 2023 01:59:29 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "94ab38f3-22dd-44b5-95e0-3bafa5adfd09", - "x-ms-ratelimit-remaining-subscription-reads": "11910", - "x-ms-routing-request-id": "WESTUS2:20230131T063719Z:94ab38f3-22dd-44b5-95e0-3bafa5adfd09" + "x-ms-correlation-request-id": "1fb6b67a-18d2-434a-b047-8c83f821177c", + "x-ms-ratelimit-remaining-subscription-reads": "11931", + "x-ms-routing-request-id": "WESTUS:20230214T015929Z:1fb6b67a-18d2-434a-b047-8c83f821177c" }, "ResponseBody": { "value": [ @@ -105,15 +105,15 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818?api-version=2020-06-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "19279", + "Content-Length": "19620", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "properties": { @@ -505,6 +505,15 @@ "metadata": { "description": "ARM identifier of primary user assigned managed identity, in case multiple ones are specified. Also the default managed identity for clusterless compute." } + }, + "managedNetwork": { + "type": "object", + "defaultValue": { + "isolationMode": "Disabled" + }, + "metadata": { + "description": "Managed network settings to be used for the workspace. If not specified, isolation mode Disabled is the default" + } } }, "variables": { @@ -663,7 +672,7 @@ { "condition": "[variables(\u0027enablePE\u0027)]", "type": "Microsoft.MachineLearningServices/workspaces", - "apiVersion": "2022-01-01-preview", + "apiVersion": "2022-12-01-preview", "tags": "[parameters(\u0027tagValues\u0027)]", "name": "[parameters(\u0027workspaceName\u0027)]", "location": "[parameters(\u0027location\u0027)]", @@ -696,7 +705,8 @@ "storageAccountArmId": "[parameters(\u0027encryption_storage_resourceid\u0027)]", "SearchAccountArmId": "[parameters(\u0027encryption_search_resourceid\u0027)]" }, - "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]" + "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]", + "managedNetwork": "[parameters(\u0027managedNetwork\u0027)]" } }, { @@ -740,27 +750,27 @@ "value": "eastus2euap" }, "workspaceName": { - "value": "e2etest_test_797279886032" + "value": "e2etest_test_786182016259" }, "resourceGroupName": { "value": "00000" }, "description": { - "value": "e2etest_test_797279886032 description" + "value": "e2etest_test_786182016259 description" }, "friendlyName": { - "value": "e2etest_test_797279886032 display name" + "value": "e2etest_test_786182016259 display name" }, "tagValues": { "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "keyVaultOption": { "value": "new" }, "keyVaultName": { - "value": "e2etesttkeyvaultd93792c0" + "value": "e2etesttkeyvault195e233b" }, "keyVaultResourceGroupName": { "value": "00000" @@ -769,7 +779,7 @@ "value": "new" }, "storageAccountName": { - "value": "e2etesttstoragea0da1e5b0" + "value": "e2etesttstorage50cc96bf3" }, "storageAccountResourceGroupName": { "value": "00000" @@ -778,7 +788,7 @@ "value": "new" }, "applicationInsightsName": { - "value": "e2etesttinsights521666cf" + "value": "e2etesttinsights7bb983b1" }, "applicationInsightsResourceGroupName": { "value": "00000" @@ -856,6 +866,11 @@ }, "primaryUserAssignedIdentity": { "value": "" + }, + "managedNetwork": { + "value": { + "isolationMode": "Disabled" + } } }, "mode": "incremental" @@ -863,37 +878,37 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "Cache-Control": "no-cache", - "Content-Length": "7876", + "Content-Length": "7945", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:24 GMT", + "Date": "Tue, 14 Feb 2023 01:59:33 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "07327898-3b16-44a6-84fd-67afbd0e9d01", - "x-ms-ratelimit-remaining-subscription-writes": "1192", - "x-ms-routing-request-id": "WESTUS2:20230131T063725Z:07327898-3b16-44a6-84fd-67afbd0e9d01" + "x-ms-correlation-request-id": "70a27ebd-3348-4a88-9665-73ea2a2843c4", + "x-ms-ratelimit-remaining-subscription-writes": "1193", + "x-ms-routing-request-id": "WESTUS:20230214T015933Z:70a27ebd-3348-4a88-9665-73ea2a2843c4" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603", - "name": "e2etest_test_797279886032-5286603", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818", + "name": "e2etest_test_786182016259-500818", "type": "Microsoft.Resources/deployments", "properties": { - "templateHash": "12037445159745527008", + "templateHash": "4984303229931942319", "parameters": { "workspaceName": { "type": "String", - "value": "e2etest_test_797279886032" + "value": "e2etest_test_786182016259" }, "description": { "type": "String", - "value": "e2etest_test_797279886032 description" + "value": "e2etest_test_786182016259 description" }, "friendlyName": { "type": "String", - "value": "e2etest_test_797279886032 display name" + "value": "e2etest_test_786182016259 display name" }, "location": { "type": "String", @@ -909,7 +924,7 @@ }, "storageAccountName": { "type": "String", - "value": "e2etesttstoragea0da1e5b0" + "value": "e2etesttstorage50cc96bf3" }, "storageAccountType": { "type": "String", @@ -933,7 +948,7 @@ }, "keyVaultName": { "type": "String", - "value": "e2etesttkeyvaultd93792c0" + "value": "e2etesttkeyvault195e233b" }, "keyVaultBehindVNet": { "type": "String", @@ -953,7 +968,7 @@ }, "applicationInsightsName": { "type": "String", - "value": "e2etesttinsights521666cf" + "value": "e2etesttinsights7bb983b1" }, "applicationInsightsResourceGroupName": { "type": "String", @@ -1044,7 +1059,7 @@ "tagValues": { "type": "Object", "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "privateEndpointName": { @@ -1092,13 +1107,19 @@ "primaryUserAssignedIdentity": { "type": "String", "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "Disabled" + } } }, "mode": "Incremental", "provisioningState": "Accepted", - "timestamp": "2023-01-31T06:37:24.6154674Z", - "duration": "PT0.0008257S", - "correlationId": "07327898-3b16-44a6-84fd-67afbd0e9d01", + "timestamp": "2023-02-14T01:59:32.9621519Z", + "duration": "PT0.0005342S", + "correlationId": "70a27ebd-3348-4a88-9665-73ea2a2843c4", "providers": [ { "namespace": "Microsoft.Storage", @@ -1166,9 +1187,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" }, { "dependsOn": [ @@ -1178,9 +1199,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" }, { "dependsOn": [ @@ -1197,19 +1218,19 @@ { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "resourceName": "e2etesttinsights7bb983b1" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", @@ -1217,16 +1238,16 @@ "resourceName": "name" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etest_test_786182016259" }, { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etest_test_786182016259" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", @@ -1243,77 +1264,111 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "21", + "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:24 GMT", + "Date": "Tue, 14 Feb 2023 01:59:33 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9cf6c66e-b931-405e-93e6-f099be3ac3dc", - "x-ms-ratelimit-remaining-subscription-reads": "11909", - "x-ms-routing-request-id": "WESTUS2:20230131T063725Z:9cf6c66e-b931-405e-93e6-f099be3ac3dc" + "x-ms-correlation-request-id": "a662a59a-d290-4b83-8f8d-6b7c34145caa", + "x-ms-ratelimit-remaining-subscription-reads": "11930", + "x-ms-routing-request-id": "WESTUS:20230214T015933Z:a662a59a-d290-4b83-8f8d-6b7c34145caa" }, "ResponseBody": { - "status": "Accepted" + "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "686", + "Content-Length": "2064", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:29 GMT", + "Date": "Tue, 14 Feb 2023 01:59:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "88cb5874-f394-41f0-a7ec-a6eda8458e8e", - "x-ms-ratelimit-remaining-subscription-reads": "11908", - "x-ms-routing-request-id": "WESTUS2:20230131T063730Z:88cb5874-f394-41f0-a7ec-a6eda8458e8e" + "x-ms-correlation-request-id": "a603d5e0-3656-4b53-836b-7b57c3b4dae8", + "x-ms-ratelimit-remaining-subscription-reads": "11929", + "x-ms-routing-request-id": "WESTUS:20230214T015938Z:a603d5e0-3656-4b53-836b-7b57c3b4dae8" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:59:37.3402422Z", + "duration": "PT3.971894S", + "trackingId": "ee361557-27d2-4404-96f5-494db852030b", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage50cc96bf3" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "timestamp": "2023-02-14T01:59:36.9029963Z", + "duration": "PT3.4689905S", + "trackingId": "d435405d-e95e-4337-9021-26754e119a74", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -1321,13 +1376,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1336,79 +1391,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:30 GMT", + "Date": "Tue, 14 Feb 2023 01:59:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0c643986-7a94-4530-a110-f8e9abce25a3", - "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "WESTUS2:20230131T063730Z:0c643986-7a94-4530-a110-f8e9abce25a3" + "x-ms-correlation-request-id": "3bd19272-23de-4bd8-bb12-0cf6a48c1ecf", + "x-ms-ratelimit-remaining-subscription-reads": "11928", + "x-ms-routing-request-id": "WESTUS:20230214T015938Z:3bd19272-23de-4bd8-bb12-0cf6a48c1ecf" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "1383", + "Content-Length": "2064", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:35 GMT", + "Date": "Tue, 14 Feb 2023 01:59:43 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "33aa9600-01e5-4f42-8a4a-b6ed727ef8de", - "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "WESTUS2:20230131T063735Z:33aa9600-01e5-4f42-8a4a-b6ed727ef8de" + "x-ms-correlation-request-id": "e475e269-6829-4fc9-8946-fc107111bb4f", + "x-ms-ratelimit-remaining-subscription-reads": "11927", + "x-ms-routing-request-id": "WESTUS:20230214T015943Z:e475e269-6829-4fc9-8946-fc107111bb4f" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:31.4303707Z", - "duration": "PT5.9065851S", - "trackingId": "d67cd243-b96f-4f62-9101-238c55c7ccda", + "timestamp": "2023-02-14T01:59:37.3402422Z", + "duration": "PT3.971894S", + "trackingId": "ee361557-27d2-4404-96f5-494db852030b", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "timestamp": "2023-02-14T01:59:36.9029963Z", + "duration": "PT3.4689905S", + "trackingId": "d435405d-e95e-4337-9021-26754e119a74", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -1416,13 +1488,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1431,131 +1503,126 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:35 GMT", + "Date": "Tue, 14 Feb 2023 01:59:43 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5a4bdee7-3877-4218-a16f-773a3b7dd1f5", - "x-ms-ratelimit-remaining-subscription-reads": "11907", - "x-ms-routing-request-id": "WESTUS2:20230131T063736Z:5a4bdee7-3877-4218-a16f-773a3b7dd1f5" + "x-ms-correlation-request-id": "8f4e3f04-d047-4d70-87e3-2aa03d1aaf0a", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-routing-request-id": "WESTUS:20230214T015943Z:8f4e3f04-d047-4d70-87e3-2aa03d1aaf0a" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/0ea047a6-741d-45cc-a9e3-ace2d554a8a4?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", + "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:40 GMT", + "Date": "Tue, 14 Feb 2023 01:59:48 GMT", "Expires": "-1", "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-87a45406122b371a503bd66c63212977-c2ea2e300114c33c-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "90c0d0a2-434f-477d-95fc-5e04fae86994", - "x-ms-ratelimit-remaining-subscription-reads": "11906", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063740Z:90c0d0a2-434f-477d-95fc-5e04fae86994", - "x-request-time": "0.024" + "x-ms-correlation-request-id": "2e203d5e-0dec-4fbf-aae4-4a92a4f632ab", + "x-ms-ratelimit-remaining-subscription-reads": "11926", + "x-ms-routing-request-id": "WESTUS:20230214T015949Z:2e203d5e-0dec-4fbf-aae4-4a92a4f632ab" }, "ResponseBody": { - "status": "InProgress" + "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2068", + "Content-Length": "2064", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:40 GMT", + "Date": "Tue, 14 Feb 2023 01:59:48 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d213a8ba-8a7a-48fc-b483-79432d3738a6", - "x-ms-ratelimit-remaining-subscription-reads": "11905", - "x-ms-routing-request-id": "WESTUS2:20230131T063741Z:d213a8ba-8a7a-48fc-b483-79432d3738a6" + "x-ms-correlation-request-id": "f7f051e4-b5c8-492c-a1ba-dd10557a6971", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-routing-request-id": "WESTUS:20230214T015949Z:f7f051e4-b5c8-492c-a1ba-dd10557a6971" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:59:37.3402422Z", + "duration": "PT3.971894S", + "trackingId": "ee361557-27d2-4404-96f5-494db852030b", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:31.4303707Z", - "duration": "PT5.9065851S", - "trackingId": "d67cd243-b96f-4f62-9101-238c55c7ccda", - "statusCode": "Accepted", + "timestamp": "2023-02-14T01:59:36.9029963Z", + "duration": "PT3.4689905S", + "trackingId": "d435405d-e95e-4337-9021-26754e119a74", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault195e233b" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -1563,13 +1630,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1578,96 +1645,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:40 GMT", + "Date": "Tue, 14 Feb 2023 01:59:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d38dafb3-08a1-45de-9cae-76fbc6e2d3c3", + "x-ms-correlation-request-id": "f0461e9c-d933-4b84-83cf-419868bf6c53", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "WESTUS2:20230131T063741Z:d38dafb3-08a1-45de-9cae-76fbc6e2d3c3" + "x-ms-routing-request-id": "WESTUS:20230214T015954Z:f0461e9c-d933-4b84-83cf-419868bf6c53" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2068", + "Content-Length": "2067", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:45 GMT", + "Date": "Tue, 14 Feb 2023 01:59:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ea1e7179-7db2-4d93-bf3c-d4ce24ed0192", - "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "WESTUS2:20230131T063746Z:ea1e7179-7db2-4d93-bf3c-d4ce24ed0192" + "x-ms-correlation-request-id": "d96f1dfd-c3aa-4d8e-bd69-9ebf45276fc4", + "x-ms-ratelimit-remaining-subscription-reads": "11925", + "x-ms-routing-request-id": "WESTUS:20230214T015954Z:d96f1dfd-c3aa-4d8e-bd69-9ebf45276fc4" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:59:37.3402422Z", + "duration": "PT3.971894S", + "trackingId": "ee361557-27d2-4404-96f5-494db852030b", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:31.4303707Z", - "duration": "PT5.9065851S", - "trackingId": "d67cd243-b96f-4f62-9101-238c55c7ccda", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault195e233b" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -1675,13 +1742,48 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/4a229f80-49b4-403b-916a-fac78a6f3d52?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 01:59:55 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-e3d4994cdb02377a9c1e0c28bad1f464-ed13368c80aef2eb-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-eastus2euap-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "e77d9727-85fc-4e87-8501-3110f6e297de", + "x-ms-ratelimit-remaining-subscription-reads": "11924", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T015956Z:e77d9727-85fc-4e87-8501-3110f6e297de", + "x-request-time": "0.021" + }, + "ResponseBody": { + "status": "InProgress" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1690,96 +1792,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:46 GMT", + "Date": "Tue, 14 Feb 2023 01:59:59 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d3c740f3-285c-4590-93b3-fed840210004", - "x-ms-ratelimit-remaining-subscription-reads": "11904", - "x-ms-routing-request-id": "WESTUS2:20230131T063746Z:d3c740f3-285c-4590-93b3-fed840210004" + "x-ms-correlation-request-id": "8283f499-e9a5-4050-9263-82951c668100", + "x-ms-ratelimit-remaining-subscription-reads": "11923", + "x-ms-routing-request-id": "WESTUS:20230214T015959Z:8283f499-e9a5-4050-9263-82951c668100" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2785", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:51 GMT", + "Date": "Tue, 14 Feb 2023 01:59:59 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "72556bf1-22a0-44a7-916b-8368896389a1", - "x-ms-ratelimit-remaining-subscription-reads": "11903", - "x-ms-routing-request-id": "WESTUS2:20230131T063752Z:72556bf1-22a0-44a7-916b-8368896389a1" + "x-ms-correlation-request-id": "072821b8-9078-4b35-b171-57b5536ee21e", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-routing-request-id": "WESTUS:20230214T015959Z:072821b8-9078-4b35-b171-57b5536ee21e" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:59:59.8514692Z", + "duration": "PT2.9428792S", + "trackingId": "d7d53460-b93c-4111-86a7-177d6ad12fad", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -1787,13 +1906,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1802,126 +1921,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:51 GMT", + "Date": "Tue, 14 Feb 2023 02:00:03 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4fa9c93e-74f1-4d30-b164-5114028e4e2e", + "x-ms-correlation-request-id": "5090fafb-8c95-4516-b2d3-33c657c556ce", "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "WESTUS2:20230131T063752Z:4fa9c93e-74f1-4d30-b164-5114028e4e2e" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:56 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "61ab2271-d086-4d59-b3c5-f164334976d5", - "x-ms-ratelimit-remaining-subscription-reads": "11902", - "x-ms-routing-request-id": "WESTUS2:20230131T063757Z:61ab2271-d086-4d59-b3c5-f164334976d5" + "x-ms-routing-request-id": "WESTUS:20230214T020004Z:5090fafb-8c95-4516-b2d3-33c657c556ce" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2785", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:37:56 GMT", + "Date": "Tue, 14 Feb 2023 02:00:04 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "625a1a61-2cd3-4e2a-942b-d71ebed70897", + "x-ms-correlation-request-id": "0d92ed1f-b4d8-4fe7-a163-9017bc55c643", "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "WESTUS2:20230131T063757Z:625a1a61-2cd3-4e2a-942b-d71ebed70897" + "x-ms-routing-request-id": "WESTUS:20230214T020005Z:0d92ed1f-b4d8-4fe7-a163-9017bc55c643" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:59:59.8514692Z", + "duration": "PT2.9428792S", + "trackingId": "d7d53460-b93c-4111-86a7-177d6ad12fad", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -1929,13 +2035,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1944,96 +2050,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:01 GMT", + "Date": "Tue, 14 Feb 2023 02:00:09 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1e61d3d4-b4be-43c8-892a-50df4ea48d4e", + "x-ms-correlation-request-id": "c372e7fe-08c5-46b8-b440-5f777dd2fe7b", "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "WESTUS2:20230131T063802Z:1e61d3d4-b4be-43c8-892a-50df4ea48d4e" + "x-ms-routing-request-id": "WESTUS:20230214T020010Z:c372e7fe-08c5-46b8-b440-5f777dd2fe7b" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2785", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:02 GMT", + "Date": "Tue, 14 Feb 2023 02:00:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "390f57b6-ff9f-4a48-a188-894e0485961d", - "x-ms-ratelimit-remaining-subscription-reads": "11901", - "x-ms-routing-request-id": "WESTUS2:20230131T063803Z:390f57b6-ff9f-4a48-a188-894e0485961d" + "x-ms-correlation-request-id": "174523df-2326-48a6-b495-26077472b7b6", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "WESTUS:20230214T020011Z:174523df-2326-48a6-b495-26077472b7b6" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:59:59.8514692Z", + "duration": "PT2.9428792S", + "trackingId": "d7d53460-b93c-4111-86a7-177d6ad12fad", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -2041,13 +2164,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2056,96 +2179,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:07 GMT", + "Date": "Tue, 14 Feb 2023 02:00:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a463a4b9-64af-40ab-8f5c-b0fad0d16889", - "x-ms-ratelimit-remaining-subscription-reads": "11900", - "x-ms-routing-request-id": "WESTUS2:20230131T063807Z:a463a4b9-64af-40ab-8f5c-b0fad0d16889" + "x-ms-correlation-request-id": "13adf5f1-26ca-4264-9f57-5357ebe980c8", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "WESTUS:20230214T020015Z:13adf5f1-26ca-4264-9f57-5357ebe980c8" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2785", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:08 GMT", + "Date": "Tue, 14 Feb 2023 02:00:16 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1f6f01c1-e934-476c-8dba-210f204b6e93", - "x-ms-ratelimit-remaining-subscription-reads": "11899", - "x-ms-routing-request-id": "WESTUS2:20230131T063808Z:1f6f01c1-e934-476c-8dba-210f204b6e93" + "x-ms-correlation-request-id": "b7552dff-1b51-4ce9-86ef-a0cd746c51ff", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "WESTUS:20230214T020016Z:b7552dff-1b51-4ce9-86ef-a0cd746c51ff" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:59:59.8514692Z", + "duration": "PT2.9428792S", + "trackingId": "d7d53460-b93c-4111-86a7-177d6ad12fad", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -2153,48 +2293,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/0ea047a6-741d-45cc-a9e3-ace2d554a8a4?api-version=2022-10-01-preview\u0026type=async", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:10 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-2e8447ee8bc4a6e8a4b2ed42d761ed0e-ae9fa6070df6fcc6-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-01", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "00bf33b8-411f-420f-be69-b265e22285e3", - "x-ms-ratelimit-remaining-subscription-reads": "11898", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063810Z:00bf33b8-411f-420f-be69-b265e22285e3", - "x-request-time": "0.022" - }, - "ResponseBody": { - "status": "InProgress" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2203,950 +2308,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:12 GMT", + "Date": "Tue, 14 Feb 2023 02:00:20 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4fb47580-2649-40db-9698-16fcd0386073", - "x-ms-ratelimit-remaining-subscription-reads": "11897", - "x-ms-routing-request-id": "WESTUS2:20230131T063813Z:4fb47580-2649-40db-9698-16fcd0386073" + "x-ms-correlation-request-id": "0848070a-dd8f-490e-a4a0-df57722901fd", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "WESTUS:20230214T020020Z:0848070a-dd8f-490e-a4a0-df57722901fd" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2065", + "Content-Length": "2780", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:13 GMT", + "Date": "Tue, 14 Feb 2023 02:00:21 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6dea75d5-bdfa-40bd-8f48-f04f1579cf94", - "x-ms-ratelimit-remaining-subscription-reads": "11896", - "x-ms-routing-request-id": "WESTUS2:20230131T063813Z:6dea75d5-bdfa-40bd-8f48-f04f1579cf94" + "x-ms-correlation-request-id": "a7a0cd4f-b641-48eb-9f52-3bc1658a8957", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "WESTUS:20230214T020021Z:a7a0cd4f-b641-48eb-9f52-3bc1658a8957" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:00:21.3723708Z", + "duration": "PT24.4637808S", + "trackingId": "d80f8909-0fca-4475-af59-2bba323e8111", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:18 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "20e01ddb-814f-434f-aedd-6049e95d3fbf", - "x-ms-ratelimit-remaining-subscription-reads": "11895", - "x-ms-routing-request-id": "WESTUS2:20230131T063818Z:20e01ddb-814f-434f-aedd-6049e95d3fbf" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2065", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:19 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f9e84e6d-5801-495a-a1b8-8351a6c8d31d", - "x-ms-ratelimit-remaining-subscription-reads": "11894", - "x-ms-routing-request-id": "WESTUS2:20230131T063819Z:f9e84e6d-5801-495a-a1b8-8351a6c8d31d" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:23 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "40cda70c-a204-4902-9d4e-9f1b1be424c0", - "x-ms-ratelimit-remaining-subscription-reads": "11893", - "x-ms-routing-request-id": "WESTUS2:20230131T063823Z:40cda70c-a204-4902-9d4e-9f1b1be424c0" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2065", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:24 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "2100b2ae-f94e-45cc-8837-ea5f67c0204a", - "x-ms-ratelimit-remaining-subscription-reads": "11892", - "x-ms-routing-request-id": "WESTUS2:20230131T063824Z:2100b2ae-f94e-45cc-8837-ea5f67c0204a" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:28 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8d57e3ff-97cf-4ad1-8639-07ee2cf69920", - "x-ms-ratelimit-remaining-subscription-reads": "11891", - "x-ms-routing-request-id": "WESTUS2:20230131T063828Z:8d57e3ff-97cf-4ad1-8639-07ee2cf69920" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2065", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:29 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c478eb14-29e6-492b-b10a-6bace4a1845f", - "x-ms-ratelimit-remaining-subscription-reads": "11890", - "x-ms-routing-request-id": "WESTUS2:20230131T063829Z:c478eb14-29e6-492b-b10a-6bace4a1845f" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:33 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "78ff4de4-90ee-4f2c-ab7c-a5745fc3d5d7", - "x-ms-ratelimit-remaining-subscription-reads": "11889", - "x-ms-routing-request-id": "WESTUS2:20230131T063834Z:78ff4de4-90ee-4f2c-ab7c-a5745fc3d5d7" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2065", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:35 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f0219cad-20fb-4863-abaf-7bc8a686ea6f", - "x-ms-ratelimit-remaining-subscription-reads": "11888", - "x-ms-routing-request-id": "WESTUS2:20230131T063835Z:f0219cad-20fb-4863-abaf-7bc8a686ea6f" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:37:30.2833825Z", - "duration": "PT4.7595969S", - "trackingId": "b9d4d2a8-bfaf-4561-89ac-25d59bf400a4", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:39 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ff80c3de-8b7e-46e4-9549-1bf3c1854e04", - "x-ms-ratelimit-remaining-subscription-reads": "11887", - "x-ms-routing-request-id": "WESTUS2:20230131T063839Z:ff80c3de-8b7e-46e4-9549-1bf3c1854e04" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2070", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:40 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b95e36c9-8eed-4a3e-bc3d-cccdde55ece6", - "x-ms-ratelimit-remaining-subscription-reads": "11886", - "x-ms-routing-request-id": "WESTUS2:20230131T063840Z:b95e36c9-8eed-4a3e-bc3d-cccdde55ece6" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/0ea047a6-741d-45cc-a9e3-ace2d554a8a4?api-version=2022-10-01-preview\u0026type=async", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:40 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-0573db151d1451775713f3d45410d095-1245b8f11d52eed0-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-01", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0f8e5a33-3768-4136-8462-c358c68cd507", - "x-ms-ratelimit-remaining-subscription-reads": "11885", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063841Z:0f8e5a33-3768-4136-8462-c358c68cd507", - "x-request-time": "0.024" - }, - "ResponseBody": { - "status": "Succeeded", - "percentComplete": 100.0 - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:44 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "39d68efa-b2c1-42b5-bf76-dbbf16b453fa", - "x-ms-ratelimit-remaining-subscription-reads": "11884", - "x-ms-routing-request-id": "WESTUS2:20230131T063844Z:39d68efa-b2c1-42b5-bf76-dbbf16b453fa" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2791", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:45 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "dbf4bdc6-9727-409d-84fb-82270253a62b", - "x-ms-ratelimit-remaining-subscription-reads": "11883", - "x-ms-routing-request-id": "WESTUS2:20230131T063846Z:dbf4bdc6-9727-409d-84fb-82270253a62b" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:38:40.8004467Z", - "duration": "PT4.3344637S", - "trackingId": "f3f2a4d7-0aa0-4e65-9e8f-1fc4d0baac05", - "statusCode": "Accepted", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:49 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3346a0fd-66cf-4eef-a3ac-1e7f1380d691", - "x-ms-ratelimit-remaining-subscription-reads": "11882", - "x-ms-routing-request-id": "WESTUS2:20230131T063850Z:3346a0fd-66cf-4eef-a3ac-1e7f1380d691" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2791", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:51 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5c17903f-9243-40eb-a562-56d667d33f12", - "x-ms-ratelimit-remaining-subscription-reads": "11881", - "x-ms-routing-request-id": "WESTUS2:20230131T063851Z:5c17903f-9243-40eb-a562-56d667d33f12" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:38:40.8004467Z", - "duration": "PT4.3344637S", - "trackingId": "f3f2a4d7-0aa0-4e65-9e8f-1fc4d0baac05", - "statusCode": "Accepted", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttkeyvault195e233b" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -3154,13 +2422,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3169,242 +2437,148 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:55 GMT", + "Date": "Tue, 14 Feb 2023 02:00:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ecc1ed93-073f-41df-93a2-30f70ffbbe4a", - "x-ms-ratelimit-remaining-subscription-reads": "11880", - "x-ms-routing-request-id": "WESTUS2:20230131T063855Z:ecc1ed93-073f-41df-93a2-30f70ffbbe4a" + "x-ms-correlation-request-id": "e4e6486a-b275-43b9-b005-3c3f1d7118fa", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-routing-request-id": "WESTUS:20230214T020026Z:e4e6486a-b275-43b9-b005-3c3f1d7118fa" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2791", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:38:56 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "39ebaa82-3b33-4f4e-87f1-47c4e939ce3b", - "x-ms-ratelimit-remaining-subscription-reads": "11879", - "x-ms-routing-request-id": "WESTUS2:20230131T063857Z:39ebaa82-3b33-4f4e-87f1-47c4e939ce3b" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:38:40.8004467Z", - "duration": "PT4.3344637S", - "trackingId": "f3f2a4d7-0aa0-4e65-9e8f-1fc4d0baac05", - "statusCode": "Accepted", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/4a229f80-49b4-403b-916a-fac78a6f3d52?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:00 GMT", + "Date": "Tue, 14 Feb 2023 02:00:25 GMT", "Expires": "-1", "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-556ba3c64ad7cf6b322db4a3068bbda4-952d4d785ac38b73-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ce2e011a-d6a3-455e-b0e5-876d03759c4e", - "x-ms-ratelimit-remaining-subscription-reads": "11878", - "x-ms-routing-request-id": "WESTUS2:20230131T063900Z:ce2e011a-d6a3-455e-b0e5-876d03759c4e" + "x-ms-correlation-request-id": "bedab933-27e2-4a61-8c81-ed4a5c614ec5", + "x-ms-ratelimit-remaining-subscription-reads": "11922", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020026Z:bedab933-27e2-4a61-8c81-ed4a5c614ec5", + "x-request-time": "0.020" }, "ResponseBody": { - "status": "Running" + "status": "InProgress" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2786", + "Content-Length": "2780", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:02 GMT", + "Date": "Tue, 14 Feb 2023 02:00:26 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ebc4c35e-47b0-415e-9c0b-9bf9989a2160", - "x-ms-ratelimit-remaining-subscription-reads": "11877", - "x-ms-routing-request-id": "WESTUS2:20230131T063902Z:ebc4c35e-47b0-415e-9c0b-9bf9989a2160" + "x-ms-correlation-request-id": "5c6108f1-4593-4a3e-ac66-ebdaf9d75bd7", + "x-ms-ratelimit-remaining-subscription-reads": "11921", + "x-ms-routing-request-id": "WESTUS:20230214T020027Z:5c6108f1-4593-4a3e-ac66-ebdaf9d75bd7" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:39:01.2789652Z", - "duration": "PT24.8129822S", - "trackingId": "6f10f517-245a-42f0-8b62-b91e818a2551", + "timestamp": "2023-02-14T02:00:23.5351205Z", + "duration": "PT26.6265305S", + "trackingId": "3fb429b5-9851-4d32-8f1a-b3ac6f826cc0", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault195e233b" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } } @@ -3412,13 +2586,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3427,268 +2601,127 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:05 GMT", + "Date": "Tue, 14 Feb 2023 02:00:30 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a30a5d5d-4980-45b6-9bf8-3c267f63300d", - "x-ms-ratelimit-remaining-subscription-reads": "11876", - "x-ms-routing-request-id": "WESTUS2:20230131T063905Z:a30a5d5d-4980-45b6-9bf8-3c267f63300d" + "x-ms-correlation-request-id": "bf5bf7ff-e7d6-4c08-9efc-808dbafb06ff", + "x-ms-ratelimit-remaining-subscription-reads": "11920", + "x-ms-routing-request-id": "WESTUS:20230214T020031Z:bf5bf7ff-e7d6-4c08-9efc-808dbafb06ff" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2786", + "Content-Length": "2780", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:07 GMT", + "Date": "Tue, 14 Feb 2023 02:00:31 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "22f0ced6-777f-4645-88ad-1e08b99ba6a0", - "x-ms-ratelimit-remaining-subscription-reads": "11875", - "x-ms-routing-request-id": "WESTUS2:20230131T063907Z:22f0ced6-777f-4645-88ad-1e08b99ba6a0" + "x-ms-correlation-request-id": "f9584aa0-07a2-4f56-92e4-bf6a86f99559", + "x-ms-ratelimit-remaining-subscription-reads": "11919", + "x-ms-routing-request-id": "WESTUS:20230214T020032Z:f9584aa0-07a2-4f56-92e4-bf6a86f99559" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:39:05.4332929Z", - "duration": "PT28.9673099S", - "trackingId": "cb14efe4-104f-4577-a11e-6b8343962a30", + "timestamp": "2023-02-14T02:00:28.7068667Z", + "duration": "PT31.7982767S", + "trackingId": "c575fcca-6c01-446f-95cb-cfc7f0a9ff16", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:10 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0adefe6a-c613-4d67-9f01-56baae624855", - "x-ms-ratelimit-remaining-subscription-reads": "11874", - "x-ms-routing-request-id": "WESTUS2:20230131T063911Z:0adefe6a-c613-4d67-9f01-56baae624855" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "3250", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:12 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c0dcbe7d-3e09-4c66-ad35-641ff506b917", - "x-ms-ratelimit-remaining-subscription-reads": "11873", - "x-ms-routing-request-id": "WESTUS2:20230131T063913Z:c0dcbe7d-3e09-4c66-ad35-641ff506b917" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:39:10.9493499Z", - "duration": "PT34.4833669S", - "trackingId": "5043488f-2f26-47a3-9fb9-27b361b92621", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etesttkeyvault195e233b" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttinsights7bb983b1" } } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/08585264598423055223", - "operationId": "08585264598423055223", - "properties": { - "provisioningOperation": "EvaluateDeploymentOutput", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:39:11.1013114Z", - "duration": "PT34.6353284S", - "trackingId": "c5128568-b5ec-4e0f-b932-81667d605672", - "statusCode": "OK" - } } ] } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operationStatuses/08585264598423055223?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operationStatuses/08585252669139929110?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3697,64 +2730,64 @@ "Content-Encoding": "gzip", "Content-Length": "22", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:15 GMT", + "Date": "Tue, 14 Feb 2023 02:00:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "21b14d0d-913a-449c-9db1-c54eb7c77155", - "x-ms-ratelimit-remaining-subscription-reads": "11872", - "x-ms-routing-request-id": "WESTUS2:20230131T063916Z:21b14d0d-913a-449c-9db1-c54eb7c77155" + "x-ms-correlation-request-id": "03046a3e-6909-4eb7-b2f1-818ced183dec", + "x-ms-ratelimit-remaining-subscription-reads": "11918", + "x-ms-routing-request-id": "WESTUS:20230214T020036Z:03046a3e-6909-4eb7-b2f1-818ced183dec" }, "ResponseBody": { "status": "Succeeded" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "8491", + "Content-Length": "8560", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:15 GMT", + "Date": "Tue, 14 Feb 2023 02:00:36 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7e6ef071-e3d4-4f92-9245-d5155604da78", - "x-ms-ratelimit-remaining-subscription-reads": "11871", - "x-ms-routing-request-id": "WESTUS2:20230131T063916Z:7e6ef071-e3d4-4f92-9245-d5155604da78" + "x-ms-correlation-request-id": "72ab6353-9ec5-432b-86a4-437353c8afe2", + "x-ms-ratelimit-remaining-subscription-reads": "11917", + "x-ms-routing-request-id": "WESTUS:20230214T020036Z:72ab6353-9ec5-432b-86a4-437353c8afe2" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603", - "name": "e2etest_test_797279886032-5286603", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818", + "name": "e2etest_test_786182016259-500818", "type": "Microsoft.Resources/deployments", "properties": { - "templateHash": "12037445159745527008", + "templateHash": "4984303229931942319", "parameters": { "workspaceName": { "type": "String", - "value": "e2etest_test_797279886032" + "value": "e2etest_test_786182016259" }, "description": { "type": "String", - "value": "e2etest_test_797279886032 description" + "value": "e2etest_test_786182016259 description" }, "friendlyName": { "type": "String", - "value": "e2etest_test_797279886032 display name" + "value": "e2etest_test_786182016259 display name" }, "location": { "type": "String", @@ -3770,7 +2803,7 @@ }, "storageAccountName": { "type": "String", - "value": "e2etesttstoragea0da1e5b0" + "value": "e2etesttstorage50cc96bf3" }, "storageAccountType": { "type": "String", @@ -3794,7 +2827,7 @@ }, "keyVaultName": { "type": "String", - "value": "e2etesttkeyvaultd93792c0" + "value": "e2etesttkeyvault195e233b" }, "keyVaultBehindVNet": { "type": "String", @@ -3814,7 +2847,7 @@ }, "applicationInsightsName": { "type": "String", - "value": "e2etesttinsights521666cf" + "value": "e2etesttinsights7bb983b1" }, "applicationInsightsResourceGroupName": { "type": "String", @@ -3905,7 +2938,7 @@ "tagValues": { "type": "Object", "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "privateEndpointName": { @@ -3953,13 +2986,19 @@ "primaryUserAssignedIdentity": { "type": "String", "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "Disabled" + } } }, "mode": "Incremental", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:39:11.119733Z", - "duration": "PT1M46.5050913S", - "correlationId": "07327898-3b16-44a6-84fd-67afbd0e9d01", + "timestamp": "2023-02-14T02:00:34.0951702Z", + "duration": "PT1M1.1335525S", + "correlationId": "70a27ebd-3348-4a88-9665-73ea2a2843c4", "providers": [ { "namespace": "Microsoft.Storage", @@ -4027,9 +3066,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" }, { "dependsOn": [ @@ -4039,9 +3078,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" }, { "dependsOn": [ @@ -4058,19 +3097,19 @@ { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "resourceName": "e2etesttstorage50cc96bf3" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "resourceName": "e2etesttkeyvault195e233b" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "resourceName": "e2etesttinsights7bb983b1" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", @@ -4078,16 +3117,16 @@ "resourceName": "name" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etest_test_786182016259" }, { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etest_test_786182016259" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", @@ -4102,126 +3141,126 @@ ], "outputResources": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3" } ] } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "3250", + "Content-Length": "3243", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:18 GMT", + "Date": "Tue, 14 Feb 2023 02:00:37 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8793ef60-0792-4679-9789-7b9ed756c1c1", - "x-ms-ratelimit-remaining-subscription-reads": "11870", - "x-ms-routing-request-id": "WESTUS2:20230131T063918Z:8793ef60-0792-4679-9789-7b9ed756c1c1" + "x-ms-correlation-request-id": "56c41bb4-57d0-480d-b0c3-2b534fc6f228", + "x-ms-ratelimit-remaining-subscription-reads": "11916", + "x-ms-routing-request-id": "WESTUS:20230214T020037Z:56c41bb4-57d0-480d-b0c3-2b534fc6f228" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:39:10.9493499Z", - "duration": "PT34.4833669S", - "trackingId": "5043488f-2f26-47a3-9fb9-27b361b92621", + "timestamp": "2023-02-14T02:00:33.8883786Z", + "duration": "PT36.9797886S", + "trackingId": "a2abb810-598f-47da-b1dc-a07809fa9c9e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault195e233b" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/08585264598423055223", - "operationId": "08585264598423055223", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/08585252669139929110", + "operationId": "08585252669139929110", "properties": { "provisioningOperation": "EvaluateDeploymentOutput", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:39:11.1013114Z", - "duration": "PT34.6353284S", - "trackingId": "c5128568-b5ec-4e0f-b932-81667d605672", + "timestamp": "2023-02-14T02:00:34.0707462Z", + "duration": "PT37.1621562S", + "trackingId": "3a7df1cd-a2ec-4923-b7da-4f888e861ef8", "statusCode": "OK" } } @@ -4229,110 +3268,110 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_797279886032-5286603/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_786182016259-500818/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "3250", + "Content-Length": "3243", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:18 GMT", + "Date": "Tue, 14 Feb 2023 02:00:37 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4447fdf5-2aec-4bc4-9ce2-f71dc1fdfca8", - "x-ms-ratelimit-remaining-subscription-reads": "11869", - "x-ms-routing-request-id": "WESTUS2:20230131T063918Z:4447fdf5-2aec-4bc4-9ce2-f71dc1fdfca8" + "x-ms-correlation-request-id": "86ad0319-59f6-4ef9-8421-5707b62717ce", + "x-ms-ratelimit-remaining-subscription-reads": "11915", + "x-ms-routing-request-id": "WESTUS:20230214T020038Z:86ad0319-59f6-4ef9-8421-5707b62717ce" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DC6A2B52AB7298AB", - "operationId": "DC6A2B52AB7298AB", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/4FBE08E5C6351D6A", + "operationId": "4FBE08E5C6351D6A", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:39:10.9493499Z", - "duration": "PT34.4833669S", - "trackingId": "5043488f-2f26-47a3-9fb9-27b361b92621", + "timestamp": "2023-02-14T02:00:33.8883786Z", + "duration": "PT36.9797886S", + "trackingId": "a2abb810-598f-47da-b1dc-a07809fa9c9e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_797279886032" + "resourceName": "e2etest_test_786182016259" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/739911AFD07DDEEF", - "operationId": "739911AFD07DDEEF", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/8EB137E14666C100", + "operationId": "8EB137E14666C100", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:37.827671Z", - "duration": "PT12.3772003S", - "trackingId": "267c70c9-c4aa-4c6b-9f6c-abb3f699f155", + "timestamp": "2023-02-14T01:59:56.8370248Z", + "duration": "PT23.4686766S", + "trackingId": "ed31954f-d9f5-44ba-b022-1fef5650837c", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights521666cf", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights521666cf" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage50cc96bf3" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/5DBE6A1DF16C676C", - "operationId": "5DBE6A1DF16C676C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/D3BE8104AAF2CC6F", + "operationId": "D3BE8104AAF2CC6F", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:37:51.1085251Z", - "duration": "PT25.5847395S", - "trackingId": "0afc60e5-cc2e-416d-8764-d1f5a790527d", + "timestamp": "2023-02-14T01:59:52.2144046Z", + "duration": "PT18.7803988S", + "trackingId": "7a0c199a-af20-40d3-83e3-6c88dfdaddf6", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea0da1e5b0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault195e233b", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault195e233b" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/DA21627E4CA659F9", - "operationId": "DA21627E4CA659F9", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/5F8AD9C3E8462591", + "operationId": "5F8AD9C3E8462591", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:38:36.2722207Z", - "duration": "PT1M10.7484351S", - "trackingId": "0af17a15-ad74-46a9-a16a-e2e046994549", + "timestamp": "2023-02-14T01:59:36.7664179Z", + "duration": "PT3.3980697S", + "trackingId": "7ac086fe-201d-4ec2-bb9d-6994cdcc732a", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvaultd93792c0", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvaultd93792c0" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights7bb983b1", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights7bb983b1" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_797279886032-5286603/operations/08585264598423055223", - "operationId": "08585264598423055223", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_786182016259-500818/operations/08585252669139929110", + "operationId": "08585252669139929110", "properties": { "provisioningOperation": "EvaluateDeploymentOutput", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:39:11.1013114Z", - "duration": "PT34.6353284S", - "trackingId": "c5128568-b5ec-4e0f-b932-81667d605672", + "timestamp": "2023-02-14T02:00:34.0707462Z", + "duration": "PT37.1621562S", + "trackingId": "3a7df1cd-a2ec-4923-b7da-4f888e861ef8", "statusCode": "OK" } } @@ -4340,13 +3379,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4354,11 +3393,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:18 GMT", + "Date": "Tue, 14 Feb 2023 02:00:37 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-8b1a8f175c7d4c1d5124f714a30a2034-e1aa6042af053d84-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-71face1c44537fc34be629be6ae3d69a-67aded1994852f66-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4367,54 +3406,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bdfd4ace-310a-43b3-aa19-236d6f5a8e40", - "x-ms-ratelimit-remaining-subscription-reads": "11868", + "x-ms-correlation-request-id": "1158ba4e-e002-4f43-b2c2-3b94d5263d6e", + "x-ms-ratelimit-remaining-subscription-reads": "11914", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063919Z:bdfd4ace-310a-43b3-aa19-236d6f5a8e40", - "x-request-time": "0.026" + "x-ms-routing-request-id": "WESTUS:20230214T020038Z:1158ba4e-e002-4f43-b2c2-3b94d5263d6e", + "x-request-time": "0.031" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "name": "e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "name": "e2etest_test_786182016259", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_797279886032 display name", - "description": "e2etest_test_797279886032 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvaultd93792c0", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights521666cf", + "friendlyName": "e2etest_test_786182016259 display name", + "description": "e2etest_test_786182016259 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault195e233b", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights7bb983b1", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:59:57.9073873Z", "notebookInfo": { - "resourceId": "bc0dbe0d101e4809aaca138b32ab0b92", - "fqdn": "ml-e2etesttest-eastus2euap-3d10da1f-6065-48c5-bd8a-511050e9be84.eastus2euap.notebooks.azure.net", + "resourceId": "92be8795a0764775866f8000d885dba4", + "fqdn": "ml-e2etesttest-eastus2euap-24bc8eda-6b6a-42dd-881f-af08f2290f9b.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "3d10da1f-6065-48c5-bd8a-511050e9be84", + "workspaceId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "8b37de03-26b5-4f44-9677-8eac88a16a53", + "principalId": "3ddbb596-2326-4697-9f7d-cf0f230a1da9", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4423,11 +3467,11 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:38:37.7058286Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:59:57.9073873Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:38:37.7058286Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:59:57.9073873Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } @@ -4439,7 +3483,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4447,27 +3491,27 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:22 GMT", + "Date": "Tue, 14 Feb 2023 02:00:39 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "208592f0-df47-43d1-8cab-c7de58fd8911", - "x-ms-ratelimit-remaining-subscription-reads": "11867", - "x-ms-routing-request-id": "WESTUS2:20230131T063922Z:208592f0-df47-43d1-8cab-c7de58fd8911" + "x-ms-correlation-request-id": "a62ff7c4-8cbb-4e51-8c61-5a6a4accb0bb", + "x-ms-ratelimit-remaining-subscription-reads": "11913", + "x-ms-routing-request-id": "WESTUS:20230214T020039Z:a62ff7c4-8cbb-4e51-8c61-5a6a4accb0bb" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe", "name": "uai-mhe", "type": "Microsoft.ManagedIdentity/userAssignedIdentities", - "location": "eastus2euap", + "location": "eastus", "tags": {}, "properties": { "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" } } }, @@ -4478,7 +3522,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-azure-mgmt-msi/6.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4486,38 +3530,38 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:22 GMT", + "Date": "Tue, 14 Feb 2023 02:00:39 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "22ccf9ae-ca43-44ea-8e0a-dce64cb90eb7", - "x-ms-ratelimit-remaining-subscription-reads": "11866", - "x-ms-routing-request-id": "WESTUS2:20230131T063922Z:22ccf9ae-ca43-44ea-8e0a-dce64cb90eb7" + "x-ms-correlation-request-id": "1972c3c4-139a-4f6c-9f24-846222203eff", + "x-ms-ratelimit-remaining-subscription-reads": "11912", + "x-ms-routing-request-id": "WESTUS:20230214T020040Z:1972c3c4-139a-4f6c-9f24-846222203eff" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2", "name": "uai-mhe2", "type": "Microsoft.ManagedIdentity/userAssignedIdentities", - "location": "eastus2euap", + "location": "eastus", "tags": {}, "properties": { "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4525,11 +3569,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:22 GMT", + "Date": "Tue, 14 Feb 2023 02:00:39 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-9d46f8afe87fa7848aa532cb4ccac105-9cddcd680f80e37a-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-f65f988473229b92af3d87ced4411275-520f0f9ca6356ac3-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4538,54 +3582,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7b19ca55-58dc-4eaf-b234-16258af482b1", - "x-ms-ratelimit-remaining-subscription-reads": "11865", + "x-ms-correlation-request-id": "32b25782-52bc-4a4a-b21b-4118cfd92656", + "x-ms-ratelimit-remaining-subscription-reads": "11911", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063923Z:7b19ca55-58dc-4eaf-b234-16258af482b1", - "x-request-time": "0.027" + "x-ms-routing-request-id": "WESTUS:20230214T020040Z:32b25782-52bc-4a4a-b21b-4118cfd92656", + "x-request-time": "0.029" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "name": "e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "name": "e2etest_test_786182016259", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_797279886032 display name", - "description": "e2etest_test_797279886032 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvaultd93792c0", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights521666cf", + "friendlyName": "e2etest_test_786182016259 display name", + "description": "e2etest_test_786182016259 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault195e233b", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights7bb983b1", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:59:57.9073873Z", "notebookInfo": { - "resourceId": "bc0dbe0d101e4809aaca138b32ab0b92", - "fqdn": "ml-e2etesttest-eastus2euap-3d10da1f-6065-48c5-bd8a-511050e9be84.eastus2euap.notebooks.azure.net", + "resourceId": "92be8795a0764775866f8000d885dba4", + "fqdn": "ml-e2etesttest-eastus2euap-24bc8eda-6b6a-42dd-881f-af08f2290f9b.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "3d10da1f-6065-48c5-bd8a-511050e9be84", + "workspaceId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "8b37de03-26b5-4f44-9677-8eac88a16a53", + "principalId": "3ddbb596-2326-4697-9f7d-cf0f230a1da9", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4594,17 +3643,17 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:38:37.7058286Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:59:57.9073873Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:38:37.7058286Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:59:57.9073873Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259?api-version=2022-12-01-preview", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -4612,7 +3661,7 @@ "Connection": "keep-alive", "Content-Length": "382", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "tags": {}, @@ -4626,33 +3675,33 @@ }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/Ph96Og-npHWp8zRTvBIWLMR6RCo79Kj9FQ9eBTTvLJI?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/gaZCM_1n9REGDmTXv-3suxQCyde8jM8bEjKNj-_MNJo?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:39:23 GMT", + "Date": "Tue, 14 Feb 2023 02:00:40 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/Ph96Og-npHWp8zRTvBIWLMR6RCo79Kj9FQ9eBTTvLJI?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/gaZCM_1n9REGDmTXv-3suxQCyde8jM8bEjKNj-_MNJo?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3533ca65-e70f-47ac-8fe2-47e8ff93bab6", - "x-ms-ratelimit-remaining-subscription-writes": "1191", + "x-ms-correlation-request-id": "fad544d3-ca1a-4bdb-8ded-f16b454c7c85", + "x-ms-ratelimit-remaining-subscription-writes": "1192", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063924Z:3533ca65-e70f-47ac-8fe2-47e8ff93bab6", - "x-request-time": "0.146" + "x-ms-routing-request-id": "WESTUS:20230214T020041Z:fad544d3-ca1a-4bdb-8ded-f16b454c7c85", + "x-request-time": "0.177" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/Ph96Og-npHWp8zRTvBIWLMR6RCo79Kj9FQ9eBTTvLJI?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/gaZCM_1n9REGDmTXv-3suxQCyde8jM8bEjKNj-_MNJo?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4660,34 +3709,70 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:23 GMT", + "Date": "Tue, 14 Feb 2023 02:00:41 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-5a0434db14a05186a273699c6eb0f031-ea024c4a4c83dbf1-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-04efa32b16ede08e80e6af596cccdb20-981d21e3ac12f3e5-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f31e9bd1-01f0-458c-8801-1bf0582ff8cb", - "x-ms-ratelimit-remaining-subscription-reads": "11864", + "x-ms-correlation-request-id": "488fefcd-a7e5-469c-8efc-c5bf628ff1fb", + "x-ms-ratelimit-remaining-subscription-reads": "11910", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063924Z:f31e9bd1-01f0-458c-8801-1bf0582ff8cb", - "x-request-time": "0.020" + "x-ms-routing-request-id": "WESTUS:20230214T020041Z:488fefcd-a7e5-469c-8efc-c5bf628ff1fb", + "x-request-time": "0.029" }, "ResponseBody": { "status": "InProgress" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/Ph96Og-npHWp8zRTvBIWLMR6RCo79Kj9FQ9eBTTvLJI?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/4a229f80-49b4-403b-916a-fac78a6f3d52?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:00:55 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-9302afa276c99fa1ecf11f5f12deaaf9-0e170592e2488e24-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-eastus2euap-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "ea462a0c-2039-4c46-875b-8d9747e10fd0", + "x-ms-ratelimit-remaining-subscription-reads": "11909", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020056Z:ea462a0c-2039-4c46-875b-8d9747e10fd0", + "x-request-time": "0.020" + }, + "ResponseBody": { + "status": "Succeeded", + "percentComplete": 100.0 + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/gaZCM_1n9REGDmTXv-3suxQCyde8jM8bEjKNj-_MNJo?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4695,20 +3780,20 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:53 GMT", + "Date": "Tue, 14 Feb 2023 02:01:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-3ea8e0dd987c4ae35fa15731cf4ab0bf-f67c011f1c5d11a5-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-7a4042d9277bd331c2256d1cbe2b85d5-b1efac42861e9427-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3d5c6f85-f450-455f-8756-4450806b52c4", - "x-ms-ratelimit-remaining-subscription-reads": "11863", + "x-ms-correlation-request-id": "46314244-1a66-419d-ae36-825e20d724df", + "x-ms-ratelimit-remaining-subscription-reads": "11908", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063954Z:3d5c6f85-f450-455f-8756-4450806b52c4", + "x-ms-routing-request-id": "WESTUS:20230214T020111Z:46314244-1a66-419d-ae36-825e20d724df", "x-request-time": "0.024" }, "ResponseBody": { @@ -4717,13 +3802,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4731,11 +3816,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:53 GMT", + "Date": "Tue, 14 Feb 2023 02:01:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-dfde8628b79d40f4761069b44be68f82-231100acf1ac8d75-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-5208a6f72bfd2022ddb858f7a14e748e-4fe29a998013d70a-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4744,61 +3829,66 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6a7ef4e3-13ea-4d1c-90e0-af2dc0312ac1", - "x-ms-ratelimit-remaining-subscription-reads": "11862", + "x-ms-correlation-request-id": "e24b248b-a41e-489b-a8df-c63d447ea368", + "x-ms-ratelimit-remaining-subscription-reads": "11907", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063954Z:6a7ef4e3-13ea-4d1c-90e0-af2dc0312ac1", - "x-request-time": "0.024" + "x-ms-routing-request-id": "WESTUS:20230214T020112Z:e24b248b-a41e-489b-a8df-c63d447ea368", + "x-request-time": "0.029" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "name": "e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "name": "e2etest_test_786182016259", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": {}, "etag": null, "properties": { - "friendlyName": "e2etest_test_797279886032 display name", - "description": "e2etest_test_797279886032 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvaultd93792c0", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights521666cf", + "friendlyName": "e2etest_test_786182016259 display name", + "description": "e2etest_test_786182016259 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault195e233b", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights7bb983b1", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:59:57.9073873Z", "notebookInfo": { - "resourceId": "bc0dbe0d101e4809aaca138b32ab0b92", - "fqdn": "ml-e2etesttest-eastus2euap-3d10da1f-6065-48c5-bd8a-511050e9be84.eastus2euap.notebooks.azure.net", + "resourceId": "92be8795a0764775866f8000d885dba4", + "fqdn": "ml-e2etesttest-eastus2euap-24bc8eda-6b6a-42dd-881f-af08f2290f9b.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "3d10da1f-6065-48c5-bd8a-511050e9be84", + "workspaceId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned,UserAssigned", - "principalId": "8b37de03-26b5-4f44-9677-8eac88a16a53", + "principalId": "3ddbb596-2326-4697-9f7d-cf0f230a1da9", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe": { - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" }, "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2": { - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, @@ -4808,23 +3898,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:38:37.7058286Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:59:57.9073873Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:39:23.7899991Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T02:00:41.2615749Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4832,11 +3922,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:39:54 GMT", + "Date": "Tue, 14 Feb 2023 02:01:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-3b9051bdf39bb2c921b9ef7576541dc6-e8755f8f87148cde-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-018c9a70c276db491a0571ce31bae810-83b63ece83e5dde9-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4845,61 +3935,66 @@ ], "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c685466c-d6a7-4aef-a101-29c676b8ad2d", - "x-ms-ratelimit-remaining-subscription-reads": "11861", + "x-ms-correlation-request-id": "1f5fb7b3-1131-421c-a373-e2e4f0c8dee3", + "x-ms-ratelimit-remaining-subscription-reads": "11906", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063954Z:c685466c-d6a7-4aef-a101-29c676b8ad2d", + "x-ms-routing-request-id": "WESTUS:20230214T020112Z:1f5fb7b3-1131-421c-a373-e2e4f0c8dee3", "x-request-time": "0.032" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "name": "e2etest_test_797279886032", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "name": "e2etest_test_786182016259", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": {}, "etag": null, "properties": { - "friendlyName": "e2etest_test_797279886032 display name", - "description": "e2etest_test_797279886032 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvaultd93792c0", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights521666cf", + "friendlyName": "e2etest_test_786182016259 display name", + "description": "e2etest_test_786182016259 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault195e233b", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights7bb983b1", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:59:57.9073873Z", "notebookInfo": { - "resourceId": "bc0dbe0d101e4809aaca138b32ab0b92", - "fqdn": "ml-e2etesttest-eastus2euap-3d10da1f-6065-48c5-bd8a-511050e9be84.eastus2euap.notebooks.azure.net", + "resourceId": "92be8795a0764775866f8000d885dba4", + "fqdn": "ml-e2etesttest-eastus2euap-24bc8eda-6b6a-42dd-881f-af08f2290f9b.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "3d10da1f-6065-48c5-bd8a-511050e9be84", + "workspaceId": "24bc8eda-6b6a-42dd-881f-af08f2290f9b", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032", - "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259", + "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned,UserAssigned", - "principalId": "8b37de03-26b5-4f44-9677-8eac88a16a53", + "principalId": "3ddbb596-2326-4697-9f7d-cf0f230a1da9", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe": { - "principalId": "0a390e3a-8a74-4a63-b4b1-358a6da87aac", - "clientId": "d8e8dc97-154f-4c2c-9ec0-de8568032d3e" + "principalId": "93029813-8a07-45a2-a347-6486be4f2240", + "clientId": "335eea06-5b20-4224-98c6-95bf072558db" }, "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai-mhe2": { - "principalId": "35341706-b4e3-4b8e-ab6f-b818a9cebaec", - "clientId": "b8233824-a37a-448e-9418-53538acd0c87" + "principalId": "418a373d-26e5-4f86-b861-6b248a35d953", + "clientId": "e37a7014-b884-4869-8a52-41134b368c26" } } }, @@ -4909,24 +4004,24 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:38:37.7058286Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:59:57.9073873Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:39:23.7899991Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T02:00:41.2615749Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights521666cf?api-version=2015-05-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights7bb983b1?api-version=2015-05-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4934,29 +4029,29 @@ "Access-Control-Expose-Headers": "Request-Context", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:40:00 GMT", + "Date": "Tue, 14 Feb 2023 02:01:16 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:7f83c1fe-8c94-4d55-9337-4ddc696f61ed", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0970c4de-c26f-4e60-9826-0f9c64b76b04", - "x-ms-ratelimit-remaining-subscription-deletes": "14990", - "x-ms-routing-request-id": "WESTUS2:20230131T064001Z:0970c4de-c26f-4e60-9826-0f9c64b76b04", + "x-ms-correlation-request-id": "06de7510-22a2-46e9-9d2c-4b0631ea13ad", + "x-ms-ratelimit-remaining-subscription-deletes": "14995", + "x-ms-routing-request-id": "WESTUS:20230214T020117Z:06de7510-22a2-46e9-9d2c-4b0631ea13ad", "X-Powered-By": "ASP.NET" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea0da1e5b0?api-version=2019-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage50cc96bf3?api-version=2019-06-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4964,85 +4059,85 @@ "Cache-Control": "no-cache", "Content-Length": "0", "Content-Type": "text/plain; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:40:07 GMT", + "Date": "Tue, 14 Feb 2023 02:01:21 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0896294e-b9c1-4a31-88b4-977010f85a51", - "x-ms-ratelimit-remaining-subscription-deletes": "14989", - "x-ms-routing-request-id": "WESTUS2:20230131T064007Z:0896294e-b9c1-4a31-88b4-977010f85a51" + "x-ms-correlation-request-id": "6071fbe9-97ab-468f-beb2-462f89baa946", + "x-ms-ratelimit-remaining-subscription-deletes": "14994", + "x-ms-routing-request-id": "WESTUS:20230214T020121Z:6071fbe9-97ab-468f-beb2-462f89baa946" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvaultd93792c0?api-version=2019-09-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault195e233b?api-version=2019-09-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:40:12 GMT", + "Date": "Tue, 14 Feb 2023 02:01:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e08f48ae-a60d-4387-985b-d92a93268db3", - "x-ms-keyvault-service-version": "1.5.655.1", - "x-ms-ratelimit-remaining-subscription-deletes": "14988", - "x-ms-routing-request-id": "WESTUS2:20230131T064013Z:e08f48ae-a60d-4387-985b-d92a93268db3" + "x-ms-correlation-request-id": "a72e1da4-104b-4bdc-9090-e09a7dcd6d82", + "x-ms-keyvault-service-version": "1.5.666.2", + "x-ms-ratelimit-remaining-subscription-deletes": "14993", + "x-ms-routing-request-id": "WESTUS:20230214T020125Z:a72e1da4-104b-4bdc-9090-e09a7dcd6d82" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_797279886032?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_786182016259?api-version=2022-12-01-preview", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/a3110070-6933-4679-851a-6a05ea3084fb?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/3a782421-0dbe-4ade-a3c8-ece5115ecc0f?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:40:13 GMT", + "Date": "Tue, 14 Feb 2023 02:01:24 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/a3110070-6933-4679-851a-6a05ea3084fb?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/3a782421-0dbe-4ade-a3c8-ece5115ecc0f?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-eastus2euap-01", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0375d1ca-d385-4bd4-bffa-be89fdf67548", - "x-ms-ratelimit-remaining-subscription-deletes": "14987", + "x-ms-correlation-request-id": "7413a2a4-e1fe-4de8-940a-839381a58a26", + "x-ms-ratelimit-remaining-subscription-deletes": "14992", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T064013Z:0375d1ca-d385-4bd4-bffa-be89fdf67548", - "x-request-time": "0.092" + "x-ms-routing-request-id": "WESTUS:20230214T020125Z:7413a2a4-e1fe-4de8-940a-839381a58a26", + "x-request-time": "0.235" }, "ResponseBody": null } ], "Variables": { - "deployment_name": "e2etest_test_797279886032-5286603", - "insights_name": "e2etesttinsights521666cf", - "keyvault_name": "e2etesttkeyvaultd93792c0", - "storage_name": "e2etesttstoragea0da1e5b0", - "wps_name": "test_797279886032" + "deployment_name": "e2etest_test_786182016259-500818", + "insights_name": "e2etesttinsights7bb983b1", + "keyvault_name": "e2etesttkeyvault195e233b", + "storage_name": "e2etesttstorage50cc96bf3", + "wps_name": "test_786182016259" } } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_create_update_and_delete.json b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_create_update_and_delete.json index defcaf784bf2..71b11cb0a54a 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_create_update_and_delete.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_create_update_and_delete.json @@ -1,13 +1,13 @@ { "Entries": [ { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -15,19 +15,19 @@ "Cache-Control": "no-cache", "Content-Length": "247", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:08 GMT", + "Date": "Tue, 14 Feb 2023 01:53:59 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6c7fd267-8979-4e6a-b0fd-0dafab034106", + "x-ms-correlation-request-id": "541cc4c4-eb08-47d2-ab48-fc3a5a9018b5", "x-ms-failure-cause": "gateway", - "x-ms-routing-request-id": "WESTUS2:20230131T063009Z:6c7fd267-8979-4e6a-b0fd-0dafab034106" + "x-ms-routing-request-id": "WESTUS:20230214T015400Z:541cc4c4-eb08-47d2-ab48-fc3a5a9018b5" }, "ResponseBody": { "error": { "code": "ResourceNotFound", - "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" + "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" } } }, @@ -38,7 +38,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -47,15 +47,15 @@ "Content-Encoding": "gzip", "Content-Length": "272", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:10 GMT", + "Date": "Tue, 14 Feb 2023 01:54:00 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "aaf6cb7c-78a6-464d-a4cc-74222bbef455", + "x-ms-correlation-request-id": "362c703f-c665-41e5-9590-eac1b497e424", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "WESTUS2:20230131T063011Z:aaf6cb7c-78a6-464d-a4cc-74222bbef455" + "x-ms-routing-request-id": "WESTUS:20230214T015401Z:362c703f-c665-41e5-9590-eac1b497e424" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus", @@ -74,7 +74,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -83,15 +83,15 @@ "Content-Encoding": "gzip", "Content-Length": "322", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:13 GMT", + "Date": "Tue, 14 Feb 2023 01:54:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e283f109-fcb4-4d4a-8c80-9916c700dfac", + "x-ms-correlation-request-id": "ed8e5f04-0709-41e3-9105-74ff4a932533", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "WESTUS2:20230131T063013Z:e283f109-fcb4-4d4a-8c80-9916c700dfac" + "x-ms-routing-request-id": "WESTUS:20230214T015402Z:ed8e5f04-0709-41e3-9105-74ff4a932533" }, "ResponseBody": { "value": [ @@ -105,15 +105,15 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285?api-version=2020-06-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "19279", + "Content-Length": "19620", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "properties": { @@ -505,6 +505,15 @@ "metadata": { "description": "ARM identifier of primary user assigned managed identity, in case multiple ones are specified. Also the default managed identity for clusterless compute." } + }, + "managedNetwork": { + "type": "object", + "defaultValue": { + "isolationMode": "Disabled" + }, + "metadata": { + "description": "Managed network settings to be used for the workspace. If not specified, isolation mode Disabled is the default" + } } }, "variables": { @@ -663,7 +672,7 @@ { "condition": "[variables(\u0027enablePE\u0027)]", "type": "Microsoft.MachineLearningServices/workspaces", - "apiVersion": "2022-01-01-preview", + "apiVersion": "2022-12-01-preview", "tags": "[parameters(\u0027tagValues\u0027)]", "name": "[parameters(\u0027workspaceName\u0027)]", "location": "[parameters(\u0027location\u0027)]", @@ -696,7 +705,8 @@ "storageAccountArmId": "[parameters(\u0027encryption_storage_resourceid\u0027)]", "SearchAccountArmId": "[parameters(\u0027encryption_search_resourceid\u0027)]" }, - "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]" + "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]", + "managedNetwork": "[parameters(\u0027managedNetwork\u0027)]" } }, { @@ -740,27 +750,27 @@ "value": "eastus2euap" }, "workspaceName": { - "value": "e2etest_test_119502617351" + "value": "e2etest_test_855339767631" }, "resourceGroupName": { "value": "00000" }, "description": { - "value": "e2etest_test_119502617351 description" + "value": "e2etest_test_855339767631 description" }, "friendlyName": { - "value": "e2etest_test_119502617351 display name" + "value": "e2etest_test_855339767631 display name" }, "tagValues": { "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "keyVaultOption": { "value": "new" }, "keyVaultName": { - "value": "e2etesttkeyvault8b9fd471" + "value": "e2etesttkeyvault3e2a4ce5" }, "keyVaultResourceGroupName": { "value": "00000" @@ -769,7 +779,7 @@ "value": "new" }, "storageAccountName": { - "value": "e2etesttstoragea482cf16d" + "value": "e2etesttstorage7a156a630" }, "storageAccountResourceGroupName": { "value": "00000" @@ -778,7 +788,7 @@ "value": "new" }, "applicationInsightsName": { - "value": "e2etesttinsights03491969" + "value": "e2etesttinsights667c475d" }, "applicationInsightsResourceGroupName": { "value": "00000" @@ -856,6 +866,11 @@ }, "primaryUserAssignedIdentity": { "value": "" + }, + "managedNetwork": { + "value": { + "isolationMode": "Disabled" + } } }, "mode": "incremental" @@ -863,37 +878,37 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "Cache-Control": "no-cache", - "Content-Length": "7876", + "Content-Length": "7947", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:19 GMT", + "Date": "Tue, 14 Feb 2023 01:54:06 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7e685d67-67f6-4f1f-b200-1e7e5674fa56", + "x-ms-correlation-request-id": "a608ee4c-ba33-4d72-8887-27beaaee8b51", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "WESTUS2:20230131T063020Z:7e685d67-67f6-4f1f-b200-1e7e5674fa56" + "x-ms-routing-request-id": "WESTUS:20230214T015407Z:a608ee4c-ba33-4d72-8887-27beaaee8b51" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430", - "name": "e2etest_test_119502617351-2374430", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285", + "name": "e2etest_test_855339767631-9567285", "type": "Microsoft.Resources/deployments", "properties": { - "templateHash": "12037445159745527008", + "templateHash": "4984303229931942319", "parameters": { "workspaceName": { "type": "String", - "value": "e2etest_test_119502617351" + "value": "e2etest_test_855339767631" }, "description": { "type": "String", - "value": "e2etest_test_119502617351 description" + "value": "e2etest_test_855339767631 description" }, "friendlyName": { "type": "String", - "value": "e2etest_test_119502617351 display name" + "value": "e2etest_test_855339767631 display name" }, "location": { "type": "String", @@ -909,7 +924,7 @@ }, "storageAccountName": { "type": "String", - "value": "e2etesttstoragea482cf16d" + "value": "e2etesttstorage7a156a630" }, "storageAccountType": { "type": "String", @@ -933,7 +948,7 @@ }, "keyVaultName": { "type": "String", - "value": "e2etesttkeyvault8b9fd471" + "value": "e2etesttkeyvault3e2a4ce5" }, "keyVaultBehindVNet": { "type": "String", @@ -953,7 +968,7 @@ }, "applicationInsightsName": { "type": "String", - "value": "e2etesttinsights03491969" + "value": "e2etesttinsights667c475d" }, "applicationInsightsResourceGroupName": { "type": "String", @@ -1044,7 +1059,7 @@ "tagValues": { "type": "Object", "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "privateEndpointName": { @@ -1092,13 +1107,19 @@ "primaryUserAssignedIdentity": { "type": "String", "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "Disabled" + } } }, "mode": "Incremental", "provisioningState": "Accepted", - "timestamp": "2023-01-31T06:30:19.6168436Z", - "duration": "PT0.0001084S", - "correlationId": "7e685d67-67f6-4f1f-b200-1e7e5674fa56", + "timestamp": "2023-02-14T01:54:06.7891516Z", + "duration": "PT0.0004062S", + "correlationId": "a608ee4c-ba33-4d72-8887-27beaaee8b51", "providers": [ { "namespace": "Microsoft.Storage", @@ -1166,9 +1187,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "resourceName": "e2etesttstorage7a156a630" }, { "dependsOn": [ @@ -1178,9 +1199,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" }, { "dependsOn": [ @@ -1197,19 +1218,19 @@ { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "resourceName": "e2etesttstorage7a156a630" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "resourceName": "e2etesttinsights667c475d" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", @@ -1217,16 +1238,16 @@ "resourceName": "name" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" }, { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", @@ -1243,13 +1264,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1258,234 +1279,96 @@ "Content-Encoding": "gzip", "Content-Length": "21", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:19 GMT", + "Date": "Tue, 14 Feb 2023 01:54:06 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1123f1a9-7130-4b34-b043-9bcbef7903d3", + "x-ms-correlation-request-id": "78848e5e-0996-4667-91b1-7ecf83f5315b", "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "WESTUS2:20230131T063020Z:1123f1a9-7130-4b34-b043-9bcbef7903d3" + "x-ms-routing-request-id": "WESTUS:20230214T015407Z:78848e5e-0996-4667-91b1-7ecf83f5315b" }, "ResponseBody": { "status": "Accepted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "12", + "Content-Length": "2068", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:24 GMT", + "Date": "Tue, 14 Feb 2023 01:54:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e7b89d3e-856d-4c4b-84db-964eabc1f374", + "x-ms-correlation-request-id": "45a1f715-30fc-406c-bf16-a1b5a64d4a67", "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "WESTUS2:20230131T063025Z:e7b89d3e-856d-4c4b-84db-964eabc1f374" - }, - "ResponseBody": { - "value": [] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:24 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "2e3d5550-64cf-4986-935e-6f2a072d889f", - "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "WESTUS2:20230131T063025Z:2e3d5550-64cf-4986-935e-6f2a072d889f" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "707", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:29 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1c689c87-13a1-47b9-90da-b69b97e49e35", - "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "WESTUS2:20230131T063030Z:1c689c87-13a1-47b9-90da-b69b97e49e35" + "x-ms-routing-request-id": "WESTUS:20230214T015412Z:45a1f715-30fc-406c-bf16-a1b5a64d4a67" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:28.856351Z", - "duration": "PT7.6043647S", - "trackingId": "bbf09bc7-7b82-4de6-bc2b-6b3837d57881", + "timestamp": "2023-02-14T01:54:11.3870275Z", + "duration": "PT3.8526543S", + "trackingId": "5044d3e3-e58a-4565-8968-1145d08e28e0", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:30 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1cfc00f9-798d-4305-be8f-5409984d2ef6", - "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "WESTUS2:20230131T063030Z:1cfc00f9-798d-4305-be8f-5409984d2ef6" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2067", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:35 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9846658e-eb66-4d69-aaf9-4aeecf776bfa", - "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-routing-request-id": "WESTUS2:20230131T063036Z:9846658e-eb66-4d69-aaf9-4aeecf776bfa" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:30.8719756Z", - "duration": "PT9.7399974S", - "trackingId": "37a26c98-9a53-4233-b872-0ff0fa430a41", + "timestamp": "2023-02-14T01:54:10.3962738Z", + "duration": "PT2.8067622S", + "trackingId": "39c45a86-78a2-4599-add2-f3b991ca07eb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:28.856351Z", - "duration": "PT7.6043647S", - "trackingId": "bbf09bc7-7b82-4de6-bc2b-6b3837d57881", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -1493,13 +1376,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1508,96 +1391,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:35 GMT", + "Date": "Tue, 14 Feb 2023 01:54:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d6097f0c-df31-4662-b1e8-d3fd3331afd0", - "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "WESTUS2:20230131T063036Z:d6097f0c-df31-4662-b1e8-d3fd3331afd0" + "x-ms-correlation-request-id": "dc448b81-9dec-4942-b82d-a98d605f423c", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-routing-request-id": "WESTUS:20230214T015412Z:dc448b81-9dec-4942-b82d-a98d605f423c" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2067", + "Content-Length": "2068", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:41 GMT", + "Date": "Tue, 14 Feb 2023 01:54:17 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "42c645ac-ad63-4b7c-99ce-29ed5f0bb721", - "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "WESTUS2:20230131T063041Z:42c645ac-ad63-4b7c-99ce-29ed5f0bb721" + "x-ms-correlation-request-id": "4a9f6866-e4e8-4818-8f90-225fca0dbfa4", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-routing-request-id": "WESTUS:20230214T015417Z:4a9f6866-e4e8-4818-8f90-225fca0dbfa4" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:54:11.3870275Z", + "duration": "PT3.8526543S", + "trackingId": "5044d3e3-e58a-4565-8968-1145d08e28e0", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:30.8719756Z", - "duration": "PT9.7399974S", - "trackingId": "37a26c98-9a53-4233-b872-0ff0fa430a41", + "timestamp": "2023-02-14T01:54:10.3962738Z", + "duration": "PT2.8067622S", + "trackingId": "39c45a86-78a2-4599-add2-f3b991ca07eb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:28.856351Z", - "duration": "PT7.6043647S", - "trackingId": "bbf09bc7-7b82-4de6-bc2b-6b3837d57881", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -1605,13 +1488,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1620,28 +1503,28 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:40 GMT", + "Date": "Tue, 14 Feb 2023 01:54:17 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "893521ce-7f66-4de8-aea3-fa9f21f9314c", - "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-routing-request-id": "WESTUS2:20230131T063041Z:893521ce-7f66-4de8-aea3-fa9f21f9314c" + "x-ms-correlation-request-id": "0f9e19f0-a79e-423f-bafa-697c04b453af", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-routing-request-id": "WESTUS:20230214T015418Z:0f9e19f0-a79e-423f-bafa-697c04b453af" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1650,96 +1533,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:46 GMT", + "Date": "Tue, 14 Feb 2023 01:54:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0ed77560-619f-4188-90ab-972cf229383c", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "WESTUS2:20230131T063046Z:0ed77560-619f-4188-90ab-972cf229383c" + "x-ms-correlation-request-id": "598fc801-9809-484a-a88f-cc9aa80201de", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "WESTUS:20230214T015423Z:598fc801-9809-484a-a88f-cc9aa80201de" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2067", + "Content-Length": "2068", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:46 GMT", + "Date": "Tue, 14 Feb 2023 01:54:22 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c7910762-feb9-4698-addb-d91a070f60c3", - "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-routing-request-id": "WESTUS2:20230131T063046Z:c7910762-feb9-4698-addb-d91a070f60c3" + "x-ms-correlation-request-id": "7ed2f75e-eddc-40f7-a1f4-37cfd000ee6d", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-routing-request-id": "WESTUS:20230214T015423Z:7ed2f75e-eddc-40f7-a1f4-37cfd000ee6d" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:54:11.3870275Z", + "duration": "PT3.8526543S", + "trackingId": "5044d3e3-e58a-4565-8968-1145d08e28e0", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:30.8719756Z", - "duration": "PT9.7399974S", - "trackingId": "37a26c98-9a53-4233-b872-0ff0fa430a41", + "timestamp": "2023-02-14T01:54:10.3962738Z", + "duration": "PT2.8067622S", + "trackingId": "39c45a86-78a2-4599-add2-f3b991ca07eb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:28.856351Z", - "duration": "PT7.6043647S", - "trackingId": "bbf09bc7-7b82-4de6-bc2b-6b3837d57881", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -1747,13 +1630,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1762,96 +1645,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:51 GMT", + "Date": "Tue, 14 Feb 2023 01:54:27 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "99ca6e88-3619-4ccb-96b4-5614cf1a6a37", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-routing-request-id": "WESTUS2:20230131T063051Z:99ca6e88-3619-4ccb-96b4-5614cf1a6a37" + "x-ms-correlation-request-id": "5114a738-e012-4c23-8043-d855e4db4373", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-routing-request-id": "WESTUS:20230214T015428Z:5114a738-e012-4c23-8043-d855e4db4373" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2070", + "Content-Length": "2071", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:52 GMT", + "Date": "Tue, 14 Feb 2023 01:54:28 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3533e57d-1333-4a79-a1c3-663a4674e589", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-routing-request-id": "WESTUS2:20230131T063052Z:3533e57d-1333-4a79-a1c3-663a4674e589" + "x-ms-correlation-request-id": "edc1cc72-b351-4f76-8475-aa3452084aa5", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "WESTUS:20230214T015428Z:edc1cc72-b351-4f76-8475-aa3452084aa5" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", - "statusCode": "OK", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:54:11.3870275Z", + "duration": "PT3.8526543S", + "trackingId": "5044d3e3-e58a-4565-8968-1145d08e28e0", + "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", + "timestamp": "2023-02-14T01:54:25.8272355Z", + "duration": "PT18.2377239S", + "trackingId": "8c24461e-e86c-4a82-bebd-7a4f05d1e0fb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:28.856351Z", - "duration": "PT7.6043647S", - "trackingId": "bbf09bc7-7b82-4de6-bc2b-6b3837d57881", - "statusCode": "Accepted", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", + "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -1859,13 +1742,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1874,96 +1757,96 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:56 GMT", + "Date": "Tue, 14 Feb 2023 01:54:33 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9f6a31c0-6ab9-4ddd-a0cb-dab8017bfef0", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-routing-request-id": "WESTUS2:20230131T063057Z:9f6a31c0-6ab9-4ddd-a0cb-dab8017bfef0" + "x-ms-correlation-request-id": "7b43bae3-d10b-4c8a-b892-1b08fcad64ea", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "WESTUS:20230214T015433Z:7b43bae3-d10b-4c8a-b892-1b08fcad64ea" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2068", + "Content-Length": "2064", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:30:57 GMT", + "Date": "Tue, 14 Feb 2023 01:54:33 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "11edb1a2-7773-4ea2-9625-217d24a36e2d", - "x-ms-ratelimit-remaining-subscription-reads": "11985", - "x-ms-routing-request-id": "WESTUS2:20230131T063057Z:11edb1a2-7773-4ea2-9625-217d24a36e2d" + "x-ms-correlation-request-id": "4c82a5aa-9253-4100-8bad-8b659824a2dc", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "WESTUS:20230214T015433Z:4c82a5aa-9253-4100-8bad-8b659824a2dc" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", + "provisioningState": "Running", + "timestamp": "2023-02-14T01:54:32.77787Z", + "duration": "PT25.2434968S", + "trackingId": "6e7c7e3b-f647-437f-89f3-16efde7920d1", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", + "timestamp": "2023-02-14T01:54:25.8272355Z", + "duration": "PT18.2377239S", + "trackingId": "8c24461e-e86c-4a82-bebd-7a4f05d1e0fb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -1971,128 +1854,129 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", + "Connection": "close", "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:02 GMT", + "Date": "Tue, 14 Feb 2023 01:54:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "73f78ac6-c72a-4b03-8db4-2f90c106db45", - "x-ms-ratelimit-remaining-subscription-reads": "11984", - "x-ms-routing-request-id": "WESTUS2:20230131T063102Z:73f78ac6-c72a-4b03-8db4-2f90c106db45" + "x-ms-correlation-request-id": "a7da99cc-dbbf-4e4f-8829-fa050bf8ddf5", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "WESTUS:20230214T015438Z:a7da99cc-dbbf-4e4f-8829-fa050bf8ddf5" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2789", + "Content-Length": "2788", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:02 GMT", + "Date": "Tue, 14 Feb 2023 01:54:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "968699c1-b9cc-43e0-836b-7a1204f6bfc9", - "x-ms-ratelimit-remaining-subscription-reads": "11983", - "x-ms-routing-request-id": "WESTUS2:20230131T063103Z:968699c1-b9cc-43e0-836b-7a1204f6bfc9" + "x-ms-correlation-request-id": "e867793c-6c2b-42d8-ac75-0b138d01e723", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-routing-request-id": "WESTUS:20230214T015439Z:e867793c-6c2b-42d8-ac75-0b138d01e723" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/0675CD3B986E0182", + "operationId": "0675CD3B986E0182", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:58.3405004Z", - "duration": "PT3.6844685S", - "trackingId": "ee738423-d7cd-43cd-8fc7-10be76b2837f", + "timestamp": "2023-02-14T01:54:37.2838106Z", + "duration": "PT2.292524S", + "trackingId": "6448bbd6-3592-4b78-aa23-a9798e1ef40d", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", + "timestamp": "2023-02-14T01:54:34.9407916Z", + "duration": "PT27.4064184S", + "trackingId": "7a6ef0ea-d9f9-4a8b-8521-668d59566d38", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", + "timestamp": "2023-02-14T01:54:25.8272355Z", + "duration": "PT18.2377239S", + "trackingId": "8c24461e-e86c-4a82-bebd-7a4f05d1e0fb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -2100,13 +1984,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2115,113 +1999,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:07 GMT", + "Date": "Tue, 14 Feb 2023 01:54:43 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "dbeebeae-3908-4441-9dc2-fab23f9af3ad", - "x-ms-ratelimit-remaining-subscription-reads": "11982", - "x-ms-routing-request-id": "WESTUS2:20230131T063107Z:dbeebeae-3908-4441-9dc2-fab23f9af3ad" + "x-ms-correlation-request-id": "f7859c6f-ba87-41e2-9997-ee7a5fbd5e46", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-routing-request-id": "WESTUS:20230214T015444Z:f7859c6f-ba87-41e2-9997-ee7a5fbd5e46" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2789", + "Content-Length": "2788", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:08 GMT", + "Date": "Tue, 14 Feb 2023 01:54:44 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5a656cb4-ac54-4ec5-9c07-0e6e6b3ab2f2", - "x-ms-ratelimit-remaining-subscription-reads": "11981", - "x-ms-routing-request-id": "WESTUS2:20230131T063108Z:5a656cb4-ac54-4ec5-9c07-0e6e6b3ab2f2" + "x-ms-correlation-request-id": "3e4fd85a-5ba5-48e6-966b-43e80b48d06c", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-routing-request-id": "WESTUS:20230214T015444Z:3e4fd85a-5ba5-48e6-966b-43e80b48d06c" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/0675CD3B986E0182", + "operationId": "0675CD3B986E0182", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:58.3405004Z", - "duration": "PT3.6844685S", - "trackingId": "ee738423-d7cd-43cd-8fc7-10be76b2837f", + "timestamp": "2023-02-14T01:54:37.2838106Z", + "duration": "PT2.292524S", + "trackingId": "6448bbd6-3592-4b78-aa23-a9798e1ef40d", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", + "timestamp": "2023-02-14T01:54:34.9407916Z", + "duration": "PT27.4064184S", + "trackingId": "7a6ef0ea-d9f9-4a8b-8521-668d59566d38", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", + "timestamp": "2023-02-14T01:54:25.8272355Z", + "duration": "PT18.2377239S", + "trackingId": "8c24461e-e86c-4a82-bebd-7a4f05d1e0fb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -2229,13 +2113,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2244,113 +2128,113 @@ "Content-Encoding": "gzip", "Content-Length": "20", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:12 GMT", + "Date": "Tue, 14 Feb 2023 01:54:48 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7429cf8f-e4e8-41f5-a431-51a73569833c", - "x-ms-ratelimit-remaining-subscription-reads": "11980", - "x-ms-routing-request-id": "WESTUS2:20230131T063112Z:7429cf8f-e4e8-41f5-a431-51a73569833c" + "x-ms-correlation-request-id": "bc673cf6-1238-4f09-82ae-48b60cb001ae", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-routing-request-id": "WESTUS:20230214T015449Z:bc673cf6-1238-4f09-82ae-48b60cb001ae" }, "ResponseBody": { "status": "Running" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2789", + "Content-Length": "2788", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:13 GMT", + "Date": "Tue, 14 Feb 2023 01:54:49 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ed92b812-3846-438e-b7b5-05d3c089ca39", - "x-ms-ratelimit-remaining-subscription-reads": "11979", - "x-ms-routing-request-id": "WESTUS2:20230131T063113Z:ed92b812-3846-438e-b7b5-05d3c089ca39" + "x-ms-correlation-request-id": "5b6eb1a8-8371-4432-8c50-f81481d74d77", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "WESTUS:20230214T015450Z:5b6eb1a8-8371-4432-8c50-f81481d74d77" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/0675CD3B986E0182", + "operationId": "0675CD3B986E0182", "properties": { "provisioningOperation": "Create", "provisioningState": "Running", - "timestamp": "2023-01-31T06:30:58.3405004Z", - "duration": "PT3.6844685S", - "trackingId": "ee738423-d7cd-43cd-8fc7-10be76b2837f", + "timestamp": "2023-02-14T01:54:37.2838106Z", + "duration": "PT2.292524S", + "trackingId": "6448bbd6-3592-4b78-aa23-a9798e1ef40d", "statusCode": "Accepted", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", + "timestamp": "2023-02-14T01:54:34.9407916Z", + "duration": "PT27.4064184S", + "trackingId": "7a6ef0ea-d9f9-4a8b-8521-668d59566d38", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", + "timestamp": "2023-02-14T01:54:25.8272355Z", + "duration": "PT18.2377239S", + "trackingId": "8c24461e-e86c-4a82-bebd-7a4f05d1e0fb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } } @@ -2358,466 +2242,79 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operationStatuses/08585252672409479412?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "20", + "Content-Length": "22", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:17 GMT", + "Date": "Tue, 14 Feb 2023 01:54:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1a650964-6dcd-47ee-b5f5-c9a691b34ca4", - "x-ms-ratelimit-remaining-subscription-reads": "11978", - "x-ms-routing-request-id": "WESTUS2:20230131T063118Z:1a650964-6dcd-47ee-b5f5-c9a691b34ca4" + "x-ms-correlation-request-id": "f601785d-6083-41c6-a059-2e1ec9ed483c", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "WESTUS:20230214T015454Z:f601785d-6083-41c6-a059-2e1ec9ed483c" }, "ResponseBody": { - "status": "Running" + "status": "Succeeded" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json", + "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "2789", + "Content-Length": "8561", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:18 GMT", + "Date": "Tue, 14 Feb 2023 01:54:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "25ba0e87-7d1d-4905-afd4-e37f783a74c8", - "x-ms-ratelimit-remaining-subscription-reads": "11977", - "x-ms-routing-request-id": "WESTUS2:20230131T063119Z:25ba0e87-7d1d-4905-afd4-e37f783a74c8" + "x-ms-correlation-request-id": "09f1632f-e068-4ceb-97b6-2241f6925f0a", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "WESTUS:20230214T015454Z:09f1632f-e068-4ceb-97b6-2241f6925f0a" }, "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:31:13.9549709Z", - "duration": "PT19.298939S", - "trackingId": "05ca470a-49cc-48c3-8dd2-2b7d6f7d7f0f", - "statusCode": "Accepted", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:22 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5819d87c-ff53-4f90-962f-3685a32305f4", - "x-ms-ratelimit-remaining-subscription-reads": "11976", - "x-ms-routing-request-id": "WESTUS2:20230131T063123Z:5819d87c-ff53-4f90-962f-3685a32305f4" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2789", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:24 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d15b8b69-bd57-4f45-9b3e-0e8ef24db658", - "x-ms-ratelimit-remaining-subscription-reads": "11975", - "x-ms-routing-request-id": "WESTUS2:20230131T063124Z:d15b8b69-bd57-4f45-9b3e-0e8ef24db658" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:31:13.9549709Z", - "duration": "PT19.298939S", - "trackingId": "05ca470a-49cc-48c3-8dd2-2b7d6f7d7f0f", - "statusCode": "Accepted", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "20", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:28 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fdf20b6b-09a3-4f60-bf12-ae966dd8acd9", - "x-ms-ratelimit-remaining-subscription-reads": "11974", - "x-ms-routing-request-id": "WESTUS2:20230131T063128Z:fdf20b6b-09a3-4f60-bf12-ae966dd8acd9" - }, - "ResponseBody": { - "status": "Running" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "2789", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:29 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "90188fcb-436c-409b-b6a3-ff575a2ef605", - "x-ms-ratelimit-remaining-subscription-reads": "11973", - "x-ms-routing-request-id": "WESTUS2:20230131T063130Z:90188fcb-436c-409b-b6a3-ff575a2ef605" - }, - "ResponseBody": { - "value": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Running", - "timestamp": "2023-01-31T06:31:13.9549709Z", - "duration": "PT19.298939S", - "trackingId": "05ca470a-49cc-48c3-8dd2-2b7d6f7d7f0f", - "statusCode": "Accepted", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", - "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" - } - } - }, - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", - "properties": { - "provisioningOperation": "Create", - "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", - "statusCode": "OK", - "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" - } - } - } - ] - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operationStatuses/08585264602684627679?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "22", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:33 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d0487a74-cf08-45d3-865a-35682a164348", - "x-ms-ratelimit-remaining-subscription-reads": "11972", - "x-ms-routing-request-id": "WESTUS2:20230131T063133Z:d0487a74-cf08-45d3-865a-35682a164348" - }, - "ResponseBody": { - "status": "Succeeded" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430?api-version=2020-06-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Length": "8492", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:33 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5e01860d-e2d0-46c5-85d0-1f497e77d947", - "x-ms-ratelimit-remaining-subscription-reads": "11971", - "x-ms-routing-request-id": "WESTUS2:20230131T063133Z:5e01860d-e2d0-46c5-85d0-1f497e77d947" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430", - "name": "e2etest_test_119502617351-2374430", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285", + "name": "e2etest_test_855339767631-9567285", "type": "Microsoft.Resources/deployments", "properties": { - "templateHash": "12037445159745527008", + "templateHash": "4984303229931942319", "parameters": { "workspaceName": { "type": "String", - "value": "e2etest_test_119502617351" + "value": "e2etest_test_855339767631" }, "description": { "type": "String", - "value": "e2etest_test_119502617351 description" + "value": "e2etest_test_855339767631 description" }, "friendlyName": { "type": "String", - "value": "e2etest_test_119502617351 display name" + "value": "e2etest_test_855339767631 display name" }, "location": { "type": "String", @@ -2833,7 +2330,7 @@ }, "storageAccountName": { "type": "String", - "value": "e2etesttstoragea482cf16d" + "value": "e2etesttstorage7a156a630" }, "storageAccountType": { "type": "String", @@ -2857,7 +2354,7 @@ }, "keyVaultName": { "type": "String", - "value": "e2etesttkeyvault8b9fd471" + "value": "e2etesttkeyvault3e2a4ce5" }, "keyVaultBehindVNet": { "type": "String", @@ -2877,7 +2374,7 @@ }, "applicationInsightsName": { "type": "String", - "value": "e2etesttinsights03491969" + "value": "e2etesttinsights667c475d" }, "applicationInsightsResourceGroupName": { "type": "String", @@ -2968,7 +2465,7 @@ "tagValues": { "type": "Object", "value": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" } }, "privateEndpointName": { @@ -3016,13 +2513,19 @@ "primaryUserAssignedIdentity": { "type": "String", "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "Disabled" + } } }, "mode": "Incremental", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:31:32.1432904Z", - "duration": "PT1M12.5265552S", - "correlationId": "7e685d67-67f6-4f1f-b200-1e7e5674fa56", + "timestamp": "2023-02-14T01:54:53.0861668Z", + "duration": "PT46.2974214S", + "correlationId": "a608ee4c-ba33-4d72-8887-27beaaee8b51", "providers": [ { "namespace": "Microsoft.Storage", @@ -3090,9 +2593,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "resourceName": "e2etesttstorage7a156a630" }, { "dependsOn": [ @@ -3102,9 +2605,9 @@ "resourceName": "name/default" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" }, { "dependsOn": [ @@ -3121,19 +2624,19 @@ { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "resourceName": "e2etesttstorage7a156a630" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "resourceName": "e2etesttinsights667c475d" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", @@ -3141,16 +2644,16 @@ "resourceName": "name" } ], - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" }, { "dependsOn": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", @@ -3165,29 +2668,29 @@ ], "outputResources": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631" }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630" } ] } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3196,95 +2699,95 @@ "Content-Encoding": "gzip", "Content-Length": "3248", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:34 GMT", + "Date": "Tue, 14 Feb 2023 01:54:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "2c948559-b7b3-4a6f-b610-79518f55d69b", - "x-ms-ratelimit-remaining-subscription-reads": "11970", - "x-ms-routing-request-id": "WESTUS2:20230131T063135Z:2c948559-b7b3-4a6f-b610-79518f55d69b" + "x-ms-correlation-request-id": "aca3c072-15ab-48e0-966d-3314133762b3", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "WESTUS:20230214T015455Z:aca3c072-15ab-48e0-966d-3314133762b3" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/0675CD3B986E0182", + "operationId": "0675CD3B986E0182", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:31:31.9201362Z", - "duration": "PT37.2641043S", - "trackingId": "365fca85-be5b-4bd5-b3ff-fc9d941030d6", + "timestamp": "2023-02-14T01:54:52.8186527Z", + "duration": "PT17.8273661S", + "trackingId": "7ac03354-b073-4ed0-9a69-6b1f1fba0b18", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", + "timestamp": "2023-02-14T01:54:34.9407916Z", + "duration": "PT27.4064184S", + "trackingId": "7a6ef0ea-d9f9-4a8b-8521-668d59566d38", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", + "timestamp": "2023-02-14T01:54:25.8272355Z", + "duration": "PT18.2377239S", + "trackingId": "8c24461e-e86c-4a82-bebd-7a4f05d1e0fb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/08585264602684627679", - "operationId": "08585264602684627679", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/08585252672409479412", + "operationId": "08585252672409479412", "properties": { "provisioningOperation": "EvaluateDeploymentOutput", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:31:32.1181075Z", - "duration": "PT37.4620756S", - "trackingId": "76eaf9bc-2a05-4d0d-97bc-7f5cbcb50400", + "timestamp": "2023-02-14T01:54:53.0559193Z", + "duration": "PT18.0646327S", + "trackingId": "5adc8c49-e54a-4a7a-91ab-2287dc96df01", "statusCode": "OK" } } @@ -3292,13 +2795,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_119502617351-2374430/operations?api-version=2020-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_855339767631-9567285/operations?api-version=2020-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3307,95 +2810,95 @@ "Content-Encoding": "gzip", "Content-Length": "3248", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:35 GMT", + "Date": "Tue, 14 Feb 2023 01:54:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8c3ae247-0f30-418c-a0ce-992c836f4ef9", - "x-ms-ratelimit-remaining-subscription-reads": "11969", - "x-ms-routing-request-id": "WESTUS2:20230131T063135Z:8c3ae247-0f30-418c-a0ce-992c836f4ef9" + "x-ms-correlation-request-id": "a7160039-f986-41c1-ab1a-299e69a16dee", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "WESTUS:20230214T015455Z:a7160039-f986-41c1-ab1a-299e69a16dee" }, "ResponseBody": { "value": [ { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/2F3AF7E4BEAD2619", - "operationId": "2F3AF7E4BEAD2619", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/0675CD3B986E0182", + "operationId": "0675CD3B986E0182", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:31:31.9201362Z", - "duration": "PT37.2641043S", - "trackingId": "365fca85-be5b-4bd5-b3ff-fc9d941030d6", + "timestamp": "2023-02-14T01:54:52.8186527Z", + "duration": "PT17.8273661S", + "trackingId": "7ac03354-b073-4ed0-9a69-6b1f1fba0b18", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "resourceType": "Microsoft.MachineLearningServices/workspaces", - "resourceName": "e2etest_test_119502617351" + "resourceName": "e2etest_test_855339767631" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/7AF08B3CD704B1AD", - "operationId": "7AF08B3CD704B1AD", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/96554985478B4A5A", + "operationId": "96554985478B4A5A", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:30.9641411Z", - "duration": "PT9.8321629S", - "trackingId": "8592ff50-1e51-432c-afa6-53b0b72776ff", + "timestamp": "2023-02-14T01:54:34.9407916Z", + "duration": "PT27.4064184S", + "trackingId": "7a6ef0ea-d9f9-4a8b-8521-668d59566d38", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights03491969", - "resourceType": "Microsoft.Insights/components", - "resourceName": "e2etesttinsights03491969" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage7a156a630" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/368A367ABFA594F4", - "operationId": "368A367ABFA594F4", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/DD9851FDA74E04ED", + "operationId": "DD9851FDA74E04ED", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.3233867Z", - "duration": "PT29.1914085S", - "trackingId": "9747de86-5155-475a-b8ee-cc3050f4f777", + "timestamp": "2023-02-14T01:54:25.8272355Z", + "duration": "PT18.2377239S", + "trackingId": "8c24461e-e86c-4a82-bebd-7a4f05d1e0fb", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault8b9fd471", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault3e2a4ce5", "resourceType": "Microsoft.KeyVault/vaults", - "resourceName": "e2etesttkeyvault8b9fd471" + "resourceName": "e2etesttkeyvault3e2a4ce5" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/529893B4D24D0D9C", - "operationId": "529893B4D24D0D9C", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/F8926336FCAAB339", + "operationId": "F8926336FCAAB339", "properties": { "provisioningOperation": "Create", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:30:50.4616854Z", - "duration": "PT29.2096991S", - "trackingId": "fe03129e-84c7-4d01-9837-dd0c74a2ce2d", + "timestamp": "2023-02-14T01:54:10.0800453Z", + "duration": "PT2.5456721S", + "trackingId": "e44f68cc-50ae-45ba-a6e8-8611c4287a4e", "statusCode": "OK", "targetResource": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "resourceType": "Microsoft.Storage/storageAccounts", - "resourceName": "e2etesttstoragea482cf16d" + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsights667c475d", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsights667c475d" } } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_119502617351-2374430/operations/08585264602684627679", - "operationId": "08585264602684627679", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_855339767631-9567285/operations/08585252672409479412", + "operationId": "08585252672409479412", "properties": { "provisioningOperation": "EvaluateDeploymentOutput", "provisioningState": "Succeeded", - "timestamp": "2023-01-31T06:31:32.1181075Z", - "duration": "PT37.4620756S", - "trackingId": "76eaf9bc-2a05-4d0d-97bc-7f5cbcb50400", + "timestamp": "2023-02-14T01:54:53.0559193Z", + "duration": "PT18.0646327S", + "trackingId": "5adc8c49-e54a-4a7a-91ab-2287dc96df01", "statusCode": "OK" } } @@ -3403,408 +2906,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:35 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-b1ac317f396b8eac773b8d3bf9197a7b-a35a7d45b4154630-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": [ - "Accept-Encoding", - "Accept-Encoding" - ], - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6ddb1230-b5fe-44c3-8307-1f0106d3afa3", - "x-ms-ratelimit-remaining-subscription-reads": "11968", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063136Z:6ddb1230-b5fe-44c3-8307-1f0106d3afa3", - "x-request-time": "0.022" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", - "type": "Microsoft.MachineLearningServices/workspaces", - "location": "eastus2euap", - "tags": { - "createdByToolkit": "sdk-v2-1.4.0" - }, - "etag": null, - "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", - "hbiWorkspace": false, - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "imageBuildCompute": null, - "provisioningState": "Succeeded", - "v1LegacyMode": false, - "softDeleteEnabled": false, - "containerRegistry": "", - "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", - "isPrivateLinkEnabled": false, - "notebookPreparationError": null - }, - "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", - "linkedModelInventoryArmId": null, - "privateLinkCount": 0, - "publicNetworkAccess": "Enabled", - "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", - "sasGetterUri": "", - "enableDataIsolation": false - }, - "identity": { - "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" - }, - "kind": "Default", - "sku": { - "name": "Basic", - "tier": "Basic" - }, - "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", - "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:30:56.9622888Z", - "lastModifiedBy": "mingweihe@microsoft.com", - "lastModifiedByType": "User" - } - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:36 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-7c5717274f7b8f347761d9fa489f7310-7769e9c3c2cd3b5c-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": [ - "Accept-Encoding", - "Accept-Encoding" - ], - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "62aa5aca-ce1c-4406-9544-6e0e589d8ce3", - "x-ms-ratelimit-remaining-subscription-reads": "11967", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063136Z:62aa5aca-ce1c-4406-9544-6e0e589d8ce3", - "x-request-time": "0.086" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", - "type": "Microsoft.MachineLearningServices/workspaces", - "location": "eastus2euap", - "tags": { - "createdByToolkit": "sdk-v2-1.4.0" - }, - "etag": null, - "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", - "hbiWorkspace": false, - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "imageBuildCompute": null, - "provisioningState": "Succeeded", - "v1LegacyMode": false, - "softDeleteEnabled": false, - "containerRegistry": "", - "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", - "isPrivateLinkEnabled": false, - "notebookPreparationError": null - }, - "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", - "linkedModelInventoryArmId": null, - "privateLinkCount": 0, - "publicNetworkAccess": "Enabled", - "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", - "sasGetterUri": "", - "enableDataIsolation": false - }, - "identity": { - "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" - }, - "kind": "Default", - "sku": { - "name": "Basic", - "tier": "Basic" - }, - "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", - "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:30:56.9622888Z", - "lastModifiedBy": "mingweihe@microsoft.com", - "lastModifiedByType": "User" - } - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:36 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-a2f5050b17c1d7e05281a4047c175f32-5cd1962819d99640-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": [ - "Accept-Encoding", - "Accept-Encoding" - ], - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a176550d-e0ea-4f04-b311-e43260cc571c", - "x-ms-ratelimit-remaining-subscription-reads": "11966", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063136Z:a176550d-e0ea-4f04-b311-e43260cc571c", - "x-request-time": "0.023" - }, - "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", - "type": "Microsoft.MachineLearningServices/workspaces", - "location": "eastus2euap", - "tags": { - "createdByToolkit": "sdk-v2-1.4.0" - }, - "etag": null, - "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", - "hbiWorkspace": false, - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "imageBuildCompute": null, - "provisioningState": "Succeeded", - "v1LegacyMode": false, - "softDeleteEnabled": false, - "containerRegistry": "", - "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", - "isPrivateLinkEnabled": false, - "notebookPreparationError": null - }, - "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", - "linkedModelInventoryArmId": null, - "privateLinkCount": 0, - "publicNetworkAccess": "Enabled", - "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", - "sasGetterUri": "", - "enableDataIsolation": false - }, - "identity": { - "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" - }, - "kind": "Default", - "sku": { - "name": "Basic", - "tier": "Basic" - }, - "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", - "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:30:56.9622888Z", - "lastModifiedBy": "mingweihe@microsoft.com", - "lastModifiedByType": "User" - } - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", - "RequestMethod": "PATCH", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "Content-Length": "377", - "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": { - "tags": { - "createdByToolkit": "sdk-v2-1.4.0" - }, - "identity": { - "type": "SystemAssigned" - }, - "properties": { - "description": "e2etest_test_119502617351 description", - "friendlyName": "e2etest_test_119502617351 display name", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969" - } - }, - "StatusCode": 202, - "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OnYIGewlHg_-uEHgMQMJntZhM-ux07_wba6Vte7rHKk?api-version=2022-10-01-preview\u0026type=async", - "Cache-Control": "no-cache", - "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:31:37 GMT", - "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OnYIGewlHg_-uEHgMQMJntZhM-ux07_wba6Vte7rHKk?api-version=2022-10-01-preview\u0026type=location", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "12c74feb-97d2-4fe2-8719-ffb373ae7acf", - "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063137Z:12c74feb-97d2-4fe2-8719-ffb373ae7acf", - "x-request-time": "0.138" - }, - "ResponseBody": null - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OnYIGewlHg_-uEHgMQMJntZhM-ux07_wba6Vte7rHKk?api-version=2022-10-01-preview\u0026type=async", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:31:37 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-14970fdc0e88cc49e850be18f4fe72a7-5564ddbd94999d30-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9157d8c7-8f54-48ef-85be-286f7f755a99", - "x-ms-ratelimit-remaining-subscription-reads": "11965", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063138Z:9157d8c7-8f54-48ef-85be-286f7f755a99", - "x-request-time": "0.020" - }, - "ResponseBody": { - "status": "InProgress" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OnYIGewlHg_-uEHgMQMJntZhM-ux07_wba6Vte7rHKk?api-version=2022-10-01-preview\u0026type=async", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:32:07 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-750de11dd4e4467bf8c4385971313aa1-020bfc81753c6d38-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fba954a4-2380-4b3a-9636-2c3c5b052874", - "x-ms-ratelimit-remaining-subscription-reads": "11964", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063208Z:fba954a4-2380-4b3a-9636-2c3c5b052874", - "x-request-time": "0.025" - }, - "ResponseBody": { - "status": "Succeeded", - "percentComplete": 100.0 - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", + "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3812,11 +2920,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:32:07 GMT", + "Date": "Tue, 14 Feb 2023 01:54:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-96538b6b124158da370d8ee768274ce6-9b5730c872df8c23-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-8c1c85c2513991539edaaab3b33b9bf4-e36663f47c5e24d6-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -3825,54 +2933,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "120bcb69-2e96-4295-8a50-db5a3b224c2e", - "x-ms-ratelimit-remaining-subscription-reads": "11963", + "x-ms-correlation-request-id": "cfa50258-973c-4b26-810d-040e800e168c", + "x-ms-ratelimit-remaining-subscription-reads": "11987", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063208Z:120bcb69-2e96-4295-8a50-db5a3b224c2e", - "x-request-time": "0.025" + "x-ms-routing-request-id": "WESTUS:20230214T015456Z:cfa50258-973c-4b26-810d-040e800e168c", + "x-request-time": "0.032" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -3881,23 +2994,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:31:37.6449868Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:54:35.7096464Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3905,11 +3018,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:32:08 GMT", + "Date": "Tue, 14 Feb 2023 01:54:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-29e8a40705e41ff1d4ff194e05d80908-f9024082627fd880-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-42010efb62a4bcb21a34bbb106616afe-ee1851158bf5e1a9-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -3918,54 +3031,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "599c67fe-6571-4c5a-9d6a-6d36baa69e48", - "x-ms-ratelimit-remaining-subscription-reads": "11962", + "x-ms-correlation-request-id": "be906ca9-8427-4a24-b1b6-a3e80f7819a6", + "x-ms-ratelimit-remaining-subscription-reads": "11986", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063208Z:599c67fe-6571-4c5a-9d6a-6d36baa69e48", - "x-request-time": "0.022" + "x-ms-routing-request-id": "WESTUS:20230214T015456Z:be906ca9-8427-4a24-b1b6-a3e80f7819a6", + "x-request-time": "0.041" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -3974,23 +3092,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:31:37.6449868Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:54:35.7096464Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3998,11 +3116,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:32:08 GMT", + "Date": "Tue, 14 Feb 2023 01:54:56 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-c048900a755a72480c46cdeed45b6c05-6b9abafb34012788-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-68d94da4ae9b67f5291d807f459f512c-8c5203ea0ff63e15-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4011,54 +3129,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "97272f3c-7f1c-4051-b90c-544401d03cf0", - "x-ms-ratelimit-remaining-subscription-reads": "11961", + "x-ms-correlation-request-id": "929e1136-3da5-4de8-b0b9-45d22553bb45", + "x-ms-ratelimit-remaining-subscription-reads": "11985", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063209Z:97272f3c-7f1c-4051-b90c-544401d03cf0", + "x-ms-routing-request-id": "WESTUS:20230214T015456Z:929e1136-3da5-4de8-b0b9-45d22553bb45", "x-request-time": "0.031" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4067,17 +3190,17 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:31:37.6449868Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:54:35.7096464Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -4085,85 +3208,50 @@ "Connection": "keep-alive", "Content-Length": "377", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "identity": { "type": "SystemAssigned" }, "properties": { - "description": "e2etest_test_119502617351 description", - "friendlyName": "e2etest_test_119502617351 display name", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969" + "description": "e2etest_test_855339767631 description", + "friendlyName": "e2etest_test_855339767631 display name", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d" } }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7sWeXqmeqs1Gq0Cj30ByxchTKgKPozDqvu0qTXC2rHg?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OURmP3synaHCTjwJezL8tp1QanmNV6XV4fR3qyyXhEM?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:32:09 GMT", + "Date": "Tue, 14 Feb 2023 01:54:57 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7sWeXqmeqs1Gq0Cj30ByxchTKgKPozDqvu0qTXC2rHg?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OURmP3synaHCTjwJezL8tp1QanmNV6XV4fR3qyyXhEM?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6608c79f-c78a-4a74-935d-179c85244acc", - "x-ms-ratelimit-remaining-subscription-writes": "1197", + "x-ms-correlation-request-id": "ce354cc8-4126-4398-9c58-a9943ab61113", + "x-ms-ratelimit-remaining-subscription-writes": "1199", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063210Z:6608c79f-c78a-4a74-935d-179c85244acc", - "x-request-time": "0.096" + "x-ms-routing-request-id": "WESTUS:20230214T015458Z:ce354cc8-4126-4398-9c58-a9943ab61113", + "x-request-time": "0.196" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7sWeXqmeqs1Gq0Cj30ByxchTKgKPozDqvu0qTXC2rHg?api-version=2022-10-01-preview\u0026type=async", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:32:09 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-23a30cd82fbeb0f623dd83c585d97db9-d9ccc02a9e565806-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "422aaf82-ae34-404b-afcd-17a0c5ea0df8", - "x-ms-ratelimit-remaining-subscription-reads": "11960", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063210Z:422aaf82-ae34-404b-afcd-17a0c5ea0df8", - "x-request-time": "0.026" - }, - "ResponseBody": { - "status": "InProgress" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7sWeXqmeqs1Gq0Cj30ByxchTKgKPozDqvu0qTXC2rHg?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OURmP3synaHCTjwJezL8tp1QanmNV6XV4fR3qyyXhEM?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4171,34 +3259,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:32:39 GMT", + "Date": "Tue, 14 Feb 2023 01:54:57 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-c304bd32b744932b076a5f098934f849-97ee2258d31fe980-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-db1765af5c5da5cc29fb3374bc6262ac-daaedb209df4bd5c-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b8bc750e-dc08-4902-aa37-a92ad8640192", - "x-ms-ratelimit-remaining-subscription-reads": "11959", + "x-ms-correlation-request-id": "d68ae83a-3fa6-45ac-b8b6-8c5286f2b743", + "x-ms-ratelimit-remaining-subscription-reads": "11984", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063240Z:b8bc750e-dc08-4902-aa37-a92ad8640192", - "x-request-time": "0.021" + "x-ms-routing-request-id": "WESTUS:20230214T015458Z:d68ae83a-3fa6-45ac-b8b6-8c5286f2b743", + "x-request-time": "0.022" }, "ResponseBody": { "status": "InProgress" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7sWeXqmeqs1Gq0Cj30ByxchTKgKPozDqvu0qTXC2rHg?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/OURmP3synaHCTjwJezL8tp1QanmNV6XV4fR3qyyXhEM?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4206,21 +3294,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:10 GMT", + "Date": "Tue, 14 Feb 2023 01:55:27 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-66cfc877bab4aaa5742b55f9c1fa8210-44797ef2cf6d624b-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-4fc2eb33df5663a75cdb47edc97eb8fc-26809c4eaca9c859-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7d47db71-8570-4ac1-a731-a8dc8b148b3e", - "x-ms-ratelimit-remaining-subscription-reads": "11958", + "x-ms-correlation-request-id": "37f6ce71-1a8c-4dad-8835-9781b29e866a", + "x-ms-ratelimit-remaining-subscription-reads": "11983", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063310Z:7d47db71-8570-4ac1-a731-a8dc8b148b3e", - "x-request-time": "0.054" + "x-ms-routing-request-id": "WESTUS:20230214T015528Z:37f6ce71-1a8c-4dad-8835-9781b29e866a", + "x-request-time": "0.024" }, "ResponseBody": { "status": "Succeeded", @@ -4228,13 +3316,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4242,11 +3330,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:10 GMT", + "Date": "Tue, 14 Feb 2023 01:55:28 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-624be872b5ec4184672720650787d9e2-8890c469f6c150f4-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-dc481b04a3e1fc513e8863c506930c8a-8955fab46c0bf711-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4255,54 +3343,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0a3b2d8b-c24a-4241-8181-36cc96859897", - "x-ms-ratelimit-remaining-subscription-reads": "11957", + "x-ms-correlation-request-id": "7dc2769f-a664-443e-83a9-ac5a04063af5", + "x-ms-ratelimit-remaining-subscription-reads": "11982", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063310Z:0a3b2d8b-c24a-4241-8181-36cc96859897", - "x-request-time": "0.021" + "x-ms-routing-request-id": "WESTUS:20230214T015528Z:7dc2769f-a664-443e-83a9-ac5a04063af5", + "x-request-time": "0.036" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4311,23 +3404,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:32:09.8216189Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:54:58.0057571Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4335,11 +3428,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:10 GMT", + "Date": "Tue, 14 Feb 2023 01:55:28 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-6692bb057c7a85f4bf00addb8cd67ddb-dd004354e3f71bfe-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-6663bac485be8ed7935719dcf6b73bdc-8388017d0e79bb79-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4348,54 +3441,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bb403531-8026-41f8-b221-f86d25d3037f", - "x-ms-ratelimit-remaining-subscription-reads": "11956", + "x-ms-correlation-request-id": "9414b7cf-0e9d-4232-8462-8b6e065572a2", + "x-ms-ratelimit-remaining-subscription-reads": "11981", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063310Z:bb403531-8026-41f8-b221-f86d25d3037f", - "x-request-time": "0.028" + "x-ms-routing-request-id": "WESTUS:20230214T015529Z:9414b7cf-0e9d-4232-8462-8b6e065572a2", + "x-request-time": "0.032" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4404,23 +3502,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:32:09.8216189Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:54:58.0057571Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4428,11 +3526,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:11 GMT", + "Date": "Tue, 14 Feb 2023 01:55:28 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-009df226badc1bcf58bc978dcd2b8234-bf9fd403c7c05a15-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-38488e89efdd1944dea86c68c6fd4e0f-15ef3211ffa1a54a-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4441,54 +3539,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "867aa83b-15a4-44ef-a54b-60f66a399319", - "x-ms-ratelimit-remaining-subscription-reads": "11955", + "x-ms-correlation-request-id": "5fe17a73-33ec-4911-9cdd-d4808312cc87", + "x-ms-ratelimit-remaining-subscription-reads": "11980", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063311Z:867aa83b-15a4-44ef-a54b-60f66a399319", - "x-request-time": "0.023" + "x-ms-routing-request-id": "WESTUS:20230214T015529Z:5fe17a73-33ec-4911-9cdd-d4808312cc87", + "x-request-time": "0.030" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4497,17 +3600,17 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:32:09.8216189Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:54:58.0057571Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -4515,50 +3618,50 @@ "Connection": "keep-alive", "Content-Length": "377", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "identity": { "type": "SystemAssigned" }, "properties": { - "description": "e2etest_test_119502617351 description", - "friendlyName": "e2etest_test_119502617351 display name", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969" + "description": "e2etest_test_855339767631 description", + "friendlyName": "e2etest_test_855339767631 display name", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d" } }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/ehZqtG2tqmCDX40Tyv-sOFmZiT1S-9jEBsiaJ5z6LFs?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/fnFL5StIRRDTvi3KvmUcVw2Pap6TJOS2lUKVCj3ftb0?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:33:12 GMT", + "Date": "Tue, 14 Feb 2023 01:55:29 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/ehZqtG2tqmCDX40Tyv-sOFmZiT1S-9jEBsiaJ5z6LFs?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/fnFL5StIRRDTvi3KvmUcVw2Pap6TJOS2lUKVCj3ftb0?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e90becd0-975a-4b2f-a950-65159810bec9", - "x-ms-ratelimit-remaining-subscription-writes": "1196", + "x-ms-correlation-request-id": "909283b5-d2b3-4b35-b5e3-a4384fb36dce", + "x-ms-ratelimit-remaining-subscription-writes": "1198", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063312Z:e90becd0-975a-4b2f-a950-65159810bec9", - "x-request-time": "0.191" + "x-ms-routing-request-id": "WESTUS:20230214T015530Z:909283b5-d2b3-4b35-b5e3-a4384fb36dce", + "x-request-time": "0.171" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/ehZqtG2tqmCDX40Tyv-sOFmZiT1S-9jEBsiaJ5z6LFs?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/fnFL5StIRRDTvi3KvmUcVw2Pap6TJOS2lUKVCj3ftb0?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4566,34 +3669,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:12 GMT", + "Date": "Tue, 14 Feb 2023 01:55:29 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-9b44d3402cf9d493edf3f6ed847c7fa9-5c162913d7d297b4-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-fbf596131a8979033a2fd1d56c806466-b6f277efb3561d94-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0fb1d53d-00c0-41bd-843e-2cbc7a2a590a", - "x-ms-ratelimit-remaining-subscription-reads": "11954", + "x-ms-correlation-request-id": "3504ac37-c7d6-4094-9c58-b7939d2ef891", + "x-ms-ratelimit-remaining-subscription-reads": "11979", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063312Z:0fb1d53d-00c0-41bd-843e-2cbc7a2a590a", - "x-request-time": "0.019" + "x-ms-routing-request-id": "WESTUS:20230214T015530Z:3504ac37-c7d6-4094-9c58-b7939d2ef891", + "x-request-time": "0.021" }, "ResponseBody": { "status": "InProgress" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/ehZqtG2tqmCDX40Tyv-sOFmZiT1S-9jEBsiaJ5z6LFs?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/fnFL5StIRRDTvi3KvmUcVw2Pap6TJOS2lUKVCj3ftb0?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4601,21 +3704,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:42 GMT", + "Date": "Tue, 14 Feb 2023 01:56:00 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-0960e96135492e21e0d3a0d2627e4e16-d20d8bab2ae08643-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-c2c884e65ab26b72611fd5113d3c887f-881e05c99288e755-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d12b7da6-618f-46b6-8a88-9bb139e1bed8", - "x-ms-ratelimit-remaining-subscription-reads": "11953", + "x-ms-correlation-request-id": "3f0966a7-9f81-4254-818f-fa798fbb246f", + "x-ms-ratelimit-remaining-subscription-reads": "11978", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063342Z:d12b7da6-618f-46b6-8a88-9bb139e1bed8", - "x-request-time": "0.022" + "x-ms-routing-request-id": "WESTUS:20230214T015600Z:3f0966a7-9f81-4254-818f-fa798fbb246f", + "x-request-time": "0.021" }, "ResponseBody": { "status": "Succeeded", @@ -4623,13 +3726,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4637,11 +3740,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:42 GMT", + "Date": "Tue, 14 Feb 2023 01:56:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-e2f21bf61dc351af5aaf9410e0ac838f-1a5ca8ad7e87c6a4-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-f289f0ad055a029d9ee2158a75ef3a03-a303cfffc49e3b97-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4650,54 +3753,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8072f639-b491-40da-8dad-60701a459f66", - "x-ms-ratelimit-remaining-subscription-reads": "11952", + "x-ms-correlation-request-id": "b2b46f4c-781b-4059-bfdd-f1e9969afac6", + "x-ms-ratelimit-remaining-subscription-reads": "11977", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063342Z:8072f639-b491-40da-8dad-60701a459f66", - "x-request-time": "0.022" + "x-ms-routing-request-id": "WESTUS:20230214T015601Z:b2b46f4c-781b-4059-bfdd-f1e9969afac6", + "x-request-time": "0.031" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4706,23 +3814,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:33:12.0149679Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:55:30.1478271Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4730,11 +3838,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:42 GMT", + "Date": "Tue, 14 Feb 2023 01:56:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-80226f7bf4443a43d00675d15424e6bd-e21e8cea6642f551-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-03a5cf219dec39257dd72ef4c54f0046-a3a80443d2299c1c-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4743,54 +3851,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "083ebe6b-d4f3-4575-b8c9-467756998447", - "x-ms-ratelimit-remaining-subscription-reads": "11951", + "x-ms-correlation-request-id": "cc91fe2c-9c9e-47bf-bb58-a4c3affc0277", + "x-ms-ratelimit-remaining-subscription-reads": "11976", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063343Z:083ebe6b-d4f3-4575-b8c9-467756998447", - "x-request-time": "0.027" + "x-ms-routing-request-id": "WESTUS:20230214T015601Z:cc91fe2c-9c9e-47bf-bb58-a4c3affc0277", + "x-request-time": "0.032" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4799,23 +3912,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:33:12.0149679Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:55:30.1478271Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4823,11 +3936,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:42 GMT", + "Date": "Tue, 14 Feb 2023 01:56:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-01d6f4f327eb87ccc5d03329dfbea0be-e7bc4ae0c03887ed-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-b81e83cdbe6113d992bf6f084cc9965a-da14226e718a214d-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -4836,54 +3949,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "31f07875-f8e3-463d-aef3-a7221dc32b8c", - "x-ms-ratelimit-remaining-subscription-reads": "11950", + "x-ms-correlation-request-id": "6176d6aa-a7eb-42dc-be7f-6be34ef3258b", + "x-ms-ratelimit-remaining-subscription-reads": "11975", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063343Z:31f07875-f8e3-463d-aef3-a7221dc32b8c", - "x-request-time": "0.022" + "x-ms-routing-request-id": "WESTUS:20230214T015601Z:6176d6aa-a7eb-42dc-be7f-6be34ef3258b", + "x-request-time": "0.028" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "createdByToolkit": "sdk-v2-1.4.0" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "e2etest_test_119502617351 display name", - "description": "e2etest_test_119502617351 description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights03491969", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -4892,72 +4010,68 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:33:12.0149679Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:55:30.1478271Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "531", + "Content-Length": "377", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "tags": { - "k1": "v1", - "k2": "v2" + "createdByToolkit": "sdk-v2-1.5.0" }, "identity": { "type": "SystemAssigned" }, "properties": { - "description": "Test description", - "friendlyName": "Test display name", - "imageBuildCompute": "compute", - "publicNetworkAccess": "Disabled", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/microsoft.insights/components/aimhetest2", - "containerRegistry": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/acrmhetest2" + "description": "e2etest_test_855339767631 description", + "friendlyName": "e2etest_test_855339767631 display name", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d" } }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/rMeyULbjzjbJEmUDxBx25bphNjsk79RsHa0sOkIN01I?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/06jrkjGJMQKgya6z7rSq4XqdfVVOyNkxi83ENqCTZVI?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:33:43 GMT", + "Date": "Tue, 14 Feb 2023 01:56:02 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/rMeyULbjzjbJEmUDxBx25bphNjsk79RsHa0sOkIN01I?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/06jrkjGJMQKgya6z7rSq4XqdfVVOyNkxi83ENqCTZVI?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0b45da29-5775-4166-8a92-a33a7650c579", - "x-ms-ratelimit-remaining-subscription-writes": "1195", + "x-ms-correlation-request-id": "563f264a-7972-4ea0-87d5-3552ffb971b2", + "x-ms-ratelimit-remaining-subscription-writes": "1197", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063344Z:0b45da29-5775-4166-8a92-a33a7650c579", - "x-request-time": "0.194" + "x-ms-routing-request-id": "WESTUS:20230214T015602Z:563f264a-7972-4ea0-87d5-3552ffb971b2", + "x-request-time": "0.115" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/rMeyULbjzjbJEmUDxBx25bphNjsk79RsHa0sOkIN01I?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/06jrkjGJMQKgya6z7rSq4XqdfVVOyNkxi83ENqCTZVI?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4965,34 +4079,34 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:33:43 GMT", + "Date": "Tue, 14 Feb 2023 01:56:02 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-b096004ed1f7409d7d2136ad7b02affd-b1f966f890409661-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-4d4c17eb53c8b117b1ddd3bed7a7c521-9d8eeaa30f0d3e36-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1918be6f-f595-4242-8408-04e0ca76ab39", - "x-ms-ratelimit-remaining-subscription-reads": "11949", + "x-ms-correlation-request-id": "8dcd1b4c-7d17-499b-8ffd-5e0f0a84a61e", + "x-ms-ratelimit-remaining-subscription-reads": "11974", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063344Z:1918be6f-f595-4242-8408-04e0ca76ab39", - "x-request-time": "0.027" + "x-ms-routing-request-id": "WESTUS:20230214T015602Z:8dcd1b4c-7d17-499b-8ffd-5e0f0a84a61e", + "x-request-time": "0.021" }, "ResponseBody": { "status": "InProgress" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/rMeyULbjzjbJEmUDxBx25bphNjsk79RsHa0sOkIN01I?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/06jrkjGJMQKgya6z7rSq4XqdfVVOyNkxi83ENqCTZVI?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5000,21 +4114,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:34:13 GMT", + "Date": "Tue, 14 Feb 2023 01:56:32 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-2255d13e9ecb01f58e75f3a78c948187-1894386903359385-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-6e353c3f4adf4f6cdcb6097980c90970-d21d061d98550807-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "31a59876-c26f-4804-8b4e-1b6a634a7940", - "x-ms-ratelimit-remaining-subscription-reads": "11948", + "x-ms-correlation-request-id": "a55c17de-1369-4f6a-96d5-71f525932057", + "x-ms-ratelimit-remaining-subscription-reads": "11973", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063414Z:31a59876-c26f-4804-8b4e-1b6a634a7940", - "x-request-time": "0.080" + "x-ms-routing-request-id": "WESTUS:20230214T015632Z:a55c17de-1369-4f6a-96d5-71f525932057", + "x-request-time": "0.023" }, "ResponseBody": { "status": "Succeeded", @@ -5022,13 +4136,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5036,11 +4150,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:34:14 GMT", + "Date": "Tue, 14 Feb 2023 01:56:32 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-482c208e6f07ad3836af31705fbf481a-4148d9da86d09c6d-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-de6c62fab05f57df96c35ca4ae46caf2-6d614973c18e2a88-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -5049,55 +4163,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8fc59d15-858a-46c8-9276-a89d43d309b8", - "x-ms-ratelimit-remaining-subscription-reads": "11947", + "x-ms-correlation-request-id": "393b5321-275d-4fd2-9ab5-46addb186ba6", + "x-ms-ratelimit-remaining-subscription-reads": "11972", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063414Z:8fc59d15-858a-46c8-9276-a89d43d309b8", - "x-request-time": "0.028" + "x-ms-routing-request-id": "WESTUS:20230214T015633Z:393b5321-275d-4fd2-9ab5-46addb186ba6", + "x-request-time": "0.030" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "k1": "v1", - "k2": "v2" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "Test display name", - "description": "Test description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/aimhetest2", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "imageBuildCompute": "compute", + "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, - "containerRegistry": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/acrmhetest2", + "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, - "publicNetworkAccess": "Disabled", + "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -5106,23 +4224,23 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:33:43.8851074Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:56:02.4760311Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5130,11 +4248,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:34:14 GMT", + "Date": "Tue, 14 Feb 2023 01:56:33 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-67e213c42707ef3176b6fdb29c6048a5-3c5e3fcda6c34fdf-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-a1fb5587d2f49476a0a5fac39b5feaf8-aeb2c27b5698d0d4-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -5143,55 +4261,59 @@ ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "296d2e46-f7a8-4acc-85dd-b3061b793e08", - "x-ms-ratelimit-remaining-subscription-reads": "11946", + "x-ms-correlation-request-id": "1249f69d-862a-40cc-a869-2223219c3b80", + "x-ms-ratelimit-remaining-subscription-reads": "11971", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063414Z:296d2e46-f7a8-4acc-85dd-b3061b793e08", - "x-request-time": "0.024" + "x-ms-routing-request-id": "WESTUS:20230214T015633Z:1249f69d-862a-40cc-a869-2223219c3b80", + "x-request-time": "0.029" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "name": "e2etest_test_119502617351", + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", "type": "Microsoft.MachineLearningServices/workspaces", "location": "eastus2euap", "tags": { - "k1": "v1", - "k2": "v2" + "createdByToolkit": "sdk-v2-1.5.0" }, "etag": null, "properties": { - "friendlyName": "Test display name", - "description": "Test description", - "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d", - "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471", - "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/aimhetest2", + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", "hbiWorkspace": false, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "imageBuildCompute": "compute", + "imageBuildCompute": null, "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, "v1LegacyMode": false, "softDeleteEnabled": false, - "containerRegistry": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/acrmhetest2", + "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", "notebookInfo": { - "resourceId": "3b3a30d8dcce4f5ca6d88a888fbe99f9", - "fqdn": "ml-e2etesttest-eastus2euap-d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538.eastus2euap.notebooks.azure.net", + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", "isPrivateLinkEnabled": false, "notebookPreparationError": null }, "storageHnsEnabled": false, - "workspaceId": "d9a3cb2c-7b6b-44e6-8912-6d1a3aea0538", + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", "linkedModelInventoryArmId": null, "privateLinkCount": 0, - "publicNetworkAccess": "Disabled", + "publicNetworkAccess": "Enabled", "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", - "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351", - "sdkTelemetryAppInsightsKey": "a8e1f1e9-194b-4beb-a878-fceea1cbcd3a", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", "sasGetterUri": "", "enableDataIsolation": false }, "identity": { "type": "SystemAssigned", - "principalId": "37a4d536-e161-4b41-a5d9-1a807b4b2bc9", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "kind": "Default", @@ -5200,172 +4322,206 @@ "tier": "Basic" }, "systemData": { - "createdAt": "2023-01-31T06:30:56.9622888Z", - "createdBy": "mingweihe@microsoft.com", + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", "createdByType": "User", - "lastModifiedAt": "2023-01-31T06:33:43.8851074Z", - "lastModifiedBy": "mingweihe@microsoft.com", + "lastModifiedAt": "2023-02-14T01:56:02.4760311Z", + "lastModifiedBy": "joharrington@microsoft.com", "lastModifiedByType": "User" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/aimhetest2?api-version=2015-05-01", - "RequestMethod": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", + "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "Access-Control-Expose-Headers": "Request-Context", "Cache-Control": "no-cache", - "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:34:21 GMT", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 01:56:33 GMT", "Expires": "-1", "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:7f83c1fe-8c94-4d55-9337-4ddc696f61ed", - "Server": "Microsoft-IIS/10.0", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-ebefc05ca6b77d966be62a2cd404254e-b4d6db8f8aa06dec-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "25cd6080-0a10-4ead-a950-2492a624f46c", - "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "WESTUS2:20230131T063422Z:25cd6080-0a10-4ead-a950-2492a624f46c", - "X-Powered-By": "ASP.NET" + "x-ms-correlation-request-id": "b02f9b9a-36fa-49b5-b42d-66ceb4fa8233", + "x-ms-ratelimit-remaining-subscription-reads": "11970", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T015633Z:b02f9b9a-36fa-49b5-b42d-66ceb4fa8233", + "x-request-time": "0.028" }, - "ResponseBody": null + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "name": "e2etest_test_855339767631", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "eastus2euap", + "tags": { + "createdByToolkit": "sdk-v2-1.5.0" + }, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_855339767631 display name", + "description": "e2etest_test_855339767631 description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage7a156a630", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault3e2a4ce5", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsights667c475d", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "networkId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "outboundRules": {} + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-14T01:54:35.7096464Z", + "notebookInfo": { + "resourceId": "fa1c121514d34f348531e6428747c837", + "fqdn": "ml-e2etesttest-eastus2euap-1d6912b4-e195-43e1-955c-64a59f2b1af0.eastus2euap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "1d6912b4-e195-43e1-955c-64a59f2b1af0", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://eastus2euap.api.azureml.ms/discovery", + "mlFlowTrackingUri": "azureml://eastus2euap.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631", + "sdkTelemetryAppInsightsKey": "bf5fc3cc-fd87-47a0-99e2-70f15d4bb11e", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "a96f5297-a16a-47f8-9bcf-795879b29243", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-14T01:54:35.7096464Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-14T01:56:02.4760311Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstoragea482cf16d?api-version=2019-06-01", - "RequestMethod": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_855339767631?api-version=2022-12-01-preview", + "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Length": "0", - "Content-Type": "text/plain; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:34:27 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Server": "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7288fec5-5f34-4b7c-b11b-ddd2ec89ae8a", - "x-ms-ratelimit-remaining-subscription-deletes": "14998", - "x-ms-routing-request-id": "WESTUS2:20230131T063428Z:7288fec5-5f34-4b7c-b11b-ddd2ec89ae8a" + "Content-Length": "603", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, - "ResponseBody": null - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault8b9fd471?api-version=2019-09-01", - "RequestMethod": "DELETE", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "RequestBody": { + "tags": { + "k1": "v1", + "k2": "v2" + }, + "identity": { + "type": "SystemAssigned" + }, + "properties": { + "description": "Test description", + "friendlyName": "Test display name", + "imageBuildCompute": "compute", + "publicNetworkAccess": "Disabled", + "applicationInsights": "/subscriptions/8f338f6e-4fce-44ae-969c-fc7d8fda030e/resourceGroups/rg-mhe-e2e-test-dont-remove/providers/microsoft.insights/components/aimhetest2", + "containerRegistry": "/subscriptions/8f338f6e-4fce-44ae-969c-fc7d8fda030e/resourceGroups/rg-mhe-e2e-test-dont-remove/providers/Microsoft.ContainerRegistry/registries/acrmhetest2", + "managedNetwork": {} + } }, - "RequestBody": null, - "StatusCode": 200, + "StatusCode": 202, "ResponseHeaders": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/_CKHzDDHhBWiWSgBrFV3A4wcKrve8BI6rHTvtHVBL3Q?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:34:32 GMT", + "Date": "Tue, 14 Feb 2023 01:56:34 GMT", "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/_CKHzDDHhBWiWSgBrFV3A4wcKrve8BI6rHTvtHVBL3Q?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", - "Server": "Microsoft-IIS/10.0", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-AspNet-Version": "4.0.30319", + "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1bd79369-eade-4651-b1a2-c8cd452a8e1b", - "x-ms-keyvault-service-version": "1.5.655.1", - "x-ms-ratelimit-remaining-subscription-deletes": "14997", - "x-ms-routing-request-id": "WESTUS2:20230131T063433Z:1bd79369-eade-4651-b1a2-c8cd452a8e1b" + "x-ms-correlation-request-id": "662eaf49-c917-4de3-9717-c3d6428f50d7", + "x-ms-ratelimit-remaining-subscription-writes": "1196", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T015634Z:662eaf49-c917-4de3-9717-c3d6428f50d7", + "x-request-time": "0.202" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/acrmhetest2?api-version=2019-05-01", - "RequestMethod": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/_CKHzDDHhBWiWSgBrFV3A4wcKrve8BI6rHTvtHVBL3Q?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json", + "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "api-supported-versions": "2019-05-01", - "Cache-Control": "no-cache", - "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:34:39 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Server": "Microsoft-HTTPAPI/2.0", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7b19e692-0b37-45fe-9f81-e51d2d993590", - "x-ms-ratelimit-remaining-subscription-deletes": "14996", - "x-ms-routing-request-id": "WESTUS2:20230131T063439Z:7b19e692-0b37-45fe-9f81-e51d2d993590" - }, - "ResponseBody": null - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_119502617351?api-version=2022-10-01-preview", - "RequestMethod": "DELETE", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "Content-Length": "0", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 202, - "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7ddd3d3e-ff21-4fbd-a7cb-fb921ccb16ec?api-version=2022-10-01-preview\u0026type=async", "Cache-Control": "no-cache", - "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:34:39 GMT", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 01:56:34 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7ddd3d3e-ff21-4fbd-a7cb-fb921ccb16ec?api-version=2022-10-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-324d30ade4cb8b11c1eb961e6979a365-b979c302b16f1c69-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9a78a849-0480-4727-bda9-6840b68f0403", - "x-ms-ratelimit-remaining-subscription-deletes": "14995", + "x-ms-correlation-request-id": "e7acd7c2-9247-4dec-8f19-3d09df4d2e50", + "x-ms-ratelimit-remaining-subscription-reads": "11969", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063440Z:9a78a849-0480-4727-bda9-6840b68f0403", - "x-request-time": "0.094" + "x-ms-routing-request-id": "WESTUS:20230214T015635Z:e7acd7c2-9247-4dec-8f19-3d09df4d2e50", + "x-request-time": "0.027" }, - "ResponseBody": null + "ResponseBody": { + "status": "InProgress" + } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7ddd3d3e-ff21-4fbd-a7cb-fb921ccb16ec?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/_CKHzDDHhBWiWSgBrFV3A4wcKrve8BI6rHTvtHVBL3Q?api-version=2022-12-01-preview\u0026type=async", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyIsImtpZCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTY3NTE0MjgwNCwibmJmIjoxNjc1MTQyODA0LCJleHAiOjE2NzUxNDc2MjAsIl9jbGFpbV9uYW1lcyI6eyJncm91cHMiOiJzcmMxIn0sIl9jbGFpbV9zb3VyY2VzIjp7InNyYzEiOnsiZW5kcG9pbnQiOiJodHRwczovL2dyYXBoLndpbmRvd3MubmV0LzcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0Ny91c2Vycy8yNTlkMGY1MS1iODBmLTQ2YjUtYWE2OC0wM2JiMzc1NDRkMjMvZ2V0TWVtYmVyT2JqZWN0cyJ9fSwiYWNyIjoiMSIsImFpbyI6IkFhUUFXLzhUQUFBQTFBNzVqVEhvREtJcVY0aFFpdkN0Rm9rM0l6NjZrTER0UHZJTXlMU1lXU1dRam9Kb3RpVzBPWms0L3lreHhsek1TeXV3N25kWm5lWFU0UXRDSkt2SDVMV1YyRWlPbUx4YUE0Q2J5aFJ5OW9HcFlSNkRWZ0tVMUlzaUlxVk1lYkgzR3p0VnkxTkZLWFJuMUJGNU5rL0Vuc1N6NnpJV1VqVld4T0pMaTZWMUZGMzBTcUZ1VFlxby8yZURnRzBlOStxeXVZYWtjeVdoejdIZTYxeEsrTk5rNWc9PSIsImFtciI6WyJwd2QiLCJyc2EiLCJ3aWEiLCJtZmEiXSwiYXBwaWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJhcHBpZGFjciI6IjAiLCJkZXZpY2VpZCI6IjlmMjdmOGM5LWQ1YjQtNDM5Ni1hN2YyLTk2MGU0NWIwNjU4YSIsImZhbWlseV9uYW1lIjoiSGUiLCJnaXZlbl9uYW1lIjoiTWluZ3dlaSIsImlwYWRkciI6Ijc1LjE3Mi45My41NCIsIm5hbWUiOiJNaW5nd2VpIEhlIiwib2lkIjoiMjU5ZDBmNTEtYjgwZi00NmI1LWFhNjgtMDNiYjM3NTQ0ZDIzIiwib25wcmVtX3NpZCI6IlMtMS01LTIxLTIxMjc1MjExODQtMTYwNDAxMjkyMC0xODg3OTI3NTI3LTQ5NzI3Njg4IiwicHVpZCI6IjEwMDMyMDAxM0FBQzNFNDIiLCJyaCI6IjAuQVJvQXY0ajVjdkdHcjBHUnF5MTgwQkhiUjBaSWYza0F1dGRQdWtQYXdmajJNQk1hQUFRLiIsInNjcCI6InVzZXJfaW1wZXJzb25hdGlvbiIsInN1YiI6IlAwRFpkRlcxaDM2N1U3eTZxTktsTTBuZUhieTJmbWFzWk9LcXVUelNPUUkiLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1bmlxdWVfbmFtZSI6Im1pbmd3ZWloZUBtaWNyb3NvZnQuY29tIiwidXBuIjoibWluZ3dlaWhlQG1pY3Jvc29mdC5jb20iLCJ1dGkiOiJmTUNEbXdLYmRrNnFXbGRmZ2QyU0FBIiwidmVyIjoiMS4wIiwid2lkcyI6WyJiNzlmYmY0ZC0zZWY5LTQ2ODktODE0My03NmIxOTRlODU1MDkiXSwieG1zX2NjIjpbIkNQMSJdLCJ4bXNfdGNkdCI6MTI4OTI0MTU0N30.Vv1cPg7gumORugu6PvChG3aYGDssFqcyqxgajY-_BzkH5FfbCT9mJvCiwuQn0ifm9BslDibDTbJTTA9BydSScqFcY7gD1wc7jR5-VhOidiZFIaNT2sp6fdGoX3rWdldV7DqW_n8yDTxlnkxkzN0vkKxSuQRE-iC9N7Got8Diy3KR30aspcDyTkYXSO8VskcE7Muin9kShSdavr6cfwasnHAexUBBi-pONI6sG5wgAlE9dB202rx2TfTULDEK5s99vCqE3AEqUkdmq7xMpQTSVpsAm9NlNGgHxa_OwBEZWY478rS3ppGYqxgVUBmGMAR08U2EAk-jd40RprQlH5_dKA", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "578bc2a8-a131-11ed-92c9-5cf370a2370c" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5373,33 +4529,39 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:34:39 GMT", + "Date": "Tue, 14 Feb 2023 01:57:04 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-cbdcee34b17ef3099326a313fa313f63-f9f7befec924d3d0-01\u0022", + "Server-Timing": "traceparent;desc=\u002200-ead14f3329fcd76a80cc21fb26250a23-20748d3823887768-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], "x-aml-cluster": "vienna-eastus2euap-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "84001a59-5659-433b-9d3c-6f044b3ff5f4", - "x-ms-ratelimit-remaining-subscription-reads": "11945", - "x-ms-request-id": "84001a59-5659-433b-9d3c-6f044b3ff5f4", + "x-ms-correlation-request-id": "1fc4ebba-83d6-45a2-9ab2-49d2a12559db", + "x-ms-ratelimit-remaining-subscription-reads": "11968", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063440Z:84001a59-5659-433b-9d3c-6f044b3ff5f4", - "x-request-time": "0.020" + "x-ms-routing-request-id": "WESTUS:20230214T015705Z:1fc4ebba-83d6-45a2-9ab2-49d2a12559db", + "x-request-time": "0.066" }, "ResponseBody": { - "status": "InProgress" + "status": "Failed", + "error": { + "code": "BadRequest", + "message": "Unable to check existing role assignments on resource /subscriptions/8f338f6e-4fce-44ae-969c-fc7d8fda030e/resourceGroups/rg-mhe-e2e-test-dont-remove/providers/Microsoft.ContainerRegistry/registries/acrmhetest2: The Resource \u0027Microsoft.ContainerRegistry/registries/acrmhetest2\u0027 under resource group \u0027rg-mhe-e2e-test-dont-remove\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" + } } } ], "Variables": { - "deployment_name": "e2etest_test_119502617351-2374430", - "insights_name": "e2etesttinsights03491969", - "keyvault_name": "e2etesttkeyvault8b9fd471", - "storage_name": "e2etesttstoragea482cf16d", - "wps_name": "test_119502617351" + "deployment_name": "e2etest_test_855339767631-9567285", + "insights_name": "e2etesttinsights667c475d", + "keyvault_name": "e2etesttkeyvault3e2a4ce5", + "storage_name": "e2etesttstorage7a156a630", + "wps_name": "test_855339767631" } } diff --git a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_create_update_delete_with_managed_network.json b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_create_update_delete_with_managed_network.json new file mode 100644 index 000000000000..b28a867f1406 --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_create_update_delete_with_managed_network.json @@ -0,0 +1,3947 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "253", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:26 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "edbc42f6-61a9-4b46-9e1b-f0835a506113", + "x-ms-failure-cause": "gateway", + "x-ms-routing-request-id": "WESTUS:20230214T020127Z:edbc42f6-61a9-4b46-9e1b-f0835a506113" + }, + "ResponseBody": { + "error": { + "code": "ResourceNotFound", + "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/DefaultResourceGroup-southcentralus?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "272", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:27 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f96eb492-c304-4ef2-8239-16af821db1ff", + "x-ms-ratelimit-remaining-subscription-reads": "11903", + "x-ms-routing-request-id": "WESTUS:20230214T020128Z:f96eb492-c304-4ef2-8239-16af821db1ff" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus", + "name": "DefaultResourceGroup-southcentralus", + "type": "Microsoft.Resources/resourceGroups", + "location": "southcentralus", + "properties": { + "provisioningState": "Succeeded" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus/resources?$filter=substringof%28%27DefaultWorkspace-southcentralus%27%2Cname%29\u0026api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "322", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:28 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "028fd248-7a40-4c76-bbd4-8cc09e92169e", + "x-ms-ratelimit-remaining-subscription-reads": "11902", + "x-ms-routing-request-id": "WESTUS:20230214T020129Z:028fd248-7a40-4c76-bbd4-8cc09e92169e" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus/providers/Microsoft.OperationalInsights/workspaces/DefaultWorkspace-southcentralus", + "name": "DefaultWorkspace-southcentralus", + "type": "Microsoft.OperationalInsights/workspaces", + "location": "southcentralus" + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211?api-version=2020-06-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "20217", + "Content-Type": "application/json", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": { + "properties": { + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "workspaceName": { + "type": "string", + "metadata": { + "description": "Specifies the name of the Azure Machine Learning workspace." + } + }, + "description": { + "type": "string", + "metadata": { + "description": "Description string." + } + }, + "friendlyName": { + "type": "string", + "metadata": { + "description": "Friendly name." + } + }, + "location": { + "type": "string", + "metadata": { + "description": "Specifies the location for all resources." + } + }, + "resourceGroupName": { + "type": "string", + "metadata": { + "description": "Specifies the resource group name of the Azure Machine Learning workspace." + } + }, + "storageAccountOption": { + "type": "string", + "defaultValue": "new", + "allowedValues": [ + "new", + "existing" + ], + "metadata": { + "description": "Determines whether or not a new storage should be provisioned." + } + }, + "storageAccountName": { + "type": "string", + "defaultValue": "[concat(\u0027sa\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the storage account." + } + }, + "storageAccountType": { + "type": "string", + "defaultValue": "Standard_LRS" + }, + "storageAccountBehindVNet": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "true", + "false" + ], + "metadata": { + "description": "Determines whether or not to put the storage account behind VNet" + } + }, + "storageAccountResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "storageAccountLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "keyVaultOption": { + "type": "string", + "defaultValue": "new", + "allowedValues": [ + "new", + "existing" + ], + "metadata": { + "description": "Determines whether or not a new key vault should be provisioned." + } + }, + "keyVaultName": { + "type": "string", + "defaultValue": "[concat(\u0027kv\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the key vault." + } + }, + "keyVaultBehindVNet": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "true", + "false" + ], + "metadata": { + "description": "Determines whether or not to put the storage account behind VNet" + } + }, + "keyVaultResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "keyVaultLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "applicationInsightsOption": { + "type": "string", + "defaultValue": "new", + "allowedValues": [ + "new", + "existing" + ], + "metadata": { + "description": "Determines whether or not new ApplicationInsights should be provisioned." + } + }, + "applicationInsightsName": { + "type": "string", + "defaultValue": "[concat(\u0027ai\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of ApplicationInsights." + } + }, + "applicationInsightsResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "applicationInsightsLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "containerRegistryOption": { + "type": "string", + "defaultValue": "none", + "allowedValues": [ + "new", + "existing", + "none" + ], + "metadata": { + "description": "Determines whether or not a new container registry should be provisioned." + } + }, + "containerRegistryName": { + "type": "string", + "defaultValue": "[concat(\u0027cr\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "The container registry bind to the workspace." + } + }, + "containerRegistrySku": { + "type": "string", + "defaultValue": "Standard", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "containerRegistryResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "containerRegistryBehindVNet": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "true", + "false" + ], + "metadata": { + "description": "Determines whether or not to put container registry behind VNet." + } + }, + "containerRegistryLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "vnetOption": { + "type": "string", + "defaultValue": "[if(equals(parameters(\u0027privateEndpointType\u0027), \u0027none\u0027), \u0027none\u0027, \u0027new\u0027)]", + "allowedValues": [ + "new", + "existing", + "none" + ], + "metadata": { + "description": "Determines whether or not a new VNet should be provisioned." + } + }, + "vnetName": { + "type": "string", + "defaultValue": "[concat(\u0027vn\u0027,uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the VNet" + } + }, + "vnetResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "addressPrefixes": { + "type": "array", + "defaultValue": [ + "10.0.0.0/16" + ], + "metadata": { + "description": "Address prefix of the virtual network" + } + }, + "subnetOption": { + "type": "string", + "defaultValue": "[if(or(not(equals(parameters(\u0027privateEndpointType\u0027), \u0027none\u0027)), equals(parameters(\u0027vnetOption\u0027), \u0027new\u0027)), \u0027new\u0027, \u0027none\u0027)]", + "allowedValues": [ + "new", + "existing", + "none" + ], + "metadata": { + "description": "Determines whether or not a new subnet should be provisioned." + } + }, + "subnetName": { + "type": "string", + "defaultValue": "[concat(\u0027sn\u0027,uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the subnet" + } + }, + "subnetPrefix": { + "type": "string", + "defaultValue": "10.0.0.0/24", + "metadata": { + "description": "Subnet prefix of the virtual network" + } + }, + "adbWorkspace": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Azure Databrick workspace to be linked to the workspace" + } + }, + "confidential_data": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "false", + "true" + ], + "metadata": { + "description": "Specifies that the Azure Machine Learning workspace holds highly confidential data." + } + }, + "encryption_status": { + "type": "string", + "defaultValue": "Disabled", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "metadata": { + "description": "Specifies if the Azure Machine Learning workspace should be encrypted with customer managed key." + } + }, + "cmk_keyvault": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Specifies the customer managed keyVault arm id." + } + }, + "resource_cmk_uri": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Specifies if the customer managed keyvault key uri." + } + }, + "privateEndpointType": { + "type": "string", + "defaultValue": "none", + "allowedValues": [ + "AutoApproval", + "ManualApproval", + "none" + ] + }, + "tagValues": { + "type": "object" + }, + "privateEndpointName": { + "type": "string", + "defaultValue": "pe", + "metadata": { + "description": "Name of the private end point added to the workspace" + } + }, + "privateEndpointResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]", + "metadata": { + "description": "Name of the resource group where the private end point is added to" + } + }, + "imageBuildCompute": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The name of the compute target to use for building environment Docker images with the container registry is behind a VNet." + } + }, + "publicNetworkAccess": { + "type": "string", + "defaultValue": "Enabled", + "allowedValues": [ + "Disabled", + "Enabled" + ], + "metadata": { + "description": "Whether to allow public endpoint connectivity when a workspace is private link enabled." + } + }, + "soft_delete_enabled": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "false", + "true" + ], + "metadata": { + "description": "Whether to create a workspace with soft delete capability" + } + }, + "allow_recover_softdeleted_workspace": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "false", + "true" + ], + "metadata": { + "description": "Whether to allow an existing soft-deleted workspace to be recovered" + } + }, + "encryption_cosmosdb_resourceid": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The Bring-Your-Own cosmosdb account that customer brings to store data" + } + }, + "encryption_storage_resourceid": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The Bring-Your-Own storage account that customer brings to store data" + } + }, + "encryption_search_resourceid": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The Bring-Your-Own search account that customer brings to store data" + } + }, + "identity": { + "type": "object", + "defaultValue": { + "type": "systemAssigned" + }, + "metadata": { + "description": "Managed identities assigned to workspace. If not specificed, SystemAssigned managed identity is the default." + } + }, + "primaryUserAssignedIdentity": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "ARM identifier of primary user assigned managed identity, in case multiple ones are specified. Also the default managed identity for clusterless compute." + } + }, + "managedNetwork": { + "type": "object", + "defaultValue": { + "isolationMode": "Disabled" + }, + "metadata": { + "description": "Managed network settings to be used for the workspace. If not specified, isolation mode Disabled is the default" + } + } + }, + "variables": { + "tenantId": "[subscription().tenantId]", + "storageAccount": "[resourceId(parameters(\u0027storageAccountResourceGroupName\u0027), \u0027Microsoft.Storage/storageAccounts\u0027, parameters(\u0027storageAccountName\u0027))]", + "keyVault": "[resourceId(parameters(\u0027keyVaultResourceGroupName\u0027), \u0027Microsoft.KeyVault/vaults\u0027, parameters(\u0027keyVaultName\u0027))]", + "containerRegistry": "[resourceId(parameters(\u0027containerRegistryResourceGroupName\u0027), \u0027Microsoft.ContainerRegistry/registries\u0027, parameters(\u0027containerRegistryName\u0027))]", + "applicationInsights": "[resourceId(parameters(\u0027applicationInsightsResourceGroupName\u0027), \u0027Microsoft.Insights/components\u0027, parameters(\u0027applicationInsightsName\u0027))]", + "vnet": "[resourceId(parameters(\u0027vnetResourceGroupName\u0027), \u0027Microsoft.Network/virtualNetworks\u0027, parameters(\u0027vnetName\u0027))]", + "subnet": "[resourceId(parameters(\u0027vnetResourceGroupName\u0027), \u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]", + "enablePE": true, + "networkRuleSetBehindVNet": { + "defaultAction": "deny", + "virtualNetworkRules": [ + { + "action": "Allow", + "id": "[variables(\u0027subnet\u0027)]" + } + ] + }, + "privateEndpointSettings": { + "name": "[concat(parameters(\u0027workspaceName\u0027), \u0027-PrivateEndpoint\u0027)]", + "properties": { + "privateLinkServiceId": "[resourceId(\u0027Microsoft.MachineLearningServices/workspaces\u0027, parameters(\u0027workspaceName\u0027))]", + "groupIds": [ + "amlworkspace" + ] + } + }, + "defaultPEConnections": "[array(variables(\u0027privateEndpointSettings\u0027))]", + "privateEndpointDeploymentName": "[concat(\u0027DeployPrivateEndpoint-\u0027, uniqueString(parameters(\u0027privateEndpointName\u0027)))]" + }, + "resources": [ + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027vnetOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2019-09-01", + "name": "[parameters(\u0027vnetName\u0027)]", + "location": "[parameters(\u0027location\u0027)]", + "tags": "[parameters(\u0027tagValues\u0027)]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters(\u0027addressPrefixes\u0027)]" + }, + "enableDdosProtection": false, + "enableVmProtection": false + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027subnetOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Network/virtualNetworks/subnets", + "apiVersion": "2019-09-01", + "name": "[concat(parameters(\u0027vnetName\u0027), \u0027/\u0027, parameters(\u0027subnetName\u0027))]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks\u0027, parameters(\u0027vnetName\u0027))]" + ], + "properties": { + "addressPrefix": "[parameters(\u0027subnetPrefix\u0027)]", + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled", + "serviceEndpoints": [ + { + "service": "Microsoft.Storage" + }, + { + "service": "Microsoft.KeyVault" + }, + { + "service": "Microsoft.ContainerRegistry" + } + ] + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027storageAccountOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2019-04-01", + "name": "[parameters(\u0027storageAccountName\u0027)]", + "tags": "[parameters(\u0027tagValues\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "location": "[parameters(\u0027storageAccountLocation\u0027)]", + "sku": { + "name": "[parameters(\u0027storageAccountType\u0027)]" + }, + "kind": "StorageV2", + "properties": { + "encryption": { + "services": { + "blob": { + "enabled": true + }, + "file": { + "enabled": true + } + }, + "keySource": "Microsoft.Storage" + }, + "supportsHttpsTrafficOnly": true, + "allowBlobPublicAccess": false, + "networkAcls": "[if(equals(parameters(\u0027storageAccountBehindVNet\u0027), \u0027true\u0027), variables(\u0027networkRuleSetBehindVNet\u0027), json(\u0027null\u0027))]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027keyVaultOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.KeyVault/vaults", + "apiVersion": "2019-09-01", + "tags": "[parameters(\u0027tagValues\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "name": "[parameters(\u0027keyVaultName\u0027)]", + "location": "[parameters(\u0027keyVaultLocation\u0027)]", + "properties": { + "tenantId": "[variables(\u0027tenantId\u0027)]", + "sku": { + "name": "standard", + "family": "A" + }, + "accessPolicies": [], + "networkAcls": "[if(equals(parameters(\u0027keyVaultBehindVNet\u0027), \u0027true\u0027), variables(\u0027networkRuleSetBehindVNet\u0027), json(\u0027null\u0027))]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027containerRegistryOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.ContainerRegistry/registries", + "apiVersion": "2019-05-01", + "tags": "[parameters(\u0027tagValues\u0027)]", + "name": "[parameters(\u0027containerRegistryName\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "location": "[parameters(\u0027containerRegistryLocation\u0027)]", + "sku": { + "name": "[parameters(\u0027containerRegistrySku\u0027)]" + }, + "properties": { + "adminUserEnabled": true, + "networkRuleSet": "[if(equals(parameters(\u0027containerRegistryBehindVNet\u0027), \u0027true\u0027), variables(\u0027networkRuleSetBehindVNet\u0027), json(\u0027null\u0027))]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027applicationInsightsOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Insights/components", + "tags": "[parameters(\u0027tagValues\u0027)]", + "apiVersion": "2020-02-02-preview", + "name": "[parameters(\u0027applicationInsightsName\u0027)]", + "location": "[if(or(equals(toLower(parameters(\u0027applicationInsightsLocation\u0027)),\u0027westcentralus\u0027), equals(toLower(parameters(\u0027applicationInsightsLocation\u0027)),\u0027eastus2euap\u0027), equals(toLower(parameters(\u0027applicationInsightsLocation\u0027)),\u0027centraluseuap\u0027)),\u0027southcentralus\u0027, parameters(\u0027applicationInsightsLocation\u0027))]", + "kind": "web", + "properties": { + "Application_Type": "web", + "WorkspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus/providers/Microsoft.OperationalInsights/workspaces/DefaultWorkspace-southcentralus" + } + }, + { + "condition": "[variables(\u0027enablePE\u0027)]", + "type": "Microsoft.MachineLearningServices/workspaces", + "apiVersion": "2022-12-01-preview", + "tags": "[parameters(\u0027tagValues\u0027)]", + "name": "[parameters(\u0027workspaceName\u0027)]", + "location": "[parameters(\u0027location\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Storage/storageAccounts\u0027, parameters(\u0027storageAccountName\u0027))]", + "[resourceId(\u0027Microsoft.KeyVault/vaults\u0027, parameters(\u0027keyVaultName\u0027))]", + "[resourceId(\u0027Microsoft.Insights/components\u0027, parameters(\u0027applicationInsightsName\u0027))]", + "[resourceId(\u0027Microsoft.ContainerRegistry/registries\u0027, parameters(\u0027containerRegistryName\u0027))]" + ], + "identity": "[parameters(\u0027identity\u0027)]", + "properties": { + "friendlyName": "[parameters(\u0027friendlyName\u0027)]", + "description": "[parameters(\u0027description\u0027)]", + "storageAccount": "[variables(\u0027storageAccount\u0027)]", + "keyVault": "[variables(\u0027keyVault\u0027)]", + "applicationInsights": "[variables(\u0027applicationInsights\u0027)]", + "containerRegistry": "[if(not(equals(parameters(\u0027containerRegistryOption\u0027), \u0027none\u0027)), variables(\u0027containerRegistry\u0027), json(\u0027null\u0027))]", + "hbiWorkspace": "[parameters(\u0027confidential_data\u0027)]", + "imageBuildCompute": "[parameters(\u0027imageBuildCompute\u0027)]", + "publicNetworkAccess": "[parameters(\u0027publicNetworkAccess\u0027)]", + "softDeleteEnabled": "[parameters(\u0027soft_delete_enabled\u0027)]", + "allowRecoverSoftDeletedWorkspace": "[parameters(\u0027allow_recover_softdeleted_workspace\u0027)]", + "encryption": { + "status": "[parameters(\u0027encryption_status\u0027)]", + "keyVaultProperties": { + "keyVaultArmId": "[parameters(\u0027cmk_keyvault\u0027)]", + "keyIdentifier": "[parameters(\u0027resource_cmk_uri\u0027)]" + }, + "cosmosDbArmId": "[parameters(\u0027encryption_cosmosdb_resourceid\u0027)]", + "storageAccountArmId": "[parameters(\u0027encryption_storage_resourceid\u0027)]", + "SearchAccountArmId": "[parameters(\u0027encryption_search_resourceid\u0027)]" + }, + "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]", + "managedNetwork": "[parameters(\u0027managedNetwork\u0027)]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), not(equals(parameters(\u0027privateEndpointType\u0027), \u0027none\u0027)))]", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2020-06-01", + "name": "[variables(\u0027privateEndpointDeploymentName\u0027)]", + "resourceGroup": "[parameters(\u0027privateEndpointResourceGroupName\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.MachineLearningServices/workspaces\u0027, parameters(\u0027workspaceName\u0027))]", + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "apiVersion": "2020-06-01", + "name": "[parameters(\u0027privateEndpointName\u0027)]", + "type": "Microsoft.Network/privateEndpoints", + "location": "[parameters(\u0027location\u0027)]", + "tags": "[parameters(\u0027tagValues\u0027)]", + "properties": { + "privateLinkServiceConnections": "[if(equals(parameters(\u0027privateEndpointType\u0027), \u0027AutoApproval\u0027), variables(\u0027defaultPEConnections\u0027), json(\u0027null\u0027))]", + "manualPrivateLinkServiceConnections": "[if(equals(parameters(\u0027privateEndpointType\u0027), \u0027ManualApproval\u0027), variables(\u0027defaultPEConnections\u0027), json(\u0027null\u0027))]", + "subnet": { + "id": "[variables(\u0027subnet\u0027)]" + } + } + } + ] + } + } + } + ] + }, + "parameters": { + "location": { + "value": "centraluseuap" + }, + "workspaceName": { + "value": "e2etest_test_107835267768_mvnet" + }, + "resourceGroupName": { + "value": "00000" + }, + "description": { + "value": "e2etest_test_107835267768_mvnet description" + }, + "friendlyName": { + "value": "e2etest_test_107835267768_mvnet display name" + }, + "tagValues": { + "value": { + "createdByToolkit": "sdk-v2-1.5.0" + } + }, + "keyVaultOption": { + "value": "new" + }, + "keyVaultName": { + "value": "e2etesttkeyvault26bfe970" + }, + "keyVaultResourceGroupName": { + "value": "00000" + }, + "storageAccountOption": { + "value": "new" + }, + "storageAccountName": { + "value": "e2etesttstorageb531f7932" + }, + "storageAccountResourceGroupName": { + "value": "00000" + }, + "applicationInsightsOption": { + "value": "new" + }, + "applicationInsightsName": { + "value": "e2etesttinsightscd822d4f" + }, + "applicationInsightsResourceGroupName": { + "value": "00000" + }, + "containerRegistryOption": { + "value": "none" + }, + "containerRegistryName": { + "value": "name" + }, + "containerRegistryResourceGroupName": { + "value": "" + }, + "encryption_status": { + "value": "Disabled" + }, + "cmk_keyvault": { + "value": "" + }, + "resource_cmk_uri": { + "value": "" + }, + "privateEndpointName": { + "value": "name" + }, + "subnetOption": { + "value": "existing" + }, + "subnetName": { + "value": "default" + }, + "vnetOption": { + "value": "existing" + }, + "vnetName": { + "value": "name" + }, + "vnetResourceGroupName": { + "value": "name" + }, + "privateEndpointType": { + "value": "none" + }, + "privateEndpointResourceGroupName": { + "value": "name" + }, + "confidential_data": { + "value": "false" + }, + "imageBuildCompute": { + "value": "" + }, + "publicNetworkAccess": { + "value": "Enabled" + }, + "soft_delete_enabled": { + "value": "false" + }, + "allow_recover_softdeleted_workspace": { + "value": "false" + }, + "encryption_cosmosdb_resourceid": { + "value": "" + }, + "encryption_storage_resourceid": { + "value": "" + }, + "encryption_search_resourceid": { + "value": "" + }, + "identity": { + "value": { + "type": "SystemAssigned" + } + }, + "primaryUserAssignedIdentity": { + "value": "" + }, + "managedNetwork": { + "value": { + "isolationMode": "AllowOnlyApprovedOutbound", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "category": "UserDefined", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + } + }, + "my-storage": { + "type": "PrivateEndpoint", + "category": "UserDefined", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + } + }, + "pytorch": { + "type": "FQDN", + "category": "UserDefined", + "destination": "*.pytorch.org" + } + } + } + } + }, + "mode": "incremental" + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "Cache-Control": "no-cache", + "Content-Length": "8562", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:32 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "bd4bc77b-dec0-4a9f-8116-bfecf5fdecee", + "x-ms-ratelimit-remaining-subscription-writes": "1191", + "x-ms-routing-request-id": "WESTUS:20230214T020133Z:bd4bc77b-dec0-4a9f-8116-bfecf5fdecee" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211", + "name": "e2etest_test_107835267768_mvnet-9808211", + "type": "Microsoft.Resources/deployments", + "properties": { + "templateHash": "4984303229931942319", + "parameters": { + "workspaceName": { + "type": "String", + "value": "e2etest_test_107835267768_mvnet" + }, + "description": { + "type": "String", + "value": "e2etest_test_107835267768_mvnet description" + }, + "friendlyName": { + "type": "String", + "value": "e2etest_test_107835267768_mvnet display name" + }, + "location": { + "type": "String", + "value": "centraluseuap" + }, + "resourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountOption": { + "type": "String", + "value": "new" + }, + "storageAccountName": { + "type": "String", + "value": "e2etesttstorageb531f7932" + }, + "storageAccountType": { + "type": "String", + "value": "Standard_LRS" + }, + "storageAccountBehindVNet": { + "type": "String", + "value": "false" + }, + "storageAccountResourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountLocation": { + "type": "String", + "value": "centraluseuap" + }, + "keyVaultOption": { + "type": "String", + "value": "new" + }, + "keyVaultName": { + "type": "String", + "value": "e2etesttkeyvault26bfe970" + }, + "keyVaultBehindVNet": { + "type": "String", + "value": "false" + }, + "keyVaultResourceGroupName": { + "type": "String", + "value": "00000" + }, + "keyVaultLocation": { + "type": "String", + "value": "centraluseuap" + }, + "applicationInsightsOption": { + "type": "String", + "value": "new" + }, + "applicationInsightsName": { + "type": "String", + "value": "e2etesttinsightscd822d4f" + }, + "applicationInsightsResourceGroupName": { + "type": "String", + "value": "00000" + }, + "applicationInsightsLocation": { + "type": "String", + "value": "centraluseuap" + }, + "containerRegistryOption": { + "type": "String", + "value": "none" + }, + "containerRegistryName": { + "type": "String", + "value": "name" + }, + "containerRegistrySku": { + "type": "String", + "value": "Standard" + }, + "containerRegistryResourceGroupName": { + "type": "String", + "value": "" + }, + "containerRegistryBehindVNet": { + "type": "String", + "value": "false" + }, + "containerRegistryLocation": { + "type": "String", + "value": "centraluseuap" + }, + "vnetOption": { + "type": "String", + "value": "existing" + }, + "vnetName": { + "type": "String", + "value": "name" + }, + "vnetResourceGroupName": { + "type": "String", + "value": "name" + }, + "addressPrefixes": { + "type": "Array", + "value": [ + "10.0.0.0/16" + ] + }, + "subnetOption": { + "type": "String", + "value": "existing" + }, + "subnetName": { + "type": "String", + "value": "default" + }, + "subnetPrefix": { + "type": "String", + "value": "10.0.0.0/24" + }, + "adbWorkspace": { + "type": "String", + "value": "" + }, + "confidential_data": { + "type": "String", + "value": "false" + }, + "encryption_status": { + "type": "String", + "value": "Disabled" + }, + "cmk_keyvault": { + "type": "String", + "value": "" + }, + "resource_cmk_uri": { + "type": "String", + "value": "" + }, + "privateEndpointType": { + "type": "String", + "value": "none" + }, + "tagValues": { + "type": "Object", + "value": { + "createdByToolkit": "sdk-v2-1.5.0" + } + }, + "privateEndpointName": { + "type": "String", + "value": "name" + }, + "privateEndpointResourceGroupName": { + "type": "String", + "value": "name" + }, + "imageBuildCompute": { + "type": "String", + "value": "" + }, + "publicNetworkAccess": { + "type": "String", + "value": "Enabled" + }, + "soft_delete_enabled": { + "type": "String", + "value": "false" + }, + "allow_recover_softdeleted_workspace": { + "type": "String", + "value": "false" + }, + "encryption_cosmosdb_resourceid": { + "type": "String", + "value": "" + }, + "encryption_storage_resourceid": { + "type": "String", + "value": "" + }, + "encryption_search_resourceid": { + "type": "String", + "value": "" + }, + "identity": { + "type": "Object", + "value": { + "type": "SystemAssigned" + } + }, + "primaryUserAssignedIdentity": { + "type": "String", + "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "AllowOnlyApprovedOutbound", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "category": "UserDefined", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + } + }, + "my-storage": { + "type": "PrivateEndpoint", + "category": "UserDefined", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + } + }, + "pytorch": { + "type": "FQDN", + "category": "UserDefined", + "destination": "*.pytorch.org" + } + } + } + } + }, + "mode": "Incremental", + "provisioningState": "Accepted", + "timestamp": "2023-02-14T02:01:33.5625941Z", + "duration": "PT0.0002864S", + "correlationId": "bd4bc77b-dec0-4a9f-8116-bfecf5fdecee", + "providers": [ + { + "namespace": "Microsoft.Storage", + "resourceTypes": [ + { + "resourceType": "storageAccounts", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.KeyVault", + "resourceTypes": [ + { + "resourceType": "vaults", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.Insights", + "resourceTypes": [ + { + "resourceType": "components", + "locations": [ + "southcentralus" + ] + } + ] + }, + { + "namespace": "Microsoft.MachineLearningServices", + "resourceTypes": [ + { + "resourceType": "workspaces", + "locations": [ + "centraluseuap" + ] + } + ] + } + ], + "dependencies": [ + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name", + "resourceType": "Microsoft.Network/virtualNetworks", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/name/providers/Microsoft.Resources/deployments/DeployPrivateEndpoint-q2xi2ah3t47py", + "resourceType": "Microsoft.Resources/deployments", + "resourceName": "DeployPrivateEndpoint-q2xi2ah3t47py" + } + ] + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "21", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:33 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b45631fd-87b3-4ef9-9fce-75b289fcf501", + "x-ms-ratelimit-remaining-subscription-reads": "11901", + "x-ms-routing-request-id": "WESTUS:20230214T020134Z:b45631fd-87b3-4ef9-9fce-75b289fcf501" + }, + "ResponseBody": { + "status": "Accepted" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2086", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:38 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "7b590866-9b84-41bc-b886-bea37d40d5ed", + "x-ms-ratelimit-remaining-subscription-reads": "11900", + "x-ms-routing-request-id": "WESTUS:20230214T020139Z:7b590866-9b84-41bc-b886-bea37d40d5ed" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:38.1460069Z", + "duration": "PT3.9967948S", + "trackingId": "c082019c-1552-462f-bfc4-a66d2f54fedf", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:36.8839057Z", + "duration": "PT2.6803531S", + "trackingId": "02f74952-7ae5-49ea-a9d8-8a424bcb1eb9", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:38 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "4952a190-f086-4395-bce2-bba93d624092", + "x-ms-ratelimit-remaining-subscription-reads": "11899", + "x-ms-routing-request-id": "WESTUS:20230214T020139Z:4952a190-f086-4395-bce2-bba93d624092" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2086", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:43 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f95766d2-375b-4275-965a-cc27bc76904b", + "x-ms-ratelimit-remaining-subscription-reads": "11898", + "x-ms-routing-request-id": "WESTUS:20230214T020144Z:f95766d2-375b-4275-965a-cc27bc76904b" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:38.1460069Z", + "duration": "PT3.9967948S", + "trackingId": "c082019c-1552-462f-bfc4-a66d2f54fedf", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:36.8839057Z", + "duration": "PT2.6803531S", + "trackingId": "02f74952-7ae5-49ea-a9d8-8a424bcb1eb9", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:44 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "af75e8da-8440-484c-9f0e-2c8c1b6bf8c9", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-routing-request-id": "WESTUS:20230214T020144Z:af75e8da-8440-484c-9f0e-2c8c1b6bf8c9" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:48 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "1541b653-e75b-4bf9-8f1e-6a8d6f04d4e0", + "x-ms-ratelimit-remaining-subscription-reads": "11897", + "x-ms-routing-request-id": "WESTUS:20230214T020149Z:1541b653-e75b-4bf9-8f1e-6a8d6f04d4e0" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2086", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:49 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f511db4a-d8c8-47a3-ada9-c71bcc45fb8b", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-routing-request-id": "WESTUS:20230214T020149Z:f511db4a-d8c8-47a3-ada9-c71bcc45fb8b" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:38.1460069Z", + "duration": "PT3.9967948S", + "trackingId": "c082019c-1552-462f-bfc4-a66d2f54fedf", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:36.8839057Z", + "duration": "PT2.6803531S", + "trackingId": "02f74952-7ae5-49ea-a9d8-8a424bcb1eb9", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:54 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "3da50a7c-7c1e-442a-99a9-b7b873de6d18", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-routing-request-id": "WESTUS:20230214T020154Z:3da50a7c-7c1e-442a-99a9-b7b873de6d18" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2088", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:54 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "cefab56b-6cda-4c1b-b2c0-5d8ad13fb027", + "x-ms-ratelimit-remaining-subscription-reads": "11896", + "x-ms-routing-request-id": "WESTUS:20230214T020155Z:cefab56b-6cda-4c1b-b2c0-5d8ad13fb027" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:38.1460069Z", + "duration": "PT3.9967948S", + "trackingId": "c082019c-1552-462f-bfc4-a66d2f54fedf", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:52.4835006Z", + "duration": "PT18.279948S", + "trackingId": "bbc9bc0c-125e-4559-b6a6-9489b102e969", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/3a782421-0dbe-4ade-a3c8-ece5115ecc0f?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:55 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-006a5043344c5a6a6da3b82e3624b6a9-de9bd749714f5d3f-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-eastus2euap-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f75c40e4-3a93-4476-9965-a609bf4de7c0", + "x-ms-ratelimit-remaining-subscription-reads": "11895", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020156Z:f75c40e4-3a93-4476-9965-a609bf4de7c0", + "x-request-time": "0.021" + }, + "ResponseBody": { + "status": "InProgress" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:01:59 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f0df9f68-33ee-40ca-a61b-aea75e8ff421", + "x-ms-ratelimit-remaining-subscription-reads": "11894", + "x-ms-routing-request-id": "WESTUS:20230214T020200Z:f0df9f68-33ee-40ca-a61b-aea75e8ff421" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2824", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:00 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "ffa2573b-ad10-4701-8102-1c6a41e5d9bc", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-routing-request-id": "WESTUS:20230214T020200Z:ffa2573b-ad10-4701-8102-1c6a41e5d9bc" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/46AC009837621187", + "operationId": "46AC009837621187", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:58.0226635Z", + "duration": "PT2.2390098S", + "trackingId": "11ebe9cc-a57c-4067-b967-d8dbd3b7983d", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:55.6683387Z", + "duration": "PT21.5191266S", + "trackingId": "b35b329e-f000-49d0-9cf8-fd9f34501b49", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:52.4835006Z", + "duration": "PT18.279948S", + "trackingId": "bbc9bc0c-125e-4559-b6a6-9489b102e969", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:05 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "d8fa15f6-6e40-492a-a0a6-a46173f82a6f", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-routing-request-id": "WESTUS:20230214T020205Z:d8fa15f6-6e40-492a-a0a6-a46173f82a6f" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2824", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:05 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "62deb202-83f5-41fa-a196-1701fdd25fa4", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-routing-request-id": "WESTUS:20230214T020205Z:62deb202-83f5-41fa-a196-1701fdd25fa4" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/46AC009837621187", + "operationId": "46AC009837621187", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:58.0226635Z", + "duration": "PT2.2390098S", + "trackingId": "11ebe9cc-a57c-4067-b967-d8dbd3b7983d", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:55.6683387Z", + "duration": "PT21.5191266S", + "trackingId": "b35b329e-f000-49d0-9cf8-fd9f34501b49", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:52.4835006Z", + "duration": "PT18.279948S", + "trackingId": "bbc9bc0c-125e-4559-b6a6-9489b102e969", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:10 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "89749d5f-54cf-41cd-a983-d67db4e39a31", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-routing-request-id": "WESTUS:20230214T020210Z:89749d5f-54cf-41cd-a983-d67db4e39a31" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2824", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:11 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "892834a4-2200-4967-9942-c2bfe1f0eac7", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "WESTUS:20230214T020211Z:892834a4-2200-4967-9942-c2bfe1f0eac7" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/46AC009837621187", + "operationId": "46AC009837621187", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-14T02:01:58.0226635Z", + "duration": "PT2.2390098S", + "trackingId": "11ebe9cc-a57c-4067-b967-d8dbd3b7983d", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:55.6683387Z", + "duration": "PT21.5191266S", + "trackingId": "b35b329e-f000-49d0-9cf8-fd9f34501b49", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:52.4835006Z", + "duration": "PT18.279948S", + "trackingId": "bbc9bc0c-125e-4559-b6a6-9489b102e969", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:15 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c7b8f3c3-3d9f-4d21-8557-a4aabd4f46f1", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "WESTUS:20230214T020215Z:c7b8f3c3-3d9f-4d21-8557-a4aabd4f46f1" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3288", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:16 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b1fcccf8-9dfa-47f8-b7c1-3b70d5715ad4", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "WESTUS:20230214T020216Z:b1fcccf8-9dfa-47f8-b7c1-3b70d5715ad4" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/46AC009837621187", + "operationId": "46AC009837621187", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:02:15.670642Z", + "duration": "PT19.8869883S", + "trackingId": "c3f1443f-69ad-4410-bd2f-a26f81a434b3", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:55.6683387Z", + "duration": "PT21.5191266S", + "trackingId": "b35b329e-f000-49d0-9cf8-fd9f34501b49", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:52.4835006Z", + "duration": "PT18.279948S", + "trackingId": "bbc9bc0c-125e-4559-b6a6-9489b102e969", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/08585252667935573910", + "operationId": "08585252667935573910", + "properties": { + "provisioningOperation": "EvaluateDeploymentOutput", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:02:15.9151614Z", + "duration": "PT20.1315077S", + "trackingId": "80729ce9-1258-4ad7-b330-2d7bd1cf514d", + "statusCode": "OK" + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operationStatuses/08585252667935573910?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "22", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:20 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "61fc4368-c6f9-415e-b640-a844411d9be0", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "WESTUS:20230214T020221Z:61fc4368-c6f9-415e-b640-a844411d9be0" + }, + "ResponseBody": { + "status": "Succeeded" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "9182", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:21 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "7f99a2e1-654f-49e2-a2c2-7d4a5a80c921", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "WESTUS:20230214T020221Z:7f99a2e1-654f-49e2-a2c2-7d4a5a80c921" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211", + "name": "e2etest_test_107835267768_mvnet-9808211", + "type": "Microsoft.Resources/deployments", + "properties": { + "templateHash": "4984303229931942319", + "parameters": { + "workspaceName": { + "type": "String", + "value": "e2etest_test_107835267768_mvnet" + }, + "description": { + "type": "String", + "value": "e2etest_test_107835267768_mvnet description" + }, + "friendlyName": { + "type": "String", + "value": "e2etest_test_107835267768_mvnet display name" + }, + "location": { + "type": "String", + "value": "centraluseuap" + }, + "resourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountOption": { + "type": "String", + "value": "new" + }, + "storageAccountName": { + "type": "String", + "value": "e2etesttstorageb531f7932" + }, + "storageAccountType": { + "type": "String", + "value": "Standard_LRS" + }, + "storageAccountBehindVNet": { + "type": "String", + "value": "false" + }, + "storageAccountResourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountLocation": { + "type": "String", + "value": "centraluseuap" + }, + "keyVaultOption": { + "type": "String", + "value": "new" + }, + "keyVaultName": { + "type": "String", + "value": "e2etesttkeyvault26bfe970" + }, + "keyVaultBehindVNet": { + "type": "String", + "value": "false" + }, + "keyVaultResourceGroupName": { + "type": "String", + "value": "00000" + }, + "keyVaultLocation": { + "type": "String", + "value": "centraluseuap" + }, + "applicationInsightsOption": { + "type": "String", + "value": "new" + }, + "applicationInsightsName": { + "type": "String", + "value": "e2etesttinsightscd822d4f" + }, + "applicationInsightsResourceGroupName": { + "type": "String", + "value": "00000" + }, + "applicationInsightsLocation": { + "type": "String", + "value": "centraluseuap" + }, + "containerRegistryOption": { + "type": "String", + "value": "none" + }, + "containerRegistryName": { + "type": "String", + "value": "name" + }, + "containerRegistrySku": { + "type": "String", + "value": "Standard" + }, + "containerRegistryResourceGroupName": { + "type": "String", + "value": "" + }, + "containerRegistryBehindVNet": { + "type": "String", + "value": "false" + }, + "containerRegistryLocation": { + "type": "String", + "value": "centraluseuap" + }, + "vnetOption": { + "type": "String", + "value": "existing" + }, + "vnetName": { + "type": "String", + "value": "name" + }, + "vnetResourceGroupName": { + "type": "String", + "value": "name" + }, + "addressPrefixes": { + "type": "Array", + "value": [ + "10.0.0.0/16" + ] + }, + "subnetOption": { + "type": "String", + "value": "existing" + }, + "subnetName": { + "type": "String", + "value": "default" + }, + "subnetPrefix": { + "type": "String", + "value": "10.0.0.0/24" + }, + "adbWorkspace": { + "type": "String", + "value": "" + }, + "confidential_data": { + "type": "String", + "value": "false" + }, + "encryption_status": { + "type": "String", + "value": "Disabled" + }, + "cmk_keyvault": { + "type": "String", + "value": "" + }, + "resource_cmk_uri": { + "type": "String", + "value": "" + }, + "privateEndpointType": { + "type": "String", + "value": "none" + }, + "tagValues": { + "type": "Object", + "value": { + "createdByToolkit": "sdk-v2-1.5.0" + } + }, + "privateEndpointName": { + "type": "String", + "value": "name" + }, + "privateEndpointResourceGroupName": { + "type": "String", + "value": "name" + }, + "imageBuildCompute": { + "type": "String", + "value": "" + }, + "publicNetworkAccess": { + "type": "String", + "value": "Enabled" + }, + "soft_delete_enabled": { + "type": "String", + "value": "false" + }, + "allow_recover_softdeleted_workspace": { + "type": "String", + "value": "false" + }, + "encryption_cosmosdb_resourceid": { + "type": "String", + "value": "" + }, + "encryption_storage_resourceid": { + "type": "String", + "value": "" + }, + "encryption_search_resourceid": { + "type": "String", + "value": "" + }, + "identity": { + "type": "Object", + "value": { + "type": "SystemAssigned" + } + }, + "primaryUserAssignedIdentity": { + "type": "String", + "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "AllowOnlyApprovedOutbound", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "category": "UserDefined", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + } + }, + "my-storage": { + "type": "PrivateEndpoint", + "category": "UserDefined", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + } + }, + "pytorch": { + "type": "FQDN", + "category": "UserDefined", + "destination": "*.pytorch.org" + } + } + } + } + }, + "mode": "Incremental", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:02:15.9409605Z", + "duration": "PT42.3786528S", + "correlationId": "bd4bc77b-dec0-4a9f-8116-bfecf5fdecee", + "providers": [ + { + "namespace": "Microsoft.Storage", + "resourceTypes": [ + { + "resourceType": "storageAccounts", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.KeyVault", + "resourceTypes": [ + { + "resourceType": "vaults", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.Insights", + "resourceTypes": [ + { + "resourceType": "components", + "locations": [ + "southcentralus" + ] + } + ] + }, + { + "namespace": "Microsoft.MachineLearningServices", + "resourceTypes": [ + { + "resourceType": "workspaces", + "locations": [ + "centraluseuap" + ] + } + ] + } + ], + "dependencies": [ + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name", + "resourceType": "Microsoft.Network/virtualNetworks", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/name/providers/Microsoft.Resources/deployments/DeployPrivateEndpoint-q2xi2ah3t47py", + "resourceType": "Microsoft.Resources/deployments", + "resourceName": "DeployPrivateEndpoint-q2xi2ah3t47py" + } + ], + "outputResources": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932" + } + ] + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3288", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:21 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "e091169a-0e84-4ce0-94c2-20f69e5cf606", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-routing-request-id": "WESTUS:20230214T020221Z:e091169a-0e84-4ce0-94c2-20f69e5cf606" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/46AC009837621187", + "operationId": "46AC009837621187", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:02:15.670642Z", + "duration": "PT19.8869883S", + "trackingId": "c3f1443f-69ad-4410-bd2f-a26f81a434b3", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:55.6683387Z", + "duration": "PT21.5191266S", + "trackingId": "b35b329e-f000-49d0-9cf8-fd9f34501b49", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:52.4835006Z", + "duration": "PT18.279948S", + "trackingId": "bbc9bc0c-125e-4559-b6a6-9489b102e969", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/08585252667935573910", + "operationId": "08585252667935573910", + "properties": { + "provisioningOperation": "EvaluateDeploymentOutput", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:02:15.9151614Z", + "duration": "PT20.1315077S", + "trackingId": "80729ce9-1258-4ad7-b330-2d7bd1cf514d", + "statusCode": "OK" + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_107835267768_mvnet-9808211/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3288", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:22 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "941d0a05-ef89-461d-93a3-1606ce24cacc", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-routing-request-id": "WESTUS:20230214T020222Z:941d0a05-ef89-461d-93a3-1606ce24cacc" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/46AC009837621187", + "operationId": "46AC009837621187", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:02:15.670642Z", + "duration": "PT19.8869883S", + "trackingId": "c3f1443f-69ad-4410-bd2f-a26f81a434b3", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_107835267768_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/65E47DEACE0860F0", + "operationId": "65E47DEACE0860F0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:55.6683387Z", + "duration": "PT21.5191266S", + "trackingId": "b35b329e-f000-49d0-9cf8-fd9f34501b49", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorageb531f7932" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/667EDD2BE5A9C5C0", + "operationId": "667EDD2BE5A9C5C0", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:52.4835006Z", + "duration": "PT18.279948S", + "trackingId": "bbc9bc0c-125e-4559-b6a6-9489b102e969", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault26bfe970", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault26bfe970" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/DB04996D1F2E522B", + "operationId": "DB04996D1F2E522B", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:01:36.7350258Z", + "duration": "PT2.5858137S", + "trackingId": "1b5f2bac-41b6-4dab-b610-1be00ee0c65f", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightscd822d4f", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightscd822d4f" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_107835267768_mvnet-9808211/operations/08585252667935573910", + "operationId": "08585252667935573910", + "properties": { + "provisioningOperation": "EvaluateDeploymentOutput", + "provisioningState": "Succeeded", + "timestamp": "2023-02-14T02:02:15.9151614Z", + "duration": "PT20.1315077S", + "trackingId": "80729ce9-1258-4ad7-b330-2d7bd1cf514d", + "statusCode": "OK" + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:22 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-490ca10ae0c0120ca11ba1733df402b7-6796eb376f206dff-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "d72e0e21-b14e-45c7-96f6-075d14d876a3", + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020222Z:d72e0e21-b14e-45c7-96f6-075d14d876a3", + "x-request-time": "0.020" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "name": "e2etest_test_107835267768_mvnet", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "centraluseuap", + "tags": { + "createdByToolkit": "sdk-v2-1.5.0" + }, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_107835267768_mvnet display name", + "description": "e2etest_test_107835267768_mvnet description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault26bfe970", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightscd822d4f", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "networkId": "98b769ca-02b8-4858-84bc-8d0199154a5f", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault26bfe970_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault26bfe970", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorageb531f7932_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorageb531f7932_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-14T02:01:56.5955600Z", + "notebookInfo": { + "resourceId": "dc397e66cb214567abcab963d15acdf1", + "fqdn": "ml-e2etestte-centraluseuap-98b769ca-02b8-4858-84bc-8d0199154a5f.centraluseuap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "98b769ca-02b8-4858-84bc-8d0199154a5f", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://master.api.azureml-test.ms/discovery", + "mlFlowTrackingUri": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "sdkTelemetryAppInsightsKey": "efed27c9-e6dc-4190-9989-79f9b7f3a4b7", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "96c34e67-46c0-4cd6-a133-a68584f56079", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-14T02:01:56.59556Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-14T02:01:56.59556Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:23 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-2c6d399e64a0fd583cc0098c47a532d1-5d11cb3c22107d61-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "ffebaa62-8ce4-4802-aba3-763c47251a78", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020223Z:ffebaa62-8ce4-4802-aba3-763c47251a78", + "x-request-time": "0.023" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "name": "e2etest_test_107835267768_mvnet", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "centraluseuap", + "tags": { + "createdByToolkit": "sdk-v2-1.5.0" + }, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_107835267768_mvnet display name", + "description": "e2etest_test_107835267768_mvnet description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault26bfe970", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightscd822d4f", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "networkId": "98b769ca-02b8-4858-84bc-8d0199154a5f", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault26bfe970_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault26bfe970", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorageb531f7932_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorageb531f7932_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-14T02:01:56.5955600Z", + "notebookInfo": { + "resourceId": "dc397e66cb214567abcab963d15acdf1", + "fqdn": "ml-e2etestte-centraluseuap-98b769ca-02b8-4858-84bc-8d0199154a5f.centraluseuap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "98b769ca-02b8-4858-84bc-8d0199154a5f", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://master.api.azureml-test.ms/discovery", + "mlFlowTrackingUri": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "sdkTelemetryAppInsightsKey": "e31c22bb-e424-4992-a495-6519750e273a", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "96c34e67-46c0-4cd6-a133-a68584f56079", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-14T02:01:56.59556Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-14T02:01:56.59556Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:23 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-ab620abb98a48268ae8e936fa8a7785f-7816d6643b4d915c-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0c590cb8-12fc-425a-a243-0c5a9e0672bb", + "x-ms-ratelimit-remaining-subscription-reads": "11983", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020223Z:0c590cb8-12fc-425a-a243-0c5a9e0672bb", + "x-request-time": "0.025" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "name": "e2etest_test_107835267768_mvnet", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "centraluseuap", + "tags": { + "createdByToolkit": "sdk-v2-1.5.0" + }, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_107835267768_mvnet display name", + "description": "e2etest_test_107835267768_mvnet description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault26bfe970", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightscd822d4f", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "networkId": "98b769ca-02b8-4858-84bc-8d0199154a5f", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault26bfe970_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault26bfe970", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorageb531f7932_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorageb531f7932_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-14T02:01:56.5955600Z", + "notebookInfo": { + "resourceId": "dc397e66cb214567abcab963d15acdf1", + "fqdn": "ml-e2etestte-centraluseuap-98b769ca-02b8-4858-84bc-8d0199154a5f.centraluseuap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "98b769ca-02b8-4858-84bc-8d0199154a5f", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://master.api.azureml-test.ms/discovery", + "mlFlowTrackingUri": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet", + "sdkTelemetryAppInsightsKey": "e31c22bb-e424-4992-a495-6519750e273a", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "96c34e67-46c0-4cd6-a133-a68584f56079", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-14T02:01:56.59556Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-14T02:01:56.59556Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/3a782421-0dbe-4ade-a3c8-ece5115ecc0f?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:26 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", + "Server-Timing": "traceparent;desc=\u002200-479a53c292d185b9d8e8ef3a2c9c5231-5cfd68e2bea81ef5-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-eastus2euap-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "6a55f27e-6b26-423e-9024-ea4c77b618ff", + "x-ms-ratelimit-remaining-subscription-reads": "11893", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020226Z:6a55f27e-6b26-423e-9024-ea4c77b618ff", + "x-request-time": "0.025" + }, + "ResponseBody": { + "status": "InProgress" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightscd822d4f?api-version=2015-05-01", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "Request-Context", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Tue, 14 Feb 2023 02:02:29 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:7f83c1fe-8c94-4d55-9337-4ddc696f61ed", + "Server": "Microsoft-IIS/10.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "42d7617d-d099-4a51-969e-bd89ec080ecc", + "x-ms-ratelimit-remaining-subscription-deletes": "14999", + "x-ms-routing-request-id": "WESTUS:20230214T020229Z:42d7617d-d099-4a51-969e-bd89ec080ecc", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorageb531f7932?api-version=2019-06-01", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Content-Type": "text/plain; charset=utf-8", + "Date": "Tue, 14 Feb 2023 02:02:34 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8a128c2a-20b2-4133-b918-061f9486d546", + "x-ms-ratelimit-remaining-subscription-deletes": "14998", + "x-ms-routing-request-id": "WESTUS:20230214T020234Z:8a128c2a-20b2-4133-b918-061f9486d546" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault26bfe970?api-version=2019-09-01", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Tue, 14 Feb 2023 02:02:38 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-IIS/10.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-AspNet-Version": "4.0.30319", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "ab70005e-c418-4758-ac56-793f4bfb7e77", + "x-ms-keyvault-service-version": "1.5.666.2", + "x-ms-ratelimit-remaining-subscription-deletes": "14997", + "x-ms-routing-request-id": "WESTUS:20230214T020238Z:ab70005e-c418-4758-ac56-793f4bfb7e77", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_107835267768_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "azure-asyncoperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/ce01079c-2318-49e7-a6a4-95fc4b3ac6a3?api-version=2022-12-01-preview\u0026type=async", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Tue, 14 Feb 2023 02:02:38 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/ce01079c-2318-49e7-a6a4-95fc4b3ac6a3?api-version=2022-12-01-preview\u0026type=location", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0440a8f3-99c2-4bba-ab3c-a35af8e9ceb9", + "x-ms-ratelimit-remaining-subscription-deletes": "14996", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS:20230214T020239Z:0440a8f3-99c2-4bba-ab3c-a35af8e9ceb9", + "x-request-time": "0.094" + }, + "ResponseBody": null + } + ], + "Variables": { + "deployment_name": "e2etest_test_107835267768_mvnet-9808211", + "insights_name": "e2etesttinsightscd822d4f", + "keyvault_name": "e2etesttkeyvault26bfe970", + "storage_name": "e2etesttstorageb531f7932", + "wps_name": "test_107835267768" + } +} diff --git a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_diagnosis.json b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_diagnosis.json index 7ecd6e6db635..c8b2ca9d8cd4 100644 --- a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_diagnosis.json +++ b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace.pyTestWorkspacetest_workspace_diagnosis.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/diagnose?api-version=2022-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/diagnose?api-version=2022-12-01-preview", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -9,7 +9,7 @@ "Connection": "keep-alive", "Content-Length": "13", "Content-Type": "application/json", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": { "value": {} @@ -18,61 +18,61 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:34:43 GMT", + "Date": "Tue, 14 Feb 2023 01:57:06 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/westus3/workspaceOperationsStatus/4eeacf50-3caa-473a-9a91-351116f1af45?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/workspaceOperationsStatus/d4e73d06-5b9e-417d-9ea2-93efcabb765a?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:2d2e8e63-272e-4b3c-8598-4ee570a0e70d", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-westus3-02", + "x-aml-cluster": "vienna-eastus-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "cc20a182-7d97-430d-aa2b-3047bbc27cf1", - "x-ms-ratelimit-remaining-subscription-reads": "11944", + "x-ms-correlation-request-id": "e2cff727-1361-4522-9c80-605aa293b759", + "x-ms-ratelimit-remaining-subscription-reads": "11967", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063443Z:cc20a182-7d97-430d-aa2b-3047bbc27cf1", - "x-request-time": "0.138" + "x-ms-routing-request-id": "WESTUS:20230214T015707Z:e2cff727-1361-4522-9c80-605aa293b759", + "x-request-time": "0.251" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/westus3/workspaceOperationsStatus/4eeacf50-3caa-473a-9a91-351116f1af45?api-version=2022-10-01-preview\u0026type=location", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/workspaceOperationsStatus/d4e73d06-5b9e-417d-9ea2-93efcabb765a?api-version=2022-12-01-preview\u0026type=location", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/westus3/workspaceOperationsStatus/4eeacf50-3caa-473a-9a91-351116f1af45?api-version=2022-10-01-preview\u0026type=async", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/workspaceOperationsStatus/d4e73d06-5b9e-417d-9ea2-93efcabb765a?api-version=2022-12-01-preview\u0026type=async", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Tue, 31 Jan 2023 06:34:43 GMT", + "Date": "Tue, 14 Feb 2023 01:57:07 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/westus3/workspaceOperationsStatus/4eeacf50-3caa-473a-9a91-351116f1af45?api-version=2022-10-01-preview\u0026type=location", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/workspaceOperationsStatus/d4e73d06-5b9e-417d-9ea2-93efcabb765a?api-version=2022-12-01-preview\u0026type=location", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:2d2e8e63-272e-4b3c-8598-4ee570a0e70d", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "x-aml-cluster": "vienna-westus3-02", + "x-aml-cluster": "vienna-eastus-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9ccb2c13-8f65-451b-86db-1a177dd70e9a", - "x-ms-ratelimit-remaining-subscription-reads": "11943", + "x-ms-correlation-request-id": "b0bad784-2dc0-4aba-be13-f5fab533ccb4", + "x-ms-ratelimit-remaining-subscription-reads": "11966", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063443Z:9ccb2c13-8f65-451b-86db-1a177dd70e9a", - "x-request-time": "0.026" + "x-ms-routing-request-id": "WESTUS:20230214T015707Z:b0bad784-2dc0-4aba-be13-f5fab533ccb4", + "x-request-time": "0.017" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus2euap/workspaceOperationsStatus/7ddd3d3e-ff21-4fbd-a7cb-fb921ccb16ec?api-version=2022-10-01-preview\u0026type=async", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/workspaceOperationsStatus/d4e73d06-5b9e-417d-9ea2-93efcabb765a?api-version=2022-12-01-preview\u0026type=location", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -80,59 +80,24 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:09 GMT", - "Expires": "-1", - "Pragma": "no-cache", - "Request-Context": "appId=cid-v1:17d65b70-e9ce-4ed5-9347-1f660ec782e9", - "Server-Timing": "traceparent;desc=\u002200-949bf17cec71711bf080787b8410ef9d-e05cb60e3efdee18-01\u0022", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", - "x-aml-cluster": "vienna-eastus2euap-02", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "647b1fc7-5d76-4139-8d16-592662100de6", - "x-ms-ratelimit-remaining-subscription-reads": "11942", - "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063510Z:647b1fc7-5d76-4139-8d16-592662100de6", - "x-request-time": "0.026" - }, - "ResponseBody": { - "status": "InProgress" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/westus3/workspaceOperationsStatus/4eeacf50-3caa-473a-9a91-351116f1af45?api-version=2022-10-01-preview\u0026type=location", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azure-ai-ml/1.4.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.7.13 (Windows-10-10.0.19041-SP0)" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Encoding": "gzip", - "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 31 Jan 2023 06:35:13 GMT", + "Date": "Tue, 14 Feb 2023 01:57:37 GMT", "Expires": "-1", "Pragma": "no-cache", "Request-Context": "appId=cid-v1:2d2e8e63-272e-4b3c-8598-4ee570a0e70d", - "Server-Timing": "traceparent;desc=\u002200-75c4075c1477a7182b288f6fa495c4e3-106ca94c409a5245-00\u0022", + "Server-Timing": "traceparent;desc=\u002200-5cdfdc216c7662c855865a66f8696ba0-ea6f23a43eb723fa-01\u0022", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ "Accept-Encoding", "Accept-Encoding" ], - "x-aml-cluster": "vienna-westus3-02", + "x-aml-cluster": "vienna-eastus-02", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "513fed09-5db4-422e-ab88-4b14ee77d9c2", - "x-ms-ratelimit-remaining-subscription-reads": "11941", + "x-ms-correlation-request-id": "b35b11e2-cd6f-49f7-8b67-2e00ef20ff39", + "x-ms-ratelimit-remaining-subscription-reads": "11965", "x-ms-response-type": "standard", - "x-ms-routing-request-id": "WESTUS2:20230131T063513Z:513fed09-5db4-422e-ab88-4b14ee77d9c2", - "x-request-time": "0.046" + "x-ms-routing-request-id": "WESTUS:20230214T015737Z:b35b11e2-cd6f-49f7-8b67-2e00ef20ff39", + "x-request-time": "0.043" }, "ResponseBody": { "value": { diff --git a/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace_outbound_rule_operations.pyTestWorkspaceOutboundRulestest_workspace_create_with_managed_network_list_show_remove_rules.json b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace_outbound_rule_operations.pyTestWorkspaceOutboundRulestest_workspace_create_with_managed_network_list_show_remove_rules.json new file mode 100644 index 000000000000..7fb37a6efa5c --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/recordings/workspace/e2etests/test_workspace_outbound_rule_operations.pyTestWorkspaceOutboundRulestest_workspace_create_with_managed_network_list_show_remove_rules.json @@ -0,0 +1,5296 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "252", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:12 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "373fe5f4-e570-4732-8c50-01781e8ebbe9", + "x-ms-failure-cause": "gateway", + "x-ms-routing-request-id": "WESTUS2:20230216T214212Z:373fe5f4-e570-4732-8c50-01781e8ebbe9" + }, + "ResponseBody": { + "error": { + "code": "ResourceNotFound", + "message": "The Resource \u0027Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet\u0027 under resource group \u002700000\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/DefaultResourceGroup-southcentralus?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "272", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:13 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "09798c95-340b-455e-bbe3-b6817ccaddf3", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-routing-request-id": "WESTUS2:20230216T214213Z:09798c95-340b-455e-bbe3-b6817ccaddf3" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus", + "name": "DefaultResourceGroup-southcentralus", + "type": "Microsoft.Resources/resourceGroups", + "location": "southcentralus", + "properties": { + "provisioningState": "Succeeded" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus/resources?$filter=substringof%28%27DefaultWorkspace-southcentralus%27%2Cname%29\u0026api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "322", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:14 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "a56d36d7-8c37-47bf-b167-030e17dbee28", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-routing-request-id": "WESTUS2:20230216T214214Z:a56d36d7-8c37-47bf-b167-030e17dbee28" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus/providers/Microsoft.OperationalInsights/workspaces/DefaultWorkspace-southcentralus", + "name": "DefaultWorkspace-southcentralus", + "type": "Microsoft.OperationalInsights/workspaces", + "location": "southcentralus" + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742?api-version=2020-06-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "20214", + "Content-Type": "application/json", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": { + "properties": { + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "workspaceName": { + "type": "string", + "metadata": { + "description": "Specifies the name of the Azure Machine Learning workspace." + } + }, + "description": { + "type": "string", + "metadata": { + "description": "Description string." + } + }, + "friendlyName": { + "type": "string", + "metadata": { + "description": "Friendly name." + } + }, + "location": { + "type": "string", + "metadata": { + "description": "Specifies the location for all resources." + } + }, + "resourceGroupName": { + "type": "string", + "metadata": { + "description": "Specifies the resource group name of the Azure Machine Learning workspace." + } + }, + "storageAccountOption": { + "type": "string", + "defaultValue": "new", + "allowedValues": [ + "new", + "existing" + ], + "metadata": { + "description": "Determines whether or not a new storage should be provisioned." + } + }, + "storageAccountName": { + "type": "string", + "defaultValue": "[concat(\u0027sa\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the storage account." + } + }, + "storageAccountType": { + "type": "string", + "defaultValue": "Standard_LRS" + }, + "storageAccountBehindVNet": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "true", + "false" + ], + "metadata": { + "description": "Determines whether or not to put the storage account behind VNet" + } + }, + "storageAccountResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "storageAccountLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "keyVaultOption": { + "type": "string", + "defaultValue": "new", + "allowedValues": [ + "new", + "existing" + ], + "metadata": { + "description": "Determines whether or not a new key vault should be provisioned." + } + }, + "keyVaultName": { + "type": "string", + "defaultValue": "[concat(\u0027kv\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the key vault." + } + }, + "keyVaultBehindVNet": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "true", + "false" + ], + "metadata": { + "description": "Determines whether or not to put the storage account behind VNet" + } + }, + "keyVaultResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "keyVaultLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "applicationInsightsOption": { + "type": "string", + "defaultValue": "new", + "allowedValues": [ + "new", + "existing" + ], + "metadata": { + "description": "Determines whether or not new ApplicationInsights should be provisioned." + } + }, + "applicationInsightsName": { + "type": "string", + "defaultValue": "[concat(\u0027ai\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of ApplicationInsights." + } + }, + "applicationInsightsResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "applicationInsightsLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "containerRegistryOption": { + "type": "string", + "defaultValue": "none", + "allowedValues": [ + "new", + "existing", + "none" + ], + "metadata": { + "description": "Determines whether or not a new container registry should be provisioned." + } + }, + "containerRegistryName": { + "type": "string", + "defaultValue": "[concat(\u0027cr\u0027, uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "The container registry bind to the workspace." + } + }, + "containerRegistrySku": { + "type": "string", + "defaultValue": "Standard", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "containerRegistryResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "containerRegistryBehindVNet": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "true", + "false" + ], + "metadata": { + "description": "Determines whether or not to put container registry behind VNet." + } + }, + "containerRegistryLocation": { + "type": "string", + "defaultValue": "[parameters(\u0027location\u0027)]" + }, + "vnetOption": { + "type": "string", + "defaultValue": "[if(equals(parameters(\u0027privateEndpointType\u0027), \u0027none\u0027), \u0027none\u0027, \u0027new\u0027)]", + "allowedValues": [ + "new", + "existing", + "none" + ], + "metadata": { + "description": "Determines whether or not a new VNet should be provisioned." + } + }, + "vnetName": { + "type": "string", + "defaultValue": "[concat(\u0027vn\u0027,uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the VNet" + } + }, + "vnetResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]" + }, + "addressPrefixes": { + "type": "array", + "defaultValue": [ + "10.0.0.0/16" + ], + "metadata": { + "description": "Address prefix of the virtual network" + } + }, + "subnetOption": { + "type": "string", + "defaultValue": "[if(or(not(equals(parameters(\u0027privateEndpointType\u0027), \u0027none\u0027)), equals(parameters(\u0027vnetOption\u0027), \u0027new\u0027)), \u0027new\u0027, \u0027none\u0027)]", + "allowedValues": [ + "new", + "existing", + "none" + ], + "metadata": { + "description": "Determines whether or not a new subnet should be provisioned." + } + }, + "subnetName": { + "type": "string", + "defaultValue": "[concat(\u0027sn\u0027,uniqueString(parameters(\u0027resourceGroupName\u0027), parameters(\u0027workspaceName\u0027)))]", + "metadata": { + "description": "Name of the subnet" + } + }, + "subnetPrefix": { + "type": "string", + "defaultValue": "10.0.0.0/24", + "metadata": { + "description": "Subnet prefix of the virtual network" + } + }, + "adbWorkspace": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Azure Databrick workspace to be linked to the workspace" + } + }, + "confidential_data": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "false", + "true" + ], + "metadata": { + "description": "Specifies that the Azure Machine Learning workspace holds highly confidential data." + } + }, + "encryption_status": { + "type": "string", + "defaultValue": "Disabled", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "metadata": { + "description": "Specifies if the Azure Machine Learning workspace should be encrypted with customer managed key." + } + }, + "cmk_keyvault": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Specifies the customer managed keyVault arm id." + } + }, + "resource_cmk_uri": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Specifies if the customer managed keyvault key uri." + } + }, + "privateEndpointType": { + "type": "string", + "defaultValue": "none", + "allowedValues": [ + "AutoApproval", + "ManualApproval", + "none" + ] + }, + "tagValues": { + "type": "object" + }, + "privateEndpointName": { + "type": "string", + "defaultValue": "pe", + "metadata": { + "description": "Name of the private end point added to the workspace" + } + }, + "privateEndpointResourceGroupName": { + "type": "string", + "defaultValue": "[parameters(\u0027resourceGroupName\u0027)]", + "metadata": { + "description": "Name of the resource group where the private end point is added to" + } + }, + "imageBuildCompute": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The name of the compute target to use for building environment Docker images with the container registry is behind a VNet." + } + }, + "publicNetworkAccess": { + "type": "string", + "defaultValue": "Enabled", + "allowedValues": [ + "Disabled", + "Enabled" + ], + "metadata": { + "description": "Whether to allow public endpoint connectivity when a workspace is private link enabled." + } + }, + "soft_delete_enabled": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "false", + "true" + ], + "metadata": { + "description": "Whether to create a workspace with soft delete capability" + } + }, + "allow_recover_softdeleted_workspace": { + "type": "string", + "defaultValue": "false", + "allowedValues": [ + "false", + "true" + ], + "metadata": { + "description": "Whether to allow an existing soft-deleted workspace to be recovered" + } + }, + "encryption_cosmosdb_resourceid": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The Bring-Your-Own cosmosdb account that customer brings to store data" + } + }, + "encryption_storage_resourceid": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The Bring-Your-Own storage account that customer brings to store data" + } + }, + "encryption_search_resourceid": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The Bring-Your-Own search account that customer brings to store data" + } + }, + "identity": { + "type": "object", + "defaultValue": { + "type": "systemAssigned" + }, + "metadata": { + "description": "Managed identities assigned to workspace. If not specificed, SystemAssigned managed identity is the default." + } + }, + "primaryUserAssignedIdentity": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "ARM identifier of primary user assigned managed identity, in case multiple ones are specified. Also the default managed identity for clusterless compute." + } + }, + "managedNetwork": { + "type": "object", + "defaultValue": { + "isolationMode": "Disabled" + }, + "metadata": { + "description": "Managed network settings to be used for the workspace. If not specified, isolation mode Disabled is the default" + } + } + }, + "variables": { + "tenantId": "[subscription().tenantId]", + "storageAccount": "[resourceId(parameters(\u0027storageAccountResourceGroupName\u0027), \u0027Microsoft.Storage/storageAccounts\u0027, parameters(\u0027storageAccountName\u0027))]", + "keyVault": "[resourceId(parameters(\u0027keyVaultResourceGroupName\u0027), \u0027Microsoft.KeyVault/vaults\u0027, parameters(\u0027keyVaultName\u0027))]", + "containerRegistry": "[resourceId(parameters(\u0027containerRegistryResourceGroupName\u0027), \u0027Microsoft.ContainerRegistry/registries\u0027, parameters(\u0027containerRegistryName\u0027))]", + "applicationInsights": "[resourceId(parameters(\u0027applicationInsightsResourceGroupName\u0027), \u0027Microsoft.Insights/components\u0027, parameters(\u0027applicationInsightsName\u0027))]", + "vnet": "[resourceId(parameters(\u0027vnetResourceGroupName\u0027), \u0027Microsoft.Network/virtualNetworks\u0027, parameters(\u0027vnetName\u0027))]", + "subnet": "[resourceId(parameters(\u0027vnetResourceGroupName\u0027), \u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]", + "enablePE": true, + "networkRuleSetBehindVNet": { + "defaultAction": "deny", + "virtualNetworkRules": [ + { + "action": "Allow", + "id": "[variables(\u0027subnet\u0027)]" + } + ] + }, + "privateEndpointSettings": { + "name": "[concat(parameters(\u0027workspaceName\u0027), \u0027-PrivateEndpoint\u0027)]", + "properties": { + "privateLinkServiceId": "[resourceId(\u0027Microsoft.MachineLearningServices/workspaces\u0027, parameters(\u0027workspaceName\u0027))]", + "groupIds": [ + "amlworkspace" + ] + } + }, + "defaultPEConnections": "[array(variables(\u0027privateEndpointSettings\u0027))]", + "privateEndpointDeploymentName": "[concat(\u0027DeployPrivateEndpoint-\u0027, uniqueString(parameters(\u0027privateEndpointName\u0027)))]" + }, + "resources": [ + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027vnetOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2019-09-01", + "name": "[parameters(\u0027vnetName\u0027)]", + "location": "[parameters(\u0027location\u0027)]", + "tags": "[parameters(\u0027tagValues\u0027)]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters(\u0027addressPrefixes\u0027)]" + }, + "enableDdosProtection": false, + "enableVmProtection": false + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027subnetOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Network/virtualNetworks/subnets", + "apiVersion": "2019-09-01", + "name": "[concat(parameters(\u0027vnetName\u0027), \u0027/\u0027, parameters(\u0027subnetName\u0027))]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks\u0027, parameters(\u0027vnetName\u0027))]" + ], + "properties": { + "addressPrefix": "[parameters(\u0027subnetPrefix\u0027)]", + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled", + "serviceEndpoints": [ + { + "service": "Microsoft.Storage" + }, + { + "service": "Microsoft.KeyVault" + }, + { + "service": "Microsoft.ContainerRegistry" + } + ] + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027storageAccountOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2019-04-01", + "name": "[parameters(\u0027storageAccountName\u0027)]", + "tags": "[parameters(\u0027tagValues\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "location": "[parameters(\u0027storageAccountLocation\u0027)]", + "sku": { + "name": "[parameters(\u0027storageAccountType\u0027)]" + }, + "kind": "StorageV2", + "properties": { + "encryption": { + "services": { + "blob": { + "enabled": true + }, + "file": { + "enabled": true + } + }, + "keySource": "Microsoft.Storage" + }, + "supportsHttpsTrafficOnly": true, + "allowBlobPublicAccess": false, + "networkAcls": "[if(equals(parameters(\u0027storageAccountBehindVNet\u0027), \u0027true\u0027), variables(\u0027networkRuleSetBehindVNet\u0027), json(\u0027null\u0027))]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027keyVaultOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.KeyVault/vaults", + "apiVersion": "2019-09-01", + "tags": "[parameters(\u0027tagValues\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "name": "[parameters(\u0027keyVaultName\u0027)]", + "location": "[parameters(\u0027keyVaultLocation\u0027)]", + "properties": { + "tenantId": "[variables(\u0027tenantId\u0027)]", + "sku": { + "name": "standard", + "family": "A" + }, + "accessPolicies": [], + "networkAcls": "[if(equals(parameters(\u0027keyVaultBehindVNet\u0027), \u0027true\u0027), variables(\u0027networkRuleSetBehindVNet\u0027), json(\u0027null\u0027))]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027containerRegistryOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.ContainerRegistry/registries", + "apiVersion": "2019-05-01", + "tags": "[parameters(\u0027tagValues\u0027)]", + "name": "[parameters(\u0027containerRegistryName\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "location": "[parameters(\u0027containerRegistryLocation\u0027)]", + "sku": { + "name": "[parameters(\u0027containerRegistrySku\u0027)]" + }, + "properties": { + "adminUserEnabled": true, + "networkRuleSet": "[if(equals(parameters(\u0027containerRegistryBehindVNet\u0027), \u0027true\u0027), variables(\u0027networkRuleSetBehindVNet\u0027), json(\u0027null\u0027))]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), equals(parameters(\u0027applicationInsightsOption\u0027), \u0027new\u0027))]", + "type": "Microsoft.Insights/components", + "tags": "[parameters(\u0027tagValues\u0027)]", + "apiVersion": "2020-02-02-preview", + "name": "[parameters(\u0027applicationInsightsName\u0027)]", + "location": "[if(or(equals(toLower(parameters(\u0027applicationInsightsLocation\u0027)),\u0027westcentralus\u0027), equals(toLower(parameters(\u0027applicationInsightsLocation\u0027)),\u0027eastus2euap\u0027), equals(toLower(parameters(\u0027applicationInsightsLocation\u0027)),\u0027centraluseuap\u0027)),\u0027southcentralus\u0027, parameters(\u0027applicationInsightsLocation\u0027))]", + "kind": "web", + "properties": { + "Application_Type": "web", + "WorkspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/DefaultResourceGroup-southcentralus/providers/Microsoft.OperationalInsights/workspaces/DefaultWorkspace-southcentralus" + } + }, + { + "condition": "[variables(\u0027enablePE\u0027)]", + "type": "Microsoft.MachineLearningServices/workspaces", + "apiVersion": "2022-12-01-preview", + "tags": "[parameters(\u0027tagValues\u0027)]", + "name": "[parameters(\u0027workspaceName\u0027)]", + "location": "[parameters(\u0027location\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.Storage/storageAccounts\u0027, parameters(\u0027storageAccountName\u0027))]", + "[resourceId(\u0027Microsoft.KeyVault/vaults\u0027, parameters(\u0027keyVaultName\u0027))]", + "[resourceId(\u0027Microsoft.Insights/components\u0027, parameters(\u0027applicationInsightsName\u0027))]", + "[resourceId(\u0027Microsoft.ContainerRegistry/registries\u0027, parameters(\u0027containerRegistryName\u0027))]" + ], + "identity": "[parameters(\u0027identity\u0027)]", + "properties": { + "friendlyName": "[parameters(\u0027friendlyName\u0027)]", + "description": "[parameters(\u0027description\u0027)]", + "storageAccount": "[variables(\u0027storageAccount\u0027)]", + "keyVault": "[variables(\u0027keyVault\u0027)]", + "applicationInsights": "[variables(\u0027applicationInsights\u0027)]", + "containerRegistry": "[if(not(equals(parameters(\u0027containerRegistryOption\u0027), \u0027none\u0027)), variables(\u0027containerRegistry\u0027), json(\u0027null\u0027))]", + "hbiWorkspace": "[parameters(\u0027confidential_data\u0027)]", + "imageBuildCompute": "[parameters(\u0027imageBuildCompute\u0027)]", + "publicNetworkAccess": "[parameters(\u0027publicNetworkAccess\u0027)]", + "softDeleteEnabled": "[parameters(\u0027soft_delete_enabled\u0027)]", + "allowRecoverSoftDeletedWorkspace": "[parameters(\u0027allow_recover_softdeleted_workspace\u0027)]", + "encryption": { + "status": "[parameters(\u0027encryption_status\u0027)]", + "keyVaultProperties": { + "keyVaultArmId": "[parameters(\u0027cmk_keyvault\u0027)]", + "keyIdentifier": "[parameters(\u0027resource_cmk_uri\u0027)]" + }, + "cosmosDbArmId": "[parameters(\u0027encryption_cosmosdb_resourceid\u0027)]", + "storageAccountArmId": "[parameters(\u0027encryption_storage_resourceid\u0027)]", + "SearchAccountArmId": "[parameters(\u0027encryption_search_resourceid\u0027)]" + }, + "primaryUserAssignedIdentity": "[parameters(\u0027primaryUserAssignedIdentity\u0027)]", + "managedNetwork": "[parameters(\u0027managedNetwork\u0027)]" + } + }, + { + "condition": "[and(variables(\u0027enablePE\u0027), not(equals(parameters(\u0027privateEndpointType\u0027), \u0027none\u0027)))]", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2020-06-01", + "name": "[variables(\u0027privateEndpointDeploymentName\u0027)]", + "resourceGroup": "[parameters(\u0027privateEndpointResourceGroupName\u0027)]", + "dependsOn": [ + "[resourceId(\u0027Microsoft.MachineLearningServices/workspaces\u0027, parameters(\u0027workspaceName\u0027))]", + "[resourceId(\u0027Microsoft.Network/virtualNetworks/subnets\u0027, parameters(\u0027vnetName\u0027), parameters(\u0027subnetName\u0027))]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "apiVersion": "2020-06-01", + "name": "[parameters(\u0027privateEndpointName\u0027)]", + "type": "Microsoft.Network/privateEndpoints", + "location": "[parameters(\u0027location\u0027)]", + "tags": "[parameters(\u0027tagValues\u0027)]", + "properties": { + "privateLinkServiceConnections": "[if(equals(parameters(\u0027privateEndpointType\u0027), \u0027AutoApproval\u0027), variables(\u0027defaultPEConnections\u0027), json(\u0027null\u0027))]", + "manualPrivateLinkServiceConnections": "[if(equals(parameters(\u0027privateEndpointType\u0027), \u0027ManualApproval\u0027), variables(\u0027defaultPEConnections\u0027), json(\u0027null\u0027))]", + "subnet": { + "id": "[variables(\u0027subnet\u0027)]" + } + } + } + ] + } + } + } + ] + }, + "parameters": { + "location": { + "value": "centraluseuap" + }, + "workspaceName": { + "value": "e2etest_test_61391569992_mvnet" + }, + "resourceGroupName": { + "value": "00000" + }, + "description": { + "value": "e2etest_test_61391569992_mvnet description" + }, + "friendlyName": { + "value": "e2etest_test_61391569992_mvnet display name" + }, + "tagValues": { + "value": { + "createdByToolkit": "sdk-v2-1.5.0" + } + }, + "keyVaultOption": { + "value": "new" + }, + "keyVaultName": { + "value": "e2etesttkeyvault653823e0" + }, + "keyVaultResourceGroupName": { + "value": "00000" + }, + "storageAccountOption": { + "value": "new" + }, + "storageAccountName": { + "value": "e2etesttstorage69282feeb" + }, + "storageAccountResourceGroupName": { + "value": "00000" + }, + "applicationInsightsOption": { + "value": "new" + }, + "applicationInsightsName": { + "value": "e2etesttinsightsc0ab7654" + }, + "applicationInsightsResourceGroupName": { + "value": "00000" + }, + "containerRegistryOption": { + "value": "none" + }, + "containerRegistryName": { + "value": "name" + }, + "containerRegistryResourceGroupName": { + "value": "" + }, + "encryption_status": { + "value": "Disabled" + }, + "cmk_keyvault": { + "value": "" + }, + "resource_cmk_uri": { + "value": "" + }, + "privateEndpointName": { + "value": "name" + }, + "subnetOption": { + "value": "existing" + }, + "subnetName": { + "value": "default" + }, + "vnetOption": { + "value": "existing" + }, + "vnetName": { + "value": "name" + }, + "vnetResourceGroupName": { + "value": "name" + }, + "privateEndpointType": { + "value": "none" + }, + "privateEndpointResourceGroupName": { + "value": "name" + }, + "confidential_data": { + "value": "false" + }, + "imageBuildCompute": { + "value": "" + }, + "publicNetworkAccess": { + "value": "Enabled" + }, + "soft_delete_enabled": { + "value": "false" + }, + "allow_recover_softdeleted_workspace": { + "value": "false" + }, + "encryption_cosmosdb_resourceid": { + "value": "" + }, + "encryption_storage_resourceid": { + "value": "" + }, + "encryption_search_resourceid": { + "value": "" + }, + "identity": { + "value": { + "type": "SystemAssigned" + } + }, + "primaryUserAssignedIdentity": { + "value": "" + }, + "managedNetwork": { + "value": { + "isolationMode": "AllowOnlyApprovedOutbound", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "category": "UserDefined", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + } + }, + "my-storage": { + "type": "PrivateEndpoint", + "category": "UserDefined", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + } + }, + "pytorch": { + "type": "FQDN", + "category": "UserDefined", + "destination": "*.pytorch.org" + } + } + } + } + }, + "mode": "incremental" + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "Cache-Control": "no-cache", + "Content-Length": "8553", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:18 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "4823dd49-35d3-4ef0-b0d8-163bd75918d8", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-routing-request-id": "WESTUS2:20230216T214218Z:4823dd49-35d3-4ef0-b0d8-163bd75918d8" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742", + "name": "e2etest_test_61391569992_mvnet-3705742", + "type": "Microsoft.Resources/deployments", + "properties": { + "templateHash": "4984303229931942319", + "parameters": { + "workspaceName": { + "type": "String", + "value": "e2etest_test_61391569992_mvnet" + }, + "description": { + "type": "String", + "value": "e2etest_test_61391569992_mvnet description" + }, + "friendlyName": { + "type": "String", + "value": "e2etest_test_61391569992_mvnet display name" + }, + "location": { + "type": "String", + "value": "centraluseuap" + }, + "resourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountOption": { + "type": "String", + "value": "new" + }, + "storageAccountName": { + "type": "String", + "value": "e2etesttstorage69282feeb" + }, + "storageAccountType": { + "type": "String", + "value": "Standard_LRS" + }, + "storageAccountBehindVNet": { + "type": "String", + "value": "false" + }, + "storageAccountResourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountLocation": { + "type": "String", + "value": "centraluseuap" + }, + "keyVaultOption": { + "type": "String", + "value": "new" + }, + "keyVaultName": { + "type": "String", + "value": "e2etesttkeyvault653823e0" + }, + "keyVaultBehindVNet": { + "type": "String", + "value": "false" + }, + "keyVaultResourceGroupName": { + "type": "String", + "value": "00000" + }, + "keyVaultLocation": { + "type": "String", + "value": "centraluseuap" + }, + "applicationInsightsOption": { + "type": "String", + "value": "new" + }, + "applicationInsightsName": { + "type": "String", + "value": "e2etesttinsightsc0ab7654" + }, + "applicationInsightsResourceGroupName": { + "type": "String", + "value": "00000" + }, + "applicationInsightsLocation": { + "type": "String", + "value": "centraluseuap" + }, + "containerRegistryOption": { + "type": "String", + "value": "none" + }, + "containerRegistryName": { + "type": "String", + "value": "name" + }, + "containerRegistrySku": { + "type": "String", + "value": "Standard" + }, + "containerRegistryResourceGroupName": { + "type": "String", + "value": "" + }, + "containerRegistryBehindVNet": { + "type": "String", + "value": "false" + }, + "containerRegistryLocation": { + "type": "String", + "value": "centraluseuap" + }, + "vnetOption": { + "type": "String", + "value": "existing" + }, + "vnetName": { + "type": "String", + "value": "name" + }, + "vnetResourceGroupName": { + "type": "String", + "value": "name" + }, + "addressPrefixes": { + "type": "Array", + "value": [ + "10.0.0.0/16" + ] + }, + "subnetOption": { + "type": "String", + "value": "existing" + }, + "subnetName": { + "type": "String", + "value": "default" + }, + "subnetPrefix": { + "type": "String", + "value": "10.0.0.0/24" + }, + "adbWorkspace": { + "type": "String", + "value": "" + }, + "confidential_data": { + "type": "String", + "value": "false" + }, + "encryption_status": { + "type": "String", + "value": "Disabled" + }, + "cmk_keyvault": { + "type": "String", + "value": "" + }, + "resource_cmk_uri": { + "type": "String", + "value": "" + }, + "privateEndpointType": { + "type": "String", + "value": "none" + }, + "tagValues": { + "type": "Object", + "value": { + "createdByToolkit": "sdk-v2-1.5.0" + } + }, + "privateEndpointName": { + "type": "String", + "value": "name" + }, + "privateEndpointResourceGroupName": { + "type": "String", + "value": "name" + }, + "imageBuildCompute": { + "type": "String", + "value": "" + }, + "publicNetworkAccess": { + "type": "String", + "value": "Enabled" + }, + "soft_delete_enabled": { + "type": "String", + "value": "false" + }, + "allow_recover_softdeleted_workspace": { + "type": "String", + "value": "false" + }, + "encryption_cosmosdb_resourceid": { + "type": "String", + "value": "" + }, + "encryption_storage_resourceid": { + "type": "String", + "value": "" + }, + "encryption_search_resourceid": { + "type": "String", + "value": "" + }, + "identity": { + "type": "Object", + "value": { + "type": "SystemAssigned" + } + }, + "primaryUserAssignedIdentity": { + "type": "String", + "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "AllowOnlyApprovedOutbound", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "category": "UserDefined", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + } + }, + "my-storage": { + "type": "PrivateEndpoint", + "category": "UserDefined", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + } + }, + "pytorch": { + "type": "FQDN", + "category": "UserDefined", + "destination": "*.pytorch.org" + } + } + } + } + }, + "mode": "Incremental", + "provisioningState": "Accepted", + "timestamp": "2023-02-16T21:42:18.2051696Z", + "duration": "PT0.0006296S", + "correlationId": "4823dd49-35d3-4ef0-b0d8-163bd75918d8", + "providers": [ + { + "namespace": "Microsoft.Storage", + "resourceTypes": [ + { + "resourceType": "storageAccounts", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.KeyVault", + "resourceTypes": [ + { + "resourceType": "vaults", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.Insights", + "resourceTypes": [ + { + "resourceType": "components", + "locations": [ + "southcentralus" + ] + } + ] + }, + { + "namespace": "Microsoft.MachineLearningServices", + "resourceTypes": [ + { + "resourceType": "workspaces", + "locations": [ + "centraluseuap" + ] + } + ] + } + ], + "dependencies": [ + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name", + "resourceType": "Microsoft.Network/virtualNetworks", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/name/providers/Microsoft.Resources/deployments/DeployPrivateEndpoint-q2xi2ah3t47py", + "resourceType": "Microsoft.Resources/deployments", + "resourceName": "DeployPrivateEndpoint-q2xi2ah3t47py" + } + ] + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:18 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "3c7f830c-14c9-4119-9334-844af71be246", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-routing-request-id": "WESTUS2:20230216T214219Z:3c7f830c-14c9-4119-9334-844af71be246" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2082", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:23 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2c13003f-b0dd-47df-a52b-7b614041f144", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-routing-request-id": "WESTUS2:20230216T214224Z:2c13003f-b0dd-47df-a52b-7b614041f144" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:23.2607946Z", + "duration": "PT4.2471579S", + "trackingId": "22abb47f-bd82-4955-9deb-9e456be0941b", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:21.9775531Z", + "duration": "PT3.0863042S", + "trackingId": "ffe5885c-7406-46c4-b1f6-afb61a639399", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:23 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0ecffaa5-7fbc-47ac-88af-7f0ddfd14bac", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-routing-request-id": "WESTUS2:20230216T214224Z:0ecffaa5-7fbc-47ac-88af-7f0ddfd14bac" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2082", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:29 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "ec23c90d-6cfe-4a05-b47c-f2e5903bab00", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-routing-request-id": "WESTUS2:20230216T214229Z:ec23c90d-6cfe-4a05-b47c-f2e5903bab00" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:23.2607946Z", + "duration": "PT4.2471579S", + "trackingId": "22abb47f-bd82-4955-9deb-9e456be0941b", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:21.9775531Z", + "duration": "PT3.0863042S", + "trackingId": "ffe5885c-7406-46c4-b1f6-afb61a639399", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:29 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "63a5ff68-7da1-43c4-8085-8f316a9f515a", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-routing-request-id": "WESTUS2:20230216T214229Z:63a5ff68-7da1-43c4-8085-8f316a9f515a" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:34 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "025b5814-7226-45be-be0b-193b214899ea", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "WESTUS2:20230216T214234Z:025b5814-7226-45be-be0b-193b214899ea" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2082", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:34 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "3c9fed95-1c82-4203-8930-9324d9a860ec", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-routing-request-id": "WESTUS2:20230216T214234Z:3c9fed95-1c82-4203-8930-9324d9a860ec" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:23.2607946Z", + "duration": "PT4.2471579S", + "trackingId": "22abb47f-bd82-4955-9deb-9e456be0941b", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:21.9775531Z", + "duration": "PT3.0863042S", + "trackingId": "ffe5885c-7406-46c4-b1f6-afb61a639399", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:39 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "7d1b9395-82dc-4739-88df-e88d86b6ebce", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-routing-request-id": "WESTUS2:20230216T214239Z:7d1b9395-82dc-4739-88df-e88d86b6ebce" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2085", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:39 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "5b1b9c0b-6629-49bf-8259-54fc86ea2321", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "WESTUS2:20230216T214240Z:5b1b9c0b-6629-49bf-8259-54fc86ea2321" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:23.2607946Z", + "duration": "PT4.2471579S", + "trackingId": "22abb47f-bd82-4955-9deb-9e456be0941b", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:38.2030312Z", + "duration": "PT19.3117823S", + "trackingId": "a320757e-de7e-4bdf-a321-82fcc29a5feb", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:44 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "164bf2eb-05d0-4a58-9769-69aed3929836", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "WESTUS2:20230216T214245Z:164bf2eb-05d0-4a58-9769-69aed3929836" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2082", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:45 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "80d8dc62-4987-4320-bc45-f65096862266", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "WESTUS2:20230216T214245Z:80d8dc62-4987-4320-bc45-f65096862266" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:42.9631219Z", + "duration": "PT23.9494852S", + "trackingId": "17f59013-ee2f-4ada-815d-80a14a1354f5", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:38.2030312Z", + "duration": "PT19.3117823S", + "trackingId": "a320757e-de7e-4bdf-a321-82fcc29a5feb", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:49 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8e4edee5-6940-4b8b-9372-865df107b51d", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "WESTUS2:20230216T214250Z:8e4edee5-6940-4b8b-9372-865df107b51d" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2818", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:50 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b7bba76a-72ce-4d7e-84d4-8a182d1ec53d", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-routing-request-id": "WESTUS2:20230216T214250Z:b7bba76a-72ce-4d7e-84d4-8a182d1ec53d" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/B5883120E41F887A", + "operationId": "B5883120E41F887A", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:45.6097502Z", + "duration": "PT2.5971112S", + "trackingId": "59198d3b-6fbe-4c4b-bb05-2081759c2c99", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:42.9631219Z", + "duration": "PT23.9494852S", + "trackingId": "17f59013-ee2f-4ada-815d-80a14a1354f5", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:38.2030312Z", + "duration": "PT19.3117823S", + "trackingId": "a320757e-de7e-4bdf-a321-82fcc29a5feb", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:54 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "26e2703f-8fc0-483b-900e-1ac97061a33e", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-routing-request-id": "WESTUS2:20230216T214255Z:26e2703f-8fc0-483b-900e-1ac97061a33e" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2818", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:42:55 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "92ec4134-97ae-4825-818f-45c5a0a75301", + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-routing-request-id": "WESTUS2:20230216T214256Z:92ec4134-97ae-4825-818f-45c5a0a75301" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/B5883120E41F887A", + "operationId": "B5883120E41F887A", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:45.6097502Z", + "duration": "PT2.5971112S", + "trackingId": "59198d3b-6fbe-4c4b-bb05-2081759c2c99", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:42.9631219Z", + "duration": "PT23.9494852S", + "trackingId": "17f59013-ee2f-4ada-815d-80a14a1354f5", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:38.2030312Z", + "duration": "PT19.3117823S", + "trackingId": "a320757e-de7e-4bdf-a321-82fcc29a5feb", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:00 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "896a2d12-a2ec-456d-be51-0022eacfedbb", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-routing-request-id": "WESTUS2:20230216T214300Z:896a2d12-a2ec-456d-be51-0022eacfedbb" + }, + "ResponseBody": { + "status": "Running" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "2818", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:01 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "dd339115-ed9a-4cd3-9ae7-f139cf2b1874", + "x-ms-ratelimit-remaining-subscription-reads": "11983", + "x-ms-routing-request-id": "WESTUS2:20230216T214301Z:dd339115-ed9a-4cd3-9ae7-f139cf2b1874" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/B5883120E41F887A", + "operationId": "B5883120E41F887A", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Running", + "timestamp": "2023-02-16T21:42:45.6097502Z", + "duration": "PT2.5971112S", + "trackingId": "59198d3b-6fbe-4c4b-bb05-2081759c2c99", + "statusCode": "Accepted", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:42.9631219Z", + "duration": "PT23.9494852S", + "trackingId": "17f59013-ee2f-4ada-815d-80a14a1354f5", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:38.2030312Z", + "duration": "PT19.3117823S", + "trackingId": "a320757e-de7e-4bdf-a321-82fcc29a5feb", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operationStatuses/08585250231489215881?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "22", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:05 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "973780a5-a7e1-4b60-9b86-d0ff738f5340", + "x-ms-ratelimit-remaining-subscription-reads": "11982", + "x-ms-routing-request-id": "WESTUS2:20230216T214305Z:973780a5-a7e1-4b60-9b86-d0ff738f5340" + }, + "ResponseBody": { + "status": "Succeeded" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "9172", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:05 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "9051ed1e-5b98-4c71-b7df-27ef8fcb2403", + "x-ms-ratelimit-remaining-subscription-reads": "11981", + "x-ms-routing-request-id": "WESTUS2:20230216T214306Z:9051ed1e-5b98-4c71-b7df-27ef8fcb2403" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742", + "name": "e2etest_test_61391569992_mvnet-3705742", + "type": "Microsoft.Resources/deployments", + "properties": { + "templateHash": "4984303229931942319", + "parameters": { + "workspaceName": { + "type": "String", + "value": "e2etest_test_61391569992_mvnet" + }, + "description": { + "type": "String", + "value": "e2etest_test_61391569992_mvnet description" + }, + "friendlyName": { + "type": "String", + "value": "e2etest_test_61391569992_mvnet display name" + }, + "location": { + "type": "String", + "value": "centraluseuap" + }, + "resourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountOption": { + "type": "String", + "value": "new" + }, + "storageAccountName": { + "type": "String", + "value": "e2etesttstorage69282feeb" + }, + "storageAccountType": { + "type": "String", + "value": "Standard_LRS" + }, + "storageAccountBehindVNet": { + "type": "String", + "value": "false" + }, + "storageAccountResourceGroupName": { + "type": "String", + "value": "00000" + }, + "storageAccountLocation": { + "type": "String", + "value": "centraluseuap" + }, + "keyVaultOption": { + "type": "String", + "value": "new" + }, + "keyVaultName": { + "type": "String", + "value": "e2etesttkeyvault653823e0" + }, + "keyVaultBehindVNet": { + "type": "String", + "value": "false" + }, + "keyVaultResourceGroupName": { + "type": "String", + "value": "00000" + }, + "keyVaultLocation": { + "type": "String", + "value": "centraluseuap" + }, + "applicationInsightsOption": { + "type": "String", + "value": "new" + }, + "applicationInsightsName": { + "type": "String", + "value": "e2etesttinsightsc0ab7654" + }, + "applicationInsightsResourceGroupName": { + "type": "String", + "value": "00000" + }, + "applicationInsightsLocation": { + "type": "String", + "value": "centraluseuap" + }, + "containerRegistryOption": { + "type": "String", + "value": "none" + }, + "containerRegistryName": { + "type": "String", + "value": "name" + }, + "containerRegistrySku": { + "type": "String", + "value": "Standard" + }, + "containerRegistryResourceGroupName": { + "type": "String", + "value": "" + }, + "containerRegistryBehindVNet": { + "type": "String", + "value": "false" + }, + "containerRegistryLocation": { + "type": "String", + "value": "centraluseuap" + }, + "vnetOption": { + "type": "String", + "value": "existing" + }, + "vnetName": { + "type": "String", + "value": "name" + }, + "vnetResourceGroupName": { + "type": "String", + "value": "name" + }, + "addressPrefixes": { + "type": "Array", + "value": [ + "10.0.0.0/16" + ] + }, + "subnetOption": { + "type": "String", + "value": "existing" + }, + "subnetName": { + "type": "String", + "value": "default" + }, + "subnetPrefix": { + "type": "String", + "value": "10.0.0.0/24" + }, + "adbWorkspace": { + "type": "String", + "value": "" + }, + "confidential_data": { + "type": "String", + "value": "false" + }, + "encryption_status": { + "type": "String", + "value": "Disabled" + }, + "cmk_keyvault": { + "type": "String", + "value": "" + }, + "resource_cmk_uri": { + "type": "String", + "value": "" + }, + "privateEndpointType": { + "type": "String", + "value": "none" + }, + "tagValues": { + "type": "Object", + "value": { + "createdByToolkit": "sdk-v2-1.5.0" + } + }, + "privateEndpointName": { + "type": "String", + "value": "name" + }, + "privateEndpointResourceGroupName": { + "type": "String", + "value": "name" + }, + "imageBuildCompute": { + "type": "String", + "value": "" + }, + "publicNetworkAccess": { + "type": "String", + "value": "Enabled" + }, + "soft_delete_enabled": { + "type": "String", + "value": "false" + }, + "allow_recover_softdeleted_workspace": { + "type": "String", + "value": "false" + }, + "encryption_cosmosdb_resourceid": { + "type": "String", + "value": "" + }, + "encryption_storage_resourceid": { + "type": "String", + "value": "" + }, + "encryption_search_resourceid": { + "type": "String", + "value": "" + }, + "identity": { + "type": "Object", + "value": { + "type": "SystemAssigned" + } + }, + "primaryUserAssignedIdentity": { + "type": "String", + "value": "" + }, + "managedNetwork": { + "type": "Object", + "value": { + "isolationMode": "AllowOnlyApprovedOutbound", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "category": "UserDefined", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + } + }, + "my-storage": { + "type": "PrivateEndpoint", + "category": "UserDefined", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + } + }, + "pytorch": { + "type": "FQDN", + "category": "UserDefined", + "destination": "*.pytorch.org" + } + } + } + } + }, + "mode": "Incremental", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:43:04.3035555Z", + "duration": "PT46.0990155S", + "correlationId": "4823dd49-35d3-4ef0-b0d8-163bd75918d8", + "providers": [ + { + "namespace": "Microsoft.Storage", + "resourceTypes": [ + { + "resourceType": "storageAccounts", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.KeyVault", + "resourceTypes": [ + { + "resourceType": "vaults", + "locations": [ + "centraluseuap" + ] + } + ] + }, + { + "namespace": "Microsoft.Insights", + "resourceTypes": [ + { + "resourceType": "components", + "locations": [ + "southcentralus" + ] + } + ] + }, + { + "namespace": "Microsoft.MachineLearningServices", + "resourceTypes": [ + { + "resourceType": "workspaces", + "locations": [ + "centraluseuap" + ] + } + ] + } + ], + "dependencies": [ + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name", + "resourceType": "Microsoft.Network/virtualNetworks", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.ContainerRegistry/registries/name", + "resourceType": "Microsoft.ContainerRegistry/registries", + "resourceName": "name" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + }, + { + "dependsOn": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Network/virtualNetworks/name/subnets/default", + "resourceType": "Microsoft.Network/virtualNetworks/subnets", + "resourceName": "name/default" + } + ], + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/name/providers/Microsoft.Resources/deployments/DeployPrivateEndpoint-q2xi2ah3t47py", + "resourceType": "Microsoft.Resources/deployments", + "resourceName": "DeployPrivateEndpoint-q2xi2ah3t47py" + } + ], + "outputResources": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet" + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb" + } + ] + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3282", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:06 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "058221d8-72c2-4c17-8a65-e8db5a7a5298", + "x-ms-ratelimit-remaining-subscription-reads": "11980", + "x-ms-routing-request-id": "WESTUS2:20230216T214307Z:058221d8-72c2-4c17-8a65-e8db5a7a5298" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/B5883120E41F887A", + "operationId": "B5883120E41F887A", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:43:03.8371289Z", + "duration": "PT20.8244899S", + "trackingId": "bea0e822-f537-4a55-b4cc-8835b26596e6", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:42.9631219Z", + "duration": "PT23.9494852S", + "trackingId": "17f59013-ee2f-4ada-815d-80a14a1354f5", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:38.2030312Z", + "duration": "PT19.3117823S", + "trackingId": "a320757e-de7e-4bdf-a321-82fcc29a5feb", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/08585250231489215881", + "operationId": "08585250231489215881", + "properties": { + "provisioningOperation": "EvaluateDeploymentOutput", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:43:04.2664424Z", + "duration": "PT21.2538034S", + "trackingId": "ba614bcc-5736-4a98-ac3e-96fa97be259d", + "statusCode": "OK" + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourcegroups/00000/deployments/e2etest_test_61391569992_mvnet-3705742/operations?api-version=2020-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "3282", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:06 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b8402053-7ee9-4618-9ed4-3d21c912f668", + "x-ms-ratelimit-remaining-subscription-reads": "11979", + "x-ms-routing-request-id": "WESTUS2:20230216T214307Z:b8402053-7ee9-4618-9ed4-3d21c912f668" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/B5883120E41F887A", + "operationId": "B5883120E41F887A", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:43:03.8371289Z", + "duration": "PT20.8244899S", + "trackingId": "bea0e822-f537-4a55-b4cc-8835b26596e6", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "resourceType": "Microsoft.MachineLearningServices/workspaces", + "resourceName": "e2etest_test_61391569992_mvnet" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/C0A434A8ECB15FB3", + "operationId": "C0A434A8ECB15FB3", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:42.9631219Z", + "duration": "PT23.9494852S", + "trackingId": "17f59013-ee2f-4ada-815d-80a14a1354f5", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "resourceType": "Microsoft.Storage/storageAccounts", + "resourceName": "e2etesttstorage69282feeb" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/236628C3B06959BC", + "operationId": "236628C3B06959BC", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:22.5266429Z", + "duration": "PT3.635394S", + "trackingId": "d17e5bc7-21d1-4d4f-bc88-b37beec2b1e2", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Insights/components/e2etesttinsightsc0ab7654", + "resourceType": "Microsoft.Insights/components", + "resourceName": "e2etesttinsightsc0ab7654" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/A19B5724D43E9F45", + "operationId": "A19B5724D43E9F45", + "properties": { + "provisioningOperation": "Create", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:42:38.2030312Z", + "duration": "PT19.3117823S", + "trackingId": "a320757e-de7e-4bdf-a321-82fcc29a5feb", + "statusCode": "OK", + "targetResource": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.KeyVault/vaults/e2etesttkeyvault653823e0", + "resourceType": "Microsoft.KeyVault/vaults", + "resourceName": "e2etesttkeyvault653823e0" + } + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Resources/deployments/e2etest_test_61391569992_mvnet-3705742/operations/08585250231489215881", + "operationId": "08585250231489215881", + "properties": { + "provisioningOperation": "EvaluateDeploymentOutput", + "provisioningState": "Succeeded", + "timestamp": "2023-02-16T21:43:04.2664424Z", + "duration": "PT21.2538034S", + "trackingId": "ba614bcc-5736-4a98-ac3e-96fa97be259d", + "statusCode": "OK" + } + } + ] + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:06 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-cb37aa769f6d3b996372a180af05d58e-d6c6e713389a9d05-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f4d54ef7-16fa-412c-b92d-996813fbf162", + "x-ms-ratelimit-remaining-subscription-reads": "11978", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214307Z:f4d54ef7-16fa-412c-b92d-996813fbf162", + "x-request-time": "0.035" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "name": "e2etest_test_61391569992_mvnet", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "centraluseuap", + "tags": { + "createdByToolkit": "sdk-v2-1.5.0" + }, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_61391569992_mvnet display name", + "description": "e2etest_test_61391569992_mvnet description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsc0ab7654", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "networkId": "56af300b-985f-41b3-9937-92c80f2808d1", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault653823e0_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-16T21:42:43.9200471Z", + "notebookInfo": { + "resourceId": "99bd8befd00c404da6426fe446162870", + "fqdn": "ml-e2etestte-centraluseuap-56af300b-985f-41b3-9937-92c80f2808d1.centraluseuap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "56af300b-985f-41b3-9937-92c80f2808d1", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://master.api.azureml-test.ms/discovery", + "mlFlowTrackingUri": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "sdkTelemetryAppInsightsKey": "efed27c9-e6dc-4190-9989-79f9b7f3a4b7", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "7dac6954-0ba5-4c28-9375-76340100a22f", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-16T21:42:43.9200471Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-16T21:42:43.9200471Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-0595f98be507c70123e78f5149b6d500-0c215055322e9b09-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2561e965-e8e9-41b7-b783-3d212f3b6d2b", + "x-ms-ratelimit-remaining-subscription-reads": "11977", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214307Z:2561e965-e8e9-41b7-b783-3d212f3b6d2b", + "x-request-time": "0.031" + }, + "ResponseBody": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault653823e0_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-7439192d57c77c5c4b9b7a4c9a30fb4c-6e277f142e817db2-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "7ef9262a-1a2c-4153-b479-78b3f8953921", + "x-ms-ratelimit-remaining-subscription-reads": "11976", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214308Z:7ef9262a-1a2c-4153-b479-78b3f8953921", + "x-request-time": "0.020" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "name": "e2etest_test_61391569992_mvnet", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "centraluseuap", + "tags": { + "createdByToolkit": "sdk-v2-1.5.0" + }, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_61391569992_mvnet display name", + "description": "e2etest_test_61391569992_mvnet description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsc0ab7654", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "networkId": "56af300b-985f-41b3-9937-92c80f2808d1", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault653823e0_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-16T21:42:43.9200471Z", + "notebookInfo": { + "resourceId": "99bd8befd00c404da6426fe446162870", + "fqdn": "ml-e2etestte-centraluseuap-56af300b-985f-41b3-9937-92c80f2808d1.centraluseuap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "56af300b-985f-41b3-9937-92c80f2808d1", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://master.api.azureml-test.ms/discovery", + "mlFlowTrackingUri": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "sdkTelemetryAppInsightsKey": "e31c22bb-e424-4992-a495-6519750e273a", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "7dac6954-0ba5-4c28-9375-76340100a22f", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-16T21:42:43.9200471Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-16T21:42:43.9200471Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "667", + "Content-Type": "application/json", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": { + "tags": {}, + "properties": { + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "outboundRules": { + "added-servicetagrule": { + "type": "ServiceTag", + "category": "UserDefined", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + } + }, + "added-perule": { + "type": "PrivateEndpoint", + "category": "UserDefined", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": true + } + }, + "added-fqdnrule": { + "type": "FQDN", + "category": "UserDefined", + "destination": "test.com" + } + } + } + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "azure-asyncoperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/riG2AEhXvFOw6a9dq-Ex6Gx9PkTD5_RYvo8dWuSfzEI?api-version=2022-12-01-preview\u0026type=async", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Thu, 16 Feb 2023 21:43:09 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/riG2AEhXvFOw6a9dq-Ex6Gx9PkTD5_RYvo8dWuSfzEI?api-version=2022-12-01-preview\u0026type=location", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "d052f122-e1ad-45d1-9d7d-7eb7b57b767b", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214309Z:d052f122-e1ad-45d1-9d7d-7eb7b57b767b", + "x-request-time": "0.701" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/riG2AEhXvFOw6a9dq-Ex6Gx9PkTD5_RYvo8dWuSfzEI?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:09 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-52f32deb308646088ebcfb99c6e4676a-4fbe2a970a132ee4-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "4fec6015-84f1-4bf2-8246-8579a715d355", + "x-ms-ratelimit-remaining-subscription-reads": "11975", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214309Z:4fec6015-84f1-4bf2-8246-8579a715d355", + "x-request-time": "0.009" + }, + "ResponseBody": { + "status": "InProgress" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/riG2AEhXvFOw6a9dq-Ex6Gx9PkTD5_RYvo8dWuSfzEI?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:39 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-6395cdacdb31090bc29be5b1815c4f60-0a11b31ffdfbcdcc-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "5ed21cf4-14ef-40d1-a8bc-78eae21a7708", + "x-ms-ratelimit-remaining-subscription-reads": "11974", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214340Z:5ed21cf4-14ef-40d1-a8bc-78eae21a7708", + "x-request-time": "0.053" + }, + "ResponseBody": { + "status": "Succeeded", + "percentComplete": 100.0 + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:39 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-658aee1da16ca996da3e71679724ee16-bd7c52a35510d555-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "5a202eb5-fab6-4b1b-9326-a1abb4673c3e", + "x-ms-ratelimit-remaining-subscription-reads": "11973", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214340Z:5a202eb5-fab6-4b1b-9326-a1abb4673c3e", + "x-request-time": "0.022" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "name": "e2etest_test_61391569992_mvnet", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "centraluseuap", + "tags": {}, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_61391569992_mvnet display name", + "description": "e2etest_test_61391569992_mvnet description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsc0ab7654", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "networkId": "56af300b-985f-41b3-9937-92c80f2808d1", + "outboundRules": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "added-servicetagrule": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-perule": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-fqdnrule": { + "type": "FQDN", + "destination": "test.com", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault653823e0_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-16T21:42:43.9200471Z", + "notebookInfo": { + "resourceId": "99bd8befd00c404da6426fe446162870", + "fqdn": "ml-e2etestte-centraluseuap-56af300b-985f-41b3-9937-92c80f2808d1.centraluseuap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "56af300b-985f-41b3-9937-92c80f2808d1", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://master.api.azureml-test.ms/discovery", + "mlFlowTrackingUri": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "sdkTelemetryAppInsightsKey": "efed27c9-e6dc-4190-9989-79f9b7f3a4b7", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "7dac6954-0ba5-4c28-9375-76340100a22f", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-16T21:42:43.9200471Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-16T21:43:08.9310284Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules/added-fqdnrule?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:39 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-fea1bc0dbad371013d89058cf9b0d6e3-360693f13c509297-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0c82df9a-0231-4bef-a91d-405253121574", + "x-ms-ratelimit-remaining-subscription-reads": "11972", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214340Z:0c82df9a-0231-4bef-a91d-405253121574", + "x-request-time": "0.023" + }, + "ResponseBody": { + "type": "FQDN", + "destination": "test.com", + "status": "Inactive", + "category": "UserDefined" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules/added-servicetagrule?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:40 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-19a7f42d5e77d24f690dd8244d21d0f3-a16dd036a415d50a-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "46e2735f-e5b1-45f2-82f1-df07fc7559ff", + "x-ms-ratelimit-remaining-subscription-reads": "11971", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214340Z:46e2735f-e5b1-45f2-82f1-df07fc7559ff", + "x-request-time": "0.023" + }, + "ResponseBody": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules/added-perule?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:40 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-59934f2774c3c7033dc5197119fd33ff-29297ac94d825f70-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "05a0bd91-9c59-4e62-a354-9378f9993ec9", + "x-ms-ratelimit-remaining-subscription-reads": "11970", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214341Z:05a0bd91-9c59-4e62-a354-9378f9993ec9", + "x-request-time": "0.026" + }, + "ResponseBody": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "UserDefined" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:40 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-2e35583b07d9295d64120e424601e073-7a0b236188ae24fd-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "1f3836da-30e5-439e-9caf-1952f41b082c", + "x-ms-ratelimit-remaining-subscription-reads": "11969", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214341Z:1f3836da-30e5-439e-9caf-1952f41b082c", + "x-request-time": "0.042" + }, + "ResponseBody": { + "my-service": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "my-storage": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": false + }, + "status": "Inactive", + "category": "UserDefined" + }, + "pytorch": { + "type": "FQDN", + "destination": "*.pytorch.org", + "status": "Inactive", + "category": "UserDefined" + }, + "added-servicetagrule": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-perule": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-fqdnrule": { + "type": "FQDN", + "destination": "test.com", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault653823e0_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules/pytorch?api-version=2022-12-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "azure-asyncoperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/hzssikmaYVu4jGUyHahwkX0oWwi74jHxgdiSWDm91Q8?api-version=2022-12-01-preview\u0026type=async", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Thu, 16 Feb 2023 21:43:41 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/hzssikmaYVu4jGUyHahwkX0oWwi74jHxgdiSWDm91Q8?api-version=2022-12-01-preview\u0026type=location", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c833a67b-b010-4244-8b05-85fa183e1ac4", + "x-ms-ratelimit-remaining-subscription-deletes": "14999", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214342Z:c833a67b-b010-4244-8b05-85fa183e1ac4", + "x-request-time": "0.202" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/hzssikmaYVu4jGUyHahwkX0oWwi74jHxgdiSWDm91Q8?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:43:41 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-5a4dbc9011a0e8ca1e52cabb816b3a84-a0306b2402952e96-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "59ecc766-60a9-4779-b33d-e011c65e67bc", + "x-ms-ratelimit-remaining-subscription-reads": "11968", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214342Z:59ecc766-60a9-4779-b33d-e011c65e67bc", + "x-request-time": "0.038" + }, + "ResponseBody": { + "status": "InProgress" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/hzssikmaYVu4jGUyHahwkX0oWwi74jHxgdiSWDm91Q8?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:44:12 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-f172ab1106281f43b22981ef87b0cc7f-f042ea1861dbb2ae-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "fb61da54-077b-43bd-8a3e-6144564ac180", + "x-ms-ratelimit-remaining-subscription-reads": "11967", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214412Z:fb61da54-077b-43bd-8a3e-6144564ac180", + "x-request-time": "0.018" + }, + "ResponseBody": { + "status": "Succeeded", + "percentComplete": 100.0 + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules/my-service?api-version=2022-12-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "azure-asyncoperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/D0f_sbYCY2zBJW_TZvoxTjIAvSapF_--ElfpN7_sdCE?api-version=2022-12-01-preview\u0026type=async", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Thu, 16 Feb 2023 21:44:12 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/D0f_sbYCY2zBJW_TZvoxTjIAvSapF_--ElfpN7_sdCE?api-version=2022-12-01-preview\u0026type=location", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "bba07abc-d169-4b01-b87a-9afc59a76fb5", + "x-ms-ratelimit-remaining-subscription-deletes": "14998", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214412Z:bba07abc-d169-4b01-b87a-9afc59a76fb5", + "x-request-time": "0.153" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/D0f_sbYCY2zBJW_TZvoxTjIAvSapF_--ElfpN7_sdCE?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:44:12 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-4f87186e4ea8dbaa9c85c3b8e08d3794-a0c972b581d5f895-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0afa4ea9-f1a4-4ef5-83cf-8c786d4d8d68", + "x-ms-ratelimit-remaining-subscription-reads": "11966", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214412Z:0afa4ea9-f1a4-4ef5-83cf-8c786d4d8d68", + "x-request-time": "0.011" + }, + "ResponseBody": { + "status": "InProgress" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/D0f_sbYCY2zBJW_TZvoxTjIAvSapF_--ElfpN7_sdCE?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:44:42 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-13b5f47016bdaf7e85a56565e0f19794-3fb21b2a55c1153c-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "47700c6b-b6d5-48f2-832d-dffe8fddcecf", + "x-ms-ratelimit-remaining-subscription-reads": "11965", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214443Z:47700c6b-b6d5-48f2-832d-dffe8fddcecf", + "x-request-time": "0.021" + }, + "ResponseBody": { + "status": "Succeeded", + "percentComplete": 100.0 + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules/my-storage?api-version=2022-12-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "azure-asyncoperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/0SiGLG_LJGpWhPGm8SW43yW0YubbfLchWbDLOEwP22Y?api-version=2022-12-01-preview\u0026type=async", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Thu, 16 Feb 2023 21:44:43 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/0SiGLG_LJGpWhPGm8SW43yW0YubbfLchWbDLOEwP22Y?api-version=2022-12-01-preview\u0026type=location", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0364b54b-6ecb-418c-96b2-e19ee37867ee", + "x-ms-ratelimit-remaining-subscription-deletes": "14997", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214443Z:0364b54b-6ecb-418c-96b2-e19ee37867ee", + "x-request-time": "0.096" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/0SiGLG_LJGpWhPGm8SW43yW0YubbfLchWbDLOEwP22Y?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:44:43 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-87844c11f66fa54f5791acc004002077-9d86b22be1e49800-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-01", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8ac3988f-42d9-4d98-83f8-51c47dcc74c7", + "x-ms-ratelimit-remaining-subscription-reads": "11964", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214443Z:8ac3988f-42d9-4d98-83f8-51c47dcc74c7", + "x-request-time": "0.012" + }, + "ResponseBody": { + "status": "InProgress" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/0SiGLG_LJGpWhPGm8SW43yW0YubbfLchWbDLOEwP22Y?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:45:13 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-3889192a15b78181da70b59e868b4d40-697719ad338f24c0-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "e7f46827-339a-4715-8866-cf1f2e91e719", + "x-ms-ratelimit-remaining-subscription-reads": "11963", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214513Z:e7f46827-339a-4715-8866-cf1f2e91e719", + "x-request-time": "0.018" + }, + "ResponseBody": { + "status": "Succeeded", + "percentComplete": 100.0 + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet/managedNetwork/outboundRules?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:45:13 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-0e1f19c0a9a633a0a37c4a0994706a9b-0303fc66876cd978-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "7246b3db-6416-48c9-acd7-f0dbe1cbf36c", + "x-ms-ratelimit-remaining-subscription-reads": "11962", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214514Z:7246b3db-6416-48c9-acd7-f0dbe1cbf36c", + "x-request-time": "0.046" + }, + "ResponseBody": { + "added-servicetagrule": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-perule": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-fqdnrule": { + "type": "FQDN", + "destination": "test.com", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault653823e0_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:45:13 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-5c3b1c935cf099558da7a0c71fdc52f6-b752c200b511660b-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "1a5122ab-ef9c-467b-a126-d0730c0a2930", + "x-ms-ratelimit-remaining-subscription-reads": "11961", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214514Z:1a5122ab-ef9c-467b-a126-d0730c0a2930", + "x-request-time": "0.033" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "name": "e2etest_test_61391569992_mvnet", + "type": "Microsoft.MachineLearningServices/workspaces", + "location": "centraluseuap", + "tags": {}, + "etag": null, + "properties": { + "friendlyName": "e2etest_test_61391569992_mvnet display name", + "description": "e2etest_test_61391569992_mvnet description", + "storageAccount": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "keyVault": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "applicationInsights": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsc0ab7654", + "hbiWorkspace": false, + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "imageBuildCompute": null, + "provisioningState": "Succeeded", + "managedNetwork": { + "isolationMode": "AllowOnlyApprovedOutbound", + "networkId": "56af300b-985f-41b3-9937-92c80f2808d1", + "outboundRules": { + "added-servicetagrule": { + "type": "ServiceTag", + "destination": { + "serviceTag": "DataFactory", + "protocol": "TCP", + "portRanges": "80, 8080-8089" + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-perule": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "UserDefined" + }, + "added-fqdnrule": { + "type": "FQDN", + "destination": "test.com", + "status": "Inactive", + "category": "UserDefined" + }, + "__SYS_PE_e2etesttkeyvault653823e0_vault": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0", + "subresourceTarget": "vault", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_blob": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "blob", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_PE_e2etesttstorage69282feeb_file": { + "type": "PrivateEndpoint", + "destination": { + "serviceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb", + "subresourceTarget": "file", + "sparkEnabled": true + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureActiveDirectory": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureActiveDirectory", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureFrontDoor.FirstParty": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureFrontDoor.FirstParty", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMachineLearning": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMachineLearning", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureMonitor": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureMonitor", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_AzureResourceManager": { + "type": "ServiceTag", + "destination": { + "serviceTag": "AzureResourceManager", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_BatchNodeManagement": { + "type": "ServiceTag", + "destination": { + "serviceTag": "BatchNodeManagement", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_MicrosoftContainerRegistry": { + "type": "ServiceTag", + "destination": { + "serviceTag": "MicrosoftContainerRegistry", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + }, + "__SYS_ST_VirtualNetwork": { + "type": "ServiceTag", + "destination": { + "serviceTag": "VirtualNetwork", + "protocol": "*", + "portRanges": "*" + }, + "status": "Inactive", + "category": "Required" + } + } + }, + "v1LegacyMode": false, + "softDeleteEnabled": false, + "containerRegistry": "", + "creationTime": "2023-02-16T21:42:43.9200471Z", + "notebookInfo": { + "resourceId": "99bd8befd00c404da6426fe446162870", + "fqdn": "ml-e2etestte-centraluseuap-56af300b-985f-41b3-9937-92c80f2808d1.centraluseuap.notebooks.azure.net", + "isPrivateLinkEnabled": false, + "notebookPreparationError": null + }, + "storageHnsEnabled": false, + "workspaceId": "56af300b-985f-41b3-9937-92c80f2808d1", + "linkedModelInventoryArmId": null, + "privateLinkCount": 0, + "publicNetworkAccess": "Enabled", + "discoveryUrl": "https://master.api.azureml-test.ms/discovery", + "mlFlowTrackingUri": "azureml://master.api.azureml-test.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet", + "sdkTelemetryAppInsightsKey": "efed27c9-e6dc-4190-9989-79f9b7f3a4b7", + "sasGetterUri": "", + "enableDataIsolation": false + }, + "identity": { + "type": "SystemAssigned", + "principalId": "7dac6954-0ba5-4c28-9375-76340100a22f", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47" + }, + "kind": "Default", + "sku": { + "name": "Basic", + "tier": "Basic" + }, + "systemData": { + "createdAt": "2023-02-16T21:42:43.9200471Z", + "createdBy": "joharrington@microsoft.com", + "createdByType": "User", + "lastModifiedAt": "2023-02-16T21:44:43.3553696Z", + "lastModifiedBy": "joharrington@microsoft.com", + "lastModifiedByType": "User" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.insights/components/e2etesttinsightsc0ab7654?api-version=2015-05-01", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "Request-Context", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Thu, 16 Feb 2023 21:45:19 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Request-Context": "appId=cid-v1:7f83c1fe-8c94-4d55-9337-4ddc696f61ed", + "Server": "Microsoft-IIS/10.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "826e31b5-9c15-442a-bf9a-5db75d5db4c2", + "x-ms-ratelimit-remaining-subscription-deletes": "14996", + "x-ms-routing-request-id": "WESTUS2:20230216T214520Z:826e31b5-9c15-442a-bf9a-5db75d5db4c2", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Storage/storageAccounts/e2etesttstorage69282feeb?api-version=2019-06-01", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Content-Type": "text/plain; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:45:24 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "59e3399d-4713-42c4-b5b1-cb7ae63e4dbe", + "x-ms-ratelimit-remaining-subscription-deletes": "14995", + "x-ms-routing-request-id": "WESTUS2:20230216T214525Z:59e3399d-4713-42c4-b5b1-cb7ae63e4dbe" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.Keyvault/vaults/e2etesttkeyvault653823e0?api-version=2019-09-01", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-mgmt-resource/15.0.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Thu, 16 Feb 2023 21:45:28 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-IIS/10.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-AspNet-Version": "4.0.30319", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f65ca451-ddc5-47bf-8d07-866fad3bec33", + "x-ms-keyvault-service-version": "1.5.666.2", + "x-ms-ratelimit-remaining-subscription-deletes": "14994", + "x-ms-routing-request-id": "WESTUS2:20230216T214529Z:f65ca451-ddc5-47bf-8d07-866fad3bec33", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/e2etest_test_61391569992_mvnet?api-version=2022-12-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "azure-asyncoperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/25318446-e996-4668-8e71-f7e2dee5b55d?api-version=2022-12-01-preview\u0026type=async", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Thu, 16 Feb 2023 21:45:29 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/25318446-e996-4668-8e71-f7e2dee5b55d?api-version=2022-12-01-preview\u0026type=location", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "e6233ae9-0822-42a7-9afb-29d0132090d1", + "x-ms-ratelimit-remaining-subscription-deletes": "14993", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214529Z:e6233ae9-0822-42a7-9afb-29d0132090d1", + "x-request-time": "0.133" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/centraluseuap/workspaceOperationsStatus/25318446-e996-4668-8e71-f7e2dee5b55d?api-version=2022-12-01-preview\u0026type=async", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.8.10 (Windows-10-10.0.22621-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 16 Feb 2023 21:45:29 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "request-context": "appId=cid-v1:512cc15a-13b5-415b-bfd0-dce7accb6bb1", + "Server-Timing": "traceparent;desc=\u002200-9927a3ab64373e7e766d90cfb8cc9fbf-ad14d4894177119a-01\u0022", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "x-aml-cluster": "vienna-test-westus2-02", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "83ca2413-b708-49d0-8cd5-72fa72be613b", + "x-ms-ratelimit-remaining-subscription-reads": "11960", + "x-ms-response-type": "standard", + "x-ms-routing-request-id": "WESTUS2:20230216T214529Z:83ca2413-b708-49d0-8cd5-72fa72be613b", + "x-request-time": "0.009" + }, + "ResponseBody": { + "status": "InProgress" + } + } + ], + "Variables": { + "deployment_name": "e2etest_test_61391569992_mvnet-3705742", + "insights_name": "e2etesttinsightsc0ab7654", + "keyvault_name": "e2etesttkeyvault653823e0", + "storage_name": "e2etesttstorage69282feeb", + "wps_name": "test_61391569992" + } +} diff --git a/sdk/ml/azure-ai-ml/tests/registry/e2etests/test_registry.py b/sdk/ml/azure-ai-ml/tests/registry/e2etests/test_registry.py index 96d62b8e3023..37b1289203d7 100644 --- a/sdk/ml/azure-ai-ml/tests/registry/e2etests/test_registry.py +++ b/sdk/ml/azure-ai-ml/tests/registry/e2etests/test_registry.py @@ -48,7 +48,9 @@ def test_registry_operations( # Some values are assigned by registries, but hidden in the local representation to avoid confusing users. # Double check that they're set properly by examining the raw registry format. - rest_registry = crud_registry_client.registries._operation.get(resource_group_name=crud_registry_client.resource_group_name, registry_name=reg_name) + rest_registry = crud_registry_client.registries._operation.get( + resource_group_name=crud_registry_client.resource_group_name, registry_name=reg_name + ) assert rest_registry # don't do a standard dictionary equality check to avoid being surprised by auto-set tags assert rest_registry.tags["one"] == "two" @@ -82,7 +84,7 @@ def test_registry_operations_with_storage_replication( registry = crud_registry_client.registries.begin_create(registry=reg).result( timeout=LROConfigurations.POLLING_TIMEOUT ) - + assert registry.name == reg_name assert registry.replication_locations[0].storage_config.replication_count == 3 assert registry.replication_locations[0].storage_config.storage_account_hns == False @@ -96,7 +98,9 @@ def test_registry_operations_with_storage_replication( # Some values are assigned by registries, but hidden in the local representation to avoid confusing users. # Double check that they're set properly by examining the raw registry format. - rest_registry = crud_registry_client.registries._operation.get(resource_group_name=crud_registry_client.resource_group_name, registry_name=reg_name) + rest_registry = crud_registry_client.registries._operation.get( + resource_group_name=crud_registry_client.resource_group_name, registry_name=reg_name + ) assert rest_registry # ensure that the underlying data behind the replicated storage looks reasonable. diff --git a/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_entity.py b/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_entity.py index 52126daf829a..7b98eb9bcd4a 100644 --- a/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_entity.py +++ b/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_entity.py @@ -75,7 +75,11 @@ def test_deserialize_from_autorest_object(self) -> None: RestRegistryRegionArmDetails( location=loc_2, acr_details=[ - AcrDetails(user_created_acr_account=UserCreatedAcrAccount(arm_resource_id=RestArmResourceId(resource_id=acr_id_1))), + AcrDetails( + user_created_acr_account=UserCreatedAcrAccount( + arm_resource_id=RestArmResourceId(resource_id=acr_id_1) + ) + ), AcrDetails( system_created_acr_account=RestSystemCreatedAcrAccount( acr_account_sku=sku, arm_resource_id=RestArmResourceId(resource_id=acr_id_2) @@ -187,17 +191,25 @@ def test_system_user_storage_serialization(self): def test_system_managed_storage_serialization(self): - system_storage = SystemCreatedStorageAccount(storage_account_hns=True, storage_account_type=StorageAccountType.PREMIUM_LRS, arm_resource_id="some managed storage id") + system_storage = SystemCreatedStorageAccount( + storage_account_hns=True, + storage_account_type=StorageAccountType.PREMIUM_LRS, + arm_resource_id="some managed storage id", + ) system_details = RegistryRegionDetails(storage_config=system_storage) rest_system_storage = system_details._storage_config_to_rest_object() assert len(rest_system_storage) == 1 assert rest_system_storage[0].system_created_storage_account.storage_account_hns_enabled == True - assert rest_system_storage[0].system_created_storage_account.storage_account_type == StorageAccountType.PREMIUM_LRS + assert ( + rest_system_storage[0].system_created_storage_account.storage_account_type == StorageAccountType.PREMIUM_LRS + ) # Ensure that arm_resource_id is never set by entity->rest converter. assert rest_system_storage[0].system_created_storage_account.arm_resource_id == None # ... but still test that ID is set in the other direction - rest_system_storage[0].system_created_storage_account.arm_resource_id = RestArmResourceId(resource_id="another storage id") + rest_system_storage[0].system_created_storage_account.arm_resource_id = RestArmResourceId( + resource_id="another storage id" + ) new_system_storage = RegistryRegionDetails._storage_config_from_rest_object(rest_system_storage) assert new_system_storage.arm_resource_id == "another storage id" @@ -205,12 +217,19 @@ def test_system_managed_storage_serialization(self): assert new_system_storage.storage_account_type == StorageAccountType.PREMIUM_LRS def test_system_replicated_managed_storage_serialization(self): - system_storage = SystemCreatedStorageAccount(storage_account_hns=False, storage_account_type=StorageAccountType.PREMIUM_ZRS, arm_resource_id="some managed storage id", replication_count=3) + system_storage = SystemCreatedStorageAccount( + storage_account_hns=False, + storage_account_type=StorageAccountType.PREMIUM_ZRS, + arm_resource_id="some managed storage id", + replication_count=3, + ) system_details = RegistryRegionDetails(storage_config=system_storage) rest_system_storage = system_details._storage_config_to_rest_object() assert len(rest_system_storage) == 3 assert rest_system_storage[0].system_created_storage_account.storage_account_hns_enabled == False - assert rest_system_storage[0].system_created_storage_account.storage_account_type == StorageAccountType.PREMIUM_ZRS + assert ( + rest_system_storage[0].system_created_storage_account.storage_account_type == StorageAccountType.PREMIUM_ZRS + ) # Ensure that arm_resource_id is never set by entity->rest converter. assert rest_system_storage[0].system_created_storage_account.arm_resource_id == None assert rest_system_storage[0] == rest_system_storage[1] @@ -218,20 +237,26 @@ def test_system_replicated_managed_storage_serialization(self): # ... but still test that ID is set in the other direction expected_ids = ["another storage id", "a second storage id", "a third storage id"] - rest_system_storage[0].system_created_storage_account.arm_resource_id = RestArmResourceId(resource_id=expected_ids[0]) + rest_system_storage[0].system_created_storage_account.arm_resource_id = RestArmResourceId( + resource_id=expected_ids[0] + ) # and that replicated ID's are populated properly - rest_system_storage[1].system_created_storage_account.arm_resource_id = RestArmResourceId(resource_id=expected_ids[1]) - rest_system_storage[2].system_created_storage_account.arm_resource_id = RestArmResourceId(resource_id=expected_ids[2]) + rest_system_storage[1].system_created_storage_account.arm_resource_id = RestArmResourceId( + resource_id=expected_ids[1] + ) + rest_system_storage[2].system_created_storage_account.arm_resource_id = RestArmResourceId( + resource_id=expected_ids[2] + ) new_system_storage = RegistryRegionDetails._storage_config_from_rest_object(rest_system_storage) assert new_system_storage.arm_resource_id == expected_ids[0] assert new_system_storage.storage_account_hns == False assert new_system_storage.storage_account_type == StorageAccountType.PREMIUM_ZRS assert new_system_storage.replication_count == 3 - + for expected_id in expected_ids: assert expected_id in new_system_storage.replicated_ids - + system_details.storage_config.replication_count = -1 try: system_details._storage_config_to_rest_object() @@ -241,14 +266,21 @@ def test_system_replicated_managed_storage_serialization(self): pass def test_system_region_details_serialization(self): - region_detail = RegistryRegionDetails(acr_config=[SystemCreatedAcrAccount(acr_account_sku="Premium")], + region_detail = RegistryRegionDetails( + acr_config=[SystemCreatedAcrAccount(acr_account_sku="Premium")], location="USEast2", - storage_config=SystemCreatedStorageAccount(storage_account_hns=False, storage_account_type=StorageAccountType.PREMIUM_LRS)) + storage_config=SystemCreatedStorageAccount( + storage_account_hns=False, storage_account_type=StorageAccountType.PREMIUM_LRS + ), + ) rest_region_detail = region_detail._to_rest_object() assert rest_region_detail.acr_details[0].system_created_acr_account.acr_account_sku == "Premium" assert rest_region_detail.location == "USEast2" - assert rest_region_detail.storage_account_details[0].system_created_storage_account.storage_account_hns_enabled == False + assert ( + rest_region_detail.storage_account_details[0].system_created_storage_account.storage_account_hns_enabled + == False + ) new_region_detail = RegistryRegionDetails._from_rest_object(rest_region_detail) diff --git a/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_operations.py b/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_operations.py index 45ef3286a971..58863fec7095 100644 --- a/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_operations.py +++ b/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_operations.py @@ -54,11 +54,7 @@ def test_check_registry_name(self, mock_registry_operation: RegistryOperations): def test_create(self, mock_registry_operation: RegistryOperations, randstr: Callable[[], str]) -> None: reg_name = f"unittest{randstr('reg_name')}" - params_override = [ - { - "name": reg_name - } - ] + params_override = [{"name": reg_name}] reg = load_registry( source="./tests/test_configs/registry/registry_valid_min.yaml", params_override=params_override ) @@ -68,4 +64,4 @@ def test_create(self, mock_registry_operation: RegistryOperations, randstr: Call def test_delete(self, mock_registry_operation: RegistryOperations, randstr: Callable[[], str]) -> None: mock_registry_operation.begin_delete(name="some registry") - mock_registry_operation._operation.begin_delete.assert_called_once() \ No newline at end of file + mock_registry_operation._operation.begin_delete.assert_called_once() diff --git a/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_schema.py b/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_schema.py index fd559eb72f0c..98575c0bd6e6 100644 --- a/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_schema.py +++ b/sdk/ml/azure-ai-ml/tests/registry/unittests/test_registry_schema.py @@ -113,4 +113,4 @@ def test_deserialize_replication_counts(self) -> None: registry = load_from_dict(RegistrySchema, target, context) registry["replication_locations"][0].storage_config.replication_count == 6 registry["replication_locations"][0].storage_config.storage_account_hns == False - registry["replication_locations"][0].storage_config.storage_account_type == StorageAccountType.STANDARD_LRS \ No newline at end of file + registry["replication_locations"][0].storage_config.storage_account_type == StorageAccountType.STANDARD_LRS diff --git a/sdk/ml/azure-ai-ml/tests/schedule/e2etests/test_schedule.py b/sdk/ml/azure-ai-ml/tests/schedule/e2etests/test_schedule.py index 9f607ef06c29..59780a1d6e4e 100644 --- a/sdk/ml/azure-ai-ml/tests/schedule/e2etests/test_schedule.py +++ b/sdk/ml/azure-ai-ml/tests/schedule/e2etests/test_schedule.py @@ -200,4 +200,4 @@ def test_spark_job_schedule(self, client: MLClient, randstr: Callable[[], str]): rest_schedule_job_dict.pop("status", None) schedule_job_dict = schedule._to_dict()["create_job"] # pop job name, empty parameters from local dict - assert schedule_job_dict == rest_schedule_job_dict \ No newline at end of file + assert schedule_job_dict == rest_schedule_job_dict diff --git a/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_entity.py b/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_entity.py index f40395d3a8a0..9fd59125d46f 100644 --- a/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_entity.py +++ b/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_entity.py @@ -136,9 +136,12 @@ def test_schedule_with_command_job(self): rest_schedule_job_dict = schedule._to_rest_object().as_dict()["properties"]["action"]["job_definition"] # assert overwrite values assert rest_schedule_job_dict["environment_variables"] == {"key": "val"} - assert rest_schedule_job_dict["resources"] == {'properties': {}, 'shm_size': '1g'} - assert rest_schedule_job_dict["distribution"] == {'distribution_type': 'PyTorch', 'process_count_per_instance': 1} - assert rest_schedule_job_dict["limits"] == {'job_limits_type': 'Command', 'timeout': 'PT50M'} + assert rest_schedule_job_dict["resources"] == {"properties": {}, "shm_size": "1g"} + assert rest_schedule_job_dict["distribution"] == { + "distribution_type": "PyTorch", + "process_count_per_instance": 1, + } + assert rest_schedule_job_dict["limits"] == {"job_limits_type": "Command", "timeout": "PT50M"} @pytest.mark.usefixtures( "enable_pipeline_private_preview_features", @@ -157,7 +160,13 @@ def test_schedule_entity_with_spark_job(self): schedule = load_schedule(test_path) rest_schedule_job_dict = schedule._to_rest_object().as_dict()["properties"]["action"]["job_definition"] # assert overwrite values - assert rest_schedule_job_dict["conf"] == {'spark.driver.cores': '2', 'spark.driver.memory': '2g', 'spark.executor.cores': '2', 'spark.executor.memory': '2g', 'spark.executor.instances': '2'} + assert rest_schedule_job_dict["conf"] == { + "spark.driver.cores": "2", + "spark.driver.memory": "2g", + "spark.executor.cores": "2", + "spark.executor.memory": "2g", + "spark.executor.instances": "2", + } assert "mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04" in rest_schedule_job_dict["environment_id"] def test_invalid_date_string(self): diff --git a/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_schema.py b/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_schema.py index 9fcc489c0cc3..4a6e927c08fc 100644 --- a/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_schema.py +++ b/sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_schema.py @@ -130,7 +130,7 @@ def test_load_recurrence_schedule_no_pattern(self): actual_trigger_dict = schedule._to_dict()["trigger"] # Remove emtpy key 'schedule': {'hours': [], 'minutes': []} actual_trigger_dict = pydash.omit(actual_trigger_dict, ["schedule"]) - assert actual_trigger_dict == expected_trigger_dict + assert actual_trigger_dict == expected_trigger_dict def test_load_recurrence_schedule_with_pattern(self): test_path = "./tests/test_configs/schedule/hello_recurrence_schedule_with_pattern.yml" diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/batch_setup/light_gbm_examples/python-guide/advanced_example.py b/sdk/ml/azure-ai-ml/tests/test_configs/batch_setup/light_gbm_examples/python-guide/advanced_example.py index 81867b99224b..f3e57f1fda39 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/batch_setup/light_gbm_examples/python-guide/advanced_example.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/batch_setup/light_gbm_examples/python-guide/advanced_example.py @@ -132,7 +132,7 @@ def main(): lgb_train, num_boost_round=10, init_model=gbm, - learning_rates=lambda iter: 0.05 * (0.99 ** iter), + learning_rates=lambda iter: 0.05 * (0.99**iter), valid_sets=lgb_eval, ) diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/components/component_with_conditional_output/entry.py b/sdk/ml/azure-ai-ml/tests/test_configs/components/component_with_conditional_output/entry.py index e37438915eb8..9e18620b2b99 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/components/component_with_conditional_output/entry.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/components/component_with_conditional_output/entry.py @@ -6,9 +6,9 @@ @command_component() def basic_component( - output1: Output(type="boolean", is_control=True), - output2: Output(type="boolean", is_control=True), - output3: Output(type="boolean"), + output1: Output(type="boolean", is_control=True), + output2: Output(type="boolean", is_control=True), + output3: Output(type="boolean"), ) -> Output(type="boolean", is_control=True): """module run logic goes here""" return False diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/components/do_while_test/entry.py b/sdk/ml/azure-ai-ml/tests/test_configs/components/do_while_test/entry.py index d24aaa01385e..2383dbc63557 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/components/do_while_test/entry.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/components/do_while_test/entry.py @@ -2,8 +2,8 @@ import sys from pathlib import Path -os.environ['AZURE_ML_CLI_PRIVATE_FEATURES_ENABLED'] = 'true' -os.environ['AZURE_ML_INTERNAL_COMPONENTS_ENABLED'] = 'true' +os.environ["AZURE_ML_CLI_PRIVATE_FEATURES_ENABLED"] = "true" +os.environ["AZURE_ML_INTERNAL_COMPONENTS_ENABLED"] = "true" from mldesigner import command_component from mldesigner import dsl as designerdsl @@ -17,30 +17,30 @@ from azure.identity import DefaultAzureCredential ENVIRONMENT_DICT = dict( - image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04", - conda_file={ - "name": "default_environment", - "channels": ["defaults"], - "dependencies": [ - "python=3.8.12", - "pip=21.2.2", - { - "pip": [ - "--extra-index-url=https://azuremlsdktestpypi.azureedge.net/sdk-cli-v2", - "mldesigner==0.1.0b6", - "mlflow==1.29.0", - "azureml-mlflow==1.45.0", - "azure-ai-ml==1.0.0", - "azure-core==1.26.0", - "azure-common==1.1.28", - "azureml-core==1.45.0.post2", - "azure-ml-component==0.9.13.post1", - "azure-identity==1.11.0" - ] - }, - ], - } - ) + image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04", + conda_file={ + "name": "default_environment", + "channels": ["defaults"], + "dependencies": [ + "python=3.8.12", + "pip=21.2.2", + { + "pip": [ + "--extra-index-url=https://azuremlsdktestpypi.azureedge.net/sdk-cli-v2", + "mldesigner==0.1.0b6", + "mlflow==1.29.0", + "azureml-mlflow==1.45.0", + "azure-ai-ml==1.0.0", + "azure-core==1.26.0", + "azure-common==1.1.28", + "azureml-core==1.45.0.post2", + "azure-ml-component==0.9.13.post1", + "azure-identity==1.11.0", + ] + }, + ], + }, +) def write_text(input, output): @@ -48,24 +48,28 @@ def write_text(input, output): if input_data.is_dir(): files = os.listdir(input_data) for f in files: - lines = (Path(input_data) / f).read_text(encoding='utf-8') + lines = (Path(input_data) / f).read_text(encoding="utf-8") (Path(output) / f).write_text(lines) else: - lines = (Path(input_data)).read_text(encoding='utf-8') + lines = (Path(input_data)).read_text(encoding="utf-8") (Path(output) / Path(input_data).name).write_text(lines) @command_component(environment=ENVIRONMENT_DICT) def primitive_component_with_normal_input_output_v2( - input_data: Input, parambool: bool, paramint: int, paramfloat: float, paramstr: str, + input_data: Input, + parambool: bool, + paramint: int, + paramfloat: float, + paramstr: str, output_data: Output, bool_param_output: Output(type="boolean", is_control=True), int_param_output: Output(type="integer", is_control=True), float_param_output: Output(type="number", is_control=True), - str_param_output: Output(type="string", is_control=True) + str_param_output: Output(type="string", is_control=True), ): if input_data is None or not Path(input_data).exists(): - (Path(output_data) / 'file').write_text('abc') + (Path(output_data) / "file").write_text("abc") return write_text(input_data, output_data) @@ -74,9 +78,13 @@ def primitive_component_with_normal_input_output_v2( int_param_output = paramint float_param_output = paramfloat str_param_output = paramstr - print(f"output params are: bool_param_output: {bool_param_output}, int_param_output: {int_param_output}, float_param_output: {float_param_output}, str_param_output: {str_param_output}") - control_output_content = '{"int_param_output": "%s", "bool_param_output": "%s", "float_param_output": "%s", "str_param_output": "%s"}' % ( - int_param_output, bool_param_output, float_param_output, str_param_output) + print( + f"output params are: bool_param_output: {bool_param_output}, int_param_output: {int_param_output}, float_param_output: {float_param_output}, str_param_output: {str_param_output}" + ) + control_output_content = ( + '{"int_param_output": "%s", "bool_param_output": "%s", "float_param_output": "%s", "str_param_output": "%s"}' + % (int_param_output, bool_param_output, float_param_output, str_param_output) + ) ExecutorBase._write_control_outputs_to_run_history(control_output_content=control_output_content) @@ -94,7 +102,7 @@ def do_while_body_component( bool_param_output: Output(type="boolean", is_control=True), int_param_output: Output(type="integer", is_control=True), float_param_output: Output(type="number", is_control=True), - str_param_output: Output(type="string", is_control=True) + str_param_output: Output(type="string", is_control=True), ): if not (input_1 is None or not Path(input_1).exists()): write_text(input_1, output_1) @@ -112,7 +120,8 @@ def do_while_body_component( bool_param_output = bool_param str_param_output = str_param - control_output_content = '{"condition": "%s", "int_param_output": "%s", "bool_param_output": "%s", "float_param_output": "%s", "str_param_output": "%s"}' % ( - str(condition), int_param_output, bool_param_output, float_param_output, str_param_output) + control_output_content = ( + '{"condition": "%s", "int_param_output": "%s", "bool_param_output": "%s", "float_param_output": "%s", "str_param_output": "%s"}' + % (str(condition), int_param_output, bool_param_output, float_param_output, str_param_output) + ) ExecutorBase._write_control_outputs_to_run_history(control_output_content=control_output_content) - diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/components/helloworld_component_multi_outputs.yml b/sdk/ml/azure-ai-ml/tests/test_configs/components/helloworld_component_multi_outputs.yml new file mode 100644 index 000000000000..94149f44a49f --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/test_configs/components/helloworld_component_multi_outputs.yml @@ -0,0 +1,37 @@ +$schema: https://azuremlschemas.azureedge.net/development/commandComponent.schema.json +type: command + +name: microsoftsamples_command_component_basic +display_name: CommandComponentBasic +description: This is the basic command component +tags: + tag: tagvalue + owner: sdkteam + +version: 0.0.1 + +inputs: + component_in_number: + description: A number + type: number + default: 10.99 + optional: True + component_in_path: + description: A path + type: uri_folder + +outputs: + component_out_path: + type: uri_folder + component_out_path_2: + type: uri_folder + +# Write some output to work around a bug when pipeline node failed to run with empty dataset as input +command: >- + echo Hello World & + echo $[[${{inputs.component_in_number}}]] & + echo ${{inputs.component_in_path}} & + echo ${{outputs.component_out_path}} > ${{outputs.component_out_path}}/component_in_number + echo ${{outputs.component_out_path_2}} > ${{outputs.component_out_path_2}}/component_in_number + +environment: azureml:AzureML-sklearn-0.24-ubuntu18.04-py37-cpu:1 diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/compute/compute-aml.yaml b/sdk/ml/azure-ai-ml/tests/test_configs/compute/compute-aml.yaml index 371b2f9f8b69..6274f2c1ed51 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/compute/compute-aml.yaml +++ b/sdk/ml/azure-ai-ml/tests/test_configs/compute/compute-aml.yaml @@ -3,6 +3,8 @@ type: amlcompute description: some_desc_aml size: Standard_DS2_v2 location: eastus +tags: + test: "true" ssh_public_access_enabled: true ssh_settings: admin_username: azureuser diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/deployments/batch/hello-component/src/hello.py b/sdk/ml/azure-ai-ml/tests/test_configs/deployments/batch/hello-component/src/hello.py index e75154b7c390..8cde7829c178 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/deployments/batch/hello-component/src/hello.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/deployments/batch/hello-component/src/hello.py @@ -1 +1 @@ -print("hello world") \ No newline at end of file +print("hello world") diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/copy_data/pipeline.py b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/copy_data/pipeline.py index 08e4114499e0..ba2a431a3d68 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/copy_data/pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/copy_data/pipeline.py @@ -24,7 +24,8 @@ def data_transfer_copy_pipeline_from_yaml(cosmos_folder, cosmos_folder_dup): type=AssetTypes.URI_FOLDER, ), cosmos_folder_dup=Input( - type=AssetTypes.URI_FOLDER, path=parent_dir + "/data/iris_model", + type=AssetTypes.URI_FOLDER, + path=parent_dir + "/data/iris_model", ), ) @@ -62,8 +63,7 @@ def data_transfer_copy_pipeline_from_builder(cosmos_folder, cosmos_folder_dup): return {"merged_blob": merge_files.outputs.output_folder} pipeline = data_transfer_copy_pipeline_from_builder( - cosmos_folder=cosmos_folder, - cosmos_folder_dup=cosmos_folder_dup + cosmos_folder=cosmos_folder, cosmos_folder_dup=cosmos_folder_dup ) pipeline.settings.default_compute = "adftest" return pipeline diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_database/pipeline.py b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_database/pipeline.py index 75f3d2f66601..1ef7037d2306 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_database/pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_database/pipeline.py @@ -11,20 +11,23 @@ def generate_dsl_pipeline_from_builder() -> PipelineJob: - connection_target_azuresql = 'azureml:my_export_azuresqldb_connection' + connection_target_azuresql = "azureml:my_export_azuresqldb_connection" table_name = "dbo.Persons" my_cosmos_folder = Input(type=AssetTypes.URI_FILE, path=parent_dir + "/data/testFile_ForSqlDB.parquet") inputs = {"source": my_cosmos_folder} - sink = {'type': 'database', 'connection': connection_target_azuresql, 'table_name': table_name} + sink = {"type": "database", "connection": connection_target_azuresql, "table_name": table_name} - @dsl.pipeline(description='submit a pipeline with data transfer export database job') + @dsl.pipeline(description="submit a pipeline with data transfer export database job") def data_transfer_export_database_pipeline_from_builder(table_name, connection_target_azuresql, cosmos_folder): from azure.ai.ml.data_transfer import Database + blob_azuresql_node_input = export_data(inputs=inputs, sink=sink) source_snowflake = Database(table_name=table_name, connection=connection_target_azuresql) blob_azuresql = export_data(inputs={"source": cosmos_folder}, sink=source_snowflake) - pipeline = data_transfer_export_database_pipeline_from_builder(table_name, connection_target_azuresql, my_cosmos_folder) + pipeline = data_transfer_export_database_pipeline_from_builder( + table_name, connection_target_azuresql, my_cosmos_folder + ) pipeline.settings.default_compute = "adftest" return pipeline diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_file_system/pipeline.py b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_file_system/pipeline.py index 79c90950b20a..789cd90b432f 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_file_system/pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/export_file_system/pipeline.py @@ -11,21 +11,24 @@ def generate_dsl_pipeline_from_builder() -> PipelineJob: - path_source_s3 = 's3://my_bucket/my_folder' - connection_target = 'azureml:my_s3_connection' + path_source_s3 = "s3://my_bucket/my_folder" + connection_target = "azureml:my_s3_connection" my_cosmos_folder = Input(type=AssetTypes.URI_FOLDER, path="azureml://datastores/my_cosmos/paths/source_cosmos") inputs = {"source": my_cosmos_folder} - sink = {'type': 'file_system', 'connection': connection_target, 'path': path_source_s3} + sink = {"type": "file_system", "connection": connection_target, "path": path_source_s3} - @dsl.pipeline(description='submit a pipeline with data transfer export file system job') + @dsl.pipeline(description="submit a pipeline with data transfer export file system job") def data_transfer_export_file_system_pipeline_from_builder(path_source_s3, connection_target, cosmos_folder): from azure.ai.ml.data_transfer import FileSystem + s3_blob_input = export_data(inputs=inputs, sink=sink, task=DataTransferTaskType.EXPORT_DATA) source_snowflake = FileSystem(path=path_source_s3, connection=connection_target) s3_blob = export_data(inputs={"source": cosmos_folder}, sink=source_snowflake) - pipeline = data_transfer_export_file_system_pipeline_from_builder(path_source_s3, connection_target, my_cosmos_folder) + pipeline = data_transfer_export_file_system_pipeline_from_builder( + path_source_s3, connection_target, my_cosmos_folder + ) pipeline.settings.default_compute = "adf_compute" return pipeline diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_database/pipeline.py b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_database/pipeline.py index 130b74affb0b..110a24fd469a 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_database/pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_database/pipeline.py @@ -10,15 +10,20 @@ def generate_dsl_pipeline_from_builder() -> PipelineJob: - query_source_snowflake = 'select * from TPCH_SF1000.PARTSUPP limit 10' - connection_target_azuresql = 'azureml:my_snowflake_connection' - outputs = {"sink": Output(type=AssetTypes.MLTABLE, path="azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/")} - source = {'type': 'database', 'connection': connection_target_azuresql, - 'query': query_source_snowflake} + query_source_snowflake = "select * from TPCH_SF1000.PARTSUPP limit 10" + connection_target_azuresql = "azureml:my_snowflake_connection" + outputs = { + "sink": Output( + type=AssetTypes.MLTABLE, + path="azureml://datastores/workspaceblobstore_sas/paths/importjob/${{name}}/output_dir/snowflake/", + ) + } + source = {"type": "database", "connection": connection_target_azuresql, "query": query_source_snowflake} - @dsl.pipeline(description='submit a pipeline with data transfer import database job') + @dsl.pipeline(description="submit a pipeline with data transfer import database job") def data_transfer_import_database_pipeline_from_builder(query_source_snowflake, connection_target_azuresql): from azure.ai.ml.data_transfer import Database + snowflake_blob_node_input = import_data( source=Database(**source), outputs=outputs, @@ -38,15 +43,15 @@ def data_transfer_import_database_pipeline_from_builder(query_source_snowflake, def generate_dsl_pipeline_from_builder_sql() -> PipelineJob: - query_source_snowflake = 'select top(10) Name from SalesLT.ProductCategory' - connection_target_azuresql = 'azureml:my_azuresqldb_connection' + query_source_snowflake = "select top(10) Name from SalesLT.ProductCategory" + connection_target_azuresql = "azureml:my_azuresqldb_connection" outputs = {"sink": Output(type=AssetTypes.MLTABLE)} - source = {'type': 'database', 'connection': connection_target_azuresql, - 'query': query_source_snowflake} + source = {"type": "database", "connection": connection_target_azuresql, "query": query_source_snowflake} - @dsl.pipeline(description='submit a pipeline with data transfer import database job') + @dsl.pipeline(description="submit a pipeline with data transfer import database job") def data_transfer_import_database_pipeline_from_builder(query_source_snowflake, connection_target_azuresql): from azure.ai.ml.data_transfer import Database + sql_blob_node_input = import_data( source=Database(**source), outputs=outputs, diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_file_system/pipeline.py b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_file_system/pipeline.py index dbdaa162d8f8..aa16c066cc54 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_file_system/pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_file_system/pipeline.py @@ -11,14 +11,15 @@ def generate_dsl_pipeline_from_builder() -> PipelineJob: - path_source_s3 = 'test1/*' - connection_target = 'azureml:my-s3-connection' + path_source_s3 = "test1/*" + connection_target = "azureml:my-s3-connection" outputs = {"sink": Output(type=AssetTypes.URI_FOLDER)} - source = {'type': 'file_system', 'connection': connection_target, 'path': path_source_s3} + source = {"type": "file_system", "connection": connection_target, "path": path_source_s3} - @dsl.pipeline(description='submit a pipeline with data transfer import file system job') + @dsl.pipeline(description="submit a pipeline with data transfer import file system job") def data_transfer_import_file_system_pipeline_from_builder(path_source_s3, connection_target): from azure.ai.ml.data_transfer import FileSystem + s3_blob_input = import_data(source=source, outputs=outputs) source_snowflake = FileSystem(path=path_source_s3, connection=connection_target) diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_stored_database/pipeline.py b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_stored_database/pipeline.py index 4d9d48ad9a89..814b27d74fd0 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_stored_database/pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/import_stored_database/pipeline.py @@ -11,16 +11,23 @@ def generate_dsl_pipeline_from_builder() -> PipelineJob: - stored_procedure = 'SelectEmployeeByJobAndDepartment' - stored_procedure_params = [{'name': 'job', 'value': 'Engineer', 'type': 'String'}, - {'name': 'department', 'value': 'Engineering', 'type': 'String'}] + stored_procedure = "SelectEmployeeByJobAndDepartment" + stored_procedure_params = [ + {"name": "job", "value": "Engineer", "type": "String"}, + {"name": "department", "value": "Engineering", "type": "String"}, + ] outputs = {"sink": Output(type=AssetTypes.MLTABLE)} - source = {'type': 'database', 'connection': 'azureml:my_sql_connection', 'stored_procedure': stored_procedure, - 'stored_procedure_params': stored_procedure_params} + source = { + "type": "database", + "connection": "azureml:my_sql_connection", + "stored_procedure": stored_procedure, + "stored_procedure_params": stored_procedure_params, + } - @dsl.pipeline(description='submit a pipeline with data transfer import stored database job') + @dsl.pipeline(description="submit a pipeline with data transfer import stored database job") def data_transfer_import_database_pipeline_from_builder(): from azure.ai.ml.data_transfer import Database + snowflake_blob = import_data( source=Database(**source), outputs=outputs, diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/pipeline.py b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/pipeline.py index 313a348de468..af2ba7a5effc 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/pipeline.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/dsl_pipeline/data_transfer_job_in_pipeline/pipeline.py @@ -11,27 +11,24 @@ def generate_dsl_pipeline() -> PipelineJob: - path_source_s3 = 'test1/*' - query_source_sql = 'select top(10) Name from SalesLT.ProductCategory' - connection_target_s3 = 'azureml:my-s3-connection' + path_source_s3 = "test1/*" + query_source_sql = "select top(10) Name from SalesLT.ProductCategory" + connection_target_s3 = "azureml:my-s3-connection" merge_files_func = load_component(parent_dir + "/copy_data/merge_files.yaml") @dsl.pipeline(description="submit a pipeline with data transfer job") def data_transfer_copy_pipeline_from_yaml(query_source_sql, path_source_s3, connection_target_s3): - source_snowflake = Database(query=query_source_sql, connection='azureml:my_azuresqldb_connection') - snowflake_blob = import_data( - source=source_snowflake, - outputs={"sink": Output(type=AssetTypes.MLTABLE)} - ) - snowflake_blob.compute = 'adftest' + source_snowflake = Database(query=query_source_sql, connection="azureml:my_azuresqldb_connection") + snowflake_blob = import_data(source=source_snowflake, outputs={"sink": Output(type=AssetTypes.MLTABLE)}) + snowflake_blob.compute = "adftest" - source_s3 = FileSystem(path=path_source_s3, connection='azureml:my-s3-connection') - s3_blob = import_data( source=source_s3, outputs={"sink": Output(type=AssetTypes.URI_FOLDER)}) + source_s3 = FileSystem(path=path_source_s3, connection="azureml:my-s3-connection") + s3_blob = import_data(source=source_s3, outputs={"sink": Output(type=AssetTypes.URI_FOLDER)}) merge_files = merge_files_func(folder1=s3_blob.outputs.sink, folder2=snowflake_blob.outputs.sink) - sink_s3 = FileSystem(path='test1/', connection=connection_target_s3) + sink_s3 = FileSystem(path="test1/", connection=connection_target_s3) blob_s3 = export_data(inputs={"source": merge_files.outputs.output_folder}, sink=sink_s3) return {"merged_blob": merge_files.outputs.output_folder} @@ -40,7 +37,7 @@ def data_transfer_copy_pipeline_from_yaml(query_source_sql, path_source_s3, conn query_source_sql=query_source_sql, path_source_s3=path_source_s3, connection_target_s3=connection_target_s3, - ) + ) # pipeline.outputs.merged_blob.path = "azureml://datastores/my_blob/paths/merged_blob" pipeline.settings.default_compute = "adftest" diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library2/greetings.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library2/greetings.py index ee111f2ca417..c8554cc1516a 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library2/greetings.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library2/greetings.py @@ -2,5 +2,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- + def greetings(): - print(f'greetings from {__name__}') \ No newline at end of file + print(f"greetings from {__name__}") diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/__init__.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/__init__.py index 9dd81a39770e..d540fd20468c 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/__init__.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/__init__.py @@ -1,3 +1,3 @@ # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# --------------------------------------------------------- \ No newline at end of file +# --------------------------------------------------------- diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/hello.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/hello.py index 45581f87d06d..1f1d9e0b0d48 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/hello.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/library3/hello.py @@ -4,4 +4,4 @@ def say_hello(): - print(f'hello from {__name__}') \ No newline at end of file + print(f"hello from {__name__}") diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/__init__.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/__init__.py index 69e3be50dac4..8db66d3d0f0f 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/__init__.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/hello.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/hello.py index 2103e1a7e54b..a60acfc38bfc 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/hello.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library1/hello.py @@ -1,2 +1,2 @@ def say_hello(): - print(f'hello from {__name__}') + print(f"hello from {__name__}") diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library2/greetings.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library2/greetings.py index eeb6c2703786..184e4a264adb 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library2/greetings.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src/python/library2/greetings.py @@ -1,2 +1,2 @@ def greetings(): - print(f'greetings from {__name__}') + print(f"greetings from {__name__}") diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/__init__.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/__init__.py index 69e3be50dac4..8db66d3d0f0f 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/__init__.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/__init__.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/__init__.py index 69e3be50dac4..8db66d3d0f0f 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/__init__.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/salute.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/salute.py index 9811d01382e9..7727b910e7f0 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/salute.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/additional_includes/src1/library1/utils/salute.py @@ -1,2 +1,2 @@ def salute(): - print(f'salute from {__name__}') + print(f"salute from {__name__}") diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes-in-zip/run.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes-in-zip/run.py index 260efb76f0a7..f59980ce7fcd 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes-in-zip/run.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes-in-zip/run.py @@ -12,5 +12,5 @@ # print(sys.path) -if __name__ == '__main__': - say_hello() \ No newline at end of file +if __name__ == "__main__": + say_hello() diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes/run.py b/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes/run.py index 260efb76f0a7..f59980ce7fcd 100644 --- a/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes/run.py +++ b/sdk/ml/azure-ai-ml/tests/test_configs/internal/component-reuse/additional-includes/run.py @@ -12,5 +12,5 @@ # print(sys.path) -if __name__ == '__main__': - say_hello() \ No newline at end of file +if __name__ == "__main__": + say_hello() diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/workspace/workspace_mvnet.yaml b/sdk/ml/azure-ai-ml/tests/test_configs/workspace/workspace_mvnet.yaml new file mode 100644 index 000000000000..d9a97690a86a --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/test_configs/workspace/workspace_mvnet.yaml @@ -0,0 +1,21 @@ +name: e2etest_test_mvnet +location: centraluseuap +managed_network: + isolation_mode: allow_only_approved_outbound + outbound_rules: + my-service: + destination: + port_ranges: 80, 8080-8089 + protocol: TCP + service_tag: DataFactory + type: service_tag + my-storage: + destination: + service_resource_id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount + spark_enabled: false + subresource_target: blob + type: private_endpoint + pytorch: + destination: '*.pytorch.org' + type: fqdn +tags: {} diff --git a/sdk/ml/azure-ai-ml/tests/test_configs/workspace/workspace_update_mvnet.yaml b/sdk/ml/azure-ai-ml/tests/test_configs/workspace/workspace_update_mvnet.yaml new file mode 100644 index 000000000000..31fa3a658e01 --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/test_configs/workspace/workspace_update_mvnet.yaml @@ -0,0 +1,19 @@ +name: e2etest_test_mvnet +managed_network: + isolation_mode: allow_only_approved_outbound + outbound_rules: + added-servicetagrule: + destination: + port_ranges: 80, 8080-8089 + protocol: TCP + service_tag: DataFactory + type: service_tag + added-perule: + destination: + service_resource_id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount + spark_enabled: true + subresource_target: blob + type: private_endpoint + added-fqdnrule: + destination: 'test.com' + type: fqdn diff --git a/sdk/ml/azure-ai-ml/tests/test_utilities/utils.py b/sdk/ml/azure-ai-ml/tests/test_utilities/utils.py index 6b4f0eec8117..b52fb9fa913d 100644 --- a/sdk/ml/azure-ai-ml/tests/test_utilities/utils.py +++ b/sdk/ml/azure-ai-ml/tests/test_utilities/utils.py @@ -349,11 +349,11 @@ def parse_local_path(origin_path, base_path=None): @contextmanager def build_temp_folder( - *, - source_base_dir: Union[str, os.PathLike], - relative_dirs_to_copy: List[str] = None, - relative_files_to_copy: List[str] = None, - extra_files_to_create: Dict[str, Optional[str]] = None, + *, + source_base_dir: Union[str, os.PathLike], + relative_dirs_to_copy: List[str] = None, + relative_files_to_copy: List[str] = None, + extra_files_to_create: Dict[str, Optional[str]] = None, ) -> str: """Build a temporary folder with files and subfolders copied from source_base_dir. diff --git a/sdk/ml/azure-ai-ml/tests/virtual_cluster/e2etests/test_vc.py b/sdk/ml/azure-ai-ml/tests/virtual_cluster/e2etests/test_vc.py index 18a50454d0b3..349d73ee0f72 100644 --- a/sdk/ml/azure-ai-ml/tests/virtual_cluster/e2etests/test_vc.py +++ b/sdk/ml/azure-ai-ml/tests/virtual_cluster/e2etests/test_vc.py @@ -1,14 +1,13 @@ - import pytest import re from devtools_testutils import AzureRecordedTestCase from azure.ai.ml import MLClient + @pytest.mark.usefixtures("recorded_test") @pytest.mark.virtual_cluster_test class TestVirtualCluster(AzureRecordedTestCase): - @pytest.mark.e2etest def test_get_and_list(self, client: MLClient) -> None: vc_list = client._virtual_clusters.list() @@ -17,9 +16,7 @@ def test_get_and_list(self, client: MLClient) -> None: test_vc_name = "SingularityTestVC" singularity_test_vc = [vc for vc in vc_list if vc["name"] == test_vc_name][0] - REGEX_PATTERN = ( - "^/?subscriptions/([^/]+)/resourceGroups/([^/]+)/providers/Microsoft.MachineLearningServices/virtualclusters/([^/]+)" - ) + REGEX_PATTERN = "^/?subscriptions/([^/]+)/resourceGroups/([^/]+)/providers/Microsoft.MachineLearningServices/virtualclusters/([^/]+)" match = re.match(REGEX_PATTERN, singularity_test_vc["id"]) subscription_id = match.group(1) resource_group_name = match.group(2) @@ -28,5 +25,3 @@ def test_get_and_list(self, client: MLClient) -> None: vc_get_client = MLClient(client._credential, subscription_id, resource_group_name) vc = vc_get_client._virtual_clusters.get(vc_name) assert test_vc_name == vc["name"] - - \ No newline at end of file diff --git a/sdk/ml/azure-ai-ml/tests/virtual_cluster/unittests/test_vc_operations.py b/sdk/ml/azure-ai-ml/tests/virtual_cluster/unittests/test_vc_operations.py index 74469b68bbe5..597ae47479af 100644 --- a/sdk/ml/azure-ai-ml/tests/virtual_cluster/unittests/test_vc_operations.py +++ b/sdk/ml/azure-ai-ml/tests/virtual_cluster/unittests/test_vc_operations.py @@ -13,18 +13,20 @@ def mock_credential() -> Mock: @pytest.fixture def mock_vc_operation(mock_workspace_scope: OperationScope, mock_credential) -> VirtualClusterOperations: - yield VirtualClusterOperations( - operation_scope=mock_workspace_scope, - credentials=mock_credential - ) + yield VirtualClusterOperations(operation_scope=mock_workspace_scope, credentials=mock_credential) @pytest.mark.unittest @pytest.mark.virtual_cluster_test class TestVCOperations: - @patch("azure.ai.ml.operations._virtual_cluster_operations.get_virtual_clusters_from_subscriptions") - def test_list(self, mock_function, mock_vc_operation: VirtualClusterOperations, mock_workspace_scope: OperationScope, mock_credential: Mock) -> None: + def test_list( + self, + mock_function, + mock_vc_operation: VirtualClusterOperations, + mock_workspace_scope: OperationScope, + mock_credential: Mock, + ) -> None: dummy_vc_list = [ { "id": "id1", @@ -33,14 +35,13 @@ def test_list(self, mock_function, mock_vc_operation: VirtualClusterOperations, { "id": "id2", "name": "name2", - } + }, ] - - + mock_function.return_value = dummy_vc_list result = mock_vc_operation.list() - assert dummy_vc_list == result + assert dummy_vc_list == result mock_function.assert_called_once_with(mock_credential, subscription_list=None) dummy_sub_list = [mock_workspace_scope.subscription_id] @@ -51,7 +52,13 @@ def test_list(self, mock_function, mock_vc_operation: VirtualClusterOperations, assert mock_function.call_count == 2 @patch("azure.ai.ml.operations._virtual_cluster_operations.get_virtual_cluster_by_id") - def test_get(self, mock_function, mock_vc_operation: VirtualClusterOperations, mock_workspace_scope: OperationScope, mock_credential: Mock) -> None: + def test_get( + self, + mock_function, + mock_vc_operation: VirtualClusterOperations, + mock_workspace_scope: OperationScope, + mock_credential: Mock, + ) -> None: dummy_vc = { "id": "id1", "name": "name1", @@ -60,5 +67,10 @@ def test_get(self, mock_function, mock_vc_operation: VirtualClusterOperations, m result = mock_vc_operation.get("name1") assert dummy_vc == result - - mock_function.assert_called_once_with(name="name1", resource_group=mock_workspace_scope.resource_group_name, subscription_id=mock_workspace_scope.subscription_id, credential=mock_credential) + + mock_function.assert_called_once_with( + name="name1", + resource_group=mock_workspace_scope.resource_group_name, + subscription_id=mock_workspace_scope.subscription_id, + credential=mock_credential, + ) diff --git a/sdk/ml/azure-ai-ml/tests/workspace/e2etests/test_workspace.py b/sdk/ml/azure-ai-ml/tests/workspace/e2etests/test_workspace.py index 0dd5bf5d0c69..6597d1a3bbf5 100644 --- a/sdk/ml/azure-ai-ml/tests/workspace/e2etests/test_workspace.py +++ b/sdk/ml/azure-ai-ml/tests/workspace/e2etests/test_workspace.py @@ -14,7 +14,11 @@ from azure.ai.ml.entities._credentials import IdentityConfiguration, ManagedIdentityConfiguration from azure.ai.ml.entities._workspace.diagnose import DiagnoseResponseResultValue from azure.ai.ml.entities._workspace.workspace import Workspace +from azure.ai.ml.entities._workspace.networking import FqdnDestination, PrivateEndpointDestination, ServiceTagDestination from azure.core.paging import ItemPaged +from azure.ai.ml.constants._workspace import ( + IsolationMode, OutboundRuleCategory, OutboundRuleType +) from azure.core.polling import LROPoller from azure.mgmt.msi._managed_service_identity_client import ManagedServiceIdentityClient @@ -174,15 +178,15 @@ def test_uai_workspace_create_update_and_delete( { "identity": { "type": "user_assigned", - "user_assigned_identities":{ + "user_assigned_identities": { user_assigned_identity.id: { "client_id": user_assigned_identity.client_id, - "principal_id": user_assigned_identity.principal_id + "principal_id": user_assigned_identity.principal_id, }, user_assigned_identity2.id: { "client_id": user_assigned_identity2.client_id, - "principal_id": user_assigned_identity2.principal_id - } + "principal_id": user_assigned_identity2.principal_id, + }, }, } }, @@ -271,7 +275,6 @@ def test_update_sai_to_sai_and_uai_workspace_with_uai_deletion( assert workspace.identity.user_assigned_identities == None assert workspace.primary_user_assigned_identity == None - # test updating identity type from system_assgined to system_assigned and user_assigned msi_client = ManagedServiceIdentityClient( credential=client._credential, subscription_id=client._operation_scope.subscription_id @@ -290,15 +293,15 @@ def test_update_sai_to_sai_and_uai_workspace_with_uai_deletion( { "identity": { "type": "system_assigned, user_assigned", - "user_assigned_identities":{ + "user_assigned_identities": { user_assigned_identity.id: { "client_id": user_assigned_identity.client_id, - "principal_id": user_assigned_identity.principal_id + "principal_id": user_assigned_identity.principal_id, }, user_assigned_identity2.id: { "client_id": user_assigned_identity2.client_id, - "principal_id": user_assigned_identity2.principal_id - } + "principal_id": user_assigned_identity2.principal_id, + }, }, } }, @@ -306,13 +309,13 @@ def test_update_sai_to_sai_and_uai_workspace_with_uai_deletion( wps = load_workspace("./tests/test_configs/workspace/workspace_min.yaml", params_override=params_override) workspace_poller = client.workspaces.begin_update( wps, - # primary_user_assigned_identity=user_assigned_identity.id, # uncomment this when sai to sai|uai fixing pr released. + # primary_user_assigned_identity=user_assigned_identity.id, # uncomment this when sai to sai|uai fixing pr released. ) assert isinstance(workspace_poller, LROPoller) workspace = workspace_poller.result() assert isinstance(workspace, Workspace) assert len(workspace.identity.user_assigned_identities) == 2 - # assert workspace.primary_user_assigned_identity == user_assigned_identity.id # uncomment this when sai to sai|uai fixing pr released. + # assert workspace.primary_user_assigned_identity == user_assigned_identity.id # uncomment this when sai to sai|uai fixing pr released. assert workspace.identity.type == camel_to_snake(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) ## test uai removal. not supported yet, service returning "Code: FailedIdentityOperation, Removal of all user-assigned identities assigned to resource '...' with type 'SystemAssigned, UserAssigned' is invalid." @@ -331,3 +334,73 @@ def test_update_sai_to_sai_and_uai_workspace_with_uai_deletion( # verify that request was accepted by checking if poller is returned assert poller assert isinstance(poller, LROPoller) + + @pytest.mark.e2etest + @pytest.mark.mlc + @pytest.mark.skipif( + condition=not is_live(), + reason="ARM template makes playback complex, so the test is flaky when run against recording", + ) + def test_workspace_create_update_delete_with_managed_network( + self, client: MLClient, randstr: Callable[[], str], location: str + ) -> None: + # resource name key word + wps_name = f"e2etest_{randstr('wps_name')}_mvnet" + + wps_description = f"{wps_name} description" + wps_display_name = f"{wps_name} display name" + params_override = [ + {"name": wps_name}, + # {"location": location}, # using master for now + {"description": wps_description}, + {"display_name": wps_display_name}, + ] + wps = load_workspace("./tests/test_configs/workspace/workspace_mvnet.yaml", params_override=params_override) + + # test creation + workspace_poller = client.workspaces.begin_create(workspace=wps) + assert isinstance(workspace_poller, LROPoller) + workspace = workspace_poller.result() + assert isinstance(workspace, Workspace) + assert workspace.name == wps_name + # assert workspace.location == location # using master for now + assert workspace.description == wps_description + assert workspace.display_name == wps_display_name + assert workspace.managed_network.isolation_mode == IsolationMode.ALLOW_ONLY_APPROVED_OUTBOUND + assert "my-service" in workspace.managed_network.outbound_rules.keys() + assert isinstance(workspace.managed_network.outbound_rules["my-service"], ServiceTagDestination) + assert "my-storage" in workspace.managed_network.outbound_rules.keys() + assert isinstance(workspace.managed_network.outbound_rules["my-storage"], PrivateEndpointDestination) + assert "pytorch" in workspace.managed_network.outbound_rules.keys() + assert isinstance(workspace.managed_network.outbound_rules["pytorch"], FqdnDestination) + + # test get + workspace = client.workspaces.get(name=wps_name) + assert isinstance(workspace, Workspace) + assert workspace.name == wps_name + assert workspace.managed_network.isolation_mode == IsolationMode.ALLOW_ONLY_APPROVED_OUTBOUND + assert "my-service" in workspace.managed_network.outbound_rules.keys() + assert isinstance(workspace.managed_network.outbound_rules["my-service"], ServiceTagDestination) + assert "my-storage" in workspace.managed_network.outbound_rules.keys() + assert isinstance(workspace.managed_network.outbound_rules["my-storage"], PrivateEndpointDestination) + assert "pytorch" in workspace.managed_network.outbound_rules.keys() + assert isinstance(workspace.managed_network.outbound_rules["pytorch"], FqdnDestination) + + """ + # this will fail right now, need to remove the rules that arent PE rules first + # test update + workspace_poller = client.workspaces.begin_update( + workspace, + managed_network=IsolationMode.ALLOW_INTERNET_OUTBOUND, + ) + assert isinstance(workspace_poller, LROPoller) + workspace = workspace_poller.result() + assert isinstance(workspace, Workspace) + assert workspace.managed_network.isolation_mode == IsolationMode.ALLOW_INTERNET_OUTBOUND + """ + + # test workspace deletion + poller = client.workspaces.begin_delete(wps_name, delete_dependent_resources=True) + # verify that request was accepted by checking if poller is returned + assert poller + assert isinstance(poller, LROPoller) diff --git a/sdk/ml/azure-ai-ml/tests/workspace/e2etests/test_workspace_outbound_rule_operations.py b/sdk/ml/azure-ai-ml/tests/workspace/e2etests/test_workspace_outbound_rule_operations.py new file mode 100644 index 000000000000..d62672cb0b47 --- /dev/null +++ b/sdk/ml/azure-ai-ml/tests/workspace/e2etests/test_workspace_outbound_rule_operations.py @@ -0,0 +1,163 @@ +# --------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# --------------------------------------------------------- +from typing import Callable + +import pytest +from devtools_testutils import AzureRecordedTestCase, is_live +from test_utilities.utils import verify_entity_load_and_dump + +from azure.ai.ml import MLClient, load_workspace +from azure.ai.ml._utils.utils import camel_to_snake +from azure.ai.ml.entities._workspace.workspace import Workspace +from azure.ai.ml.entities._workspace.networking import FqdnDestination, PrivateEndpointDestination, ServiceTagDestination +from azure.core.paging import ItemPaged +from azure.ai.ml.constants._workspace import ( + IsolationMode, OutboundRuleCategory, OutboundRuleType +) +from azure.core.polling import LROPoller + +@pytest.mark.e2etest +@pytest.mark.core_sdk_test +@pytest.mark.usefixtures( + "recorded_test", "mock_workspace_arm_template_deployment_name", "mock_workspace_dependent_resource_name_generator" +) +class TestWorkspaceOutboundRules(AzureRecordedTestCase): + @pytest.mark.e2etest + @pytest.mark.mlc + @pytest.mark.skipif( + condition=not is_live(), + reason="ARM template makes playback complex, so the test is flaky when run against recording", + ) + def test_workspace_create_with_managed_network_list_show_remove_rules( + self, client: MLClient, randstr: Callable[[], str] + ) -> None: + # resource name key word + wps_name = f"e2etest_{randstr('wps_name')}_mvnet" + + wps_description = f"{wps_name} description" + wps_display_name = f"{wps_name} display name" + params_override = [ + {"name": wps_name}, + # {"location": location}, # using master for now + {"description": wps_description}, + {"display_name": wps_display_name}, + ] + wps = load_workspace("./tests/test_configs/workspace/workspace_mvnet.yaml", params_override=params_override) + + # test creation + workspace_poller = client.workspaces.begin_create(workspace=wps) + assert isinstance(workspace_poller, LROPoller) + workspace = workspace_poller.result() + assert isinstance(workspace, Workspace) + assert workspace.name == wps_name + # assert workspace.location == location # using master for now + assert workspace.description == wps_description + assert workspace.display_name == wps_display_name + assert workspace.managed_network.isolation_mode == IsolationMode.ALLOW_ONLY_APPROVED_OUTBOUND + + # test list outbound rules + rules = client.workspace_outbound_rule.list( + client.resource_group_name, wps_name + ) + assert "my-service" in rules.keys() + assert isinstance(rules["my-service"], ServiceTagDestination) + assert rules["my-service"].category == OutboundRuleCategory.USER_DEFINED + assert rules["my-service"].port_ranges == "80, 8080-8089" + assert rules["my-service"].protocol == "TCP" + assert rules["my-service"].service_tag == "DataFactory" + + assert "my-storage" in rules.keys() + assert isinstance(rules["my-storage"], PrivateEndpointDestination) + assert rules["my-storage"].category == OutboundRuleCategory.USER_DEFINED + assert rules["my-storage"].service_resource_id == "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount" + assert rules["my-storage"].spark_enabled == False + assert rules["my-storage"].subresource_target == "blob" + + assert "pytorch" in rules.keys() + assert isinstance(rules["pytorch"], FqdnDestination) + assert rules["pytorch"].category == OutboundRuleCategory.USER_DEFINED + assert rules["pytorch"].destination == "*.pytorch.org" + + # test adding outbound rules with workspace update + params_override = [ + {"name": wps_name}, + ] + wps_update = load_workspace("./tests/test_configs/workspace/workspace_update_mvnet.yaml", params_override=params_override) + + workspace_poller = client.workspaces.begin_update(workspace=wps_update) + assert isinstance(workspace_poller, LROPoller) + workspace = workspace_poller.result() + assert isinstance(workspace, Workspace) + assert workspace.name == wps_name + + # test show rules added + # FQDN rule + rule = client.workspace_outbound_rule.show( + client.resource_group_name, wps_name, "added-fqdnrule" + ) + assert isinstance(rule, FqdnDestination) + assert rule.category == OutboundRuleCategory.USER_DEFINED + assert rule.destination == "test.com" + # ServiceTag rule + rule = client.workspace_outbound_rule.show( + client.resource_group_name, wps_name, "added-servicetagrule" + ) + assert isinstance(rule, ServiceTagDestination) + assert rule.category == OutboundRuleCategory.USER_DEFINED + assert rule.service_tag == "DataFactory" + assert rule.protocol == "TCP" + assert rule.port_ranges == "80, 8080-8089" + # PrivateEndpoint rule + rule = client.workspace_outbound_rule.show( + client.resource_group_name, wps_name, "added-perule" + ) + assert isinstance(rule, PrivateEndpointDestination) + assert rule.category == OutboundRuleCategory.USER_DEFINED + assert rule.service_resource_id == "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount" + assert rule.subresource_target == "blob" + assert rule.spark_enabled == True + + # assert update did not remove existing outbound rules + rules = client.workspace_outbound_rule.list( + client.resource_group_name, wps_name + ) + assert "pytorch" in rules.keys() + assert "my-service" in rules.keys() + assert "my-storage" in rules.keys() + + # test remove outbound rule + rule_poller = client.workspace_outbound_rule.remove( + client.resource_group_name, + wps_name, + "pytorch") + assert isinstance(rule_poller, LROPoller) + rule_poller.result() + + rule_poller = client.workspace_outbound_rule.remove( + client.resource_group_name, + wps_name, + "my-service") + assert isinstance(rule_poller, LROPoller) + rule_poller.result() + + rule_poller = client.workspace_outbound_rule.remove( + client.resource_group_name, + wps_name, + "my-storage") + assert isinstance(rule_poller, LROPoller) + rule_poller.result() + + # assert remove worked removed the outbound rules + rules = client.workspace_outbound_rule.list( + client.resource_group_name, wps_name + ) + assert "pytorch" not in rules.keys() + assert "my-service" not in rules.keys() + assert "my-storage" not in rules.keys() + + # test workspace deletion + poller = client.workspaces.begin_delete(wps_name, delete_dependent_resources=True) + # verify that request was accepted by checking if poller is returned + assert poller + assert isinstance(poller, LROPoller) diff --git a/sdk/ml/azure-ai-ml/tests/workspace/unittests/test_workspace_operations.py b/sdk/ml/azure-ai-ml/tests/workspace/unittests/test_workspace_operations.py index 7360f5fb6678..68fd4467b5ea 100644 --- a/sdk/ml/azure-ai-ml/tests/workspace/unittests/test_workspace_operations.py +++ b/sdk/ml/azure-ai-ml/tests/workspace/unittests/test_workspace_operations.py @@ -5,7 +5,7 @@ from pytest_mock import MockFixture from azure.ai.ml import MLClient, load_workspace -from azure.ai.ml._restclient.v2022_10_01_preview.models import ( +from azure.ai.ml._restclient.v2022_12_01_preview.models import ( EncryptionKeyVaultUpdateProperties, EncryptionUpdateProperties, ) diff --git a/sdk/modelsrepository/azure-iot-modelsrepository/pyproject.toml b/sdk/modelsrepository/azure-iot-modelsrepository/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/modelsrepository/azure-iot-modelsrepository/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md b/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md index 806c56ffe8df..c11e9b874727 100644 --- a/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md @@ -1,17 +1,15 @@ # Release History -## 1.0.0 (Unreleased) +## 1.0.0 (2023-02-16) ### Features Added - Added new `on_error` parameter to the `upload` method to allow users to handle errors in their own way. - - An `UploadLogsError` class was added to encapsulate information about the error. An instance of this class is passed to the `on_error` callback. + - An `LogsUploadError` class was added to encapsulate information about the error. An instance of this class is passed to the `on_error` callback. - Added IO support for upload. Now IO streams can be passed in using the `logs` parameter. ([#28373](https://github.com/Azure/azure-sdk-for-python/pull/28373)) ### Breaking Changes - Removed support for max_concurrency -### Bugs Fixed - ### Other Changes - Removed `msrest` dependency. - Added requirement for `isodate>=0.6.0` (`isodate` was required by `msrest`). diff --git a/sdk/monitor/azure-monitor-ingestion/README.md b/sdk/monitor/azure-monitor-ingestion/README.md index 75482d5d5a1a..b6a086517c1c 100644 --- a/sdk/monitor/azure-monitor-ingestion/README.md +++ b/sdk/monitor/azure-monitor-ingestion/README.md @@ -133,7 +133,7 @@ except HttpResponseError as e: ### Upload with custom error handling -To upload logs with custom error handling, you can pass a callback function to the `on_error` parameter of the `upload` method. The callback function will be called for each error that occurs during the upload and should expect one argument that corresponds to an `UploadLogsError` object. This object contains the error encountered and the list of logs that failed to upload. +To upload logs with custom error handling, you can pass a callback function to the `on_error` parameter of the `upload` method. The callback function will be called for each error that occurs during the upload and should expect one argument that corresponds to an `LogsUploadError` object. This object contains the error encountered and the list of logs that failed to upload. ```python # Example 1: Collect all logs that failed to upload. @@ -175,7 +175,10 @@ The following code samples show common scenarios with the Azure Monitor Ingestio #### Logs Ingestion samples -- [Upload a list of logs](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_send_small_logs.py) ([async sample](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_send_small_logs_async.py)) +- [Upload a list of logs][sample_send_small_logs] ([async sample][sample_send_small_logs_async]) +- [Upload a list of logs with custom error handling][sample_custom_error_callback] ([async sample][sample_custom_error_callback_async]) +- [Upload the contents of a file][sample_upload_file_contents] ([async sample][sample_upload_file_contents_async]) +- [Upload data in a pandas DataFrame][sample_upload_pandas_dataframe] ([async sample][sample_upload_pandas_dataframe_async]) ## Contributing @@ -205,6 +208,15 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-ingestion/samples [source]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/ +[sample_send_small_logs]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_send_small_logs.py +[sample_send_small_logs_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_send_small_logs_async.py +[sample_custom_error_callback]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_custom_error_callback.py +[sample_custom_error_callback_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_custom_error_callback_async.py +[sample_upload_file_contents]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_upload_file_contents.py +[sample_upload_file_contents_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_upload_file_contents_async.py +[sample_upload_pandas_dataframe]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_upload_pandas_dataframe.py +[sample_upload_pandas_dataframe_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_upload_pandas_dataframe_async.py + [cla]: https://cla.microsoft.com [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/monitor/azure-monitor-ingestion/assets.json b/sdk/monitor/azure-monitor-ingestion/assets.json index 0623f66f3675..6d4a7997e009 100644 --- a/sdk/monitor/azure-monitor-ingestion/assets.json +++ b/sdk/monitor/azure-monitor-ingestion/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/monitor/azure-monitor-ingestion", - "Tag": "python/monitor/azure-monitor-ingestion_70c5ade383" + "Tag": "python/monitor/azure-monitor-ingestion_12276a5674" } diff --git a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_models.py b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_models.py index 71f6ff5560a6..3ed82c443ef0 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_models.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_models.py @@ -13,7 +13,7 @@ JSON = Mapping[str, Any] # pylint: disable=unsubscriptable-object -class UploadLogsError: +class LogsUploadError: """Error information for a failed upload to Azure Monitor. :param error: The error that occured during the upload. diff --git a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_operations.py b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_operations.py index b036cd55d911..4cb6de736995 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_operations.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -82,81 +82,6 @@ def build_logs_ingestion_upload_request( class LogsIngestionClientOperationsMixin(LogsIngestionClientMixinABC): - @overload - def upload( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - stream: str, - body: List[JSON], - *, - content_encoding: Optional[str] = None, - x_ms_client_request_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Ingestion API used to directly ingest data using Data Collection Rules. - - See error response code and error response message for more detail. - - :param rule_id: The immutable Id of the Data Collection Rule resource. Required. - :type rule_id: str - :param stream: The streamDeclaration name as defined in the Data Collection Rule. Required. - :type stream: str - :param body: An array of objects matching the schema defined by the provided stream. Required. - :type body: list[JSON] - :keyword content_encoding: gzip. Default value is None. - :paramtype content_encoding: str - :keyword x_ms_client_request_id: Client request Id. Default value is None. - :paramtype x_ms_client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = [ - {} # Optional. - ] - """ - - @overload - def upload( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - stream: str, - body: IO, - *, - content_encoding: Optional[str] = None, - x_ms_client_request_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Ingestion API used to directly ingest data using Data Collection Rules. - - See error response code and error response message for more detail. - - :param rule_id: The immutable Id of the Data Collection Rule resource. Required. - :type rule_id: str - :param stream: The streamDeclaration name as defined in the Data Collection Rule. Required. - :type stream: str - :param body: An array of objects matching the schema defined by the provided stream. Required. - :type body: IO - :keyword content_encoding: gzip. Default value is None. - :paramtype content_encoding: str - :keyword x_ms_client_request_id: Client request Id. Default value is None. - :paramtype x_ms_client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ @distributed_trace def upload( # pylint: disable=inconsistent-return-statements diff --git a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_patch.py b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_patch.py index 6a3971ae2f94..93c6035d0073 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_patch.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_patch.py @@ -13,7 +13,7 @@ from ._operations import LogsIngestionClientOperationsMixin as GeneratedOps from .._helpers import _create_gzip_requests, GZIP_MAGIC_NUMBER -from .._models import UploadLogsError +from .._models import LogsUploadError if sys.version_info >= (3, 9): from collections.abc import Mapping, MutableMapping @@ -32,7 +32,7 @@ def upload( # type: ignore[override] # pylint: disable=arguments-renamed, argum stream_name: str, logs: Union[List[JSON], IO], *, - on_error: Optional[Callable[[UploadLogsError], None]] = None, + on_error: Optional[Callable[[LogsUploadError], None]] = None, **kwargs: Any ) -> None: """Ingestion API used to directly ingest data using Data Collection Rules. @@ -47,9 +47,9 @@ def upload( # type: ignore[override] # pylint: disable=arguments-renamed, argum :param logs: An array of objects matching the schema defined by the provided stream. :type logs: list[JSON] or IO :keyword on_error: The callback function that is called when a chunk of logs fails to upload. - This function should expect one argument that corresponds to an "UploadLogsError" object. + This function should expect one argument that corresponds to an "LogsUploadError" object. If no function is provided, then the first exception encountered will be raised. - :paramtype on_error: Optional[Callable[[~azure.monitor.ingestion.UploadLogsError], None]] + :paramtype on_error: Optional[Callable[[~azure.monitor.ingestion.LogsUploadError], None]] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -74,7 +74,7 @@ def upload( # type: ignore[override] # pylint: disable=arguments-renamed, argum ) except Exception as err: # pylint: disable=broad-except if on_error: - on_error(UploadLogsError(error=err, failed_logs=cast(List[Mapping[str, Any]], log_chunk))) + on_error(LogsUploadError(error=err, failed_logs=cast(List[Mapping[str, Any]], log_chunk))) else: _LOGGER.error("Failed to upload chunk containing %d log entries", len(log_chunk)) raise err diff --git a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_patch.py b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_patch.py index 57f0123af9a7..d9c5953a143f 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_patch.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_patch.py @@ -9,7 +9,7 @@ from typing import TYPE_CHECKING, Any from azure.core.pipeline.policies import BearerTokenCredentialPolicy from ._client import LogsIngestionClient as GeneratedClient -from ._models import UploadLogsError +from ._models import LogsUploadError if TYPE_CHECKING: from azure.core.credentials import TokenCredential @@ -40,7 +40,7 @@ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) __all__ = [ "LogsIngestionClient", - "UploadLogsError" + "LogsUploadError" ] diff --git a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_operations.py b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_operations.py index f141ee5ac1c2..093cd6a408a3 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_operations.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,81 +36,6 @@ class LogsIngestionClientOperationsMixin(LogsIngestionClientMixinABC): - @overload - async def upload( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - stream: str, - body: List[JSON], - *, - content_encoding: Optional[str] = None, - x_ms_client_request_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Ingestion API used to directly ingest data using Data Collection Rules. - - See error response code and error response message for more detail. - - :param rule_id: The immutable Id of the Data Collection Rule resource. Required. - :type rule_id: str - :param stream: The streamDeclaration name as defined in the Data Collection Rule. Required. - :type stream: str - :param body: An array of objects matching the schema defined by the provided stream. Required. - :type body: list[JSON] - :keyword content_encoding: gzip. Default value is None. - :paramtype content_encoding: str - :keyword x_ms_client_request_id: Client request Id. Default value is None. - :paramtype x_ms_client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = [ - {} # Optional. - ] - """ - - @overload - async def upload( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - stream: str, - body: IO, - *, - content_encoding: Optional[str] = None, - x_ms_client_request_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Ingestion API used to directly ingest data using Data Collection Rules. - - See error response code and error response message for more detail. - - :param rule_id: The immutable Id of the Data Collection Rule resource. Required. - :type rule_id: str - :param stream: The streamDeclaration name as defined in the Data Collection Rule. Required. - :type stream: str - :param body: An array of objects matching the schema defined by the provided stream. Required. - :type body: IO - :keyword content_encoding: gzip. Default value is None. - :paramtype content_encoding: str - :keyword x_ms_client_request_id: Client request Id. Default value is None. - :paramtype x_ms_client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ @distributed_trace_async async def upload( # pylint: disable=inconsistent-return-statements diff --git a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_patch.py b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_patch.py index f86be97c1a7d..cabd88dcdd86 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_patch.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_patch.py @@ -13,7 +13,7 @@ from ._operations import LogsIngestionClientOperationsMixin as GeneratedOps from ..._helpers import _create_gzip_requests, GZIP_MAGIC_NUMBER -from ..._models import UploadLogsError +from ..._models import LogsUploadError if sys.version_info >= (3, 9): from collections.abc import Mapping, MutableMapping @@ -32,7 +32,7 @@ async def upload( # type: ignore[override] # pylint: disable=arguments-renamed, stream_name: str, logs: Union[List[JSON], IO], *, - on_error: Optional[Callable[[UploadLogsError], Awaitable[None]]] = None, + on_error: Optional[Callable[[LogsUploadError], Awaitable[None]]] = None, **kwargs: Any ) -> None: """Ingestion API used to directly ingest data using Data Collection Rules. @@ -47,9 +47,9 @@ async def upload( # type: ignore[override] # pylint: disable=arguments-renamed, :param logs: An array of objects matching the schema defined by the provided stream. :type logs: list[JSON] or IO :keyword on_error: The callback function that is called when a chunk of logs fails to upload. - This function should expect one argument that corresponds to an "UploadLogsError" object. + This function should expect one argument that corresponds to an "LogsUploadError" object. If no function is provided, then the first exception encountered will be raised. - :paramtype on_error: Optional[Callable[[~azure.monitor.ingestion.UploadLogsError], None]] + :paramtype on_error: Optional[Callable[[~azure.monitor.ingestion.LogsUploadError], None]] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -74,7 +74,7 @@ async def upload( # type: ignore[override] # pylint: disable=arguments-renamed, ) except Exception as err: # pylint: disable=broad-except if on_error: - await on_error(UploadLogsError(error=err, failed_logs=cast(List[Mapping[str, Any]], log_chunk))) + await on_error(LogsUploadError(error=err, failed_logs=cast(List[Mapping[str, Any]], log_chunk))) else: _LOGGER.error("Failed to upload chunk containing %d log entries", len(log_chunk)) raise err diff --git a/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_custom_error_callback_async.py b/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_custom_error_callback_async.py index 3d1373dbf258..ff384a01e138 100644 --- a/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_custom_error_callback_async.py +++ b/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_custom_error_callback_async.py @@ -31,7 +31,7 @@ from azure.core.exceptions import HttpResponseError from azure.identity.aio import DefaultAzureCredential -from azure.monitor.ingestion import UploadLogsError +from azure.monitor.ingestion import LogsUploadError from azure.monitor.ingestion.aio import LogsIngestionClient @@ -55,7 +55,7 @@ async def send_logs(): failed_logs = [] # Sample callback that stores the logs that failed to upload. - async def on_error_save(error: UploadLogsError) -> None: + async def on_error_save(error: LogsUploadError) -> None: print("Log chunk failed to upload with error: ", error.error) failed_logs.extend(error.failed_logs) @@ -65,7 +65,7 @@ async def on_error_pass(_) -> None: # Sample callback that raises the error if it corresponds to a specific HTTP error code. # This aborts the rest of the upload. - async def on_error_abort(error: UploadLogsError) -> None: + async def on_error_abort(error: LogsUploadError) -> None: if isinstance(error.error, HttpResponseError) and error.error.status_code in (400, 401, 403): print("Aborting upload...") raise error.error diff --git a/sdk/monitor/azure-monitor-ingestion/samples/sample_custom_error_callback.py b/sdk/monitor/azure-monitor-ingestion/samples/sample_custom_error_callback.py index 495a36905186..f9f3558191b8 100644 --- a/sdk/monitor/azure-monitor-ingestion/samples/sample_custom_error_callback.py +++ b/sdk/monitor/azure-monitor-ingestion/samples/sample_custom_error_callback.py @@ -30,7 +30,7 @@ from azure.core.exceptions import HttpResponseError from azure.identity import DefaultAzureCredential -from azure.monitor.ingestion import LogsIngestionClient, UploadLogsError +from azure.monitor.ingestion import LogsIngestionClient, LogsUploadError endpoint = os.environ['DATA_COLLECTION_ENDPOINT'] @@ -55,7 +55,7 @@ failed_logs = [] # Sample callback that stores the logs that failed to upload. -def on_error_save(error: UploadLogsError) -> None: +def on_error_save(error: LogsUploadError) -> None: print("Log chunk failed to upload with error: ", error.error) failed_logs.extend(error.failed_logs) @@ -65,7 +65,7 @@ def on_error_pass(_) -> None: # Sample callback that raises the error if it corresponds to a specific HTTP error code. # This aborts the rest of the upload. -def on_error_abort(error: UploadLogsError) -> None: +def on_error_abort(error: LogsUploadError) -> None: if isinstance(error.error, HttpResponseError) and error.error.status_code in (400, 401, 403): print("Aborting upload...") raise error.error diff --git a/sdk/monitor/azure-monitor-ingestion/setup.py b/sdk/monitor/azure-monitor-ingestion/setup.py index 053e2c007f6d..1b8e776c183a 100644 --- a/sdk/monitor/azure-monitor-ingestion/setup.py +++ b/sdk/monitor/azure-monitor-ingestion/setup.py @@ -61,7 +61,7 @@ author_email='azpysdkhelp@microsoft.com', url='https://github.com/Azure/azure-sdk-for-python', classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.7', diff --git a/sdk/monitor/azure-monitor-ingestion/tests/conftest.py b/sdk/monitor/azure-monitor-ingestion/tests/conftest.py index 8e99fb68e0e6..fb21e700afb2 100644 --- a/sdk/monitor/azure-monitor-ingestion/tests/conftest.py +++ b/sdk/monitor/azure-monitor-ingestion/tests/conftest.py @@ -23,6 +23,8 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- +from datetime import datetime + import pytest from devtools_testutils.sanitizers import ( @@ -80,3 +82,17 @@ def monitor_info(environment_variables): "dce": environment_variables.get(ENV_DCE), "dcr_id": environment_variables.get(ENV_DCR_ID) } + + +@pytest.fixture(scope="session") +def large_data(): + logs = [] + content = "a" * (1024 * 100) # 100 KiB string + + # Ensure total size is > 2 MiB data + for i in range(24): + logs.append({ + "Time": datetime.now().isoformat(), + "AdditionalContext": content + }) + return logs diff --git a/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion.py b/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion.py index ed2322c263ac..0ddd9df6a122 100644 --- a/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion.py +++ b/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion.py @@ -6,6 +6,7 @@ import gzip import json import os +from unittest import mock import uuid import pytest @@ -43,6 +44,12 @@ def test_send_logs(self, recorded_test, monitor_info): with client: client.upload(rule_id=monitor_info['dcr_id'], stream_name=monitor_info['stream_name'], logs=LOGS_BODY) + def test_send_logs_large(self, recorded_test, monitor_info, large_data): + client = self.create_client_from_credential( + LogsIngestionClient, self.get_credential(LogsIngestionClient), endpoint=monitor_info['dce']) + with client: + client.upload(rule_id=monitor_info['dcr_id'], stream_name=monitor_info['stream_name'], logs=large_data) + def test_send_logs_error(self, recorded_test, monitor_info): client = self.create_client_from_credential( LogsIngestionClient, self.get_credential(LogsIngestionClient), endpoint=monitor_info['dce']) @@ -92,3 +99,44 @@ def test_send_logs_gzip_file(self, monitor_info): with open(temp_file, 'rb') as f: client.upload(rule_id=monitor_info['dcr_id'], stream_name=monitor_info['stream_name'], logs=f) os.remove(temp_file) + + + def test_abort_error_handler(self, monitor_info): + client = self.create_client_from_credential( + LogsIngestionClient, self.get_credential(LogsIngestionClient), endpoint=monitor_info['dce']) + + class TestException(Exception): + pass + + def on_error(e): + on_error.called = True + if isinstance(e.error, RuntimeError): + raise TestException("Abort") + return + + on_error.called = False + + with client: + # No exception should be raised + with mock.patch("azure.monitor.ingestion._operations._patch.GeneratedOps.upload", + side_effect=ConnectionError): + client.upload( + rule_id=monitor_info['dcr_id'], + stream_name=monitor_info['stream_name'], + logs=LOGS_BODY, + on_error=on_error) + + assert on_error.called + + on_error.called = False + # Exception should now be raised since error handler checked for RuntimeError. + with mock.patch("azure.monitor.ingestion._operations._patch.GeneratedOps.upload", + side_effect=RuntimeError): + with pytest.raises(TestException): + client.upload( + rule_id=monitor_info['dcr_id'], + stream_name=monitor_info['stream_name'], + logs=LOGS_BODY, + on_error=on_error) + + assert on_error.called diff --git a/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion_async.py b/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion_async.py index 59571337876b..e854e20ef9e5 100644 --- a/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion_async.py +++ b/sdk/monitor/azure-monitor-ingestion/tests/test_logs_ingestion_async.py @@ -6,6 +6,7 @@ import gzip import os import json +from unittest import mock import uuid import pytest @@ -44,7 +45,17 @@ async def test_send_logs_async(self, recorded_test, monitor_info): LogsIngestionClient, credential, endpoint=monitor_info['dce']) async with client: await client.upload(rule_id=monitor_info['dcr_id'], stream_name=monitor_info['stream_name'], logs=LOGS_BODY) - credential.close() + await credential.close() + + @pytest.mark.asyncio + async def test_send_logs_large(self, recorded_test, monitor_info, large_data): + credential = self.get_credential(LogsIngestionClient, is_async=True) + client = self.create_client_from_credential( + LogsIngestionClient, credential, endpoint=monitor_info['dce']) + async with client: + await client.upload( + rule_id=monitor_info['dcr_id'], stream_name=monitor_info['stream_name'], logs=large_data) + await credential.close() @pytest.mark.asyncio async def test_send_logs_error(self, recorded_test, monitor_info): @@ -56,7 +67,7 @@ async def test_send_logs_error(self, recorded_test, monitor_info): with pytest.raises(HttpResponseError) as ex: async with client: await client.upload(rule_id='bad-rule', stream_name=monitor_info['stream_name'], logs=body) - credential.close() + await credential.close() @pytest.mark.asyncio async def test_send_logs_error_custom(self, recorded_test, monitor_info): @@ -76,7 +87,7 @@ async def on_error(e): await client.upload( rule_id='bad-rule', stream_name=monitor_info['stream_name'], logs=body, on_error=on_error) assert on_error.called - credential.close() + await credential.close() @pytest.mark.asyncio async def test_send_logs_json_file(self, recorded_test, monitor_info): @@ -92,7 +103,7 @@ async def test_send_logs_json_file(self, recorded_test, monitor_info): with open(temp_file, 'r') as f: await client.upload(rule_id=monitor_info['dcr_id'], stream_name=monitor_info['stream_name'], logs=f) os.remove(temp_file) - credential.close() + await credential.close() @pytest.mark.asyncio @pytest.mark.live_test_only("Issues recording binary streams with test-proxy") @@ -109,4 +120,49 @@ async def test_send_logs_gzip_file(self, monitor_info): with open(temp_file, 'rb') as f: await client.upload(rule_id=monitor_info['dcr_id'], stream_name=monitor_info['stream_name'], logs=f) os.remove(temp_file) - credential.close() + await credential.close() + + + @pytest.mark.asyncio + async def test_abort_error_handler(self, monitor_info): + credential = self.get_credential(LogsIngestionClient, is_async=True) + client = self.create_client_from_credential( + LogsIngestionClient, credential, endpoint=monitor_info['dce']) + body = [{"foo": "bar"}] + + class TestException(Exception): + pass + + async def on_error(e): + on_error.called = True + if isinstance(e.error, RuntimeError): + raise TestException("Abort") + return + + on_error.called = False + + async with client: + # No exception should be raised + with mock.patch("azure.monitor.ingestion.aio._operations._patch.GeneratedOps.upload", + side_effect=ConnectionError): + await client.upload( + rule_id=monitor_info['dcr_id'], + stream_name=monitor_info['stream_name'], + logs=LOGS_BODY, + on_error=on_error) + + assert on_error.called + + on_error.called = False + # Exception should now be raised since error handler checked for RuntimeError. + with mock.patch("azure.monitor.ingestion.aio._operations._patch.GeneratedOps.upload", + side_effect=RuntimeError): + with pytest.raises(TestException): + await client.upload( + rule_id=monitor_info['dcr_id'], + stream_name=monitor_info['stream_name'], + logs=LOGS_BODY, + on_error=on_error) + + assert on_error.called + await credential.close() diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/pyproject.toml b/sdk/monitor/azure-monitor-opentelemetry-exporter/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/monitor/azure-monitor-query/assets.json b/sdk/monitor/azure-monitor-query/assets.json index b690ba12d5b7..d9529eaeb9b0 100644 --- a/sdk/monitor/azure-monitor-query/assets.json +++ b/sdk/monitor/azure-monitor-query/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/monitor/azure-monitor-query", - "Tag": "python/monitor/azure-monitor-query_3c8d44893c" + "Tag": "python/monitor/azure-monitor-query_86a8ec0380" } diff --git a/sdk/monitor/azure-monitor-query/pyproject.toml b/sdk/monitor/azure-monitor-query/pyproject.toml new file mode 100644 index 000000000000..4c6583046165 --- /dev/null +++ b/sdk/monitor/azure-monitor-query/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +type_check_samples = false diff --git a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py index 50dd0d60da6f..d14f57607e3d 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py +++ b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py @@ -10,7 +10,8 @@ from devtools_testutils import AzureRecordedTestCase -METRIC_NAME = "Event" +METRIC_NAME = "requests/count" +METRIC_RESOURCE_PROVIDER = "Microsoft.Insights/components" class TestMetricsClient(AzureRecordedTestCase): @@ -37,6 +38,10 @@ def test_metrics_granularity(self, recorded_test, monitor_info): ) assert response assert response.granularity == timedelta(minutes=5) + metric = response.metrics[METRIC_NAME] + assert metric.timeseries + for t in metric.timeseries: + assert t.metadata_values is not None def test_metrics_filter(self, recorded_test, monitor_info): client = self.create_client_from_credential(MetricsQueryClient, self.get_credential(MetricsQueryClient)) @@ -45,7 +50,7 @@ def test_metrics_filter(self, recorded_test, monitor_info): metric_names=[METRIC_NAME], timespan=timedelta(days=1), granularity=timedelta(minutes=5), - filter="Source eq '*'", + filter="request/success eq '0'", aggregations=[MetricAggregationType.COUNT] ) assert response @@ -99,7 +104,7 @@ def test_metrics_namespaces(self, recorded_test, monitor_info): def test_metrics_definitions(self, recorded_test, monitor_info): client = self.create_client_from_credential(MetricsQueryClient, self.get_credential(MetricsQueryClient)) response = client.list_metric_definitions( - monitor_info['metrics_resource_id'], namespace='Microsoft.OperationalInsights/workspaces') + monitor_info['metrics_resource_id'], namespace=METRIC_RESOURCE_PROVIDER) assert response is not None for item in response: diff --git a/sdk/monitor/azure-monitor-query/tests/test_metrics_client_async.py b/sdk/monitor/azure-monitor-query/tests/test_metrics_client_async.py index e49b2618405d..668796776dc7 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_metrics_client_async.py +++ b/sdk/monitor/azure-monitor-query/tests/test_metrics_client_async.py @@ -14,7 +14,9 @@ from devtools_testutils import AzureRecordedTestCase -METRIC_NAME = "Event" +METRIC_NAME = "requests/count" +METRIC_RESOURCE_PROVIDER = "Microsoft.Insights/components" + class TestMetricsClientAsync(AzureRecordedTestCase): @@ -46,6 +48,10 @@ async def test_metrics_granularity(self, recorded_test, monitor_info): ) assert response assert response.granularity == timedelta(minutes=5) + metric = response.metrics[METRIC_NAME] + assert metric.timeseries + for t in metric.timeseries: + assert t.metadata_values is not None @pytest.mark.asyncio async def test_metrics_filter(self, recorded_test, monitor_info): @@ -57,7 +63,7 @@ async def test_metrics_filter(self, recorded_test, monitor_info): metric_names=[METRIC_NAME], timespan=timedelta(days=1), granularity=timedelta(minutes=5), - filter="Source eq '*'", + filter="request/success eq '0'", aggregations=[MetricAggregationType.COUNT] ) assert response @@ -124,7 +130,7 @@ async def test_metrics_definitions(self, recorded_test, monitor_info): async with client: response = client.list_metric_definitions( - monitor_info['metrics_resource_id'], namespace='Microsoft.OperationalInsights/workspaces') + monitor_info['metrics_resource_id'], namespace=METRIC_RESOURCE_PROVIDER) assert response is not None async for item in response: diff --git a/sdk/monitor/test-resources.bicep b/sdk/monitor/test-resources.bicep index f6ee3524232a..45b985709dde 100644 --- a/sdk/monitor/test-resources.bicep +++ b/sdk/monitor/test-resources.bicep @@ -231,7 +231,7 @@ resource dataCollectionRule 'Microsoft.Insights/dataCollectionRules@2021-09-01-p } output APPLICATIONINSIGHTS_CONNECTION_STRING string = applicationInsightsComponent.properties.ConnectionString -output METRICS_RESOURCE_ID string = primaryWorkspace.id +output METRICS_RESOURCE_ID string = applicationInsightsComponent.id output AZURE_MONITOR_WORKSPACE_ID string = primaryWorkspace.properties.customerId output AZURE_MONITOR_SECONDARY_WORKSPACE_ID string = secondaryWorkspace.properties.customerId output AZURE_MONITOR_DCE string = dataCollectionEndpoint.properties.logsIngestion.endpoint diff --git a/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md b/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md index 3befc67394c6..272ec957d05e 100644 --- a/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md +++ b/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 9.0.2b1 (2023-02-16) + +### Other Changes + + - Added generated samples in github repo + - Drop support for python<3.7.0 + ## 9.0.1 (2022-10-26) ### Bugs Fixed diff --git a/sdk/netapp/azure-mgmt-netapp/README.md b/sdk/netapp/azure-mgmt-netapp/README.md index 3ea127244c32..6c8a56f22f08 100644 --- a/sdk/netapp/azure-mgmt-netapp/README.md +++ b/sdk/netapp/azure-mgmt-netapp/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [NetApp Files Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-netapp +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = NetAppManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [NetApp Files Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/netapp/azure-mgmt-netapp/_meta.json b/sdk/netapp/azure-mgmt-netapp/_meta.json index ef686342ee9e..182d26e1fd2f 100644 --- a/sdk/netapp/azure-mgmt-netapp/_meta.json +++ b/sdk/netapp/azure-mgmt-netapp/_meta.json @@ -1,11 +1,11 @@ { + "commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.11", + "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "commit": "d1eee5499dbf9281debdc90c4f4cbc7470fb8d6d", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/netapp/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.11 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/netapp/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/netapp/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py index 22a5110cce5f..877de7b3e183 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["NetAppManagementClient"] +__all__ = [ + "NetAppManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py index f82a7459743f..73908b90073a 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -37,7 +43,7 @@ class NetAppManagementClientConfiguration(Configuration): # pylint: disable=too def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(NetAppManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-netapp/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py index 150884608fed..d8c85c60fb36 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import NetAppManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -98,7 +98,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -146,15 +146,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> NetAppManagementClient + def __enter__(self) -> "NetAppManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py index 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,24 +38,22 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, Mapping try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - class RawDeserializer: @@ -65,8 +64,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +130,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +157,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +185,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +216,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,9 +273,9 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs): self.additional_properties = {} @@ -310,7 +307,7 @@ def enable_additional_properties_sending(cls): @classmethod def is_xml_model(cls): try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,7 +316,7 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} @@ -453,7 +450,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -606,13 +603,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +618,23 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -675,7 +672,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -843,7 +840,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +998,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1416,7 +1413,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1441,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1543,7 +1540,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1562,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1744,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1795,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1807,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1823,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1838,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1868,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1883,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1898,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1921,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1957,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py index eef1380c4107..6e7b756d1fa5 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.0.1" +VERSION = "9.0.2b1" diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py index b3e2c409d373..1d833f94c238 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["NetAppManagementClient"] +__all__ = [ + "NetAppManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py index 9ac41b907133..73c88b9ad833 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -37,7 +43,7 @@ class NetAppManagementClientConfiguration(Configuration): # pylint: disable=too def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(NetAppManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py index ce0f40547e29..173eb990b983 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import NetAppManagementClientConfiguration from .operations import ( @@ -98,7 +98,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py index 5ee6d3248f6e..a99aa02bd8bf 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py @@ -23,7 +23,7 @@ from ._subvolumes_operations import SubvolumesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py index d53faee406ae..eb9206342091 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse @@ -32,6 +33,10 @@ from ..._vendor import _convert_request from ...operations._account_backups_operations import build_delete_request, build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,8 +78,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupsList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -97,7 +104,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -113,7 +120,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +128,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +147,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, backup_name: str, **kwargs: Any) -> _models.Backup: @@ -170,8 +179,10 @@ async def get(self, resource_group_name: str, account_name: str, backup_name: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -184,9 +195,9 @@ async def get(self, resource_group_name: str, account_name: str, backup_name: st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +214,9 @@ async def get(self, resource_group_name: str, account_name: str, backup_name: st return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, backup_name: str, **kwargs: Any @@ -219,8 +232,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -233,9 +248,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -248,7 +263,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + } @distributed_trace_async async def begin_delete( @@ -279,11 +296,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -302,9 +321,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -316,6 +335,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py index 223e07fe6765..bf7af4e994f7 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,8 +82,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetAppAc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccountList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.NetAppAccountList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -99,7 +106,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -115,7 +122,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -123,13 +130,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -142,7 +149,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts"} @distributed_trace def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetAppAccount"]: @@ -160,8 +167,10 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccountList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.NetAppAccountList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -183,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -199,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -207,13 +216,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -226,7 +235,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.NetAppAccount: @@ -254,8 +265,10 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -267,9 +280,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -286,7 +299,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } async def _create_or_update_initial( self, resource_group_name: str, account_name: str, body: Union[_models.NetAppAccount, IO], **kwargs: Any @@ -302,9 +317,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,9 +344,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -346,11 +363,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("NetAppAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } @overload async def begin_create_or_update( @@ -460,14 +479,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, body=body, @@ -487,10 +508,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -502,9 +523,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -520,8 +543,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -533,9 +558,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -548,7 +573,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -575,11 +602,13 @@ async def begin_delete(self, resource_group_name: str, account_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -597,9 +626,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -611,9 +640,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } async def _update_initial( self, resource_group_name: str, account_name: str, body: Union[_models.NetAppAccountPatch, IO], **kwargs: Any @@ -629,9 +660,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -654,9 +687,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -673,11 +706,13 @@ async def _update_initial( deserialized = self._deserialize("NetAppAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } @overload async def begin_update( @@ -787,14 +822,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, body=body, @@ -814,9 +851,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -828,9 +865,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } async def _renew_credentials_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -846,8 +885,10 @@ async def _renew_credentials_initial( # pylint: disable=inconsistent-return-sta _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_renew_credentials_request( resource_group_name=resource_group_name, @@ -859,9 +900,9 @@ async def _renew_credentials_initial( # pylint: disable=inconsistent-return-sta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -874,7 +915,9 @@ async def _renew_credentials_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _renew_credentials_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials"} # type: ignore + _renew_credentials_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials" + } @distributed_trace_async async def begin_renew_credentials( @@ -905,11 +948,13 @@ async def begin_renew_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._renew_credentials_initial( # type: ignore resource_group_name=resource_group_name, @@ -927,10 +972,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -942,6 +987,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_renew_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials"} # type: ignore + begin_renew_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py index 8c6052d03a42..c4f9cde91675 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,6 +39,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPoliciesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies" + } @distributed_trace_async async def get( @@ -178,8 +187,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -192,9 +203,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -211,7 +222,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } async def _create_initial( self, @@ -232,9 +245,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupPolicy]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupPolicy]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -258,9 +273,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -282,7 +297,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } @overload async def begin_create( @@ -405,14 +422,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, backup_policy_name=backup_policy_name, @@ -433,10 +452,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -448,9 +467,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } async def _update_initial( self, @@ -471,9 +492,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -497,9 +520,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -516,11 +539,13 @@ async def _update_initial( deserialized = self._deserialize("BackupPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } @overload async def begin_update( @@ -643,14 +668,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, backup_policy_name=backup_policy_name, @@ -671,10 +698,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -686,9 +713,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, backup_policy_name: str, **kwargs: Any @@ -704,8 +733,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -718,9 +749,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -733,7 +764,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } @distributed_trace_async async def begin_delete( @@ -764,11 +797,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -787,9 +822,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -801,6 +836,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py index e5fd5dbff7f0..6321a4715d35 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,8 +100,10 @@ async def get_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStatus] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupStatus] = kwargs.pop("cls", None) request = build_get_status_request( resource_group_name=resource_group_name, @@ -110,9 +117,9 @@ async def get_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,7 +136,9 @@ async def get_status( return deserialized - get_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus"} # type: ignore + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus" + } @distributed_trace_async async def get_volume_restore_status( @@ -163,8 +172,10 @@ async def get_volume_restore_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreStatus] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RestoreStatus] = kwargs.pop("cls", None) request = build_get_volume_restore_status_request( resource_group_name=resource_group_name, @@ -178,9 +189,9 @@ async def get_volume_restore_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,7 +208,9 @@ async def get_volume_restore_status( return deserialized - get_volume_restore_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus"} # type: ignore + get_volume_restore_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus" + } @distributed_trace def list( @@ -223,8 +236,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupsList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -249,7 +264,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -265,7 +280,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -273,13 +288,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -292,7 +307,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups" + } @distributed_trace_async async def get( @@ -334,8 +351,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -350,9 +369,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -369,7 +388,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } async def _create_initial( self, @@ -392,9 +413,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Backup]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Backup]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -420,9 +443,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -444,7 +467,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } @overload async def begin_create( @@ -585,14 +610,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -615,9 +642,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -629,9 +656,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } async def _update_initial( self, @@ -654,9 +683,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -685,9 +716,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -704,11 +735,13 @@ async def _update_initial( deserialized = self._deserialize("Backup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } @overload async def begin_update( @@ -849,14 +882,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -879,9 +914,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -893,9 +928,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -917,8 +954,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -933,9 +972,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -948,7 +987,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } @distributed_trace_async async def begin_delete( @@ -989,11 +1030,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1014,9 +1057,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1028,6 +1071,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py index 25780c423089..7c61a4ee9ec2 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -32,6 +33,10 @@ build_query_region_info_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,9 +100,11 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckAvailabilityResponse] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CheckAvailabilityResponse] = kwargs.pop("cls", None) _body = _models.ResourceNameAvailabilityRequest(name=name, resource_group=resource_group, type=type) _json = self._serialize.body(_body, "ResourceNameAvailabilityRequest") @@ -113,9 +120,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,7 +139,9 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability" + } @distributed_trace_async async def check_file_path_availability( @@ -165,9 +174,11 @@ async def check_file_path_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckAvailabilityResponse] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CheckAvailabilityResponse] = kwargs.pop("cls", None) _body = _models.FilePathAvailabilityRequest(name=name, subnet_id=subnet_id) _json = self._serialize.body(_body, "FilePathAvailabilityRequest") @@ -183,9 +194,9 @@ async def check_file_path_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -202,7 +213,9 @@ async def check_file_path_availability( return deserialized - check_file_path_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability"} # type: ignore + check_file_path_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability" + } @distributed_trace_async async def check_quota_availability( @@ -244,9 +257,11 @@ async def check_quota_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckAvailabilityResponse] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CheckAvailabilityResponse] = kwargs.pop("cls", None) _body = _models.QuotaAvailabilityRequest(name=name, resource_group=resource_group, type=type) _json = self._serialize.body(_body, "QuotaAvailabilityRequest") @@ -262,9 +277,9 @@ async def check_quota_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -281,7 +296,9 @@ async def check_quota_availability( return deserialized - check_quota_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability"} # type: ignore + check_quota_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability" + } @distributed_trace_async async def query_region_info(self, location: str, **kwargs: Any) -> _models.RegionInfo: @@ -307,8 +324,10 @@ async def query_region_info(self, location: str, **kwargs: Any) -> _models.Regio _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegionInfo] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RegionInfo] = kwargs.pop("cls", None) request = build_query_region_info_request( location=location, @@ -319,9 +338,9 @@ async def query_region_info(self, location: str, **kwargs: Any) -> _models.Regio params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -338,4 +357,6 @@ async def query_region_info(self, location: str, **kwargs: Any) -> _models.Regio return deserialized - query_region_info.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo"} # type: ignore + query_region_info.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py index 5e328f05b4f5..f9113718c0e4 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._net_app_resource_quota_limits_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,8 +76,10 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Subscript _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionQuotaItemList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubscriptionQuotaItemList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +101,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +117,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionQuotaItemList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits" + } @distributed_trace_async async def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _models.SubscriptionQuotaItem: @@ -165,8 +174,10 @@ async def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionQuotaItem] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubscriptionQuotaItem] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -178,9 +189,9 @@ async def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +208,6 @@ async def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _mod return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py index 7caaaa7f1c3b..2ecabba580b1 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,8 +71,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -87,7 +94,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -103,7 +110,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.NetApp/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.NetApp/operations"} diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py index 551914e6e283..db07ad6968ad 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,6 +39,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPoolList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CapacityPoolList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CapacityPoolList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools" + } @distributed_trace_async async def get( @@ -178,8 +187,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -192,9 +203,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -211,7 +222,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } async def _create_or_update_initial( self, @@ -232,9 +245,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -258,9 +273,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -277,11 +292,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("CapacityPool", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } @overload async def begin_create_or_update( @@ -404,14 +421,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -432,9 +451,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -446,9 +465,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } async def _update_initial( self, @@ -469,9 +490,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CapacityPool]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CapacityPool]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -495,9 +518,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -516,7 +539,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } @overload async def begin_update( @@ -639,14 +664,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -667,9 +694,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -681,9 +708,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any @@ -699,8 +728,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -713,9 +744,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -728,7 +759,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } @distributed_trace_async async def begin_delete( @@ -759,11 +792,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -782,9 +817,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -796,6 +831,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py index da6d688e5144..bd6334758dc2 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPoliciesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +127,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SnapshotPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies" + } @distributed_trace_async async def get( @@ -177,8 +186,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -191,9 +202,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,7 +221,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @overload async def create( @@ -311,9 +324,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -337,9 +352,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -356,11 +371,13 @@ async def create( deserialized = self._deserialize("SnapshotPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } async def _update_initial( self, @@ -381,9 +398,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -407,9 +426,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -426,11 +445,13 @@ async def _update_initial( deserialized = self._deserialize("SnapshotPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @overload async def begin_update( @@ -547,14 +568,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, snapshot_policy_name=snapshot_policy_name, @@ -575,9 +598,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -589,9 +612,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, snapshot_policy_name: str, **kwargs: Any @@ -607,8 +632,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -621,9 +648,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -636,7 +663,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @distributed_trace_async async def begin_delete( @@ -665,11 +694,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -688,9 +719,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -702,9 +733,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @distributed_trace_async async def list_volumes( @@ -736,8 +769,10 @@ async def list_volumes( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicyVolumeList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotPolicyVolumeList] = kwargs.pop("cls", None) request = build_list_volumes_request( resource_group_name=resource_group_name, @@ -750,9 +785,9 @@ async def list_volumes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -769,4 +804,6 @@ async def list_volumes( return deserialized - list_volumes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes"} # type: ignore + list_volumes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py index 36d09d947bd6..a25737d972f6 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py @@ -44,6 +44,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,8 +96,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotsList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -118,7 +124,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -134,7 +140,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -142,13 +148,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SnapshotsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,7 +167,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots" + } @distributed_trace_async async def get( @@ -203,8 +211,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -219,9 +229,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -238,7 +248,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } async def _create_initial( self, @@ -261,9 +273,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Snapshot]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -289,9 +303,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -310,7 +324,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } @overload async def begin_create( @@ -451,14 +467,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -481,9 +499,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -495,9 +513,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } async def _update_initial( self, @@ -520,9 +540,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Snapshot]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) _json = self._serialize.body(body, "object") @@ -541,9 +563,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -562,7 +584,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } @distributed_trace_async async def begin_update( @@ -607,14 +631,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -637,9 +663,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -651,9 +677,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -675,8 +703,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -691,9 +721,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -706,7 +736,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } @distributed_trace_async async def begin_delete( @@ -747,11 +779,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -772,9 +806,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -786,9 +820,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } async def _restore_files_initial( # pylint: disable=inconsistent-return-statements self, @@ -811,9 +847,11 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,9 +877,9 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -854,7 +892,9 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - _restore_files_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles"} # type: ignore + _restore_files_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles" + } @overload async def begin_restore_files( @@ -992,12 +1032,14 @@ async def begin_restore_files( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._restore_files_initial( # type: ignore resource_group_name=resource_group_name, @@ -1020,7 +1062,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1032,6 +1074,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restore_files.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles"} # type: ignore + begin_restore_files.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py index 7efa659359e6..674c432967e4 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,8 +91,10 @@ def list_by_volume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubvolumesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -112,7 +119,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -128,7 +135,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -136,13 +143,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SubvolumesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,7 +162,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_volume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes"} # type: ignore + list_by_volume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes" + } @distributed_trace_async async def get( @@ -197,8 +206,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeInfo] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubvolumeInfo] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -213,9 +224,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -232,7 +243,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } async def _create_initial( self, @@ -255,9 +268,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SubvolumeInfo]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -283,9 +298,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -307,7 +322,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } @overload async def begin_create( @@ -448,14 +465,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubvolumeInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -478,10 +497,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -493,9 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } async def _update_initial( self, @@ -518,9 +539,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SubvolumeInfo]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -546,9 +569,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -567,7 +590,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } @overload async def begin_update( @@ -708,14 +733,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubvolumeInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -738,10 +765,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -753,9 +780,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -777,8 +806,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -793,9 +824,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -808,7 +839,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } @distributed_trace_async async def begin_delete( @@ -849,11 +882,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -874,10 +909,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -889,9 +924,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } async def _get_metadata_initial( self, @@ -913,8 +950,10 @@ async def _get_metadata_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SubvolumeModel]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.SubvolumeModel]] = kwargs.pop("cls", None) request = build_get_metadata_request( resource_group_name=resource_group_name, @@ -929,9 +968,9 @@ async def _get_metadata_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -950,7 +989,9 @@ async def _get_metadata_initial( return deserialized - _get_metadata_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata"} # type: ignore + _get_metadata_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata" + } @distributed_trace_async async def begin_get_metadata( @@ -992,13 +1033,15 @@ async def begin_get_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeModel] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubvolumeModel] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._get_metadata_initial( # type: ignore + raw_result = await self._get_metadata_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1019,10 +1062,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1034,6 +1077,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_get_metadata.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata"} # type: ignore + begin_get_metadata.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py index e8f7a4f2f039..e6e66bd1fa42 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._vaults_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VaultList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VaultList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +101,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +117,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,4 +144,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py index f902f2519014..48ff35d98145 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,6 +38,10 @@ build_list_by_net_app_account_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ def list_by_net_app_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeGroupList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +127,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VolumeGroupList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_net_app_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups"} # type: ignore + list_by_net_app_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups" + } @distributed_trace_async async def get( @@ -179,8 +188,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupDetails] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -193,9 +204,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,7 +223,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } async def _create_initial( self, @@ -233,9 +246,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupDetails] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -259,9 +274,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,7 +293,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } @overload async def begin_create( @@ -407,14 +424,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupDetails] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, volume_group_name=volume_group_name, @@ -435,7 +454,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -447,9 +466,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, volume_group_name: str, **kwargs: Any @@ -465,8 +486,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -479,9 +502,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -494,7 +517,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } @distributed_trace_async async def begin_delete( @@ -525,11 +550,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -548,7 +575,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -560,6 +587,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py index 267600bbf9d1..8e6594beb480 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,6 +39,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,10 @@ def list_by_volume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRulesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeQuotaRulesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +118,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +134,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +142,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VolumeQuotaRulesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,7 +161,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_volume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules"} # type: ignore + list_by_volume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules" + } @distributed_trace_async async def get( @@ -196,8 +205,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -212,9 +223,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -231,7 +242,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } async def _create_initial( self, @@ -254,9 +267,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -282,9 +297,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -301,11 +316,13 @@ async def _create_initial( deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } @overload async def begin_create( @@ -446,14 +463,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -476,9 +495,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -490,9 +509,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } async def _update_initial( self, @@ -515,9 +536,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VolumeQuotaRule]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VolumeQuotaRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -543,9 +566,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -564,7 +587,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } @overload async def begin_update( @@ -705,14 +730,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -735,9 +762,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -749,9 +776,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -773,8 +802,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -789,9 +820,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -804,7 +835,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } @distributed_trace_async async def begin_delete( @@ -845,11 +878,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -870,9 +905,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -884,6 +919,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py index fe4a0b6c14e3..ae2073a5a265 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -52,6 +53,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,8 +102,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -122,7 +129,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -138,7 +145,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +153,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VolumeList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -165,7 +172,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes" + } @distributed_trace_async async def get( @@ -199,8 +208,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Volume] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -214,9 +225,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -233,7 +244,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } async def _create_or_update_initial( self, @@ -255,9 +268,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Volume]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -282,9 +297,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -306,7 +321,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } @overload async def begin_create_or_update( @@ -438,14 +455,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Volume] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -467,10 +486,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -482,9 +501,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } async def _update_initial( self, @@ -506,9 +527,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Volume]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -533,9 +556,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -554,7 +577,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } @overload async def begin_update( @@ -686,14 +711,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Volume] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -715,9 +742,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -729,9 +756,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -753,8 +782,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -769,9 +800,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -784,7 +815,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } @distributed_trace_async async def begin_delete( @@ -826,11 +859,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -851,9 +886,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -865,9 +900,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } async def _revert_initial( # pylint: disable=inconsistent-return-statements self, @@ -889,9 +926,11 @@ async def _revert_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -916,9 +955,9 @@ async def _revert_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -931,7 +970,9 @@ async def _revert_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _revert_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert"} # type: ignore + _revert_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert" + } @overload async def begin_revert( @@ -1060,12 +1101,14 @@ async def begin_revert( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._revert_initial( # type: ignore resource_group_name=resource_group_name, @@ -1087,9 +1130,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1101,9 +1144,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_revert.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert"} # type: ignore + begin_revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert" + } async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -1119,8 +1164,10 @@ async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_cifs_password_request( resource_group_name=resource_group_name, @@ -1134,9 +1181,9 @@ async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-s params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1149,7 +1196,9 @@ async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-s if cls: return cls(pipeline_response, None, {}) - _reset_cifs_password_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword"} # type: ignore + _reset_cifs_password_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword" + } @distributed_trace_async async def begin_reset_cifs_password( @@ -1182,11 +1231,13 @@ async def begin_reset_cifs_password( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._reset_cifs_password_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,7 +1257,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1218,9 +1269,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_reset_cifs_password.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword"} # type: ignore + begin_reset_cifs_password.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword" + } async def _break_replication_initial( # pylint: disable=inconsistent-return-statements self, @@ -1242,9 +1295,11 @@ async def _break_replication_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1272,9 +1327,9 @@ async def _break_replication_initial( # pylint: disable=inconsistent-return-sta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1287,7 +1342,9 @@ async def _break_replication_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _break_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication"} # type: ignore + _break_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication" + } @overload async def begin_break_replication( @@ -1416,12 +1473,14 @@ async def begin_break_replication( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._break_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -1443,9 +1502,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1457,9 +1516,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_break_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication"} # type: ignore + begin_break_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication" + } async def _reestablish_replication_initial( # pylint: disable=inconsistent-return-statements self, @@ -1481,9 +1542,11 @@ async def _reestablish_replication_initial( # pylint: disable=inconsistent-retu _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1508,9 +1571,9 @@ async def _reestablish_replication_initial( # pylint: disable=inconsistent-retu params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1523,7 +1586,9 @@ async def _reestablish_replication_initial( # pylint: disable=inconsistent-retu if cls: return cls(pipeline_response, None, {}) - _reestablish_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication"} # type: ignore + _reestablish_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication" + } @overload async def begin_reestablish_replication( @@ -1655,12 +1720,14 @@ async def begin_reestablish_replication( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._reestablish_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -1682,9 +1749,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1696,9 +1763,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_reestablish_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication"} # type: ignore + begin_reestablish_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication" + } @distributed_trace_async async def replication_status( @@ -1732,8 +1801,10 @@ async def replication_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReplicationStatus] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ReplicationStatus] = kwargs.pop("cls", None) request = build_replication_status_request( resource_group_name=resource_group_name, @@ -1747,9 +1818,9 @@ async def replication_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1766,7 +1837,9 @@ async def replication_status( return deserialized - replication_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus"} # type: ignore + replication_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus" + } @distributed_trace def list_replications( @@ -1792,8 +1865,10 @@ def list_replications( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListReplications] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ListReplications] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1818,7 +1893,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1834,7 +1909,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1842,13 +1917,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListReplications", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1861,7 +1936,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_replications.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications"} # type: ignore + list_replications.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications" + } async def _resync_replication_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -1877,8 +1954,10 @@ async def _resync_replication_initial( # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_resync_replication_request( resource_group_name=resource_group_name, @@ -1892,9 +1971,9 @@ async def _resync_replication_initial( # pylint: disable=inconsistent-return-st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1907,7 +1986,9 @@ async def _resync_replication_initial( # pylint: disable=inconsistent-return-st if cls: return cls(pipeline_response, None, {}) - _resync_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication"} # type: ignore + _resync_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication" + } @distributed_trace_async async def begin_resync_replication( @@ -1941,11 +2022,13 @@ async def begin_resync_replication( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._resync_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -1965,9 +2048,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1979,9 +2062,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_resync_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication"} # type: ignore + begin_resync_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication" + } async def _delete_replication_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -1997,8 +2082,10 @@ async def _delete_replication_initial( # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_replication_request( resource_group_name=resource_group_name, @@ -2012,9 +2099,9 @@ async def _delete_replication_initial( # pylint: disable=inconsistent-return-st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2027,7 +2114,9 @@ async def _delete_replication_initial( # pylint: disable=inconsistent-return-st if cls: return cls(pipeline_response, None, {}) - _delete_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication"} # type: ignore + _delete_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication" + } @distributed_trace_async async def begin_delete_replication( @@ -2061,11 +2150,13 @@ async def begin_delete_replication( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -2085,9 +2176,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2099,9 +2190,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication"} # type: ignore + begin_delete_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication" + } async def _authorize_replication_initial( # pylint: disable=inconsistent-return-statements self, @@ -2123,9 +2216,11 @@ async def _authorize_replication_initial( # pylint: disable=inconsistent-return _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2150,9 +2245,9 @@ async def _authorize_replication_initial( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2165,7 +2260,9 @@ async def _authorize_replication_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _authorize_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication"} # type: ignore + _authorize_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication" + } @overload async def begin_authorize_replication( @@ -2294,12 +2391,14 @@ async def begin_authorize_replication( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._authorize_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -2321,9 +2420,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2335,9 +2434,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_authorize_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication"} # type: ignore + begin_authorize_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication" + } async def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -2353,8 +2454,10 @@ async def _re_initialize_replication_initial( # pylint: disable=inconsistent-re _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_re_initialize_replication_request( resource_group_name=resource_group_name, @@ -2368,9 +2471,9 @@ async def _re_initialize_replication_initial( # pylint: disable=inconsistent-re params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2383,7 +2486,9 @@ async def _re_initialize_replication_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _re_initialize_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication"} # type: ignore + _re_initialize_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication" + } @distributed_trace_async async def begin_re_initialize_replication( @@ -2416,11 +2521,13 @@ async def begin_re_initialize_replication( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._re_initialize_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -2440,9 +2547,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2454,9 +2561,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_re_initialize_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication"} # type: ignore + begin_re_initialize_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication" + } async def _pool_change_initial( # pylint: disable=inconsistent-return-statements self, @@ -2478,9 +2587,11 @@ async def _pool_change_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2505,9 +2616,9 @@ async def _pool_change_initial( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2520,7 +2631,9 @@ async def _pool_change_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _pool_change_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange"} # type: ignore + _pool_change_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange" + } @overload async def begin_pool_change( @@ -2649,12 +2762,14 @@ async def begin_pool_change( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._pool_change_initial( # type: ignore resource_group_name=resource_group_name, @@ -2676,9 +2791,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2690,9 +2805,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_pool_change.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange"} # type: ignore + begin_pool_change.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange" + } async def _relocate_initial( # pylint: disable=inconsistent-return-statements self, @@ -2714,9 +2831,11 @@ async def _relocate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2744,9 +2863,9 @@ async def _relocate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2759,7 +2878,9 @@ async def _relocate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _relocate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate"} # type: ignore + _relocate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate" + } @overload async def begin_relocate( @@ -2888,12 +3009,14 @@ async def begin_relocate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._relocate_initial( # type: ignore resource_group_name=resource_group_name, @@ -2915,7 +3038,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2927,9 +3050,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_relocate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate"} # type: ignore + begin_relocate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate" + } async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -2945,8 +3070,10 @@ async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_finalize_relocation_request( resource_group_name=resource_group_name, @@ -2960,9 +3087,9 @@ async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-s params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2975,7 +3102,9 @@ async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-s if cls: return cls(pipeline_response, None, {}) - _finalize_relocation_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation"} # type: ignore + _finalize_relocation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation" + } @distributed_trace_async async def begin_finalize_relocation( @@ -3008,11 +3137,13 @@ async def begin_finalize_relocation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._finalize_relocation_initial( # type: ignore resource_group_name=resource_group_name, @@ -3032,7 +3163,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3044,9 +3175,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_finalize_relocation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation"} # type: ignore + begin_finalize_relocation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation" + } async def _revert_relocation_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -3062,8 +3195,10 @@ async def _revert_relocation_initial( # pylint: disable=inconsistent-return-sta _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_revert_relocation_request( resource_group_name=resource_group_name, @@ -3077,9 +3212,9 @@ async def _revert_relocation_initial( # pylint: disable=inconsistent-return-sta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3092,7 +3227,9 @@ async def _revert_relocation_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _revert_relocation_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation"} # type: ignore + _revert_relocation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation" + } @distributed_trace_async async def begin_revert_relocation( @@ -3126,11 +3263,13 @@ async def begin_revert_relocation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._revert_relocation_initial( # type: ignore resource_group_name=resource_group_name, @@ -3150,7 +3289,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -3162,6 +3301,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_revert_relocation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation"} # type: ignore + begin_revert_relocation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py index 599c7623d642..25a7793a743f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py @@ -132,7 +132,7 @@ from ._net_app_management_client_enums import Type from ._net_app_management_client_enums import VolumeStorageToNetworkProximity from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py index 5ee6d3248f6e..a99aa02bd8bf 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py @@ -23,7 +23,7 @@ from ._subvolumes_operations import SubvolumesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py index 423ea9d7ef45..65ca606602b4 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +63,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +97,7 @@ def build_get_request( "backupName": _SERIALIZER.url("backup_name", backup_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +113,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -123,7 +128,7 @@ def build_delete_request( "backupName": _SERIALIZER.url("backup_name", backup_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,8 +173,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupsList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +199,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +215,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +223,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +242,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, backup_name: str, **kwargs: Any) -> _models.Backup: @@ -265,8 +274,10 @@ def get(self, resource_group_name: str, account_name: str, backup_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -279,9 +290,9 @@ def get(self, resource_group_name: str, account_name: str, backup_name: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +309,9 @@ def get(self, resource_group_name: str, account_name: str, backup_name: str, **k return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, backup_name: str, **kwargs: Any @@ -314,8 +327,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -328,9 +343,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -343,7 +358,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + } @distributed_trace def begin_delete( @@ -374,11 +391,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -397,9 +416,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -411,6 +430,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py index edc25dc835d8..3dbac0424833 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -66,7 +71,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +86,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,7 +101,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +117,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -129,8 +134,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +151,7 @@ def build_create_or_update_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +169,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -178,7 +183,7 @@ def build_delete_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,8 +197,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,7 +214,7 @@ def build_update_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -227,7 +232,7 @@ def build_renew_credentials_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -241,7 +246,7 @@ def build_renew_credentials_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -282,8 +287,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetAppAccount _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccountList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.NetAppAccountList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,7 +311,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -320,7 +327,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -328,13 +335,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -347,7 +354,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts"} @distributed_trace def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetAppAccount"]: @@ -365,8 +372,10 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Net _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccountList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.NetAppAccountList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -388,7 +397,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -404,7 +413,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -412,13 +421,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -431,7 +440,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.NetAppAccount: @@ -459,8 +470,10 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -472,9 +485,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -491,7 +504,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } def _create_or_update_initial( self, resource_group_name: str, account_name: str, body: Union[_models.NetAppAccount, IO], **kwargs: Any @@ -507,9 +522,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -532,9 +549,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -551,11 +568,13 @@ def _create_or_update_initial( deserialized = self._deserialize("NetAppAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } @overload def begin_create_or_update( @@ -665,14 +684,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, body=body, @@ -692,9 +713,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -706,9 +727,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -724,8 +747,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -737,9 +762,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -752,7 +777,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -779,11 +806,13 @@ def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,9 +830,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -815,9 +844,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } def _update_initial( self, resource_group_name: str, account_name: str, body: Union[_models.NetAppAccountPatch, IO], **kwargs: Any @@ -833,9 +864,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -858,9 +891,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -877,11 +910,13 @@ def _update_initial( deserialized = self._deserialize("NetAppAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } @overload def begin_update( @@ -991,14 +1026,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NetAppAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, body=body, @@ -1018,9 +1055,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1032,9 +1069,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + } def _renew_credentials_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -1050,8 +1089,10 @@ def _renew_credentials_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_renew_credentials_request( resource_group_name=resource_group_name, @@ -1063,9 +1104,9 @@ def _renew_credentials_initial( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1078,7 +1119,9 @@ def _renew_credentials_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _renew_credentials_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials"} # type: ignore + _renew_credentials_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials" + } @distributed_trace def begin_renew_credentials(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1107,11 +1150,13 @@ def begin_renew_credentials(self, resource_group_name: str, account_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._renew_credentials_initial( # type: ignore resource_group_name=resource_group_name, @@ -1129,9 +1174,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1143,6 +1188,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_renew_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials"} # type: ignore + begin_renew_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py index d9aa843bb97a..f2ecf73d9e52 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +63,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +97,7 @@ def build_get_request( "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,8 +114,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +132,7 @@ def build_create_request( "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,8 +151,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +169,7 @@ def build_update_request( "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,7 +187,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -197,7 +202,7 @@ def build_delete_request( "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,8 +247,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPoliciesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -266,7 +273,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -282,7 +289,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -290,13 +297,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -309,7 +316,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies" + } @distributed_trace def get( @@ -341,8 +350,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -355,9 +366,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -374,7 +385,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } def _create_initial( self, @@ -395,9 +408,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BackupPolicy]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BackupPolicy]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -421,9 +436,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -445,7 +460,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } @overload def begin_create( @@ -568,14 +585,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, backup_policy_name=backup_policy_name, @@ -596,9 +615,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -610,9 +629,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } def _update_initial( self, @@ -633,9 +654,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -659,9 +682,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -678,11 +701,13 @@ def _update_initial( deserialized = self._deserialize("BackupPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } @overload def begin_update( @@ -805,14 +830,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, backup_policy_name=backup_policy_name, @@ -833,9 +860,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -847,9 +874,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, backup_policy_name: str, **kwargs: Any @@ -865,8 +894,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -879,9 +910,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -894,7 +925,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } @distributed_trace def begin_delete( @@ -925,11 +958,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,9 +983,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -962,6 +997,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py index 8bed9a391bfa..5d6da8f2e644 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,7 @@ def build_get_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_get_status_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +88,7 @@ def build_get_volume_restore_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +110,7 @@ def build_get_volume_restore_status_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,7 +127,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +149,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +172,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +195,7 @@ def build_get_request( "backupName": _SERIALIZER.url("backup_name", backup_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,8 +218,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +242,7 @@ def build_create_request( "backupName": _SERIALIZER.url("backup_name", backup_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,8 +267,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +291,7 @@ def build_update_request( "backupName": _SERIALIZER.url("backup_name", backup_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -310,7 +315,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -331,7 +336,7 @@ def build_delete_request( "backupName": _SERIALIZER.url("backup_name", backup_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -390,8 +395,10 @@ def get_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStatus] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupStatus] = kwargs.pop("cls", None) request = build_get_status_request( resource_group_name=resource_group_name, @@ -405,9 +412,9 @@ def get_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -424,7 +431,9 @@ def get_status( return deserialized - get_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus"} # type: ignore + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus" + } @distributed_trace def get_volume_restore_status( @@ -458,8 +467,10 @@ def get_volume_restore_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreStatus] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RestoreStatus] = kwargs.pop("cls", None) request = build_get_volume_restore_status_request( resource_group_name=resource_group_name, @@ -473,9 +484,9 @@ def get_volume_restore_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -492,7 +503,9 @@ def get_volume_restore_status( return deserialized - get_volume_restore_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus"} # type: ignore + get_volume_restore_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus" + } @distributed_trace def list( @@ -518,8 +531,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupsList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -544,7 +559,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -560,7 +575,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -568,13 +583,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -587,7 +602,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups" + } @distributed_trace def get( @@ -629,8 +646,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -645,9 +664,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -664,7 +683,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } def _create_initial( self, @@ -687,9 +708,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Backup]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Backup]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -715,9 +738,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -739,7 +762,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } @overload def begin_create( @@ -877,14 +902,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -907,9 +934,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -921,9 +948,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } def _update_initial( self, @@ -946,9 +975,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -977,9 +1008,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -996,11 +1027,13 @@ def _update_initial( deserialized = self._deserialize("Backup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } @overload def begin_update( @@ -1138,14 +1171,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Backup] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1168,9 +1203,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1182,9 +1217,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1206,8 +1243,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1222,9 +1261,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1237,7 +1276,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } @distributed_trace def begin_delete( @@ -1278,11 +1319,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1303,9 +1346,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1317,6 +1360,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py index 78f431b2a56a..4d03a3b01060 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,8 @@ def build_check_name_availability_request(location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,8 +74,8 @@ def build_check_file_path_availability_request(location: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_check_file_path_availability_request(location: str, subscription_id: s "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +105,8 @@ def build_check_quota_availability_request(location: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +119,7 @@ def build_check_quota_availability_request(location: str, subscription_id: str, "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +136,7 @@ def build_query_region_info_request(location: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +148,7 @@ def build_query_region_info_request(location: str, subscription_id: str, **kwarg "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,9 +218,11 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckAvailabilityResponse] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CheckAvailabilityResponse] = kwargs.pop("cls", None) _body = _models.ResourceNameAvailabilityRequest(name=name, resource_group=resource_group, type=type) _json = self._serialize.body(_body, "ResourceNameAvailabilityRequest") @@ -231,9 +238,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,7 +257,9 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability" + } @distributed_trace def check_file_path_availability( @@ -283,9 +292,11 @@ def check_file_path_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckAvailabilityResponse] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CheckAvailabilityResponse] = kwargs.pop("cls", None) _body = _models.FilePathAvailabilityRequest(name=name, subnet_id=subnet_id) _json = self._serialize.body(_body, "FilePathAvailabilityRequest") @@ -301,9 +312,9 @@ def check_file_path_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -320,7 +331,9 @@ def check_file_path_availability( return deserialized - check_file_path_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability"} # type: ignore + check_file_path_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability" + } @distributed_trace def check_quota_availability( @@ -362,9 +375,11 @@ def check_quota_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckAvailabilityResponse] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CheckAvailabilityResponse] = kwargs.pop("cls", None) _body = _models.QuotaAvailabilityRequest(name=name, resource_group=resource_group, type=type) _json = self._serialize.body(_body, "QuotaAvailabilityRequest") @@ -380,9 +395,9 @@ def check_quota_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -399,7 +414,9 @@ def check_quota_availability( return deserialized - check_quota_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability"} # type: ignore + check_quota_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability" + } @distributed_trace def query_region_info(self, location: str, **kwargs: Any) -> _models.RegionInfo: @@ -425,8 +442,10 @@ def query_region_info(self, location: str, **kwargs: Any) -> _models.RegionInfo: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegionInfo] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RegionInfo] = kwargs.pop("cls", None) request = build_query_region_info_request( location=location, @@ -437,9 +456,9 @@ def query_region_info(self, location: str, **kwargs: Any) -> _models.RegionInfo: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -456,4 +475,6 @@ def query_region_info(self, location: str, **kwargs: Any) -> _models.RegionInfo: return deserialized - query_region_info.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo"} # type: ignore + query_region_info.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py index e39c8ec13a92..c7a814198ceb 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "location": _SERIALIZER.url("location", location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +72,7 @@ def build_get_request(location: str, quota_limit_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +86,7 @@ def build_get_request(location: str, quota_limit_name: str, subscription_id: str "quotaLimitName": _SERIALIZER.url("quota_limit_name", quota_limit_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,8 +133,10 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.SubscriptionQu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionQuotaItemList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubscriptionQuotaItemList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -151,7 +158,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -167,7 +174,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -175,13 +182,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionQuotaItemList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -194,7 +201,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits" + } @distributed_trace def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _models.SubscriptionQuotaItem: @@ -222,8 +231,10 @@ def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _models.Su _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubscriptionQuotaItem] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubscriptionQuotaItem] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -235,9 +246,9 @@ def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _models.Su params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -254,4 +265,6 @@ def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _models.Su return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py index 50042e0c23b2..4ddc9c25a60c 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,8 +93,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +116,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +132,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +140,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,4 +159,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.NetApp/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.NetApp/operations"} diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py index 86d277e3fbed..0d70885a04cd 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +63,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +99,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +116,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +136,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,8 +155,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +175,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +193,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -205,7 +210,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -250,8 +255,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPoolList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CapacityPoolList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -274,7 +281,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -290,7 +297,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -298,13 +305,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CapacityPoolList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -317,7 +324,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any) -> _models.CapacityPool: @@ -347,8 +356,10 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -361,9 +372,9 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -380,7 +391,9 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } def _create_or_update_initial( self, @@ -401,9 +414,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -427,9 +442,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -446,11 +461,13 @@ def _create_or_update_initial( deserialized = self._deserialize("CapacityPool", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } @overload def begin_create_or_update( @@ -573,14 +590,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -601,9 +620,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -615,9 +634,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } def _update_initial( self, @@ -638,9 +659,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CapacityPool]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CapacityPool]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -664,9 +687,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -685,7 +708,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } @overload def begin_update( @@ -808,14 +833,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapacityPool] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -836,9 +863,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -850,9 +877,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any @@ -868,8 +897,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -882,9 +913,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -897,7 +928,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } @distributed_trace def begin_delete( @@ -928,11 +961,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -951,9 +986,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -965,6 +1000,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py index d3ae97176a44..729afbdf1e32 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +63,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +97,7 @@ def build_get_request( "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,8 +114,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +132,7 @@ def build_create_request( "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,8 +151,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +169,7 @@ def build_update_request( "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,7 +187,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -197,7 +202,7 @@ def build_delete_request( "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -211,7 +216,7 @@ def build_list_volumes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +233,7 @@ def build_list_volumes_request( "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -274,8 +279,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPoliciesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -298,7 +305,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -314,7 +321,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -322,13 +329,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SnapshotPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -341,7 +348,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies" + } @distributed_trace def get( @@ -371,8 +380,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,9 +396,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -404,7 +415,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @overload def create( @@ -505,9 +518,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -531,9 +546,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -550,11 +565,13 @@ def create( deserialized = self._deserialize("SnapshotPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } def _update_initial( self, @@ -575,9 +592,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -601,9 +620,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -620,11 +639,13 @@ def _update_initial( deserialized = self._deserialize("SnapshotPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @overload def begin_update( @@ -741,14 +762,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, snapshot_policy_name=snapshot_policy_name, @@ -769,9 +792,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -783,9 +806,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, snapshot_policy_name: str, **kwargs: Any @@ -801,8 +826,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -815,9 +842,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -830,7 +857,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @distributed_trace def begin_delete( @@ -859,11 +888,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -882,9 +913,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -896,9 +927,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + } @distributed_trace def list_volumes( @@ -930,8 +963,10 @@ def list_volumes( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotPolicyVolumeList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotPolicyVolumeList] = kwargs.pop("cls", None) request = build_list_volumes_request( resource_group_name=resource_group_name, @@ -944,9 +979,9 @@ def list_volumes( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -963,4 +998,6 @@ def list_volumes( return deserialized - list_volumes.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes"} # type: ignore + list_volumes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py index 4f280d392f6d..72512d8e5563 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py @@ -36,6 +36,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +76,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +122,7 @@ def build_get_request( "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,8 +145,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +169,7 @@ def build_create_request( "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,8 +196,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +220,7 @@ def build_update_request( "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,7 +244,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -261,7 +265,7 @@ def build_delete_request( "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,8 +285,8 @@ def build_restore_files_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -303,7 +307,7 @@ def build_restore_files_request( "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -358,8 +362,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotsList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SnapshotsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -384,7 +390,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -400,7 +406,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -408,13 +414,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SnapshotsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -427,7 +433,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots" + } @distributed_trace def get( @@ -469,8 +477,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -485,9 +495,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -504,7 +514,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } def _create_initial( self, @@ -527,9 +539,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Snapshot]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -555,9 +569,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -576,7 +590,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } @overload def begin_create( @@ -714,14 +730,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -744,9 +762,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -758,9 +776,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } def _update_initial( self, @@ -783,9 +803,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Snapshot]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) _json = self._serialize.body(body, "object") @@ -804,9 +826,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -825,7 +847,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } @distributed_trace def begin_update( @@ -869,14 +893,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -899,9 +925,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -913,9 +939,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -937,8 +965,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -953,9 +983,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -968,7 +998,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } @distributed_trace def begin_delete( @@ -1009,11 +1041,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1034,9 +1068,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1048,9 +1082,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + } def _restore_files_initial( # pylint: disable=inconsistent-return-statements self, @@ -1073,9 +1109,11 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1101,9 +1139,9 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1116,7 +1154,9 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restore_files_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles"} # type: ignore + _restore_files_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles" + } @overload def begin_restore_files( @@ -1254,12 +1294,14 @@ def begin_restore_files( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._restore_files_initial( # type: ignore resource_group_name=resource_group_name, @@ -1282,7 +1324,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1294,6 +1336,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restore_files.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles"} # type: ignore + begin_restore_files.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py index d156bbcfda67..51111fcf4d77 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,7 @@ def build_list_by_volume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_list_by_volume_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +94,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +124,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,8 +147,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +178,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -198,8 +203,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +234,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -253,7 +258,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -281,7 +286,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -301,7 +306,7 @@ def build_get_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -331,7 +336,7 @@ def build_get_metadata_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -385,8 +390,10 @@ def list_by_volume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubvolumesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -411,7 +418,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -427,7 +434,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -435,13 +442,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SubvolumesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -454,7 +461,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_volume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes"} # type: ignore + list_by_volume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes" + } @distributed_trace def get( @@ -496,8 +505,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeInfo] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubvolumeInfo] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -512,9 +523,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -531,7 +542,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } def _create_initial( self, @@ -554,9 +567,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SubvolumeInfo]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -582,9 +597,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -606,7 +621,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } @overload def begin_create( @@ -747,14 +764,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubvolumeInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -777,9 +796,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -791,9 +810,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } def _update_initial( self, @@ -816,9 +837,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SubvolumeInfo]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -844,9 +867,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -865,7 +888,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } @overload def begin_update( @@ -1006,14 +1031,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubvolumeInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1036,9 +1063,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1050,9 +1077,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1074,8 +1103,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1090,9 +1121,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1105,7 +1136,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } @distributed_trace def begin_delete( @@ -1146,11 +1179,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1171,9 +1206,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1185,9 +1220,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}" + } def _get_metadata_initial( self, @@ -1209,8 +1246,10 @@ def _get_metadata_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.SubvolumeModel]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.SubvolumeModel]] = kwargs.pop("cls", None) request = build_get_metadata_request( resource_group_name=resource_group_name, @@ -1225,9 +1264,9 @@ def _get_metadata_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1246,7 +1285,9 @@ def _get_metadata_initial( return deserialized - _get_metadata_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata"} # type: ignore + _get_metadata_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata" + } @distributed_trace def begin_get_metadata( @@ -1288,13 +1329,15 @@ def begin_get_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.SubvolumeModel] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SubvolumeModel] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._get_metadata_initial( # type: ignore + raw_result = self._get_metadata_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1315,9 +1358,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1329,6 +1372,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_get_metadata.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata"} # type: ignore + begin_get_metadata.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py index d0084a732bc0..2624f9062324 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +61,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,8 +109,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VaultList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VaultList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -128,7 +135,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -144,7 +151,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -152,13 +159,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -171,4 +178,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py index ded72e56a922..99dce9cc2c01 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,7 @@ def build_list_by_net_app_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +65,7 @@ def build_list_by_net_app_account_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +106,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,8 +123,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +148,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,7 +166,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -183,7 +188,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,8 +235,10 @@ def list_by_net_app_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeGroupList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -254,7 +261,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -270,7 +277,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -278,13 +285,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VolumeGroupList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -297,7 +304,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_net_app_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups"} # type: ignore + list_by_net_app_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups" + } @distributed_trace def get( @@ -329,8 +338,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupDetails] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -343,9 +354,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -362,7 +373,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } def _create_initial( self, @@ -383,9 +396,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupDetails] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -409,9 +424,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -428,7 +443,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } @overload def begin_create( @@ -557,14 +574,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeGroupDetails] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, volume_group_name=volume_group_name, @@ -585,7 +604,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -597,9 +616,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, volume_group_name: str, **kwargs: Any @@ -615,8 +636,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -629,9 +652,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -644,7 +667,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } @distributed_trace def begin_delete( @@ -675,11 +700,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -698,7 +725,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -710,6 +737,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py index 75c7055a6082..e93b653d944f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,7 @@ def build_list_by_volume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_list_by_volume_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +94,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +117,7 @@ def build_get_request( "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,8 +140,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +164,7 @@ def build_create_request( "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,8 +189,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +213,7 @@ def build_update_request( "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -232,7 +237,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -253,7 +258,7 @@ def build_delete_request( "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -304,8 +309,10 @@ def list_by_volume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRulesList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeQuotaRulesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -330,7 +337,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -346,7 +353,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -354,13 +361,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VolumeQuotaRulesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -373,7 +380,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_volume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules"} # type: ignore + list_by_volume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules" + } @distributed_trace def get( @@ -415,8 +424,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -431,9 +442,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -450,7 +461,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } def _create_initial( self, @@ -473,9 +486,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -501,9 +516,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -520,11 +535,13 @@ def _create_initial( deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } @overload def begin_create( @@ -665,14 +682,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -695,9 +714,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -709,9 +728,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } def _update_initial( self, @@ -734,9 +755,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VolumeQuotaRule]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VolumeQuotaRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -762,9 +785,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -783,7 +806,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } @overload def begin_update( @@ -924,14 +949,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeQuotaRule] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -954,9 +981,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -968,9 +995,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -992,8 +1021,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1008,9 +1039,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1023,7 +1054,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } @distributed_trace def begin_delete( @@ -1064,11 +1097,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1089,9 +1124,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1103,6 +1138,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}" + } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py index e6cf816df31d..5b222199024a 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +68,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +107,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,8 +124,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +147,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,8 +166,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +189,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +214,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -229,7 +234,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if force_delete is not None: @@ -245,8 +250,8 @@ def build_revert_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -266,7 +271,7 @@ def build_revert_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -283,7 +288,7 @@ def build_reset_cifs_password_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -303,7 +308,7 @@ def build_reset_cifs_password_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -317,8 +322,8 @@ def build_break_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -338,7 +343,7 @@ def build_break_replication_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -356,8 +361,8 @@ def build_reestablish_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -377,7 +382,7 @@ def build_reestablish_replication_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -395,7 +400,7 @@ def build_replication_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -417,7 +422,7 @@ def build_replication_status_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -434,7 +439,7 @@ def build_list_replications_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -456,7 +461,7 @@ def build_list_replications_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -472,7 +477,7 @@ def build_resync_replication_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -492,7 +497,7 @@ def build_resync_replication_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -505,7 +510,7 @@ def build_delete_replication_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -525,7 +530,7 @@ def build_delete_replication_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -539,8 +544,8 @@ def build_authorize_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -560,7 +565,7 @@ def build_authorize_replication_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -577,7 +582,7 @@ def build_re_initialize_replication_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -597,7 +602,7 @@ def build_re_initialize_replication_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -611,8 +616,8 @@ def build_pool_change_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -632,7 +637,7 @@ def build_pool_change_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -650,8 +655,8 @@ def build_relocate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( "template_url", @@ -671,7 +676,7 @@ def build_relocate_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -688,7 +693,7 @@ def build_finalize_relocation_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -708,7 +713,7 @@ def build_finalize_relocation_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -721,7 +726,7 @@ def build_revert_relocation_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -741,7 +746,7 @@ def build_revert_relocation_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -790,8 +795,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VolumeList] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.VolumeList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -815,7 +822,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -831,7 +838,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -839,13 +846,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VolumeList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -858,7 +865,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes" + } @distributed_trace def get( @@ -892,8 +901,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Volume] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -907,9 +918,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -926,7 +937,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } def _create_or_update_initial( self, @@ -948,9 +961,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Volume]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -975,9 +990,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -999,7 +1014,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } @overload def begin_create_or_update( @@ -1128,14 +1145,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Volume] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1157,9 +1176,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1171,9 +1190,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } def _update_initial( self, @@ -1195,9 +1216,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Volume]] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1222,9 +1245,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1243,7 +1266,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } @overload def begin_update( @@ -1372,14 +1397,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Volume] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1401,9 +1428,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1415,9 +1442,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1439,8 +1468,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1455,9 +1486,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1470,7 +1501,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } @distributed_trace def begin_delete( @@ -1512,11 +1545,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1537,9 +1572,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1551,9 +1586,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + } def _revert_initial( # pylint: disable=inconsistent-return-statements self, @@ -1575,9 +1612,11 @@ def _revert_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1602,9 +1641,9 @@ def _revert_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1617,7 +1656,9 @@ def _revert_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _revert_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert"} # type: ignore + _revert_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert" + } @overload def begin_revert( @@ -1746,12 +1787,14 @@ def begin_revert( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._revert_initial( # type: ignore resource_group_name=resource_group_name, @@ -1773,9 +1816,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1787,9 +1830,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_revert.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert"} # type: ignore + begin_revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert" + } def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -1805,8 +1850,10 @@ def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_cifs_password_request( resource_group_name=resource_group_name, @@ -1820,9 +1867,9 @@ def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1835,7 +1882,9 @@ def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - _reset_cifs_password_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword"} # type: ignore + _reset_cifs_password_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword" + } @distributed_trace def begin_reset_cifs_password( @@ -1868,11 +1917,13 @@ def begin_reset_cifs_password( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._reset_cifs_password_initial( # type: ignore resource_group_name=resource_group_name, @@ -1892,7 +1943,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1904,9 +1955,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_reset_cifs_password.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword"} # type: ignore + begin_reset_cifs_password.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword" + } def _break_replication_initial( # pylint: disable=inconsistent-return-statements self, @@ -1928,9 +1981,11 @@ def _break_replication_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1958,9 +2013,9 @@ def _break_replication_initial( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1973,7 +2028,9 @@ def _break_replication_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _break_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication"} # type: ignore + _break_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication" + } @overload def begin_break_replication( @@ -2102,12 +2159,14 @@ def begin_break_replication( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._break_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -2129,9 +2188,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2143,9 +2202,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_break_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication"} # type: ignore + begin_break_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication" + } def _reestablish_replication_initial( # pylint: disable=inconsistent-return-statements self, @@ -2167,9 +2228,11 @@ def _reestablish_replication_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2194,9 +2257,9 @@ def _reestablish_replication_initial( # pylint: disable=inconsistent-return-sta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2209,7 +2272,9 @@ def _reestablish_replication_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reestablish_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication"} # type: ignore + _reestablish_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication" + } @overload def begin_reestablish_replication( @@ -2341,12 +2406,14 @@ def begin_reestablish_replication( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._reestablish_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -2368,9 +2435,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2382,9 +2449,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_reestablish_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication"} # type: ignore + begin_reestablish_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication" + } @distributed_trace def replication_status( @@ -2418,8 +2487,10 @@ def replication_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReplicationStatus] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ReplicationStatus] = kwargs.pop("cls", None) request = build_replication_status_request( resource_group_name=resource_group_name, @@ -2433,9 +2504,9 @@ def replication_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2452,7 +2523,9 @@ def replication_status( return deserialized - replication_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus"} # type: ignore + replication_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus" + } @distributed_trace def list_replications( @@ -2478,8 +2551,10 @@ def list_replications( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListReplications] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ListReplications] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2504,7 +2579,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2520,7 +2595,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2528,13 +2603,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListReplications", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2547,7 +2622,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_replications.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications"} # type: ignore + list_replications.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications" + } def _resync_replication_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -2563,8 +2640,10 @@ def _resync_replication_initial( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_resync_replication_request( resource_group_name=resource_group_name, @@ -2578,9 +2657,9 @@ def _resync_replication_initial( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2593,7 +2672,9 @@ def _resync_replication_initial( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - _resync_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication"} # type: ignore + _resync_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication" + } @distributed_trace def begin_resync_replication( @@ -2627,11 +2708,13 @@ def begin_resync_replication( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._resync_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -2651,9 +2734,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2665,9 +2748,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_resync_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication"} # type: ignore + begin_resync_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication" + } def _delete_replication_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -2683,8 +2768,10 @@ def _delete_replication_initial( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_replication_request( resource_group_name=resource_group_name, @@ -2698,9 +2785,9 @@ def _delete_replication_initial( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2713,7 +2800,9 @@ def _delete_replication_initial( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - _delete_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication"} # type: ignore + _delete_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication" + } @distributed_trace def begin_delete_replication( @@ -2747,11 +2836,13 @@ def begin_delete_replication( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -2771,9 +2862,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2785,9 +2876,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication"} # type: ignore + begin_delete_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication" + } def _authorize_replication_initial( # pylint: disable=inconsistent-return-statements self, @@ -2809,9 +2902,11 @@ def _authorize_replication_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2836,9 +2931,9 @@ def _authorize_replication_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2851,7 +2946,9 @@ def _authorize_replication_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _authorize_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication"} # type: ignore + _authorize_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication" + } @overload def begin_authorize_replication( @@ -2980,12 +3077,14 @@ def begin_authorize_replication( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._authorize_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -3007,9 +3106,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3021,9 +3120,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_authorize_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication"} # type: ignore + begin_authorize_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication" + } def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -3039,8 +3140,10 @@ def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_re_initialize_replication_request( resource_group_name=resource_group_name, @@ -3054,9 +3157,9 @@ def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-s params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3069,7 +3172,9 @@ def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-s if cls: return cls(pipeline_response, None, {}) - _re_initialize_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication"} # type: ignore + _re_initialize_replication_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication" + } @distributed_trace def begin_re_initialize_replication( @@ -3102,11 +3207,13 @@ def begin_re_initialize_replication( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._re_initialize_replication_initial( # type: ignore resource_group_name=resource_group_name, @@ -3126,9 +3233,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3140,9 +3247,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_re_initialize_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication"} # type: ignore + begin_re_initialize_replication.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication" + } def _pool_change_initial( # pylint: disable=inconsistent-return-statements self, @@ -3164,9 +3273,11 @@ def _pool_change_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3191,9 +3302,9 @@ def _pool_change_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3206,7 +3317,9 @@ def _pool_change_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _pool_change_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange"} # type: ignore + _pool_change_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange" + } @overload def begin_pool_change( @@ -3335,12 +3448,14 @@ def begin_pool_change( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._pool_change_initial( # type: ignore resource_group_name=resource_group_name, @@ -3362,9 +3477,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3376,9 +3491,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_pool_change.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange"} # type: ignore + begin_pool_change.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange" + } def _relocate_initial( # pylint: disable=inconsistent-return-statements self, @@ -3400,9 +3517,11 @@ def _relocate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3430,9 +3549,9 @@ def _relocate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3445,7 +3564,9 @@ def _relocate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _relocate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate"} # type: ignore + _relocate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate" + } @overload def begin_relocate( @@ -3574,12 +3695,14 @@ def begin_relocate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._relocate_initial( # type: ignore resource_group_name=resource_group_name, @@ -3601,7 +3724,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3613,9 +3736,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_relocate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate"} # type: ignore + begin_relocate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate" + } def _finalize_relocation_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -3631,8 +3756,10 @@ def _finalize_relocation_initial( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_finalize_relocation_request( resource_group_name=resource_group_name, @@ -3646,9 +3773,9 @@ def _finalize_relocation_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3661,7 +3788,9 @@ def _finalize_relocation_initial( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - _finalize_relocation_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation"} # type: ignore + _finalize_relocation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation" + } @distributed_trace def begin_finalize_relocation( @@ -3694,11 +3823,13 @@ def begin_finalize_relocation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._finalize_relocation_initial( # type: ignore resource_group_name=resource_group_name, @@ -3718,7 +3849,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3730,9 +3861,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_finalize_relocation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation"} # type: ignore + begin_finalize_relocation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation" + } def _revert_relocation_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any @@ -3748,8 +3881,10 @@ def _revert_relocation_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_revert_relocation_request( resource_group_name=resource_group_name, @@ -3763,9 +3898,9 @@ def _revert_relocation_initial( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3778,7 +3913,9 @@ def _revert_relocation_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _revert_relocation_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation"} # type: ignore + _revert_relocation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation" + } @distributed_trace def begin_revert_relocation( @@ -3812,11 +3949,13 @@ def begin_revert_relocation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-05-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._revert_relocation_initial( # type: ignore resource_group_name=resource_group_name, @@ -3836,7 +3975,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -3848,6 +3987,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_revert_relocation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation"} # type: ignore + begin_revert_relocation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation" + } diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update.py new file mode 100644 index 000000000000..087ed2339273 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python accounts_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.accounts.begin_create_or_update( + resource_group_name="myRG", + account_name="account1", + body={ + "location": "eastus", + "properties": { + "activeDirectories": [ + { + "aesEncryption": True, + "dns": "10.10.10.3, 10.10.10.4", + "domain": "10.10.10.3", + "ldapOverTLS": False, + "ldapSigning": False, + "organizationalUnit": "OU=Engineering", + "password": "ad_password", + "site": "SiteName", + "smbServerName": "SMBServer", + "username": "ad_user_name", + } + ] + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_delete.py new file mode 100644 index 000000000000..0dbfea3ee333 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python accounts_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.accounts.begin_delete( + resource_group_name="myRG", + account_name="account1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_get.py new file mode 100644 index 000000000000..a46608ed2f3b --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python accounts_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.accounts.get( + resource_group_name="myRG", + account_name="account1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_list.py new file mode 100644 index 000000000000..d91e26977c20 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python accounts_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.accounts.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_renew_credentials.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_renew_credentials.py new file mode 100644 index 000000000000..2b366f8f70d9 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_renew_credentials.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python accounts_renew_credentials.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.accounts.begin_renew_credentials( + resource_group_name="myRG", + account_name="account1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_RenewCredentials.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_update.py new file mode 100644 index 000000000000..c7e697177873 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python accounts_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.accounts.begin_update( + resource_group_name="myRG", + account_name="account1", + body={"tags": {"Tag1": "Value1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_retrieve_throughput_distribution.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_create.py similarity index 58% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_retrieve_throughput_distribution.py rename to sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_create.py index 1e5c6831c9d5..04d312736405 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_retrieve_throughput_distribution.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_create.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.netapp import NetAppManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-netapp # USAGE - python cosmos_db_sql_container_retrieve_throughput_distribution.py + python backup_policies_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,23 +24,28 @@ def main(): - client = CosmosDBManagementClient( + client = NetAppManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", ) - response = client.sql_resources.begin_sql_container_retrieve_throughput_distribution( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - container_name="containerName", - retrieve_throughput_parameters={ - "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + response = client.backup_policies.begin_create( + resource_group_name="myRG", + account_name="account1", + backup_policy_name="backupPolicyName", + body={ + "location": "westus", + "properties": { + "dailyBackupsToKeep": 10, + "enabled": True, + "monthlyBackupsToKeep": 10, + "weeklyBackupsToKeep": 10, + }, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerRetrieveThroughputDistribution.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_delete.py new file mode 100644 index 000000000000..e2876e85c73c --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backup_policies_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backup_policies.begin_delete( + resource_group_name="resourceGroup", + account_name="accountName", + backup_policy_name="backupPolicyName", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_get.py new file mode 100644 index 000000000000..e3fa186ccca4 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backup_policies_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backup_policies.get( + resource_group_name="myRG", + account_name="account1", + backup_policy_name="backupPolicyName", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_list.py new file mode 100644 index 000000000000..897b4ff51a65 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backup_policies_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backup_policies.list( + resource_group_name="myRG", + account_name="account1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_update.py new file mode 100644 index 000000000000..0c87bfb90c5d --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_update.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backup_policies_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backup_policies.begin_update( + resource_group_name="myRG", + account_name="account1", + backup_policy_name="backupPolicyName", + body={ + "location": "westus", + "properties": { + "dailyBackupsToKeep": 5, + "enabled": False, + "monthlyBackupsToKeep": 10, + "weeklyBackupsToKeep": 10, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_delete.py new file mode 100644 index 000000000000..af06ca5e3a3f --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_account_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.account_backups.begin_delete( + resource_group_name="resourceGroup", + account_name="accountName", + backup_name="backupName", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Account_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_get.py new file mode 100644 index 000000000000..1cbcacd2ee44 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_account_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.account_backups.get( + resource_group_name="myRG", + account_name="account1", + backup_name="backup1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Account_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_list.py new file mode 100644 index 000000000000..f8e912560e4a --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_account_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_account_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.account_backups.list( + resource_group_name="myRG", + account_name="account1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Account_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_create.py new file mode 100644 index 000000000000..4f0430f2ad85 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_create.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backups.begin_create( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + backup_name="backup1", + body={"location": "eastus", "properties": {"label": "myLabel"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_delete.py new file mode 100644 index 000000000000..ac23e8498a60 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_delete.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backups.begin_delete( + resource_group_name="resourceGroup", + account_name="accountName", + pool_name="poolName", + volume_name="volumeName", + backup_name="backupName", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_get.py new file mode 100644 index 000000000000..68cd005a1436 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backups.get( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + backup_name="backup1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_list.py new file mode 100644 index 000000000000..1c97a6358bd6 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backups.list( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_update.py new file mode 100644 index 000000000000..4c7210c31e5f --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_update.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python backups_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backups.begin_update( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + backup_name="backup1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/operation_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/operation_list.py new file mode 100644 index 000000000000..bf77791dc147 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/operation_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python operation_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/OperationList.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_create_or_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_create_or_update.py new file mode 100644 index 000000000000..6ee0257f9231 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_create_or_update.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python pools_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.pools.begin_create_or_update( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + body={ + "location": "eastus", + "properties": {"qosType": "Auto", "serviceLevel": "Premium", "size": 4398046511104}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_delete.py new file mode 100644 index 000000000000..6ca46cbfbfc0 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python pools_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.pools.begin_delete( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_get.py new file mode 100644 index 000000000000..412900164a14 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python pools_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.pools.get( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_list.py new file mode 100644 index 000000000000..b399bd3c307b --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python pools_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.pools.list( + resource_group_name="myRG", + account_name="account1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_get.py new file mode 100644 index 000000000000..fe29094a2033 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python quota_limits_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.net_app_resource_quota_limits.get( + location="eastus", + quota_limit_name="totalCoolAccessVolumesPerSubscription", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/QuotaLimits_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_list.py new file mode 100644 index 000000000000..3fae29e21eb4 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_list.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python quota_limits_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.net_app_resource_quota_limits.list( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/QuotaLimits_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/region_info.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_info.py new file mode 100644 index 000000000000..9cc5aa08ee5f --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_info.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python region_info.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.net_app_resource.query_region_info( + location="eastus", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/RegionInfo.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_create.py new file mode 100644 index 000000000000..4ab9c94fc94b --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_create.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshot_policies_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshot_policies.create( + resource_group_name="myRG", + account_name="account1", + snapshot_policy_name="snapshotPolicyName", + body={ + "location": "eastus", + "properties": { + "dailySchedule": {"hour": 14, "minute": 30, "snapshotsToKeep": 4}, + "enabled": True, + "hourlySchedule": {"minute": 50, "snapshotsToKeep": 2}, + "monthlySchedule": {"daysOfMonth": "10,11,12", "hour": 14, "minute": 15, "snapshotsToKeep": 5}, + "weeklySchedule": {"day": "Wednesday", "hour": 14, "minute": 45, "snapshotsToKeep": 3}, + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_delete.py new file mode 100644 index 000000000000..2ec7d1314cee --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshot_policies_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshot_policies.begin_delete( + resource_group_name="resourceGroup", + account_name="accountName", + snapshot_policy_name="snapshotPolicyName", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_get.py new file mode 100644 index 000000000000..9e440885fc66 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshot_policies_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshot_policies.get( + resource_group_name="myRG", + account_name="account1", + snapshot_policy_name="snapshotPolicyName", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list.py new file mode 100644 index 000000000000..75fbfe4ea1ee --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshot_policies_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshot_policies.list( + resource_group_name="myRG", + account_name="account1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list_volumes.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list_volumes.py new file mode 100644 index 000000000000..d903c8d14e97 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list_volumes.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshot_policies_list_volumes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshot_policies.list_volumes( + resource_group_name="myRG", + account_name="account1", + snapshot_policy_name="snapshotPolicyName", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_ListVolumes.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_update.py new file mode 100644 index 000000000000..cd114b631678 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_update.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshot_policies_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshot_policies.begin_update( + resource_group_name="myRG", + account_name="account1", + snapshot_policy_name="snapshotPolicyName", + body={ + "location": "eastus", + "properties": { + "dailySchedule": {"hour": 14, "minute": 30, "snapshotsToKeep": 4}, + "enabled": True, + "hourlySchedule": {"minute": 50, "snapshotsToKeep": 2}, + "monthlySchedule": {"daysOfMonth": "10,11,12", "hour": 14, "minute": 15, "snapshotsToKeep": 5}, + "weeklySchedule": {"day": "Wednesday", "hour": 14, "minute": 45, "snapshotsToKeep": 3}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_create.py new file mode 100644 index 000000000000..db8488ef28da --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_create.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshots_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshots.begin_create( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + snapshot_name="snapshot1", + body={"location": "eastus"}, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_delete.py new file mode 100644 index 000000000000..4a3886bc387d --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_delete.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshots_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshots.begin_delete( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + snapshot_name="snapshot1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_get.py new file mode 100644 index 000000000000..682f5c7a63e0 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshots_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshots.get( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + snapshot_name="snapshot1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_list.py new file mode 100644 index 000000000000..cda449bcc542 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshots_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshots.list( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_single_file_restore.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_single_file_restore.py new file mode 100644 index 000000000000..dadd88f23fd0 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_single_file_restore.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python snapshots_single_file_restore.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.snapshots.begin_restore_files( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + snapshot_name="snapshot1", + body={"filePaths": ["/dir1/customer1.db", "/dir1/customer2.db"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_SingleFileRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_create.py new file mode 100644 index 000000000000..6762ea6fb477 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_create.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python subvolumes_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.subvolumes.begin_create( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + subvolume_name="subvolume1", + body={"properties": {"path": "/subvolumePath"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_delete.py new file mode 100644 index 000000000000..c6b54a5d5a16 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_delete.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python subvolumes_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.subvolumes.begin_delete( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + subvolume_name="subvolume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_get.py new file mode 100644 index 000000000000..e8a52454a68b --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python subvolumes_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.subvolumes.get( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + subvolume_name="subvolume1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_list.py new file mode 100644 index 000000000000..ff6acf938ffc --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python subvolumes_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.subvolumes.list_by_volume( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_metadata.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_metadata.py new file mode 100644 index 000000000000..fd8aad80a999 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_metadata.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python subvolumes_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.subvolumes.begin_get_metadata( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + subvolume_name="subvolume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Metadata.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_update.py new file mode 100644 index 000000000000..bb6eaa7c2182 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_update.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python subvolumes_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.subvolumes.begin_update( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + subvolume_name="subvolume1", + body={"properties": {"path": "/subvolumePath"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/vaults_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/vaults_list.py new file mode 100644 index 000000000000..3f2d98ece7f3 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/vaults_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python vaults_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.vaults.list( + resource_group_name="myRG", + account_name="account1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Vaults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create.py new file mode 100644 index 000000000000..9932458a2b24 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_groups_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volume_groups.begin_create( + resource_group_name="myRG", + account_name="account1", + volume_group_name="group1", + body={ + "location": "westus", + "properties": { + "groupMetaData": { + "applicationIdentifier": "DEV", + "applicationType": "SAP-HANA", + "deploymentSpecId": "20542149-bfca-5618-1879-9863dc6767f1", + "groupDescription": "Volume group", + }, + "volumes": [ + { + "name": "test-data-mnt00001", + "properties": { + "capacityPoolResourceId": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1", + "creationToken": "test-data-mnt00001", + "proximityPlacementGroup": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg", + "serviceLevel": "Premium", + "subnetId": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3", + "throughputMibps": 10, + "usageThreshold": 107374182400, + "volumeSpecName": "data", + }, + }, + { + "name": "test-log-mnt00001", + "properties": { + "capacityPoolResourceId": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1", + "creationToken": "test-log-mnt00001", + "proximityPlacementGroup": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg", + "serviceLevel": "Premium", + "subnetId": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3", + "throughputMibps": 10, + "usageThreshold": 107374182400, + "volumeSpecName": "log", + }, + }, + { + "name": "test-shared", + "properties": { + "capacityPoolResourceId": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1", + "creationToken": "test-shared", + "proximityPlacementGroup": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg", + "serviceLevel": "Premium", + "subnetId": "/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3", + "throughputMibps": 10, + "usageThreshold": 107374182400, + "volumeSpecName": "shared", + }, + }, + ], + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_delete.py new file mode 100644 index 000000000000..8a0d9863c068 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_groups_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volume_groups.begin_delete( + resource_group_name="myRG", + account_name="account1", + volume_group_name="group1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get.py new file mode 100644 index 000000000000..9216cdeba62f --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_groups_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volume_groups.get( + resource_group_name="myRG", + account_name="account1", + volume_group_name="group1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list.py new file mode 100644 index 000000000000..729fdb132578 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_groups_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volume_groups.list_by_net_app_account( + resource_group_name="myRG", + account_name="account1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_List.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_retrieve_throughput_distribution.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_create.py similarity index 58% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_retrieve_throughput_distribution.py rename to sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_create.py index 30e8e1a5a281..22f8da1861b9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_retrieve_throughput_distribution.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_create.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.netapp import NetAppManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-netapp # USAGE - python cosmos_db_mongo_db_database_retrieve_throughput_distribution.py + python volume_quota_rules_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,22 +24,25 @@ def main(): - client = CosmosDBManagementClient( + client = NetAppManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="5275316f-a498-48d6-b324-2cbfdc4311b9", ) - response = client.mongo_db_resources.begin_mongo_db_database_retrieve_throughput_distribution( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - retrieve_throughput_parameters={ - "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + response = client.volume_quota_rules.begin_create( + resource_group_name="myRG", + account_name="account-9957", + pool_name="pool-5210", + volume_name="volume-6387", + volume_quota_rule_name="rule-0004", + body={ + "location": "westus", + "properties": {"quotaSizeInKiBs": 100005, "quotaTarget": "1821", "quotaType": "IndividualUserQuota"}, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBDatabaseRetrieveThroughputDistribution.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_delete.py new file mode 100644 index 000000000000..e46f0289c3fa --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_delete.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_quota_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5275316f-a498-48d6-b324-2cbfdc4311b9", + ) + + response = client.volume_quota_rules.begin_delete( + resource_group_name="myRG", + account_name="account-9957", + pool_name="pool-5210", + volume_name="volume-6387", + volume_quota_rule_name="rule-0004", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_get.py new file mode 100644 index 000000000000..08b56f1b04a2 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_quota_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5275316f-a498-48d6-b324-2cbfdc4311b9", + ) + + response = client.volume_quota_rules.get( + resource_group_name="myRG", + account_name="account-9957", + pool_name="pool-5210", + volume_name="volume-6387", + volume_quota_rule_name="rule-0004", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_list.py new file mode 100644 index 000000000000..b853154756ee --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_quota_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5275316f-a498-48d6-b324-2cbfdc4311b9", + ) + + response = client.volume_quota_rules.list_by_volume( + resource_group_name="myRG", + account_name="account-9957", + pool_name="pool-5210", + volume_name="volume-6387", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_update.py new file mode 100644 index 000000000000..b9957c4739b4 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_update.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volume_quota_rules_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5275316f-a498-48d6-b324-2cbfdc4311b9", + ) + + response = client.volume_quota_rules.begin_update( + resource_group_name="myRG", + account_name="account-9957", + pool_name="pool-5210", + volume_name="volume-6387", + volume_quota_rule_name="rule-0004", + body={"properties": {"quotaSizeInKiBs": 100009}}, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_authorize_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_authorize_replication.py new file mode 100644 index 000000000000..b25a9fb3930e --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_authorize_replication.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_authorize_replication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_authorize_replication( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + body={ + "remoteVolumeResourceId": "/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRemoteRG/providers/Microsoft.NetApp/netAppAccounts/remoteAccount1/capacityPools/remotePool1/volumes/remoteVolume1" + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_AuthorizeReplication.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_backup_status.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_backup_status.py new file mode 100644 index 000000000000..edd7a33b709a --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_backup_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_backup_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backups.get_status( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_BackupStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_replication.py new file mode 100644 index 000000000000..1d6788a1380d --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_replication.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_break_replication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_break_replication( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_BreakReplication.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_redistribute_throughput.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_create_or_update.py similarity index 51% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_redistribute_throughput.py rename to sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_create_or_update.py index 91d1cb063f1b..d0b6c054cec6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_redistribute_throughput.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_create_or_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.netapp import NetAppManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-netapp # USAGE - python cosmos_db_sql_database_redistribute_throughput.py + python volumes_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,31 +24,31 @@ def main(): - client = CosmosDBManagementClient( + client = NetAppManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", ) - response = client.sql_resources.begin_sql_database_redistribute_throughput( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - redistribute_throughput_parameters={ + response = client.volumes.begin_create_or_update( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + body={ + "location": "eastus", "properties": { - "resource": { - "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], - "targetPhysicalPartitionThroughputInfo": [ - {"id": "0", "throughput": 5000}, - {"id": "1", "throughput": 5000}, - ], - "throughputPolicy": "custom", - } - } + "creationToken": "my-unique-file-path", + "encryptionKeySource": "Microsoft.KeyVault", + "serviceLevel": "Premium", + "subnetId": "/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3", + "throughputMibps": 128, + "usageThreshold": 107374182400, + }, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseRedistributeThroughput.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete.py new file mode 100644 index 000000000000..ee99eb59f961 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_delete( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete_replication.py new file mode 100644 index 000000000000..338658f3f460 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete_replication.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_delete_replication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_delete_replication( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_DeleteReplication.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_finalize_relocation.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_finalize_relocation.py new file mode 100644 index 000000000000..6548f1f1b592 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_finalize_relocation.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_finalize_relocation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_finalize_relocation( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_FinalizeRelocation.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_get.py new file mode 100644 index 000000000000..e5de9dbdafd0 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.get( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list.py new file mode 100644 index 000000000000..8feecd46525c --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.list( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_List.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list_replications.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list_replications.py new file mode 100644 index 000000000000..d38ab93bf101 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list_replications.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_list_replications.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.list_replications( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ListReplications.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_pool_change.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_pool_change.py new file mode 100644 index 000000000000..72b3d5fd42be --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_pool_change.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_pool_change.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_pool_change( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + body={ + "newPoolResourceId": "/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1" + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_PoolChange.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_re_initialize_replication.py similarity index 65% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_delete.py rename to sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_re_initialize_replication.py index ca2554b9dc5d..d1baada5dc57 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_re_initialize_replication.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.netapp import NetAppManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-netapp # USAGE - python cosmos_db_cassandra_view_delete.py + python volumes_re_initialize_replication.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,20 +24,20 @@ def main(): - client = CosmosDBManagementClient( + client = NetAppManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", ) - response = client.cassandra_resources.begin_delete_cassandra_view( - resource_group_name="rg1", - account_name="ddb1", - keyspace_name="keyspacename", - view_name="viewname", + response = client.volumes.begin_re_initialize_replication( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewDelete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ReInitializeReplication.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reestablish_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reestablish_replication.py new file mode 100644 index 000000000000..ddb9a8cccc15 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reestablish_replication.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_reestablish_replication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_reestablish_replication( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + body={ + "sourceVolumeId": "/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/mySourceRG/providers/Microsoft.NetApp/netAppAccounts/sourceAccount1/capacityPools/sourcePool1/volumes/sourceVolume1" + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ReestablishReplication.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_relocate.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_relocate.py new file mode 100644 index 000000000000..3d7799ee5844 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_relocate.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_relocate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_relocate( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Relocate.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_replication_status.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_replication_status.py new file mode 100644 index 000000000000..f48c476047c3 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_replication_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_replication_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.replication_status( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ReplicationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reset_cifs_password.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reset_cifs_password.py new file mode 100644 index 000000000000..571434e80235 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reset_cifs_password.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_reset_cifs_password.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_reset_cifs_password( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ResetCifsPassword.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_restore_status.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_restore_status.py new file mode 100644 index 000000000000..2093be99e543 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_restore_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_restore_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.backups.get_volume_restore_status( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ) + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_RestoreStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_resync_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_resync_replication.py new file mode 100644 index 000000000000..16cbee76befd --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_resync_replication.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_resync_replication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_resync_replication( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ResyncReplication.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert.py new file mode 100644 index 000000000000..69f5f5e40179 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_revert.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_revert( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + body={ + "snapshotId": "/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1" + }, + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Revert.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert_relocation.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert_relocation.py new file mode 100644 index 000000000000..ad7e985ef976 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert_relocation.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.netapp import NetAppManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-netapp +# USAGE + python volumes_revert_relocation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NetAppManagementClient( + credential=DefaultAzureCredential(), + subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", + ) + + response = client.volumes.begin_revert_relocation( + resource_group_name="myRG", + account_name="account1", + pool_name="pool1", + volume_name="volume1", + ).result() + print(response) + + +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_RevertRelocation.json +if __name__ == "__main__": + main() diff --git a/sdk/netapp/azure-mgmt-netapp/setup.py b/sdk/netapp/azure-mgmt-netapp/setup.py index bdd3865353bf..981eb309420f 100644 --- a/sdk/netapp/azure-mgmt-netapp/setup.py +++ b/sdk/netapp/azure-mgmt-netapp/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -69,9 +70,10 @@ 'pytyped': ['py.typed'], }, install_requires=[ - 'msrest>=0.7.1', - 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.2,<2.0.0', + "msrest>=0.7.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", ], python_requires=">=3.7" ) diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_create_delete_account.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_create_delete_account.json index 025628a58107..e9d996c93c18 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_create_delete_account.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_create_delete_account.json @@ -219,7 +219,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -293,7 +293,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -345,7 +345,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -385,7 +385,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -457,7 +457,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -572,7 +572,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -601,7 +601,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -641,7 +641,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -694,7 +694,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -727,7 +727,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -794,4 +794,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_get_account_by_name.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_get_account_by_name.json index 6f79fa239a8f..fa8d0c1d44a9 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_get_account_by_name.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_get_account_by_name.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -385,7 +385,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -458,7 +458,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -487,7 +487,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -527,7 +527,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -580,7 +580,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -608,4 +608,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_list_accounts.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_list_accounts.json index 846a4fbc6285..a565f7ce28f1 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_list_accounts.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_list_accounts.json @@ -219,7 +219,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -293,7 +293,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -345,7 +345,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -385,7 +385,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -459,7 +459,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -511,7 +511,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -551,7 +551,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -623,7 +623,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -780,7 +780,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -809,7 +809,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -849,7 +849,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -902,7 +902,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -936,7 +936,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -965,7 +965,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1005,7 +1005,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1058,7 +1058,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1086,4 +1086,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_patch_account.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_patch_account.json index 6649f4d8cc6e..cf729f22efe8 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_patch_account.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account.pyTestNetAppAccounttest_patch_account.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "28", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "tags": { @@ -465,7 +465,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -494,7 +494,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -534,7 +534,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -588,7 +588,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -616,4 +616,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_delete_account_backups.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_delete_account_backups.json index 752c689b3382..4e4a10dfa5e1 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_delete_account_backups.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_delete_account_backups.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1072,7 +1072,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1133,7 +1133,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1670,7 +1670,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1780,7 +1780,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1890,7 +1890,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1931,7 +1931,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2055,7 +2055,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2095,7 +2095,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2135,7 +2135,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2264,7 +2264,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2308,7 +2308,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2348,7 +2348,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2388,7 +2388,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2432,7 +2432,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2477,7 +2477,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2522,7 +2522,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2567,7 +2567,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2612,7 +2612,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2657,7 +2657,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2702,7 +2702,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2747,7 +2747,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2792,7 +2792,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2837,7 +2837,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2882,7 +2882,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3425,7 +3425,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3454,7 +3454,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3494,7 +3494,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3534,7 +3534,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3574,7 +3574,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3614,7 +3614,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3654,7 +3654,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3781,7 +3781,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3813,7 +3813,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3842,7 +3842,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3882,7 +3882,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3922,7 +3922,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3962,7 +3962,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4002,7 +4002,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4042,7 +4042,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4082,7 +4082,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4117,7 +4117,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4644,7 +4644,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4673,7 +4673,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4713,7 +4713,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4773,7 +4773,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4800,7 +4800,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4825,7 +4825,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4850,7 +4850,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4874,7 +4874,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4906,7 +4906,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4935,7 +4935,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4975,7 +4975,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5028,7 +5028,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5091,4 +5091,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_get_account_backups.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_get_account_backups.json index 99ed7eef5b40..f9556036eb60 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_get_account_backups.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_get_account_backups.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1740,7 +1740,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1850,7 +1850,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1891,7 +1891,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2015,7 +2015,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2055,7 +2055,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2095,7 +2095,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2224,7 +2224,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2268,7 +2268,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2308,7 +2308,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2348,7 +2348,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2392,7 +2392,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2437,7 +2437,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2482,7 +2482,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2527,7 +2527,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2572,7 +2572,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2617,7 +2617,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2662,7 +2662,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2707,7 +2707,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2752,7 +2752,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2797,7 +2797,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2842,7 +2842,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2887,7 +2887,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2932,7 +2932,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2977,7 +2977,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3022,7 +3022,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3067,7 +3067,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3112,7 +3112,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3157,7 +3157,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3202,7 +3202,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3247,7 +3247,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3292,7 +3292,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3333,7 +3333,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -3464,7 +3464,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3504,7 +3504,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3544,7 +3544,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3671,7 +3671,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3705,7 +3705,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3734,7 +3734,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3774,7 +3774,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3814,7 +3814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3854,7 +3854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3894,7 +3894,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3934,7 +3934,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3974,7 +3974,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4014,7 +4014,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4141,7 +4141,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4173,7 +4173,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4202,7 +4202,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4242,7 +4242,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4282,7 +4282,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4342,7 +4342,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4367,7 +4367,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4392,7 +4392,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4417,7 +4417,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4441,7 +4441,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4473,7 +4473,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4502,7 +4502,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4542,7 +4542,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4595,7 +4595,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4658,4 +4658,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_list_account_backups.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_list_account_backups.json index 5da3d91e3d66..484da7ef4984 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_list_account_backups.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_account_backup.pyTestNetAppAccountBackuptest_list_account_backups.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1740,7 +1740,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1850,7 +1850,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1891,7 +1891,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2015,7 +2015,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2055,7 +2055,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2095,7 +2095,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2224,7 +2224,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2268,7 +2268,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2308,7 +2308,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2348,7 +2348,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2392,7 +2392,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2437,7 +2437,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2482,7 +2482,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2527,7 +2527,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2572,7 +2572,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2617,7 +2617,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2662,7 +2662,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2707,7 +2707,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2752,7 +2752,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2797,7 +2797,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2842,7 +2842,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2887,7 +2887,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2932,7 +2932,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2977,7 +2977,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3018,7 +3018,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -3151,7 +3151,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -3195,7 +3195,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3235,7 +3235,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -3279,7 +3279,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3324,7 +3324,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3369,7 +3369,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3414,7 +3414,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3459,7 +3459,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3504,7 +3504,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3549,7 +3549,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3594,7 +3594,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3639,7 +3639,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3684,7 +3684,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3729,7 +3729,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3774,7 +3774,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3819,7 +3819,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3864,7 +3864,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3909,7 +3909,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3954,7 +3954,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3999,7 +3999,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4044,7 +4044,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4089,7 +4089,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4134,7 +4134,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4179,7 +4179,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4224,7 +4224,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4269,7 +4269,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4314,7 +4314,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4359,7 +4359,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4404,7 +4404,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4449,7 +4449,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4494,7 +4494,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5052,7 +5052,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5093,7 +5093,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -5224,7 +5224,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5264,7 +5264,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5304,7 +5304,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5431,7 +5431,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5464,7 +5464,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5505,7 +5505,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -5636,7 +5636,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5669,7 +5669,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6196,7 +6196,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -6225,7 +6225,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6265,7 +6265,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6305,7 +6305,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6345,7 +6345,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6385,7 +6385,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6425,7 +6425,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6465,7 +6465,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6505,7 +6505,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6632,7 +6632,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -6664,7 +6664,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -6693,7 +6693,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6733,7 +6733,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6773,7 +6773,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6833,7 +6833,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6858,7 +6858,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6883,7 +6883,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6908,7 +6908,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6932,7 +6932,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -6964,7 +6964,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -6993,7 +6993,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7033,7 +7033,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7086,7 +7086,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -7187,4 +7187,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_create_delete_backup.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_create_delete_backup.json index c2992f56751e..d55e4059cfae 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_create_delete_backup.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_create_delete_backup.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1700,7 +1700,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1810,7 +1810,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1851,7 +1851,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1975,7 +1975,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2015,7 +2015,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2055,7 +2055,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2184,7 +2184,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2228,7 +2228,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2268,7 +2268,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2308,7 +2308,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2352,7 +2352,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2397,7 +2397,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2442,7 +2442,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2487,7 +2487,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2532,7 +2532,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2577,7 +2577,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2622,7 +2622,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2667,7 +2667,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2712,7 +2712,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2757,7 +2757,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2802,7 +2802,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2847,7 +2847,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2892,7 +2892,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2937,7 +2937,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2982,7 +2982,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3027,7 +3027,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3072,7 +3072,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3117,7 +3117,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3162,7 +3162,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3207,7 +3207,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3252,7 +3252,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3297,7 +3297,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3342,7 +3342,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3387,7 +3387,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3432,7 +3432,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3477,7 +3477,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3518,7 +3518,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -3651,7 +3651,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -3695,7 +3695,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3735,7 +3735,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -3779,7 +3779,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3824,7 +3824,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3869,7 +3869,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3914,7 +3914,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3959,7 +3959,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4004,7 +4004,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4049,7 +4049,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4094,7 +4094,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4139,7 +4139,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4184,7 +4184,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4229,7 +4229,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4274,7 +4274,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4319,7 +4319,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4364,7 +4364,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4409,7 +4409,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4454,7 +4454,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4499,7 +4499,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4544,7 +4544,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4589,7 +4589,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4634,7 +4634,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4679,7 +4679,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4724,7 +4724,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4769,7 +4769,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4814,7 +4814,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4859,7 +4859,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4904,7 +4904,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4949,7 +4949,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4994,7 +4994,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5060,7 +5060,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -5089,7 +5089,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5129,7 +5129,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5169,7 +5169,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5209,7 +5209,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5249,7 +5249,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5289,7 +5289,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5329,7 +5329,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5369,7 +5369,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5409,7 +5409,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5449,7 +5449,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5484,7 +5484,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5517,7 +5517,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5566,7 +5566,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5607,7 +5607,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -5738,7 +5738,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5778,7 +5778,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5818,7 +5818,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5945,7 +5945,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5978,7 +5978,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6011,7 +6011,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -6040,7 +6040,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6080,7 +6080,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6120,7 +6120,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6160,7 +6160,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6200,7 +6200,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6240,7 +6240,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6367,7 +6367,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -6399,7 +6399,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -6428,7 +6428,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6468,7 +6468,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6508,7 +6508,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6568,7 +6568,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6593,7 +6593,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6618,7 +6618,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6643,7 +6643,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -6667,7 +6667,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -6699,7 +6699,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -6728,7 +6728,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6768,7 +6768,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6821,7 +6821,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -6884,4 +6884,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_by_name.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_by_name.json index 4ae087dfeef0..7f4d8c4d8df9 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_by_name.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_by_name.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1740,7 +1740,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1850,7 +1850,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1891,7 +1891,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2015,7 +2015,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2055,7 +2055,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2095,7 +2095,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2224,7 +2224,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2268,7 +2268,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2308,7 +2308,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2348,7 +2348,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2392,7 +2392,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2437,7 +2437,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2482,7 +2482,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2527,7 +2527,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2572,7 +2572,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2617,7 +2617,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2662,7 +2662,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2707,7 +2707,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2752,7 +2752,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2797,7 +2797,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2842,7 +2842,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2887,7 +2887,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2932,7 +2932,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2977,7 +2977,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3022,7 +3022,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3063,7 +3063,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -3194,7 +3194,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3234,7 +3234,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3274,7 +3274,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3401,7 +3401,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3435,7 +3435,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3464,7 +3464,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3504,7 +3504,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3544,7 +3544,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3584,7 +3584,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3624,7 +3624,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3664,7 +3664,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3704,7 +3704,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3831,7 +3831,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3863,7 +3863,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3892,7 +3892,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3932,7 +3932,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3972,7 +3972,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4032,7 +4032,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4057,7 +4057,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4082,7 +4082,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4107,7 +4107,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4131,7 +4131,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4163,7 +4163,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4192,7 +4192,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4232,7 +4232,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4285,7 +4285,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4348,4 +4348,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_status.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_status.json index 93a675bf9484..38197dc4f5ef 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_status.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_get_backup_status.json @@ -798,7 +798,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -850,7 +850,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -890,7 +890,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -964,7 +964,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1028,7 +1028,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1068,7 +1068,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1129,7 +1129,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1226,7 +1226,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1266,7 +1266,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1306,7 +1306,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1346,7 +1346,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1386,7 +1386,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1426,7 +1426,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1466,7 +1466,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1506,7 +1506,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1546,7 +1546,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1586,7 +1586,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1626,7 +1626,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1666,7 +1666,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1776,7 +1776,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1886,7 +1886,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1927,7 +1927,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2051,7 +2051,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2091,7 +2091,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2131,7 +2131,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2260,7 +2260,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2304,7 +2304,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2344,7 +2344,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2384,7 +2384,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2428,7 +2428,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2473,7 +2473,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2518,7 +2518,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2563,7 +2563,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2608,7 +2608,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2653,7 +2653,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2698,7 +2698,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2743,7 +2743,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2788,7 +2788,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2833,7 +2833,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2878,7 +2878,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2923,7 +2923,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2968,7 +2968,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3013,7 +3013,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3058,7 +3058,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3103,7 +3103,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3148,7 +3148,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3193,7 +3193,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3238,7 +3238,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3283,7 +3283,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3328,7 +3328,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3373,7 +3373,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3418,7 +3418,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3463,7 +3463,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3508,7 +3508,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3545,7 +3545,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3586,7 +3586,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -3717,7 +3717,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3757,7 +3757,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3797,7 +3797,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3924,7 +3924,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3958,7 +3958,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3987,7 +3987,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4027,7 +4027,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4067,7 +4067,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4107,7 +4107,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4147,7 +4147,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4187,7 +4187,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4314,7 +4314,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4346,7 +4346,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4375,7 +4375,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4415,7 +4415,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4455,7 +4455,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4515,7 +4515,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4540,7 +4540,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4565,7 +4565,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4590,7 +4590,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4614,7 +4614,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4646,7 +4646,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4675,7 +4675,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4715,7 +4715,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4768,7 +4768,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4831,4 +4831,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_list_backup.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_list_backup.json index 328ec57a2635..3fee96f93391 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_list_backup.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_list_backup.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1700,7 +1700,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1810,7 +1810,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1851,7 +1851,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1975,7 +1975,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2015,7 +2015,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2055,7 +2055,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2184,7 +2184,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2228,7 +2228,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2268,7 +2268,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2308,7 +2308,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2352,7 +2352,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2397,7 +2397,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2442,7 +2442,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2487,7 +2487,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2532,7 +2532,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2577,7 +2577,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2622,7 +2622,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2667,7 +2667,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2708,7 +2708,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2841,7 +2841,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2885,7 +2885,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2925,7 +2925,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2969,7 +2969,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3014,7 +3014,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3059,7 +3059,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3104,7 +3104,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3149,7 +3149,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3194,7 +3194,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3239,7 +3239,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3284,7 +3284,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3329,7 +3329,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3374,7 +3374,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3419,7 +3419,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3464,7 +3464,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3509,7 +3509,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3554,7 +3554,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3599,7 +3599,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3644,7 +3644,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3689,7 +3689,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3734,7 +3734,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3779,7 +3779,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3824,7 +3824,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3869,7 +3869,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3914,7 +3914,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3959,7 +3959,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4004,7 +4004,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4049,7 +4049,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4094,7 +4094,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4139,7 +4139,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4184,7 +4184,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4249,7 +4249,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4290,7 +4290,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -4421,7 +4421,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4461,7 +4461,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4501,7 +4501,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4628,7 +4628,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4661,7 +4661,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4702,7 +4702,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -4833,7 +4833,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4866,7 +4866,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4899,7 +4899,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4928,7 +4928,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4968,7 +4968,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5008,7 +5008,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5048,7 +5048,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5088,7 +5088,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5128,7 +5128,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5168,7 +5168,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5208,7 +5208,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5335,7 +5335,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5367,7 +5367,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -5396,7 +5396,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5436,7 +5436,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5476,7 +5476,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5536,7 +5536,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -5561,7 +5561,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -5586,7 +5586,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -5611,7 +5611,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -5635,7 +5635,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5667,7 +5667,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -5696,7 +5696,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5736,7 +5736,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5789,7 +5789,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5852,4 +5852,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_update_backup.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_update_backup.json index 3b7a21f26753..af9e4d9810c7 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_update_backup.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup.pyTestNetAppBackuptest_update_backup.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1740,7 +1740,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1850,7 +1850,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1891,7 +1891,7 @@ "Connection": "keep-alive", "Content-Length": "412", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2015,7 +2015,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2055,7 +2055,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2095,7 +2095,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2224,7 +2224,7 @@ "Connection": "keep-alive", "Content-Length": "69", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2268,7 +2268,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2308,7 +2308,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2348,7 +2348,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2392,7 +2392,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2437,7 +2437,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2482,7 +2482,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2527,7 +2527,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2572,7 +2572,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2617,7 +2617,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2662,7 +2662,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2707,7 +2707,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2752,7 +2752,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2797,7 +2797,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2842,7 +2842,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2887,7 +2887,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2932,7 +2932,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2977,7 +2977,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3022,7 +3022,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3067,7 +3067,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3112,7 +3112,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3157,7 +3157,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3202,7 +3202,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3247,7 +3247,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3292,7 +3292,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3337,7 +3337,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3382,7 +3382,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3427,7 +3427,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3472,7 +3472,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3517,7 +3517,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3562,7 +3562,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3607,7 +3607,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3652,7 +3652,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3699,7 +3699,7 @@ "Connection": "keep-alive", "Content-Length": "65", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -3744,7 +3744,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3784,7 +3784,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3824,7 +3824,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3872,7 +3872,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3918,7 +3918,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3959,7 +3959,7 @@ "Connection": "keep-alive", "Content-Length": "413", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -4090,7 +4090,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4130,7 +4130,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4170,7 +4170,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4297,7 +4297,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4331,7 +4331,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4360,7 +4360,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4400,7 +4400,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4440,7 +4440,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4480,7 +4480,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4520,7 +4520,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4560,7 +4560,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4687,7 +4687,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -4719,7 +4719,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -4748,7 +4748,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4788,7 +4788,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4828,7 +4828,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4888,7 +4888,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4913,7 +4913,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4938,7 +4938,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4963,7 +4963,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -4987,7 +4987,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5019,7 +5019,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -5048,7 +5048,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5088,7 +5088,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5141,7 +5141,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -5204,4 +5204,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_create_delete_backup_policy.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_create_delete_backup_policy.json index e86050849a0e..f490e271b836 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_create_delete_backup_policy.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_create_delete_backup_policy.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "134", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -449,7 +449,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -489,7 +489,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -546,7 +546,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -607,7 +607,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -636,7 +636,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -676,7 +676,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -733,7 +733,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -766,7 +766,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -799,7 +799,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -828,7 +828,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -868,7 +868,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -921,7 +921,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -949,4 +949,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_get_backup_policy_by_name.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_get_backup_policy_by_name.json index 832745be04f2..3a2b92dd73be 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_get_backup_policy_by_name.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_get_backup_policy_by_name.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "134", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -449,7 +449,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -489,7 +489,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -546,7 +546,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -604,7 +604,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -633,7 +633,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -673,7 +673,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -730,7 +730,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -764,7 +764,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -793,7 +793,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -833,7 +833,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -886,7 +886,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -914,4 +914,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_list_backup_policies.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_list_backup_policies.json index da760321f854..844adddd44ab 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_list_backup_policies.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_list_backup_policies.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "134", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -449,7 +449,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -489,7 +489,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -548,7 +548,7 @@ "Connection": "keep-alive", "Content-Length": "134", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -610,7 +610,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -650,7 +650,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -707,7 +707,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -795,7 +795,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -824,7 +824,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -864,7 +864,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -921,7 +921,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -955,7 +955,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -984,7 +984,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1024,7 +1024,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1081,7 +1081,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1114,7 +1114,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1147,7 +1147,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1176,7 +1176,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1216,7 +1216,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1269,7 +1269,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1297,4 +1297,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_update_backup_policies.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_update_backup_policies.json index 57b0aeb0f3ca..8b98c58e32e7 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_update_backup_policies.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_backup_policies.pyTestNetAppBackupPoliciestest_update_backup_policies.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "134", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -449,7 +449,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -489,7 +489,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -548,7 +548,7 @@ "Connection": "keep-alive", "Content-Length": "134", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -613,7 +613,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -653,7 +653,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -711,7 +711,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -740,7 +740,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -780,7 +780,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -837,7 +837,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -871,7 +871,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -900,7 +900,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -940,7 +940,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -993,7 +993,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1021,4 +1021,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_net_app_resource_quota_limits.pyTestNetAppResourceQuotatest_list_resource_quota_limit.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_net_app_resource_quota_limits.pyTestNetAppResourceQuotatest_list_resource_quota_limit.json index 62ea9585e5bd..a08c2fc63c47 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_net_app_resource_quota_limits.pyTestNetAppResourceQuotatest_list_resource_quota_limit.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_net_app_resource_quota_limits.pyTestNetAppResourceQuotatest_list_resource_quota_limit.json @@ -219,7 +219,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -328,4 +328,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_create_delete_pool.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_create_delete_pool.json index 1421e1617ee7..31fdea78f8f3 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_create_delete_pool.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_create_delete_pool.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -451,7 +451,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -491,7 +491,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -550,7 +550,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -613,7 +613,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -642,7 +642,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -682,7 +682,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -722,7 +722,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -782,7 +782,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -807,7 +807,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -832,7 +832,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -857,7 +857,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -881,7 +881,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -912,7 +912,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -945,7 +945,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -974,7 +974,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1014,7 +1014,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1067,7 +1067,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1095,4 +1095,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_get_pool_by_name.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_get_pool_by_name.json index 14bacfcdcd7c..8d0119d7bdd6 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_get_pool_by_name.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_get_pool_by_name.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -451,7 +451,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -491,7 +491,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -550,7 +550,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -610,7 +610,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -639,7 +639,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -679,7 +679,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -719,7 +719,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -779,7 +779,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -804,7 +804,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -829,7 +829,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -854,7 +854,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -878,7 +878,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -910,7 +910,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -939,7 +939,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -979,7 +979,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1060,4 +1060,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_list_pools.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_list_pools.json index 66a76e7af5df..cc81dadf898c 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_list_pools.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_list_pools.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -451,7 +451,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -491,7 +491,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -552,7 +552,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -616,7 +616,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -656,7 +656,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -715,7 +715,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -807,7 +807,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -836,7 +836,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -876,7 +876,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -936,7 +936,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -963,7 +963,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -988,7 +988,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -1013,7 +1013,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -1037,7 +1037,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1069,7 +1069,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1098,7 +1098,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1138,7 +1138,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1178,7 +1178,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1238,7 +1238,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -1263,7 +1263,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -1288,7 +1288,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -1313,7 +1313,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -1337,7 +1337,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1369,7 +1369,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1398,7 +1398,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1438,7 +1438,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1491,7 +1491,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1519,4 +1519,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_patch_pool.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_patch_pool.json index 9f461dda1dc2..cd3c4ed4d699 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_patch_pool.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_patch_pool.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -451,7 +451,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -491,7 +491,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -552,7 +552,7 @@ "Connection": "keep-alive", "Content-Length": "88", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "tags": { @@ -619,7 +619,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -659,7 +659,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -720,7 +720,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -749,7 +749,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -789,7 +789,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -829,7 +829,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -890,7 +890,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -915,7 +915,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -940,7 +940,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -965,7 +965,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -989,7 +989,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1021,7 +1021,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1050,7 +1050,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1090,7 +1090,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1143,7 +1143,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1171,4 +1171,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_update_pool.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_update_pool.json index a314735839dc..8f664dd633c5 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_update_pool.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_pool.pyTestNetAppCapacityPooltest_update_pool.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -451,7 +451,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -491,7 +491,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -552,7 +552,7 @@ "Connection": "keep-alive", "Content-Length": "83", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -618,7 +618,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -658,7 +658,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -718,7 +718,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -747,7 +747,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -787,7 +787,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -827,7 +827,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -887,7 +887,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -912,7 +912,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -937,7 +937,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -962,7 +962,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -986,7 +986,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1018,7 +1018,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1047,7 +1047,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1087,7 +1087,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1140,7 +1140,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1168,4 +1168,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_create_delete_snapshot.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_create_delete_snapshot.json index c118819f844f..d907323fb2a8 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_create_delete_snapshot.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_create_delete_snapshot.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1740,7 +1740,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1852,7 +1852,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -1892,7 +1892,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1932,7 +1932,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1972,7 +1972,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2011,7 +2011,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2056,7 +2056,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2085,7 +2085,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2125,7 +2125,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2165,7 +2165,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2200,7 +2200,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2233,7 +2233,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2266,7 +2266,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2295,7 +2295,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2335,7 +2335,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2375,7 +2375,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2415,7 +2415,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2455,7 +2455,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2495,7 +2495,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2535,7 +2535,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2575,7 +2575,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2695,7 +2695,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2727,7 +2727,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2756,7 +2756,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2796,7 +2796,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2836,7 +2836,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2896,7 +2896,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2921,7 +2921,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2946,7 +2946,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2971,7 +2971,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2995,7 +2995,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3027,7 +3027,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3056,7 +3056,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3096,7 +3096,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3149,7 +3149,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3212,4 +3212,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_get_snapshot_by_name.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_get_snapshot_by_name.json index f2adee42e64f..ee6685b1c22b 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_get_snapshot_by_name.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_get_snapshot_by_name.json @@ -795,7 +795,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -847,7 +847,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -887,7 +887,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -961,7 +961,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1025,7 +1025,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1065,7 +1065,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1126,7 +1126,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1223,7 +1223,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1263,7 +1263,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1303,7 +1303,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1343,7 +1343,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1383,7 +1383,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1423,7 +1423,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1463,7 +1463,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1503,7 +1503,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1543,7 +1543,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1583,7 +1583,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1623,7 +1623,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1663,7 +1663,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1773,7 +1773,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1885,7 +1885,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -1925,7 +1925,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1965,7 +1965,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2005,7 +2005,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2044,7 +2044,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2085,7 +2085,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2114,7 +2114,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2154,7 +2154,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2194,7 +2194,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2229,7 +2229,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2263,7 +2263,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2292,7 +2292,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2332,7 +2332,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2372,7 +2372,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2412,7 +2412,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2452,7 +2452,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2492,7 +2492,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2532,7 +2532,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2572,7 +2572,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2692,7 +2692,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2724,7 +2724,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2753,7 +2753,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2793,7 +2793,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2833,7 +2833,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2893,7 +2893,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2918,7 +2918,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2943,7 +2943,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2968,7 +2968,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2992,7 +2992,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3024,7 +3024,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3053,7 +3053,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3093,7 +3093,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3146,7 +3146,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3209,4 +3209,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_list_snapshots.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_list_snapshots.json index 72f21ac0cd73..df741323d1ca 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_list_snapshots.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot.pyTestNetAppSnapshottest_list_snapshots.json @@ -831,7 +831,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -883,7 +883,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -923,7 +923,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -997,7 +997,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1061,7 +1061,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1101,7 +1101,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1162,7 +1162,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1259,7 +1259,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1299,7 +1299,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1339,7 +1339,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1379,7 +1379,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1419,7 +1419,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1459,7 +1459,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1499,7 +1499,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1539,7 +1539,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1579,7 +1579,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1619,7 +1619,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1659,7 +1659,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1699,7 +1699,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1809,7 +1809,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1921,7 +1921,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -1961,7 +1961,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2001,7 +2001,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2041,7 +2041,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2080,7 +2080,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2192,7 +2192,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -2232,7 +2232,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2272,7 +2272,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2312,7 +2312,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 201, @@ -2351,7 +2351,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2407,7 +2407,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2436,7 +2436,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2476,7 +2476,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2516,7 +2516,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2551,7 +2551,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2585,7 +2585,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2614,7 +2614,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2654,7 +2654,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2694,7 +2694,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2729,7 +2729,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2763,7 +2763,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2792,7 +2792,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2832,7 +2832,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2872,7 +2872,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2912,7 +2912,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2952,7 +2952,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2992,7 +2992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3032,7 +3032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3072,7 +3072,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3192,7 +3192,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3224,7 +3224,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3253,7 +3253,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3293,7 +3293,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3333,7 +3333,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3393,7 +3393,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3418,7 +3418,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3443,7 +3443,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3468,7 +3468,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3492,7 +3492,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3524,7 +3524,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3553,7 +3553,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3593,7 +3593,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3646,7 +3646,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3709,4 +3709,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_assign_snapshot_policy_to_volume.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_assign_snapshot_policy_to_volume.json index 4bafb71ada43..39c0d171fdc4 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_assign_snapshot_policy_to_volume.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_assign_snapshot_policy_to_volume.json @@ -798,7 +798,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -850,7 +850,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -890,7 +890,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -964,7 +964,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1028,7 +1028,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1068,7 +1068,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1129,7 +1129,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1226,7 +1226,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1266,7 +1266,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1306,7 +1306,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1346,7 +1346,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1386,7 +1386,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1426,7 +1426,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1466,7 +1466,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1506,7 +1506,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1546,7 +1546,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1586,7 +1586,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1626,7 +1626,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1666,7 +1666,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1778,7 +1778,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -1853,7 +1853,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1893,7 +1893,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1967,7 +1967,7 @@ "Connection": "keep-alive", "Content-Length": "179", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -2039,7 +2039,7 @@ "Connection": "keep-alive", "Content-Length": "432", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -2162,7 +2162,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2202,7 +2202,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2242,7 +2242,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2368,7 +2368,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2397,7 +2397,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2437,7 +2437,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2477,7 +2477,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2517,7 +2517,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2557,7 +2557,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2597,7 +2597,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2637,7 +2637,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2762,7 +2762,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2794,7 +2794,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2823,7 +2823,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2863,7 +2863,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2921,7 +2921,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2955,7 +2955,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2984,7 +2984,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3024,7 +3024,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3064,7 +3064,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3124,7 +3124,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3149,7 +3149,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3174,7 +3174,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3199,7 +3199,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3223,7 +3223,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3255,7 +3255,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3284,7 +3284,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3324,7 +3324,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3378,7 +3378,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3441,4 +3441,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_create_delete_snapshot_policy.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_create_delete_snapshot_policy.json index ae0e20ddcdf4..f08da68ceb6e 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_create_delete_snapshot_policy.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_create_delete_snapshot_policy.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "179", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -457,7 +457,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -520,7 +520,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -549,7 +549,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -589,7 +589,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -647,7 +647,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -680,7 +680,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -713,7 +713,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -742,7 +742,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -782,7 +782,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -835,7 +835,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -863,4 +863,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_get_snapshot_policy_by_name.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_get_snapshot_policy_by_name.json index 8a6f89e3c995..8a7b51db9190 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_get_snapshot_policy_by_name.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_get_snapshot_policy_by_name.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "179", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -457,7 +457,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -517,7 +517,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -546,7 +546,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -586,7 +586,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -644,7 +644,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -678,7 +678,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -707,7 +707,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -747,7 +747,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -800,7 +800,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -828,4 +828,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_list_snapshot_policies.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_list_snapshot_policies.json index 18b65bf5eefa..4e1da79b2bde 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_list_snapshot_policies.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_list_snapshot_policies.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "179", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -459,7 +459,7 @@ "Connection": "keep-alive", "Content-Length": "179", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -529,7 +529,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -621,7 +621,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -650,7 +650,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -690,7 +690,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -748,7 +748,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -782,7 +782,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -811,7 +811,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -851,7 +851,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -909,7 +909,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -942,7 +942,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -975,7 +975,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1004,7 +1004,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1044,7 +1044,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1097,7 +1097,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -1125,4 +1125,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_update_snapshot_policies.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_update_snapshot_policies.json index 8fccbb3af1be..4c888e8972d0 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_update_snapshot_policies.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_snapshot_policies.pyTestNetAppSnapshotPolicytest_update_snapshot_policies.json @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -273,7 +273,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -313,7 +313,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -387,7 +387,7 @@ "Connection": "keep-alive", "Content-Length": "179", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -459,7 +459,7 @@ "Connection": "keep-alive", "Content-Length": "190", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -531,7 +531,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -571,7 +571,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -634,7 +634,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -663,7 +663,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -703,7 +703,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -765,7 +765,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -799,7 +799,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -828,7 +828,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -868,7 +868,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -921,7 +921,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -949,4 +949,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_crud_subvolumes.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_crud_subvolumes.json index da38862eee11..045d8df0fa47 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_crud_subvolumes.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_crud_subvolumes.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "812", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1192,7 +1192,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1232,7 +1232,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1272,7 +1272,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1312,7 +1312,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1352,7 +1352,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1392,7 +1392,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1432,7 +1432,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1472,7 +1472,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1512,7 +1512,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1552,7 +1552,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1592,7 +1592,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1632,7 +1632,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1744,7 +1744,7 @@ "Connection": "keep-alive", "Content-Length": "59", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1788,7 +1788,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1828,7 +1828,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1868,7 +1868,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1908,7 +1908,7 @@ "Connection": "keep-alive", "Content-Length": "64", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1952,7 +1952,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1992,7 +1992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2032,7 +2032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2070,7 +2070,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2109,7 +2109,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2138,7 +2138,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2178,7 +2178,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2218,7 +2218,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2251,7 +2251,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2280,7 +2280,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2320,7 +2320,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2360,7 +2360,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2400,7 +2400,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2440,7 +2440,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2480,7 +2480,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2520,7 +2520,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2640,7 +2640,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2672,7 +2672,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2701,7 +2701,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2741,7 +2741,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2781,7 +2781,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2841,7 +2841,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2866,7 +2866,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2891,7 +2891,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2916,7 +2916,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2940,7 +2940,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2972,7 +2972,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3001,7 +3001,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3041,7 +3041,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3094,7 +3094,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3157,4 +3157,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_get_metadata.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_get_metadata.json index db782bbb56fd..9658d566bb33 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_get_metadata.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_get_metadata.json @@ -831,7 +831,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -883,7 +883,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -923,7 +923,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -997,7 +997,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1061,7 +1061,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1101,7 +1101,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1162,7 +1162,7 @@ "Connection": "keep-alive", "Content-Length": "814", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1261,7 +1261,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1301,7 +1301,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1341,7 +1341,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1381,7 +1381,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1421,7 +1421,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1461,7 +1461,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1501,7 +1501,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1541,7 +1541,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1581,7 +1581,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1621,7 +1621,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1661,7 +1661,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1701,7 +1701,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1813,7 +1813,7 @@ "Connection": "keep-alive", "Content-Length": "55", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1857,7 +1857,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1897,7 +1897,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1937,7 +1937,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1976,7 +1976,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2010,7 +2010,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2050,7 +2050,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2099,7 +2099,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2128,7 +2128,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2168,7 +2168,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2209,7 +2209,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2238,7 +2238,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2278,7 +2278,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2318,7 +2318,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2358,7 +2358,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2398,7 +2398,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2438,7 +2438,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2478,7 +2478,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2598,7 +2598,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2630,7 +2630,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2659,7 +2659,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2699,7 +2699,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2739,7 +2739,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2799,7 +2799,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2824,7 +2824,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2849,7 +2849,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2874,7 +2874,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2898,7 +2898,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2930,7 +2930,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2959,7 +2959,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2999,7 +2999,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3052,7 +3052,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3115,4 +3115,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_list_by_volume.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_list_by_volume.json index 6b0fb94419d0..0bbd17fddf69 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_list_by_volume.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_subvolume.pyTestNetAppSubvolumetest_list_by_volume.json @@ -831,7 +831,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -883,7 +883,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -923,7 +923,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -997,7 +997,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1061,7 +1061,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1101,7 +1101,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1162,7 +1162,7 @@ "Connection": "keep-alive", "Content-Length": "814", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1261,7 +1261,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1301,7 +1301,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1341,7 +1341,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1381,7 +1381,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1421,7 +1421,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1461,7 +1461,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1501,7 +1501,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1541,7 +1541,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1581,7 +1581,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1621,7 +1621,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1661,7 +1661,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1773,7 +1773,7 @@ "Connection": "keep-alive", "Content-Length": "59", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1817,7 +1817,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1857,7 +1857,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1897,7 +1897,7 @@ "Connection": "keep-alive", "Content-Length": "59", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1941,7 +1941,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1993,7 +1993,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2022,7 +2022,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2062,7 +2062,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2102,7 +2102,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2140,7 +2140,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2180,7 +2180,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2213,7 +2213,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2253,7 +2253,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2296,7 +2296,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2325,7 +2325,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2365,7 +2365,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2405,7 +2405,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2438,7 +2438,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2467,7 +2467,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2507,7 +2507,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2547,7 +2547,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2587,7 +2587,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2627,7 +2627,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2667,7 +2667,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2707,7 +2707,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2747,7 +2747,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2867,7 +2867,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2899,7 +2899,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2928,7 +2928,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2968,7 +2968,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3008,7 +3008,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3068,7 +3068,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3093,7 +3093,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3118,7 +3118,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3143,7 +3143,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3167,7 +3167,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3199,7 +3199,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3228,7 +3228,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3268,7 +3268,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3321,7 +3321,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3384,4 +3384,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_vault.pyTestNetAppVaulttest_get_vault.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_vault.pyTestNetAppVaulttest_get_vault.json index 25a7519a76bb..1b32692eebfd 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_vault.pyTestNetAppVaulttest_get_vault.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_vault.pyTestNetAppVaulttest_get_vault.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1740,7 +1740,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1780,7 +1780,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1809,7 +1809,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1849,7 +1849,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1889,7 +1889,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1929,7 +1929,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1969,7 +1969,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2009,7 +2009,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2049,7 +2049,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2169,7 +2169,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2201,7 +2201,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2230,7 +2230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2270,7 +2270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2310,7 +2310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2370,7 +2370,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2395,7 +2395,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2420,7 +2420,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2445,7 +2445,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2469,7 +2469,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2501,7 +2501,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2530,7 +2530,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2570,7 +2570,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2623,7 +2623,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2686,4 +2686,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_create_delete_list_volume.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_create_delete_list_volume.json index 674c3645ee33..a93dfc84017f 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_create_delete_list_volume.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_create_delete_list_volume.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "774", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1740,7 +1740,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1854,7 +1854,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1883,7 +1883,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1923,7 +1923,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1963,7 +1963,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2003,7 +2003,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2043,7 +2043,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2083,7 +2083,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2123,7 +2123,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2163,7 +2163,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2283,7 +2283,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2314,7 +2314,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2346,7 +2346,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2378,7 +2378,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2407,7 +2407,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2447,7 +2447,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2487,7 +2487,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2547,7 +2547,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2572,7 +2572,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2597,7 +2597,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2622,7 +2622,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2646,7 +2646,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2678,7 +2678,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2707,7 +2707,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2747,7 +2747,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2800,7 +2800,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2863,4 +2863,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_get_volume_by_name.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_get_volume_by_name.json index 570dfad963a8..2f549cf65269 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_get_volume_by_name.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_get_volume_by_name.json @@ -798,7 +798,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -850,7 +850,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -890,7 +890,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -964,7 +964,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1028,7 +1028,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1068,7 +1068,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1129,7 +1129,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1226,7 +1226,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1266,7 +1266,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1306,7 +1306,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1346,7 +1346,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1386,7 +1386,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1426,7 +1426,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1466,7 +1466,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1506,7 +1506,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1546,7 +1546,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1586,7 +1586,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1626,7 +1626,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1666,7 +1666,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1776,7 +1776,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1887,7 +1887,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -1916,7 +1916,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1956,7 +1956,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1996,7 +1996,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2036,7 +2036,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2076,7 +2076,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2116,7 +2116,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2236,7 +2236,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2268,7 +2268,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2297,7 +2297,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2337,7 +2337,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2397,7 +2397,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2424,7 +2424,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2449,7 +2449,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2474,7 +2474,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2498,7 +2498,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2530,7 +2530,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2559,7 +2559,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2599,7 +2599,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2652,7 +2652,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2715,4 +2715,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_list_volumes.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_list_volumes.json index c94e29b5aa2c..2c882811f01f 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_list_volumes.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_list_volumes.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1742,7 +1742,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1839,7 +1839,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1879,7 +1879,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1919,7 +1919,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1959,7 +1959,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2069,7 +2069,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2263,7 +2263,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2292,7 +2292,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2332,7 +2332,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2372,7 +2372,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2492,7 +2492,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2524,7 +2524,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2553,7 +2553,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2593,7 +2593,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2633,7 +2633,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2673,7 +2673,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2713,7 +2713,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2753,7 +2753,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2793,7 +2793,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2833,7 +2833,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2953,7 +2953,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2985,7 +2985,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3014,7 +3014,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3054,7 +3054,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3094,7 +3094,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3154,7 +3154,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3179,7 +3179,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3204,7 +3204,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3229,7 +3229,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3253,7 +3253,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3285,7 +3285,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3314,7 +3314,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3354,7 +3354,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3407,7 +3407,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3470,4 +3470,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_patch_volume.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_patch_volume.json index 0fdba4972015..78b8a7a92efb 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_patch_volume.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_patch_volume.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1702,7 +1702,7 @@ "Connection": "keep-alive", "Content-Length": "166", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "properties": { @@ -1820,7 +1820,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1860,7 +1860,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1900,7 +1900,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2021,7 +2021,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2050,7 +2050,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2090,7 +2090,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2130,7 +2130,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2170,7 +2170,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2210,7 +2210,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2250,7 +2250,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2290,7 +2290,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2330,7 +2330,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2450,7 +2450,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2482,7 +2482,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2511,7 +2511,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2551,7 +2551,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2591,7 +2591,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2651,7 +2651,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2676,7 +2676,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2701,7 +2701,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2726,7 +2726,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2750,7 +2750,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2782,7 +2782,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2811,7 +2811,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2851,7 +2851,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2904,7 +2904,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2967,4 +2967,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_pool_change.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_pool_change.json index 4481e611be66..c952cc1af0cb 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_pool_change.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_pool_change.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -814,7 +814,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -854,7 +854,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -928,7 +928,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -992,7 +992,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1032,7 +1032,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1190,7 +1190,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1230,7 +1230,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1270,7 +1270,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1310,7 +1310,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1350,7 +1350,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1390,7 +1390,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1430,7 +1430,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1470,7 +1470,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1510,7 +1510,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1550,7 +1550,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1590,7 +1590,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1630,7 +1630,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1742,7 +1742,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1806,7 +1806,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1846,7 +1846,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1907,7 +1907,7 @@ "Connection": "keep-alive", "Content-Length": "219", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "newPoolResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sdk-python-tests-rg-tmp/providers/Microsoft.NetApp/netAppAccounts/sdk-py-tests-acc-1-7b9e2339/capacityPools/sdk-py-tests-pool-2" @@ -1938,7 +1938,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1978,7 +1978,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2018,7 +2018,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2130,7 +2130,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2232,7 +2232,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2265,7 +2265,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2294,7 +2294,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2334,7 +2334,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2374,7 +2374,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2414,7 +2414,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2454,7 +2454,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2494,7 +2494,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2534,7 +2534,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2646,7 +2646,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2678,7 +2678,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2707,7 +2707,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2747,7 +2747,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2787,7 +2787,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2847,7 +2847,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2872,7 +2872,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2897,7 +2897,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2922,7 +2922,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2946,7 +2946,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2978,7 +2978,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3007,7 +3007,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3047,7 +3047,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3087,7 +3087,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3147,7 +3147,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3172,7 +3172,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3197,7 +3197,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3222,7 +3222,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -3246,7 +3246,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3278,7 +3278,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -3307,7 +3307,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3347,7 +3347,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3400,7 +3400,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -3463,4 +3463,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_update_volume.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_update_volume.json index 1905a9e4709a..45ab80580546 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_update_volume.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_update_volume.json @@ -762,7 +762,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -834,7 +834,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -874,7 +874,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -914,7 +914,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -988,7 +988,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1053,7 +1053,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1093,7 +1093,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1154,7 +1154,7 @@ "Connection": "keep-alive", "Content-Length": "783", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1251,7 +1251,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1291,7 +1291,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1331,7 +1331,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1371,7 +1371,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1411,7 +1411,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1451,7 +1451,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1491,7 +1491,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1531,7 +1531,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1571,7 +1571,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1611,7 +1611,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1651,7 +1651,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1691,7 +1691,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1803,7 +1803,7 @@ "Connection": "keep-alive", "Content-Length": "787", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1937,7 +1937,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1977,7 +1977,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2017,7 +2017,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2104,7 +2104,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -2133,7 +2133,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2173,7 +2173,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2213,7 +2213,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2253,7 +2253,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2293,7 +2293,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2333,7 +2333,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2373,7 +2373,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2413,7 +2413,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2507,7 +2507,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2539,7 +2539,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2564,7 +2564,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2589,7 +2589,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2614,7 +2614,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2639,7 +2639,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2663,7 +2663,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2695,7 +2695,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -2719,7 +2719,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -2780,4 +2780,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_volume_replication.json b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_volume_replication.json index 9d06787851e9..4550f6a8099a 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_volume_replication.json +++ b/sdk/netapp/azure-mgmt-netapp/tests/recordings/test_volume.pyTestNetAppVolumetest_volume_replication.json @@ -1199,7 +1199,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2" @@ -1251,7 +1251,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1291,7 +1291,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1365,7 +1365,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1429,7 +1429,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1469,7 +1469,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1530,7 +1530,7 @@ "Connection": "keep-alive", "Content-Length": "789", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "westus2", @@ -1627,7 +1627,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1667,7 +1667,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1707,7 +1707,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1747,7 +1747,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1787,7 +1787,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1827,7 +1827,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1867,7 +1867,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1907,7 +1907,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1947,7 +1947,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -1987,7 +1987,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2027,7 +2027,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2067,7 +2067,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2179,7 +2179,7 @@ "Connection": "keep-alive", "Content-Length": "23", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "eastus2" @@ -2231,7 +2231,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2271,7 +2271,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2345,7 +2345,7 @@ "Connection": "keep-alive", "Content-Length": "138", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "eastus2", @@ -2409,7 +2409,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2449,7 +2449,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2510,7 +2510,7 @@ "Connection": "keep-alive", "Content-Length": "1213", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "location": "eastus2", @@ -2625,7 +2625,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2665,7 +2665,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2705,7 +2705,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2745,7 +2745,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2785,7 +2785,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2825,7 +2825,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2865,7 +2865,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2905,7 +2905,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2945,7 +2945,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -2985,7 +2985,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3025,7 +3025,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3137,7 +3137,7 @@ "Connection": "keep-alive", "Content-Length": "268", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": { "remoteVolumeResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sdk-python-tests-rg-R-tmp/providers/Microsoft.NetApp/netAppAccounts/sdk-py-tests-acc-2-b2-86eb264b/capacityPools/sdk-py-tests-pool-2/volumes/sdk-py-tests-vol-4-b2-86eb264b" @@ -3168,7 +3168,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3278,7 +3278,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3318,7 +3318,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3428,7 +3428,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3538,7 +3538,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3648,7 +3648,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3758,7 +3758,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3870,7 +3870,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -3980,7 +3980,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4092,7 +4092,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4202,7 +4202,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4314,7 +4314,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4424,7 +4424,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4536,7 +4536,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4646,7 +4646,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4758,7 +4758,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4868,7 +4868,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -4980,7 +4980,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5090,7 +5090,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5202,7 +5202,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5312,7 +5312,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5424,7 +5424,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5534,7 +5534,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5646,7 +5646,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5756,7 +5756,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5868,7 +5868,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -5978,7 +5978,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6090,7 +6090,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6200,7 +6200,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6312,7 +6312,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6422,7 +6422,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6534,7 +6534,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6644,7 +6644,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6756,7 +6756,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6796,7 +6796,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -6906,7 +6906,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7018,7 +7018,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7128,7 +7128,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7240,7 +7240,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7350,7 +7350,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7462,7 +7462,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7572,7 +7572,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7684,7 +7684,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7794,7 +7794,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -7906,7 +7906,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8016,7 +8016,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8128,7 +8128,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8245,7 +8245,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8357,7 +8357,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8397,7 +8397,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8530,7 +8530,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8566,7 +8566,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8602,7 +8602,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8638,7 +8638,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8674,7 +8674,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8710,7 +8710,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8746,7 +8746,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8782,7 +8782,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8818,7 +8818,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8854,7 +8854,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8890,7 +8890,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8926,7 +8926,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8962,7 +8962,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -8998,7 +8998,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9034,7 +9034,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9070,7 +9070,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9106,7 +9106,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9142,7 +9142,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9178,7 +9178,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9214,7 +9214,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9250,7 +9250,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9286,7 +9286,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9322,7 +9322,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9358,7 +9358,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9394,7 +9394,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9430,7 +9430,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9466,7 +9466,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9502,7 +9502,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9538,7 +9538,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9574,7 +9574,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9610,7 +9610,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9646,7 +9646,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9682,7 +9682,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9718,7 +9718,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9754,7 +9754,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9790,7 +9790,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9826,7 +9826,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9862,7 +9862,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9898,7 +9898,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9934,7 +9934,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -9970,7 +9970,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10006,7 +10006,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10042,7 +10042,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10078,7 +10078,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10114,7 +10114,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10150,7 +10150,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10186,7 +10186,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10222,7 +10222,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10258,7 +10258,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10294,7 +10294,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10330,7 +10330,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10366,7 +10366,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10402,7 +10402,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10438,7 +10438,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10474,7 +10474,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10510,7 +10510,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10546,7 +10546,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10582,7 +10582,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10618,7 +10618,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10654,7 +10654,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10690,7 +10690,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10726,7 +10726,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10762,7 +10762,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10798,7 +10798,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10834,7 +10834,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10870,7 +10870,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10906,7 +10906,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10942,7 +10942,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -10978,7 +10978,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11014,7 +11014,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11050,7 +11050,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11086,7 +11086,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11122,7 +11122,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11158,7 +11158,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11194,7 +11194,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11230,7 +11230,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11266,7 +11266,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11302,7 +11302,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11338,7 +11338,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11374,7 +11374,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11410,7 +11410,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11446,7 +11446,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11482,7 +11482,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11518,7 +11518,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11554,7 +11554,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11590,7 +11590,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11626,7 +11626,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11662,7 +11662,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11698,7 +11698,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11734,7 +11734,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11770,7 +11770,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11806,7 +11806,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11842,7 +11842,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11878,7 +11878,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11914,7 +11914,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11950,7 +11950,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -11986,7 +11986,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12022,7 +12022,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12058,7 +12058,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12094,7 +12094,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12130,7 +12130,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12166,7 +12166,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12202,7 +12202,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12238,7 +12238,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12274,7 +12274,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12310,7 +12310,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12346,7 +12346,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12382,7 +12382,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12418,7 +12418,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12454,7 +12454,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12490,7 +12490,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12526,7 +12526,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12562,7 +12562,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12598,7 +12598,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12634,7 +12634,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12670,7 +12670,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12706,7 +12706,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12742,7 +12742,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12778,7 +12778,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12814,7 +12814,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12850,7 +12850,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12886,7 +12886,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12922,7 +12922,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12958,7 +12958,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -12994,7 +12994,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13030,7 +13030,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13066,7 +13066,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13102,7 +13102,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13138,7 +13138,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13174,7 +13174,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13210,7 +13210,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13246,7 +13246,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13282,7 +13282,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13318,7 +13318,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13354,7 +13354,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13390,7 +13390,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13426,7 +13426,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13462,7 +13462,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13498,7 +13498,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13534,7 +13534,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13570,7 +13570,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13606,7 +13606,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13642,7 +13642,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13678,7 +13678,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13714,7 +13714,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13750,7 +13750,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13786,7 +13786,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13822,7 +13822,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13858,7 +13858,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13894,7 +13894,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13930,7 +13930,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -13966,7 +13966,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14002,7 +14002,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14038,7 +14038,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14074,7 +14074,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14110,7 +14110,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14146,7 +14146,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14182,7 +14182,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14218,7 +14218,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14254,7 +14254,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14290,7 +14290,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14326,7 +14326,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14362,7 +14362,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14398,7 +14398,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14434,7 +14434,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14470,7 +14470,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14506,7 +14506,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14542,7 +14542,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14578,7 +14578,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14614,7 +14614,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14650,7 +14650,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14686,7 +14686,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14722,7 +14722,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14758,7 +14758,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14794,7 +14794,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14830,7 +14830,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14866,7 +14866,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14902,7 +14902,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14938,7 +14938,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -14974,7 +14974,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15010,7 +15010,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15046,7 +15046,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15082,7 +15082,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15118,7 +15118,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15154,7 +15154,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15190,7 +15190,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15226,7 +15226,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15262,7 +15262,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15298,7 +15298,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15334,7 +15334,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15371,7 +15371,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15413,7 +15413,7 @@ "Connection": "keep-alive", "Content-Length": "0", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -15442,7 +15442,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15482,7 +15482,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15518,7 +15518,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15635,7 +15635,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15675,7 +15675,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15787,7 +15787,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15916,7 +15916,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -15945,7 +15945,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -15985,7 +15985,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16021,7 +16021,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16057,7 +16057,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16093,7 +16093,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16129,7 +16129,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16165,7 +16165,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16201,7 +16201,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16237,7 +16237,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16273,7 +16273,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16309,7 +16309,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16345,7 +16345,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16381,7 +16381,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16417,7 +16417,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16453,7 +16453,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16489,7 +16489,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16525,7 +16525,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16561,7 +16561,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16597,7 +16597,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16633,7 +16633,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16669,7 +16669,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16705,7 +16705,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16741,7 +16741,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16777,7 +16777,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16817,7 +16817,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16853,7 +16853,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -16893,7 +16893,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17023,7 +17023,7 @@ "Connection": "keep-alive", "Content-Length": "0", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -17052,7 +17052,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17092,7 +17092,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17128,7 +17128,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17168,7 +17168,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17297,7 +17297,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -17326,7 +17326,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17366,7 +17366,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17402,7 +17402,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17438,7 +17438,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17474,7 +17474,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17510,7 +17510,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17546,7 +17546,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17582,7 +17582,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 400, @@ -17615,7 +17615,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17727,7 +17727,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17832,7 +17832,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -17861,7 +17861,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17901,7 +17901,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -17941,7 +17941,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18054,7 +18054,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18094,7 +18094,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18134,7 +18134,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18174,7 +18174,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18287,7 +18287,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -18319,7 +18319,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -18348,7 +18348,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18388,7 +18388,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18428,7 +18428,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18488,7 +18488,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -18513,7 +18513,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -18538,7 +18538,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -18563,7 +18563,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -18587,7 +18587,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -18619,7 +18619,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -18648,7 +18648,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18688,7 +18688,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18741,7 +18741,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -18775,7 +18775,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -18804,7 +18804,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18844,7 +18844,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18884,7 +18884,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18924,7 +18924,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -18964,7 +18964,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -19086,7 +19086,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -19118,7 +19118,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -19147,7 +19147,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -19187,7 +19187,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -19227,7 +19227,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -19287,7 +19287,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -19312,7 +19312,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -19337,7 +19337,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -19362,7 +19362,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 204, @@ -19386,7 +19386,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -19418,7 +19418,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 202, @@ -19447,7 +19447,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -19487,7 +19487,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 200, @@ -19540,7 +19540,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-netapp/9.0.1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" + "User-Agent": "azsdk-python-mgmt-netapp/9.0.2b1 Python/3.9.5 (Windows-10-10.0.19044-SP0)" }, "RequestBody": null, "StatusCode": 404, @@ -19774,4 +19774,4 @@ } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/nspkg/azure-cognitiveservices-knowledge-nspkg/pyproject.toml b/sdk/nspkg/azure-cognitiveservices-knowledge-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-cognitiveservices-knowledge-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-cognitiveservices-language-nspkg/pyproject.toml b/sdk/nspkg/azure-cognitiveservices-language-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-cognitiveservices-language-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-cognitiveservices-nspkg/pyproject.toml b/sdk/nspkg/azure-cognitiveservices-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-cognitiveservices-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-cognitiveservices-search-nspkg/pyproject.toml b/sdk/nspkg/azure-cognitiveservices-search-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-cognitiveservices-search-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-cognitiveservices-vision-nspkg/pyproject.toml b/sdk/nspkg/azure-cognitiveservices-vision-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-cognitiveservices-vision-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-messaging-nspkg/pyproject.toml b/sdk/nspkg/azure-messaging-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-messaging-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-nspkg/pyproject.toml b/sdk/nspkg/azure-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-purview-nspkg/pyproject.toml b/sdk/nspkg/azure-purview-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-purview-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/nspkg/azure-synapse-nspkg/pyproject.toml b/sdk/nspkg/azure-synapse-nspkg/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/nspkg/azure-synapse-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/personalizer/azure-ai-personalizer/pyproject.toml b/sdk/personalizer/azure-ai-personalizer/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/personalizer/azure-ai-personalizer/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/purview/azure-purview-administration/pyproject.toml b/sdk/purview/azure-purview-administration/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/purview/azure-purview-administration/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/purview/azure-purview-catalog/pyproject.toml b/sdk/purview/azure-purview-catalog/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/purview/azure-purview-catalog/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/purview/azure-purview-scanning/pyproject.toml b/sdk/purview/azure-purview-scanning/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/purview/azure-purview-scanning/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/CHANGELOG.md b/sdk/recoveryservices/azure-mgmt-recoveryservices/CHANGELOG.md index 7de14938a5ee..3d51695097c8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/CHANGELOG.md +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.3.0 (2023-02-15) + +### Other Changes + + - Upgraded api-version to `2023-01-01` + ## 2.2.0 (2022-11-30) ### Features Added diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md b/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md index 2e016f86bd5f..fb3c66bed16b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Recovery Services](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/recoveryservices) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-recoveryservices +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservices import RecoveryServicesClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = RecoveryServicesClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Recovery Services](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json index 2e9ee7690abe..f4ab772c087b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "2f2e48923cebd95f7d184608a29bcd06d9cb3653", + "commit": "630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/recoveryservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/recoveryservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/recoveryservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py index 827e1d87a41c..142b44a06d20 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py @@ -35,14 +35,14 @@ class RecoveryServicesClientConfiguration(Configuration): # pylint: disable=too :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", "2022-10-01") + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py index 547e0df52dc6..ccba801fe7d0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py @@ -65,7 +65,7 @@ class RecoveryServicesClient( :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_serialization.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_vendor.py index 37965302deab..a5310169b7f7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_vendor.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_version.py index f30401ec2040..6398307550c1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0" +VERSION = "2.3.0" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_configuration.py index c0eab43750f8..e9a4dd8cdb57 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_configuration.py @@ -35,14 +35,14 @@ class RecoveryServicesClientConfiguration(Configuration): # pylint: disable=too :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", "2022-10-01") + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py index 6dfe6e436cdd..30f9faf70cb2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py @@ -68,7 +68,7 @@ class RecoveryServicesClient( :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py index cf465c35fbcc..cb32b7379cf3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py @@ -72,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py index 1d32873eebed..020625e53957 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py @@ -81,7 +81,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) @@ -185,7 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py index 70b691987347..b86df4f3f7d1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py @@ -70,7 +70,7 @@ async def get_operation_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) @@ -138,7 +138,7 @@ async def get_operation_result( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.Vault]] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py index a19c6227891e..5df49b809213 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py @@ -182,7 +182,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -313,7 +313,7 @@ async def capabilities( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py index d02145db902b..dc3f813f876f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py @@ -85,7 +85,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py index 9e8c6379247c..fac4ad1ccafb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py @@ -78,7 +78,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ReplicationUsageList] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py index 891e8da68de4..b8fb0db37d97 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py @@ -77,7 +77,7 @@ def list_by_vaults( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultUsageList] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py index 025186b45be3..03b720787763 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py @@ -158,7 +158,7 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py index 7ce956903b32..2920da4ee39c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py @@ -85,7 +85,7 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultExtendedInfoResource] = kwargs.pop("cls", None) @@ -218,7 +218,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -363,7 +363,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py index 97d40f76c483..2777582a5c86 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py @@ -80,7 +80,7 @@ def list_by_subscription_id(self, **kwargs: Any) -> AsyncIterable["_models.Vault _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultList] = kwargs.pop("cls", None) @@ -166,7 +166,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultList] = kwargs.pop("cls", None) @@ -263,7 +263,7 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Vault] = kwargs.pop("cls", None) @@ -315,7 +315,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -471,7 +471,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -545,7 +545,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -593,7 +593,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -747,7 +747,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py index 7382fbaf058c..0885b9abf50f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -28,7 +28,9 @@ class AzureMonitorAlertSettings(_serialization.Model): "alerts_for_all_job_failures": {"key": "alertsForAllJobFailures", "type": "str"}, } - def __init__(self, *, alerts_for_all_job_failures: Optional[Union[str, "_models.AlertsState"]] = None, **kwargs): + def __init__( + self, *, alerts_for_all_job_failures: Optional[Union[str, "_models.AlertsState"]] = None, **kwargs: Any + ) -> None: """ :keyword alerts_for_all_job_failures: Known values are: "Enabled" and "Disabled". :paramtype alerts_for_all_job_failures: str or ~azure.mgmt.recoveryservices.models.AlertsState @@ -48,7 +50,7 @@ class CapabilitiesProperties(_serialization.Model): "dns_zones": {"key": "dnsZones", "type": "[DNSZone]"}, } - def __init__(self, *, dns_zones: Optional[List["_models.DNSZone"]] = None, **kwargs): + def __init__(self, *, dns_zones: Optional[List["_models.DNSZone"]] = None, **kwargs: Any) -> None: """ :keyword dns_zones: :paramtype dns_zones: list[~azure.mgmt.recoveryservices.models.DNSZone] @@ -74,7 +76,7 @@ class ResourceCapabilitiesBase(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: str, **kwargs): + def __init__(self, *, type: str, **kwargs: Any) -> None: """ :keyword type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. Required. :paramtype type: str @@ -103,7 +105,9 @@ class CapabilitiesResponse(ResourceCapabilitiesBase): "properties": {"key": "properties", "type": "CapabilitiesResponseProperties"}, } - def __init__(self, *, type: str, properties: Optional["_models.CapabilitiesResponseProperties"] = None, **kwargs): + def __init__( + self, *, type: str, properties: Optional["_models.CapabilitiesResponseProperties"] = None, **kwargs: Any + ) -> None: """ :keyword type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. Required. :paramtype type: str @@ -125,7 +129,7 @@ class CapabilitiesResponseProperties(_serialization.Model): "dns_zones": {"key": "dnsZones", "type": "[DNSZoneResponse]"}, } - def __init__(self, *, dns_zones: Optional[List["_models.DNSZoneResponse"]] = None, **kwargs): + def __init__(self, *, dns_zones: Optional[List["_models.DNSZoneResponse"]] = None, **kwargs: Any) -> None: """ :keyword dns_zones: :paramtype dns_zones: list[~azure.mgmt.recoveryservices.models.DNSZoneResponse] @@ -145,7 +149,7 @@ class CertificateRequest(_serialization.Model): "properties": {"key": "properties", "type": "RawCertificateData"}, } - def __init__(self, *, properties: Optional["_models.RawCertificateData"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RawCertificateData"] = None, **kwargs: Any) -> None: """ :keyword properties: Raw certificate data. :paramtype properties: ~azure.mgmt.recoveryservices.models.RawCertificateData @@ -168,7 +172,7 @@ class CheckNameAvailabilityParameters(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. :paramtype type: str @@ -181,7 +185,8 @@ def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, ** class CheckNameAvailabilityResult(_serialization.Model): - """Response for check name availability API. Resource provider will set availability as true | false. + """Response for check name availability API. Resource provider will set availability as true | + false. :ivar name_available: :vartype name_available: bool @@ -203,8 +208,8 @@ def __init__( name_available: Optional[bool] = None, reason: Optional[str] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: :paramtype name_available: bool @@ -230,7 +235,9 @@ class ClassicAlertSettings(_serialization.Model): "alerts_for_critical_operations": {"key": "alertsForCriticalOperations", "type": "str"}, } - def __init__(self, *, alerts_for_critical_operations: Optional[Union[str, "_models.AlertsState"]] = None, **kwargs): + def __init__( + self, *, alerts_for_critical_operations: Optional[Union[str, "_models.AlertsState"]] = None, **kwargs: Any + ) -> None: """ :keyword alerts_for_critical_operations: Known values are: "Enabled" and "Disabled". :paramtype alerts_for_critical_operations: str or @@ -267,8 +274,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Name of the provider for display purposes. :paramtype provider: str @@ -309,8 +316,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, blob_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the log. :paramtype name: str @@ -338,8 +345,8 @@ class ClientDiscoveryForProperties(_serialization.Model): } def __init__( - self, *, service_specification: Optional["_models.ClientDiscoveryForServiceSpecification"] = None, **kwargs - ): + self, *, service_specification: Optional["_models.ClientDiscoveryForServiceSpecification"] = None, **kwargs: Any + ) -> None: """ :keyword service_specification: Operation properties. :paramtype service_specification: @@ -362,8 +369,8 @@ class ClientDiscoveryForServiceSpecification(_serialization.Model): } def __init__( - self, *, log_specifications: Optional[List["_models.ClientDiscoveryForLogSpecification"]] = None, **kwargs - ): + self, *, log_specifications: Optional[List["_models.ClientDiscoveryForLogSpecification"]] = None, **kwargs: Any + ) -> None: """ :keyword log_specifications: List of log specifications of this operation. :paramtype log_specifications: @@ -392,8 +399,8 @@ def __init__( *, value: Optional[List["_models.ClientDiscoveryValueForSingleApi"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: List of available operations. :paramtype value: list[~azure.mgmt.recoveryservices.models.ClientDiscoveryValueForSingleApi] @@ -433,8 +440,8 @@ def __init__( display: Optional["_models.ClientDiscoveryDisplay"] = None, origin: Optional[str] = None, properties: Optional["_models.ClientDiscoveryForProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the Operation. :paramtype name: str @@ -474,8 +481,8 @@ def __init__( *, use_system_assigned_identity: Optional[bool] = None, user_assigned_identity: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword use_system_assigned_identity: Indicate that system assigned identity should be used. Mutually exclusive with 'userAssignedIdentity' field. @@ -500,7 +507,7 @@ class CmkKeyVaultProperties(_serialization.Model): "key_uri": {"key": "keyUri", "type": "str"}, } - def __init__(self, *, key_uri: Optional[str] = None, **kwargs): + def __init__(self, *, key_uri: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key_uri: The key uri of the Customer Managed Key. :paramtype key_uri: str @@ -522,7 +529,9 @@ class DNSZone(_serialization.Model): "sub_resource": {"key": "subResource", "type": "str"}, } - def __init__(self, *, sub_resource: Optional[Union[str, "_models.VaultSubResourceType"]] = None, **kwargs): + def __init__( + self, *, sub_resource: Optional[Union[str, "_models.VaultSubResourceType"]] = None, **kwargs: Any + ) -> None: """ :keyword sub_resource: Subresource type for vault AzureBackup, AzureBackup_secondary or AzureSiteRecovery. Known values are: "AzureBackup", "AzureBackup_secondary", and @@ -554,8 +563,8 @@ def __init__( *, sub_resource: Optional[Union[str, "_models.VaultSubResourceType"]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sub_resource: Subresource type for vault AzureBackup, AzureBackup_secondary or AzureSiteRecovery. Known values are: "AzureBackup", "AzureBackup_secondary", and @@ -601,7 +610,7 @@ class Error(_serialization.Model): "target": {"key": "target", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.additional_info = None @@ -632,7 +641,7 @@ class ErrorAdditionalInfo(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.info = None @@ -679,8 +688,8 @@ def __init__( *, type: Union[str, "_models.ResourceIdentityType"], user_assigned_identities: Optional[Dict[str, "_models.UserIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type @@ -711,7 +720,7 @@ class ImmutabilitySettings(_serialization.Model): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: Optional[Union[str, "_models.ImmutabilityState"]] = None, **kwargs): + def __init__(self, *, state: Optional[Union[str, "_models.ImmutabilityState"]] = None, **kwargs: Any) -> None: """ :keyword state: Known values are: "Disabled", "Unlocked", and "Locked". :paramtype state: str or ~azure.mgmt.recoveryservices.models.ImmutabilityState @@ -743,8 +752,8 @@ def __init__( failed_jobs: Optional[int] = None, suspended_jobs: Optional[int] = None, in_progress_jobs: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword failed_jobs: Count of failed jobs. :paramtype failed_jobs: int @@ -779,8 +788,8 @@ def __init__( *, azure_monitor_alert_settings: Optional["_models.AzureMonitorAlertSettings"] = None, classic_alert_settings: Optional["_models.ClassicAlertSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_monitor_alert_settings: Settings for Azure Monitor based alerts. :paramtype azure_monitor_alert_settings: @@ -828,8 +837,8 @@ def __init__( deprecated_provider_count: Optional[int] = None, supported_provider_count: Optional[int] = None, unsupported_provider_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword un_healthy_vm_count: Count of unhealthy VMs. :paramtype un_healthy_vm_count: int @@ -867,7 +876,7 @@ class NameInfo(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Value of usage. :paramtype value: str @@ -916,8 +925,8 @@ def __init__( name: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword end_time: End time of the operation. :paramtype end_time: ~datetime.datetime @@ -972,7 +981,7 @@ class Resource(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Optional ETag. :paramtype etag: str @@ -1025,8 +1034,8 @@ def __init__( etag: Optional[str] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Optional ETag. :paramtype etag: str @@ -1093,8 +1102,8 @@ def __init__( properties: Optional["_models.VaultProperties"] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.IdentityData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Optional ETag. :paramtype etag: str @@ -1132,7 +1141,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1173,7 +1182,9 @@ class PrivateEndpointConnection(_serialization.Model): "group_ids": {"key": "groupIds", "type": "[str]"}, } - def __init__(self, *, group_ids: Optional[List[Union[str, "_models.VaultSubResourceType"]]] = None, **kwargs): + def __init__( + self, *, group_ids: Optional[List[Union[str, "_models.VaultSubResourceType"]]] = None, **kwargs: Any + ) -> None: """ :keyword group_ids: Group Ids for the Private Endpoint. :paramtype group_ids: list[str or ~azure.mgmt.recoveryservices.models.VaultSubResourceType] @@ -1220,7 +1231,7 @@ class PrivateEndpointConnectionVaultProperties(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1268,7 +1279,7 @@ class PrivateLinkResource(_serialization.Model): "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1294,8 +1305,12 @@ class PrivateLinkResources(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: A collection of private link resources. :paramtype value: list[~azure.mgmt.recoveryservices.models.PrivateLinkResource] @@ -1333,7 +1348,7 @@ class PrivateLinkServiceConnectionState(_serialization.Model): "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None @@ -1361,8 +1376,8 @@ def __init__( *, auth_type: Optional[Union[str, "_models.AuthType"]] = None, certificate: Optional[bytes] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword auth_type: Specifies the authentication type. Known values are: "Invalid", "ACS", "AAD", "AccessControlService", and "AzureActiveDirectory". @@ -1411,8 +1426,8 @@ def __init__( recovery_plan_count: Optional[int] = None, registered_servers_count: Optional[int] = None, recovery_services_provider_auth_type: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword monitoring_summary: Summary of the replication monitoring data for this vault. :paramtype monitoring_summary: ~azure.mgmt.recoveryservices.models.MonitoringSummary @@ -1448,7 +1463,7 @@ class ReplicationUsageList(_serialization.Model): "value": {"key": "value", "type": "[ReplicationUsage]"}, } - def __init__(self, *, value: Optional[List["_models.ReplicationUsage"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ReplicationUsage"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of replication usages for the given vault. :paramtype value: list[~azure.mgmt.recoveryservices.models.ReplicationUsage] @@ -1477,7 +1492,9 @@ class ResourceCapabilities(ResourceCapabilitiesBase): "properties": {"key": "properties", "type": "CapabilitiesProperties"}, } - def __init__(self, *, type: str, properties: Optional["_models.CapabilitiesProperties"] = None, **kwargs): + def __init__( + self, *, type: str, properties: Optional["_models.CapabilitiesProperties"] = None, **kwargs: Any + ) -> None: """ :keyword type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. Required. :paramtype type: str @@ -1551,8 +1568,8 @@ def __init__( thumbprint: Optional[str] = None, valid_from: Optional[datetime.datetime] = None, valid_to: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword certificate: The base64 encoded certificate raw data string. :paramtype certificate: bytes @@ -1669,8 +1686,8 @@ def __init__( valid_to: Optional[datetime.datetime] = None, service_resource_id: Optional[str] = None, aad_audience: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword certificate: The base64 encoded certificate raw data string. :paramtype certificate: bytes @@ -1792,8 +1809,8 @@ def __init__( thumbprint: Optional[str] = None, valid_from: Optional[datetime.datetime] = None, valid_to: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword certificate: The base64 encoded certificate raw data string. :paramtype certificate: bytes @@ -1846,7 +1863,9 @@ class SecuritySettings(_serialization.Model): "immutability_settings": {"key": "immutabilitySettings", "type": "ImmutabilitySettings"}, } - def __init__(self, *, immutability_settings: Optional["_models.ImmutabilitySettings"] = None, **kwargs): + def __init__( + self, *, immutability_settings: Optional["_models.ImmutabilitySettings"] = None, **kwargs: Any + ) -> None: """ :keyword immutability_settings: Immutability Settings of a vault. :paramtype immutability_settings: ~azure.mgmt.recoveryservices.models.ImmutabilitySettings @@ -1895,8 +1914,8 @@ def __init__( family: Optional[str] = None, size: Optional[str] = None, capacity: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of SKU is RS0 (Recovery Services 0th version) and the tier is standard tier. They do not have affect on backend storage redundancy or any other vault settings. To @@ -1957,8 +1976,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2022,7 +2041,9 @@ class TrackedResource(Resource): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, etag: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, *, location: str, etag: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: """ :keyword etag: Optional ETag. :paramtype etag: str @@ -2087,7 +2108,7 @@ class UpgradeDetails(_serialization.Model): "previous_resource_id": {"key": "previousResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.operation_id = None @@ -2122,7 +2143,7 @@ class UserIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -2189,8 +2210,8 @@ def __init__( identity: Optional["_models.IdentityData"] = None, properties: Optional["_models.VaultProperties"] = None, sku: Optional["_models.Sku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Optional ETag. :paramtype etag: str @@ -2213,7 +2234,8 @@ def __init__( class VaultCertificateResponse(_serialization.Model): - """Certificate corresponding to a vault that can be used by clients to register themselves with the vault. + """Certificate corresponding to a vault that can be used by clients to register themselves with + the vault. Variables are only populated by the server, and will be ignored when sending a request. @@ -2241,7 +2263,7 @@ class VaultCertificateResponse(_serialization.Model): "properties": {"key": "properties", "type": "ResourceCertificateDetails"}, } - def __init__(self, *, properties: Optional["_models.ResourceCertificateDetails"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ResourceCertificateDetails"] = None, **kwargs: Any) -> None: """ :keyword properties: Certificate details representing the Vault credentials. :paramtype properties: ~azure.mgmt.recoveryservices.models.ResourceCertificateDetails @@ -2302,8 +2324,8 @@ def __init__( encryption_key: Optional[str] = None, encryption_key_thumbprint: Optional[str] = None, algorithm: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Optional ETag. :paramtype etag: str @@ -2343,7 +2365,7 @@ class VaultList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Vault"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Vault"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.recoveryservices.models.Vault] @@ -2435,8 +2457,8 @@ def __init__( monitoring_settings: Optional["_models.MonitoringSettings"] = None, redundancy_settings: Optional["_models.VaultPropertiesRedundancySettings"] = None, security_settings: Optional["_models.SecuritySettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword upgrade_details: Details for upgrading vault. :paramtype upgrade_details: ~azure.mgmt.recoveryservices.models.UpgradeDetails @@ -2498,8 +2520,8 @@ def __init__( key_vault_properties: Optional["_models.CmkKeyVaultProperties"] = None, kek_identity: Optional["_models.CmkKekIdentity"] = None, infrastructure_encryption: Optional[Union[str, "_models.InfrastructureEncryptionState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: The properties of the Key Vault which hosts CMK. :paramtype key_vault_properties: ~azure.mgmt.recoveryservices.models.CmkKeyVaultProperties @@ -2549,7 +2571,7 @@ class VaultPropertiesMoveDetails(_serialization.Model): "target_resource_id": {"key": "targetResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.operation_id = None @@ -2583,7 +2605,7 @@ class VaultPropertiesRedundancySettings(_serialization.Model): "cross_region_restore": {"key": "crossRegionRestore", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.standard_tier_storage_redundancy = None @@ -2626,8 +2648,8 @@ def __init__( current_value: Optional[int] = None, limit: Optional[int] = None, name: Optional["_models.NameInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword unit: Unit of the usage. Known values are: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", and "BytesPerSecond". @@ -2663,7 +2685,7 @@ class VaultUsageList(_serialization.Model): "value": {"key": "value", "type": "[VaultUsage]"}, } - def __init__(self, *, value: Optional[List["_models.VaultUsage"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.VaultUsage"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of usages for the given vault. :paramtype value: list[~azure.mgmt.recoveryservices.models.VaultUsage] diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py index e47eb34050a1..1a2a079c034e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingle _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py index 4b4d86e2e5a1..571149d4d098 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py @@ -45,7 +45,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +144,7 @@ def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iter _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResources] = kwargs.pop("cls", None) @@ -248,7 +248,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py index 6baa3262f1b9..69082eeeb378 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py @@ -45,7 +45,7 @@ def build_get_operation_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +79,7 @@ def build_get_operation_result_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +137,7 @@ def get_operation_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) @@ -205,7 +205,7 @@ def get_operation_result( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.Vault]] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py index 4000916bf1ee..e9f1666ba798 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py @@ -45,7 +45,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -79,7 +79,7 @@ def build_capabilities_request(location: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -248,7 +248,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -379,7 +379,7 @@ def capabilities( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py index a83f6fad1167..d75c3024d045 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py @@ -44,7 +44,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -115,7 +115,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py index 8d1df4cdc90d..c7aeb69ad208 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py @@ -45,7 +45,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iter _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ReplicationUsageList] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py index b99c5dfa53c5..d3385b152ac1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py @@ -47,7 +47,7 @@ def build_list_by_vaults_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,7 @@ def list_by_vaults( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultUsageList] = kwargs.pop("cls", None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py index 964b12210d29..9bc2a59bbee3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py @@ -45,7 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +197,7 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py index 14996bbe18de..afa5f95c901c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py @@ -43,7 +43,7 @@ def build_get_request(resource_group_name: str, vault_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -110,7 +110,7 @@ def build_update_request(resource_group_name: str, vault_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,7 +184,7 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultExtendedInfoResource] = kwargs.pop("cls", None) @@ -317,7 +317,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -462,7 +462,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py index bf497b95a0c2..fbff0bff4193 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py @@ -47,7 +47,7 @@ def build_list_by_subscription_id_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,7 @@ def build_get_request(resource_group_name: str, vault_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +134,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +168,7 @@ def build_delete_request(resource_group_name: str, vault_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +199,7 @@ def build_update_request(resource_group_name: str, vault_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -260,7 +260,7 @@ def list_by_subscription_id(self, **kwargs: Any) -> Iterable["_models.Vault"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultList] = kwargs.pop("cls", None) @@ -346,7 +346,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VaultList] = kwargs.pop("cls", None) @@ -443,7 +443,7 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Vault] = kwargs.pop("cls", None) @@ -495,7 +495,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -651,7 +651,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -725,7 +725,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -773,7 +773,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -927,7 +927,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/capabilities.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/capabilities.py index 97a4634d71b9..b2f50ceafeb4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/capabilities.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/capabilities.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/Capabilities.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/Capabilities.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_available.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_available.py index 262ea8106a53..8fd38295bb07 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_available.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_available.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/CheckNameAvailability_Available.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/CheckNameAvailability_Available.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_not_available.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_not_available.py index ac81731e9ab6..34a62c5a4167 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_not_available.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/check_name_availability_not_available.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/CheckNameAvailability_NotAvailable.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/CheckNameAvailability_NotAvailable.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_registered_identities.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_registered_identities.py index 7b743323d0ff..2be299c85721 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_registered_identities.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_registered_identities.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/DeleteRegisteredIdentities.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/DeleteRegisteredIdentities.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_vault.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_vault.py index bf0357b39d15..90499ea41ed6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_vault.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/delete_vault.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/DeleteVault.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/DeleteVault.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_result.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_result.py index 936e1c205739..a8554baea804 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_result.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_result.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/GetOperationResult.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/GetOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_status.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_status.py index 359a04c1e265..72f6d0b05a26 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_status.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_operation_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/GetOperationStatus.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/GetOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_private_link_resources.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_private_link_resources.py index 0e97127d79e6..53a2432f1fc0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_private_link_resources.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_private_link_resources.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/GetPrivateLinkResources.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/GetPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault.py index f00b69c9a0c9..0b3a40daa697 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/GETVault.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/GETVault.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault_extended_info.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault_extended_info.py index f64c077c193a..d69b59c33bb2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault_extended_info.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/get_vault_extended_info.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/GETVaultExtendedInfo.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/GETVaultExtendedInfo.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_by_subscription_ids.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_by_subscription_ids.py index 8de58b5d43e9..b5e819fcf1c4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_by_subscription_ids.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_by_subscription_ids.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ListBySubscriptionIds.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/ListBySubscriptionIds.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_operations.py index af75e27c02b8..363da422d931 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ListOperations.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_private_link_resources.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_private_link_resources.py index dfee56703b1c..ced0f8461122 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_private_link_resources.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_private_link_resources.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ListPrivateLinkResources.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/ListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_replication_usages.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_replication_usages.py index 20580a6a4b1b..ed21059a28d9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_replication_usages.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_replication_usages.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ListReplicationUsages.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/ListReplicationUsages.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_resources.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_resources.py index a7e98381263d..dfa2450adb15 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_resources.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_resources.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ListResources.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/ListResources.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_usages.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_usages.py index b0bc5dcd3305..16f4b7b71da5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_usages.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/list_usages.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ListUsages.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/ListUsages.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault.py index e6fe7541c3fb..3bb340aced32 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PATCHVault.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PATCHVault.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk.py index e8933381539b..58cd3b26bb72 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PATCHVault_WithCMK.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PATCHVault_WithCMK.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk2.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk2.py index 5cf842da9913..e611cdaee339 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk2.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk2.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PatchVault_WithCMK2.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PatchVault_WithCMK2.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk3.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk3.py index d902b0ac71b4..84e286648463 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_cmk3.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PATCHVault_WithCMK3.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PATCHVault_WithCMK3.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_monitoring_settings.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_monitoring_settings.py index e758785ff218..6ce6f0f6965a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_monitoring_settings.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_monitoring_settings.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PATCHVault_WithMonitoringSettings.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PATCHVault_WithMonitoringSettings.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_user_assigned_identity.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_user_assigned_identity.py index 341095954f83..bfa59c447331 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_user_assigned_identity.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/patch_vault_with_user_assigned_identity.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PATCHVault_WithUserAssignedIdentity.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PATCHVault_WithUserAssignedIdentity.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault.py index 712492bc0190..6252962095c5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PUTVault.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PUTVault.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_cred.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_cred.py index d50903e7a2bc..839b883b4c9c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_cred.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_cred.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PUTVaultCred.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PUTVaultCred.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_cmk.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_cmk.py index 6f7b9437df8d..b65aa19af0f9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_cmk.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_cmk.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PUTVault_WithCMK.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PUTVault_WithCMK.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_monitoring_settings.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_monitoring_settings.py index 64c891a72513..be38d898a99c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_monitoring_settings.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_monitoring_settings.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PUTVault_WithMonitoringSettings.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PUTVault_WithMonitoringSettings.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_user_assigned_identity.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_user_assigned_identity.py index d1e783f3a5d1..fa7ba9f7056d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_user_assigned_identity.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/generated_samples/put_vault_with_user_assigned_identity.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/PUTVault_WithUserAssignedIdentity.json +# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/examples/PUTVault_WithUserAssignedIdentity.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md index 7b7c42ff0712..8c48261a059f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 1.3.0b1 (2023-02-16) + +### Other Changes + + - Added generated samples in github repo + - Drop support for python<3.7.0 + ## 1.2.0 (2023-01-17) ### Features Added diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md index b07c2d4625a6..c87fd19111c1 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Red Hat Openshift Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-redhatopenshift +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = AzureRedHatOpenShiftClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Red Hat Openshift Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json index f7f8e131c419..d96631b80774 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json @@ -1,11 +1,11 @@ { - "commit": "9b3aa35e75751e751070a7af1f96518cb8820e44", + "commit": "51d4c24a011e300b9713179e0515fef35bf3f678", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/redhatopenshift/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/redhatopenshift/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/redhatopenshift/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py index 3f9e70c55a41..c09f28fac6f5 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "1.3.0b1" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift4_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift4_client.py index ff16686e0b58..f9306888743e 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift4_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift4_client.py @@ -93,5 +93,5 @@ def __enter__(self) -> "AzureRedHatOpenShift4Client": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_metadata.json index fb6106d7a3e3..a3edd23de433 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_metadata.json +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_vendor.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_vendor.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_version.py index dbf4c577231c..765933bc5a68 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_version.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "1.3.0b1" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_azure_red_hat_open_shift4_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_azure_red_hat_open_shift4_client.py index ebd3b893d9c4..c53b46444a62 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_azure_red_hat_open_shift4_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_azure_red_hat_open_shift4_client.py @@ -93,5 +93,5 @@ async def __aenter__(self) -> "AzureRedHatOpenShift4Client": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_open_shift_clusters_operations.py index b4ad904b93cc..e2e32b4aefd7 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_open_shift_clusters_operations.py @@ -471,8 +471,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -819,8 +819,8 @@ async def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_models_py3.py index bea3c975f780..29935bb01f84 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_models_py3.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -39,8 +39,8 @@ def __init__( visibility: Optional[Union[str, "_models.Visibility"]] = None, url: Optional[str] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword visibility: API server visibility (immutable). Known values are: "Private" and "Public". @@ -86,8 +86,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -135,8 +135,8 @@ def __init__( domain: Optional[str] = None, version: Optional[str] = None, resource_group_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pull_secret: The pull secret for the cluster (immutable). :paramtype pull_secret: str @@ -165,7 +165,7 @@ class ConsoleProfile(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, *, url: Optional[str] = None, **kwargs): + def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword url: The URL to access the cluster console (immutable). :paramtype url: str @@ -201,8 +201,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -243,8 +243,8 @@ def __init__( name: Optional[str] = None, visibility: Optional[Union[str, "_models.Visibility"]] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The ingress profile name. Must be "default" (immutable). :paramtype name: str @@ -275,8 +275,8 @@ class MasterProfile(_serialization.Model): } def __init__( - self, *, vm_size: Optional[Union[str, "_models.VMSize"]] = None, subnet_id: Optional[str] = None, **kwargs - ): + self, *, vm_size: Optional[Union[str, "_models.VMSize"]] = None, subnet_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword vm_size: The size of the master VMs (immutable). Known values are: "Standard_D2s_v3", "Standard_D4s_v3", and "Standard_D8s_v3". @@ -303,7 +303,7 @@ class NetworkProfile(_serialization.Model): "service_cidr": {"key": "serviceCidr", "type": "str"}, } - def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs): + def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs: Any) -> None: """ :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods (immutable). :paramtype pod_cidr: str @@ -342,7 +342,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -351,7 +351,8 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -386,7 +387,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -478,8 +479,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -534,7 +535,9 @@ class OpenShiftClusterCredentials(_serialization.Model): "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, } - def __init__(self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs): + def __init__( + self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword kubeadmin_username: The username for the kubeadmin user. :paramtype kubeadmin_username: str @@ -561,8 +564,12 @@ class OpenShiftClusterList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OpenShiftCluster"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.OpenShiftCluster"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of OpenShift clusters. :paramtype value: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] @@ -628,8 +635,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] @@ -693,8 +700,8 @@ def __init__( name: Optional[str] = None, display: Optional["_models.Display"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -724,7 +731,9 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.Operation] @@ -750,7 +759,7 @@ class ServicePrincipalProfile(_serialization.Model): "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs): + def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_id: The client ID used for the cluster (immutable). :paramtype client_id: str @@ -794,8 +803,8 @@ def __init__( disk_size_gb: Optional[int] = None, subnet_id: Optional[str] = None, count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The worker profile name. Must be "worker" (immutable). :paramtype name: str diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_open_shift_clusters_operations.py index ac69317be703..9804903e5ede 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_open_shift_clusters_operations.py @@ -688,8 +688,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1036,8 +1036,8 @@ def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_azure_red_hat_open_shift_client.py index 32280205eef8..e38a28be6f8c 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_azure_red_hat_open_shift_client.py @@ -93,5 +93,5 @@ def __enter__(self) -> "AzureRedHatOpenShiftClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_metadata.json index b51acb84d1da..67feb7836386 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_metadata.json +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_vendor.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_vendor.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_version.py index dbf4c577231c..765933bc5a68 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_version.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "1.3.0b1" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_azure_red_hat_open_shift_client.py index e9f2b875259e..d1728e3a4a9f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_azure_red_hat_open_shift_client.py @@ -93,5 +93,5 @@ async def __aenter__(self) -> "AzureRedHatOpenShiftClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_open_shift_clusters_operations.py index 5b31236288f6..bc98efd2a2de 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_open_shift_clusters_operations.py @@ -480,8 +480,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -836,8 +836,8 @@ async def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_models_py3.py index 74d21d348962..d4f96278fa47 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_models_py3.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -40,8 +40,8 @@ def __init__( visibility: Optional[Union[str, "_models.Visibility"]] = None, url: Optional[str] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword visibility: API server visibility. Known values are: "Private" and "Public". :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Visibility @@ -86,8 +86,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -135,8 +135,8 @@ def __init__( domain: Optional[str] = None, version: Optional[str] = None, resource_group_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pull_secret: The pull secret for the cluster. :paramtype pull_secret: str @@ -165,7 +165,7 @@ class ConsoleProfile(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, *, url: Optional[str] = None, **kwargs): + def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword url: The URL to access the cluster console. :paramtype url: str @@ -201,8 +201,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -243,8 +243,8 @@ def __init__( name: Optional[str] = None, visibility: Optional[Union[str, "_models.Visibility"]] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The ingress profile name. :paramtype name: str @@ -295,8 +295,8 @@ def __init__( subnet_id: Optional[str] = None, encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, disk_encryption_set_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword vm_size: The size of the master VMs. Known values are: "Standard_D16as_v4", "Standard_D16s_v3", "Standard_D2s_v3", "Standard_D32as_v4", "Standard_D32s_v3", @@ -348,8 +348,8 @@ def __init__( software_defined_network: Optional[Union[str, "_models.SoftwareDefinedNetwork"]] = None, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword software_defined_network: The software defined network (SDN) to use when installing the cluster. Known values are: "OVNKubernetes" and "OpenShiftSDN". @@ -393,7 +393,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -402,7 +402,8 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -437,7 +438,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -536,8 +537,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -595,7 +596,7 @@ class OpenShiftClusterAdminKubeconfig(_serialization.Model): "kubeconfig": {"key": "kubeconfig", "type": "str"}, } - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs): + def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kubeconfig: The base64-encoded kubeconfig file. :paramtype kubeconfig: str @@ -618,7 +619,9 @@ class OpenShiftClusterCredentials(_serialization.Model): "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, } - def __init__(self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs): + def __init__( + self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword kubeadmin_username: The username for the kubeadmin user. :paramtype kubeadmin_username: str @@ -645,8 +648,12 @@ class OpenShiftClusterList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OpenShiftCluster"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.OpenShiftCluster"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of OpenShift clusters. :paramtype value: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] @@ -724,8 +731,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] @@ -795,8 +802,8 @@ def __init__( name: Optional[str] = None, display: Optional["_models.Display"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -826,7 +833,9 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Operation] @@ -852,7 +861,7 @@ class ServicePrincipalProfile(_serialization.Model): "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs): + def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_id: The client ID used for the cluster. :paramtype client_id: str @@ -903,8 +912,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -980,8 +989,8 @@ def __init__( count: Optional[int] = None, encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, disk_encryption_set_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The worker profile name. :paramtype name: str diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_open_shift_clusters_operations.py index 441fe89f88ef..9e1b434f4ec9 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_open_shift_clusters_operations.py @@ -745,8 +745,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1101,8 +1101,8 @@ def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_azure_red_hat_open_shift_client.py index 256ff2ea48b0..715b2b2cc7f8 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_azure_red_hat_open_shift_client.py @@ -93,5 +93,5 @@ def __enter__(self) -> "AzureRedHatOpenShiftClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_metadata.json index fe5b08d9dfa2..13a3fba8dff2 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_metadata.json +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_vendor.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_vendor.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_version.py index dbf4c577231c..765933bc5a68 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_version.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "1.3.0b1" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_azure_red_hat_open_shift_client.py index 4eb2897f23e7..02b42f3d011d 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_azure_red_hat_open_shift_client.py @@ -93,5 +93,5 @@ async def __aenter__(self) -> "AzureRedHatOpenShiftClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_open_shift_clusters_operations.py index 5ce8eea53035..4d918ed9244d 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_open_shift_clusters_operations.py @@ -472,8 +472,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -820,8 +820,8 @@ async def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_models_py3.py index ce32314b4dd3..a1fa3b24665a 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_models_py3.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -40,8 +40,8 @@ def __init__( visibility: Optional[Union[str, "_models.Visibility"]] = None, url: Optional[str] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword visibility: API server visibility. Known values are: "Private" and "Public". :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_04_01.models.Visibility @@ -86,8 +86,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -141,8 +141,8 @@ def __init__( version: Optional[str] = None, resource_group_id: Optional[str] = None, fips_validated_modules: Optional[Union[str, "_models.FipsValidatedModules"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pull_secret: The pull secret for the cluster. :paramtype pull_secret: str @@ -176,7 +176,7 @@ class ConsoleProfile(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, *, url: Optional[str] = None, **kwargs): + def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword url: The URL to access the cluster console. :paramtype url: str @@ -212,8 +212,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -254,8 +254,8 @@ def __init__( name: Optional[str] = None, visibility: Optional[Union[str, "_models.Visibility"]] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The ingress profile name. :paramtype name: str @@ -300,8 +300,8 @@ def __init__( subnet_id: Optional[str] = None, encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, disk_encryption_set_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword vm_size: The size of the master VMs. :paramtype vm_size: str @@ -336,7 +336,7 @@ class NetworkProfile(_serialization.Model): "service_cidr": {"key": "serviceCidr", "type": "str"}, } - def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs): + def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs: Any) -> None: """ :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. :paramtype pod_cidr: str @@ -375,7 +375,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -384,7 +384,8 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -419,7 +420,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -515,8 +516,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -569,7 +570,7 @@ class OpenShiftClusterAdminKubeconfig(_serialization.Model): "kubeconfig": {"key": "kubeconfig", "type": "str"}, } - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs): + def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kubeconfig: The base64-encoded kubeconfig file. :paramtype kubeconfig: str @@ -592,7 +593,9 @@ class OpenShiftClusterCredentials(_serialization.Model): "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, } - def __init__(self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs): + def __init__( + self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword kubeadmin_username: The username for the kubeadmin user. :paramtype kubeadmin_username: str @@ -619,8 +622,12 @@ class OpenShiftClusterList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OpenShiftCluster"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.OpenShiftCluster"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of OpenShift clusters. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] @@ -695,8 +702,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] @@ -761,8 +768,8 @@ def __init__( name: Optional[str] = None, display: Optional["_models.Display"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -792,7 +799,9 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.Operation] @@ -818,7 +827,7 @@ class ServicePrincipalProfile(_serialization.Model): "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs): + def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_id: The client ID used for the cluster. :paramtype client_id: str @@ -868,8 +877,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -938,8 +947,8 @@ def __init__( count: Optional[int] = None, encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, disk_encryption_set_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The worker profile name. :paramtype name: str diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_open_shift_clusters_operations.py index dbaf7f51a867..5270ee95f68f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_open_shift_clusters_operations.py @@ -721,8 +721,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1069,8 +1069,8 @@ def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_azure_red_hat_open_shift_client.py index e6f07110b101..2c78f916c6ef 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_azure_red_hat_open_shift_client.py @@ -123,5 +123,5 @@ def __enter__(self) -> "AzureRedHatOpenShiftClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_metadata.json index cd6626c22759..8159de66e6c2 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_metadata.json +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_vendor.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_vendor.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_version.py index dbf4c577231c..765933bc5a68 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_version.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "1.3.0b1" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_azure_red_hat_open_shift_client.py index 9fd2094b8037..0d0f5f648745 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_azure_red_hat_open_shift_client.py @@ -123,5 +123,5 @@ async def __aenter__(self) -> "AzureRedHatOpenShiftClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_machine_pools_operations.py index ed59673c6198..ce254fb2241e 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_machine_pools_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_machine_pools_operations.py @@ -312,7 +312,8 @@ async def create_or_update( :type resource_name: str :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a model type or a IO type. Required. + :param parameters: The MachinePool resource. Is either a MachinePool type or a IO type. + Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -536,7 +537,8 @@ async def update( :type resource_name: str :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a model type or a IO type. Required. + :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO type. + Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_clusters_operations.py index a57b0ce125b2..6bf8809dd54c 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_clusters_operations.py @@ -472,8 +472,8 @@ async def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -820,8 +820,8 @@ async def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_secrets_operations.py index af9e527f7af2..5264064502b5 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_secrets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_secrets_operations.py @@ -309,7 +309,7 @@ async def create_or_update( :type resource_name: str :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str - :param parameters: The Secret resource. Is either a model type or a IO type. Required. + :param parameters: The Secret resource. Is either a Secret type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -533,7 +533,7 @@ async def update( :type resource_name: str :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str - :param parameters: The Secret resource. Is either a model type or a IO type. Required. + :param parameters: The Secret resource. Is either a SecretUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_identity_providers_operations.py index cc03a66a7d1e..625bcf487413 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_identity_providers_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_identity_providers_operations.py @@ -315,8 +315,8 @@ async def create_or_update( :type resource_name: str :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a model type or a IO type. - Required. + :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or + a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -544,8 +544,8 @@ async def update( :type resource_name: str :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a model type or a IO type. - Required. + :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_sets_operations.py index ba86d9ddad78..fb673f3b83ef 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_sets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_sets_operations.py @@ -309,7 +309,7 @@ async def create_or_update( :type resource_name: str :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a model type or a IO type. Required. + :param parameters: The SyncSet resource. Is either a SyncSet type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -533,7 +533,7 @@ async def update( :type resource_name: str :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a model type or a IO type. Required. + :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_models_py3.py index 46ce95dc0e19..1a315077417e 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_models_py3.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -40,8 +40,8 @@ def __init__( visibility: Optional[Union[str, "_models.Visibility"]] = None, url: Optional[str] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword visibility: API server visibility. Known values are: "Private" and "Public". :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility @@ -86,8 +86,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -141,8 +141,8 @@ def __init__( version: Optional[str] = None, resource_group_id: Optional[str] = None, fips_validated_modules: Optional[Union[str, "_models.FipsValidatedModules"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pull_secret: The pull secret for the cluster. :paramtype pull_secret: str @@ -176,7 +176,7 @@ class ConsoleProfile(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, *, url: Optional[str] = None, **kwargs): + def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword url: The URL to access the cluster console. :paramtype url: str @@ -212,8 +212,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -254,8 +254,8 @@ def __init__( name: Optional[str] = None, visibility: Optional[Union[str, "_models.Visibility"]] = None, ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The ingress profile name. :paramtype name: str @@ -302,7 +302,7 @@ class Resource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -312,7 +312,8 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -343,7 +344,7 @@ class ProxyResource(Resource): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -383,7 +384,7 @@ class MachinePool(ProxyResource): "resources": {"key": "properties.resources", "type": "str"}, } - def __init__(self, *, resources: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: :paramtype resources: str @@ -407,8 +408,8 @@ class MachinePoolList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.MachinePool"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.MachinePool"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of Machine Pools. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] @@ -440,7 +441,7 @@ class MachinePoolUpdate(_serialization.Model): "resources": {"key": "properties.resources", "type": "str"}, } - def __init__(self, *, resources: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: :paramtype resources: str @@ -480,8 +481,8 @@ def __init__( subnet_id: Optional[str] = None, encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, disk_encryption_set_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword vm_size: The size of the master VMs. :paramtype vm_size: str @@ -516,7 +517,7 @@ class NetworkProfile(_serialization.Model): "service_cidr": {"key": "serviceCidr", "type": "str"}, } - def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs): + def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs: Any) -> None: """ :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. :paramtype pod_cidr: str @@ -529,7 +530,8 @@ def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -569,7 +571,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -666,8 +668,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -719,7 +721,7 @@ class OpenShiftClusterAdminKubeconfig(_serialization.Model): "kubeconfig": {"key": "kubeconfig", "type": "str"}, } - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs): + def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kubeconfig: The base64-encoded kubeconfig file. :paramtype kubeconfig: str @@ -742,7 +744,9 @@ class OpenShiftClusterCredentials(_serialization.Model): "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, } - def __init__(self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs): + def __init__( + self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword kubeadmin_username: The username for the kubeadmin user. :paramtype kubeadmin_username: str @@ -769,8 +773,12 @@ class OpenShiftClusterList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OpenShiftCluster"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.OpenShiftCluster"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of OpenShift clusters. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] @@ -845,8 +853,8 @@ def __init__( worker_profiles: Optional[List["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] @@ -922,7 +930,7 @@ class OpenShiftVersion(ProxyResource): "version": {"key": "properties.version", "type": "str"}, } - def __init__(self, *, version: Optional[str] = None, **kwargs): + def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword version: Version represents the version to create the cluster at. :paramtype version: str @@ -946,8 +954,12 @@ class OpenShiftVersionList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OpenShiftVersion"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.OpenShiftVersion"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The List of available versions. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] @@ -983,8 +995,8 @@ def __init__( name: Optional[str] = None, display: Optional["_models.Display"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1014,7 +1026,9 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Operation] @@ -1061,7 +1075,7 @@ class Secret(ProxyResource): "secret_resources": {"key": "properties.secretResources", "type": "str"}, } - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs): + def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword secret_resources: The Secrets Resources. :paramtype secret_resources: str @@ -1084,7 +1098,9 @@ class SecretList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of secrets. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] @@ -1116,7 +1132,7 @@ class SecretUpdate(_serialization.Model): "secret_resources": {"key": "properties.secretResources", "type": "str"}, } - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs): + def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword secret_resources: The Secrets Resources. :paramtype secret_resources: str @@ -1140,7 +1156,7 @@ class ServicePrincipalProfile(_serialization.Model): "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs): + def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_id: The client ID used for the cluster. :paramtype client_id: str @@ -1187,7 +1203,7 @@ class SyncIdentityProvider(ProxyResource): "resources": {"key": "properties.resources", "type": "str"}, } - def __init__(self, *, resources: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: :paramtype resources: str @@ -1211,8 +1227,12 @@ class SyncIdentityProviderList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SyncIdentityProvider"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.SyncIdentityProvider"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of sync identity providers. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] @@ -1244,7 +1264,7 @@ class SyncIdentityProviderUpdate(_serialization.Model): "resources": {"key": "properties.resources", "type": "str"}, } - def __init__(self, *, resources: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: :paramtype resources: str @@ -1289,7 +1309,7 @@ class SyncSet(ProxyResource): "resources": {"key": "properties.resources", "type": "str"}, } - def __init__(self, *, resources: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: Resources represents the SyncSets configuration. :paramtype resources: str @@ -1312,7 +1332,9 @@ class SyncSetList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SyncSet"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SyncSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of syncsets. :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] @@ -1344,7 +1366,7 @@ class SyncSetUpdate(_serialization.Model): "resources": {"key": "properties.resources", "type": "str"}, } - def __init__(self, *, resources: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: Resources represents the SyncSets configuration. :paramtype resources: str @@ -1392,8 +1414,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1462,8 +1484,8 @@ def __init__( count: Optional[int] = None, encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, disk_encryption_set_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The worker profile name. :paramtype name: str diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_machine_pools_operations.py index 79a3e89c7697..df306fa6095f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_machine_pools_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_machine_pools_operations.py @@ -546,7 +546,8 @@ def create_or_update( :type resource_name: str :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a model type or a IO type. Required. + :param parameters: The MachinePool resource. Is either a MachinePool type or a IO type. + Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -770,7 +771,8 @@ def update( :type resource_name: str :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a model type or a IO type. Required. + :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO type. + Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_clusters_operations.py index 0404aec7b180..0b70f40ff467 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_clusters_operations.py @@ -721,8 +721,8 @@ def begin_create_or_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO + type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1069,8 +1069,8 @@ def begin_update( :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a model type or a IO type. - Required. + :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_secrets_operations.py index 1c94c58d08d4..acf7803f66a0 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_secrets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_secrets_operations.py @@ -542,7 +542,7 @@ def create_or_update( :type resource_name: str :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str - :param parameters: The Secret resource. Is either a model type or a IO type. Required. + :param parameters: The Secret resource. Is either a Secret type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -766,7 +766,7 @@ def update( :type resource_name: str :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str - :param parameters: The Secret resource. Is either a model type or a IO type. Required. + :param parameters: The Secret resource. Is either a SecretUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_identity_providers_operations.py index 329e234af7ba..79e1397c17ac 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_identity_providers_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_identity_providers_operations.py @@ -549,8 +549,8 @@ def create_or_update( :type resource_name: str :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a model type or a IO type. - Required. + :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or + a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -778,8 +778,8 @@ def update( :type resource_name: str :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a model type or a IO type. - Required. + :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_sets_operations.py index 3aa40fcee155..38fc2c400242 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_sets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_sets_operations.py @@ -542,7 +542,7 @@ def create_or_update( :type resource_name: str :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a model type or a IO type. Required. + :param parameters: The SyncSet resource. Is either a SyncSet type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -766,7 +766,7 @@ def update( :type resource_name: str :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a model type or a IO type. Required. + :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py new file mode 100644 index 000000000000..8a63ff925615 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python machine_pools_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.machine_pools.create_or_update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={ + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/MachinePools_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_delete.py new file mode 100644 index 000000000000..f35222669806 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python machine_pools_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.machine_pools.delete( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/MachinePools_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_get.py new file mode 100644 index 000000000000..341955164ec2 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python machine_pools_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.machine_pools.get( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/MachinePools_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_list.py new file mode 100644 index 000000000000..9d6a860e9ce6 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python machine_pools_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.machine_pools.list( + resource_group_name="resourceGroup", + resource_name="resourceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/MachinePools_List.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py new file mode 100644 index 000000000000..6c22139b29f8 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python machine_pools_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.machine_pools.update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={ + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/MachinePools_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_create_or_update.py new file mode 100644 index 000000000000..8160546339f7 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_create_or_update.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.begin_create_or_update( + resource_group_name="resourceGroup", + resource_name="resourceName", + parameters={ + "location": "location", + "properties": { + "apiserverProfile": {"visibility": "Public"}, + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "fipsValidatedModules": "Enabled", + "pullSecret": '{"auths":{"registry.connect.redhat.com":{"auth":""},"registry.redhat.io":{"auth":""}}}', + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup", + }, + "consoleProfile": {}, + "ingressProfiles": [{"name": "default", "visibility": "Public"}], + "masterProfile": { + "encryptionAtHost": "Enabled", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", + "vmSize": "Standard_D8s_v3", + }, + "networkProfile": {"podCidr": "10.128.0.0/14", "serviceCidr": "172.30.0.0/16"}, + "servicePrincipalProfile": {"clientId": "clientId", "clientSecret": "clientSecret"}, + "workerProfiles": [ + { + "count": 3, + "diskSizeGB": 128, + "name": "worker", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "vmSize": "Standard_D2s_v3", + } + ], + }, + "tags": {"key": "value"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_delete.py new file mode 100644 index 000000000000..1dfd9e88f969 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.begin_delete( + resource_group_name="resourceGroup", + resource_name="resourceName", + ).result() + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_get.py new file mode 100644 index 000000000000..7f58062c44e6 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.get( + resource_group_name="resourceGroup", + resource_name="resourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list.py new file mode 100644 index 000000000000..0755d37ba76f --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_List.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_admin_credentials.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_admin_credentials.py new file mode 100644 index 000000000000..e6834641544f --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_admin_credentials.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_list_admin_credentials.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.list_admin_credentials( + resource_group_name="resourceGroup", + resource_name="resourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_ListAdminCredentials.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_by_resource_group.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_by_resource_group.py new file mode 100644 index 000000000000..9538ba3561e9 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.list_by_resource_group( + resource_group_name="resourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_credentials.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_credentials.py new file mode 100644 index 000000000000..7825ec9d79f4 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_credentials.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_list_credentials.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.list_credentials( + resource_group_name="resourceGroup", + resource_name="resourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_ListCredentials.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_update.py new file mode 100644 index 000000000000..0a1034bad2eb --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_update.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_clusters_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_clusters.begin_update( + resource_group_name="resourceGroup", + resource_name="resourceName", + parameters={ + "properties": { + "apiserverProfile": {"visibility": "Public"}, + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "fipsValidatedModules": "Enabled", + "pullSecret": '{"auths":{"registry.connect.redhat.com":{"auth":""},"registry.redhat.io":{"auth":""}}}', + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup", + }, + "consoleProfile": {}, + "ingressProfiles": [{"name": "default", "visibility": "Public"}], + "masterProfile": { + "encryptionAtHost": "Enabled", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", + "vmSize": "Standard_D8s_v3", + }, + "networkProfile": {"podCidr": "10.128.0.0/14", "serviceCidr": "172.30.0.0/16"}, + "servicePrincipalProfile": {"clientId": "clientId", "clientSecret": "clientSecret"}, + "workerProfiles": [ + { + "count": 3, + "diskSizeGB": 128, + "name": "worker", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "vmSize": "Standard_D2s_v3", + } + ], + }, + "tags": {"key": "value"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftClusters_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_list.py new file mode 100644 index 000000000000..9942e1e29764 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_list.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python open_shift_versions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.open_shift_versions.list( + location="location", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/OpenShiftVersions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/operations_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/operations_list.py new file mode 100644 index 000000000000..5357e7890b05 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py new file mode 100644 index 000000000000..77c087b3ed93 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python secrets_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.secrets.create_or_update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={"properties": {}}, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/Secrets_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_delete.py new file mode 100644 index 000000000000..e59a52e8ab21 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python secrets_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.secrets.delete( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/Secrets_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_get.py new file mode 100644 index 000000000000..d180940ba5e2 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python secrets_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.secrets.get( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/Secrets_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_list.py new file mode 100644 index 000000000000..d41b0681e7d0 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python secrets_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.secrets.list( + resource_group_name="resourceGroup", + resource_name="resourceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/Secrets_List.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py new file mode 100644 index 000000000000..1f59d5831f8c --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python secrets_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.secrets.update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={"properties": {}}, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/Secrets_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py new file mode 100644 index 000000000000..3160f4ed5bfe --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_identity_providers_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_identity_providers.create_or_update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={ + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncIdentityProviders_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_delete.py new file mode 100644 index 000000000000..e14797516aa4 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_identity_providers_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_identity_providers.delete( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncIdentityProviders_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_get.py new file mode 100644 index 000000000000..b22a6a724627 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_identity_providers_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_identity_providers.get( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncIdentityProviders_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_list.py new file mode 100644 index 000000000000..473eaa22405f --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_identity_providers_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_identity_providers.list( + resource_group_name="resourceGroup", + resource_name="resourceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncIdentityProviders_List.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py new file mode 100644 index 000000000000..b004280cff91 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_identity_providers_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_identity_providers.update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={ + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncIdentityProviders_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py new file mode 100644 index 000000000000..8c279e01ca85 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_sets_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_sets.create_or_update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={ + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncSets_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_delete.py new file mode 100644 index 000000000000..c93df8489a26 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_sets_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_sets.delete( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncSets_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_get.py new file mode 100644 index 000000000000..80fcf50e6966 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_sets_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_sets.get( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncSets_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_list.py new file mode 100644 index 000000000000..6759208ec368 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_sets_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_sets.list( + resource_group_name="resourceGroup", + resource_name="resourceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncSets_List.json +if __name__ == "__main__": + main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py new file mode 100644 index 000000000000..e0f2de2b2516 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-redhatopenshift +# USAGE + python sync_sets_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureRedHatOpenShiftClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.sync_sets.update( + resource_group_name="resourceGroup", + resource_name="resourceName", + child_resource_name="childResourceName", + parameters={ + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/examples/SyncSets_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml b/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/reservations/azure-mgmt-reservations/CHANGELOG.md b/sdk/reservations/azure-mgmt-reservations/CHANGELOG.md index e2dc54e01f53..db8cae415a82 100644 --- a/sdk/reservations/azure-mgmt-reservations/CHANGELOG.md +++ b/sdk/reservations/azure-mgmt-reservations/CHANGELOG.md @@ -1,5 +1,33 @@ # Release History +## 2.2.0 (2023-02-15) + +### Features Added + + - Model CalculateExchangeRequestProperties has a new parameter savings_plans_to_purchase + - Model CalculateExchangeResponseProperties has a new parameter savings_plans_to_purchase + - Model ExchangeResponseProperties has a new parameter savings_plans_to_purchase + - Model Patch has a new parameter applied_scope_properties + - Model Patch has a new parameter review_date_time + - Model PurchaseRequest has a new parameter applied_scope_properties + - Model PurchaseRequest has a new parameter review_date_time + - Model ReservationOrderResponse has a new parameter expiry_date_time + - Model ReservationOrderResponse has a new parameter review_date_time + - Model ReservationSummary has a new parameter no_benefit_count + - Model ReservationSummary has a new parameter warning_count + - Model ReservationsProperties has a new parameter applied_scope_properties + - Model ReservationsProperties has a new parameter expiry_date_time + - Model ReservationsProperties has a new parameter purchase_date_time + - Model ReservationsProperties has a new parameter review_date_time + - Model ReservationsProperties has a new parameter swap_properties + - Operation AzureReservationAPIOperationsMixin.get_catalog has a new optional parameter filter + - Operation AzureReservationAPIOperationsMixin.get_catalog has a new optional parameter skip + - Operation AzureReservationAPIOperationsMixin.get_catalog has a new optional parameter take + +### Breaking Changes + + - Renamed operation ReturnOperations.post to ReturnOperations.begin_post + ## 2.2.0b1 (2022-12-27) ### Features Added diff --git a/sdk/reservations/azure-mgmt-reservations/README.md b/sdk/reservations/azure-mgmt-reservations/README.md index 49a70885a8f8..ba164159967b 100644 --- a/sdk/reservations/azure-mgmt-reservations/README.md +++ b/sdk/reservations/azure-mgmt-reservations/README.md @@ -28,7 +28,7 @@ By default, [Azure Active Directory](https://aka.ms/awps/aad) token authenticati - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +- `AZURE_CLIENT_SECRET` for Azure client secret. In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. diff --git a/sdk/reservations/azure-mgmt-reservations/_meta.json b/sdk/reservations/azure-mgmt-reservations/_meta.json index 4d9514cc5393..484ec4c5386d 100644 --- a/sdk/reservations/azure-mgmt-reservations/_meta.json +++ b/sdk/reservations/azure-mgmt-reservations/_meta.json @@ -1,11 +1,11 @@ { - "commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c", + "commit": "3751704f5318f1175875c94b66af769db917f2d3", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/reservations/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/reservations/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/reservations/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_serialization.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_serialization.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_vendor.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_vendor.py index c5bb55a49a2b..9123ccb875bc 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_vendor.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py index 67a252e2565e..f30401ec2040 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0b1" +VERSION = "2.2.0" diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py index 2374bf3143b0..b695c4fd9e73 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py @@ -7,8 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -20,6 +21,7 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -41,8 +43,8 @@ class AzureReservationAPIOperationsMixin(AzureReservationAPIMixinABC): - @distributed_trace_async - async def get_catalog( + @distributed_trace + def get_catalog( self, subscription_id: str, reserved_resource_type: Optional[str] = None, @@ -50,8 +52,11 @@ async def get_catalog( publisher_id: Optional[str] = None, offer_id: Optional[str] = None, plan_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[float] = None, + take: Optional[float] = None, **kwargs: Any - ) -> List[_models.Catalog]: + ) -> AsyncIterable["_models.Catalog"]: """Get the regions and skus that are available for RI purchase for the specified Azure subscription. @@ -64,7 +69,7 @@ async def get_catalog( Default value is None. :type reserved_resource_type: str :param location: Filters the skus based on the location specified in this parameter. This can - be an azure region or global. Default value is None. + be an Azure region or global. Default value is None. :type location: str :param publisher_id: Publisher id used to get the third party products. Default value is None. :type publisher_id: str @@ -72,11 +77,25 @@ async def get_catalog( :type offer_id: str :param plan_id: Plan id used to get the third party products. Default value is None. :type plan_id: str + :param filter: May be used to filter by Catalog properties. The filter supports 'eq', 'or', and + 'and'. Default value is None. + :type filter: str + :param skip: The number of reservations to skip from the list before returning results. Default + value is None. + :type skip: float + :param take: To number of reservations to return. Default value is None. + :type take: float :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Catalog or the result of cls(response) - :rtype: list[~azure.mgmt.reservations.models.Catalog] + :return: An iterator like instance of either Catalog or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + cls: ClsType[_models.CatalogsResult] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -85,44 +104,57 @@ async def get_catalog( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) - cls: ClsType[List[_models.Catalog]] = kwargs.pop("cls", None) - - request = build_get_catalog_request( - subscription_id=subscription_id, - reserved_resource_type=reserved_resource_type, - location=location, - publisher_id=publisher_id, - offer_id=offer_id, - plan_id=plan_id, - api_version=api_version, - template_url=self.get_catalog.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[Catalog]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + def prepare_request(next_link=None): + if not next_link: + + request = build_get_catalog_request( + subscription_id=subscription_id, + reserved_resource_type=reserved_resource_type, + location=location, + publisher_id=publisher_id, + offer_id=offer_id, + plan_id=plan_id, + filter=filter, + skip=skip, + take=take, + api_version=api_version, + template_url=self.get_catalog.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CatalogsResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) get_catalog.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs"} @@ -151,7 +183,7 @@ async def get_applied_reservation_list(self, subscription_id: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.AppliedReservations] = kwargs.pop("cls", None) request = build_get_applied_reservation_list_request( diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py index 4e2de954214e..8bbacc2ec04e 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py @@ -72,7 +72,7 @@ async def _post_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.CalculateExchangeOperationResultResponse]] = kwargs.pop("cls", None) @@ -213,7 +213,7 @@ async def begin_post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CalculateExchangeOperationResultResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py index 320e903f5b1b..25409ef2cf3c 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py @@ -135,7 +135,7 @@ async def post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CalculateRefundResponse] = kwargs.pop("cls", None) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py index c1ed17a88816..8d714f8a0988 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py @@ -72,7 +72,7 @@ async def _post_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ExchangeOperationResultResponse]] = kwargs.pop("cls", None) @@ -213,7 +213,7 @@ async def begin_post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExchangeOperationResultResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py index f4210f7aa582..10336203e255 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py @@ -72,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResponse"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py index b21514c4f488..c17b51d91b23 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py @@ -226,7 +226,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[AsyncLROPoller[_models.CurrentQuotaLimitBase], AsyncLROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> AsyncLROPoller[_models.CurrentQuotaLimitBase]: """Create or update the quota (service limits) of a resource to the requested value. Steps: @@ -280,7 +280,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[AsyncLROPoller[_models.CurrentQuotaLimitBase], AsyncLROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> AsyncLROPoller[_models.CurrentQuotaLimitBase]: """Create or update the quota (service limits) of a resource to the requested value. Steps: @@ -332,7 +332,7 @@ async def begin_create_or_update( resource_name: str, create_quota_request: Union[_models.CurrentQuotaLimitBase, IO], **kwargs: Any - ) -> Union[AsyncLROPoller[_models.CurrentQuotaLimitBase], AsyncLROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> AsyncLROPoller[_models.CurrentQuotaLimitBase]: """Create or update the quota (service limits) of a resource to the requested value. Steps: @@ -515,7 +515,7 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[AsyncLROPoller[_models.CurrentQuotaLimitBase], AsyncLROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> AsyncLROPoller[_models.CurrentQuotaLimitBase]: """Update the quota (service limits) of this resource to the requested value. • To get the quota information for specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a new value. @@ -566,7 +566,7 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[AsyncLROPoller[_models.CurrentQuotaLimitBase], AsyncLROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> AsyncLROPoller[_models.CurrentQuotaLimitBase]: """Update the quota (service limits) of this resource to the requested value. • To get the quota information for specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a new value. @@ -615,7 +615,7 @@ async def begin_update( resource_name: str, create_quota_request: Union[_models.CurrentQuotaLimitBase, IO], **kwargs: Any - ) -> Union[AsyncLROPoller[_models.CurrentQuotaLimitBase], AsyncLROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> AsyncLROPoller[_models.CurrentQuotaLimitBase]: """Update the quota (service limits) of this resource to the requested value. • To get the quota information for specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a new value. diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py index 3c502a570f92..5bf8999c8b60 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py @@ -89,7 +89,7 @@ async def _available_scopes_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableScopeProperties] = kwargs.pop("cls", None) @@ -149,13 +149,13 @@ async def begin_available_scopes( ) -> AsyncLROPoller[_models.AvailableScopeProperties]: """Get Available Scopes for ``Reservation``. - Get Available Scopes for ``Reservation``. + Check whether the scopes from request is valid for ``Reservation``. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Required. + :param body: Scopes to be checked for eligibility. Required. :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -187,13 +187,13 @@ async def begin_available_scopes( ) -> AsyncLROPoller[_models.AvailableScopeProperties]: """Get Available Scopes for ``Reservation``. - Get Available Scopes for ``Reservation``. + Check whether the scopes from request is valid for ``Reservation``. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Required. + :param body: Scopes to be checked for eligibility. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -223,13 +223,14 @@ async def begin_available_scopes( ) -> AsyncLROPoller[_models.AvailableScopeProperties]: """Get Available Scopes for ``Reservation``. - Get Available Scopes for ``Reservation``. + Check whether the scopes from request is valid for ``Reservation``. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Is either a model type or a IO type. Required. + :param body: Scopes to be checked for eligibility. Is either a model type or a IO type. + Required. :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -251,7 +252,7 @@ async def begin_available_scopes( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableScopeProperties] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -310,7 +311,7 @@ async def _split_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[List[_models.ReservationResponse]]] = kwargs.pop("cls", None) @@ -347,11 +348,16 @@ async def _split_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("[ReservationResponse]", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -455,7 +461,7 @@ async def begin_split( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ReservationResponse]] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -513,7 +519,7 @@ async def _merge_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[List[_models.ReservationResponse]]] = kwargs.pop("cls", None) @@ -550,11 +556,16 @@ async def _merge_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("[ReservationResponse]", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -661,7 +672,7 @@ async def begin_merge( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ReservationResponse]] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -722,7 +733,7 @@ def list(self, reservation_order_id: str, **kwargs: Any) -> AsyncIterable["_mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationList] = kwargs.pop("cls", None) error_map = { @@ -781,16 +792,16 @@ async def get_next(next_link=None): @distributed_trace_async async def get( - self, reservation_id: str, reservation_order_id: str, expand: Optional[str] = None, **kwargs: Any + self, reservation_order_id: str, reservation_id: str, expand: Optional[str] = None, **kwargs: Any ) -> _models.ReservationResponse: """Get ``Reservation`` details. Get specific ``Reservation`` details. - :param reservation_id: Id of the Reservation Item. Required. - :type reservation_id: str :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str + :param reservation_id: Id of the reservation item. Required. + :type reservation_id: str :param expand: Supported value of this query is renewProperties. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -809,12 +820,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationResponse] = kwargs.pop("cls", None) request = build_get_request( - reservation_id=reservation_id, reservation_order_id=reservation_order_id, + reservation_id=reservation_id, expand=expand, api_version=api_version, template_url=self.get.metadata["url"], @@ -860,7 +871,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ReservationResponse]] = kwargs.pop("cls", None) @@ -898,11 +909,19 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ReservationResponse", pipeline_response) + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -926,7 +945,7 @@ async def begin_update( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :param parameters: Information needed to patch a reservation item. Required. :type parameters: ~azure.mgmt.reservations.models.Patch @@ -963,7 +982,7 @@ async def begin_update( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :param parameters: Information needed to patch a reservation item. Required. :type parameters: IO @@ -994,7 +1013,7 @@ async def begin_update( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :param parameters: Information needed to patch a reservation item. Is either a model type or a IO type. Required. @@ -1018,7 +1037,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ReservationResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1045,7 +1064,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1073,7 +1095,7 @@ async def archive( # pylint: disable=inconsistent-return-statements :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -1091,7 +1113,7 @@ async def archive( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_archive_request( @@ -1129,11 +1151,11 @@ async def unarchive( # pylint: disable=inconsistent-return-statements ) -> None: """Unarchive a ``Reservation``. - Unarchiving a ``Reservation`` moves it to the state it was before archiving. + Restores a ``Reservation`` to the state it was before archiving. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -1151,7 +1173,7 @@ async def unarchive( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_unarchive_request( @@ -1185,16 +1207,16 @@ async def unarchive( # pylint: disable=inconsistent-return-statements @distributed_trace def list_revisions( - self, reservation_id: str, reservation_order_id: str, **kwargs: Any + self, reservation_order_id: str, reservation_id: str, **kwargs: Any ) -> AsyncIterable["_models.ReservationResponse"]: """Get ``Reservation`` revisions. List of all the revisions for the ``Reservation``. - :param reservation_id: Id of the Reservation Item. Required. - :type reservation_id: str :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str + :param reservation_id: Id of the reservation item. Required. + :type reservation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReservationResponse or the result of cls(response) :rtype: @@ -1204,7 +1226,7 @@ def list_revisions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationList] = kwargs.pop("cls", None) error_map = { @@ -1219,8 +1241,8 @@ def prepare_request(next_link=None): if not next_link: request = build_list_revisions_request( - reservation_id=reservation_id, reservation_order_id=reservation_order_id, + reservation_id=reservation_id, api_version=api_version, template_url=self.list_revisions.metadata["url"], headers=_headers, @@ -1281,9 +1303,9 @@ def list_all( :param filter: May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, - displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, - reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}. Default - value is None. + displayProvisioningState, effectiveDateTime, expiryDate, expiryDateTime, provisioningState, + quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + userFriendlyRenewState}. Default value is None. :type filter: str :param orderby: May be used to sort order by reservation properties. Default value is None. :type orderby: str @@ -1306,7 +1328,7 @@ def list_all( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationsListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py index 866c12d8fd67..b9b8db867ab8 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py @@ -134,7 +134,7 @@ async def calculate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CalculatePriceResponse] = kwargs.pop("cls", None) @@ -194,7 +194,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ReservationOrderResponse _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationOrderList] = kwargs.pop("cls", None) error_map = { @@ -264,7 +264,7 @@ async def _purchase_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) @@ -300,14 +300,18 @@ async def _purchase_initial( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -411,7 +415,7 @@ async def begin_purchase( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -483,7 +487,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -599,7 +603,7 @@ async def change_directory( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ChangeDirectoryResponse] = kwargs.pop("cls", None) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py index 8b1ad1c5f397..0b82c6c62bea 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,10 +19,12 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -56,18 +58,80 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + async def _post_initial( + self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any + ) -> _models.RefundResponse: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RefundRequest") + + request = build_post_request( + reservation_order_id=reservation_order_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("RefundResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _post_initial.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} + @overload - async def post( + async def begin_post( self, reservation_order_id: str, body: _models.RefundRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RefundResponse: + ) -> AsyncLROPoller[_models.RefundResponse]: """Return a reservation. - Return a reservation. + Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str @@ -77,18 +141,26 @@ async def post( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RefundResponse or the result of cls(response) - :rtype: ~azure.mgmt.reservations.models.RefundResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RefundResponse or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def post( + async def begin_post( self, reservation_order_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RefundResponse: + ) -> AsyncLROPoller[_models.RefundResponse]: """Return a reservation. - Return a reservation. + Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str @@ -98,18 +170,26 @@ async def post( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RefundResponse or the result of cls(response) - :rtype: ~azure.mgmt.reservations.models.RefundResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RefundResponse or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def post( + async def begin_post( self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any - ) -> _models.RefundResponse: + ) -> AsyncLROPoller[_models.RefundResponse]: """Return a reservation. - Return a reservation. + Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str @@ -120,65 +200,65 @@ async def post( Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RefundResponse or the result of cls(response) - :rtype: ~azure.mgmt.reservations.models.RefundResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RefundResponse or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._post_initial( + reservation_order_id=reservation_order_id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - _json = self._serialize.body(body, "RefundRequest") - - request = build_post_request( - reservation_order_id=reservation_order_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.post.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response = pipeline_response.http_response + deserialized = self._deserialize("RefundResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("RefundResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - post.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} + begin_post.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py index 113332cc0607..1d4db29e5dbc 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py @@ -26,9 +26,11 @@ from ._models_py3 import CalculateRefundResponse from ._models_py3 import Catalog from ._models_py3 import CatalogMsrp +from ._models_py3 import CatalogsResult from ._models_py3 import ChangeDirectoryRequest from ._models_py3 import ChangeDirectoryResponse from ._models_py3 import ChangeDirectoryResult +from ._models_py3 import Commitment from ._models_py3 import CreateGenericQuotaRequestParameters from ._models_py3 import CurrentQuotaLimit from ._models_py3 import CurrentQuotaLimitBase @@ -53,6 +55,7 @@ from ._models_py3 import PatchPropertiesRenewProperties from ._models_py3 import PaymentDetail from ._models_py3 import Price +from ._models_py3 import ProxyResource from ._models_py3 import PurchaseRequest from ._models_py3 import PurchaseRequestPropertiesReservedResourceProperties from ._models_py3 import QuotaLimits @@ -93,7 +96,11 @@ from ._models_py3 import ReservationsListResult from ._models_py3 import ReservationsProperties from ._models_py3 import ReservationsPropertiesUtilization +from ._models_py3 import Resource from ._models_py3 import ResourceName +from ._models_py3 import SavingsPlanPurchaseRequest +from ._models_py3 import SavingsPlanToPurchaseCalculateExchange +from ._models_py3 import SavingsPlanToPurchaseExchange from ._models_py3 import ScopeProperties from ._models_py3 import ServiceError from ._models_py3 import ServiceErrorDetail @@ -107,7 +114,9 @@ from ._models_py3 import SystemData from ._azure_reservation_api_enums import AppliedScopeType +from ._azure_reservation_api_enums import BillingPlan from ._azure_reservation_api_enums import CalculateExchangeOperationResultStatus +from ._azure_reservation_api_enums import CommitmentGrain from ._azure_reservation_api_enums import CreatedByType from ._azure_reservation_api_enums import DisplayProvisioningState from ._azure_reservation_api_enums import ErrorResponseCode @@ -123,6 +132,7 @@ from ._azure_reservation_api_enums import ReservationTerm from ._azure_reservation_api_enums import ReservedResourceType from ._azure_reservation_api_enums import ResourceType +from ._azure_reservation_api_enums import SavingsPlanTerm from ._azure_reservation_api_enums import UserFriendlyAppliedScopeType from ._azure_reservation_api_enums import UserFriendlyRenewState from ._patch import __all__ as _patch_all @@ -150,9 +160,11 @@ "CalculateRefundResponse", "Catalog", "CatalogMsrp", + "CatalogsResult", "ChangeDirectoryRequest", "ChangeDirectoryResponse", "ChangeDirectoryResult", + "Commitment", "CreateGenericQuotaRequestParameters", "CurrentQuotaLimit", "CurrentQuotaLimitBase", @@ -177,6 +189,7 @@ "PatchPropertiesRenewProperties", "PaymentDetail", "Price", + "ProxyResource", "PurchaseRequest", "PurchaseRequestPropertiesReservedResourceProperties", "QuotaLimits", @@ -217,7 +230,11 @@ "ReservationsListResult", "ReservationsProperties", "ReservationsPropertiesUtilization", + "Resource", "ResourceName", + "SavingsPlanPurchaseRequest", + "SavingsPlanToPurchaseCalculateExchange", + "SavingsPlanToPurchaseExchange", "ScopeProperties", "ServiceError", "ServiceErrorDetail", @@ -230,7 +247,9 @@ "SubscriptionScopeProperties", "SystemData", "AppliedScopeType", + "BillingPlan", "CalculateExchangeOperationResultStatus", + "CommitmentGrain", "CreatedByType", "DisplayProvisioningState", "ErrorResponseCode", @@ -246,6 +265,7 @@ "ReservationTerm", "ReservedResourceType", "ResourceType", + "SavingsPlanTerm", "UserFriendlyAppliedScopeType", "UserFriendlyRenewState", ] diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py index 839cd4d2708f..a384a3971088 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py @@ -15,6 +15,13 @@ class AppliedScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SINGLE = "Single" SHARED = "Shared" + MANAGEMENT_GROUP = "ManagementGroup" + + +class BillingPlan(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.""" + + P1_M = "P1M" class CalculateExchangeOperationResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -26,6 +33,12 @@ class CalculateExchangeOperationResultStatus(str, Enum, metaclass=CaseInsensitiv PENDING = "Pending" +class CommitmentGrain(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Commitment grain.""" + + HOURLY = "Hourly" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -36,7 +49,7 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DisplayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Represent the current display state of the Reservation.""" + """Represent the current display state of the reservation.""" SUCCEEDED = "Succeeded" EXPIRING = "Expiring" @@ -45,10 +58,12 @@ class DisplayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PROCESSING = "Processing" CANCELLED = "Cancelled" FAILED = "Failed" + WARNING = "Warning" + NO_BENEFIT = "NoBenefit" class ErrorResponseCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ErrorResponseCode.""" + """Error code describing the reason that service is not able to process the incoming request.""" NOT_SPECIFIED = "NotSpecified" INTERNAL_SERVER_ERROR = "InternalServerError" @@ -229,7 +244,7 @@ class ReservationStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ReservationTerm(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Represent the term of Reservation.""" + """Represent the term of reservation.""" P1_Y = "P1Y" P3_Y = "P3Y" @@ -277,6 +292,13 @@ class ResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_SPECIFIC = "serviceSpecific" +class SavingsPlanTerm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Represent savings plan term in ISO 8601 format.""" + + P1_Y = "P1Y" + P3_Y = "P3Y" + + class UserFriendlyAppliedScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The applied scope type.""" diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py index 14b02b2ccb95..139b6eeb7976 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py @@ -29,7 +29,7 @@ class AppliedReservationList(_serialization.Model): - """AppliedReservationList. + """Paginated list of applied reservations. :ivar value: :vartype value: list[str] @@ -42,7 +42,7 @@ class AppliedReservationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List[str]] = None, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[List[str]] = None, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[str] @@ -55,7 +55,7 @@ def __init__(self, *, value: Optional[List[str]] = None, next_link: Optional[str class AppliedReservations(_serialization.Model): - """AppliedReservations. + """The response for applied reservations api. Variables are only populated by the server, and will be ignored when sending a request. @@ -65,7 +65,7 @@ class AppliedReservations(_serialization.Model): :vartype name: str :ivar type: Type of resource. "Microsoft.Capacity/AppliedReservations". :vartype type: str - :ivar reservation_order_ids: + :ivar reservation_order_ids: Paginated list of applied reservations. :vartype reservation_order_ids: ~azure.mgmt.reservations.models.AppliedReservationList """ @@ -82,9 +82,11 @@ class AppliedReservations(_serialization.Model): "reservation_order_ids": {"key": "properties.reservationOrderIds", "type": "AppliedReservationList"}, } - def __init__(self, *, reservation_order_ids: Optional["_models.AppliedReservationList"] = None, **kwargs): + def __init__( + self, *, reservation_order_ids: Optional["_models.AppliedReservationList"] = None, **kwargs: Any + ) -> None: """ - :keyword reservation_order_ids: + :keyword reservation_order_ids: Paginated list of applied reservations. :paramtype reservation_order_ids: ~azure.mgmt.reservations.models.AppliedReservationList """ super().__init__(**kwargs) @@ -95,20 +97,27 @@ def __init__(self, *, reservation_order_ids: Optional["_models.AppliedReservatio class AppliedScopeProperties(_serialization.Model): - """AppliedScopeProperties. + """Properties specific to applied scope type. Not required if not applicable. Required and need to + provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. - :ivar tenant_id: Tenant ID of the applied scope type. + :ivar tenant_id: Tenant ID where the savings plan should apply benefit. :vartype tenant_id: str - :ivar management_group_id: Management group ID of the format - /providers/Microsoft.Management/managementGroups/{managementGroupId}. + :ivar management_group_id: Fully-qualified identifier of the management group where the benefit + must be applied. :vartype management_group_id: str - :ivar display_name: Management group display name. + :ivar subscription_id: Fully-qualified identifier of the subscription. + :vartype subscription_id: str + :ivar resource_group_id: Fully-qualified identifier of the resource group. + :vartype resource_group_id: str + :ivar display_name: Display name. :vartype display_name: str """ _attribute_map = { "tenant_id": {"key": "tenantId", "type": "str"}, "management_group_id": {"key": "managementGroupId", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "resource_group_id": {"key": "resourceGroupId", "type": "str"}, "display_name": {"key": "displayName", "type": "str"}, } @@ -117,28 +126,36 @@ def __init__( *, tenant_id: Optional[str] = None, management_group_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group_id: Optional[str] = None, display_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword tenant_id: Tenant ID of the applied scope type. + :keyword tenant_id: Tenant ID where the savings plan should apply benefit. :paramtype tenant_id: str - :keyword management_group_id: Management group ID of the format - /providers/Microsoft.Management/managementGroups/{managementGroupId}. + :keyword management_group_id: Fully-qualified identifier of the management group where the + benefit must be applied. :paramtype management_group_id: str - :keyword display_name: Management group display name. + :keyword subscription_id: Fully-qualified identifier of the subscription. + :paramtype subscription_id: str + :keyword resource_group_id: Fully-qualified identifier of the resource group. + :paramtype resource_group_id: str + :keyword display_name: Display name. :paramtype display_name: str """ super().__init__(**kwargs) self.tenant_id = tenant_id self.management_group_id = management_group_id + self.subscription_id = subscription_id + self.resource_group_id = resource_group_id self.display_name = display_name class AvailableScopeProperties(_serialization.Model): - """AvailableScopeProperties. + """The response of available scope api containing scopes and their eligibilities. - :ivar properties: + :ivar properties: The scopes checked by the available scope api. :vartype properties: ~azure.mgmt.reservations.models.SubscriptionScopeProperties """ @@ -146,9 +163,9 @@ class AvailableScopeProperties(_serialization.Model): "properties": {"key": "properties", "type": "SubscriptionScopeProperties"}, } - def __init__(self, *, properties: Optional["_models.SubscriptionScopeProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.SubscriptionScopeProperties"] = None, **kwargs: Any) -> None: """ - :keyword properties: + :keyword properties: The scopes checked by the available scope api. :paramtype properties: ~azure.mgmt.reservations.models.SubscriptionScopeProperties """ super().__init__(**kwargs) @@ -166,7 +183,9 @@ class AvailableScopeRequest(_serialization.Model): "properties": {"key": "properties", "type": "AvailableScopeRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.AvailableScopeRequestProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.AvailableScopeRequestProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Available scope request properties. :paramtype properties: ~azure.mgmt.reservations.models.AvailableScopeRequestProperties @@ -186,7 +205,7 @@ class AvailableScopeRequestProperties(_serialization.Model): "scopes": {"key": "scopes", "type": "[str]"}, } - def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs): + def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword scopes: :paramtype scopes: list[str] @@ -198,11 +217,14 @@ def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs): class BillingInformation(_serialization.Model): """billing information. - :ivar billing_currency_total_paid_amount: + :ivar billing_currency_total_paid_amount: Pricing information containing the amount and the + currency code. :vartype billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price - :ivar billing_currency_prorated_amount: + :ivar billing_currency_prorated_amount: Pricing information containing the amount and the + currency code. :vartype billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price - :ivar billing_currency_remaining_commitment_amount: + :ivar billing_currency_remaining_commitment_amount: Pricing information containing the amount + and the currency code. :vartype billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price """ @@ -221,14 +243,17 @@ def __init__( billing_currency_total_paid_amount: Optional["_models.Price"] = None, billing_currency_prorated_amount: Optional["_models.Price"] = None, billing_currency_remaining_commitment_amount: Optional["_models.Price"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword billing_currency_total_paid_amount: + :keyword billing_currency_total_paid_amount: Pricing information containing the amount and the + currency code. :paramtype billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price - :keyword billing_currency_prorated_amount: + :keyword billing_currency_prorated_amount: Pricing information containing the amount and the + currency code. :paramtype billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price - :keyword billing_currency_remaining_commitment_amount: + :keyword billing_currency_remaining_commitment_amount: Pricing information containing the + amount and the currency code. :paramtype billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price """ super().__init__(**kwargs) @@ -270,8 +295,8 @@ def __init__( status: Optional[Union[str, "_models.CalculateExchangeOperationResultStatus"]] = None, properties: Optional["_models.CalculateExchangeResponseProperties"] = None, error: Optional["_models.OperationResultError"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: It should match what is used to GET the operation result. :paramtype id: str @@ -306,7 +331,9 @@ class CalculateExchangeRequest(_serialization.Model): "properties": {"key": "properties", "type": "CalculateExchangeRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.CalculateExchangeRequestProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.CalculateExchangeRequestProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Calculate exchange request properties. :paramtype properties: ~azure.mgmt.reservations.models.CalculateExchangeRequestProperties @@ -320,12 +347,17 @@ class CalculateExchangeRequestProperties(_serialization.Model): :ivar reservations_to_purchase: List of reservations that are being purchased in this exchange. :vartype reservations_to_purchase: list[~azure.mgmt.reservations.models.PurchaseRequest] + :ivar savings_plans_to_purchase: List of savings plans that are being purchased in this + exchange. + :vartype savings_plans_to_purchase: + list[~azure.mgmt.reservations.models.SavingsPlanPurchaseRequest] :ivar reservations_to_exchange: List of reservations that are being returned in this exchange. :vartype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturn] """ _attribute_map = { "reservations_to_purchase": {"key": "reservationsToPurchase", "type": "[PurchaseRequest]"}, + "savings_plans_to_purchase": {"key": "savingsPlansToPurchase", "type": "[SavingsPlanPurchaseRequest]"}, "reservations_to_exchange": {"key": "reservationsToExchange", "type": "[ReservationToReturn]"}, } @@ -333,19 +365,25 @@ def __init__( self, *, reservations_to_purchase: Optional[List["_models.PurchaseRequest"]] = None, + savings_plans_to_purchase: Optional[List["_models.SavingsPlanPurchaseRequest"]] = None, reservations_to_exchange: Optional[List["_models.ReservationToReturn"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword reservations_to_purchase: List of reservations that are being purchased in this exchange. :paramtype reservations_to_purchase: list[~azure.mgmt.reservations.models.PurchaseRequest] + :keyword savings_plans_to_purchase: List of savings plans that are being purchased in this + exchange. + :paramtype savings_plans_to_purchase: + list[~azure.mgmt.reservations.models.SavingsPlanPurchaseRequest] :keyword reservations_to_exchange: List of reservations that are being returned in this exchange. :paramtype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturn] """ super().__init__(**kwargs) self.reservations_to_purchase = reservations_to_purchase + self.savings_plans_to_purchase = savings_plans_to_purchase self.reservations_to_exchange = reservations_to_exchange @@ -354,15 +392,18 @@ class CalculateExchangeResponseProperties(_serialization.Model): :ivar session_id: Exchange session identifier. :vartype session_id: str - :ivar net_payable: + :ivar net_payable: Pricing information containing the amount and the currency code. :vartype net_payable: ~azure.mgmt.reservations.models.Price - :ivar refunds_total: + :ivar refunds_total: Pricing information containing the amount and the currency code. :vartype refunds_total: ~azure.mgmt.reservations.models.Price - :ivar purchases_total: + :ivar purchases_total: Pricing information containing the amount and the currency code. :vartype purchases_total: ~azure.mgmt.reservations.models.Price :ivar reservations_to_purchase: Details of the reservations being purchased. :vartype reservations_to_purchase: list[~azure.mgmt.reservations.models.ReservationToPurchaseCalculateExchange] + :ivar savings_plans_to_purchase: Details of the savings plans being purchased. + :vartype savings_plans_to_purchase: + list[~azure.mgmt.reservations.models.SavingsPlanToPurchaseCalculateExchange] :ivar reservations_to_exchange: Details of the reservations being returned. :vartype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToExchange] :ivar policy_result: Exchange policy errors. @@ -378,6 +419,10 @@ class CalculateExchangeResponseProperties(_serialization.Model): "key": "reservationsToPurchase", "type": "[ReservationToPurchaseCalculateExchange]", }, + "savings_plans_to_purchase": { + "key": "savingsPlansToPurchase", + "type": "[SavingsPlanToPurchaseCalculateExchange]", + }, "reservations_to_exchange": {"key": "reservationsToExchange", "type": "[ReservationToExchange]"}, "policy_result": {"key": "policyResult", "type": "ExchangePolicyErrors"}, } @@ -390,22 +435,26 @@ def __init__( refunds_total: Optional["_models.Price"] = None, purchases_total: Optional["_models.Price"] = None, reservations_to_purchase: Optional[List["_models.ReservationToPurchaseCalculateExchange"]] = None, + savings_plans_to_purchase: Optional[List["_models.SavingsPlanToPurchaseCalculateExchange"]] = None, reservations_to_exchange: Optional[List["_models.ReservationToExchange"]] = None, policy_result: Optional["_models.ExchangePolicyErrors"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword session_id: Exchange session identifier. :paramtype session_id: str - :keyword net_payable: + :keyword net_payable: Pricing information containing the amount and the currency code. :paramtype net_payable: ~azure.mgmt.reservations.models.Price - :keyword refunds_total: + :keyword refunds_total: Pricing information containing the amount and the currency code. :paramtype refunds_total: ~azure.mgmt.reservations.models.Price - :keyword purchases_total: + :keyword purchases_total: Pricing information containing the amount and the currency code. :paramtype purchases_total: ~azure.mgmt.reservations.models.Price :keyword reservations_to_purchase: Details of the reservations being purchased. :paramtype reservations_to_purchase: list[~azure.mgmt.reservations.models.ReservationToPurchaseCalculateExchange] + :keyword savings_plans_to_purchase: Details of the savings plans being purchased. + :paramtype savings_plans_to_purchase: + list[~azure.mgmt.reservations.models.SavingsPlanToPurchaseCalculateExchange] :keyword reservations_to_exchange: Details of the reservations being returned. :paramtype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToExchange] @@ -418,14 +467,15 @@ def __init__( self.refunds_total = refunds_total self.purchases_total = purchases_total self.reservations_to_purchase = reservations_to_purchase + self.savings_plans_to_purchase = savings_plans_to_purchase self.reservations_to_exchange = reservations_to_exchange self.policy_result = policy_result class CalculatePriceResponse(_serialization.Model): - """CalculatePriceResponse. + """The response of calculate price for reservation. - :ivar properties: + :ivar properties: Properties for calculate price response. :vartype properties: ~azure.mgmt.reservations.models.CalculatePriceResponseProperties """ @@ -433,9 +483,11 @@ class CalculatePriceResponse(_serialization.Model): "properties": {"key": "properties", "type": "CalculatePriceResponseProperties"}, } - def __init__(self, *, properties: Optional["_models.CalculatePriceResponseProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.CalculatePriceResponseProperties"] = None, **kwargs: Any + ) -> None: """ - :keyword properties: + :keyword properties: Properties for calculate price response. :paramtype properties: ~azure.mgmt.reservations.models.CalculatePriceResponseProperties """ super().__init__(**kwargs) @@ -443,7 +495,7 @@ def __init__(self, *, properties: Optional["_models.CalculatePriceResponseProper class CalculatePriceResponseProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """CalculatePriceResponseProperties. + """Properties for calculate price response. :ivar billing_currency_total: Currency and amount that customer will be charged in customer's local currency. Tax is not included. @@ -463,9 +515,9 @@ class CalculatePriceResponseProperties(_serialization.Model): # pylint: disable :ivar reservation_order_id: GUID that represents reservation order that can be placed after calculating price. :vartype reservation_order_id: str - :ivar sku_title: Title of SKU that is being purchased. + :ivar sku_title: Title of sku that is being purchased. :vartype sku_title: str - :ivar sku_description: Description of SKU that is being purchased. + :ivar sku_description: Description of sku that is being purchased. :vartype sku_description: str :ivar pricing_currency_total: Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. @@ -509,8 +561,8 @@ def __init__( sku_description: Optional[str] = None, pricing_currency_total: Optional["_models.CalculatePriceResponsePropertiesPricingCurrencyTotal"] = None, payment_schedule: Optional[List["_models.PaymentDetail"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword billing_currency_total: Currency and amount that customer will be charged in customer's local currency. Tax is not included. @@ -530,9 +582,9 @@ def __init__( :keyword reservation_order_id: GUID that represents reservation order that can be placed after calculating price. :paramtype reservation_order_id: str - :keyword sku_title: Title of SKU that is being purchased. + :keyword sku_title: Title of sku that is being purchased. :paramtype sku_title: str - :keyword sku_description: Description of SKU that is being purchased. + :keyword sku_description: Description of sku that is being purchased. :paramtype sku_description: str :keyword pricing_currency_total: Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. @@ -556,7 +608,8 @@ def __init__( class CalculatePriceResponsePropertiesBillingCurrencyTotal(_serialization.Model): - """Currency and amount that customer will be charged in customer's local currency. Tax is not included. + """Currency and amount that customer will be charged in customer's local currency. Tax is not + included. :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -570,7 +623,7 @@ class CalculatePriceResponsePropertiesBillingCurrencyTotal(_serialization.Model) "amount": {"key": "amount", "type": "float"}, } - def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs): + def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs: Any) -> None: """ :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -584,7 +637,8 @@ def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[floa class CalculatePriceResponsePropertiesPricingCurrencyTotal(_serialization.Model): - """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. + """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is + not included. :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -598,7 +652,7 @@ class CalculatePriceResponsePropertiesPricingCurrencyTotal(_serialization.Model) "amount": {"key": "amount", "type": "float"}, } - def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs): + def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs: Any) -> None: """ :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -612,11 +666,12 @@ def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[floa class CalculateRefundRequest(_serialization.Model): - """CalculateRefundRequest. + """Request containing information needed for calculating refund. :ivar id: Fully qualified identifier of the reservation order being returned. :vartype id: str - :ivar properties: + :ivar properties: Properties needed for calculate refund including the scope and the + reservation to be returned. :vartype properties: ~azure.mgmt.reservations.models.CalculateRefundRequestProperties """ @@ -630,12 +685,13 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin properties: Optional["_models.CalculateRefundRequestProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the reservation order being returned. :paramtype id: str - :keyword properties: + :keyword properties: Properties needed for calculate refund including the scope and the + reservation to be returned. :paramtype properties: ~azure.mgmt.reservations.models.CalculateRefundRequestProperties """ super().__init__(**kwargs) @@ -644,7 +700,7 @@ def __init__( class CalculateRefundRequestProperties(_serialization.Model): - """CalculateRefundRequestProperties. + """Properties needed for calculate refund including the scope and the reservation to be returned. :ivar scope: The scope of the refund, e.g. Reservation. :vartype scope: str @@ -662,8 +718,8 @@ def __init__( *, scope: Optional[str] = None, reservation_to_return: Optional["_models.ReservationToReturn"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The scope of the refund, e.g. Reservation. :paramtype scope: str @@ -676,11 +732,11 @@ def __init__( class CalculateRefundResponse(_serialization.Model): - """CalculateRefundResponse. + """The response of calculate refund containing refund information of reservation. :ivar id: Fully qualified identifier of the reservation being returned. :vartype id: str - :ivar properties: + :ivar properties: The refund properties of reservation. :vartype properties: ~azure.mgmt.reservations.models.RefundResponseProperties """ @@ -694,12 +750,12 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin properties: Optional["_models.RefundResponseProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the reservation being returned. :paramtype id: str - :keyword properties: + :keyword properties: The refund properties of reservation. :paramtype properties: ~azure.mgmt.reservations.models.RefundResponseProperties """ super().__init__(**kwargs) @@ -708,15 +764,15 @@ def __init__( class Catalog(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Catalog. + """Product details of a type of resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_type: The type of resource the SKU applies to. + :ivar resource_type: The type of resource the sku applies to. :vartype resource_type: str - :ivar name: The name of SKU. + :ivar name: The name of sku. :vartype name: str - :ivar billing_plans: The billing plan options available for this SKU. + :ivar billing_plans: The billing plan options available for this sku. :vartype billing_plans: dict[str, list[str or ~azure.mgmt.reservations.models.ReservationBillingPlan]] :ivar terms: Available reservation terms for this resource. @@ -725,13 +781,13 @@ class Catalog(_serialization.Model): # pylint: disable=too-many-instance-attrib :vartype locations: list[str] :ivar sku_properties: :vartype sku_properties: list[~azure.mgmt.reservations.models.SkuProperty] - :ivar msrp: Pricing information about the SKU. + :ivar msrp: Pricing information about the sku. :vartype msrp: ~azure.mgmt.reservations.models.CatalogMsrp :ivar restrictions: :vartype restrictions: list[~azure.mgmt.reservations.models.SkuRestriction] - :ivar tier: The tier of this SKU. + :ivar tier: The tier of this sku. :vartype tier: str - :ivar size: The size of this SKU. + :ivar size: The size of this sku. :vartype size: str :ivar capabilities: :vartype capabilities: list[~azure.mgmt.reservations.models.SkuCapability] @@ -765,10 +821,13 @@ class Catalog(_serialization.Model): # pylint: disable=too-many-instance-attrib } def __init__( - self, *, billing_plans: Optional[Dict[str, List[Union[str, "_models.ReservationBillingPlan"]]]] = None, **kwargs - ): + self, + *, + billing_plans: Optional[Dict[str, List[Union[str, "_models.ReservationBillingPlan"]]]] = None, + **kwargs: Any + ) -> None: """ - :keyword billing_plans: The billing plan options available for this SKU. + :keyword billing_plans: The billing plan options available for this sku. :paramtype billing_plans: dict[str, list[str or ~azure.mgmt.reservations.models.ReservationBillingPlan]] """ @@ -787,7 +846,7 @@ def __init__( class CatalogMsrp(_serialization.Model): - """Pricing information about the SKU. + """Pricing information about the sku. :ivar p1_y: Amount in pricing currency. Tax not included. :vartype p1_y: ~azure.mgmt.reservations.models.Price @@ -797,7 +856,7 @@ class CatalogMsrp(_serialization.Model): "p1_y": {"key": "p1Y", "type": "Price"}, } - def __init__(self, *, p1_y: Optional["_models.Price"] = None, **kwargs): + def __init__(self, *, p1_y: Optional["_models.Price"] = None, **kwargs: Any) -> None: """ :keyword p1_y: Amount in pricing currency. Tax not included. :paramtype p1_y: ~azure.mgmt.reservations.models.Price @@ -806,8 +865,43 @@ def __init__(self, *, p1_y: Optional["_models.Price"] = None, **kwargs): self.p1_y = p1_y +class CatalogsResult(_serialization.Model): + """The list of catalogs and pagination information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of catalogs. + :vartype value: list[~azure.mgmt.reservations.models.Catalog] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + :ivar total_items: The total amount of catalog items. + :vartype total_items: int + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Catalog]"}, + "next_link": {"key": "nextLink", "type": "str"}, + "total_items": {"key": "totalItems", "type": "int"}, + } + + def __init__(self, *, total_items: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword total_items: The total amount of catalog items. + :paramtype total_items: int + """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + self.total_items = total_items + + class ChangeDirectoryRequest(_serialization.Model): - """ChangeDirectoryRequest. + """Request body for change directory of a reservation. :ivar destination_tenant_id: Tenant id GUID that reservation order is to be transferred to. :vartype destination_tenant_id: str @@ -817,7 +911,7 @@ class ChangeDirectoryRequest(_serialization.Model): "destination_tenant_id": {"key": "destinationTenantId", "type": "str"}, } - def __init__(self, *, destination_tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, destination_tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword destination_tenant_id: Tenant id GUID that reservation order is to be transferred to. :paramtype destination_tenant_id: str @@ -845,8 +939,8 @@ def __init__( *, reservation_order: Optional["_models.ChangeDirectoryResult"] = None, reservations: Optional[List["_models.ChangeDirectoryResult"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword reservation_order: Change directory result for reservation order or reservation. :paramtype reservation_order: ~azure.mgmt.reservations.models.ChangeDirectoryResult @@ -886,8 +980,8 @@ def __init__( name: Optional[str] = None, is_succeeded: Optional[bool] = None, error: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Identifier of the reservation order or reservation. :paramtype id: str @@ -906,6 +1000,73 @@ def __init__( self.error = error +class Price(_serialization.Model): + """Pricing information containing the amount and the currency code. + + :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase + record. + :vartype currency_code: str + :ivar amount: + :vartype amount: float + """ + + _attribute_map = { + "currency_code": {"key": "currencyCode", "type": "str"}, + "amount": {"key": "amount", "type": "float"}, + } + + def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs: Any) -> None: + """ + :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this + purchase record. + :paramtype currency_code: str + :keyword amount: + :paramtype amount: float + """ + super().__init__(**kwargs) + self.currency_code = currency_code + self.amount = amount + + +class Commitment(Price): + """Commitment towards the benefit. + + :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase + record. + :vartype currency_code: str + :ivar amount: + :vartype amount: float + :ivar grain: Commitment grain. "Hourly" + :vartype grain: str or ~azure.mgmt.reservations.models.CommitmentGrain + """ + + _attribute_map = { + "currency_code": {"key": "currencyCode", "type": "str"}, + "amount": {"key": "amount", "type": "float"}, + "grain": {"key": "grain", "type": "str"}, + } + + def __init__( + self, + *, + currency_code: Optional[str] = None, + amount: Optional[float] = None, + grain: Optional[Union[str, "_models.CommitmentGrain"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this + purchase record. + :paramtype currency_code: str + :keyword amount: + :paramtype amount: float + :keyword grain: Commitment grain. "Hourly" + :paramtype grain: str or ~azure.mgmt.reservations.models.CommitmentGrain + """ + super().__init__(currency_code=currency_code, amount=amount, **kwargs) + self.grain = grain + + class CreateGenericQuotaRequestParameters(_serialization.Model): """Quota change requests information. @@ -917,7 +1078,7 @@ class CreateGenericQuotaRequestParameters(_serialization.Model): "value": {"key": "value", "type": "[CurrentQuotaLimitBase]"}, } - def __init__(self, *, value: Optional[List["_models.CurrentQuotaLimitBase"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CurrentQuotaLimitBase"]] = None, **kwargs: Any) -> None: """ :keyword value: Quota change requests. :paramtype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] @@ -963,7 +1124,7 @@ class CurrentQuotaLimit(_serialization.Model): "properties": {"key": "quotaInformation.properties", "type": "QuotaProperties"}, } - def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Quota properties for the resource. :paramtype properties: ~azure.mgmt.reservations.models.QuotaProperties @@ -1005,7 +1166,7 @@ class CurrentQuotaLimitBase(_serialization.Model): "properties": {"key": "properties", "type": "QuotaProperties"}, } - def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Quota properties for the resource. :paramtype properties: ~azure.mgmt.reservations.models.QuotaProperties @@ -1018,9 +1179,9 @@ def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, ** class Error(_serialization.Model): - """Error. + """Error information. - :ivar error: + :ivar error: Extended error information including error code and error message. :vartype error: ~azure.mgmt.reservations.models.ExtendedErrorInfo """ @@ -1028,9 +1189,9 @@ class Error(_serialization.Model): "error": {"key": "error", "type": "ExtendedErrorInfo"}, } - def __init__(self, *, error: Optional["_models.ExtendedErrorInfo"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ExtendedErrorInfo"] = None, **kwargs: Any) -> None: """ - :keyword error: + :keyword error: Extended error information including error code and error message. :paramtype error: ~azure.mgmt.reservations.models.ExtendedErrorInfo """ super().__init__(**kwargs) @@ -1062,7 +1223,7 @@ class ErrorDetails(_serialization.Model): "target": {"key": "target", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1071,7 +1232,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. :ivar error: The details of the error. :vartype error: ~azure.mgmt.reservations.models.ErrorDetails @@ -1081,7 +1243,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetails"}, } - def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.reservations.models.ErrorDetails @@ -1101,7 +1263,7 @@ class ExceptionResponse(_serialization.Model): "error": {"key": "error", "type": "ServiceError"}, } - def __init__(self, *, error: Optional["_models.ServiceError"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ServiceError"] = None, **kwargs: Any) -> None: """ :keyword error: The API error details. :paramtype error: ~azure.mgmt.reservations.models.ServiceError @@ -1143,8 +1305,8 @@ def __init__( status: Optional[Union[str, "_models.ExchangeOperationResultStatus"]] = None, properties: Optional["_models.ExchangeResponseProperties"] = None, error: Optional["_models.OperationResultError"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: It should match what is used to GET the operation result. :paramtype id: str @@ -1181,7 +1343,7 @@ class ExchangePolicyError(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: :paramtype code: str @@ -1204,7 +1366,7 @@ class ExchangePolicyErrors(_serialization.Model): "policy_errors": {"key": "policyErrors", "type": "[ExchangePolicyError]"}, } - def __init__(self, *, policy_errors: Optional[List["_models.ExchangePolicyError"]] = None, **kwargs): + def __init__(self, *, policy_errors: Optional[List["_models.ExchangePolicyError"]] = None, **kwargs: Any) -> None: """ :keyword policy_errors: Exchange Policy errors. :paramtype policy_errors: list[~azure.mgmt.reservations.models.ExchangePolicyError] @@ -1224,7 +1386,7 @@ class ExchangeRequest(_serialization.Model): "properties": {"key": "properties", "type": "ExchangeRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.ExchangeRequestProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ExchangeRequestProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Exchange request properties. :paramtype properties: ~azure.mgmt.reservations.models.ExchangeRequestProperties @@ -1244,7 +1406,7 @@ class ExchangeRequestProperties(_serialization.Model): "session_id": {"key": "sessionId", "type": "str"}, } - def __init__(self, *, session_id: Optional[str] = None, **kwargs): + def __init__(self, *, session_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword session_id: SessionId that was returned by CalculateExchange API. :paramtype session_id: str @@ -1258,15 +1420,18 @@ class ExchangeResponseProperties(_serialization.Model): :ivar session_id: Exchange session identifier. :vartype session_id: str - :ivar net_payable: + :ivar net_payable: Pricing information containing the amount and the currency code. :vartype net_payable: ~azure.mgmt.reservations.models.Price - :ivar refunds_total: + :ivar refunds_total: Pricing information containing the amount and the currency code. :vartype refunds_total: ~azure.mgmt.reservations.models.Price - :ivar purchases_total: + :ivar purchases_total: Pricing information containing the amount and the currency code. :vartype purchases_total: ~azure.mgmt.reservations.models.Price :ivar reservations_to_purchase: Details of the reservations being purchased. :vartype reservations_to_purchase: list[~azure.mgmt.reservations.models.ReservationToPurchaseExchange] + :ivar savings_plans_to_purchase: Details of the savings plans being purchased. + :vartype savings_plans_to_purchase: + list[~azure.mgmt.reservations.models.SavingsPlanToPurchaseExchange] :ivar reservations_to_exchange: Details of the reservations being returned. :vartype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturnForExchange] @@ -1280,6 +1445,7 @@ class ExchangeResponseProperties(_serialization.Model): "refunds_total": {"key": "refundsTotal", "type": "Price"}, "purchases_total": {"key": "purchasesTotal", "type": "Price"}, "reservations_to_purchase": {"key": "reservationsToPurchase", "type": "[ReservationToPurchaseExchange]"}, + "savings_plans_to_purchase": {"key": "savingsPlansToPurchase", "type": "[SavingsPlanToPurchaseExchange]"}, "reservations_to_exchange": {"key": "reservationsToExchange", "type": "[ReservationToReturnForExchange]"}, "policy_result": {"key": "policyResult", "type": "ExchangePolicyErrors"}, } @@ -1292,22 +1458,26 @@ def __init__( refunds_total: Optional["_models.Price"] = None, purchases_total: Optional["_models.Price"] = None, reservations_to_purchase: Optional[List["_models.ReservationToPurchaseExchange"]] = None, + savings_plans_to_purchase: Optional[List["_models.SavingsPlanToPurchaseExchange"]] = None, reservations_to_exchange: Optional[List["_models.ReservationToReturnForExchange"]] = None, policy_result: Optional["_models.ExchangePolicyErrors"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword session_id: Exchange session identifier. :paramtype session_id: str - :keyword net_payable: + :keyword net_payable: Pricing information containing the amount and the currency code. :paramtype net_payable: ~azure.mgmt.reservations.models.Price - :keyword refunds_total: + :keyword refunds_total: Pricing information containing the amount and the currency code. :paramtype refunds_total: ~azure.mgmt.reservations.models.Price - :keyword purchases_total: + :keyword purchases_total: Pricing information containing the amount and the currency code. :paramtype purchases_total: ~azure.mgmt.reservations.models.Price :keyword reservations_to_purchase: Details of the reservations being purchased. :paramtype reservations_to_purchase: list[~azure.mgmt.reservations.models.ReservationToPurchaseExchange] + :keyword savings_plans_to_purchase: Details of the savings plans being purchased. + :paramtype savings_plans_to_purchase: + list[~azure.mgmt.reservations.models.SavingsPlanToPurchaseExchange] :keyword reservations_to_exchange: Details of the reservations being returned. :paramtype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturnForExchange] @@ -1320,14 +1490,16 @@ def __init__( self.refunds_total = refunds_total self.purchases_total = purchases_total self.reservations_to_purchase = reservations_to_purchase + self.savings_plans_to_purchase = savings_plans_to_purchase self.reservations_to_exchange = reservations_to_exchange self.policy_result = policy_result class ExtendedErrorInfo(_serialization.Model): - """ExtendedErrorInfo. + """Extended error information including error code and error message. - :ivar code: Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", + :ivar code: Error code describing the reason that service is not able to process the incoming + request. Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", "AuthorizationFailed", "BadRequest", "ClientCertificateThumbprintNotSet", "InvalidRequestContent", "OperationFailed", "HttpMethodNotSupported", "InvalidRequestUri", "MissingTenantId", "InvalidTenantId", "InvalidReservationOrderId", "InvalidReservationId", @@ -1358,10 +1530,15 @@ class ExtendedErrorInfo(_serialization.Model): } def __init__( - self, *, code: Optional[Union[str, "_models.ErrorResponseCode"]] = None, message: Optional[str] = None, **kwargs - ): + self, + *, + code: Optional[Union[str, "_models.ErrorResponseCode"]] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword code: Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", + :keyword code: Error code describing the reason that service is not able to process the + incoming request. Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", "AuthorizationFailed", "BadRequest", "ClientCertificateThumbprintNotSet", "InvalidRequestContent", "OperationFailed", "HttpMethodNotSupported", "InvalidRequestUri", "MissingTenantId", "InvalidTenantId", "InvalidReservationOrderId", "InvalidReservationId", @@ -1410,8 +1587,8 @@ def __init__( *, status_code: Optional[Union[str, "_models.ReservationStatusCode"]] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status_code: Known values are: "None", "Pending", "Processing", "Active", "PurchaseError", "PaymentInstrumentError", "Split", "Merged", "Expired", and "Succeeded". @@ -1425,7 +1602,7 @@ def __init__( class MergeRequest(_serialization.Model): - """MergeRequest. + """The request for reservation merge. :ivar sources: Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. @@ -1436,7 +1613,7 @@ class MergeRequest(_serialization.Model): "sources": {"key": "properties.sources", "type": "[str]"}, } - def __init__(self, *, sources: Optional[List[str]] = None, **kwargs): + def __init__(self, *, sources: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword sources: Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. @@ -1447,7 +1624,7 @@ def __init__(self, *, sources: Optional[List[str]] = None, **kwargs): class OperationDisplay(_serialization.Model): - """OperationDisplay. + """Information about an operation. :ivar provider: :vartype provider: str @@ -1473,8 +1650,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: :paramtype provider: str @@ -1493,7 +1670,7 @@ def __init__( class OperationList(_serialization.Model): - """OperationList. + """Paginated list of operations. :ivar value: :vartype value: list[~azure.mgmt.reservations.models.OperationResponse] @@ -1507,8 +1684,12 @@ class OperationList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OperationResponse"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.OperationResponse"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.reservations.models.OperationResponse] @@ -1521,7 +1702,7 @@ def __init__( class OperationResponse(_serialization.Model): - """OperationResponse. + """The response containing operation information. :ivar name: Name of the operation. :vartype name: str @@ -1551,8 +1732,8 @@ def __init__( display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -1590,7 +1771,7 @@ class OperationResultError(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used for error troubleshooting, aggregation, and analysis. @@ -1606,33 +1787,43 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, class Patch(_serialization.Model): - """Patch. + """The request for reservation patch. - :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single" and "Shared". + :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and + "ManagementGroup". :vartype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :ivar applied_scopes: List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. :vartype applied_scopes: list[str] + :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not + applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is + ManagementGroup. + :vartype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties :ivar instance_flexibility: Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. Known values are: "On" and "Off". :vartype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility - :ivar name: Name of the Reservation. + :ivar name: Display name of the reservation. :vartype name: str :ivar renew: Setting this to true will automatically purchase a new reservation on the expiration date time. :vartype renew: bool :ivar renew_properties: :vartype renew_properties: ~azure.mgmt.reservations.models.PatchPropertiesRenewProperties + :ivar review_date_time: This is the date-time when the Azure hybrid benefit needs to be + reviewed. + :vartype review_date_time: ~datetime.datetime """ _attribute_map = { "applied_scope_type": {"key": "properties.appliedScopeType", "type": "str"}, "applied_scopes": {"key": "properties.appliedScopes", "type": "[str]"}, + "applied_scope_properties": {"key": "properties.appliedScopeProperties", "type": "AppliedScopeProperties"}, "instance_flexibility": {"key": "properties.instanceFlexibility", "type": "str"}, "name": {"key": "properties.name", "type": "str"}, "renew": {"key": "properties.renew", "type": "bool"}, "renew_properties": {"key": "properties.renewProperties", "type": "PatchPropertiesRenewProperties"}, + "review_date_time": {"key": "properties.reviewDateTime", "type": "iso-8601"}, } def __init__( @@ -1640,44 +1831,55 @@ def __init__( *, applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None, applied_scopes: Optional[List[str]] = None, + applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None, instance_flexibility: Optional[Union[str, "_models.InstanceFlexibility"]] = None, name: Optional[str] = None, renew: bool = False, renew_properties: Optional["_models.PatchPropertiesRenewProperties"] = None, - **kwargs - ): + review_date_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword applied_scope_type: Type of the Applied Scope. Known values are: "Single" and - "Shared". + :keyword applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", + and "ManagementGroup". :paramtype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :keyword applied_scopes: List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. :paramtype applied_scopes: list[str] + :keyword applied_scope_properties: Properties specific to applied scope type. Not required if + not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType + is ManagementGroup. + :paramtype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties :keyword instance_flexibility: Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. Known values are: "On" and "Off". :paramtype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility - :keyword name: Name of the Reservation. + :keyword name: Display name of the reservation. :paramtype name: str :keyword renew: Setting this to true will automatically purchase a new reservation on the expiration date time. :paramtype renew: bool :keyword renew_properties: :paramtype renew_properties: ~azure.mgmt.reservations.models.PatchPropertiesRenewProperties + :keyword review_date_time: This is the date-time when the Azure hybrid benefit needs to be + reviewed. + :paramtype review_date_time: ~datetime.datetime """ super().__init__(**kwargs) self.applied_scope_type = applied_scope_type self.applied_scopes = applied_scopes + self.applied_scope_properties = applied_scope_properties self.instance_flexibility = instance_flexibility self.name = name self.renew = renew self.renew_properties = renew_properties + self.review_date_time = review_date_time class PatchPropertiesRenewProperties(_serialization.Model): """PatchPropertiesRenewProperties. - :ivar purchase_properties: + :ivar purchase_properties: The request for reservation purchase. :vartype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest """ @@ -1685,9 +1887,9 @@ class PatchPropertiesRenewProperties(_serialization.Model): "purchase_properties": {"key": "purchaseProperties", "type": "PurchaseRequest"}, } - def __init__(self, *, purchase_properties: Optional["_models.PurchaseRequest"] = None, **kwargs): + def __init__(self, *, purchase_properties: Optional["_models.PurchaseRequest"] = None, **kwargs: Any) -> None: """ - :keyword purchase_properties: + :keyword purchase_properties: The request for reservation purchase. :paramtype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest """ super().__init__(**kwargs) @@ -1735,8 +1937,8 @@ def __init__( billing_account: Optional[str] = None, status: Optional[Union[str, "_models.PaymentStatus"]] = None, extended_status_info: Optional["_models.ExtendedStatusInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword due_date: Date when the payment needs to be done. :paramtype due_date: ~datetime.date @@ -1765,40 +1967,91 @@ def __init__( self.extended_status_info = extended_status_info -class Price(_serialization.Model): - """Price. +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase - record. - :vartype currency_code: str - :ivar amount: - :vartype amount: float + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.reservations.models.SystemData """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + _attribute_map = { - "currency_code": {"key": "currencyCode", "type": "str"}, - "amount": {"key": "amount", "type": "float"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs): - """ - :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this - purchase record. - :paramtype currency_code: str - :keyword amount: - :paramtype amount: float - """ + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.reservations.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.currency_code = currency_code - self.amount = amount class PurchaseRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes - """PurchaseRequest. + """The request for reservation purchase. - :ivar sku: + :ivar sku: The name of sku. :vartype sku: ~azure.mgmt.reservations.models.SkuName - :ivar location: The Azure Region where the reserved resource lives. + :ivar location: The Azure region where the reserved resource lives. :vartype location: str :ivar reserved_resource_type: The type of the resource that is being reserved. Known values are: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", "SqlDataWarehouse", @@ -1807,21 +2060,27 @@ class PurchaseRequest(_serialization.Model): # pylint: disable=too-many-instanc "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", "NetAppStorage", "AzureFiles", "SqlEdge", and "VirtualMachineSoftware". :vartype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType - :ivar billing_scope_id: Subscription that will be charged for purchasing Reservation. + :ivar billing_scope_id: Subscription that will be charged for purchasing reservation or savings + plan. :vartype billing_scope_id: str - :ivar term: Represent the term of Reservation. Known values are: "P1Y", "P3Y", and "P5Y". + :ivar term: Represent the term of reservation. Known values are: "P1Y", "P3Y", and "P5Y". :vartype term: str or ~azure.mgmt.reservations.models.ReservationTerm :ivar billing_plan: Represent the billing plans. Known values are: "Upfront" and "Monthly". :vartype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :ivar quantity: Quantity of the SKUs that are part of the Reservation. + :ivar quantity: Quantity of the skus that are part of the reservation. :vartype quantity: int - :ivar display_name: Friendly name of the Reservation. + :ivar display_name: Friendly name of the reservation. :vartype display_name: str - :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single" and "Shared". + :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and + "ManagementGroup". :vartype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :ivar applied_scopes: List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. :vartype applied_scopes: list[str] + :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not + applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is + ManagementGroup. + :vartype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties :ivar renew: Setting this to true will automatically purchase a new reservation on the expiration date time. :vartype renew: bool @@ -1829,6 +2088,9 @@ class PurchaseRequest(_serialization.Model): # pylint: disable=too-many-instanc required if not applicable. :vartype reserved_resource_properties: ~azure.mgmt.reservations.models.PurchaseRequestPropertiesReservedResourceProperties + :ivar review_date_time: This is the date-time when the Azure hybrid benefit needs to be + reviewed. + :vartype review_date_time: ~datetime.datetime """ _attribute_map = { @@ -1842,11 +2104,13 @@ class PurchaseRequest(_serialization.Model): # pylint: disable=too-many-instanc "display_name": {"key": "properties.displayName", "type": "str"}, "applied_scope_type": {"key": "properties.appliedScopeType", "type": "str"}, "applied_scopes": {"key": "properties.appliedScopes", "type": "[str]"}, + "applied_scope_properties": {"key": "properties.appliedScopeProperties", "type": "AppliedScopeProperties"}, "renew": {"key": "properties.renew", "type": "bool"}, "reserved_resource_properties": { "key": "properties.reservedResourceProperties", "type": "PurchaseRequestPropertiesReservedResourceProperties", }, + "review_date_time": {"key": "properties.reviewDateTime", "type": "iso-8601"}, } def __init__( @@ -1862,14 +2126,16 @@ def __init__( display_name: Optional[str] = None, applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None, applied_scopes: Optional[List[str]] = None, + applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None, renew: bool = False, reserved_resource_properties: Optional["_models.PurchaseRequestPropertiesReservedResourceProperties"] = None, - **kwargs - ): + review_date_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword sku: + :keyword sku: The name of sku. :paramtype sku: ~azure.mgmt.reservations.models.SkuName - :keyword location: The Azure Region where the reserved resource lives. + :keyword location: The Azure region where the reserved resource lives. :paramtype location: str :keyword reserved_resource_type: The type of the resource that is being reserved. Known values are: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", "SqlDataWarehouse", @@ -1878,22 +2144,27 @@ def __init__( "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", "NetAppStorage", "AzureFiles", "SqlEdge", and "VirtualMachineSoftware". :paramtype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType - :keyword billing_scope_id: Subscription that will be charged for purchasing Reservation. + :keyword billing_scope_id: Subscription that will be charged for purchasing reservation or + savings plan. :paramtype billing_scope_id: str - :keyword term: Represent the term of Reservation. Known values are: "P1Y", "P3Y", and "P5Y". + :keyword term: Represent the term of reservation. Known values are: "P1Y", "P3Y", and "P5Y". :paramtype term: str or ~azure.mgmt.reservations.models.ReservationTerm :keyword billing_plan: Represent the billing plans. Known values are: "Upfront" and "Monthly". :paramtype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :keyword quantity: Quantity of the SKUs that are part of the Reservation. + :keyword quantity: Quantity of the skus that are part of the reservation. :paramtype quantity: int - :keyword display_name: Friendly name of the Reservation. + :keyword display_name: Friendly name of the reservation. :paramtype display_name: str - :keyword applied_scope_type: Type of the Applied Scope. Known values are: "Single" and - "Shared". + :keyword applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", + and "ManagementGroup". :paramtype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :keyword applied_scopes: List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. :paramtype applied_scopes: list[str] + :keyword applied_scope_properties: Properties specific to applied scope type. Not required if + not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType + is ManagementGroup. + :paramtype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties :keyword renew: Setting this to true will automatically purchase a new reservation on the expiration date time. :paramtype renew: bool @@ -1901,6 +2172,9 @@ def __init__( required if not applicable. :paramtype reserved_resource_properties: ~azure.mgmt.reservations.models.PurchaseRequestPropertiesReservedResourceProperties + :keyword review_date_time: This is the date-time when the Azure hybrid benefit needs to be + reviewed. + :paramtype review_date_time: ~datetime.datetime """ super().__init__(**kwargs) self.sku = sku @@ -1913,8 +2187,10 @@ def __init__( self.display_name = display_name self.applied_scope_type = applied_scope_type self.applied_scopes = applied_scopes + self.applied_scope_properties = applied_scope_properties self.renew = renew self.reserved_resource_properties = reserved_resource_properties + self.review_date_time = review_date_time class PurchaseRequestPropertiesReservedResourceProperties(_serialization.Model): @@ -1930,7 +2206,9 @@ class PurchaseRequestPropertiesReservedResourceProperties(_serialization.Model): "instance_flexibility": {"key": "instanceFlexibility", "type": "str"}, } - def __init__(self, *, instance_flexibility: Optional[Union[str, "_models.InstanceFlexibility"]] = None, **kwargs): + def __init__( + self, *, instance_flexibility: Optional[Union[str, "_models.InstanceFlexibility"]] = None, **kwargs: Any + ) -> None: """ :keyword instance_flexibility: Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. Known @@ -1961,8 +2239,8 @@ def __init__( *, value: Optional[List["_models.CurrentQuotaLimitBase"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: List of quotas (service limits). :paramtype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] @@ -1991,8 +2269,12 @@ class QuotaLimitsResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.CurrentQuotaLimit"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.CurrentQuotaLimit"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: List of quotas with the quota request status. :paramtype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimit] @@ -2054,8 +2336,8 @@ def __init__( name: Optional["_models.ResourceName"] = None, resource_type: Optional[Union[str, "_models.ResourceType"]] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword limit: Quota properties. :paramtype limit: int @@ -2127,8 +2409,8 @@ def __init__( *, provisioning_state: Optional[Union[str, "_models.QuotaRequestState"]] = None, value: Optional[List["_models.SubRequest"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: The quota request status. Known values are: "Accepted", "Invalid", "Succeeded", "Failed", and "InProgress". @@ -2162,8 +2444,12 @@ class QuotaRequestDetailsList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.QuotaRequestDetails"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.QuotaRequestDetails"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The quota requests. :paramtype value: list[~azure.mgmt.reservations.models.QuotaRequestDetails] @@ -2230,7 +2516,7 @@ class QuotaRequestOneResourceSubmitResponse(_serialization.Model): "properties": {"key": "properties.properties.properties", "type": "QuotaProperties"}, } - def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Quota properties for the resource. :paramtype properties: ~azure.mgmt.reservations.models.QuotaProperties @@ -2282,8 +2568,8 @@ def __init__( *, provisioning_state: Optional[Union[str, "_models.QuotaRequestState"]] = None, value: Optional[List["_models.SubRequest"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: The quota request status. Known values are: "Accepted", "Invalid", "Succeeded", "Failed", and "InProgress". @@ -2326,7 +2612,7 @@ class QuotaRequestSubmitResponse(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.QuotaRequestProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.QuotaRequestProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The quota request details. :paramtype properties: ~azure.mgmt.reservations.models.QuotaRequestProperties @@ -2372,7 +2658,7 @@ class QuotaRequestSubmitResponse201(_serialization.Model): "message": {"key": "properties.message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2392,11 +2678,14 @@ class RefundBillingInformation(_serialization.Model): :vartype completed_transactions: int :ivar total_transactions: The number of total transactions in this reservation's payment. :vartype total_transactions: int - :ivar billing_currency_total_paid_amount: + :ivar billing_currency_total_paid_amount: Pricing information containing the amount and the + currency code. :vartype billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price - :ivar billing_currency_prorated_amount: + :ivar billing_currency_prorated_amount: Pricing information containing the amount and the + currency code. :vartype billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price - :ivar billing_currency_remaining_commitment_amount: + :ivar billing_currency_remaining_commitment_amount: Pricing information containing the amount + and the currency code. :vartype billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price """ @@ -2421,8 +2710,8 @@ def __init__( billing_currency_total_paid_amount: Optional["_models.Price"] = None, billing_currency_prorated_amount: Optional["_models.Price"] = None, billing_currency_remaining_commitment_amount: Optional["_models.Price"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword billing_plan: Represent the billing plans. Known values are: "Upfront" and "Monthly". :paramtype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan @@ -2431,11 +2720,14 @@ def __init__( :paramtype completed_transactions: int :keyword total_transactions: The number of total transactions in this reservation's payment. :paramtype total_transactions: int - :keyword billing_currency_total_paid_amount: + :keyword billing_currency_total_paid_amount: Pricing information containing the amount and the + currency code. :paramtype billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price - :keyword billing_currency_prorated_amount: + :keyword billing_currency_prorated_amount: Pricing information containing the amount and the + currency code. :paramtype billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price - :keyword billing_currency_remaining_commitment_amount: + :keyword billing_currency_remaining_commitment_amount: Pricing information containing the + amount and the currency code. :paramtype billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price """ super().__init__(**kwargs) @@ -2450,7 +2742,8 @@ def __init__( class RefundPolicyError(_serialization.Model): """error details. - :ivar code: Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", + :ivar code: Error code describing the reason that service is not able to process the incoming + request. Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", "AuthorizationFailed", "BadRequest", "ClientCertificateThumbprintNotSet", "InvalidRequestContent", "OperationFailed", "HttpMethodNotSupported", "InvalidRequestUri", "MissingTenantId", "InvalidTenantId", "InvalidReservationOrderId", "InvalidReservationId", @@ -2481,10 +2774,15 @@ class RefundPolicyError(_serialization.Model): } def __init__( - self, *, code: Optional[Union[str, "_models.ErrorResponseCode"]] = None, message: Optional[str] = None, **kwargs - ): + self, + *, + code: Optional[Union[str, "_models.ErrorResponseCode"]] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword code: Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", + :keyword code: Error code describing the reason that service is not able to process the + incoming request. Known values are: "NotSpecified", "InternalServerError", "ServerTimeout", "AuthorizationFailed", "BadRequest", "ClientCertificateThumbprintNotSet", "InvalidRequestContent", "OperationFailed", "HttpMethodNotSupported", "InvalidRequestUri", "MissingTenantId", "InvalidTenantId", "InvalidReservationOrderId", "InvalidReservationId", @@ -2524,7 +2822,7 @@ class RefundPolicyResult(_serialization.Model): "properties": {"key": "properties", "type": "RefundPolicyResultProperty"}, } - def __init__(self, *, properties: Optional["_models.RefundPolicyResultProperty"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RefundPolicyResultProperty"] = None, **kwargs: Any) -> None: """ :keyword properties: Refund policy result property. :paramtype properties: ~azure.mgmt.reservations.models.RefundPolicyResultProperty @@ -2536,9 +2834,9 @@ def __init__(self, *, properties: Optional["_models.RefundPolicyResultProperty"] class RefundPolicyResultProperty(_serialization.Model): """Refund policy result property. - :ivar consumed_refunds_total: + :ivar consumed_refunds_total: Pricing information containing the amount and the currency code. :vartype consumed_refunds_total: ~azure.mgmt.reservations.models.Price - :ivar max_refund_limit: + :ivar max_refund_limit: Pricing information containing the amount and the currency code. :vartype max_refund_limit: ~azure.mgmt.reservations.models.Price :ivar policy_errors: Refund Policy errors. :vartype policy_errors: list[~azure.mgmt.reservations.models.RefundPolicyError] @@ -2556,12 +2854,13 @@ def __init__( consumed_refunds_total: Optional["_models.Price"] = None, max_refund_limit: Optional["_models.Price"] = None, policy_errors: Optional[List["_models.RefundPolicyError"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword consumed_refunds_total: + :keyword consumed_refunds_total: Pricing information containing the amount and the currency + code. :paramtype consumed_refunds_total: ~azure.mgmt.reservations.models.Price - :keyword max_refund_limit: + :keyword max_refund_limit: Pricing information containing the amount and the currency code. :paramtype max_refund_limit: ~azure.mgmt.reservations.models.Price :keyword policy_errors: Refund Policy errors. :paramtype policy_errors: list[~azure.mgmt.reservations.models.RefundPolicyError] @@ -2573,9 +2872,10 @@ def __init__( class RefundRequest(_serialization.Model): - """RefundRequest. + """Request containing information needed for returning reservation. - :ivar properties: + :ivar properties: Properties needed for refund request including the session id from calculate + refund, the scope, the reservation to be returned and the return reason. :vartype properties: ~azure.mgmt.reservations.models.RefundRequestProperties """ @@ -2583,9 +2883,10 @@ class RefundRequest(_serialization.Model): "properties": {"key": "properties", "type": "RefundRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.RefundRequestProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RefundRequestProperties"] = None, **kwargs: Any) -> None: """ - :keyword properties: + :keyword properties: Properties needed for refund request including the session id from + calculate refund, the scope, the reservation to be returned and the return reason. :paramtype properties: ~azure.mgmt.reservations.models.RefundRequestProperties """ super().__init__(**kwargs) @@ -2593,7 +2894,8 @@ def __init__(self, *, properties: Optional["_models.RefundRequestProperties"] = class RefundRequestProperties(_serialization.Model): - """RefundRequestProperties. + """Properties needed for refund request including the session id from calculate refund, the scope, + the reservation to be returned and the return reason. :ivar session_id: SessionId that was returned by CalculateRefund API. :vartype session_id: str @@ -2619,8 +2921,8 @@ def __init__( scope: Optional[str] = None, reservation_to_return: Optional["_models.ReservationToReturn"] = None, return_reason: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword session_id: SessionId that was returned by CalculateRefund API. :paramtype session_id: str @@ -2639,11 +2941,11 @@ def __init__( class RefundResponse(_serialization.Model): - """RefundResponse. + """The response of refund request containing refund information of reservation. :ivar id: Fully qualified identifier of the reservation being returned. :vartype id: str - :ivar properties: + :ivar properties: The refund properties of reservation. :vartype properties: ~azure.mgmt.reservations.models.RefundResponseProperties """ @@ -2657,12 +2959,12 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin properties: Optional["_models.RefundResponseProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the reservation being returned. :paramtype id: str - :keyword properties: + :keyword properties: The refund properties of reservation. :paramtype properties: ~azure.mgmt.reservations.models.RefundResponseProperties """ super().__init__(**kwargs) @@ -2671,15 +2973,15 @@ def __init__( class RefundResponseProperties(_serialization.Model): - """RefundResponseProperties. + """The refund properties of reservation. :ivar session_id: Refund session identifier. :vartype session_id: str :ivar quantity: Quantity to be returned. :vartype quantity: int - :ivar billing_refund_amount: + :ivar billing_refund_amount: Pricing information containing the amount and the currency code. :vartype billing_refund_amount: ~azure.mgmt.reservations.models.Price - :ivar pricing_refund_amount: + :ivar pricing_refund_amount: Pricing information containing the amount and the currency code. :vartype pricing_refund_amount: ~azure.mgmt.reservations.models.Price :ivar policy_result: Refund policy result. :vartype policy_result: ~azure.mgmt.reservations.models.RefundPolicyResult @@ -2705,16 +3007,18 @@ def __init__( pricing_refund_amount: Optional["_models.Price"] = None, policy_result: Optional["_models.RefundPolicyResult"] = None, billing_information: Optional["_models.RefundBillingInformation"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword session_id: Refund session identifier. :paramtype session_id: str :keyword quantity: Quantity to be returned. :paramtype quantity: int - :keyword billing_refund_amount: + :keyword billing_refund_amount: Pricing information containing the amount and the currency + code. :paramtype billing_refund_amount: ~azure.mgmt.reservations.models.Price - :keyword pricing_refund_amount: + :keyword pricing_refund_amount: Pricing information containing the amount and the currency + code. :paramtype pricing_refund_amount: ~azure.mgmt.reservations.models.Price :keyword policy_result: Refund policy result. :paramtype policy_result: ~azure.mgmt.reservations.models.RefundPolicyResult @@ -2731,9 +3035,9 @@ def __init__( class RenewPropertiesResponse(_serialization.Model): - """RenewPropertiesResponse. + """The renew properties for a reservation. - :ivar purchase_properties: + :ivar purchase_properties: The request for reservation purchase. :vartype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest :ivar pricing_currency_total: Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. @@ -2763,10 +3067,10 @@ def __init__( purchase_properties: Optional["_models.PurchaseRequest"] = None, pricing_currency_total: Optional["_models.RenewPropertiesResponsePricingCurrencyTotal"] = None, billing_currency_total: Optional["_models.RenewPropertiesResponseBillingCurrencyTotal"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword purchase_properties: + :keyword purchase_properties: The request for reservation purchase. :paramtype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest :keyword pricing_currency_total: Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. @@ -2784,7 +3088,8 @@ def __init__( class RenewPropertiesResponseBillingCurrencyTotal(_serialization.Model): - """Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. + """Currency and amount that customer will be charged in customer's local currency for renewal + purchase. Tax is not included. :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -2798,7 +3103,7 @@ class RenewPropertiesResponseBillingCurrencyTotal(_serialization.Model): "amount": {"key": "amount", "type": "float"}, } - def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs): + def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs: Any) -> None: """ :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -2812,7 +3117,8 @@ def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[floa class RenewPropertiesResponsePricingCurrencyTotal(_serialization.Model): - """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. + """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is + not included. This is locked price 30 days before expiry. :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -2826,7 +3132,7 @@ class RenewPropertiesResponsePricingCurrencyTotal(_serialization.Model): "amount": {"key": "amount", "type": "float"}, } - def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs): + def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[float] = None, **kwargs: Any) -> None: """ :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase record. @@ -2840,7 +3146,7 @@ def __init__(self, *, currency_code: Optional[str] = None, amount: Optional[floa class ReservationList(_serialization.Model): - """ReservationList. + """List of ``Reservation``\ s. :ivar value: :vartype value: list[~azure.mgmt.reservations.models.ReservationResponse] @@ -2854,8 +3160,12 @@ class ReservationList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ReservationResponse"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ReservationResponse"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.reservations.models.ReservationResponse] @@ -2868,14 +3178,14 @@ def __init__( class ReservationMergeProperties(_serialization.Model): - """ReservationMergeProperties. + """Properties of reservation merge. - :ivar merge_destination: Reservation Resource Id Created due to the merge. Format of the - resource Id is + :ivar merge_destination: Reservation resource id Created due to the merge. Format of the + resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :vartype merge_destination: str - :ivar merge_sources: Resource Ids of the Source Reservation's merged to form this Reservation. - Format of the resource Id is + :ivar merge_sources: Resource ids of the source reservation's merged to form this reservation. + Format of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :vartype merge_sources: list[str] """ @@ -2885,14 +3195,16 @@ class ReservationMergeProperties(_serialization.Model): "merge_sources": {"key": "mergeSources", "type": "[str]"}, } - def __init__(self, *, merge_destination: Optional[str] = None, merge_sources: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, merge_destination: Optional[str] = None, merge_sources: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ - :keyword merge_destination: Reservation Resource Id Created due to the merge. Format of the - resource Id is + :keyword merge_destination: Reservation resource id Created due to the merge. Format of the + resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :paramtype merge_destination: str - :keyword merge_sources: Resource Ids of the Source Reservation's merged to form this - Reservation. Format of the resource Id is + :keyword merge_sources: Resource ids of the source reservation's merged to form this + reservation. Format of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :paramtype merge_sources: list[str] """ @@ -2929,8 +3241,8 @@ def __init__( start_date: Optional[datetime.date] = None, next_payment_due_date: Optional[datetime.date] = None, transactions: Optional[List["_models.PaymentDetail"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pricing_currency_total: Amount of money to be paid for the Order. Tax is not included. :paramtype pricing_currency_total: ~azure.mgmt.reservations.models.Price @@ -2950,7 +3262,7 @@ def __init__( class ReservationOrderList(_serialization.Model): - """ReservationOrderList. + """List of ``ReservationOrder``\ s. :ivar value: :vartype value: list[~azure.mgmt.reservations.models.ReservationOrderResponse] @@ -2968,8 +3280,8 @@ def __init__( *, value: Optional[List["_models.ReservationOrderResponse"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.reservations.models.ReservationOrderResponse] @@ -2982,7 +3294,7 @@ def __init__( class ReservationOrderResponse(_serialization.Model): # pylint: disable=too-many-instance-attributes - """ReservationOrderResponse. + """Details of a reservation order being returned. Variables are only populated by the server, and will be ignored when sending a request. @@ -3003,13 +3315,15 @@ class ReservationOrderResponse(_serialization.Model): # pylint: disable=too-man :vartype request_date_time: ~datetime.datetime :ivar created_date_time: This is the DateTime when the reservation was created. :vartype created_date_time: ~datetime.datetime - :ivar expiry_date: This is the date when the Reservation will expire. + :ivar expiry_date: This is the date when the reservation will expire. :vartype expiry_date: ~datetime.date + :ivar expiry_date_time: This is the date-time when the reservation will expire. + :vartype expiry_date_time: ~datetime.datetime :ivar benefit_start_time: This is the DateTime when the reservation benefit started. :vartype benefit_start_time: ~datetime.datetime - :ivar original_quantity: Total Quantity of the SKUs purchased in the Reservation. + :ivar original_quantity: Total Quantity of the skus purchased in the reservation. :vartype original_quantity: int - :ivar term: Represent the term of Reservation. Known values are: "P1Y", "P3Y", and "P5Y". + :ivar term: Represent the term of reservation. Known values are: "P1Y", "P3Y", and "P5Y". :vartype term: str or ~azure.mgmt.reservations.models.ReservationTerm :ivar provisioning_state: Current state of the reservation. Known values are: "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", "ConfirmedBilling", @@ -3023,6 +3337,9 @@ class ReservationOrderResponse(_serialization.Model): # pylint: disable=too-man ~azure.mgmt.reservations.models.ReservationOrderBillingPlanInformation :ivar reservations: :vartype reservations: list[~azure.mgmt.reservations.models.ReservationResponse] + :ivar review_date_time: This is the date-time when the Azure Hybrid Benefit needs to be + reviewed. + :vartype review_date_time: ~datetime.datetime """ _validation = { @@ -3042,6 +3359,7 @@ class ReservationOrderResponse(_serialization.Model): # pylint: disable=too-man "request_date_time": {"key": "properties.requestDateTime", "type": "iso-8601"}, "created_date_time": {"key": "properties.createdDateTime", "type": "iso-8601"}, "expiry_date": {"key": "properties.expiryDate", "type": "date"}, + "expiry_date_time": {"key": "properties.expiryDateTime", "type": "iso-8601"}, "benefit_start_time": {"key": "properties.benefitStartTime", "type": "iso-8601"}, "original_quantity": {"key": "properties.originalQuantity", "type": "int"}, "term": {"key": "properties.term", "type": "str"}, @@ -3049,6 +3367,7 @@ class ReservationOrderResponse(_serialization.Model): # pylint: disable=too-man "billing_plan": {"key": "properties.billingPlan", "type": "str"}, "plan_information": {"key": "properties.planInformation", "type": "ReservationOrderBillingPlanInformation"}, "reservations": {"key": "properties.reservations", "type": "[ReservationResponse]"}, + "review_date_time": {"key": "properties.reviewDateTime", "type": "iso-8601"}, } def __init__( @@ -3059,6 +3378,7 @@ def __init__( request_date_time: Optional[datetime.datetime] = None, created_date_time: Optional[datetime.datetime] = None, expiry_date: Optional[datetime.date] = None, + expiry_date_time: Optional[datetime.datetime] = None, benefit_start_time: Optional[datetime.datetime] = None, original_quantity: Optional[int] = None, term: Optional[Union[str, "_models.ReservationTerm"]] = None, @@ -3066,8 +3386,9 @@ def __init__( billing_plan: Optional[Union[str, "_models.ReservationBillingPlan"]] = None, plan_information: Optional["_models.ReservationOrderBillingPlanInformation"] = None, reservations: Optional[List["_models.ReservationResponse"]] = None, - **kwargs - ): + review_date_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ :keyword etag: :paramtype etag: int @@ -3078,13 +3399,15 @@ def __init__( :paramtype request_date_time: ~datetime.datetime :keyword created_date_time: This is the DateTime when the reservation was created. :paramtype created_date_time: ~datetime.datetime - :keyword expiry_date: This is the date when the Reservation will expire. + :keyword expiry_date: This is the date when the reservation will expire. :paramtype expiry_date: ~datetime.date + :keyword expiry_date_time: This is the date-time when the reservation will expire. + :paramtype expiry_date_time: ~datetime.datetime :keyword benefit_start_time: This is the DateTime when the reservation benefit started. :paramtype benefit_start_time: ~datetime.datetime - :keyword original_quantity: Total Quantity of the SKUs purchased in the Reservation. + :keyword original_quantity: Total Quantity of the skus purchased in the reservation. :paramtype original_quantity: int - :keyword term: Represent the term of Reservation. Known values are: "P1Y", "P3Y", and "P5Y". + :keyword term: Represent the term of reservation. Known values are: "P1Y", "P3Y", and "P5Y". :paramtype term: str or ~azure.mgmt.reservations.models.ReservationTerm :keyword provisioning_state: Current state of the reservation. Known values are: "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", "ConfirmedBilling", @@ -3099,6 +3422,9 @@ def __init__( ~azure.mgmt.reservations.models.ReservationOrderBillingPlanInformation :keyword reservations: :paramtype reservations: list[~azure.mgmt.reservations.models.ReservationResponse] + :keyword review_date_time: This is the date-time when the Azure Hybrid Benefit needs to be + reviewed. + :paramtype review_date_time: ~datetime.datetime """ super().__init__(**kwargs) self.etag = etag @@ -3110,6 +3436,7 @@ def __init__( self.request_date_time = request_date_time self.created_date_time = created_date_time self.expiry_date = expiry_date + self.expiry_date_time = expiry_date_time self.benefit_start_time = benefit_start_time self.original_quantity = original_quantity self.term = term @@ -3117,31 +3444,35 @@ def __init__( self.billing_plan = billing_plan self.plan_information = plan_information self.reservations = reservations + self.review_date_time = review_date_time -class ReservationResponse(_serialization.Model): +class ReservationResponse(ProxyResource): """The definition of the reservation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar location: The Azure Region where the reserved resource lives. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.reservations.models.SystemData + :ivar location: The Azure region where the reserved resource lives. :vartype location: str :ivar etag: :vartype etag: int - :ivar id: Identifier of the reservation. - :vartype id: str - :ivar name: Name of the reservation. - :vartype name: str :ivar sku: The sku information associated to this reservation. :vartype sku: ~azure.mgmt.reservations.models.SkuName :ivar properties: The properties associated to this reservation. :vartype properties: ~azure.mgmt.reservations.models.ReservationsProperties - :ivar type: Type of resource. "Microsoft.Capacity/reservationOrders/reservations". - :vartype type: str :ivar kind: Resource Provider type to be reserved. Default value is "Microsoft.Compute". :vartype kind: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.reservations.models.SystemData """ _validation = { @@ -3152,15 +3483,15 @@ class ReservationResponse(_serialization.Model): } _attribute_map = { - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "int"}, "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "etag": {"key": "etag", "type": "int"}, "sku": {"key": "sku", "type": "SkuName"}, "properties": {"key": "properties", "type": "ReservationsProperties"}, - "type": {"key": "type", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__( @@ -3171,10 +3502,10 @@ def __init__( sku: Optional["_models.SkuName"] = None, properties: Optional["_models.ReservationsProperties"] = None, kind: Optional[Literal["Microsoft.Compute"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: The Azure Region where the reserved resource lives. + :keyword location: The Azure region where the reserved resource lives. :paramtype location: str :keyword etag: :paramtype etag: int @@ -3188,13 +3519,9 @@ def __init__( super().__init__(**kwargs) self.location = location self.etag = etag - self.id = None - self.name = None self.sku = sku self.properties = properties - self.type = None self.kind = kind - self.system_data = None class ReservationsListResult(_serialization.Model): @@ -3221,7 +3548,7 @@ class ReservationsListResult(_serialization.Model): "summary": {"key": "summary", "type": "ReservationSummary"}, } - def __init__(self, *, summary: Optional["_models.ReservationSummary"] = None, **kwargs): + def __init__(self, *, summary: Optional["_models.ReservationSummary"] = None, **kwargs: Any) -> None: """ :keyword summary: The roll out count summary of the reservations. :paramtype summary: ~azure.mgmt.reservations.models.ReservationSummary @@ -3233,14 +3560,14 @@ def __init__(self, *, summary: Optional["_models.ReservationSummary"] = None, ** class ReservationSplitProperties(_serialization.Model): - """ReservationSplitProperties. + """Properties of reservation split. - :ivar split_destinations: List of destination Resource Id that are created due to split. Format - of the resource Id is + :ivar split_destinations: List of destination resource id that are created due to split. Format + of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :vartype split_destinations: list[str] - :ivar split_source: Resource Id of the Reservation from which this is split. Format of the - resource Id is + :ivar split_source: Resource id of the reservation from which this is split. Format of the + resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :vartype split_source: str """ @@ -3250,14 +3577,16 @@ class ReservationSplitProperties(_serialization.Model): "split_source": {"key": "splitSource", "type": "str"}, } - def __init__(self, *, split_destinations: Optional[List[str]] = None, split_source: Optional[str] = None, **kwargs): + def __init__( + self, *, split_destinations: Optional[List[str]] = None, split_source: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword split_destinations: List of destination Resource Id that are created due to split. - Format of the resource Id is + :keyword split_destinations: List of destination resource id that are created due to split. + Format of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :paramtype split_destinations: list[str] - :keyword split_source: Resource Id of the Reservation from which this is split. Format of the - resource Id is + :keyword split_source: Resource id of the reservation from which this is split. Format of the + resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :paramtype split_source: str """ @@ -3279,58 +3608,69 @@ class ReservationsProperties(_serialization.Model): # pylint: disable=too-many- "SqlEdge", and "VirtualMachineSoftware". :vartype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType :ivar instance_flexibility: Allows reservation discount to be applied across skus within the - same Autofit group. Not all skus support instance size flexibility. Known values are: "On" and + same auto fit group. Not all skus support instance size flexibility. Known values are: "On" and "Off". :vartype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility :ivar display_name: Friendly name for user to easily identify the reservation. :vartype display_name: str :ivar applied_scopes: The list of applied scopes. :vartype applied_scopes: list[str] - :ivar applied_scope_type: The applied scope type. Known values are: "Single" and "Shared". + :ivar applied_scope_type: The applied scope type. Known values are: "Single", "Shared", and + "ManagementGroup". :vartype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :ivar archived: Indicates if the reservation is archived. :vartype archived: bool :ivar capabilities: Capabilities of the reservation. :vartype capabilities: str - :ivar quantity: Quantity of the SKUs that are part of the Reservation. + :ivar quantity: Quantity of the skus that are part of the reservation. :vartype quantity: int :ivar provisioning_state: Current state of the reservation. Known values are: "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", "BillingFailed", "Failed", "Split", and "Merged". :vartype provisioning_state: str or ~azure.mgmt.reservations.models.ProvisioningState - :ivar effective_date_time: DateTime of the Reservation starting when this version is effective + :ivar effective_date_time: DateTime of the reservation starting when this version is effective from. :vartype effective_date_time: ~datetime.datetime :ivar benefit_start_time: This is the DateTime when the reservation benefit started. :vartype benefit_start_time: ~datetime.datetime - :ivar last_updated_date_time: DateTime of the last time the Reservation was updated. + :ivar last_updated_date_time: DateTime of the last time the reservation was updated. :vartype last_updated_date_time: ~datetime.datetime - :ivar expiry_date: This is the date when the Reservation will expire. + :ivar expiry_date: This is the date when the reservation will expire. :vartype expiry_date: ~datetime.date - :ivar sku_description: Description of the SKU in english. + :ivar expiry_date_time: This is the date-time when the reservation will expire. + :vartype expiry_date_time: ~datetime.datetime + :ivar review_date_time: This is the date-time when the Azure Hybrid Benefit needs to be + reviewed. + :vartype review_date_time: ~datetime.datetime + :ivar sku_description: Description of the sku in english. :vartype sku_description: str :ivar extended_status_info: The message giving detailed information about the status code. :vartype extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo - :ivar billing_plan: The billing plan options available for this SKU. Known values are: + :ivar billing_plan: The billing plan options available for this sku. Known values are: "Upfront" and "Monthly". :vartype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan :ivar display_provisioning_state: The provisioning state of the reservation for display, e.g. Succeeded. :vartype display_provisioning_state: str - :ivar provisioning_sub_state: The provisioning state of the reservation, e.g. Succeeded. + :ivar provisioning_sub_state: The provisioning sub-state of the reservation, e.g. Succeeded. :vartype provisioning_sub_state: str - :ivar purchase_date: This is the date when the Reservation was purchased. + :ivar purchase_date: This is the date when the reservation was purchased. :vartype purchase_date: ~datetime.date - :ivar split_properties: + :ivar purchase_date_time: This is the date-time when the reservation was purchased. + :vartype purchase_date_time: ~datetime.datetime + :ivar split_properties: Properties of reservation split. :vartype split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties - :ivar merge_properties: + :ivar merge_properties: Properties of reservation merge. :vartype merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties - :ivar swap_properties: + :ivar swap_properties: Properties of reservation swap. :vartype swap_properties: ~azure.mgmt.reservations.models.ReservationSwapProperties - :ivar applied_scope_properties: + :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not + applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is + ManagementGroup. :vartype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties - :ivar billing_scope_id: Subscription that will be charged for purchasing Reservation. + :ivar billing_scope_id: Subscription that will be charged for purchasing reservation or savings + plan. :vartype billing_scope_id: str :ivar renew: Setting this to true will automatically purchase a new reservation on the expiration date time. @@ -3343,9 +3683,9 @@ class ReservationsProperties(_serialization.Model): # pylint: disable=too-many- Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :vartype renew_destination: str - :ivar renew_properties: + :ivar renew_properties: The renew properties for a reservation. :vartype renew_properties: ~azure.mgmt.reservations.models.RenewPropertiesResponse - :ivar term: Represent the term of Reservation. Known values are: "P1Y", "P3Y", and "P5Y". + :ivar term: Represent the term of reservation. Known values are: "P1Y", "P3Y", and "P5Y". :vartype term: str or ~azure.mgmt.reservations.models.ReservationTerm :ivar user_friendly_applied_scope_type: The applied scope type of the reservation for display, e.g. Shared. @@ -3379,12 +3719,15 @@ class ReservationsProperties(_serialization.Model): # pylint: disable=too-many- "benefit_start_time": {"key": "benefitStartTime", "type": "iso-8601"}, "last_updated_date_time": {"key": "lastUpdatedDateTime", "type": "iso-8601"}, "expiry_date": {"key": "expiryDate", "type": "date"}, + "expiry_date_time": {"key": "expiryDateTime", "type": "iso-8601"}, + "review_date_time": {"key": "reviewDateTime", "type": "iso-8601"}, "sku_description": {"key": "skuDescription", "type": "str"}, "extended_status_info": {"key": "extendedStatusInfo", "type": "ExtendedStatusInfo"}, "billing_plan": {"key": "billingPlan", "type": "str"}, "display_provisioning_state": {"key": "displayProvisioningState", "type": "str"}, "provisioning_sub_state": {"key": "provisioningSubState", "type": "str"}, "purchase_date": {"key": "purchaseDate", "type": "date"}, + "purchase_date_time": {"key": "purchaseDateTime", "type": "iso-8601"}, "split_properties": {"key": "splitProperties", "type": "ReservationSplitProperties"}, "merge_properties": {"key": "mergeProperties", "type": "ReservationMergeProperties"}, "swap_properties": {"key": "swapProperties", "type": "ReservationSwapProperties"}, @@ -3415,10 +3758,13 @@ def __init__( # pylint: disable=too-many-locals effective_date_time: Optional[datetime.datetime] = None, benefit_start_time: Optional[datetime.datetime] = None, expiry_date: Optional[datetime.date] = None, + expiry_date_time: Optional[datetime.datetime] = None, + review_date_time: Optional[datetime.datetime] = None, sku_description: Optional[str] = None, extended_status_info: Optional["_models.ExtendedStatusInfo"] = None, billing_plan: Optional[Union[str, "_models.ReservationBillingPlan"]] = None, purchase_date: Optional[datetime.date] = None, + purchase_date_time: Optional[datetime.datetime] = None, split_properties: Optional["_models.ReservationSplitProperties"] = None, merge_properties: Optional["_models.ReservationMergeProperties"] = None, swap_properties: Optional["_models.ReservationSwapProperties"] = None, @@ -3429,8 +3775,8 @@ def __init__( # pylint: disable=too-many-locals renew_destination: Optional[str] = None, renew_properties: Optional["_models.RenewPropertiesResponse"] = None, term: Optional[Union[str, "_models.ReservationTerm"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword reserved_resource_type: The type of the resource that is being reserved. Known values are: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", "SqlDataWarehouse", @@ -3440,51 +3786,62 @@ def __init__( # pylint: disable=too-many-locals "SqlEdge", and "VirtualMachineSoftware". :paramtype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType :keyword instance_flexibility: Allows reservation discount to be applied across skus within the - same Autofit group. Not all skus support instance size flexibility. Known values are: "On" and + same auto fit group. Not all skus support instance size flexibility. Known values are: "On" and "Off". :paramtype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility :keyword display_name: Friendly name for user to easily identify the reservation. :paramtype display_name: str :keyword applied_scopes: The list of applied scopes. :paramtype applied_scopes: list[str] - :keyword applied_scope_type: The applied scope type. Known values are: "Single" and "Shared". + :keyword applied_scope_type: The applied scope type. Known values are: "Single", "Shared", and + "ManagementGroup". :paramtype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :keyword archived: Indicates if the reservation is archived. :paramtype archived: bool :keyword capabilities: Capabilities of the reservation. :paramtype capabilities: str - :keyword quantity: Quantity of the SKUs that are part of the Reservation. + :keyword quantity: Quantity of the skus that are part of the reservation. :paramtype quantity: int :keyword provisioning_state: Current state of the reservation. Known values are: "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", "BillingFailed", "Failed", "Split", and "Merged". :paramtype provisioning_state: str or ~azure.mgmt.reservations.models.ProvisioningState - :keyword effective_date_time: DateTime of the Reservation starting when this version is + :keyword effective_date_time: DateTime of the reservation starting when this version is effective from. :paramtype effective_date_time: ~datetime.datetime :keyword benefit_start_time: This is the DateTime when the reservation benefit started. :paramtype benefit_start_time: ~datetime.datetime - :keyword expiry_date: This is the date when the Reservation will expire. + :keyword expiry_date: This is the date when the reservation will expire. :paramtype expiry_date: ~datetime.date - :keyword sku_description: Description of the SKU in english. + :keyword expiry_date_time: This is the date-time when the reservation will expire. + :paramtype expiry_date_time: ~datetime.datetime + :keyword review_date_time: This is the date-time when the Azure Hybrid Benefit needs to be + reviewed. + :paramtype review_date_time: ~datetime.datetime + :keyword sku_description: Description of the sku in english. :paramtype sku_description: str :keyword extended_status_info: The message giving detailed information about the status code. :paramtype extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo - :keyword billing_plan: The billing plan options available for this SKU. Known values are: + :keyword billing_plan: The billing plan options available for this sku. Known values are: "Upfront" and "Monthly". :paramtype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :keyword purchase_date: This is the date when the Reservation was purchased. + :keyword purchase_date: This is the date when the reservation was purchased. :paramtype purchase_date: ~datetime.date - :keyword split_properties: + :keyword purchase_date_time: This is the date-time when the reservation was purchased. + :paramtype purchase_date_time: ~datetime.datetime + :keyword split_properties: Properties of reservation split. :paramtype split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties - :keyword merge_properties: + :keyword merge_properties: Properties of reservation merge. :paramtype merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties - :keyword swap_properties: + :keyword swap_properties: Properties of reservation swap. :paramtype swap_properties: ~azure.mgmt.reservations.models.ReservationSwapProperties - :keyword applied_scope_properties: + :keyword applied_scope_properties: Properties specific to applied scope type. Not required if + not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType + is ManagementGroup. :paramtype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties - :keyword billing_scope_id: Subscription that will be charged for purchasing Reservation. + :keyword billing_scope_id: Subscription that will be charged for purchasing reservation or + savings plan. :paramtype billing_scope_id: str :keyword renew: Setting this to true will automatically purchase a new reservation on the expiration date time. @@ -3497,9 +3854,9 @@ def __init__( # pylint: disable=too-many-locals renew. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :paramtype renew_destination: str - :keyword renew_properties: + :keyword renew_properties: The renew properties for a reservation. :paramtype renew_properties: ~azure.mgmt.reservations.models.RenewPropertiesResponse - :keyword term: Represent the term of Reservation. Known values are: "P1Y", "P3Y", and "P5Y". + :keyword term: Represent the term of reservation. Known values are: "P1Y", "P3Y", and "P5Y". :paramtype term: str or ~azure.mgmt.reservations.models.ReservationTerm """ super().__init__(**kwargs) @@ -3516,12 +3873,15 @@ def __init__( # pylint: disable=too-many-locals self.benefit_start_time = benefit_start_time self.last_updated_date_time = None self.expiry_date = expiry_date + self.expiry_date_time = expiry_date_time + self.review_date_time = review_date_time self.sku_description = sku_description self.extended_status_info = extended_status_info self.billing_plan = billing_plan self.display_provisioning_state = None self.provisioning_sub_state = None self.purchase_date = purchase_date + self.purchase_date_time = purchase_date_time self.split_properties = split_properties self.merge_properties = merge_properties self.swap_properties = swap_properties @@ -3542,7 +3902,7 @@ class ReservationsPropertiesUtilization(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar trend: The number of days trend for a reservation. + :ivar trend: last 7 day utilization trend for a reservation. :vartype trend: str :ivar aggregates: The array of aggregates of a reservation's utilization. :vartype aggregates: list[~azure.mgmt.reservations.models.ReservationUtilizationAggregates] @@ -3557,7 +3917,9 @@ class ReservationsPropertiesUtilization(_serialization.Model): "aggregates": {"key": "aggregates", "type": "[ReservationUtilizationAggregates]"}, } - def __init__(self, *, aggregates: Optional[List["_models.ReservationUtilizationAggregates"]] = None, **kwargs): + def __init__( + self, *, aggregates: Optional[List["_models.ReservationUtilizationAggregates"]] = None, **kwargs: Any + ) -> None: """ :keyword aggregates: The array of aggregates of a reservation's utilization. :paramtype aggregates: list[~azure.mgmt.reservations.models.ReservationUtilizationAggregates] @@ -3586,6 +3948,10 @@ class ReservationSummary(_serialization.Model): :vartype cancelled_count: float :ivar processing_count: The number of reservation in Processing state. :vartype processing_count: float + :ivar warning_count: The number of reservation in Warning state. + :vartype warning_count: float + :ivar no_benefit_count: The number of reservation in NoBenefit state. + :vartype no_benefit_count: float """ _validation = { @@ -3596,6 +3962,8 @@ class ReservationSummary(_serialization.Model): "pending_count": {"readonly": True}, "cancelled_count": {"readonly": True}, "processing_count": {"readonly": True}, + "warning_count": {"readonly": True}, + "no_benefit_count": {"readonly": True}, } _attribute_map = { @@ -3606,9 +3974,11 @@ class ReservationSummary(_serialization.Model): "pending_count": {"key": "pendingCount", "type": "float"}, "cancelled_count": {"key": "cancelledCount", "type": "float"}, "processing_count": {"key": "processingCount", "type": "float"}, + "warning_count": {"key": "warningCount", "type": "float"}, + "no_benefit_count": {"key": "noBenefitCount", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.succeeded_count = None @@ -3618,17 +3988,19 @@ def __init__(self, **kwargs): self.pending_count = None self.cancelled_count = None self.processing_count = None + self.warning_count = None + self.no_benefit_count = None class ReservationSwapProperties(_serialization.Model): - """ReservationSwapProperties. + """Properties of reservation swap. - :ivar swap_source: Resource Id of the Source Reservation that gets swapped. Format of the - resource Id is + :ivar swap_source: Resource id of the source reservation that gets swapped. Format of the + resource id is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :vartype swap_source: str - :ivar swap_destination: Reservation Resource Id that the original resource gets swapped to. - Format of the resource Id is + :ivar swap_destination: Reservation resource id that the original resource gets swapped to. + Format of the resource id is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :vartype swap_destination: str """ @@ -3638,14 +4010,16 @@ class ReservationSwapProperties(_serialization.Model): "swap_destination": {"key": "swapDestination", "type": "str"}, } - def __init__(self, *, swap_source: Optional[str] = None, swap_destination: Optional[str] = None, **kwargs): + def __init__( + self, *, swap_source: Optional[str] = None, swap_destination: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword swap_source: Resource Id of the Source Reservation that gets swapped. Format of the - resource Id is + :keyword swap_source: Resource id of the source reservation that gets swapped. Format of the + resource id is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :paramtype swap_source: str - :keyword swap_destination: Reservation Resource Id that the original resource gets swapped to. - Format of the resource Id is + :keyword swap_destination: Reservation resource id that the original resource gets swapped to. + Format of the resource id is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. :paramtype swap_destination: str """ @@ -3657,11 +4031,11 @@ def __init__(self, *, swap_source: Optional[str] = None, swap_destination: Optio class ReservationToExchange(_serialization.Model): """Reservation refund details. - :ivar reservation_id: Fully qualified id of the Reservation being returned. + :ivar reservation_id: Fully qualified id of the reservation being returned. :vartype reservation_id: str :ivar quantity: Quantity to be returned. :vartype quantity: int - :ivar billing_refund_amount: + :ivar billing_refund_amount: Pricing information containing the amount and the currency code. :vartype billing_refund_amount: ~azure.mgmt.reservations.models.Price :ivar billing_information: billing information. :vartype billing_information: ~azure.mgmt.reservations.models.BillingInformation @@ -3681,14 +4055,15 @@ def __init__( quantity: Optional[int] = None, billing_refund_amount: Optional["_models.Price"] = None, billing_information: Optional["_models.BillingInformation"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword reservation_id: Fully qualified id of the Reservation being returned. + :keyword reservation_id: Fully qualified id of the reservation being returned. :paramtype reservation_id: str :keyword quantity: Quantity to be returned. :paramtype quantity: int - :keyword billing_refund_amount: + :keyword billing_refund_amount: Pricing information containing the amount and the currency + code. :paramtype billing_refund_amount: ~azure.mgmt.reservations.models.Price :keyword billing_information: billing information. :paramtype billing_information: ~azure.mgmt.reservations.models.BillingInformation @@ -3703,9 +4078,9 @@ def __init__( class ReservationToPurchaseCalculateExchange(_serialization.Model): """Reservation purchase details. - :ivar properties: + :ivar properties: The request for reservation purchase. :vartype properties: ~azure.mgmt.reservations.models.PurchaseRequest - :ivar billing_currency_total: + :ivar billing_currency_total: Pricing information containing the amount and the currency code. :vartype billing_currency_total: ~azure.mgmt.reservations.models.Price """ @@ -3719,12 +4094,13 @@ def __init__( *, properties: Optional["_models.PurchaseRequest"] = None, billing_currency_total: Optional["_models.Price"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword properties: + :keyword properties: The request for reservation purchase. :paramtype properties: ~azure.mgmt.reservations.models.PurchaseRequest - :keyword billing_currency_total: + :keyword billing_currency_total: Pricing information containing the amount and the currency + code. :paramtype billing_currency_total: ~azure.mgmt.reservations.models.Price """ super().__init__(**kwargs) @@ -3735,14 +4111,14 @@ def __init__( class ReservationToPurchaseExchange(_serialization.Model): """Reservation purchase details. - :ivar reservation_order_id: Fully qualified id of the ReservationOrder being purchased. + :ivar reservation_order_id: Fully qualified id of the reservationOrder being purchased. :vartype reservation_order_id: str - :ivar reservation_id: Fully qualified id of the Reservation being purchased. This value is only + :ivar reservation_id: Fully qualified id of the reservation being purchased. This value is only guaranteed to be non-null if the purchase is successful. :vartype reservation_id: str - :ivar properties: + :ivar properties: The request for reservation purchase. :vartype properties: ~azure.mgmt.reservations.models.PurchaseRequest - :ivar billing_currency_total: + :ivar billing_currency_total: Pricing information containing the amount and the currency code. :vartype billing_currency_total: ~azure.mgmt.reservations.models.Price :ivar status: Status of the individual operation. Known values are: "Succeeded", "Failed", "Cancelled", and "Pending". @@ -3765,17 +4141,18 @@ def __init__( properties: Optional["_models.PurchaseRequest"] = None, billing_currency_total: Optional["_models.Price"] = None, status: Optional[Union[str, "_models.OperationStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword reservation_order_id: Fully qualified id of the ReservationOrder being purchased. + :keyword reservation_order_id: Fully qualified id of the reservationOrder being purchased. :paramtype reservation_order_id: str - :keyword reservation_id: Fully qualified id of the Reservation being purchased. This value is + :keyword reservation_id: Fully qualified id of the reservation being purchased. This value is only guaranteed to be non-null if the purchase is successful. :paramtype reservation_id: str - :keyword properties: + :keyword properties: The request for reservation purchase. :paramtype properties: ~azure.mgmt.reservations.models.PurchaseRequest - :keyword billing_currency_total: + :keyword billing_currency_total: Pricing information containing the amount and the currency + code. :paramtype billing_currency_total: ~azure.mgmt.reservations.models.Price :keyword status: Status of the individual operation. Known values are: "Succeeded", "Failed", "Cancelled", and "Pending". @@ -3792,7 +4169,7 @@ def __init__( class ReservationToReturn(_serialization.Model): """Reservation to return. - :ivar reservation_id: Fully qualified identifier of the Reservation being returned. + :ivar reservation_id: Fully qualified identifier of the reservation being returned. :vartype reservation_id: str :ivar quantity: Quantity to be returned. Must be greater than zero. :vartype quantity: int @@ -3803,9 +4180,9 @@ class ReservationToReturn(_serialization.Model): "quantity": {"key": "quantity", "type": "int"}, } - def __init__(self, *, reservation_id: Optional[str] = None, quantity: Optional[int] = None, **kwargs): + def __init__(self, *, reservation_id: Optional[str] = None, quantity: Optional[int] = None, **kwargs: Any) -> None: """ - :keyword reservation_id: Fully qualified identifier of the Reservation being returned. + :keyword reservation_id: Fully qualified identifier of the reservation being returned. :paramtype reservation_id: str :keyword quantity: Quantity to be returned. Must be greater than zero. :paramtype quantity: int @@ -3818,11 +4195,11 @@ def __init__(self, *, reservation_id: Optional[str] = None, quantity: Optional[i class ReservationToReturnForExchange(_serialization.Model): """Reservation refund details. - :ivar reservation_id: Fully qualified id of the Reservation being returned. + :ivar reservation_id: Fully qualified id of the reservation being returned. :vartype reservation_id: str :ivar quantity: Quantity to be returned. :vartype quantity: int - :ivar billing_refund_amount: + :ivar billing_refund_amount: Pricing information containing the amount and the currency code. :vartype billing_refund_amount: ~azure.mgmt.reservations.models.Price :ivar billing_information: billing information. :vartype billing_information: ~azure.mgmt.reservations.models.BillingInformation @@ -3847,14 +4224,15 @@ def __init__( billing_refund_amount: Optional["_models.Price"] = None, billing_information: Optional["_models.BillingInformation"] = None, status: Optional[Union[str, "_models.OperationStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword reservation_id: Fully qualified id of the Reservation being returned. + :keyword reservation_id: Fully qualified id of the reservation being returned. :paramtype reservation_id: str :keyword quantity: Quantity to be returned. :paramtype quantity: int - :keyword billing_refund_amount: + :keyword billing_refund_amount: Pricing information containing the amount and the currency + code. :paramtype billing_refund_amount: ~azure.mgmt.reservations.models.Price :keyword billing_information: billing information. :paramtype billing_information: ~azure.mgmt.reservations.models.BillingInformation @@ -3899,7 +4277,7 @@ class ReservationUtilizationAggregates(_serialization.Model): "value_unit": {"key": "valueUnit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.grain = None @@ -3928,7 +4306,7 @@ class ResourceName(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Resource name. :paramtype value: str @@ -3938,8 +4316,184 @@ def __init__(self, *, value: Optional[str] = None, **kwargs): self.localized_value = None +class SavingsPlanPurchaseRequest(_serialization.Model): + """Request body for savings plan purchase. + + :ivar sku: The name of sku. + :vartype sku: ~azure.mgmt.reservations.models.SkuName + :ivar display_name: Friendly name of the savings plan. + :vartype display_name: str + :ivar billing_scope_id: Subscription that will be charged for purchasing reservation or savings + plan. + :vartype billing_scope_id: str + :ivar term: Represent savings plan term in ISO 8601 format. Known values are: "P1Y" and "P3Y". + :vartype term: str or ~azure.mgmt.reservations.models.SavingsPlanTerm + :ivar billing_plan: Represents the billing plan in ISO 8601 format. Required only for monthly + billing plans. "P1M" + :vartype billing_plan: str or ~azure.mgmt.reservations.models.BillingPlan + :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and + "ManagementGroup". + :vartype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType + :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not + applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is + ManagementGroup. + :vartype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties + :ivar commitment: Commitment towards the benefit. + :vartype commitment: ~azure.mgmt.reservations.models.Commitment + """ + + _attribute_map = { + "sku": {"key": "sku", "type": "SkuName"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "billing_scope_id": {"key": "properties.billingScopeId", "type": "str"}, + "term": {"key": "properties.term", "type": "str"}, + "billing_plan": {"key": "properties.billingPlan", "type": "str"}, + "applied_scope_type": {"key": "properties.appliedScopeType", "type": "str"}, + "applied_scope_properties": {"key": "properties.appliedScopeProperties", "type": "AppliedScopeProperties"}, + "commitment": {"key": "properties.commitment", "type": "Commitment"}, + } + + def __init__( + self, + *, + sku: Optional["_models.SkuName"] = None, + display_name: Optional[str] = None, + billing_scope_id: Optional[str] = None, + term: Optional[Union[str, "_models.SavingsPlanTerm"]] = None, + billing_plan: Optional[Union[str, "_models.BillingPlan"]] = None, + applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None, + applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None, + commitment: Optional["_models.Commitment"] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: The name of sku. + :paramtype sku: ~azure.mgmt.reservations.models.SkuName + :keyword display_name: Friendly name of the savings plan. + :paramtype display_name: str + :keyword billing_scope_id: Subscription that will be charged for purchasing reservation or + savings plan. + :paramtype billing_scope_id: str + :keyword term: Represent savings plan term in ISO 8601 format. Known values are: "P1Y" and + "P3Y". + :paramtype term: str or ~azure.mgmt.reservations.models.SavingsPlanTerm + :keyword billing_plan: Represents the billing plan in ISO 8601 format. Required only for + monthly billing plans. "P1M" + :paramtype billing_plan: str or ~azure.mgmt.reservations.models.BillingPlan + :keyword applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", + and "ManagementGroup". + :paramtype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType + :keyword applied_scope_properties: Properties specific to applied scope type. Not required if + not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType + is ManagementGroup. + :paramtype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties + :keyword commitment: Commitment towards the benefit. + :paramtype commitment: ~azure.mgmt.reservations.models.Commitment + """ + super().__init__(**kwargs) + self.sku = sku + self.display_name = display_name + self.billing_scope_id = billing_scope_id + self.term = term + self.billing_plan = billing_plan + self.applied_scope_type = applied_scope_type + self.applied_scope_properties = applied_scope_properties + self.commitment = commitment + + +class SavingsPlanToPurchaseCalculateExchange(_serialization.Model): + """Savings plan purchase details. + + :ivar properties: Request body for savings plan purchase. + :vartype properties: ~azure.mgmt.reservations.models.SavingsPlanPurchaseRequest + :ivar billing_currency_total: Pricing information containing the amount and the currency code. + :vartype billing_currency_total: ~azure.mgmt.reservations.models.Price + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "SavingsPlanPurchaseRequest"}, + "billing_currency_total": {"key": "billingCurrencyTotal", "type": "Price"}, + } + + def __init__( + self, + *, + properties: Optional["_models.SavingsPlanPurchaseRequest"] = None, + billing_currency_total: Optional["_models.Price"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Request body for savings plan purchase. + :paramtype properties: ~azure.mgmt.reservations.models.SavingsPlanPurchaseRequest + :keyword billing_currency_total: Pricing information containing the amount and the currency + code. + :paramtype billing_currency_total: ~azure.mgmt.reservations.models.Price + """ + super().__init__(**kwargs) + self.properties = properties + self.billing_currency_total = billing_currency_total + + +class SavingsPlanToPurchaseExchange(_serialization.Model): + """Savings plan purchase details. + + :ivar savings_plan_order_id: Fully qualified id of the savings plan order being purchased. + :vartype savings_plan_order_id: str + :ivar savings_plan_id: Fully qualified id of the savings plan being purchased. This value is + only guaranteed to be non-null if the purchase is successful. + :vartype savings_plan_id: str + :ivar properties: Request body for savings plan purchase. + :vartype properties: ~azure.mgmt.reservations.models.SavingsPlanPurchaseRequest + :ivar billing_currency_total: Pricing information containing the amount and the currency code. + :vartype billing_currency_total: ~azure.mgmt.reservations.models.Price + :ivar status: Status of the individual operation. Known values are: "Succeeded", "Failed", + "Cancelled", and "Pending". + :vartype status: str or ~azure.mgmt.reservations.models.OperationStatus + """ + + _attribute_map = { + "savings_plan_order_id": {"key": "savingsPlanOrderId", "type": "str"}, + "savings_plan_id": {"key": "savingsPlanId", "type": "str"}, + "properties": {"key": "properties", "type": "SavingsPlanPurchaseRequest"}, + "billing_currency_total": {"key": "billingCurrencyTotal", "type": "Price"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + savings_plan_order_id: Optional[str] = None, + savings_plan_id: Optional[str] = None, + properties: Optional["_models.SavingsPlanPurchaseRequest"] = None, + billing_currency_total: Optional["_models.Price"] = None, + status: Optional[Union[str, "_models.OperationStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword savings_plan_order_id: Fully qualified id of the savings plan order being purchased. + :paramtype savings_plan_order_id: str + :keyword savings_plan_id: Fully qualified id of the savings plan being purchased. This value is + only guaranteed to be non-null if the purchase is successful. + :paramtype savings_plan_id: str + :keyword properties: Request body for savings plan purchase. + :paramtype properties: ~azure.mgmt.reservations.models.SavingsPlanPurchaseRequest + :keyword billing_currency_total: Pricing information containing the amount and the currency + code. + :paramtype billing_currency_total: ~azure.mgmt.reservations.models.Price + :keyword status: Status of the individual operation. Known values are: "Succeeded", "Failed", + "Cancelled", and "Pending". + :paramtype status: str or ~azure.mgmt.reservations.models.OperationStatus + """ + super().__init__(**kwargs) + self.savings_plan_order_id = savings_plan_order_id + self.savings_plan_id = savings_plan_id + self.properties = properties + self.billing_currency_total = billing_currency_total + self.status = status + + class ScopeProperties(_serialization.Model): - """ScopeProperties. + """The scope and whether it is valid. :ivar scope: :vartype scope: str @@ -3952,7 +4506,7 @@ class ScopeProperties(_serialization.Model): "valid": {"key": "valid", "type": "bool"}, } - def __init__(self, *, scope: Optional[str] = None, valid: Optional[bool] = None, **kwargs): + def __init__(self, *, scope: Optional[str] = None, valid: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword scope: :paramtype scope: str @@ -3987,7 +4541,7 @@ class ServiceError(_serialization.Model): "details": {"key": "details", "type": "[ServiceErrorDetail]"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: The error code. :paramtype code: str @@ -4021,7 +4575,7 @@ class ServiceErrorDetail(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -4029,7 +4583,7 @@ def __init__(self, **kwargs): class SkuCapability(_serialization.Model): - """SkuCapability. + """Capability of a sku. :ivar name: An invariant to describe the feature. :vartype name: str @@ -4042,7 +4596,7 @@ class SkuCapability(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: An invariant to describe the feature. :paramtype name: str @@ -4055,7 +4609,7 @@ def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, * class SkuName(_serialization.Model): - """SkuName. + """The name of sku. :ivar name: :vartype name: str @@ -4065,7 +4619,7 @@ class SkuName(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: :paramtype name: str @@ -4075,7 +4629,7 @@ def __init__(self, *, name: Optional[str] = None, **kwargs): class SkuProperty(_serialization.Model): - """SkuProperty. + """Property of a sku. :ivar name: An invariant to describe the feature. :vartype name: str @@ -4088,7 +4642,7 @@ class SkuProperty(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: An invariant to describe the feature. :paramtype name: str @@ -4101,12 +4655,12 @@ def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, * class SkuRestriction(_serialization.Model): - """SkuRestriction. + """Restriction of a sku. :ivar type: The type of restrictions. :vartype type: str :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. + be different locations where the sku is restricted. :vartype values: list[str] :ivar reason_code: The reason for restriction. :vartype reason_code: str @@ -4124,13 +4678,13 @@ def __init__( type: Optional[str] = None, values: Optional[List[str]] = None, reason_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of restrictions. :paramtype type: str :keyword values: The value of restrictions. If the restriction type is set to location. This - would be different locations where the SKU is restricted. + would be different locations where the sku is restricted. :paramtype values: list[str] :keyword reason_code: The reason for restriction. :paramtype reason_code: str @@ -4142,7 +4696,7 @@ def __init__( class SplitRequest(_serialization.Model): - """SplitRequest. + """The request for reservation split. :ivar quantities: List of the quantities in the new reservations to create. :vartype quantities: list[int] @@ -4157,7 +4711,9 @@ class SplitRequest(_serialization.Model): "reservation_id": {"key": "properties.reservationId", "type": "str"}, } - def __init__(self, *, quantities: Optional[List[int]] = None, reservation_id: Optional[str] = None, **kwargs): + def __init__( + self, *, quantities: Optional[List[int]] = None, reservation_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword quantities: List of the quantities in the new reservations to create. :paramtype quantities: list[int] @@ -4217,8 +4773,8 @@ def __init__( name: Optional["_models.ResourceName"] = None, unit: Optional[str] = None, provisioning_state: Optional[Union[str, "_models.QuotaRequestState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The resource name. :paramtype name: ~azure.mgmt.reservations.models.ResourceName @@ -4240,7 +4796,7 @@ def __init__( class SubscriptionScopeProperties(_serialization.Model): - """SubscriptionScopeProperties. + """The scopes checked by the available scope api. :ivar scopes: :vartype scopes: list[~azure.mgmt.reservations.models.ScopeProperties] @@ -4250,7 +4806,7 @@ class SubscriptionScopeProperties(_serialization.Model): "scopes": {"key": "scopes", "type": "[ScopeProperties]"}, } - def __init__(self, *, scopes: Optional[List["_models.ScopeProperties"]] = None, **kwargs): + def __init__(self, *, scopes: Optional[List["_models.ScopeProperties"]] = None, **kwargs: Any) -> None: """ :keyword scopes: :paramtype scopes: list[~azure.mgmt.reservations.models.ScopeProperties] @@ -4296,8 +4852,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py index 9a9d4b9202db..81344fc6ab41 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +17,7 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -47,12 +48,15 @@ def build_get_catalog_request( publisher_id: Optional[str] = None, offer_id: Optional[str] = None, plan_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[float] = None, + take: Optional[float] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,6 +79,12 @@ def build_get_catalog_request( _params["offerId"] = _SERIALIZER.query("offer_id", offer_id, "str") if plan_id is not None: _params["planId"] = _SERIALIZER.query("plan_id", plan_id, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "float") + if take is not None: + _params["$take"] = _SERIALIZER.query("take", take, "float") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -86,7 +96,7 @@ def build_get_applied_reservation_list_request(subscription_id: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,8 +128,11 @@ def get_catalog( publisher_id: Optional[str] = None, offer_id: Optional[str] = None, plan_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[float] = None, + take: Optional[float] = None, **kwargs: Any - ) -> List[_models.Catalog]: + ) -> Iterable["_models.Catalog"]: """Get the regions and skus that are available for RI purchase for the specified Azure subscription. @@ -132,7 +145,7 @@ def get_catalog( Default value is None. :type reserved_resource_type: str :param location: Filters the skus based on the location specified in this parameter. This can - be an azure region or global. Default value is None. + be an Azure region or global. Default value is None. :type location: str :param publisher_id: Publisher id used to get the third party products. Default value is None. :type publisher_id: str @@ -140,11 +153,25 @@ def get_catalog( :type offer_id: str :param plan_id: Plan id used to get the third party products. Default value is None. :type plan_id: str + :param filter: May be used to filter by Catalog properties. The filter supports 'eq', 'or', and + 'and'. Default value is None. + :type filter: str + :param skip: The number of reservations to skip from the list before returning results. Default + value is None. + :type skip: float + :param take: To number of reservations to return. Default value is None. + :type take: float :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Catalog or the result of cls(response) - :rtype: list[~azure.mgmt.reservations.models.Catalog] + :return: An iterator like instance of either Catalog or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.reservations.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + cls: ClsType[_models.CatalogsResult] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -153,44 +180,57 @@ def get_catalog( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) - cls: ClsType[List[_models.Catalog]] = kwargs.pop("cls", None) - - request = build_get_catalog_request( - subscription_id=subscription_id, - reserved_resource_type=reserved_resource_type, - location=location, - publisher_id=publisher_id, - offer_id=offer_id, - plan_id=plan_id, - api_version=api_version, - template_url=self.get_catalog.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[Catalog]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + def prepare_request(next_link=None): + if not next_link: + + request = build_get_catalog_request( + subscription_id=subscription_id, + reserved_resource_type=reserved_resource_type, + location=location, + publisher_id=publisher_id, + offer_id=offer_id, + plan_id=plan_id, + filter=filter, + skip=skip, + take=take, + api_version=api_version, + template_url=self.get_catalog.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CatalogsResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) get_catalog.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs"} @@ -219,7 +259,7 @@ def get_applied_reservation_list(self, subscription_id: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.AppliedReservations] = kwargs.pop("cls", None) request = build_get_applied_reservation_list_request( diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py index 481fbf6b1e7d..6cd2da2deebb 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py @@ -45,7 +45,7 @@ def build_post_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96,7 +96,7 @@ def _post_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.CalculateExchangeOperationResultResponse]] = kwargs.pop("cls", None) @@ -237,7 +237,7 @@ def begin_post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CalculateExchangeOperationResultResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py index 425ae4fb9845..f2881e9be3aa 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py @@ -43,7 +43,7 @@ def build_post_request(reservation_order_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +166,7 @@ def post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CalculateRefundResponse] = kwargs.pop("cls", None) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py index 3196c70a8e9f..5c3d35fc4762 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py @@ -45,7 +45,7 @@ def build_post_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96,7 +96,7 @@ def _post_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ExchangeOperationResultResponse]] = kwargs.pop("cls", None) @@ -237,7 +237,7 @@ def begin_post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExchangeOperationResultResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py index 857a165369f1..bf3b599edaa0 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py @@ -44,7 +44,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationResponse"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py index 85636cb5ffc7..ea8080c32a3a 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py @@ -353,7 +353,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[LROPoller[_models.CurrentQuotaLimitBase], LROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> LROPoller[_models.CurrentQuotaLimitBase]: """Create or update the quota (service limits) of a resource to the requested value. Steps: @@ -405,7 +405,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[LROPoller[_models.CurrentQuotaLimitBase], LROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> LROPoller[_models.CurrentQuotaLimitBase]: """Create or update the quota (service limits) of a resource to the requested value. Steps: @@ -455,7 +455,7 @@ def begin_create_or_update( resource_name: str, create_quota_request: Union[_models.CurrentQuotaLimitBase, IO], **kwargs: Any - ) -> Union[LROPoller[_models.CurrentQuotaLimitBase], LROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> LROPoller[_models.CurrentQuotaLimitBase]: """Create or update the quota (service limits) of a resource to the requested value. Steps: @@ -635,7 +635,7 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[LROPoller[_models.CurrentQuotaLimitBase], LROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> LROPoller[_models.CurrentQuotaLimitBase]: """Update the quota (service limits) of this resource to the requested value. • To get the quota information for specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a new value. @@ -684,7 +684,7 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[LROPoller[_models.CurrentQuotaLimitBase], LROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> LROPoller[_models.CurrentQuotaLimitBase]: """Update the quota (service limits) of this resource to the requested value. • To get the quota information for specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a new value. @@ -731,7 +731,7 @@ def begin_update( resource_name: str, create_quota_request: Union[_models.CurrentQuotaLimitBase, IO], **kwargs: Any - ) -> Union[LROPoller[_models.CurrentQuotaLimitBase], LROPoller[_models.QuotaRequestSubmitResponse201]]: + ) -> LROPoller[_models.CurrentQuotaLimitBase]: """Update the quota (service limits) of this resource to the requested value. • To get the quota information for specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a new value. diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py index 0eec5d1ea4e2..f7c679bacfc6 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py @@ -46,7 +46,7 @@ def build_available_scopes_request(reservation_order_id: str, reservation_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -77,7 +77,7 @@ def build_split_request(reservation_order_id: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -104,7 +104,7 @@ def build_merge_request(reservation_order_id: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_list_request(reservation_order_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,12 +154,12 @@ def build_list_request(reservation_order_id: str, **kwargs: Any) -> HttpRequest: def build_get_request( - reservation_id: str, reservation_order_id: str, *, expand: Optional[str] = None, **kwargs: Any + reservation_order_id: str, reservation_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,8 +168,8 @@ def build_get_request( "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", ) # pylint: disable=line-too-long path_format_arguments = { - "reservationId": _SERIALIZER.url("reservation_id", reservation_id, "str"), "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, "str"), + "reservationId": _SERIALIZER.url("reservation_id", reservation_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -177,7 +177,7 @@ def build_get_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if expand is not None: - _params["expand"] = _SERIALIZER.query("expand", expand, "str") + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -189,7 +189,7 @@ def build_update_request(reservation_order_id: str, reservation_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +220,7 @@ def build_archive_request(reservation_order_id: str, reservation_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +248,7 @@ def build_unarchive_request(reservation_order_id: str, reservation_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -272,11 +272,11 @@ def build_unarchive_request(reservation_order_id: str, reservation_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_revisions_request(reservation_id: str, reservation_order_id: str, **kwargs: Any) -> HttpRequest: +def build_list_revisions_request(reservation_order_id: str, reservation_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,8 +285,8 @@ def build_list_revisions_request(reservation_id: str, reservation_order_id: str, "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions", ) # pylint: disable=line-too-long path_format_arguments = { - "reservationId": _SERIALIZER.url("reservation_id", reservation_id, "str"), "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, "str"), + "reservationId": _SERIALIZER.url("reservation_id", reservation_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -313,7 +313,7 @@ def build_list_all_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +377,7 @@ def _available_scopes_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableScopeProperties] = kwargs.pop("cls", None) @@ -437,13 +437,13 @@ def begin_available_scopes( ) -> LROPoller[_models.AvailableScopeProperties]: """Get Available Scopes for ``Reservation``. - Get Available Scopes for ``Reservation``. + Check whether the scopes from request is valid for ``Reservation``. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Required. + :param body: Scopes to be checked for eligibility. Required. :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -474,13 +474,13 @@ def begin_available_scopes( ) -> LROPoller[_models.AvailableScopeProperties]: """Get Available Scopes for ``Reservation``. - Get Available Scopes for ``Reservation``. + Check whether the scopes from request is valid for ``Reservation``. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Required. + :param body: Scopes to be checked for eligibility. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -509,13 +509,14 @@ def begin_available_scopes( ) -> LROPoller[_models.AvailableScopeProperties]: """Get Available Scopes for ``Reservation``. - Get Available Scopes for ``Reservation``. + Check whether the scopes from request is valid for ``Reservation``. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Is either a model type or a IO type. Required. + :param body: Scopes to be checked for eligibility. Is either a model type or a IO type. + Required. :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -536,7 +537,7 @@ def begin_available_scopes( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableScopeProperties] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -595,7 +596,7 @@ def _split_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[List[_models.ReservationResponse]]] = kwargs.pop("cls", None) @@ -632,11 +633,16 @@ def _split_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("[ReservationResponse]", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -740,7 +746,7 @@ def begin_split( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ReservationResponse]] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -798,7 +804,7 @@ def _merge_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[List[_models.ReservationResponse]]] = kwargs.pop("cls", None) @@ -835,11 +841,16 @@ def _merge_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("[ReservationResponse]", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -946,7 +957,7 @@ def begin_merge( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ReservationResponse]] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1006,7 +1017,7 @@ def list(self, reservation_order_id: str, **kwargs: Any) -> Iterable["_models.Re _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationList] = kwargs.pop("cls", None) error_map = { @@ -1065,16 +1076,16 @@ def get_next(next_link=None): @distributed_trace def get( - self, reservation_id: str, reservation_order_id: str, expand: Optional[str] = None, **kwargs: Any + self, reservation_order_id: str, reservation_id: str, expand: Optional[str] = None, **kwargs: Any ) -> _models.ReservationResponse: """Get ``Reservation`` details. Get specific ``Reservation`` details. - :param reservation_id: Id of the Reservation Item. Required. - :type reservation_id: str :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str + :param reservation_id: Id of the reservation item. Required. + :type reservation_id: str :param expand: Supported value of this query is renewProperties. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1093,12 +1104,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationResponse] = kwargs.pop("cls", None) request = build_get_request( - reservation_id=reservation_id, reservation_order_id=reservation_order_id, + reservation_id=reservation_id, expand=expand, api_version=api_version, template_url=self.get.metadata["url"], @@ -1144,7 +1155,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ReservationResponse]] = kwargs.pop("cls", None) @@ -1182,11 +1193,19 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ReservationResponse", pipeline_response) + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -1210,7 +1229,7 @@ def begin_update( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :param parameters: Information needed to patch a reservation item. Required. :type parameters: ~azure.mgmt.reservations.models.Patch @@ -1247,7 +1266,7 @@ def begin_update( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :param parameters: Information needed to patch a reservation item. Required. :type parameters: IO @@ -1278,7 +1297,7 @@ def begin_update( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :param parameters: Information needed to patch a reservation item. Is either a model type or a IO type. Required. @@ -1302,7 +1321,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ReservationResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1329,7 +1348,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1357,7 +1378,7 @@ def archive( # pylint: disable=inconsistent-return-statements :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -1375,7 +1396,7 @@ def archive( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_archive_request( @@ -1413,11 +1434,11 @@ def unarchive( # pylint: disable=inconsistent-return-statements ) -> None: """Unarchive a ``Reservation``. - Unarchiving a ``Reservation`` moves it to the state it was before archiving. + Restores a ``Reservation`` to the state it was before archiving. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item. Required. + :param reservation_id: Id of the reservation item. Required. :type reservation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -1435,7 +1456,7 @@ def unarchive( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_unarchive_request( @@ -1469,16 +1490,16 @@ def unarchive( # pylint: disable=inconsistent-return-statements @distributed_trace def list_revisions( - self, reservation_id: str, reservation_order_id: str, **kwargs: Any + self, reservation_order_id: str, reservation_id: str, **kwargs: Any ) -> Iterable["_models.ReservationResponse"]: """Get ``Reservation`` revisions. List of all the revisions for the ``Reservation``. - :param reservation_id: Id of the Reservation Item. Required. - :type reservation_id: str :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str + :param reservation_id: Id of the reservation item. Required. + :type reservation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReservationResponse or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.reservations.models.ReservationResponse] @@ -1487,7 +1508,7 @@ def list_revisions( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationList] = kwargs.pop("cls", None) error_map = { @@ -1502,8 +1523,8 @@ def prepare_request(next_link=None): if not next_link: request = build_list_revisions_request( - reservation_id=reservation_id, reservation_order_id=reservation_order_id, + reservation_id=reservation_id, api_version=api_version, template_url=self.list_revisions.metadata["url"], headers=_headers, @@ -1564,9 +1585,9 @@ def list_all( :param filter: May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, - displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, - reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}. Default - value is None. + displayProvisioningState, effectiveDateTime, expiryDate, expiryDateTime, provisioningState, + quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + userFriendlyRenewState}. Default value is None. :type filter: str :param orderby: May be used to sort order by reservation properties. Default value is None. :type orderby: str @@ -1588,7 +1609,7 @@ def list_all( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationsListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py index 085c65f341ad..e9015230bf9b 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py @@ -46,7 +46,7 @@ def build_calculate_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -68,7 +68,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_purchase_request(reservation_order_id: str, **kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -114,7 +114,7 @@ def build_get_request(reservation_order_id: str, *, expand: Optional[str] = None _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +140,7 @@ def build_change_directory_request(reservation_order_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -250,7 +250,7 @@ def calculate(self, body: Union[_models.PurchaseRequest, IO], **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CalculatePriceResponse] = kwargs.pop("cls", None) @@ -309,7 +309,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ReservationOrderResponse"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationOrderList] = kwargs.pop("cls", None) error_map = { @@ -379,7 +379,7 @@ def _purchase_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) @@ -415,14 +415,18 @@ def _purchase_initial( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -523,7 +527,7 @@ def begin_purchase( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -595,7 +599,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -711,7 +715,7 @@ def change_directory( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ChangeDirectoryResponse] = kwargs.pop("cls", None) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py index a535832781ab..83fbadec45d9 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,10 +19,12 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer @@ -43,7 +45,7 @@ def build_post_request(reservation_order_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -85,18 +87,80 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def _post_initial( + self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any + ) -> _models.RefundResponse: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RefundRequest") + + request = build_post_request( + reservation_order_id=reservation_order_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("RefundResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _post_initial.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} + @overload - def post( + def begin_post( self, reservation_order_id: str, body: _models.RefundRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RefundResponse: + ) -> LROPoller[_models.RefundResponse]: """Return a reservation. - Return a reservation. + Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str @@ -106,18 +170,26 @@ def post( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RefundResponse or the result of cls(response) - :rtype: ~azure.mgmt.reservations.models.RefundResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RefundResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def post( + def begin_post( self, reservation_order_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RefundResponse: + ) -> LROPoller[_models.RefundResponse]: """Return a reservation. - Return a reservation. + Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str @@ -127,18 +199,26 @@ def post( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RefundResponse or the result of cls(response) - :rtype: ~azure.mgmt.reservations.models.RefundResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RefundResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def post( + def begin_post( self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any - ) -> _models.RefundResponse: + ) -> LROPoller[_models.RefundResponse]: """Return a reservation. - Return a reservation. + Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str @@ -149,65 +229,65 @@ def post( Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RefundResponse or the result of cls(response) - :rtype: ~azure.mgmt.reservations.models.RefundResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RefundResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._post_initial( + reservation_order_id=reservation_order_id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("RefundResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - _json = self._serialize.body(body, "RefundRequest") - - request = build_post_request( - reservation_order_id=reservation_order_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.post.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("RefundResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - post.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_post.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/archive.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/archive.py index 12d28d88189c..72b6876ec37f 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/archive.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/archive.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Archive.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_exchange.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_exchange.py index 16f3849c0cec..f9e48e7b3d35 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_exchange.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_exchange.py @@ -55,12 +55,27 @@ def main(): "sku": {"name": "Standard_B1ls"}, } ], + "savingsPlansToPurchase": [ + { + "properties": { + "appliedScopeProperties": { + "resourceGroupId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg" + }, + "appliedScopeType": "Single", + "billingScopeId": "/subscriptions/10000000-0000-0000-0000-000000000000", + "commitment": {"amount": 15.23, "currencyCode": "USD", "grain": "Hourly"}, + "displayName": "ComputeSavingsPlan", + "term": "P1Y", + }, + "sku": {"name": "Compute_Savings_Plan"}, + } + ], } }, ).result() print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateExchange.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateExchange.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_refund.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_refund.py index db3419bb2990..93aa685f4f8d 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_refund.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_refund.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_reservation_order.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_reservation_order.py index eba871dd01fd..ab798f14b78b 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_reservation_order.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/calculate_reservation_order.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateReservationOrder.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateReservationOrder.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/change_directory_reservation_order.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/change_directory_reservation_order.py index 9c4ccffb3849..ea186f527d7f 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/change_directory_reservation_order.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/change_directory_reservation_order.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/ChangeDirectoryReservationOrder.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/ChangeDirectoryReservationOrder.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/exchange.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/exchange.py index ffead6407fb0..06330f0efa39 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/exchange.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/exchange.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Exchange.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Exchange.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_applied_reservations.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_applied_reservations.py index 343e1956615a..47a4ed365fcc 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_applied_reservations.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_applied_reservations.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetAppliedReservations.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAppliedReservations.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_available_scope.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_available_scope.py index 21c2011c642e..3e04d4091f7d 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_available_scope.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_available_scope.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetAvailableScope.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_catalog.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_catalog.py index e757bf86e9ae..175fb8882356 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_catalog.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_catalog.py @@ -31,9 +31,10 @@ def main(): response = client.get_catalog( subscription_id="23bc208b-083f-4901-ae85-4f98c0c3b4b6", ) - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetCatalog.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetCatalog.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_operations.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_operations.py index 7ca68a923df1..231e0b8f9c65 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_operations.py @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetOperations.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_details.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_details.py index d6306e33fcdd..8f9343cbad94 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_details.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_details.py @@ -29,12 +29,12 @@ def main(): ) response = client.reservation.get( - reservation_id="6ef59113-3482-40da-8d79-787f823e34bc", reservation_order_id="276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + reservation_id="6ef59113-3482-40da-8d79-787f823e34bc", ) print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationDetails.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details.py index 6a4007d2258e..26cf37d6d3c3 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetails.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetails.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details_with_expand_plan_information.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details_with_expand_plan_information.py index cc276b75bc03..8890ff2de990 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details_with_expand_plan_information.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_order_details_with_expand_plan_information.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_orders.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_orders.py index db43642aee9c..e77ec60f450a 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_orders.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_orders.py @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrders.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrders.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_revisions.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_revisions.py index 5382ef932ca2..93de7e0bac0b 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_revisions.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservation_revisions.py @@ -29,13 +29,13 @@ def main(): ) response = client.reservation.list_revisions( - reservation_id="6ef59113-3482-40da-8d79-787f823e34bc", reservation_order_id="276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + reservation_id="6ef59113-3482-40da-8d79-787f823e34bc", ) for item in response: print(item) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationRevisions.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationRevisions.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations.py index 159661f700f7..5f98fcaa6efb 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations.py @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservations.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations_from_order.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations_from_order.py index cae7546e9385..59c758aac557 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations_from_order.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_reservations_from_order.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationsFromOrder.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationsFromOrder.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/merge_reservations.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/merge_reservations.py index b27110f7be6c..9c21137aa048 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/merge_reservations.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/merge_reservations.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/MergeReservations.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/MergeReservations.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/purchase_reservation_order.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/purchase_reservation_order.py index 6e5023848976..b3b2ad0b0e62 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/purchase_reservation_order.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/purchase_reservation_order.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/PurchaseReservationOrder.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/PurchaseReservationOrder.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/return.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/return.py index 4eac73fbaf25..8fae4a796a44 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/return.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/return.py @@ -28,8 +28,8 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.return_operations.post( - reservation_order_id="276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + response = client.return_operations.begin_post( + reservation_order_id="50000000-aaaa-bbbb-cccc-100000000004", body={ "properties": { "reservationToReturn": { @@ -41,10 +41,10 @@ def main(): "sessionId": "10000000-aaaa-bbbb-cccc-200000000000", } }, - ) + ).result() print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/split_reservation.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/split_reservation.py index 11effdf3af95..f27cf34b6423 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/split_reservation.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/split_reservation.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/SplitReservation.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/SplitReservation.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/unarchive.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/unarchive.py index 1a42bb9e804f..87e76952bf14 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/unarchive.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/unarchive.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Unarchive.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json if __name__ == "__main__": main() diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/update_reservation.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/update_reservation.py index a4b0517423df..3f694f7548b0 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/update_reservation.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/update_reservation.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/UpdateReservation.json +# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md b/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md index 811e50e30e2e..ee61ad5a32ec 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 1.0.0b3 (2023-02-16) + +### Other Changes + + - Added generated samples in github repo + - Drop support for python<3.7.0 + ## 1.0.0b2 (2022-11-15) ### Features Added diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md b/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md index 333cba8a5163..8329f10ae06d 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Resource Health Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/resourcehealth) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-resourcehealth +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = MicrosoftResourceHealth(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Resource Health Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json index e86f53a0a342..d1b5bdd1d22a 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json @@ -1,11 +1,11 @@ { - "commit": "5ad969c742647212adb951f9e96858a5b2a761f9", + "commit": "51d4c24a011e300b9713179e0515fef35bf3f678", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/resourcehealth/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py index f5442c41b4c0..1f27100b3373 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py @@ -36,9 +36,8 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -53,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py index fc2016510ecd..e2ddd28c66cd 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py @@ -67,10 +67,10 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version=None, # type: Optional[str] + api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = MicrosoftResourceHealthConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py index 240df16c57f3..25467dfc00bb 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,34 +38,50 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull -_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") # Name used in context CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -75,12 +92,12 @@ def deserialize_from_text(cls, data, content_type=None): :type data: str or bytes or IO :param str content_type: The content type. """ - if hasattr(data, 'read'): + if hasattr(data, "read"): # Assume a stream data = cast(IO, data).read() if isinstance(data, bytes): - data_as_str = data.decode(encoding='utf-8-sig') + data_as_str = data.decode(encoding="utf-8-sig") else: # Explain to mypy the correct type. data_as_str = cast(str, data) @@ -116,7 +133,8 @@ def _json_attemp(data): try: return True, json.loads(data) except ValueError: - return False, None # Don't care about this one + return False, None # Don't care about this one + success, json_result = _json_attemp(data) if success: return json_result @@ -129,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -139,8 +156,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): """ # Try to use content-type from headers if available content_type = None - if 'content-type' in headers: - content_type = headers['content-type'].split(";")[0].strip().lower() + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() # Ouch, this server did not declare what it sent... # Let's guess it's JSON... # Also, since Autorest was considering that an empty body was a valid JSON, @@ -152,20 +169,22 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return cls.deserialize_from_text(body_bytes, content_type) return None + try: basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) try: - _long_type = long # type: ignore + _long_type = long # type: ignore except NameError: _long_type = int + class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" @@ -181,9 +200,11 @@ def dst(self, dt): """No daylight saving for UTC.""" return datetime.timedelta(hours=1) + try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore """Fixed offset in minutes east from UTC. Copy/pasted from Python doc @@ -197,7 +218,7 @@ def utcoffset(self, dt): return self.__offset def tzname(self, dt): - return str(self.__offset.total_seconds()/3600) + return str(self.__offset.total_seconds() / 3600) def __repr__(self): return "".format(self.tzname(None)) @@ -208,14 +229,17 @@ def dst(self, dt): def __getinitargs__(self): return (self.__offset,) + try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore _FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -276,47 +304,42 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): - cls._attribute_map['additional_properties'] = {'key': '', 'type': '{object}'} + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @classmethod def _create_xml_node(cls): - """Create XML node. - """ + """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} - return _create_xml_node( - xml_map.get('name', cls.__name__), - xml_map.get("prefix", None), - xml_map.get("ns", None) - ) + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -330,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -367,7 +397,7 @@ def my_key_transformer(key, attr_desc, value): @classmethod def _infer_class_models(cls): try: - str_models = cls.__module__.rsplit('.', 1)[0] + str_models = cls.__module__.rsplit(".", 1)[0] models = sys.modules[str_models] client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: @@ -378,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -390,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -403,16 +438,20 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = [ - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor - ] if key_extractors is None else key_extractors + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) return deserializer(cls.__name__, data, content_type=content_type) @classmethod def _flatten_subtype(cls, key, objects): - if '_subtype_map' not in cls.__dict__: + if "_subtype_map" not in cls.__dict__: return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): @@ -425,18 +464,14 @@ def _classify(cls, response, objects): We want to ignore any inherited _subtype_maps. Remove the polymorphic key from the initial data. """ - for subtype_key in cls.__dict__.get('_subtype_map', {}).keys(): + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) else: - subtype_value = xml_key_extractor( - subtype_key, - cls._attribute_map[subtype_key], - response - ) + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: # Try to match base class. Can be class name only # (bug to fix in Autorest to support x-ms-discriminator-name) @@ -444,7 +479,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -453,11 +488,7 @@ def _classify(cls, response, objects): ) break else: - _LOGGER.warning( - "Discriminator %s is absent or null, use base class %s.", - subtype_key, - cls.__name__ - ) + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) break return cls @@ -468,29 +499,40 @@ def _get_rest_key_parts(cls, attr_key): :returns: A list of RestAPI part :rtype: list """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]['key']) + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] def _decode_attribute_map_key(key): """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. + inside the received data. - :param str key: A key string from the generated code + :param str key: A key string from the generated code """ - return key.replace('\\.', '.') + return key.replace("\\.", ".") class Serializer(object): """Request object model serializer.""" - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} - - _xml_basic_types_serializers = {'bool': lambda x:str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", - 4: "Fri", 5: "Sat", 6: "Sun"} - months = {1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", - 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec"} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } validation = { "min_length": lambda x, y: len(x) < y, "max_length": lambda x, y: len(x) > y, @@ -502,26 +544,26 @@ class Serializer(object): "max_items": lambda x, y: len(x) > y, "pattern": lambda x, y: not re.match(y, x, re.UNICODE), "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0 - } + "multiple": lambda x, y: x % y != 0, + } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { - 'iso-8601': Serializer.serialize_iso, - 'rfc-1123': Serializer.serialize_rfc, - 'unix-time': Serializer.serialize_unix, - 'duration': Serializer.serialize_duration, - 'date': Serializer.serialize_date, - 'time': Serializer.serialize_time, - 'decimal': Serializer.serialize_decimal, - 'long': Serializer.serialize_long, - 'bytearray': Serializer.serialize_bytearray, - 'base64': Serializer.serialize_base64, - 'object': self.serialize_object, - '[]': self.serialize_iter, - '{}': self.serialize_dict - } - self.dependencies = dict(classes) if classes else {} + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -542,14 +584,12 @@ def _serialize(self, target_obj, data_type=None, **kwargs): class_name = target_obj.__class__.__name__ if data_type: - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) if not hasattr(target_obj, "_attribute_map"): data_type = type(target_obj).__name__ if data_type in self.basic_types.values(): - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) # Force "is_xml" kwargs if we detect a XML model try: @@ -564,10 +604,10 @@ def _serialize(self, target_obj, data_type=None, **kwargs): attributes = target_obj._attribute_map for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): continue - if attr_name == "additional_properties" and attr_desc["key"] == '': + if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: serialized.update(target_obj.additional_properties) continue @@ -575,68 +615,60 @@ def _serialize(self, target_obj, data_type=None, **kwargs): orig_attr = getattr(target_obj, attr) if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) keys = keys if isinstance(keys, list) else [keys] - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) - + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) if is_xml_model_serialization: - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) - xml_prefix = xml_desc.get('prefix', None) - xml_ns = xml_desc.get('ns', None) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if 'name' not in getattr(orig_attr, '_xml_map', {}): + if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace + if len(splitted_tag) == 2: # Namespace new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary - local_node = _create_xml_node( - xml_name, - xml_prefix, - xml_ns - ) + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format( - attr_name, class_name, str(target_obj)) + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise_with_traceback(SerializationError, msg, err) else: return serialized @@ -652,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip('[]{}') - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -668,19 +700,18 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: deserializer.key_extractors = [ rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor + last_rest_key_case_insensitive_extractor, ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback( - SerializationError, "Unable to build a model: "+str(err), err) + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) return self._serialize(data, data_type, **kwargs) @@ -695,13 +726,13 @@ def url(self, name, data, data_type, **kwargs): """ try: output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -720,27 +751,19 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [ - self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" - for d - in data - ] - if not kwargs.get('skip_quote', False): - data = [ - quote(str(d), safe='') - for d - in data - ] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] return str(self.serialize_iter(data, internal_data_type, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -756,11 +779,11 @@ def header(self, name, data, data_type, **kwargs): :raises: ValueError if data is None """ try: - if data_type in ['[str]']: + if data_type in ["[str]"]: data = ["" if d is None else d for d in data] output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) @@ -782,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -796,13 +821,11 @@ def serialize_data(self, data, data_type, **kwargs): iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: - return self.serialize_type[iter_type]( - data, data_type[1:-1], **kwargs) + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback( - SerializationError, msg.format(data, data_type), err) + raise_with_traceback(SerializationError, msg.format(data, data_type), err) else: return self._serialize(data, **kwargs) @@ -829,7 +852,7 @@ def serialize_basic(cls, data, data_type, **kwargs): custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) - if data_type == 'str': + if data_type == "str": return cls.serialize_unicode(data) return eval(data_type)(data) # nosec @@ -847,7 +870,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -886,25 +909,21 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialized.append(None) if div: - serialized = ['' if s is None else str(s) for s in serialized] + serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) - if 'xml' in serialization_ctxt or is_xml: + if "xml" in serialization_ctxt or is_xml: # XML serialization is more complicated - xml_desc = serialization_ctxt.get('xml', {}) - xml_name = xml_desc.get('name') + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") if not xml_name: - xml_name = serialization_ctxt['key'] + xml_name = serialization_ctxt["key"] # Create a wrap node if necessary (use the fact that Element and list have "append") is_wrapped = xml_desc.get("wrapped", False) node_name = xml_desc.get("itemsName", xml_name) if is_wrapped: - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) else: final_result = [] # All list elements to "local_node" @@ -912,11 +931,7 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): if isinstance(el, ET.Element): el_node = el else: - el_node = _create_xml_node( - node_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) if el is not None: # Otherwise it writes "None" :-p el_node.text = str(el) final_result.append(el_node) @@ -936,21 +951,16 @@ def serialize_dict(self, attr, dict_type, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_data( - value, dict_type, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None - if 'xml' in serialization_ctxt: + if "xml" in serialization_ctxt: # XML serialization is more complicated - xml_desc = serialization_ctxt['xml'] - xml_name = xml_desc['name'] + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) for key, value in serialized.items(): ET.SubElement(final_result, key).text = value return final_result @@ -996,8 +1006,7 @@ def serialize_object(self, attr, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_object( - value, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None return serialized @@ -1006,8 +1015,7 @@ def serialize_object(self, attr, **kwargs): serialized = [] for obj in attr: try: - serialized.append(self.serialize_object( - obj, **kwargs)) + serialized.append(self.serialize_object(obj, **kwargs)) except ValueError: pass return serialized @@ -1020,10 +1028,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1045,8 +1053,8 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr).decode('ascii') - return encoded.strip('=').replace('+', '-').replace('/', '_') + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod def serialize_decimal(attr, **kwargs): @@ -1113,16 +1121,20 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], utc.tm_mday, - Serializer.months[utc.tm_mon], utc.tm_year, - utc.tm_hour, utc.tm_min, utc.tm_sec) + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) @staticmethod def serialize_iso(attr, **kwargs): @@ -1136,19 +1148,18 @@ def serialize_iso(attr, **kwargs): attr = isodate.parse_datetime(attr) try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") - microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") if microseconds: - microseconds = '.'+microseconds + microseconds = "." + microseconds date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, - utc.tm_hour, utc.tm_min, utc.tm_sec) - return date + microseconds + 'Z' + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) @@ -1169,18 +1180,19 @@ def serialize_unix(attr, **kwargs): return attr try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") + def rest_key_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: - dict_keys = _FLATTEN.split(key) + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1191,15 +1203,16 @@ def rest_key_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) return working_data.get(key) + def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1211,30 +1224,33 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) if working_data: return attribute_key_case_insensitive_extractor(key, None, working_data) + def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - """ - key = attr_desc['key'] + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) + def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" """ - key = attr_desc['key'] + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + def attribute_key_extractor(attr, _, data): return data.get(attr) + def attribute_key_case_insensitive_extractor(attr, _, data): found_key = None lower_attr = attr.lower() @@ -1245,6 +1261,7 @@ def attribute_key_case_insensitive_extractor(attr, _, data): return data.get(found_key) + def _extract_name_from_internal_type(internal_type): """Given an internal type XML description, extract correct XML name with namespace. @@ -1253,7 +1270,7 @@ def _extract_name_from_internal_type(internal_type): :returns: A tuple XML name + namespace dict """ internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1268,17 +1285,17 @@ def xml_key_extractor(attr, attr_desc, data): if not isinstance(data, ET.Element): return None - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) # Look for a children - is_iter_type = attr_desc['type'].startswith("[") + is_iter_type = attr_desc["type"].startswith("[") is_wrapped = xml_desc.get("wrapped", False) internal_type = attr_desc.get("internalType", None) internal_type_xml_map = getattr(internal_type, "_xml_map", {}) # Integrate namespace if necessary - xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1294,15 +1311,15 @@ def xml_key_extractor(attr, attr_desc, data): # - Wrapped node # - Internal type is an enum (considered basic types) # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): children = data.findall(xml_name) # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: xml_name = _extract_name_from_internal_type(internal_type) children = data.findall(xml_name) # That's an array else: - if internal_type: # Complex type, ignore itemsName and use the complex type name + if internal_type: # Complex type, ignore itemsName and use the complex type name items_name = _extract_name_from_internal_type(internal_type) else: items_name = xml_desc.get("itemsName", xml_name) @@ -1311,21 +1328,22 @@ def xml_key_extractor(attr, attr_desc, data): if len(children) == 0: if is_iter_type: if is_wrapped: - return None # is_wrapped no node, we want None + return None # is_wrapped no node, we want None else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) + else: # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name - )) + ) + ) return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty @@ -1333,6 +1351,7 @@ def xml_key_extractor(attr, attr_desc, data): raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) return children[0] + class Deserializer(object): """Response object model deserializer. @@ -1340,37 +1359,32 @@ class Deserializer(object): :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. """ - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile( - r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' - r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { - 'iso-8601': Deserializer.deserialize_iso, - 'rfc-1123': Deserializer.deserialize_rfc, - 'unix-time': Deserializer.deserialize_unix, - 'duration': Deserializer.deserialize_duration, - 'date': Deserializer.deserialize_date, - 'time': Deserializer.deserialize_time, - 'decimal': Deserializer.deserialize_decimal, - 'long': Deserializer.deserialize_long, - 'bytearray': Deserializer.deserialize_bytearray, - 'base64': Deserializer.deserialize_base64, - 'object': self.deserialize_object, - '[]': self.deserialize_iter, - '{}': self.deserialize_dict - } + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } self.deserialize_expected_types = { - 'duration': (isodate.Duration, datetime.timedelta), - 'iso-8601': (datetime.datetime) + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [ - rest_key_extractor, - xml_key_extractor - ] + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much # complicated, with no real scenario for now. @@ -1403,8 +1417,7 @@ def _deserialize(self, target_obj, data): """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, '_validation', {}).items() - if config.get('constant')] + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: for attr, mapconfig in data._attribute_map.items(): if attr in constants: @@ -1412,15 +1425,11 @@ def _deserialize(self, target_obj, data): value = getattr(data, attr) if value is None: continue - local_type = mapconfig['type'] - internal_data_type = local_type.strip('[]{}') + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): continue - setattr( - data, - attr, - self._deserialize(local_type, value) - ) + setattr(data, attr, self._deserialize(local_type, value)) return data except AttributeError: return @@ -1435,16 +1444,16 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == '': + if attr == "additional_properties" and attr_desc["key"] == "": continue raw_value = None # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip('[]{}') + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") if internal_data_type in self.dependencies: attr_desc["internalType"] = self.dependencies[internal_data_type] @@ -1452,21 +1461,18 @@ def _deserialize(self, target_obj, data): found_value = key_extractor(attr, attr_desc, data) if found_value is not None: if raw_value is not None and raw_value != found_value: - msg = ("Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" ) - _LOGGER.warning( - msg, - found_value, - key_extractor, - attr + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning(msg, found_value, key_extractor, attr) continue raw_value = found_value - value = self.deserialize_data(raw_value, attr_desc['type']) + value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1475,14 +1481,17 @@ def _deserialize(self, target_obj, data): def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": # Check empty string. If it's not empty, someone has a real "additionalProperties" return None if isinstance(data, ET.Element): data = {el.tag: el.text for el in data} - known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) - for desc in attribute_map.values() if desc['key'] != ''} + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } present_keys = set(data.keys()) missing_keys = present_keys - known_keys return {key: data[key] for key in missing_keys} @@ -1493,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1508,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1518,15 +1527,14 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: return self(target_obj, data, content_type=content_type) except: _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None @@ -1554,22 +1562,16 @@ def _unpack_content(raw_data, content_type=None): return context[RawDeserializer.CONTEXT_NAME] raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - #Assume this is enough to recognize universal_http.ClientResponse without importing it + # Assume this is enough to recognize universal_http.ClientResponse without importing it if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text(), - raw_data.headers - ) + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, '_content_consumed'): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text, - raw_data.headers - ) + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1579,14 +1581,11 @@ def _instantiate_model(self, response, attrs, additional_properties=None): :param d_attrs: The deserialized response attributes. """ if callable(response): - subtype = getattr(response, '_subtype_map', {}) + subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() - if v.get('readonly')] - const = [k for k, v in response._validation.items() - if v.get('constant')] - kwargs = {k: v for k, v in attrs.items() - if k not in subtype and k not in readonly + const} + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) @@ -1594,8 +1593,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format( - kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1659,13 +1657,10 @@ def deserialize_iter(self, attr, iter_type): """ if attr is None: return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children + if isinstance(attr, ET.Element): # If I receive an element here, get the children attr = list(attr) if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( - iter_type, - type(attr) - )) + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) return [self.deserialize_data(a, iter_type) for a in attr] def deserialize_dict(self, attr, dict_type): @@ -1677,7 +1672,7 @@ def deserialize_dict(self, attr, dict_type): :rtype: dict """ if isinstance(attr, list): - return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} if isinstance(attr, ET.Element): # Transform value into {"Key": "value"} @@ -1698,7 +1693,7 @@ def deserialize_object(self, attr, **kwargs): # Do no recurse on XML, just return the tree as-is return attr if isinstance(attr, basestring): - return self.deserialize_basic(attr, 'str') + return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: return self.deserialize_basic(attr, self.basic_types[obj_type]) @@ -1709,8 +1704,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = {} for key, value in attr.items(): try: - deserialized[key] = self.deserialize_object( - value, **kwargs) + deserialized[key] = self.deserialize_object(value, **kwargs) except ValueError: deserialized[key] = None return deserialized @@ -1719,8 +1713,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = [] for obj in attr: try: - deserialized.append(self.deserialize_object( - obj, **kwargs)) + deserialized.append(self.deserialize_object(obj, **kwargs)) except ValueError: pass return deserialized @@ -1747,23 +1740,23 @@ def deserialize_basic(self, attr, data_type): if not attr: if data_type == "str": # None or '', node is empty string. - return '' + return "" else: # None or '', node with a strong type is None. # Don't try to model "empty bool" or "empty int" return None - if data_type == 'bool': + if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) elif isinstance(attr, basestring): - if attr.lower() in ['true', '1']: + if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ['false', '0']: + elif attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) - if data_type == 'str': + if data_type == "str": return self.deserialize_unicode(attr) return eval(data_type)(attr) # nosec @@ -1782,7 +1775,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1833,7 +1826,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1845,9 +1838,9 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = '=' * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace('-', '+').replace('_', '/') + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @staticmethod @@ -1861,7 +1854,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1876,7 +1869,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1890,7 +1883,7 @@ def deserialize_duration(attr): attr = attr.text try: duration = isodate.parse_duration(attr) - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1906,7 +1899,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1921,7 +1914,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1936,10 +1929,9 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], - tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -1960,12 +1952,12 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) - check_decimal = attr.split('.') + check_decimal = attr.split(".") if len(check_decimal) > 1: decimal_str = "" for digit in check_decimal[1]: @@ -1980,7 +1972,7 @@ def deserialize_iso(attr): test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1996,7 +1988,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py index 49fbeb446e68..01c327e5d6a4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b3" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py index 831c1dee7d5d..7296d25f5a3e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py index a396695bd008..2510bc1e268f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py @@ -70,7 +70,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = MicrosoftResourceHealthConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py index 3b9fe1779056..b54ca5518ef6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py index c7969fcbc023..7b34753df363 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-01-01") # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", "2015-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json index 9d9933b2fd31..bfe48dba626e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py index 096b2cca9b33..f5e4c3ada41c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import MicrosoftResourceHealthConfiguration from .operations import ( @@ -65,7 +65,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -100,15 +100,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> MicrosoftResourceHealth + def __enter__(self) -> "MicrosoftResourceHealth": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py index dfa6ee022f15..20971492f129 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b3" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py index af2371d6b6d4..e02d3fbb7c52 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py index a2b32475851d..a8d670d658ae 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-01-01") # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", "2015-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py index eba8efaf381b..c3fcf7a2ca8d 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import MicrosoftResourceHealthConfiguration from .operations import ( @@ -65,7 +65,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -107,5 +107,5 @@ async def __aenter__(self) -> "MicrosoftResourceHealth": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py index 470cb0f8e6d3..af3625f21163 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py @@ -12,7 +12,7 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py index 0d6f8cf8ddf0..8737693a6f32 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py @@ -86,8 +86,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -181,8 +183,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -206,7 +208,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -222,7 +224,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -230,13 +232,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -250,7 +252,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace_async async def get_by_resource( @@ -288,8 +292,8 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -301,9 +305,9 @@ async def get_by_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,7 +325,7 @@ async def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -353,8 +357,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -377,7 +381,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -393,7 +397,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -401,13 +405,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -421,4 +425,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py index 522b6fcbdedf..0e0bb70f5698 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py @@ -92,8 +92,8 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -105,9 +105,9 @@ async def get_by_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -125,7 +125,9 @@ async def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current"} # type: ignore + get_by_resource.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + } @distributed_trace def list( @@ -155,8 +157,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -179,7 +181,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -195,7 +197,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -203,13 +205,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -223,4 +225,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py index 8129ea7b3513..f342647ed9ea 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py @@ -85,8 +85,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +109,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +125,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,4 +153,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py index 3f13ab14cdd7..50be7539a9ae 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -85,9 +85,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,4 +105,4 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py index c188087fe984..f254b8446c6c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py @@ -22,7 +22,7 @@ from ._microsoft_resource_health_enums import AvailabilityStateValues from ._microsoft_resource_health_enums import ReasonChronicityTypes from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py index 866acc1a803c..f109d01529e4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -48,8 +48,8 @@ def __init__( type: Optional[str] = None, location: Optional[str] = None, properties: Optional["_models.AvailabilityStatusProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Azure Resource Manager Identity for the availabilityStatuses resource. :paramtype id: str @@ -92,7 +92,9 @@ class AvailabilityStatusListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of availabilityStatuses. Required. :paramtype value: list[~azure.mgmt.resourcehealth.v2015_01_01.models.AvailabilityStatus] @@ -186,8 +188,8 @@ def __init__( recently_resolved_state: Optional["_models.AvailabilityStatusPropertiesRecentlyResolvedState"] = None, recommended_actions: Optional[List["_models.RecommendedAction"]] = None, service_impacting_events: Optional[List["_models.ServiceImpactingEvent"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword availability_state: Availability status of the resource. Known values are: "Available", "Unavailable", and "Unknown". @@ -248,7 +250,8 @@ def __init__( class AvailabilityStatusPropertiesRecentlyResolvedState(_serialization.Model): - """An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. + """An annotation describing a change in the availabilityState to Available from Unavailable with a + reasonType of type Unplanned. :ivar unavailable_occurred_time: Timestamp for when the availabilityState changed to Unavailable. @@ -271,8 +274,8 @@ def __init__( unavailable_occurred_time: Optional[datetime.datetime] = None, resolved_time: Optional[datetime.datetime] = None, unavailability_summary: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword unavailable_occurred_time: Timestamp for when the availabilityState changed to Unavailable. @@ -314,7 +317,7 @@ class ErrorResponse(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -336,7 +339,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -375,8 +380,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Provider name. :paramtype provider: str @@ -411,7 +416,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, value: List["_models.Operation"], **kwargs): + def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: """ :keyword value: List of operations available in the resourcehealth resource provider. Required. :paramtype value: list[~azure.mgmt.resourcehealth.v2015_01_01.models.Operation] @@ -443,8 +448,8 @@ def __init__( action: Optional[str] = None, action_url: Optional[str] = None, action_url_text: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Recommended action. :paramtype action: str @@ -492,8 +497,8 @@ def __init__( correlation_id: Optional[str] = None, status: Optional["_models.ServiceImpactingEventStatus"] = None, incident_properties: Optional["_models.ServiceImpactingEventIncidentProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword event_start_time: Timestamp for when the event started. :paramtype event_start_time: ~datetime.datetime @@ -542,8 +547,8 @@ def __init__( service: Optional[str] = None, region: Optional[str] = None, incident_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Title of the incident. :paramtype title: str @@ -572,7 +577,7 @@ class ServiceImpactingEventStatus(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Current status of the event. :paramtype value: str diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py index 470cb0f8e6d3..af3625f21163 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py @@ -12,7 +12,7 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py index 5003d6939a41..1ce93cd468f1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py @@ -47,7 +47,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_by_subscription_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +84,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +118,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_get_by_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,7 +148,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,8 +214,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -238,7 +238,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -254,7 +254,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -262,13 +262,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -282,7 +282,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -309,8 +311,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -334,7 +336,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -350,7 +352,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -358,13 +360,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -378,7 +380,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def get_by_resource( @@ -416,8 +420,8 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -429,9 +433,9 @@ def get_by_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -449,7 +453,7 @@ def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -481,8 +485,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -505,7 +509,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -521,7 +525,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -529,13 +533,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -549,4 +553,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py index 5abbf174bfe3..90588fa60598 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py @@ -47,7 +47,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_get_by_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,8 +156,8 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -169,9 +169,9 @@ def get_by_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -189,7 +189,9 @@ def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current"} # type: ignore + get_by_resource.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + } @distributed_trace def list( @@ -219,8 +221,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -243,7 +245,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -259,7 +261,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -267,13 +269,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -287,4 +289,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py index 5e30a63693a4..fbd77461c4a6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py @@ -47,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,8 +118,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,7 +142,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -158,7 +158,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -166,13 +166,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -186,4 +186,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py index 36fca29383f6..f0f98c1335c4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py @@ -43,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,8 +97,8 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -107,9 +107,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,4 +127,4 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py index 3b9fe1779056..b54ca5518ef6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py index f0fdb825a3d1..d0da50c9730c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-07-01") # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", "2018-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json index 00168fdb1a40..a37a96571b5d 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py index 4bda6e363946..6a1ea00b4935 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import MicrosoftResourceHealthConfiguration from .operations import ( @@ -67,7 +67,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -101,15 +101,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> MicrosoftResourceHealth + def __enter__(self) -> "MicrosoftResourceHealth": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py index c47f66669f1b..20971492f129 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b3" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py index af2371d6b6d4..e02d3fbb7c52 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py index 54157b8cda81..7a5f1b7fc164 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-07-01") # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", "2018-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py index 59cf99bf0925..0cdb7f1e8b84 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import MicrosoftResourceHealthConfiguration from .operations import ( @@ -67,7 +67,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -108,5 +108,5 @@ async def __aenter__(self) -> "MicrosoftResourceHealth": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py index ce0b9cd8ad26..4d84024fc0a6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._metadata_operations import MetadataOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py index d73d591c9020..4366f2918f1e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py @@ -87,8 +87,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +127,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,7 +155,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -183,8 +185,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -208,7 +210,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -224,7 +226,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -232,13 +234,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -252,7 +254,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace_async async def get_by_resource( @@ -292,8 +296,8 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -305,9 +309,9 @@ async def get_by_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -325,7 +329,7 @@ async def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -358,8 +362,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -382,7 +386,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -398,7 +402,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -406,13 +410,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -426,4 +430,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py index 26275be46a37..1f19c1c2e295 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py @@ -80,8 +80,8 @@ async def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssuesGetResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) request = build_get_request( issue_name=issue_name, @@ -91,9 +91,9 @@ async def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +111,7 @@ async def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult"]: @@ -127,8 +127,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssueListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -148,7 +148,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -164,7 +164,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -172,13 +172,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -192,4 +192,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py index 3b7ce60e04d0..cf5fd38ee99b 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py @@ -91,8 +91,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +116,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +132,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,13 +140,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -160,7 +160,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" + } @distributed_trace def list_by_single_resource( @@ -192,8 +194,8 @@ def list_by_single_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -216,7 +218,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -232,7 +234,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -240,13 +242,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -260,4 +262,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py index e0b6f54472e1..03b44476404e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntityListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +92,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -108,7 +108,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +116,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} @distributed_trace_async async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: @@ -160,8 +160,8 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntity] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) request = build_get_entity_request( name=name, @@ -171,9 +171,9 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -191,4 +191,4 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: return deserialized - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} # type: ignore + get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py index b22e05acbcaa..e4ff11a438ea 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -85,9 +85,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,4 +105,4 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py index 422674218a37..54f19b7e4f22 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py @@ -53,7 +53,7 @@ from ._microsoft_resource_health_enums import SeverityValues from ._microsoft_resource_health_enums import StageValues from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py index 2c8e196f8453..d7a7ef94362f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py @@ -55,8 +55,8 @@ def __init__( type: Optional[str] = None, location: Optional[str] = None, properties: Optional["_models.AvailabilityStatusProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Azure Resource Manager Identity for the availabilityStatuses resource. :paramtype id: str @@ -99,7 +99,9 @@ class AvailabilityStatusListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of availabilityStatuses. Required. :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.AvailabilityStatus] @@ -206,8 +208,8 @@ def __init__( recently_resolved: Optional["_models.AvailabilityStatusPropertiesRecentlyResolved"] = None, recommended_actions: Optional[List["_models.RecommendedAction"]] = None, service_impacting_events: Optional[List["_models.ServiceImpactingEvent"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword availability_state: Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event. Known values are: @@ -281,7 +283,8 @@ def __init__( class AvailabilityStatusPropertiesRecentlyResolved(_serialization.Model): - """An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. + """An annotation describing a change in the availabilityState to Available from Unavailable with a + reasonType of type Unplanned. :ivar unavailable_occurred_time: Timestamp for when the availabilityState changed to Unavailable. @@ -304,8 +307,8 @@ def __init__( unavailable_occurred_time: Optional[datetime.datetime] = None, resolved_time: Optional[datetime.datetime] = None, unavailability_summary: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword unavailable_occurred_time: Timestamp for when the availabilityState changed to Unavailable. @@ -345,8 +348,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, regions: Optional[List["_models.ImpactedRegion"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The impacted service id. :paramtype id: str @@ -380,8 +383,8 @@ def __init__( *, value: Optional[List["_models.EmergingIssuesGetResult"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The list of emerging issues. :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.EmergingIssuesGetResult] @@ -420,7 +423,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -471,8 +474,8 @@ def __init__( refresh_timestamp: Optional[datetime.datetime] = None, status_banners: Optional[List["_models.StatusBanner"]] = None, status_active_events: Optional[List["_models.StatusActiveEvent"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. :paramtype refresh_timestamp: ~datetime.datetime @@ -513,7 +516,7 @@ class ErrorResponse(_serialization.Model): "details": {"key": "details", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -654,8 +657,8 @@ def __init__( # pylint: disable=too-many-locals priority: Optional[int] = None, last_update_time: Optional[datetime.datetime] = None, hir_stage: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". @@ -753,7 +756,7 @@ class EventPropertiesArticle(_serialization.Model): "article_content": {"key": "articleContent", "type": "str"}, } - def __init__(self, *, article_content: Optional[str] = None, **kwargs): + def __init__(self, *, article_content: Optional[str] = None, **kwargs: Any) -> None: """ :keyword article_content: Article content of event. :paramtype article_content: str @@ -786,8 +789,8 @@ def __init__( message: Optional[str] = None, actions: Optional[List["_models.EventPropertiesRecommendedActionsItem"]] = None, locale_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Recommended action title for the service health event. :paramtype message: str @@ -817,7 +820,7 @@ class EventPropertiesRecommendedActionsItem(_serialization.Model): "action_text": {"key": "actionText", "type": "str"}, } - def __init__(self, *, group_id: Optional[int] = None, action_text: Optional[str] = None, **kwargs): + def __init__(self, *, group_id: Optional[int] = None, action_text: Optional[str] = None, **kwargs: Any) -> None: """ :keyword group_id: Recommended action group Id for the service health event. :paramtype group_id: int @@ -850,7 +853,7 @@ class Events(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Event"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Event"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The list of event. Required. :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Event] @@ -886,8 +889,8 @@ def __init__( question: Optional[str] = None, answer: Optional[str] = None, locale_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword question: FAQ question for the service health event. :paramtype question: str @@ -922,8 +925,8 @@ def __init__( *, impacted_service: Optional[str] = None, impacted_regions: Optional[List["_models.ImpactedServiceRegion"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword impacted_service: Impacted service name. :paramtype impacted_service: str @@ -951,8 +954,12 @@ class ImpactedRegion(_serialization.Model): } def __init__( - self, *, id: Optional[str] = None, name: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword id: The impacted region id. :paramtype id: str @@ -996,8 +1003,8 @@ def __init__( impacted_subscriptions: Optional[List[str]] = None, last_update_time: Optional[datetime.datetime] = None, updates: Optional[List["_models.Update"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword impacted_region: Impacted region name. :paramtype impacted_region: str @@ -1054,8 +1061,8 @@ def __init__( extension_name: Optional[str] = None, blade_name: Optional[str] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of link. Known values are: "Button" and "Hyperlink". :paramtype type: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.LinkTypeValues @@ -1093,7 +1100,7 @@ class LinkDisplayText(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Display text of link. :paramtype value: str @@ -1153,8 +1160,8 @@ def __init__( depends_on: Optional[List[str]] = None, applicable_scenarios: Optional[List[Union[str, "_models.Scenario"]]] = None, supported_values: Optional[List["_models.MetadataSupportedValueDetail"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name. :paramtype display_name: str @@ -1189,8 +1196,8 @@ class MetadataEntityListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.MetadataEntity"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.MetadataEntity"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of metadata entities. :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.MetadataEntity] @@ -1221,8 +1228,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin display_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id. :paramtype id: str @@ -1248,7 +1255,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -1287,8 +1296,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Provider name. :paramtype provider: str @@ -1323,7 +1332,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, value: List["_models.Operation"], **kwargs): + def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: """ :keyword value: List of operations available in the resourcehealth resource provider. Required. :paramtype value: list[~azure.mgmt.resourcehealth.v2018_07_01.models.Operation] @@ -1355,8 +1364,8 @@ def __init__( action: Optional[str] = None, action_url: Optional[str] = None, action_url_text: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Recommended action. :paramtype action: str @@ -1404,8 +1413,8 @@ def __init__( correlation_id: Optional[str] = None, status: Optional["_models.ServiceImpactingEventStatus"] = None, incident_properties: Optional["_models.ServiceImpactingEventIncidentProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword event_start_time: Timestamp for when the event started. :paramtype event_start_time: ~datetime.datetime @@ -1454,8 +1463,8 @@ def __init__( service: Optional[str] = None, region: Optional[str] = None, incident_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Title of the incident. :paramtype title: str @@ -1484,7 +1493,7 @@ class ServiceImpactingEventStatus(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Current status of the event. :paramtype value: str @@ -1546,8 +1555,8 @@ def __init__( published: Optional[bool] = None, last_modified_time: Optional[datetime.datetime] = None, impacts: Optional[List["_models.EmergingIssueImpact"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: The active event title. :paramtype title: str @@ -1612,8 +1621,8 @@ def __init__( message: Optional[str] = None, cloud: Optional[str] = None, last_modified_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: The banner title. :paramtype title: str @@ -1647,8 +1656,8 @@ class Update(_serialization.Model): } def __init__( - self, *, summary: Optional[str] = None, update_date_time: Optional[datetime.datetime] = None, **kwargs - ): + self, *, summary: Optional[str] = None, update_date_time: Optional[datetime.datetime] = None, **kwargs: Any + ) -> None: """ :keyword summary: Summary text for the given update for the service health event. :paramtype summary: str diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py index ce0b9cd8ad26..4d84024fc0a6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py @@ -13,7 +13,7 @@ from ._metadata_operations import MetadataOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py index 487770ac10e5..0d8204da04f8 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py @@ -47,7 +47,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_by_subscription_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +84,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +118,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_get_by_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,7 +148,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -215,8 +215,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -239,7 +239,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -255,7 +255,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -263,13 +263,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -283,7 +283,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -311,8 +313,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -336,7 +338,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -352,7 +354,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -360,13 +362,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -380,7 +382,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def get_by_resource( @@ -420,8 +424,8 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -433,9 +437,9 @@ def get_by_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -453,7 +457,7 @@ def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -486,8 +490,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -510,7 +514,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -526,7 +530,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -534,13 +538,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -554,4 +558,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py index 033b9d2acd76..67e0e64497e4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py @@ -45,7 +45,7 @@ def build_get_request(issue_name: Union[str, _models.Enum8], **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_get_request(issue_name: Union[str, _models.Enum8], **kwargs: Any) -> H "issueName": _SERIALIZER.url("issue_name", issue_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,8 +125,8 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssuesGetResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) request = build_get_request( issue_name=issue_name, @@ -136,9 +136,9 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -156,7 +156,7 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E return deserialized - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: @@ -172,8 +172,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssueListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -193,7 +193,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -209,7 +209,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -217,13 +217,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EmergingIssueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -237,4 +237,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py index e39fc04c85e9..2fc1b98f4827 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py @@ -52,7 +52,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_list_by_subscription_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +84,7 @@ def build_list_by_single_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_list_by_single_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,8 +157,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -182,7 +182,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -198,7 +198,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -206,13 +206,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -226,7 +226,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" + } @distributed_trace def list_by_single_resource( @@ -257,8 +259,8 @@ def list_by_single_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -281,7 +283,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -297,7 +299,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -305,13 +307,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("Events", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -325,4 +327,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py index 32e3f9f2d3e6..1636ab55b347 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_entity_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_entity_request(name: str, **kwargs: Any) -> HttpRequest: "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,8 +116,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntityListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -137,7 +137,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -153,7 +153,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -161,13 +161,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetadataEntityListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -181,7 +181,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} @distributed_trace def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: @@ -205,8 +205,8 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntity] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) request = build_get_entity_request( name=name, @@ -216,9 +216,9 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -236,4 +236,4 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: return deserialized - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} # type: ignore + get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py index 7cff171c6533..6f8c3f7b5fbd 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py @@ -43,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,8 +97,8 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -107,9 +107,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,4 +127,4 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py new file mode 100644 index 000000000000..281dc008ac4f --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python availability_status_get_by_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.availability_statuses.get_by_resource( + resource_uri="resourceUri", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatus_GetByResource.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py new file mode 100644 index 000000000000..a2bb74c30de5 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python availability_statuses_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.availability_statuses.list( + resource_uri="resourceUri", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatuses_List.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py new file mode 100644 index 000000000000..f0795344557a --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python availability_statuses_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.availability_statuses.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatuses_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py new file mode 100644 index 000000000000..7647ed2e9b81 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python availability_statuses_list_by_subscription_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.availability_statuses.list_by_subscription_id() + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatuses_ListBySubscriptionId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py new file mode 100644 index 000000000000..552cb4f02fdb --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python emerging_issues_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.emerging_issues.get( + issue_name="default", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/EmergingIssues_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py new file mode 100644 index 000000000000..3bb728fc15cd --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python emerging_issues_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.emerging_issues.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/EmergingIssues_List.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py new file mode 100644 index 000000000000..fca2086b83ee --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python events_list_by_single_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.events.list_by_single_resource( + resource_uri="subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Events_ListBySingleResource.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py new file mode 100644 index 000000000000..363292a6ff69 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python events_list_by_subscription_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.events.list_by_subscription_id() + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Events_ListBySubscriptionId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py new file mode 100644 index 000000000000..f76c69b15f9c --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python metadata_get_entity.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.metadata.get_entity( + name="status", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Metadata_GetEntity.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py new file mode 100644 index 000000000000..b5fd97aea687 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import MicrosoftResourceHealth + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python metadata_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MicrosoftResourceHealth( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.metadata.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Metadata_List.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-msi/CHANGELOG.md b/sdk/resources/azure-mgmt-msi/CHANGELOG.md index a28bb1f87050..d40c5d752ea3 100644 --- a/sdk/resources/azure-mgmt-msi/CHANGELOG.md +++ b/sdk/resources/azure-mgmt-msi/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 7.1.0b1 (2023-02-16) + +### Other Changes + + - Added generated samples in github repo + - Drop support for python<3.7.0 + ## 7.0.0 (2023-02-02) ### Features Added diff --git a/sdk/resources/azure-mgmt-msi/_meta.json b/sdk/resources/azure-mgmt-msi/_meta.json index d0c1f24451b8..d0e866245b78 100644 --- a/sdk/resources/azure-mgmt-msi/_meta.json +++ b/sdk/resources/azure-mgmt-msi/_meta.json @@ -1,11 +1,11 @@ { - "commit": "3d7a3848106b831a4a7f46976fe38aa605c4f44d", + "commit": "51d4c24a011e300b9713179e0515fef35bf3f678", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.16", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/msi/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/msi/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/msi/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_version.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_version.py index 364f3c906cf9..d00e82dfabad 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_version.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "7.1.0b1" diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_managed_service_identity_client.py index 900887024743..b8ce7a54d011 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_managed_service_identity_client.py @@ -97,5 +97,5 @@ def __enter__(self) -> "ManagedServiceIdentityClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_version.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_version.py index 364f3c906cf9..d00e82dfabad 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_version.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "7.1.0b1" diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/_managed_service_identity_client.py index e2015a2068c6..91d8c3375b2a 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/_managed_service_identity_client.py @@ -97,5 +97,5 @@ async def __aenter__(self) -> "ManagedServiceIdentityClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/operations/_user_assigned_identities_operations.py index 328ea1bba0b5..d329295cfc5d 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/aio/operations/_user_assigned_identities_operations.py @@ -298,8 +298,8 @@ async def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2018_11_30.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -439,8 +439,8 @@ async def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2018_11_30.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/operations/_user_assigned_identities_operations.py index 70dacc324bf3..4fcbafc9aa71 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2018_11_30/operations/_user_assigned_identities_operations.py @@ -475,8 +475,8 @@ def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2018_11_30.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -616,8 +616,8 @@ def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2018_11_30.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_managed_service_identity_client.py index 73ee67121aff..e3d32bf1c259 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_managed_service_identity_client.py @@ -97,5 +97,5 @@ def __enter__(self) -> "ManagedServiceIdentityClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_version.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_version.py index 364f3c906cf9..d00e82dfabad 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_version.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "7.1.0b1" diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/_managed_service_identity_client.py index 11a64d3b649b..0d02776795f1 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/_managed_service_identity_client.py @@ -97,5 +97,5 @@ async def __aenter__(self) -> "ManagedServiceIdentityClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/operations/_user_assigned_identities_operations.py index 0621c2b9a153..23b25ed05f5f 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/aio/operations/_user_assigned_identities_operations.py @@ -424,8 +424,8 @@ async def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2021_09_30_preview.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -567,8 +567,8 @@ async def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2021_09_30_preview.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/operations/_user_assigned_identities_operations.py index bc499c39312e..cf1ceb330436 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2021_09_30_preview/operations/_user_assigned_identities_operations.py @@ -661,8 +661,8 @@ def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2021_09_30_preview.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -804,8 +804,8 @@ def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2021_09_30_preview.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_managed_service_identity_client.py index 362a1ba6d279..20d32ad4e09a 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_managed_service_identity_client.py @@ -108,5 +108,5 @@ def __enter__(self) -> "ManagedServiceIdentityClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_version.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_version.py index 364f3c906cf9..d00e82dfabad 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_version.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "7.1.0b1" diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/_managed_service_identity_client.py index fe425cc90822..0b8246d5fe6a 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/_managed_service_identity_client.py @@ -108,5 +108,5 @@ async def __aenter__(self) -> "ManagedServiceIdentityClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_federated_identity_credentials_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_federated_identity_credentials_operations.py index e03b94361ab5..b83d0692e328 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_federated_identity_credentials_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_federated_identity_credentials_operations.py @@ -255,7 +255,7 @@ async def create_or_update( credential resource. Required. :type federated_identity_credential_resource_name: str :param parameters: Parameters to create or update the federated identity credential. Is either - a model type or a IO type. Required. + a FederatedIdentityCredential type or a IO type. Required. :type parameters: ~azure.mgmt.msi.v2022_01_31_preview.models.FederatedIdentityCredential or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_user_assigned_identities_operations.py index 921aa2af9882..8d2f7c6791ac 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/aio/operations/_user_assigned_identities_operations.py @@ -424,8 +424,8 @@ async def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2022_01_31_preview.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -567,8 +567,8 @@ async def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2022_01_31_preview.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_federated_identity_credentials_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_federated_identity_credentials_operations.py index 477fe7276da9..52bc8e786ad8 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_federated_identity_credentials_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_federated_identity_credentials_operations.py @@ -418,7 +418,7 @@ def create_or_update( credential resource. Required. :type federated_identity_credential_resource_name: str :param parameters: Parameters to create or update the federated identity credential. Is either - a model type or a IO type. Required. + a FederatedIdentityCredential type or a IO type. Required. :type parameters: ~azure.mgmt.msi.v2022_01_31_preview.models.FederatedIdentityCredential or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_user_assigned_identities_operations.py index d2b760d63c8e..1845c81b6b99 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2022_01_31_preview/operations/_user_assigned_identities_operations.py @@ -661,8 +661,8 @@ def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2022_01_31_preview.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -804,8 +804,8 @@ def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2022_01_31_preview.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_managed_service_identity_client.py index dfe5d04ee346..52f8d05b35e0 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_managed_service_identity_client.py @@ -108,5 +108,5 @@ def __enter__(self) -> "ManagedServiceIdentityClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_version.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_version.py index 364f3c906cf9..d00e82dfabad 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_version.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "7.1.0b1" diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/_managed_service_identity_client.py index 200291d1e8c8..c679f7b0df78 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/_managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/_managed_service_identity_client.py @@ -108,5 +108,5 @@ async def __aenter__(self) -> "ManagedServiceIdentityClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_federated_identity_credentials_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_federated_identity_credentials_operations.py index d81690730ea4..8ffad7efe711 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_federated_identity_credentials_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_federated_identity_credentials_operations.py @@ -253,7 +253,7 @@ async def create_or_update( credential resource. Required. :type federated_identity_credential_resource_name: str :param parameters: Parameters to create or update the federated identity credential. Is either - a model type or a IO type. Required. + a FederatedIdentityCredential type or a IO type. Required. :type parameters: ~azure.mgmt.msi.v2023_01_31.models.FederatedIdentityCredential or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_user_assigned_identities_operations.py index c923b5ad9535..09056320a66f 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/aio/operations/_user_assigned_identities_operations.py @@ -298,8 +298,8 @@ async def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2023_01_31.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -439,8 +439,8 @@ async def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2023_01_31.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_federated_identity_credentials_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_federated_identity_credentials_operations.py index bc9ce06c48a4..91bbc01876f4 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_federated_identity_credentials_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_federated_identity_credentials_operations.py @@ -425,7 +425,7 @@ def create_or_update( credential resource. Required. :type federated_identity_credential_resource_name: str :param parameters: Parameters to create or update the federated identity credential. Is either - a model type or a IO type. Required. + a FederatedIdentityCredential type or a IO type. Required. :type parameters: ~azure.mgmt.msi.v2023_01_31.models.FederatedIdentityCredential or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_user_assigned_identities_operations.py index 3552fff7c725..7de2659de99a 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2023_01_31/operations/_user_assigned_identities_operations.py @@ -475,8 +475,8 @@ def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to create or update the identity. Is either a model type or a IO - type. Required. + :param parameters: Parameters to create or update the identity. Is either a Identity type or a + IO type. Required. :type parameters: ~azure.mgmt.msi.v2023_01_31.models.Identity or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -616,8 +616,8 @@ def update( :type resource_group_name: str :param resource_name: The name of the identity resource. Required. :type resource_name: str - :param parameters: Parameters to update the identity. Is either a model type or a IO type. - Required. + :param parameters: Parameters to update the identity. Is either a IdentityUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.msi.v2023_01_31.models.IdentityUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_create.py b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_create.py new file mode 100644 index 000000000000..d29987c1e946 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_create.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python federated_identity_credential_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="c267c0e7-0a73-4789-9e17-d26aeb0904e5", + ) + + response = client.federated_identity_credentials.create_or_update( + resource_group_name="rgName", + resource_name="resourceName", + federated_identity_credential_resource_name="ficResourceName", + parameters={ + "properties": { + "audiences": ["api://AzureADTokenExchange"], + "issuer": "https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID", + "subject": "system:serviceaccount:ns:svcaccount", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_delete.py b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_delete.py new file mode 100644 index 000000000000..6d58d618c929 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python federated_identity_credential_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="c267c0e7-0a73-4789-9e17-d26aeb0904e5", + ) + + response = client.federated_identity_credentials.delete( + resource_group_name="rgName", + resource_name="resourceName", + federated_identity_credential_resource_name="ficResourceName", + ) + print(response) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_get.py b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_get.py new file mode 100644 index 000000000000..6caae283a4ef --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python federated_identity_credential_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="c267c0e7-0a73-4789-9e17-d26aeb0904e5", + ) + + response = client.federated_identity_credentials.get( + resource_group_name="rgName", + resource_name="resourceName", + federated_identity_credential_resource_name="ficResourceName", + ) + print(response) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialGet.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_list.py b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_list.py new file mode 100644 index 000000000000..981cdad844ce --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/federated_identity_credential_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python federated_identity_credential_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="c267c0e7-0a73-4789-9e17-d26aeb0904e5", + ) + + response = client.federated_identity_credentials.list( + resource_group_name="rgName", + resource_name="resourceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialList.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/identity_create.py b/sdk/resources/azure-mgmt-msi/generated_samples/identity_create.py new file mode 100644 index 000000000000..2ef50936b846 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/identity_create.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python identity_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.user_assigned_identities.create_or_update( + resource_group_name="rgName", + resource_name="resourceName", + parameters={"location": "eastus", "tags": {"key1": "value1", "key2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_get.py b/sdk/resources/azure-mgmt-msi/generated_samples/identity_delete.py similarity index 69% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_get.py rename to sdk/resources/azure-mgmt-msi/generated_samples/identity_delete.py index 996d42772900..443714cec665 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_get.py +++ b/sdk/resources/azure-mgmt-msi/generated_samples/identity_delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.msi import ManagedServiceIdentityClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-msi # USAGE - python cosmos_db_data_transfer_job_get.py + python identity_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,18 @@ def main(): - client = CosmosDBManagementClient( + client = ManagedServiceIdentityClient( credential=DefaultAzureCredential(), subscription_id="subid", ) - response = client.data_transfer_jobs.get( - resource_group_name="rg1", - account_name="ddb1", - job_name="j1", + response = client.user_assigned_identities.delete( + resource_group_name="rgName", + resource_name="resourceName", ) print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityDelete.json if __name__ == "__main__": main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/identity_get.py b/sdk/resources/azure-mgmt-msi/generated_samples/identity_get.py new file mode 100644 index 000000000000..c84cf6c87cd9 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/identity_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python identity_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.user_assigned_identities.get( + resource_group_name="rgName", + resource_name="resourceName", + ) + print(response) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/identity_list_by_resource_group.py b/sdk/resources/azure-mgmt-msi/generated_samples/identity_list_by_resource_group.py new file mode 100644 index 000000000000..6c5a965d1479 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/identity_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python identity_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.user_assigned_identities.list_by_resource_group( + resource_group_name="rgName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backups_list.py b/sdk/resources/azure-mgmt-msi/generated_samples/identity_list_by_subscription.py similarity index 69% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backups_list.py rename to sdk/resources/azure-mgmt-msi/generated_samples/identity_list_by_subscription.py index 0127a63effe3..f63c85b91cf1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backups_list.py +++ b/sdk/resources/azure-mgmt-msi/generated_samples/identity_list_by_subscription.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.msi import ManagedServiceIdentityClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-msi # USAGE - python cosmos_db_managed_cassandra_backups_list.py + python identity_list_by_subscription.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,16 @@ def main(): - client = CosmosDBManagementClient( + client = ManagedServiceIdentityClient( credential=DefaultAzureCredential(), subscription_id="subid", ) - response = client.cassandra_clusters.list_backups( - resource_group_name="cassandra-prod-rg", - cluster_name="cassandra-prod", - ) + response = client.user_assigned_identities.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraBackupsList.json +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backup.py b/sdk/resources/azure-mgmt-msi/generated_samples/identity_update.py similarity index 68% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backup.py rename to sdk/resources/azure-mgmt-msi/generated_samples/identity_update.py index 3cc5534ac622..19f4fd2ab2cc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backup.py +++ b/sdk/resources/azure-mgmt-msi/generated_samples/identity_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.msi import ManagedServiceIdentityClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-msi # USAGE - python cosmos_db_managed_cassandra_backup.py + python identity_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = CosmosDBManagementClient( + client = ManagedServiceIdentityClient( credential=DefaultAzureCredential(), subscription_id="subid", ) - response = client.cassandra_clusters.get_backup( - resource_group_name="cassandra-prod-rg", - cluster_name="cassandra-prod", - backup_id="1611250348", + response = client.user_assigned_identities.update( + resource_group_name="rgName", + resource_name="resourceName", + parameters={"location": "eastus", "tags": {"key1": "value1", "key2": "value2"}}, ) print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBManagedCassandraBackup.json +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityUpdate.json if __name__ == "__main__": main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/msi_operations_list.py b/sdk/resources/azure-mgmt-msi/generated_samples/msi_operations_list.py new file mode 100644 index 000000000000..89015f5e744a --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/msi_operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python msi_operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/MsiOperationsList.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-msi/generated_samples/system_assigned_identity_get.py b/sdk/resources/azure-mgmt-msi/generated_samples/system_assigned_identity_get.py new file mode 100644 index 000000000000..172180ab2abc --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/generated_samples/system_assigned_identity_get.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.msi import ManagedServiceIdentityClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-msi +# USAGE + python system_assigned_identity_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ManagedServiceIdentityClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.system_assigned_identities.get_by_scope( + scope="scope", + ) + print(response) + + +# x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/SystemAssignedIdentityGet.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/CHANGELOG.md b/sdk/resources/azure-mgmt-resource/CHANGELOG.md index 9420b97fdcd2..c942a1de1bbc 100644 --- a/sdk/resources/azure-mgmt-resource/CHANGELOG.md +++ b/sdk/resources/azure-mgmt-resource/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 22.1.0b1 (2023-02-16) + +### Other Changes + + - Added generated samples in github repo + - Drop support for python<3.7.0 + ## 22.0.0 (2022-12-15) ### Breaking Changes diff --git a/sdk/resources/azure-mgmt-resource/README.md b/sdk/resources/azure-mgmt-resource/README.md index f5cebd21bf78..eea7d5ef183a 100644 --- a/sdk/resources/azure-mgmt-resource/README.md +++ b/sdk/resources/azure-mgmt-resource/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/resources?view=azure-python-preview) -Code samples for this package can be found at [Resource Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/resources) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-resource +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Resource Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/resources/azure-mgmt-resource/_meta.json b/sdk/resources/azure-mgmt-resource/_meta.json index c46cf33519c9..a5a3f242c121 100644 --- a/sdk/resources/azure-mgmt-resource/_meta.json +++ b/sdk/resources/azure-mgmt-resource/_meta.json @@ -1,11 +1,11 @@ { - "commit": "5346ea8c300e274c447e9a49f178194050cb11d4", + "commit": "51d4c24a011e300b9713179e0515fef35bf3f678", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/resources/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py index 50f5659cd52b..b7a087ec4d03 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py @@ -84,5 +84,5 @@ def __enter__(self) -> "ChangesClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json index 3a5312e819c8..5d604ba34e3f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py index 3ce95aed3081..599a9694445b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py @@ -84,5 +84,5 @@ async def __aenter__(self) -> "ChangesClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_changes_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_changes_client_enums.py index 1a70f25342ea..996871a4dc8d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_changes_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_changes_client_enums.py @@ -13,29 +13,29 @@ class ChangeCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The entity that made the change.""" - #: User initiated change USER = "User" - #: System initiated change + """User initiated change""" SYSTEM = "System" + """System initiated change""" class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of change that was captured in the resource.""" - #: An existing resource underwent a change UPDATE = "Update" - #: An existing resource was deleted + """An existing resource underwent a change""" DELETE = "Delete" - #: A newly created resource + """An existing resource was deleted""" CREATE = "Create" + """A newly created resource""" class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of change that occurred.""" - #: An existing property underwent a change UPDATE = "Update" - #: A property was newly created + """An existing property underwent a change""" INSERT = "Insert" - #: An existing property was deleted + """A property was newly created""" REMOVE = "Remove" + """An existing property was deleted""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py index bff73be0ef85..bd729a07cc1a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING +from typing import Any, Dict, List, Optional, TYPE_CHECKING from ... import _serialization @@ -49,7 +49,7 @@ class ChangeAttributes(_serialization.Model): "new_resource_snapshot_id": {"key": "newResourceSnapshotId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.correlation_id = None @@ -90,7 +90,7 @@ class ChangeBase(_serialization.Model): "new_value": {"key": "newValue", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.property_change_type = None @@ -137,8 +137,8 @@ def __init__( *, change_attributes: Optional["_models.ChangeAttributes"] = None, changes: Optional[Dict[str, "_models.ChangeBase"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword change_attributes: Details about the change resource. :paramtype change_attributes: ~azure.mgmt.resource.changes.v2022_05_01.models.ChangeAttributes @@ -169,8 +169,12 @@ class ChangeResourceListResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.ChangeResourceResult"]] = None, **kwargs - ): + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ChangeResourceResult"]] = None, + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of Change Resources. :paramtype next_link: str @@ -209,7 +213,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -247,7 +251,7 @@ class ChangeResourceResult(Resource): "properties": {"key": "properties", "type": "ChangeProperties"}, } - def __init__(self, *, properties: Optional["_models.ChangeProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ChangeProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The properties of a change. :paramtype properties: ~azure.mgmt.resource.changes.v2022_05_01.models.ChangeProperties @@ -277,7 +281,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -318,7 +322,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -329,7 +333,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.resource.changes.v2022_05_01.models.ErrorDetail @@ -339,7 +344,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.resource.changes.v2022_05_01.models.ErrorDetail diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py index fd1ee73fa386..d9497148f86f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py @@ -92,5 +92,5 @@ def __enter__(self) -> "DeploymentScriptsClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json index 2a8cf8bf344b..4f95defa0356 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription Id which forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py index 6438502d06c1..8df38c8fc0d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py @@ -92,5 +92,5 @@ async def __aenter__(self) -> "DeploymentScriptsClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py index b62025c7f10c..c0c742282d24 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py @@ -232,8 +232,8 @@ async def begin_create( :type resource_group_name: str :param script_name: Name of the deployment script. Required. :type script_name: str - :param deployment_script: Deployment script supplied to the operation. Is either a model type - or a IO type. Required. + :param deployment_script: Deployment script supplied to the operation. Is either a + DeploymentScript type or a IO type. Required. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -378,7 +378,7 @@ async def update( :param script_name: Name of the deployment script. Required. :type script_name: str :param deployment_script: Deployment script resource with the tags to be updated. Is either a - model type or a IO type. Default value is None. + DeploymentScriptUpdateParameter type or a IO type. Default value is None. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptUpdateParameter or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py index 66b3af2defcb..4658c448392b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -42,7 +42,7 @@ class AzureResourceBase(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -112,8 +112,8 @@ def __init__( identity: "_models.ManagedServiceIdentity", location: str, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. Required. @@ -267,8 +267,8 @@ def __init__( environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, timeout: datetime.timedelta = "P1D", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. Required. @@ -391,8 +391,8 @@ def __init__( environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, timeout: datetime.timedelta = "P1D", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_script_uri: Uri for the script. This is the entry point for the external script. @@ -477,8 +477,8 @@ def __init__( container_settings: Optional["_models.ContainerConfiguration"] = None, storage_account_settings: Optional["_models.StorageAccountConfiguration"] = None, cleanup_preference: Union[str, "_models.CleanupOptions"] = "Always", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword container_settings: Container settings. :paramtype container_settings: @@ -598,8 +598,8 @@ def __init__( container_settings: Optional["_models.ContainerConfiguration"] = None, storage_account_settings: Optional["_models.StorageAccountConfiguration"] = None, cleanup_preference: Union[str, "_models.CleanupOptions"] = "Always", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_script_uri: Uri for the script. This is the entry point for the external script. @@ -803,8 +803,8 @@ def __init__( environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, timeout: datetime.timedelta = "P1D", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. Required. @@ -968,8 +968,8 @@ def __init__( container_settings: Optional["_models.ContainerConfiguration"] = None, storage_account_settings: Optional["_models.StorageAccountConfiguration"] = None, cleanup_preference: Union[str, "_models.CleanupOptions"] = "Always", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_script_uri: Uri for the script. This is the entry point for the external script. @@ -1063,7 +1063,7 @@ class ContainerConfiguration(_serialization.Model): "container_group_name": {"key": "containerGroupName", "type": "str"}, } - def __init__(self, *, container_group_name: Optional[str] = None, **kwargs): + def __init__(self, *, container_group_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword container_group_name: Container group name, if not specified then the name will get auto-generated. Not specifying a 'containerGroupName' indicates the system to generate a unique @@ -1102,7 +1102,7 @@ class DeploymentScriptListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentScript"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentScript"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment scripts. :paramtype value: @@ -1125,7 +1125,7 @@ class DeploymentScriptsError(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -1164,7 +1164,7 @@ class DeploymentScriptUpdateParameter(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags to be updated. :paramtype tags: dict[str, str] @@ -1196,7 +1196,9 @@ class EnvironmentVariable(_serialization.Model): "secure_value": {"key": "secureValue", "type": "str"}, } - def __init__(self, *, name: str, value: Optional[str] = None, secure_value: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, value: Optional[str] = None, secure_value: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: The name of the environment variable. Required. :paramtype name: str @@ -1232,7 +1234,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1240,7 +1242,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1274,7 +1277,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1315,8 +1318,8 @@ def __init__( *, type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of the managed identity. "UserAssigned" :paramtype type: str or @@ -1361,7 +1364,7 @@ class ScriptLog(AzureResourceBase): "log": {"key": "properties.log", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.log = None @@ -1379,7 +1382,7 @@ class ScriptLogsList(_serialization.Model): "value": {"key": "value", "type": "[ScriptLog]"}, } - def __init__(self, *, value: Optional[List["_models.ScriptLog"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ScriptLog"]] = None, **kwargs: Any) -> None: """ :keyword value: Deployment scripts logs. :paramtype value: @@ -1425,7 +1428,7 @@ class ScriptStatus(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Error that is relayed from the script execution. :paramtype error: @@ -1441,7 +1444,8 @@ def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs) class StorageAccountConfiguration(_serialization.Model): - """Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 and FileStorage. + """Settings to use an existing storage account. Valid storage account kinds are: Storage, + StorageV2 and FileStorage. :ivar storage_account_name: The storage account name. :vartype storage_account_name: str @@ -1455,8 +1459,8 @@ class StorageAccountConfiguration(_serialization.Model): } def __init__( - self, *, storage_account_name: Optional[str] = None, storage_account_key: Optional[str] = None, **kwargs - ): + self, *, storage_account_name: Optional[str] = None, storage_account_key: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword storage_account_name: The storage account name. :paramtype storage_account_name: str @@ -1507,8 +1511,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1557,7 +1561,7 @@ class UserAssignedIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py index 11335ff39729..3b894b767afe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py @@ -503,8 +503,8 @@ def begin_create( :type resource_group_name: str :param script_name: Name of the deployment script. Required. :type script_name: str - :param deployment_script: Deployment script supplied to the operation. Is either a model type - or a IO type. Required. + :param deployment_script: Deployment script supplied to the operation. Is either a + DeploymentScript type or a IO type. Required. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -649,7 +649,7 @@ def update( :param script_name: Name of the deployment script. Required. :type script_name: str :param deployment_script: Deployment script resource with the tags to be updated. Is either a - model type or a IO type. Default value is None. + DeploymentScriptUpdateParameter type or a IO type. Default value is None. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptUpdateParameter or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py index d493f4f40695..7b506329961d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py @@ -92,5 +92,5 @@ def __enter__(self) -> "DeploymentScriptsClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json index 6d4fc63a4117..d90cc280ba26 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription Id which forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py index f80f14383396..5bb578dda81f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py @@ -92,5 +92,5 @@ async def __aenter__(self) -> "DeploymentScriptsClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py index 74a75267c12b..76acac3eb96b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py @@ -230,8 +230,8 @@ async def begin_create( :type resource_group_name: str :param script_name: Name of the deployment script. Required. :type script_name: str - :param deployment_script: Deployment script supplied to the operation. Is either a model type - or a IO type. Required. + :param deployment_script: Deployment script supplied to the operation. Is either a + DeploymentScript type or a IO type. Required. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -374,7 +374,7 @@ async def update( :param script_name: Name of the deployment script. Required. :type script_name: str :param deployment_script: Deployment script resource with the tags to be updated. Is either a - model type or a IO type. Default value is None. + DeploymentScriptUpdateParameter type or a IO type. Default value is None. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptUpdateParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py index d875b9c59e9c..d6bd0533d466 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -42,7 +42,7 @@ class AzureResourceBase(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -109,8 +109,8 @@ def __init__( location: str, identity: Optional["_models.ManagedServiceIdentity"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. @@ -260,8 +260,8 @@ def __init__( environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, timeout: datetime.timedelta = "P1D", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. @@ -383,8 +383,8 @@ def __init__( environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, timeout: datetime.timedelta = "P1D", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_script_uri: Uri for the script. This is the entry point for the external script. @@ -469,8 +469,8 @@ def __init__( container_settings: Optional["_models.ContainerConfiguration"] = None, storage_account_settings: Optional["_models.StorageAccountConfiguration"] = None, cleanup_preference: Union[str, "_models.CleanupOptions"] = "Always", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword container_settings: Container settings. :paramtype container_settings: @@ -589,8 +589,8 @@ def __init__( container_settings: Optional["_models.ContainerConfiguration"] = None, storage_account_settings: Optional["_models.StorageAccountConfiguration"] = None, cleanup_preference: Union[str, "_models.CleanupOptions"] = "Always", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_script_uri: Uri for the script. This is the entry point for the external script. @@ -790,8 +790,8 @@ def __init__( environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, timeout: datetime.timedelta = "P1D", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported. @@ -954,8 +954,8 @@ def __init__( container_settings: Optional["_models.ContainerConfiguration"] = None, storage_account_settings: Optional["_models.StorageAccountConfiguration"] = None, cleanup_preference: Union[str, "_models.CleanupOptions"] = "Always", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_script_uri: Uri for the script. This is the entry point for the external script. @@ -1049,7 +1049,7 @@ class ContainerConfiguration(_serialization.Model): "container_group_name": {"key": "containerGroupName", "type": "str"}, } - def __init__(self, *, container_group_name: Optional[str] = None, **kwargs): + def __init__(self, *, container_group_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword container_group_name: Container group name, if not specified then the name will get auto-generated. Not specifying a 'containerGroupName' indicates the system to generate a unique @@ -1088,7 +1088,7 @@ class DeploymentScriptListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentScript"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentScript"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment scripts. :paramtype value: @@ -1111,7 +1111,7 @@ class DeploymentScriptsError(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -1149,7 +1149,7 @@ class DeploymentScriptUpdateParameter(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags to be updated. :paramtype tags: dict[str, str] @@ -1181,7 +1181,9 @@ class EnvironmentVariable(_serialization.Model): "secure_value": {"key": "secureValue", "type": "str"}, } - def __init__(self, *, name: str, value: Optional[str] = None, secure_value: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, value: Optional[str] = None, secure_value: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: The name of the environment variable. Required. :paramtype name: str @@ -1217,7 +1219,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1225,7 +1227,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1258,7 +1261,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1299,8 +1302,8 @@ def __init__( *, type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of the managed identity. "UserAssigned" :paramtype type: str or @@ -1345,7 +1348,7 @@ class ScriptLog(AzureResourceBase): "log": {"key": "properties.log", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.log = None @@ -1362,7 +1365,7 @@ class ScriptLogsList(_serialization.Model): "value": {"key": "value", "type": "[ScriptLog]"}, } - def __init__(self, *, value: Optional[List["_models.ScriptLog"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ScriptLog"]] = None, **kwargs: Any) -> None: """ :keyword value: Deployment scripts logs. :paramtype value: list[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLog] @@ -1407,7 +1410,7 @@ class ScriptStatus(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Error that is relayed from the script execution. :paramtype error: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse @@ -1422,7 +1425,8 @@ def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs) class StorageAccountConfiguration(_serialization.Model): - """Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 and FileStorage. + """Settings to use an existing storage account. Valid storage account kinds are: Storage, + StorageV2 and FileStorage. :ivar storage_account_name: The storage account name. :vartype storage_account_name: str @@ -1436,8 +1440,8 @@ class StorageAccountConfiguration(_serialization.Model): } def __init__( - self, *, storage_account_name: Optional[str] = None, storage_account_key: Optional[str] = None, **kwargs - ): + self, *, storage_account_name: Optional[str] = None, storage_account_key: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword storage_account_name: The storage account name. :paramtype storage_account_name: str @@ -1488,8 +1492,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1538,7 +1542,7 @@ class UserAssignedIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py index 60d314c5704d..fefd3c998271 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py @@ -485,8 +485,8 @@ def begin_create( :type resource_group_name: str :param script_name: Name of the deployment script. Required. :type script_name: str - :param deployment_script: Deployment script supplied to the operation. Is either a model type - or a IO type. Required. + :param deployment_script: Deployment script supplied to the operation. Is either a + DeploymentScript type or a IO type. Required. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -629,7 +629,7 @@ def update( :param script_name: Name of the deployment script. Required. :type script_name: str :param deployment_script: Deployment script resource with the tags to be updated. Is either a - model type or a IO type. Default value is None. + DeploymentScriptUpdateParameter type or a IO type. Default value is None. :type deployment_script: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptUpdateParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py index 59a88a0ad8d5..a909a996b3ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py @@ -86,5 +86,5 @@ def __enter__(self) -> "FeatureClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json index b94d29d56658..a0c01f74dee5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_vendor.py index de802b7ebdf4..3b7da72b39ac 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py index 403e09981f05..3078a7905e59 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py @@ -86,5 +86,5 @@ async def __aenter__(self) -> "FeatureClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/models/_models_py3.py index 5b03032f59f8..e36a8c371c3c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization @@ -31,8 +31,8 @@ class FeatureOperationsListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.FeatureResult"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.FeatureResult"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The array of features. :paramtype value: list[~azure.mgmt.resource.features.v2015_12_01.models.FeatureResult] @@ -55,7 +55,7 @@ class FeatureProperties(_serialization.Model): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: Optional[str] = None, **kwargs): + def __init__(self, *, state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword state: The registration state of the feature for the subscription. :paramtype state: str @@ -91,8 +91,8 @@ def __init__( properties: Optional["_models.FeatureProperties"] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the feature. :paramtype name: str @@ -124,7 +124,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -159,8 +161,8 @@ def __init__( provider: Optional[str] = None, resource: Optional[str] = None, operation: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Features. :paramtype provider: str @@ -176,7 +178,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Features operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Features operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Features operations. :vartype value: list[~azure.mgmt.resource.features.v2015_12_01.models.Operation] @@ -189,7 +192,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Features operations. :paramtype value: list[~azure.mgmt.resource.features.v2015_12_01.models.Operation] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py index eaf44812d049..3e200cb52df3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py @@ -92,5 +92,5 @@ def __enter__(self) -> "FeatureClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json index 0d6868f27249..61e56264e049 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_vendor.py index de802b7ebdf4..3b7da72b39ac 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py index 153ce2cfa90a..c5fbecb8d883 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py @@ -92,5 +92,5 @@ async def __aenter__(self) -> "FeatureClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py index 5d7a142c1067..40935a2caa88 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py @@ -664,7 +664,7 @@ async def create_or_update( :param feature_name: The feature name. Required. :type feature_name: str :param subscription_feature_registration_type: Subscription Feature Registration Type details. - Is either a model type or a IO type. Default value is None. + Is either a SubscriptionFeatureRegistration type or a IO type. Default value is None. :type subscription_feature_registration_type: ~azure.mgmt.resource.features.v2021_07_01.models.SubscriptionFeatureRegistration or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py index fc56a0763af9..28eca6eb4154 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -49,7 +49,7 @@ class AuthorizationProfile(_serialization.Model): "approver": {"key": "approver", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.requested_time = None @@ -83,7 +83,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, *, details: Optional[List["_models.ErrorDefinition"]] = None, **kwargs): + def __init__(self, *, details: Optional[List["_models.ErrorDefinition"]] = None, **kwargs: Any) -> None: """ :keyword details: Internal error details. :paramtype details: list[~azure.mgmt.resource.features.v2021_07_01.models.ErrorDefinition] @@ -105,7 +105,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: The error details. :paramtype error: ~azure.mgmt.resource.features.v2021_07_01.models.ErrorDefinition @@ -129,8 +129,8 @@ class FeatureOperationsListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.FeatureResult"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.FeatureResult"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The array of features. :paramtype value: list[~azure.mgmt.resource.features.v2021_07_01.models.FeatureResult] @@ -153,7 +153,7 @@ class FeatureProperties(_serialization.Model): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: Optional[str] = None, **kwargs): + def __init__(self, *, state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword state: The registration state of the feature for the subscription. :paramtype state: str @@ -189,8 +189,8 @@ def __init__( properties: Optional["_models.FeatureProperties"] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the feature. :paramtype name: str @@ -222,7 +222,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -257,8 +259,8 @@ def __init__( provider: Optional[str] = None, resource: Optional[str] = None, operation: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Features. :paramtype provider: str @@ -274,7 +276,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Features operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Features operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Features operations. :vartype value: list[~azure.mgmt.resource.features.v2021_07_01.models.Operation] @@ -287,7 +290,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Features operations. :paramtype value: list[~azure.mgmt.resource.features.v2021_07_01.models.Operation] @@ -324,7 +329,7 @@ class ProxyResource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -361,7 +366,9 @@ class SubscriptionFeatureRegistration(ProxyResource): "properties": {"key": "properties", "type": "SubscriptionFeatureRegistrationProperties"}, } - def __init__(self, *, properties: Optional["_models.SubscriptionFeatureRegistrationProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.SubscriptionFeatureRegistrationProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: :paramtype properties: @@ -391,8 +398,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.SubscriptionFeatureRegistration"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of subscription feature registrations list. @@ -485,8 +492,8 @@ def __init__( metadata: Optional[Dict[str, str]] = None, should_feature_display_in_portal: bool = False, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: The state. Known values are: "NotSpecified", "NotRegistered", "Pending", "Registering", "Registered", "Unregistering", and "Unregistered". diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py index 89ee132fc2b3..8336c57ba7a8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py @@ -965,7 +965,7 @@ def create_or_update( :param feature_name: The feature name. Required. :type feature_name: str :param subscription_feature_registration_type: Subscription Feature Registration Type details. - Is either a model type or a IO type. Default value is None. + Is either a SubscriptionFeatureRegistration type or a IO type. Default value is None. :type subscription_feature_registration_type: ~azure.mgmt.resource.features.v2021_07_01.models.SubscriptionFeatureRegistration or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py index c2f32147e3a1..3f3289969ae6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py @@ -92,5 +92,5 @@ def __enter__(self) -> "ManagementLinkClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json index abb15aa3fa4a..8a65c63cfde1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py index bcc7d150a0da..ade659138499 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py @@ -92,5 +92,5 @@ async def __aenter__(self) -> "ManagementLinkClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py index f6f0e34d551d..6481d81b56a1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py @@ -276,8 +276,8 @@ async def create_or_update( /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. Required. :type link_id: str - :param parameters: Parameters for creating or updating a resource link. Is either a model type - or a IO type. Required. + :param parameters: Parameters for creating or updating a resource link. Is either a + ResourceLink type or a IO type. Required. :type parameters: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLink or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py index 485292ca5850..9b406e99aec0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization @@ -30,7 +30,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -69,8 +71,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -89,7 +91,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.links.v2016_09_01.models.Operation] @@ -102,7 +105,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.links.v2016_09_01.models.Operation] @@ -142,7 +147,7 @@ class ResourceLink(_serialization.Model): "properties": {"key": "properties", "type": "ResourceLinkProperties"}, } - def __init__(self, *, properties: Optional["_models.ResourceLinkProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ResourceLinkProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties for resource link. :paramtype properties: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLinkProperties @@ -171,7 +176,7 @@ class ResourceLinkFilter(_serialization.Model): "target_id": {"key": "targetId", "type": "str"}, } - def __init__(self, *, target_id: str, **kwargs): + def __init__(self, *, target_id: str, **kwargs: Any) -> None: """ :keyword target_id: The ID of the target resource. Required. :paramtype target_id: str @@ -206,7 +211,7 @@ class ResourceLinkProperties(_serialization.Model): "notes": {"key": "notes", "type": "str"}, } - def __init__(self, *, target_id: str, notes: Optional[str] = None, **kwargs): + def __init__(self, *, target_id: str, notes: Optional[str] = None, **kwargs: Any) -> None: """ :keyword target_id: The fully qualified ID of the target resource in the link. Required. :paramtype target_id: str @@ -242,7 +247,7 @@ class ResourceLinkResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ResourceLink"], **kwargs): + def __init__(self, *, value: List["_models.ResourceLink"], **kwargs: Any) -> None: """ :keyword value: An array of resource links. Required. :paramtype value: list[~azure.mgmt.resource.links.v2016_09_01.models.ResourceLink] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py index 069884b93778..b007f010ffdd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py @@ -414,8 +414,8 @@ def create_or_update( /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink. Required. :type link_id: str - :param parameters: Parameters for creating or updating a resource link. Is either a model type - or a IO type. Required. + :param parameters: Parameters for creating or updating a resource link. Is either a + ResourceLink type or a IO type. Required. :type parameters: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLink or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py index 3572989b17b6..43e9d738fb80 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py @@ -88,5 +88,5 @@ def __enter__(self) -> "ManagementLockClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json index 5eddd2d2f122..f8504539f56e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py index edc300388c08..61cddc901533 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py @@ -88,5 +88,5 @@ async def __aenter__(self) -> "ManagementLockClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py index 25877e832466..8ba4156e3fd6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py @@ -138,8 +138,8 @@ async def create_or_update_at_resource_group_level( :type resource_group_name: str :param lock_name: The lock name. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -436,8 +436,8 @@ async def create_or_update_at_resource_level( :type resource_name: str :param lock_name: The name of lock. Required. :type lock_name: str - :param parameters: Create or update management lock parameters. Is either a model type or a IO - type. Required. + :param parameters: Create or update management lock parameters. Is either a + ManagementLockObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -642,8 +642,8 @@ async def create_or_update_at_subscription_level( :param lock_name: The name of lock. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py index c38cc9cb216a..8b016d48f716 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -31,8 +31,12 @@ class ManagementLockListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ManagementLockObject"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ManagementLockObject"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of locks. :paramtype value: list[~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject] @@ -81,8 +85,8 @@ def __init__( name: Optional[str] = None, level: Optional[Union[str, "_models.LockLevel"]] = None, notes: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the lock. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py index 5ab8d323a404..042637f985dd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py @@ -499,8 +499,8 @@ def create_or_update_at_resource_group_level( :type resource_group_name: str :param lock_name: The lock name. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -797,8 +797,8 @@ def create_or_update_at_resource_level( :type resource_name: str :param lock_name: The name of lock. Required. :type lock_name: str - :param parameters: Create or update management lock parameters. Is either a model type or a IO - type. Required. + :param parameters: Create or update management lock parameters. Is either a + ManagementLockObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1003,8 +1003,8 @@ def create_or_update_at_subscription_level( :param lock_name: The name of lock. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py index 6923f198f0ad..32a7546bd6ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py @@ -95,5 +95,5 @@ def __enter__(self) -> "ManagementLockClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json index dc6655ee668d..67aa781d3373 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py index 8fe859f18380..6b2dd571fb3e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py @@ -95,5 +95,5 @@ async def __aenter__(self) -> "ManagementLockClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py index e091cb202ab2..f48eaf7b059b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py @@ -261,8 +261,8 @@ async def create_or_update_at_resource_group_level( :param lock_name: The lock name. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -529,8 +529,8 @@ async def create_or_update_by_scope( :type scope: str :param lock_name: The name of lock. Required. :type lock_name: str - :param parameters: Create or update management lock parameters. Is either a model type or a IO - type. Required. + :param parameters: Create or update management lock parameters. Is either a + ManagementLockObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -840,8 +840,8 @@ async def create_or_update_at_resource_level( :param lock_name: The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. Required. :type lock_name: str - :param parameters: Parameters for creating or updating a management lock. Is either a model - type or a IO type. Required. + :param parameters: Parameters for creating or updating a management lock. Is either a + ManagementLockObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1152,8 +1152,8 @@ async def create_or_update_at_subscription_level( :param lock_name: The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py index ca0bf2f263cf..4eec71e7633b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -31,8 +31,12 @@ class ManagementLockListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ManagementLockObject"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ManagementLockObject"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of locks. :paramtype value: list[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject] @@ -90,8 +94,8 @@ def __init__( level: Union[str, "_models.LockLevel"], notes: Optional[str] = None, owners: Optional[List["_models.ManagementLockOwner"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword level: The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but @@ -124,7 +128,7 @@ class ManagementLockOwner(_serialization.Model): "application_id": {"key": "applicationId", "type": "str"}, } - def __init__(self, *, application_id: Optional[str] = None, **kwargs): + def __init__(self, *, application_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword application_id: The application ID of the lock owner. :paramtype application_id: str @@ -147,7 +151,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -182,8 +188,8 @@ def __init__( provider: Optional[str] = None, resource: Optional[str] = None, operation: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Authorization. :paramtype provider: str @@ -199,7 +205,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Authorization operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Authorization operations. It contains a list of + operations and a URL link to get the next set of results. :ivar value: List of Microsoft.Authorization operations. :vartype value: list[~azure.mgmt.resource.locks.v2016_09_01.models.Operation] @@ -212,7 +219,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Authorization operations. :paramtype value: list[~azure.mgmt.resource.locks.v2016_09_01.models.Operation] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py index ee0c44d77bbf..3a9569aac39c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py @@ -780,8 +780,8 @@ def create_or_update_at_resource_group_level( :param lock_name: The lock name. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1048,8 +1048,8 @@ def create_or_update_by_scope( :type scope: str :param lock_name: The name of lock. Required. :type lock_name: str - :param parameters: Create or update management lock parameters. Is either a model type or a IO - type. Required. + :param parameters: Create or update management lock parameters. Is either a + ManagementLockObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1359,8 +1359,8 @@ def create_or_update_at_resource_level( :param lock_name: The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. Required. :type lock_name: str - :param parameters: Parameters for creating or updating a management lock. Is either a model - type or a IO type. Required. + :param parameters: Parameters for creating or updating a management lock. Is either a + ManagementLockObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1671,8 +1671,8 @@ def create_or_update_at_subscription_level( :param lock_name: The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters. Required. :type lock_name: str - :param parameters: The management lock parameters. Is either a model type or a IO type. - Required. + :param parameters: The management lock parameters. Is either a ManagementLockObject type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_application_client.py index 578b3c22bc05..130ea067a5cc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_application_client.py @@ -92,5 +92,5 @@ def __enter__(self) -> "ApplicationClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_metadata.json index ba5f9d28822c..e4b116f870f2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_vendor.py index 9dff0718b06c..06217a584f63 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/_application_client.py index d512c4f5abc1..dcb06e1255fa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/_application_client.py @@ -92,5 +92,5 @@ async def __aenter__(self) -> "ApplicationClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/operations/_operations.py index 6e896a245b1e..1f1886f9a1ee 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/aio/operations/_operations.py @@ -493,7 +493,7 @@ async def begin_create_or_update( :param application_name: The name of the managed application. Required. :type application_name: str :param parameters: Parameters supplied to the create or update a managed application. Is either - a model type or a IO type. Required. + a Application type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -638,7 +638,7 @@ async def update( :param application_name: The name of the managed application. Required. :type application_name: str :param parameters: Parameters supplied to update an existing managed application. Is either a - model type or a IO type. Default value is None. + ApplicationPatchable type or a IO type. Default value is None. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.ApplicationPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1188,7 +1188,7 @@ async def begin_create_or_update_by_id( Required. :type application_id: str :param parameters: Parameters supplied to the create or update a managed application. Is either - a model type or a IO type. Required. + a Application type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1323,7 +1323,7 @@ async def update_by_id( Required. :type application_id: str :param parameters: Parameters supplied to update an existing managed application. Is either a - model type or a IO type. Default value is None. + Application type or a IO type. Default value is None. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1757,7 +1757,7 @@ async def begin_create_or_update( :param application_definition_name: The name of the managed application definition. Required. :type application_definition_name: str :param parameters: Parameters supplied to the create or update an managed application - definition. Is either a model type or a IO type. Required. + definition. Is either a ApplicationDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.ApplicationDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2259,7 +2259,7 @@ async def begin_create_or_update_by_id( :param application_definition_name: The name of the managed application definition. Required. :type application_definition_name: str :param parameters: Parameters supplied to the create or update a managed application - definition. Is either a model type or a IO type. Required. + definition. Is either a ApplicationDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.ApplicationDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/models/_models_py3.py index c1d92c8d50fa..50e23ab5df9e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/models/_models_py3.py @@ -58,7 +58,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -121,8 +121,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -226,8 +226,8 @@ def __init__( plan: Optional["_models.Plan"] = None, application_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -287,8 +287,8 @@ def __init__( name: Optional[str] = None, uri: Optional[str] = None, type: Optional[Union[str, "_models.ApplicationArtifactType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The managed application artifact name. :paramtype name: str @@ -401,8 +401,8 @@ def __init__( package_file_uri: Optional[str] = None, main_template: Optional[JSON] = None, create_ui_definition: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -474,8 +474,8 @@ def __init__( *, value: Optional[List["_models.ApplicationDefinition"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The array of managed application definitions. :paramtype value: @@ -503,8 +503,8 @@ class ApplicationListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Application"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Application"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The array of managed applications. :paramtype value: list[~azure.mgmt.resource.managedapplications.v2018_06_01.models.Application] @@ -598,8 +598,8 @@ def __init__( managed_resource_group_id: Optional[str] = None, application_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -659,7 +659,7 @@ class ApplicationProviderAuthorization(_serialization.Model): "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, } - def __init__(self, *, principal_id: str, role_definition_id: str, **kwargs): + def __init__(self, *, principal_id: str, role_definition_id: str, **kwargs: Any) -> None: """ :keyword principal_id: The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources. Required. @@ -675,7 +675,8 @@ def __init__(self, *, principal_id: str, role_definition_id: str, **kwargs): class ErrorResponse(_serialization.Model): - """Error response indicates managed application is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates managed application is not able to process the incoming request. The + reason is provided in the error message. :ivar http_status: Http status code. :vartype http_status: str @@ -697,8 +698,8 @@ def __init__( http_status: Optional[str] = None, error_code: Optional[str] = None, error_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword http_status: Http status code. :paramtype http_status: str @@ -737,7 +738,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Default value is "SystemAssigned". :paramtype type: str @@ -762,7 +763,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -798,8 +801,8 @@ def __init__( provider: Optional[str] = None, resource: Optional[str] = None, operation: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Solutions. :paramtype provider: str @@ -815,7 +818,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Solutions operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Solutions operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Solutions operations. :vartype value: list[~azure.mgmt.resource.managedapplications.v2018_06_01.models.Operation] @@ -828,7 +832,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Solutions operations. :paramtype value: list[~azure.mgmt.resource.managedapplications.v2018_06_01.models.Operation] @@ -873,8 +879,15 @@ class Plan(_serialization.Model): } def __init__( - self, *, name: str, publisher: str, product: str, version: str, promotion_code: Optional[str] = None, **kwargs - ): + self, + *, + name: str, + publisher: str, + product: str, + version: str, + promotion_code: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword name: The plan name. Required. :paramtype name: str @@ -926,8 +939,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan name. :paramtype name: str @@ -989,8 +1002,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. Required. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/operations/_operations.py index ba152d4cc757..23f8f0adf86e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2018_06_01/operations/_operations.py @@ -1034,7 +1034,7 @@ def begin_create_or_update( :param application_name: The name of the managed application. Required. :type application_name: str :param parameters: Parameters supplied to the create or update a managed application. Is either - a model type or a IO type. Required. + a Application type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1179,7 +1179,7 @@ def update( :param application_name: The name of the managed application. Required. :type application_name: str :param parameters: Parameters supplied to update an existing managed application. Is either a - model type or a IO type. Default value is None. + ApplicationPatchable type or a IO type. Default value is None. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.ApplicationPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1729,7 +1729,7 @@ def begin_create_or_update_by_id( Required. :type application_id: str :param parameters: Parameters supplied to the create or update a managed application. Is either - a model type or a IO type. Required. + a Application type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1864,7 +1864,7 @@ def update_by_id( Required. :type application_id: str :param parameters: Parameters supplied to update an existing managed application. Is either a - model type or a IO type. Default value is None. + Application type or a IO type. Default value is None. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2298,7 +2298,7 @@ def begin_create_or_update( :param application_definition_name: The name of the managed application definition. Required. :type application_definition_name: str :param parameters: Parameters supplied to the create or update an managed application - definition. Is either a model type or a IO type. Required. + definition. Is either a ApplicationDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.ApplicationDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2800,7 +2800,7 @@ def begin_create_or_update_by_id( :param application_definition_name: The name of the managed application definition. Required. :type application_definition_name: str :param parameters: Parameters supplied to the create or update a managed application - definition. Is either a model type or a IO type. Required. + definition. Is either a ApplicationDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.resource.managedapplications.v2018_06_01.models.ApplicationDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json index f429975850bd..41a9b3e3ec20 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py index 3173904294b0..782e2e070837 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py @@ -93,5 +93,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py index 1310d5becdba..dc2c8e30c049 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py @@ -93,5 +93,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py index 4252ffa2aa93..7d0be212ff97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py @@ -204,8 +204,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -767,8 +767,8 @@ async def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -970,8 +970,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py index 5676fc284ce3..e62f3c3aac69 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py @@ -58,8 +58,8 @@ def __init__( display_name: Optional[str] = None, policy_definition_id: Optional[str] = None, scope: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the policy assignment. :paramtype id: str @@ -98,8 +98,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment] @@ -153,8 +157,8 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, policy_rule: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the policy definition. If you do not specify a value for name, the value is inferred from the name value in the request URI. @@ -194,8 +198,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinition] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py index 67d1ca27feec..2a6d26b677fb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py @@ -604,8 +604,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1167,8 +1167,8 @@ def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1370,8 +1370,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json index 8f50e5e24181..e69e6d305358 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py index 04b82dc602d0..bb00ba5fdfc7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py @@ -93,5 +93,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py index e140fa5aad7c..4066ffb19df3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py @@ -93,5 +93,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py index 90be02588696..e72ba05dc229 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py @@ -202,8 +202,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -753,8 +753,8 @@ async def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -952,8 +952,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py index f03602f6ef48..7f505fda3540 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py @@ -58,8 +58,8 @@ def __init__( display_name: Optional[str] = None, policy_definition_id: Optional[str] = None, scope: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the policy assignment. :paramtype id: str @@ -98,8 +98,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment] @@ -153,8 +157,8 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, policy_rule: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the policy definition. If you do not specify a value for name, the value is inferred from the name value in the request URI. @@ -193,8 +197,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinition] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py index b8a72200ed66..c2ce34692981 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py @@ -576,8 +576,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1127,8 +1127,8 @@ def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1326,8 +1326,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json index 4947b4f3934b..f185aa13ffe3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py index c85788a1b814..cc0e19e09986 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py @@ -93,5 +93,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py index 029e17980b41..de6f6c8b9cc9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py @@ -93,5 +93,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py index 67a8ff830ecc..60410b8e2f92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py @@ -129,8 +129,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -432,8 +432,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1018,8 +1018,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1569,8 +1569,8 @@ async def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py index eb9bbf1cf41c..e77ee2dc9fbf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py @@ -71,8 +71,8 @@ def __init__( scope: Optional[str] = None, parameters: Optional[JSON] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the policy assignment. :paramtype type: str @@ -115,8 +115,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment] @@ -182,8 +186,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -229,8 +233,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py index 447208d7d4d4..aa9e7d12556d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py @@ -650,8 +650,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -953,8 +953,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1535,8 +1535,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -2086,8 +2086,8 @@ def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json index d85cda4731eb..5dc6e9b54c97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py index ae5306ff65d0..bd8dd5d948f9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py @@ -96,5 +96,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py index 1bffcf7c91ae..a42064148962 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py @@ -96,5 +96,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py index 2d4ae607eda7..fcc4157608ef 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py @@ -224,8 +224,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -760,8 +760,8 @@ async def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -965,8 +965,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -1428,8 +1428,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -1778,8 +1778,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -2081,8 +2081,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py index ba23c4d2984f..fdfecbe93a6c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py @@ -24,7 +24,8 @@ class ErrorResponse(_serialization.Model): - """Error response indicates ARM is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates ARM is not able to process the incoming request. The reason is + provided in the error message. :ivar http_status: Http status code. :vartype http_status: str @@ -46,8 +47,8 @@ def __init__( http_status: Optional[str] = None, error_code: Optional[str] = None, error_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword http_status: Http status code. :paramtype http_status: str @@ -122,8 +123,8 @@ def __init__( parameters: Optional[JSON] = None, description: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: The policy sku. :paramtype sku: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySku @@ -171,8 +172,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment] @@ -238,8 +243,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -286,8 +291,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition] @@ -313,7 +322,9 @@ class PolicyDefinitionReference(_serialization.Model): "parameters": {"key": "parameters", "type": "object"}, } - def __init__(self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs): + def __init__( + self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. :paramtype policy_definition_id: str @@ -380,8 +391,8 @@ def __init__( metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -428,8 +439,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: @@ -462,7 +477,7 @@ class PolicySku(_serialization.Model): "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the policy sku. Possible values are A0 and A1. Required. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py index 7126c869622d..c3032be66552 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py @@ -1057,8 +1057,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1593,8 +1593,8 @@ def create_by_id( '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -1798,8 +1798,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -2261,8 +2261,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', @@ -2611,8 +2611,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. @@ -2914,8 +2914,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json index 1ec0cd9bd9ac..463cd4cf8dcb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py index 4720c5a79986..049982e7bc4c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py @@ -99,5 +99,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py index 91d7615364ce..bcb76ce44f56 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py @@ -99,5 +99,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py index 905bb3f95037..2275426f53f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py @@ -250,8 +250,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -878,8 +878,8 @@ async def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1090,8 +1090,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1408,8 +1408,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1931,8 +1931,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2423,8 +2423,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py index 82a1ad683f2c..e2f1296065e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py @@ -24,7 +24,8 @@ class ErrorResponse(_serialization.Model): - """Error response indicates Azure Resource Manager is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates Azure Resource Manager is not able to process the incoming request. + The reason is provided in the error message. :ivar http_status: Http status code. :vartype http_status: str @@ -46,8 +47,8 @@ def __init__( http_status: Optional[str] = None, error_code: Optional[str] = None, error_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword http_status: Http status code. :paramtype http_status: str @@ -123,8 +124,8 @@ def __init__( parameters: Optional[JSON] = None, description: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: The policy sku. This property is optional, obsolete, and will be ignored. :paramtype sku: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySku @@ -173,8 +174,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment] @@ -244,8 +249,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -292,8 +297,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition] @@ -319,7 +328,9 @@ class PolicyDefinitionReference(_serialization.Model): "parameters": {"key": "parameters", "type": "object"}, } - def __init__(self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs): + def __init__( + self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. :paramtype policy_definition_id: str @@ -386,8 +397,8 @@ def __init__( metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -432,8 +443,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition] @@ -465,7 +480,7 @@ class PolicySku(_serialization.Model): "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the policy sku. Possible values are A0 and A1. Required. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py index ac957503aaa8..2add9a63852e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py @@ -1045,8 +1045,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1673,8 +1673,8 @@ def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1885,8 +1885,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2203,8 +2203,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2724,8 +2724,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3216,8 +3216,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json index 775c6e779df4..84e9833ea6d8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py index f12ae87116c7..3e2cb6beb4ff 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py @@ -99,5 +99,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py index 1451e2acd3a5..615688e46516 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py @@ -99,5 +99,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py index 617979f12e06..8dd8776aae0b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py @@ -250,8 +250,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -878,8 +878,8 @@ async def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1090,8 +1090,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1408,8 +1408,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1931,8 +1931,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2423,8 +2423,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py index fa2f093940d6..091e5b8f7c7c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py @@ -24,7 +24,8 @@ class ErrorResponse(_serialization.Model): - """Error response indicates Azure Resource Manager is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates Azure Resource Manager is not able to process the incoming request. + The reason is provided in the error message. :ivar http_status: Http status code. :vartype http_status: str @@ -46,8 +47,8 @@ def __init__( http_status: Optional[str] = None, error_code: Optional[str] = None, error_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword http_status: Http status code. :paramtype http_status: str @@ -86,7 +87,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.resource.policy.v2018_05_01.models.ResourceIdentityType @@ -167,8 +168,8 @@ def __init__( parameters: Optional[JSON] = None, description: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: The policy sku. This property is optional, obsolete, and will be ignored. :paramtype sku: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySku @@ -224,8 +225,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment] @@ -295,8 +300,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -343,8 +348,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition] @@ -370,7 +379,9 @@ class PolicyDefinitionReference(_serialization.Model): "parameters": {"key": "parameters", "type": "object"}, } - def __init__(self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs): + def __init__( + self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. :paramtype policy_definition_id: str @@ -437,8 +448,8 @@ def __init__( metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -483,8 +494,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition] @@ -516,7 +531,7 @@ class PolicySku(_serialization.Model): "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the policy sku. Possible values are A0 and A1. Required. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py index 68e5a8d69f0b..8f47b396de41 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py @@ -1045,8 +1045,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1673,8 +1673,8 @@ def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1885,8 +1885,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2203,8 +2203,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2724,8 +2724,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3216,8 +3216,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json index 874e6eecd3e7..793cfccbaa60 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py index 23dbe260b8bb..47f7756859b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py @@ -99,5 +99,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py index 9b7d56641593..7dce3a609672 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py @@ -99,5 +99,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py index 0a32954d1017..e2083ddc94a9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py @@ -250,8 +250,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -878,8 +878,8 @@ async def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1090,8 +1090,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1408,8 +1408,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1931,8 +1931,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2423,8 +2423,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py index 6eee995193fd..a86ee7465088 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py @@ -24,7 +24,8 @@ class ErrorResponse(_serialization.Model): - """Error response indicates Azure Resource Manager is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates Azure Resource Manager is not able to process the incoming request. + The reason is provided in the error message. :ivar http_status: Http status code. :vartype http_status: str @@ -46,8 +47,8 @@ def __init__( http_status: Optional[str] = None, error_code: Optional[str] = None, error_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword http_status: Http status code. :paramtype http_status: str @@ -86,7 +87,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.resource.policy.v2019_01_01.models.ResourceIdentityType @@ -167,8 +168,8 @@ def __init__( parameters: Optional[JSON] = None, description: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: The policy sku. This property is optional, obsolete, and will be ignored. :paramtype sku: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySku @@ -224,8 +225,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment] @@ -295,8 +300,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -343,8 +348,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition] @@ -370,7 +379,9 @@ class PolicyDefinitionReference(_serialization.Model): "parameters": {"key": "parameters", "type": "object"}, } - def __init__(self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs): + def __init__( + self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. :paramtype policy_definition_id: str @@ -437,8 +448,8 @@ def __init__( metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -483,8 +494,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition] @@ -516,7 +531,7 @@ class PolicySku(_serialization.Model): "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the policy sku. Possible values are A0 and A1. Required. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py index 25129b6b0497..1ee5bc9762ea 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py @@ -1045,8 +1045,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1673,8 +1673,8 @@ def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1885,8 +1885,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2203,8 +2203,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2724,8 +2724,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3216,8 +3216,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json index 8c48215ab41a..fdb16a1b2d3c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py index 046c2fea36de..e33511ff5af8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py @@ -99,5 +99,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py index 74184da5ea6a..bd37e04018dd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py @@ -99,5 +99,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py index 23bce1e912bd..adb90c176381 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py @@ -250,8 +250,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -878,8 +878,8 @@ async def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1090,8 +1090,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1408,8 +1408,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1931,8 +1931,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2423,8 +2423,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py index 3dee9c91c9c4..d6d848cb82da 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py @@ -24,7 +24,8 @@ class ErrorResponse(_serialization.Model): - """Error response indicates Azure Resource Manager is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates Azure Resource Manager is not able to process the incoming request. + The reason is provided in the error message. :ivar http_status: Http status code. :vartype http_status: str @@ -46,8 +47,8 @@ def __init__( http_status: Optional[str] = None, error_code: Optional[str] = None, error_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword http_status: Http status code. :paramtype http_status: str @@ -86,7 +87,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.resource.policy.v2019_06_01.models.ResourceIdentityType @@ -173,8 +174,8 @@ def __init__( description: Optional[str] = None, metadata: Optional[JSON] = None, enforcement_mode: Optional[Union[str, "_models.EnforcementMode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: The policy sku. This property is optional, obsolete, and will be ignored. :paramtype sku: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySku @@ -235,8 +236,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment] @@ -306,8 +311,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -354,8 +359,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition] @@ -381,7 +390,9 @@ class PolicyDefinitionReference(_serialization.Model): "parameters": {"key": "parameters", "type": "object"}, } - def __init__(self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs): + def __init__( + self, *, policy_definition_id: Optional[str] = None, parameters: Optional[JSON] = None, **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. :paramtype policy_definition_id: str @@ -448,8 +459,8 @@ def __init__( metadata: Optional[JSON] = None, parameters: Optional[JSON] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Known values are: "NotSpecified", "BuiltIn", and "Custom". @@ -494,8 +505,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition] @@ -527,7 +542,7 @@ class PolicySku(_serialization.Model): "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the policy sku. Possible values are A0 and A1. Required. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_policy_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_policy_client_enums.py index 673984bf1adf..8b463ae48c80 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_policy_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_policy_client_enums.py @@ -13,10 +13,10 @@ class EnforcementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The policy assignment enforcement mode. Possible values are Default and DoNotEnforce.""" - #: The policy effect is enforced during resource creation or update. DEFAULT = "Default" - #: The policy effect is not enforced during resource creation or update. + """The policy effect is enforced during resource creation or update.""" DO_NOT_ENFORCE = "DoNotEnforce" + """The policy effect is not enforced during resource creation or update.""" class PolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py index 82b5ed56d8b4..9329c4be19cb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py @@ -1045,8 +1045,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1673,8 +1673,8 @@ def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1885,8 +1885,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2203,8 +2203,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2724,8 +2724,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3216,8 +3216,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json index 949ac18c6a6c..8904abbcf5e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py index a7f3e0bf8240..4ea4a23cf989 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py @@ -99,5 +99,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py index efb9fb9fffc1..9f98a10da212 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py @@ -99,5 +99,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py index 3804f006b684..ada5d03f390f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py @@ -250,8 +250,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -970,8 +970,8 @@ async def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1180,8 +1180,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1498,8 +1498,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2021,8 +2021,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2507,8 +2507,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py index 400cfc9bcb9a..2e2821ef5d2f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py @@ -44,7 +44,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -52,7 +52,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -85,7 +86,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -120,7 +121,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. This is the only required field when adding a system assigned identity to a resource. Known values are: "SystemAssigned" and "None". @@ -161,8 +162,8 @@ def __init__( allowed_values: Optional[List[JSON]] = None, default_value: Optional[JSON] = None, metadata: Optional["_models.ParameterDefinitionsValueMetadata"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The data type of the parameter. Known values are: "String", "Array", "Object", "Boolean", "Integer", "Float", and "DateTime". @@ -206,8 +207,8 @@ def __init__( additional_properties: Optional[Dict[str, JSON]] = None, display_name: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -234,7 +235,7 @@ class ParameterValuesValue(_serialization.Model): "value": {"key": "value", "type": "object"}, } - def __init__(self, *, value: Optional[JSON] = None, **kwargs): + def __init__(self, *, value: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword value: The value of the parameter. :paramtype value: JSON @@ -322,8 +323,8 @@ def __init__( description: Optional[str] = None, metadata: Optional[JSON] = None, enforcement_mode: Optional[Union[str, "_models.EnforcementMode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: The policy sku. This property is optional, obsolete, and will be ignored. :paramtype sku: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySku @@ -387,8 +388,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment] @@ -461,8 +466,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[Dict[str, "_models.ParameterDefinitionsValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Known values are: "NotSpecified", "BuiltIn", "Custom", and "Static". @@ -535,8 +540,8 @@ def __init__( category: Optional[str] = None, description: Optional[str] = None, additional_metadata_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the group. Required. :paramtype name: str @@ -573,8 +578,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition] @@ -622,8 +631,8 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterValuesValue"]] = None, policy_definition_reference_id: Optional[str] = None, group_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. Required. @@ -708,8 +717,8 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterDefinitionsValue"]] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, policy_definition_groups: Optional[List["_models.PolicyDefinitionGroup"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Known values are: "NotSpecified", "BuiltIn", "Custom", and "Static". @@ -761,8 +770,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition] @@ -794,7 +807,7 @@ class PolicySku(_serialization.Model): "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, tier: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the policy sku. Possible values are A0 and A1. Required. :paramtype name: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_policy_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_policy_client_enums.py index 32d926e71d18..74587f324e1f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_policy_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_policy_client_enums.py @@ -13,10 +13,10 @@ class EnforcementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The policy assignment enforcement mode. Possible values are Default and DoNotEnforce.""" - #: The policy effect is enforced during resource creation or update. DEFAULT = "Default" - #: The policy effect is not enforced during resource creation or update. + """The policy effect is enforced during resource creation or update.""" DO_NOT_ENFORCE = "DoNotEnforce" + """The policy effect is not enforced during resource creation or update.""" class ParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -45,8 +45,8 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): resource. """ - #: Indicates that a system assigned identity is associated with the resource. SYSTEM_ASSIGNED = "SystemAssigned" - #: Indicates that no identity is associated with the resource or that the existing identity should - #: be removed. + """Indicates that a system assigned identity is associated with the resource.""" NONE = "None" + """Indicates that no identity is associated with the resource or that the existing identity should + #: be removed.""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py index cfee3584adba..7ab97f19bbf9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py @@ -1086,8 +1086,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1806,8 +1806,8 @@ def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2016,8 +2016,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2334,8 +2334,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2855,8 +2855,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3341,8 +3341,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json index 5d6bbc12e01a..a67168bb9494 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py index 0756e74015ce..ae2b7d0d6d3c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py @@ -114,5 +114,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py index 04bed4c289cf..7ad8314b2f56 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py @@ -114,5 +114,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py index 090dd2be1deb..62fdb0aa9014 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py @@ -414,8 +414,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1135,8 +1135,8 @@ async def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1345,8 +1345,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1663,8 +1663,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2222,8 +2222,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2729,8 +2729,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3207,8 +3207,8 @@ async def create_or_update( :type scope: str :param policy_exemption_name: The name of the policy exemption to delete. Required. :type policy_exemption_name: str - :param parameters: Parameters for the policy exemption. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy exemption. Is either a PolicyExemption type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py index 69ca74cd2aa1..d998745376eb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py @@ -65,8 +65,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -122,8 +122,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -162,7 +162,7 @@ class AliasPathMetadata(_serialization.Model): "attributes": {"key": "attributes", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -192,8 +192,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -222,7 +222,7 @@ class DataEffect(_serialization.Model): "details_schema": {"key": "detailsSchema", "type": "object"}, } - def __init__(self, *, name: Optional[str] = None, details_schema: Optional[JSON] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, details_schema: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword name: The data effect name. :paramtype name: str @@ -265,8 +265,8 @@ def __init__( fully_qualified_resource_type: Optional[str] = None, default_properties: Optional[List[str]] = None, allow_custom_properties: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The function name as it will appear in the policy rule. eg - 'vault'. :paramtype name: str @@ -354,8 +354,8 @@ def __init__( field_values: Optional[List[str]] = None, standard: Optional[List[str]] = None, custom: Optional[List["_models.DataManifestCustomResourceFunctionDefinition"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword namespaces: The list of namespaces for the data policy manifest. :paramtype namespaces: list[str] @@ -406,8 +406,12 @@ class DataPolicyManifestListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DataPolicyManifest"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.DataPolicyManifest"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of data policy manifests. :paramtype value: list[~azure.mgmt.resource.policy.v2020_09_01.models.DataPolicyManifest] @@ -440,7 +444,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -448,7 +452,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -481,7 +486,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -516,7 +521,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. This is the only required field when adding a system assigned identity to a resource. Known values are: "SystemAssigned" and "None". @@ -529,7 +534,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] class NonComplianceMessage(_serialization.Model): - """A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and on resource's non-compliant compliance results. + """A message that describes why a resource is non-compliant with the policy. This is shown in + 'deny' error messages and on resource's non-compliant compliance results. All required parameters must be populated in order to send to Azure. @@ -552,7 +558,7 @@ class NonComplianceMessage(_serialization.Model): "policy_definition_reference_id": {"key": "policyDefinitionReferenceId", "type": "str"}, } - def __init__(self, *, message: str, policy_definition_reference_id: Optional[str] = None, **kwargs): + def __init__(self, *, message: str, policy_definition_reference_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and on resource's non-compliant compliance results. @@ -598,8 +604,8 @@ def __init__( allowed_values: Optional[List[JSON]] = None, default_value: Optional[JSON] = None, metadata: Optional["_models.ParameterDefinitionsValueMetadata"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The data type of the parameter. Known values are: "String", "Array", "Object", "Boolean", "Integer", "Float", and "DateTime". @@ -654,8 +660,8 @@ def __init__( description: Optional[str] = None, strong_type: Optional[str] = None, assign_permissions: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -691,7 +697,7 @@ class ParameterValuesValue(_serialization.Model): "value": {"key": "value", "type": "object"}, } - def __init__(self, *, value: Optional[JSON] = None, **kwargs): + def __init__(self, *, value: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword value: The value of the parameter. :paramtype value: JSON @@ -781,8 +787,8 @@ def __init__( metadata: Optional[JSON] = None, enforcement_mode: Union[str, "_models.EnforcementMode"] = "Default", non_compliance_messages: Optional[List["_models.NonComplianceMessage"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the policy assignment. Only required when utilizing managed identity. @@ -846,8 +852,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment] @@ -920,8 +930,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[Dict[str, "_models.ParameterDefinitionsValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Known values are: "NotSpecified", "BuiltIn", "Custom", and "Static". @@ -994,8 +1004,8 @@ def __init__( category: Optional[str] = None, description: Optional[str] = None, additional_metadata_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the group. Required. :paramtype name: str @@ -1032,8 +1042,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition] @@ -1081,8 +1095,8 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterValuesValue"]] = None, policy_definition_reference_id: Optional[str] = None, group_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. Required. @@ -1174,8 +1188,8 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_assignment_id: The ID of the policy assignment that is being exempted. Required. @@ -1232,7 +1246,7 @@ class PolicyExemptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PolicyExemption"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PolicyExemption"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of policy exemptions. :paramtype value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption] @@ -1305,8 +1319,8 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterDefinitionsValue"]] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, policy_definition_groups: Optional[List["_models.PolicyDefinitionGroup"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Known values are: "NotSpecified", "BuiltIn", "Custom", and "Static". @@ -1358,8 +1372,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition] @@ -1386,8 +1404,8 @@ class ResourceTypeAliases(_serialization.Model): } def __init__( - self, *, resource_type: Optional[str] = None, aliases: Optional[List["_models.Alias"]] = None, **kwargs - ): + self, *, resource_type: Optional[str] = None, aliases: Optional[List["_models.Alias"]] = None, **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type name. :paramtype resource_type: str @@ -1437,8 +1455,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py index dfa3190a3b57..a343ee244333 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py @@ -13,51 +13,51 @@ class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The attributes of the token that the alias path is referring to.""" - #: The token that the alias path is referring to has no attributes. NONE = "None" - #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + """The token that the alias path is referring to has no attributes.""" MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the token that the alias path is referring to.""" - #: The token type is not specified. NOT_SPECIFIED = "NotSpecified" - #: The token type can be anything. + """The token type is not specified.""" ANY = "Any" - #: The token type is string. + """The token type can be anything.""" STRING = "String" - #: The token type is object. + """The token type is string.""" OBJECT = "Object" - #: The token type is array. + """The token type is object.""" ARRAY = "Array" - #: The token type is integer. + """The token type is array.""" INTEGER = "Integer" - #: The token type is number. + """The token type is integer.""" NUMBER = "Number" - #: The token type is boolean. + """The token type is number.""" BOOLEAN = "Boolean" + """The token type is boolean.""" class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -72,20 +72,20 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class EnforcementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The policy assignment enforcement mode. Possible values are Default and DoNotEnforce.""" - #: The policy effect is enforced during resource creation or update. DEFAULT = "Default" - #: The policy effect is not enforced during resource creation or update. + """The policy effect is enforced during resource creation or update.""" DO_NOT_ENFORCE = "DoNotEnforce" + """The policy effect is not enforced during resource creation or update.""" class ExemptionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The policy exemption category. Possible values are Waiver and Mitigated.""" - #: This category of exemptions usually means the scope is not applicable for the policy. WAIVER = "Waiver" - #: This category of exemptions usually means the mitigation actions have been applied to the - #: scope. + """This category of exemptions usually means the scope is not applicable for the policy.""" MITIGATED = "Mitigated" + """This category of exemptions usually means the mitigation actions have been applied to the + #: scope.""" class ParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -114,8 +114,8 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): resource. """ - #: Indicates that a system assigned identity is associated with the resource. SYSTEM_ASSIGNED = "SystemAssigned" - #: Indicates that no identity is associated with the resource or that the existing identity should - #: be removed. + """Indicates that a system assigned identity is associated with the resource.""" NONE = "None" + """Indicates that no identity is associated with the resource or that the existing identity should + #: be removed.""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py index a6257c5c115c..cf09c77b37cc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py @@ -1576,8 +1576,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2297,8 +2297,8 @@ def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2507,8 +2507,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2825,8 +2825,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3384,8 +3384,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3891,8 +3891,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4369,8 +4369,8 @@ def create_or_update( :type scope: str :param policy_exemption_name: The name of the policy exemption to delete. Required. :type policy_exemption_name: str - :param parameters: Parameters for the policy exemption. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy exemption. Is either a PolicyExemption type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json index cc7b54cab10d..195803d2cd33 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py index 0d41aea61664..fb0dbc4a2ef5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py @@ -123,5 +123,5 @@ def __enter__(self) -> "PolicyClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py index c1cd843d872e..af133640f50d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py @@ -123,5 +123,5 @@ async def __aenter__(self) -> "PolicyClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py index 9dd5bd8b16bc..13daaae4db80 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py @@ -432,8 +432,8 @@ async def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -659,8 +659,8 @@ async def update( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for policy assignment patch request. Is either a model type or a - IO type. Required. + :param parameters: Parameters for policy assignment patch request. Is either a + PolicyAssignmentUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1315,8 +1315,8 @@ async def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1532,8 +1532,8 @@ async def update_by_id( :param policy_assignment_id: The ID of the policy assignment to update. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment patch request. Is either a model type or a - IO type. Required. + :param parameters: Parameters for policy assignment patch request. Is either a + PolicyAssignmentUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1678,8 +1678,8 @@ async def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1996,8 +1996,8 @@ async def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2555,8 +2555,8 @@ async def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3062,8 +3062,8 @@ async def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3540,8 +3540,8 @@ async def create_or_update( :type scope: str :param policy_exemption_name: The name of the policy exemption to delete. Required. :type policy_exemption_name: str - :param parameters: Parameters for the policy exemption. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy exemption. Is either a PolicyExemption type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4238,7 +4238,8 @@ async def create_or_update( :param variable_name: The name of the variable to operate on. Required. :type variable_name: str - :param parameters: Parameters for the variable. Is either a model type or a IO type. Required. + :param parameters: Parameters for the variable. Is either a Variable type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4508,7 +4509,8 @@ async def create_or_update_at_management_group( :type management_group_id: str :param variable_name: The name of the variable to operate on. Required. :type variable_name: str - :param parameters: Parameters for the variable. Is either a model type or a IO type. Required. + :param parameters: Parameters for the variable. Is either a Variable type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4955,8 +4957,8 @@ async def create_or_update( :type variable_name: str :param variable_value_name: The name of the variable value to operate on. Required. :type variable_value_name: str - :param parameters: Parameters for the variable value. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the variable value. Is either a VariableValue type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5410,8 +5412,8 @@ async def create_or_update_at_management_group( :type variable_name: str :param variable_value_name: The name of the variable value to operate on. Required. :type variable_value_name: str - :param parameters: Parameters for the variable value. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the variable value. Is either a VariableValue type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py index 8a701b2c0683..f4f9b0338798 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py @@ -65,8 +65,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -122,8 +122,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -162,7 +162,7 @@ class AliasPathMetadata(_serialization.Model): "attributes": {"key": "attributes", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -192,8 +192,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -222,7 +222,7 @@ class DataEffect(_serialization.Model): "details_schema": {"key": "detailsSchema", "type": "object"}, } - def __init__(self, *, name: Optional[str] = None, details_schema: Optional[JSON] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, details_schema: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword name: The data effect name. :paramtype name: str @@ -265,8 +265,8 @@ def __init__( fully_qualified_resource_type: Optional[str] = None, default_properties: Optional[List[str]] = None, allow_custom_properties: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The function name as it will appear in the policy rule. eg - 'vault'. :paramtype name: str @@ -354,8 +354,8 @@ def __init__( field_values: Optional[List[str]] = None, standard: Optional[List[str]] = None, custom: Optional[List["_models.DataManifestCustomResourceFunctionDefinition"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword namespaces: The list of namespaces for the data policy manifest. :paramtype namespaces: list[str] @@ -406,8 +406,12 @@ class DataPolicyManifestListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DataPolicyManifest"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.DataPolicyManifest"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of data policy manifests. :paramtype value: list[~azure.mgmt.resource.policy.v2021_06_01.models.DataPolicyManifest] @@ -440,7 +444,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -448,7 +452,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -481,7 +486,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -492,7 +497,8 @@ def __init__(self, **kwargs): class Identity(_serialization.Model): - """Identity for the resource. Policy assignments support a maximum of one identity. That is either a system assigned identity or a single user assigned identity. + """Identity for the resource. Policy assignments support a maximum of one identity. That is + either a system assigned identity or a single user assigned identity. Variables are only populated by the server, and will be ignored when sending a request. @@ -530,8 +536,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. This is the only required field when adding a system or user assigned identity to a resource. Known values are: "SystemAssigned", "UserAssigned", and @@ -551,7 +557,8 @@ def __init__( class NonComplianceMessage(_serialization.Model): - """A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and on resource's non-compliant compliance results. + """A message that describes why a resource is non-compliant with the policy. This is shown in + 'deny' error messages and on resource's non-compliant compliance results. All required parameters must be populated in order to send to Azure. @@ -574,7 +581,7 @@ class NonComplianceMessage(_serialization.Model): "policy_definition_reference_id": {"key": "policyDefinitionReferenceId", "type": "str"}, } - def __init__(self, *, message: str, policy_definition_reference_id: Optional[str] = None, **kwargs): + def __init__(self, *, message: str, policy_definition_reference_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and on resource's non-compliant compliance results. @@ -620,8 +627,8 @@ def __init__( allowed_values: Optional[List[JSON]] = None, default_value: Optional[JSON] = None, metadata: Optional["_models.ParameterDefinitionsValueMetadata"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The data type of the parameter. Known values are: "String", "Array", "Object", "Boolean", "Integer", "Float", and "DateTime". @@ -676,8 +683,8 @@ def __init__( description: Optional[str] = None, strong_type: Optional[str] = None, assign_permissions: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -713,7 +720,7 @@ class ParameterValuesValue(_serialization.Model): "value": {"key": "value", "type": "object"}, } - def __init__(self, *, value: Optional[JSON] = None, **kwargs): + def __init__(self, *, value: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword value: The value of the parameter. :paramtype value: JSON @@ -807,8 +814,8 @@ def __init__( metadata: Optional[JSON] = None, enforcement_mode: Union[str, "_models.EnforcementMode"] = "Default", non_compliance_messages: Optional[List["_models.NonComplianceMessage"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the policy assignment. Only required when utilizing managed identity. @@ -873,8 +880,12 @@ class PolicyAssignmentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyAssignment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy assignments. :paramtype value: list[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment] @@ -901,7 +912,9 @@ class PolicyAssignmentUpdate(_serialization.Model): "identity": {"key": "identity", "type": "Identity"}, } - def __init__(self, *, location: Optional[str] = None, identity: Optional["_models.Identity"] = None, **kwargs): + def __init__( + self, *, location: Optional[str] = None, identity: Optional["_models.Identity"] = None, **kwargs: Any + ) -> None: """ :keyword location: The location of the policy assignment. Only required when utilizing managed identity. @@ -979,8 +992,8 @@ def __init__( policy_rule: Optional[JSON] = None, metadata: Optional[JSON] = None, parameters: Optional[Dict[str, "_models.ParameterDefinitionsValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Known values are: "NotSpecified", "BuiltIn", "Custom", and "Static". @@ -1054,8 +1067,8 @@ def __init__( category: Optional[str] = None, description: Optional[str] = None, additional_metadata_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the group. Required. :paramtype name: str @@ -1092,8 +1105,12 @@ class PolicyDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicyDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition] @@ -1141,8 +1158,8 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterValuesValue"]] = None, policy_definition_reference_id: Optional[str] = None, group_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_definition_id: The ID of the policy definition or policy set definition. Required. @@ -1234,8 +1251,8 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_assignment_id: The ID of the policy assignment that is being exempted. Required. @@ -1292,7 +1309,7 @@ class PolicyExemptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PolicyExemption"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PolicyExemption"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of policy exemptions. :paramtype value: list[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption] @@ -1369,8 +1386,8 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterDefinitionsValue"]] = None, policy_definitions: Optional[List["_models.PolicyDefinitionReference"]] = None, policy_definition_groups: Optional[List["_models.PolicyDefinitionGroup"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Known values are: "NotSpecified", "BuiltIn", "Custom", and "Static". @@ -1423,8 +1440,12 @@ class PolicySetDefinitionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PolicySetDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: An array of policy set definitions. :paramtype value: list[~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition] @@ -1453,7 +1474,7 @@ class PolicyVariableColumn(_serialization.Model): "column_name": {"key": "columnName", "type": "str"}, } - def __init__(self, *, column_name: str, **kwargs): + def __init__(self, *, column_name: str, **kwargs: Any) -> None: """ :keyword column_name: The name of this policy variable column. Required. :paramtype column_name: str @@ -1484,7 +1505,7 @@ class PolicyVariableValueColumnValue(_serialization.Model): "column_value": {"key": "columnValue", "type": "object"}, } - def __init__(self, *, column_name: str, column_value: JSON, **kwargs): + def __init__(self, *, column_name: str, column_value: JSON, **kwargs: Any) -> None: """ :keyword column_name: Column name for the variable value. Required. :paramtype column_name: str @@ -1512,8 +1533,8 @@ class ResourceTypeAliases(_serialization.Model): } def __init__( - self, *, resource_type: Optional[str] = None, aliases: Optional[List["_models.Alias"]] = None, **kwargs - ): + self, *, resource_type: Optional[str] = None, aliases: Optional[List["_models.Alias"]] = None, **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type name. :paramtype resource_type: str @@ -1563,8 +1584,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1612,7 +1633,7 @@ class UserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1655,7 +1676,7 @@ class Variable(_serialization.Model): "columns": {"key": "properties.columns", "type": "[PolicyVariableColumn]"}, } - def __init__(self, *, columns: List["_models.PolicyVariableColumn"], **kwargs): + def __init__(self, *, columns: List["_models.PolicyVariableColumn"], **kwargs: Any) -> None: """ :keyword columns: Variable column definitions. Required. :paramtype columns: list[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyVariableColumn] @@ -1688,7 +1709,7 @@ class VariableListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Variable"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Variable"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of variables. :paramtype value: list[~azure.mgmt.resource.policy.v2021_06_01.models.Variable] @@ -1735,7 +1756,7 @@ class VariableValue(_serialization.Model): "values": {"key": "properties.values", "type": "[PolicyVariableValueColumnValue]"}, } - def __init__(self, *, values: List["_models.PolicyVariableValueColumnValue"], **kwargs): + def __init__(self, *, values: List["_models.PolicyVariableValueColumnValue"], **kwargs: Any) -> None: """ :keyword values: Variable value column value array. Required. :paramtype values: @@ -1769,7 +1790,7 @@ class VariableValueListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.VariableValue"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.VariableValue"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of variable values. :paramtype value: list[~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_policy_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_policy_client_enums.py index d3c9137c492f..f5282a4be3cd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_policy_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_policy_client_enums.py @@ -13,51 +13,51 @@ class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The attributes of the token that the alias path is referring to.""" - #: The token that the alias path is referring to has no attributes. NONE = "None" - #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + """The token that the alias path is referring to has no attributes.""" MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the token that the alias path is referring to.""" - #: The token type is not specified. NOT_SPECIFIED = "NotSpecified" - #: The token type can be anything. + """The token type is not specified.""" ANY = "Any" - #: The token type is string. + """The token type can be anything.""" STRING = "String" - #: The token type is object. + """The token type is string.""" OBJECT = "Object" - #: The token type is array. + """The token type is object.""" ARRAY = "Array" - #: The token type is integer. + """The token type is array.""" INTEGER = "Integer" - #: The token type is number. + """The token type is integer.""" NUMBER = "Number" - #: The token type is boolean. + """The token type is number.""" BOOLEAN = "Boolean" + """The token type is boolean.""" class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -72,20 +72,20 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class EnforcementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The policy assignment enforcement mode. Possible values are Default and DoNotEnforce.""" - #: The policy effect is enforced during resource creation or update. DEFAULT = "Default" - #: The policy effect is not enforced during resource creation or update. + """The policy effect is enforced during resource creation or update.""" DO_NOT_ENFORCE = "DoNotEnforce" + """The policy effect is not enforced during resource creation or update.""" class ExemptionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The policy exemption category. Possible values are Waiver and Mitigated.""" - #: This category of exemptions usually means the scope is not applicable for the policy. WAIVER = "Waiver" - #: This category of exemptions usually means the mitigation actions have been applied to the - #: scope. + """This category of exemptions usually means the scope is not applicable for the policy.""" MITIGATED = "Mitigated" + """This category of exemptions usually means the mitigation actions have been applied to the + #: scope.""" class ParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -114,10 +114,10 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): identity to a resource. """ - #: Indicates that a system assigned identity is associated with the resource. SYSTEM_ASSIGNED = "SystemAssigned" - #: Indicates that a system assigned identity is associated with the resource. + """Indicates that a system assigned identity is associated with the resource.""" USER_ASSIGNED = "UserAssigned" - #: Indicates that no identity is associated with the resource or that the existing identity should - #: be removed. + """Indicates that a system assigned identity is associated with the resource.""" NONE = "None" + """Indicates that no identity is associated with the resource or that the existing identity should + #: be removed.""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py index e4074e64545b..5ca43067c731 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py @@ -2143,8 +2143,8 @@ def create( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for the policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy assignment. Is either a PolicyAssignment type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2370,8 +2370,8 @@ def update( :type scope: str :param policy_assignment_name: The name of the policy assignment. Required. :type policy_assignment_name: str - :param parameters: Parameters for policy assignment patch request. Is either a model type or a - IO type. Required. + :param parameters: Parameters for policy assignment patch request. Is either a + PolicyAssignmentUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3026,8 +3026,8 @@ def create_by_id( :param policy_assignment_id: The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment. Is either a model type or a IO type. - Required. + :param parameters: Parameters for policy assignment. Is either a PolicyAssignment type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3243,8 +3243,8 @@ def update_by_id( :param policy_assignment_id: The ID of the policy assignment to update. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required. :type policy_assignment_id: str - :param parameters: Parameters for policy assignment patch request. Is either a model type or a - IO type. Required. + :param parameters: Parameters for policy assignment patch request. Is either a + PolicyAssignmentUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3389,8 +3389,8 @@ def create_or_update( :param policy_definition_name: The name of the policy definition to create. Required. :type policy_definition_name: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3707,8 +3707,8 @@ def create_or_update_at_management_group( :type policy_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy definition properties. Is either a PolicyDefinition type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4266,8 +4266,8 @@ def create_or_update( :param policy_set_definition_name: The name of the policy set definition to create. Required. :type policy_set_definition_name: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4773,8 +4773,8 @@ def create_or_update_at_management_group( :type policy_set_definition_name: str :param management_group_id: The ID of the management group. Required. :type management_group_id: str - :param parameters: The policy set definition properties. Is either a model type or a IO type. - Required. + :param parameters: The policy set definition properties. Is either a PolicySetDefinition type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5251,8 +5251,8 @@ def create_or_update( :type scope: str :param policy_exemption_name: The name of the policy exemption to delete. Required. :type policy_exemption_name: str - :param parameters: Parameters for the policy exemption. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the policy exemption. Is either a PolicyExemption type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5949,7 +5949,8 @@ def create_or_update( :param variable_name: The name of the variable to operate on. Required. :type variable_name: str - :param parameters: Parameters for the variable. Is either a model type or a IO type. Required. + :param parameters: Parameters for the variable. Is either a Variable type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6219,7 +6220,8 @@ def create_or_update_at_management_group( :type management_group_id: str :param variable_name: The name of the variable to operate on. Required. :type variable_name: str - :param parameters: Parameters for the variable. Is either a model type or a IO type. Required. + :param parameters: Parameters for the variable. Is either a Variable type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6662,8 +6664,8 @@ def create_or_update( :type variable_name: str :param variable_value_name: The name of the variable value to operate on. Required. :type variable_value_name: str - :param parameters: Parameters for the variable value. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the variable value. Is either a VariableValue type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7117,8 +7119,8 @@ def create_or_update_at_management_group( :type variable_name: str :param variable_value_name: The name of the variable value to operate on. Required. :type variable_value_name: str - :param parameters: Parameters for the variable value. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the variable value. Is either a VariableValue type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json index 283d7831adc5..36d2e211ca9c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py index ffe67b68e095..a37aeac34f97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py @@ -94,5 +94,5 @@ def __enter__(self) -> "ResourcePrivateLinkClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py index af9ff7d3089f..5ea1b851fa3c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py @@ -94,5 +94,5 @@ async def __aenter__(self) -> "ResourcePrivateLinkClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py index bd70e3274229..a57c6e109c4f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py @@ -125,7 +125,7 @@ async def put( :param pla_id: The ID of the PLA. Required. :type pla_id: str :param parameters: Parameters supplied to create the private link association. Is either a - model type or a IO type. Required. + PrivateLinkAssociationObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.privatelinks.v2020_05_01.models.PrivateLinkAssociationObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -462,8 +462,8 @@ async def put( :type resource_group_name: str :param rmpl_name: The name of the resource management private link. Required. :type rmpl_name: str - :param parameters: The region to create the Resource Management private link. Is either a model - type or a IO type. Required. + :param parameters: The region to create the Resource Management private link. Is either a + ResourceManagementPrivateLinkLocation type or a IO type. Required. :type parameters: ~azure.mgmt.resource.privatelinks.v2020_05_01.models.ResourceManagementPrivateLinkLocation or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py index bc928f8be2b1..810f72ec72e9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -37,7 +37,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -45,7 +45,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -78,7 +79,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -117,7 +118,9 @@ class PrivateLinkAssociation(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.PrivateLinkAssociationPropertiesExpanded"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.PrivateLinkAssociationPropertiesExpanded"] = None, **kwargs: Any + ) -> None: """ :keyword properties: The private link association properties. :paramtype properties: @@ -142,7 +145,7 @@ class PrivateLinkAssociationGetResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkAssociation]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkAssociation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkAssociation"]] = None, **kwargs: Any) -> None: """ :keyword value: private link association information. :paramtype value: @@ -164,7 +167,9 @@ class PrivateLinkAssociationObject(_serialization.Model): "properties": {"key": "properties", "type": "PrivateLinkAssociationProperties"}, } - def __init__(self, *, properties: Optional["_models.PrivateLinkAssociationProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.PrivateLinkAssociationProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: The properties of the PrivateLinkAssociation. :paramtype properties: @@ -194,8 +199,8 @@ def __init__( *, private_link: Optional[str] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccessOptions"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_link: The rmpl Resource ID. :paramtype private_link: str @@ -236,8 +241,8 @@ def __init__( public_network_access: Optional[Union[str, "_models.PublicNetworkAccessOptions"]] = None, tenant_id: Optional[str] = None, scope: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_link: The rmpl Resource ID. :paramtype private_link: str @@ -293,8 +298,8 @@ def __init__( *, properties: Optional["_models.ResourceManagementPrivateLinkEndpointConnections"] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: :paramtype properties: @@ -321,7 +326,7 @@ class ResourceManagementPrivateLinkEndpointConnections(_serialization.Model): "private_endpoint_connections": {"key": "privateEndpointConnections", "type": "[str]"}, } - def __init__(self, *, private_endpoint_connections: Optional[List[str]] = None, **kwargs): + def __init__(self, *, private_endpoint_connections: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword private_endpoint_connections: The private endpoint connections. :paramtype private_endpoint_connections: list[str] @@ -342,7 +347,7 @@ class ResourceManagementPrivateLinkListResult(_serialization.Model): "value": {"key": "value", "type": "[ResourceManagementPrivateLink]"}, } - def __init__(self, *, value: Optional[List["_models.ResourceManagementPrivateLink"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceManagementPrivateLink"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource management private links. :paramtype value: @@ -363,7 +368,7 @@ class ResourceManagementPrivateLinkLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: the region to create private link association. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py index 39b0281d3529..c4ae62bf4f05 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py @@ -393,7 +393,7 @@ def put( :param pla_id: The ID of the PLA. Required. :type pla_id: str :param parameters: Parameters supplied to create the private link association. Is either a - model type or a IO type. Required. + PrivateLinkAssociationObject type or a IO type. Required. :type parameters: ~azure.mgmt.resource.privatelinks.v2020_05_01.models.PrivateLinkAssociationObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -730,8 +730,8 @@ def put( :type resource_group_name: str :param rmpl_name: The name of the resource management private link. Required. :type rmpl_name: str - :param parameters: The region to create the Resource Management private link. Is either a model - type or a IO type. Required. + :param parameters: The region to create the Resource Management private link. Is either a + ResourceManagementPrivateLinkLocation type or a IO type. Required. :type parameters: ~azure.mgmt.resource.privatelinks.v2020_05_01.models.ResourceManagementPrivateLinkLocation or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json index b29f13406f67..75ac113d7a8e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py index efb685bb5904..b6fb6cef97e0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py @@ -114,5 +114,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py index 717e13c294f0..e20efff83de5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py @@ -116,5 +116,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py index 68200f273298..460ba0d4b992 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py @@ -420,8 +420,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -675,7 +675,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Deployment to validate. Is either a model type or a IO type. Required. + :param parameters: Deployment to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1474,7 +1474,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group to be created or updated. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update resource group service - operation. Is either a model type or a IO type. Required. + operation. Is either a ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1765,7 +1765,7 @@ async def patch( is case insensitive. Required. :type resource_group_name: str :param parameters: Parameters supplied to the update state resource group service operation. Is - either a model type or a IO type. Required. + either a ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1885,7 +1885,7 @@ async def export_template( :param resource_group_name: The name of the resource group to be created or updated. Required. :type resource_group_name: str :param parameters: Parameters supplied to the export template resource group operation. Is - either a model type or a IO type. Required. + either a ExportTemplateRequest type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2187,7 +2187,8 @@ async def begin_move_resources( :param source_resource_group_name: Source resource group name. Required. :type source_resource_group_name: str - :param parameters: move resources' parameters. Is either a model type or a IO type. Required. + :param parameters: move resources' parameters. Is either a ResourcesMoveInfo type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2604,8 +2605,8 @@ async def create_or_update( :type resource_name: str :param api_version: Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2879,8 +2880,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py index 980aae5ebfc6..06a295db585f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py @@ -42,7 +42,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -68,7 +68,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -103,8 +105,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -130,7 +132,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: The debug detail level. :paramtype detail_level: str @@ -166,8 +168,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2016_02_01.models.BasicDependency] @@ -196,7 +198,7 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The deployment properties. :paramtype properties: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentProperties @@ -216,7 +218,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -252,7 +254,9 @@ class DeploymentExtended(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__( + self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any + ) -> None: """ :keyword name: The name of the deployment. Required. :paramtype name: str @@ -277,7 +281,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -301,8 +305,12 @@ class DeploymentListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DeploymentExtended"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.DeploymentExtended"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentExtended] @@ -338,8 +346,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin operation_id: Optional[str] = None, properties: Optional["_models.DeploymentOperationProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Full deployment operation id. :paramtype id: str @@ -398,8 +406,8 @@ def __init__( target_resource: Optional["_models.TargetResource"] = None, request: Optional["_models.HttpMessage"] = None, response: Optional["_models.HttpMessage"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: The state of the provisioning. :paramtype provisioning_state: str @@ -444,8 +452,12 @@ class DeploymentOperationsListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DeploymentOperation"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.DeploymentOperation"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentOperation] @@ -500,8 +512,8 @@ def __init__( parameters: Optional[JSON] = None, parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. It can be a JObject or a well formed JSON string. Use only one of Template or TemplateLink. @@ -597,8 +609,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: The state of the provisioning. :paramtype provisioning_state: str @@ -664,8 +676,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -700,7 +712,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -708,7 +720,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -741,7 +754,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -768,7 +781,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -814,7 +827,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -889,8 +902,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -993,8 +1006,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1052,8 +1065,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1079,7 +1092,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1112,7 +1125,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Default value is "SystemAssigned". :paramtype type: str @@ -1143,7 +1156,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: URI referencing the template. Required. :paramtype uri: str @@ -1182,8 +1195,8 @@ def __init__( publisher: Optional[str] = None, product: Optional[str] = None, promotion_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1229,8 +1242,8 @@ def __init__( namespace: Optional[str] = None, registration_state: Optional[str] = None, resource_types: Optional[List["_models.ProviderResourceType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The provider id. :paramtype id: str @@ -1263,7 +1276,9 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Provider"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2016_02_01.models.Provider] @@ -1306,8 +1321,8 @@ def __init__( aliases: Optional[List["_models.AliasType"]] = None, api_versions: Optional[List[str]] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1369,8 +1384,8 @@ def __init__( name: Optional[str] = None, properties: Optional["_models.ResourceGroupProperties"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The Name of the resource group. :paramtype name: str @@ -1412,8 +1427,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1440,7 +1455,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1472,7 +1487,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, next_link: str, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup] @@ -1501,7 +1516,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1527,7 +1542,9 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__( + self, *, next_link: str, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of resources. :paramtype value: @@ -1575,8 +1592,8 @@ def __init__( message: str, target: Optional[str] = None, details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: The error code returned from the server. Required. :paramtype code: str @@ -1626,8 +1643,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -1662,7 +1679,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The ids of the resources. :paramtype resources: list[str] @@ -1709,8 +1728,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The sku name. :paramtype name: str @@ -1745,7 +1764,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource Id. :paramtype id: str @@ -1768,7 +1787,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -1812,8 +1831,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1849,7 +1868,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, next_link: str, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2016_02_01.models.TagDetails] @@ -1884,7 +1903,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -1920,8 +1941,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -1937,7 +1958,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -1950,7 +1972,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -1982,7 +2006,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: URI referencing the template. Required. :paramtype uri: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py index f4aaebbca38d..b32fdc3fb20c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py @@ -1488,8 +1488,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1743,7 +1743,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Deployment to validate. Is either a model type or a IO type. Required. + :param parameters: Deployment to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2540,7 +2540,7 @@ def create_or_update( :param resource_group_name: The name of the resource group to be created or updated. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update resource group service - operation. Is either a model type or a IO type. Required. + operation. Is either a ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2831,7 +2831,7 @@ def patch( is case insensitive. Required. :type resource_group_name: str :param parameters: Parameters supplied to the update state resource group service operation. Is - either a model type or a IO type. Required. + either a ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2951,7 +2951,7 @@ def export_template( :param resource_group_name: The name of the resource group to be created or updated. Required. :type resource_group_name: str :param parameters: Parameters supplied to the export template resource group operation. Is - either a model type or a IO type. Required. + either a ExportTemplateRequest type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3253,7 +3253,8 @@ def begin_move_resources( :param source_resource_group_name: Source resource group name. Required. :type source_resource_group_name: str - :param parameters: move resources' parameters. Is either a model type or a IO type. Required. + :param parameters: move resources' parameters. Is either a ResourcesMoveInfo type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3670,8 +3671,8 @@ def create_or_update( :type resource_name: str :param api_version: Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3945,8 +3946,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json index 1ca06341b0cb..d8c770d5efa5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py index 4c1ded8b0606..2d364dc1e499 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py @@ -114,5 +114,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py index 990043a48627..0cdcd8f053d7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py @@ -116,5 +116,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py index cd66c8c37e69..1255eede1851 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py @@ -440,8 +440,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -703,7 +703,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1505,7 +1505,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group to create or update. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1802,8 +1802,8 @@ async def patch( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a ResourceGroup + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1920,8 +1920,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2238,8 +2238,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2813,8 +2813,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3082,8 +3082,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3543,8 +3543,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3757,7 +3757,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py index 9c2a97ad5d8b..37806fa9f3f5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py @@ -41,7 +41,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -67,7 +67,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -102,8 +104,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -134,7 +136,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -175,8 +177,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2016_09_01.models.BasicDependency] @@ -211,7 +213,7 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", **kwargs): + def __init__(self, *, properties: "_models.DeploymentProperties", **kwargs: Any) -> None: """ :keyword properties: The deployment properties. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentProperties @@ -231,7 +233,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -267,7 +269,9 @@ class DeploymentExtended(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__( + self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any + ) -> None: """ :keyword name: The name of the deployment. Required. :paramtype name: str @@ -292,7 +296,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -321,7 +325,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentExtended] @@ -356,7 +360,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -413,7 +417,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -446,7 +450,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentOperation] @@ -511,8 +515,8 @@ def __init__( parameters: Optional[JSON] = None, parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -621,8 +625,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -683,8 +687,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -719,7 +723,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -727,7 +731,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -760,7 +765,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -787,7 +792,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -833,7 +838,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -909,8 +914,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1014,8 +1019,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1073,8 +1078,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1100,7 +1105,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1133,7 +1138,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Default value is "SystemAssigned". :paramtype type: str @@ -1164,7 +1169,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1203,8 +1208,8 @@ def __init__( publisher: Optional[str] = None, product: Optional[str] = None, promotion_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1251,7 +1256,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1283,7 +1288,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2016_09_01.models.Provider] @@ -1328,8 +1333,8 @@ def __init__( api_versions: Optional[List[str]] = None, zone_mappings: Optional[List["_models.ZoneMapping"]] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1397,8 +1402,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1442,8 +1447,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1470,7 +1475,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1502,7 +1507,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup] @@ -1529,7 +1534,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1555,7 +1560,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -1596,7 +1601,7 @@ class ResourceManagementErrorWithDetails(_serialization.Model): "details": {"key": "details", "type": "[ResourceManagementErrorWithDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1636,8 +1641,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -1672,7 +1677,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -1719,8 +1726,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -1755,7 +1762,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -1778,7 +1785,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -1823,8 +1830,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1861,7 +1868,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2016_09_01.models.TagDetails] @@ -1894,7 +1901,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -1930,8 +1939,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -1947,7 +1956,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -1960,7 +1970,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -1992,7 +2004,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2018,7 +2030,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py index cf207baed59a..9035ce03f3d5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py @@ -1630,8 +1630,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1893,7 +1893,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2693,7 +2693,7 @@ def create_or_update( :param resource_group_name: The name of the resource group to create or update. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2990,8 +2990,8 @@ def patch( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a ResourceGroup + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3108,8 +3108,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3426,8 +3426,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4001,8 +4001,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4270,8 +4270,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4731,8 +4731,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4945,7 +4945,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json index fab978c90f43..9779b4668687 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py index 4fdb5dd7270a..d0faea8b641a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py @@ -114,5 +114,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py index 16fcd992447b..ae14ab86586a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py @@ -116,5 +116,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py index 8b207f05342b..c6139dc285a6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py @@ -441,8 +441,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -704,7 +704,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1543,8 +1543,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1752,8 +1752,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2327,8 +2327,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2596,8 +2596,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3057,8 +3057,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3271,7 +3271,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3517,7 +3518,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group to create or update. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3814,8 +3815,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3933,8 +3934,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py index f790a2a164eb..6ad90b7188ed 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py @@ -41,7 +41,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -67,7 +67,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -102,8 +104,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -134,7 +136,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -175,8 +177,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2017_05_10.models.BasicDependency] @@ -211,7 +213,7 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", **kwargs): + def __init__(self, *, properties: "_models.DeploymentProperties", **kwargs: Any) -> None: """ :keyword properties: The deployment properties. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentProperties @@ -231,7 +233,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -267,7 +269,9 @@ class DeploymentExtended(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__( + self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any + ) -> None: """ :keyword name: The name of the deployment. Required. :paramtype name: str @@ -292,7 +296,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -321,7 +325,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentExtended] @@ -356,7 +360,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -413,7 +417,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -446,7 +450,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentOperation] @@ -511,8 +515,8 @@ def __init__( parameters: Optional[JSON] = None, parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -621,8 +625,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -683,8 +687,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -719,7 +723,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -727,7 +731,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -760,7 +765,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -787,7 +792,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -833,7 +838,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -909,8 +914,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1014,8 +1019,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1073,8 +1078,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1100,7 +1105,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1133,7 +1138,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Default value is "SystemAssigned". :paramtype type: str @@ -1164,7 +1169,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1207,8 +1212,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1258,7 +1263,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1290,7 +1295,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2017_05_10.models.Provider] @@ -1335,8 +1340,8 @@ def __init__( api_versions: Optional[List[str]] = None, zone_mappings: Optional[List["_models.ZoneMapping"]] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1404,8 +1409,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1449,8 +1454,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1477,7 +1482,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1509,7 +1514,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup] @@ -1546,8 +1551,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1583,7 +1588,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1609,7 +1614,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -1650,7 +1655,7 @@ class ResourceManagementErrorWithDetails(_serialization.Model): "details": {"key": "details", "type": "[ResourceManagementErrorWithDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1690,8 +1695,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -1726,7 +1731,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -1773,8 +1780,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -1809,7 +1816,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -1832,7 +1839,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -1877,8 +1884,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1915,7 +1922,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2017_05_10.models.TagDetails] @@ -1948,7 +1955,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -1984,8 +1993,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2001,7 +2010,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2014,7 +2024,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2046,7 +2058,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2072,7 +2084,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py index 48e21c77cece..12e9280db252 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py @@ -1666,8 +1666,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1929,7 +1929,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2766,8 +2766,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2975,8 +2975,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3550,8 +3550,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3819,8 +3819,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4280,8 +4280,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4494,7 +4494,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4740,7 +4741,7 @@ def create_or_update( :param resource_group_name: The name of the resource group to create or update. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5037,8 +5038,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5156,8 +5157,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2017_05_10.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json index f53069d0ac10..e573002aff39 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py index d84e3397a6a5..3d644e39a94e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py @@ -114,5 +114,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py index a744ebb4b7f3..7155447bfb5a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py @@ -116,5 +116,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py index 2374b5ed182d..78919f345cd7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py @@ -441,8 +441,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -704,7 +704,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1543,8 +1543,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1752,8 +1752,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2325,8 +2325,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2594,8 +2594,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3055,8 +3055,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3269,7 +3269,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3515,7 +3516,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group to create or update. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3812,8 +3813,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3931,8 +3932,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py index a3a9e2b10ebd..21e6ef7bf7f5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py @@ -37,7 +37,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -63,7 +63,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -98,8 +100,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -130,7 +132,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -171,8 +173,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2018_02_01.models.BasicDependency] @@ -207,7 +209,7 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", **kwargs): + def __init__(self, *, properties: "_models.DeploymentProperties", **kwargs: Any) -> None: """ :keyword properties: The deployment properties. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentProperties @@ -227,7 +229,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -263,7 +265,9 @@ class DeploymentExtended(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__( + self, *, name: str, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any + ) -> None: """ :keyword name: The name of the deployment. Required. :paramtype name: str @@ -288,7 +292,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -317,7 +321,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentExtended] @@ -352,7 +356,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -409,7 +413,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -442,7 +446,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentOperation] @@ -512,8 +516,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -631,8 +635,8 @@ def __init__( mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -697,8 +701,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -733,7 +737,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -741,7 +745,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -774,7 +779,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -801,7 +806,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -847,7 +852,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -923,8 +928,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1028,8 +1033,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1087,8 +1092,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1114,7 +1119,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1148,7 +1153,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1180,8 +1185,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1223,8 +1228,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1258,7 +1263,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1301,8 +1306,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1352,7 +1357,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1384,7 +1389,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2018_02_01.models.Provider] @@ -1429,8 +1434,8 @@ def __init__( api_versions: Optional[List[str]] = None, zone_mappings: Optional[List["_models.ZoneMapping"]] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1498,8 +1503,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1543,8 +1548,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1571,7 +1576,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1603,7 +1608,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup] @@ -1640,8 +1645,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1677,7 +1682,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1703,7 +1708,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -1744,7 +1749,7 @@ class ResourceManagementErrorWithDetails(_serialization.Model): "details": {"key": "details", "type": "[ResourceManagementErrorWithDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1784,8 +1789,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -1820,7 +1825,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -1867,8 +1874,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -1903,7 +1910,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -1926,7 +1933,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -1971,8 +1978,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2009,7 +2016,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2018_02_01.models.TagDetails] @@ -2042,7 +2049,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2078,8 +2087,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2095,7 +2104,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2108,7 +2118,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2140,7 +2152,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2166,7 +2178,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py index bbfe5098d3c8..b53d98ab9084 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py @@ -1666,8 +1666,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1929,7 +1929,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2766,8 +2766,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2975,8 +2975,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3548,8 +3548,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3817,8 +3817,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4278,8 +4278,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4492,7 +4492,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4738,7 +4739,7 @@ def create_or_update( :param resource_group_name: The name of the resource group to create or update. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5035,8 +5036,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5154,8 +5155,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_02_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json index d28a6916bad4..7ffc02372f48 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py index 3fa56fd15b03..4b2bb23cc7b4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py index da45c7928f50..95bf9326ff75 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py index 25ace65b8f30..87258aa5e87c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py @@ -524,8 +524,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -762,7 +762,7 @@ async def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1319,8 +1319,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1582,7 +1582,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2434,8 +2434,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2643,8 +2643,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3231,8 +3231,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3500,8 +3500,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3961,8 +3961,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4175,7 +4175,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4427,7 +4428,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4724,8 +4725,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -4843,8 +4844,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py index 46be9ab763b6..41b8e59439f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py @@ -37,7 +37,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -63,7 +63,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -98,8 +100,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -135,7 +137,7 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -158,7 +160,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -199,8 +201,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2018_05_01.models.BasicDependency] @@ -238,7 +240,9 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -261,7 +265,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -307,8 +311,8 @@ def __init__( *, location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -335,7 +339,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -364,7 +368,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended] @@ -399,7 +403,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -456,7 +460,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -489,7 +493,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperation] @@ -559,8 +563,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -678,8 +682,8 @@ def __init__( mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -744,8 +748,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -780,7 +784,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -788,7 +792,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -821,7 +826,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -848,7 +853,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -894,7 +899,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -970,8 +975,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1075,8 +1080,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1134,8 +1139,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1161,7 +1166,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1211,8 +1216,8 @@ def __init__( user_assigned_identities: Optional[ Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1250,8 +1255,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1293,8 +1298,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1322,7 +1327,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1361,8 +1368,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1381,7 +1388,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.Operation] @@ -1394,7 +1402,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.Operation] @@ -1426,7 +1436,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1469,8 +1479,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1520,7 +1530,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1552,7 +1562,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.Provider] @@ -1597,8 +1607,8 @@ def __init__( api_versions: Optional[List[str]] = None, zone_mappings: Optional[List["_models.ZoneMapping"]] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1670,8 +1680,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -1714,8 +1724,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1742,7 +1752,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1774,7 +1784,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup] @@ -1811,8 +1821,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1848,7 +1858,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1874,7 +1884,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -1915,7 +1925,7 @@ class ResourceManagementErrorWithDetails(_serialization.Model): "details": {"key": "details", "type": "[ResourceManagementErrorWithDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1955,8 +1965,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -1991,7 +2001,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2038,8 +2050,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2074,7 +2086,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2097,7 +2109,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2142,8 +2154,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2180,7 +2192,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.TagDetails] @@ -2213,7 +2225,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2249,8 +2263,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2266,7 +2280,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2279,7 +2294,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2311,7 +2328,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2337,7 +2354,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py index 0bdea417b51a..2980ccbed4b6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py @@ -2062,8 +2062,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2300,7 +2300,7 @@ def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2857,8 +2857,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3120,7 +3120,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3970,8 +3970,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4179,8 +4179,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4767,8 +4767,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5036,8 +5036,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5497,8 +5497,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5711,7 +5711,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5963,7 +5964,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6260,8 +6261,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6379,8 +6380,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2018_05_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json index 53679fe98802..73e72aa53bd6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py index a657441aa17c..a7ceda4ddd90 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py index 44239f4c5948..11dbdc9dec12 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py index f360cb5ea3f1..bd7bd0474ab5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py @@ -524,8 +524,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -762,7 +762,7 @@ async def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1319,8 +1319,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1582,7 +1582,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2434,8 +2434,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2643,8 +2643,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3231,8 +3231,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3500,8 +3500,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3961,8 +3961,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4175,7 +4175,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4427,7 +4428,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4724,8 +4725,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -4843,8 +4844,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py index 3ca7fee03e8a..1d522121b016 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py @@ -37,7 +37,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -63,7 +63,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -98,8 +100,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -135,7 +137,7 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -158,7 +160,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -199,8 +201,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2019_03_01.models.BasicDependency] @@ -238,7 +240,9 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -261,7 +265,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -307,8 +311,8 @@ def __init__( *, location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -335,7 +339,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -364,7 +368,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended] @@ -399,7 +403,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -456,7 +460,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -489,7 +493,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation] @@ -559,8 +563,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -678,8 +682,8 @@ def __init__( mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -744,8 +748,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -780,7 +784,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -788,7 +792,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -821,7 +826,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -848,7 +853,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -894,7 +899,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -970,8 +975,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1075,8 +1080,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1134,8 +1139,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1161,7 +1166,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1211,8 +1216,8 @@ def __init__( user_assigned_identities: Optional[ Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1250,8 +1255,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1293,8 +1298,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1322,7 +1327,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1361,8 +1368,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1381,7 +1388,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2019_03_01.models.Operation] @@ -1394,7 +1402,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_03_01.models.Operation] @@ -1426,7 +1436,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1469,8 +1479,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1524,7 +1534,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1557,7 +1567,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2019_03_01.models.Provider] @@ -1606,8 +1616,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1682,8 +1692,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -1726,8 +1736,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1754,7 +1764,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1786,7 +1796,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup] @@ -1823,8 +1833,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1860,7 +1870,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1886,7 +1896,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -1927,7 +1937,7 @@ class ResourceManagementErrorWithDetails(_serialization.Model): "details": {"key": "details", "type": "[ResourceManagementErrorWithDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1967,8 +1977,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2003,7 +2013,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2050,8 +2062,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2086,7 +2098,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2109,7 +2121,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2154,8 +2166,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2192,7 +2204,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2019_03_01.models.TagDetails] @@ -2225,7 +2237,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2261,8 +2275,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2278,7 +2292,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2291,7 +2306,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2323,7 +2340,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2349,7 +2366,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py index 99d39852b768..39209526a47f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py @@ -2062,8 +2062,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2300,7 +2300,7 @@ def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2857,8 +2857,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3120,7 +3120,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3970,8 +3970,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4179,8 +4179,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4767,8 +4767,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5036,8 +5036,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5497,8 +5497,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5711,7 +5711,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5963,7 +5964,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6260,8 +6261,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6379,8 +6380,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json index 60387458e25c..4393a5da0197 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py index 4e22c90ed122..ba4214f74b67 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py index d0b531888f8c..31537a571c7d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py index 3f459359c635..c815dbf94057 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py @@ -556,8 +556,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -814,7 +814,7 @@ async def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1348,8 +1348,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1586,7 +1586,7 @@ async def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2143,8 +2143,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2406,7 +2406,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3258,8 +3258,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3467,8 +3467,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4055,8 +4055,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4324,8 +4324,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4785,8 +4785,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4999,7 +4999,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5251,7 +5252,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5548,8 +5549,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5667,8 +5668,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py index f0c4ef876424..74ea24a0001d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py @@ -37,7 +37,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -63,7 +63,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -98,8 +100,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -135,7 +137,7 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -158,7 +160,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -199,8 +201,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2019_05_01.models.BasicDependency] @@ -238,7 +240,9 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -261,7 +265,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -307,8 +311,8 @@ def __init__( *, location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -335,7 +339,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -364,7 +368,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended] @@ -399,7 +403,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -460,7 +464,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -494,7 +498,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperation] @@ -564,8 +568,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -687,8 +691,8 @@ def __init__( mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -754,8 +758,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -790,7 +794,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -798,7 +802,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -831,7 +836,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -858,7 +863,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -904,7 +909,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -980,8 +985,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1085,8 +1090,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1144,8 +1149,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1171,7 +1176,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1221,8 +1226,8 @@ def __init__( user_assigned_identities: Optional[ Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1260,8 +1265,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1303,8 +1308,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1332,7 +1337,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1371,8 +1378,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1391,7 +1398,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2019_05_01.models.Operation] @@ -1404,7 +1412,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_01.models.Operation] @@ -1436,7 +1446,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1479,8 +1489,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1534,7 +1544,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1567,7 +1577,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_01.models.Provider] @@ -1616,8 +1626,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1692,8 +1702,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -1736,8 +1746,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1764,7 +1774,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1796,7 +1806,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup] @@ -1833,8 +1843,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1870,7 +1880,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1896,7 +1906,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -1937,7 +1947,7 @@ class ResourceManagementErrorWithDetails(_serialization.Model): "details": {"key": "details", "type": "[ResourceManagementErrorWithDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1977,8 +1987,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2013,7 +2023,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2060,8 +2072,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2096,7 +2108,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2119,7 +2131,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2164,8 +2176,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2202,7 +2214,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_01.models.TagDetails] @@ -2235,7 +2247,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2271,8 +2285,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2288,7 +2302,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2301,7 +2316,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2333,7 +2350,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2359,7 +2376,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py index d519e4755b5d..1bbfc30d83d3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py @@ -2394,8 +2394,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2652,7 +2652,7 @@ def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3186,8 +3186,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3424,7 +3424,7 @@ def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3981,8 +3981,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4244,7 +4244,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5094,8 +5094,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5303,8 +5303,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5891,8 +5891,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6160,8 +6160,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6621,8 +6621,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6835,7 +6835,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7087,7 +7088,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7384,8 +7385,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -7503,8 +7504,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json index ee2663fc83eb..227d5df53edf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py index d31b9ce7181f..73ae90858230 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py index 1f11c0558ff5..c3734424241d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py index 177edaab6d83..e1913ab11639 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py @@ -558,8 +558,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -816,7 +816,7 @@ async def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1350,8 +1350,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1588,7 +1588,7 @@ async def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2145,8 +2145,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2408,7 +2408,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3410,8 +3410,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3619,8 +3619,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4207,8 +4207,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4476,8 +4476,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4937,8 +4937,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5151,7 +5151,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5403,7 +5404,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5700,8 +5701,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5819,8 +5820,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py index cb6ccdd99ddb..e6d409f47c4d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py @@ -37,7 +37,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -63,7 +63,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -98,8 +100,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -135,7 +137,7 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -158,7 +160,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -199,8 +201,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2019_05_10.models.BasicDependency] @@ -238,7 +240,9 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -261,7 +265,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -307,8 +311,8 @@ def __init__( *, location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -335,7 +339,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -364,7 +368,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended] @@ -399,7 +403,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -460,7 +464,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -494,7 +498,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperation] @@ -564,8 +568,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -687,8 +691,8 @@ def __init__( mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -754,8 +758,8 @@ def __init__( *, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: Validation error. :paramtype error: @@ -790,7 +794,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -798,7 +802,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -831,7 +836,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -858,7 +863,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -904,7 +909,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -980,8 +985,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1085,8 +1090,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1144,8 +1149,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1171,7 +1176,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1221,8 +1226,8 @@ def __init__( user_assigned_identities: Optional[ Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1260,8 +1265,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1303,8 +1308,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1332,7 +1337,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1371,8 +1378,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1391,7 +1398,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2019_05_10.models.Operation] @@ -1404,7 +1412,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_10.models.Operation] @@ -1436,7 +1446,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1479,8 +1489,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1534,7 +1544,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1567,7 +1577,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_10.models.Provider] @@ -1616,8 +1626,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1692,8 +1702,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -1736,8 +1746,8 @@ def __init__( *, template: Optional[JSON] = None, error: Optional["_models.ResourceManagementErrorWithDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1764,7 +1774,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1796,7 +1806,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup] @@ -1833,8 +1843,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -1870,7 +1880,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -1896,7 +1906,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -1937,7 +1947,7 @@ class ResourceManagementErrorWithDetails(_serialization.Model): "details": {"key": "details", "type": "[ResourceManagementErrorWithDetails]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1977,8 +1987,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2013,7 +2023,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2060,8 +2072,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2096,7 +2108,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2119,7 +2131,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2164,8 +2176,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2202,7 +2214,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2019_05_10.models.TagDetails] @@ -2235,7 +2247,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2271,8 +2285,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2288,7 +2302,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2301,7 +2316,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2333,7 +2350,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2359,7 +2376,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py index 80cbc5ee46be..f5eb95863848 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py @@ -2447,8 +2447,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2705,7 +2705,7 @@ def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3239,8 +3239,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3477,7 +3477,7 @@ def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4034,8 +4034,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4297,7 +4297,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5297,8 +5297,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5506,8 +5506,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6094,8 +6094,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6363,8 +6363,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6824,8 +6824,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7038,7 +7038,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7290,7 +7291,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7587,8 +7588,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -7706,8 +7707,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_05_10.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json index ecf70d18a3e7..3af3cadfc685 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py index 07ac22b73981..16eaae5275de 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py index 1f1561d37255..4590051d3059 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py index 51396229e8eb..9a41589d99e6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py @@ -564,8 +564,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -810,7 +810,7 @@ async def validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1331,8 +1331,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1563,7 +1563,7 @@ async def validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2108,8 +2108,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2366,7 +2366,7 @@ async def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2900,8 +2900,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3138,7 +3138,7 @@ async def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3350,7 +3350,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3903,8 +3904,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4166,7 +4167,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4404,7 +4405,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5402,8 +5404,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5611,8 +5613,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6199,8 +6201,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6468,8 +6470,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6929,8 +6931,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7143,7 +7145,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7395,7 +7398,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7692,8 +7695,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -7811,8 +7814,8 @@ async def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py index 91fb91b88af2..e033591146fe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py @@ -37,7 +37,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -63,7 +63,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -98,8 +100,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -135,7 +137,7 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -158,7 +160,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -199,8 +201,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2019_07_01.models.BasicDependency] @@ -238,7 +240,9 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -261,7 +265,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -307,8 +311,8 @@ def __init__( *, location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -335,7 +339,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -364,7 +368,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] @@ -399,7 +403,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -460,7 +464,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -494,7 +498,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation] @@ -564,8 +568,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -687,8 +691,8 @@ def __init__( mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -753,8 +757,8 @@ def __init__( *, error: Optional["_models.ErrorResponse"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: The deployment validation error. :paramtype error: ~azure.mgmt.resource.resources.v2019_07_01.models.ErrorResponse @@ -788,7 +792,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -866,8 +872,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -928,7 +934,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -960,7 +968,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -968,7 +976,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1001,7 +1010,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1028,7 +1037,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1074,7 +1083,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1150,8 +1159,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1255,8 +1264,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1314,8 +1323,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1341,7 +1350,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1391,8 +1400,8 @@ def __init__( user_assigned_identities: Optional[ Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1430,8 +1439,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1473,8 +1482,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1502,7 +1511,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1541,8 +1552,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1561,7 +1572,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2019_07_01.models.Operation] @@ -1574,7 +1586,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_07_01.models.Operation] @@ -1606,7 +1620,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1649,8 +1663,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1704,7 +1718,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1737,7 +1751,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2019_07_01.models.Provider] @@ -1786,8 +1800,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1862,8 +1876,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -1900,7 +1914,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1926,7 +1942,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1958,7 +1974,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup] @@ -1995,8 +2011,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2032,7 +2048,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2058,7 +2074,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2100,8 +2116,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2136,7 +2152,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2183,8 +2201,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2219,7 +2237,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2242,7 +2260,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2287,8 +2305,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2325,7 +2343,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2019_07_01.models.TagDetails] @@ -2358,7 +2376,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2394,8 +2414,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2411,7 +2431,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2424,7 +2445,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2456,7 +2479,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2508,8 +2531,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -2533,7 +2556,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -2555,8 +2579,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -2611,8 +2635,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -2650,7 +2674,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py index 9c3da29484b1..89692fdf97b0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py @@ -13,24 +13,24 @@ class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -57,17 +57,17 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" + """The property is an array and contains nested changes.""" class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py index 86aab543e440..6108be1ca55d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py @@ -3178,8 +3178,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3424,7 +3424,7 @@ def validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3945,8 +3945,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4177,7 +4177,7 @@ def validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4718,8 +4718,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4976,7 +4976,7 @@ def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5510,8 +5510,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5748,7 +5748,7 @@ def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5960,7 +5960,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6513,8 +6514,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6776,7 +6777,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7014,7 +7015,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8010,8 +8012,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8219,8 +8221,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8807,8 +8809,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9076,8 +9078,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9537,8 +9539,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9751,7 +9753,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10003,7 +10006,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10300,8 +10303,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -10419,8 +10422,8 @@ def export_template( :param resource_group_name: The name of the resource group to export as a template. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_07_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json index 0195c7b7b09b..44e357adfb8c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py index ffd6bbce3fe6..2b741bccaaf9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py index 3eaf869fa987..66183a925307 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py index a30062e68362..ef3f995ba2a2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py @@ -564,8 +564,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -810,7 +810,7 @@ async def validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1331,8 +1331,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1563,7 +1563,8 @@ async def validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2108,8 +2109,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2366,7 +2367,8 @@ async def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2900,8 +2902,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3138,7 +3140,7 @@ async def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3350,7 +3352,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3903,8 +3906,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4166,7 +4169,7 @@ async def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4404,7 +4407,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5403,8 +5407,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5612,8 +5616,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6201,8 +6205,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6470,8 +6474,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6931,8 +6935,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7145,7 +7149,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7397,7 +7402,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7694,8 +7699,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -7897,8 +7902,8 @@ async def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py index d24493f22cc9..e042047370f7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py @@ -37,7 +37,7 @@ class AliasPathType(_serialization.Model): "api_versions": {"key": "apiVersions", "type": "[str]"}, } - def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs): + def __init__(self, *, path: Optional[str] = None, api_versions: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -63,7 +63,9 @@ class AliasType(_serialization.Model): "paths": {"key": "paths", "type": "[AliasPathType]"}, } - def __init__(self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, paths: Optional[List["_models.AliasPathType"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -98,8 +100,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -135,7 +137,7 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -158,7 +160,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -199,8 +201,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2019_08_01.models.BasicDependency] @@ -238,7 +240,9 @@ class Deployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -261,7 +265,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -307,8 +311,8 @@ def __init__( *, location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -335,7 +339,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -364,7 +368,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended] @@ -399,7 +403,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -460,7 +464,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -494,7 +498,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation] @@ -564,8 +568,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -687,8 +691,8 @@ def __init__( mode: Optional[Union[str, "_models.DeploymentMode"]] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword outputs: Key/value pairs that represent deployment output. :paramtype outputs: JSON @@ -753,8 +757,8 @@ def __init__( *, error: Optional["_models.ErrorResponse"] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error: The deployment validation error. :paramtype error: ~azure.mgmt.resource.resources.v2019_08_01.models.ErrorResponse @@ -788,7 +792,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -866,8 +872,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -928,7 +934,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -960,7 +968,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -968,7 +976,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1001,7 +1010,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1028,7 +1037,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1074,7 +1083,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1150,8 +1159,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1255,8 +1264,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1314,8 +1323,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1341,7 +1350,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1391,8 +1400,8 @@ def __init__( user_assigned_identities: Optional[ Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1430,8 +1439,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1473,8 +1482,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1502,7 +1511,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1541,8 +1552,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1561,7 +1572,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2019_08_01.models.Operation] @@ -1574,7 +1586,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_08_01.models.Operation] @@ -1606,7 +1620,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1649,8 +1663,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1704,7 +1718,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1737,7 +1751,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2019_08_01.models.Provider] @@ -1786,8 +1800,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1862,8 +1876,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -1900,7 +1914,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -1926,7 +1942,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -1958,7 +1974,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup] @@ -1995,8 +2011,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2032,7 +2048,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2058,7 +2074,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2100,8 +2116,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2136,7 +2152,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2169,7 +2187,7 @@ class ScopedDeployment(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__(self, *, location: str, properties: "_models.DeploymentProperties", **kwargs): + def __init__(self, *, location: str, properties: "_models.DeploymentProperties", **kwargs: Any) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2216,8 +2234,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2252,7 +2270,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2275,7 +2293,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2320,8 +2338,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2358,7 +2376,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2019_08_01.models.TagDetails] @@ -2391,7 +2409,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2427,8 +2447,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2444,7 +2464,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2457,7 +2478,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2489,7 +2512,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2541,8 +2564,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -2566,7 +2589,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -2588,8 +2612,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -2644,8 +2668,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -2683,7 +2707,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py index 9c3da29484b1..89692fdf97b0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py @@ -13,24 +13,24 @@ class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -57,17 +57,17 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" + """The property is an array and contains nested changes.""" class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py index 412d5b484ad9..c89d5d82010b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py @@ -3178,8 +3178,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3424,7 +3424,7 @@ def validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3945,8 +3945,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4177,7 +4177,8 @@ def validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4718,8 +4719,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4976,7 +4977,8 @@ def validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5510,8 +5512,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5748,7 +5750,7 @@ def validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5960,7 +5962,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6513,8 +6516,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6776,7 +6779,7 @@ def validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7014,7 +7017,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8011,8 +8015,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8220,8 +8224,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8809,8 +8813,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9078,8 +9082,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9539,8 +9543,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9753,7 +9757,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10005,7 +10010,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10302,8 +10307,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -10505,8 +10510,8 @@ def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_08_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json index 9c93160bb866..2840a295fd73 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py index a9d64e9c0a85..0599147879bd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py index 183177204107..eccfe7fc6c41 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py index 0db6ec0a3322..79912ef41dd9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py @@ -570,8 +570,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -900,7 +900,7 @@ async def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1418,8 +1418,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1733,7 +1733,8 @@ async def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1938,7 +1939,8 @@ async def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2483,8 +2485,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2825,7 +2827,8 @@ async def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3045,7 +3048,8 @@ async def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3577,8 +3581,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3899,7 +3903,7 @@ async def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4105,7 +4109,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4658,8 +4663,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5006,7 +5011,7 @@ async def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5238,7 +5243,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6237,8 +6243,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6446,8 +6452,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7035,8 +7041,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7304,8 +7310,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7765,8 +7771,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7979,7 +7985,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8231,7 +8238,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8528,8 +8535,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -8731,8 +8738,8 @@ async def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9295,7 +9302,7 @@ async def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9432,7 +9439,7 @@ async def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py index e02223f19c27..526bda5a6077 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py @@ -54,8 +54,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -100,8 +100,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -139,8 +139,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -178,8 +178,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -210,7 +210,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -251,8 +251,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2019_10_01.models.BasicDependency] @@ -299,8 +299,8 @@ def __init__( properties: "_models.DeploymentProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -326,7 +326,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -376,8 +376,8 @@ def __init__( location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -407,7 +407,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -436,7 +436,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended] @@ -471,7 +471,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -539,7 +539,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_operation = None @@ -574,7 +574,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation] @@ -644,8 +644,8 @@ def __init__( parameters_link: Optional["_models.ParametersLink"] = None, debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -772,7 +772,7 @@ class DeploymentPropertiesExtended(_serialization.Model): # pylint: disable=too "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -815,7 +815,7 @@ class DeploymentValidateResult(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any) -> None: """ :keyword properties: The template deployment properties. :paramtype properties: @@ -847,7 +847,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -925,8 +927,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -987,7 +989,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -1019,7 +1023,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1027,7 +1031,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1060,7 +1065,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1087,7 +1092,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1133,7 +1138,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1209,8 +1214,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1314,8 +1319,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1373,8 +1378,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1400,7 +1405,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1445,8 +1450,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.IdentityUserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1485,7 +1490,7 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1512,8 +1517,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1555,8 +1560,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1584,7 +1589,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1623,8 +1630,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1643,7 +1650,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2019_10_01.models.Operation] @@ -1656,7 +1664,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2019_10_01.models.Operation] @@ -1688,7 +1698,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1731,8 +1741,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1786,7 +1796,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1819,7 +1829,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2019_10_01.models.Provider] @@ -1868,8 +1878,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1944,8 +1954,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -1982,7 +1992,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -2008,7 +2020,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2040,7 +2052,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup] @@ -2077,8 +2089,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2114,7 +2126,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2140,7 +2152,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2182,8 +2194,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2221,7 +2233,7 @@ class ResourceReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2241,7 +2253,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2283,8 +2297,8 @@ def __init__( location: str, properties: "_models.DeploymentProperties", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2321,7 +2335,7 @@ class ScopedDeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs): + def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs: Any) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2369,8 +2383,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2405,7 +2419,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2428,7 +2442,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2473,8 +2487,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2502,7 +2516,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -2531,7 +2545,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2019_10_01.models.TagDetails] @@ -2561,8 +2575,8 @@ def __init__( *, operation: Optional[Union[str, "_models.TagsPatchOperation"]] = None, properties: Optional["_models.Tags"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operation: The operation type for the patch API. Known values are: "Replace", "Merge", and "Delete". @@ -2607,7 +2621,7 @@ class TagsResource(_serialization.Model): "properties": {"key": "properties", "type": "Tags"}, } - def __init__(self, *, properties: "_models.Tags", **kwargs): + def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: """ :keyword properties: The set of tags. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2019_10_01.models.Tags @@ -2642,7 +2656,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2678,8 +2694,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2695,7 +2711,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2708,7 +2725,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2740,7 +2759,7 @@ class TemplateLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the template to deploy. Required. :paramtype uri: str @@ -2792,8 +2811,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -2817,7 +2836,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -2839,8 +2859,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -2895,8 +2915,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -2934,7 +2954,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py index 6e88be60b0cf..1a7b324c797c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py @@ -13,44 +13,44 @@ class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -77,43 +77,43 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" + """The property is an array and contains nested changes.""" class ProvisioningOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the current provisioning operation.""" - #: The provisioning operation is not specified. NOT_SPECIFIED = "NotSpecified" - #: The provisioning operation is create. + """The provisioning operation is not specified.""" CREATE = "Create" - #: The provisioning operation is delete. + """The provisioning operation is create.""" DELETE = "Delete" - #: The provisioning operation is waiting. + """The provisioning operation is delete.""" WAITING = "Waiting" - #: The provisioning operation is waiting Azure async operation. + """The provisioning operation is waiting.""" AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" - #: The provisioning operation is waiting for resource cache. + """The provisioning operation is waiting Azure async operation.""" RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" - #: The provisioning operation is action. + """The provisioning operation is waiting for resource cache.""" ACTION = "Action" - #: The provisioning operation is read. + """The provisioning operation is action.""" READ = "Read" - #: The provisioning operation is evaluate output. + """The provisioning operation is read.""" EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" - #: The provisioning operation is cleanup. This operation is part of the 'complete' mode - #: deployment. + """The provisioning operation is evaluate output.""" DEPLOYMENT_CLEANUP = "DeploymentCleanup" + """The provisioning operation is cleanup. This operation is part of the 'complete' mode + #: deployment.""" class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -128,13 +128,13 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TagsPatchOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation type for the patch API.""" - #: The 'replace' option replaces the entire set of existing tags with a new set. REPLACE = "Replace" - #: The 'merge' option allows adding tags with new names and updating the values of tags with - #: existing names. + """The 'replace' option replaces the entire set of existing tags with a new set.""" MERGE = "Merge" - #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + """The 'merge' option allows adding tags with new names and updating the values of tags with + #: existing names.""" DELETE = "Delete" + """The 'delete' option allows selectively deleting tags based on given names or name/value pairs.""" class WhatIfResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py index 924ff7d4b14d..9612c4e3f581 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py @@ -3344,8 +3344,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3674,7 +3674,7 @@ def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4192,8 +4192,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4507,7 +4507,8 @@ def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4712,7 +4713,8 @@ def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5253,8 +5255,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5595,7 +5597,8 @@ def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5815,7 +5818,8 @@ def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6347,8 +6351,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6669,7 +6673,7 @@ def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6875,7 +6879,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7428,8 +7433,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7776,7 +7781,7 @@ def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8008,7 +8013,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9005,8 +9011,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9214,8 +9220,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9803,8 +9809,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10072,8 +10078,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10533,8 +10539,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10747,7 +10753,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10999,7 +11006,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11296,8 +11303,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -11499,8 +11506,8 @@ def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12063,7 +12070,7 @@ def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12200,7 +12207,7 @@ def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json index 89bd9fe8f640..48d54b2b46fe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py index d10e1b62ba9f..be27cc344890 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py @@ -118,5 +118,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py index fcef5d34b38f..d6a1cb4fc052 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py @@ -120,5 +120,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py index 9d8f94db17b7..a971987392f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py @@ -571,8 +571,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -901,7 +901,7 @@ async def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1419,8 +1419,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1734,7 +1734,8 @@ async def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1939,7 +1940,8 @@ async def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2484,8 +2486,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2826,7 +2828,8 @@ async def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3046,7 +3049,8 @@ async def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3578,8 +3582,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3900,7 +3904,7 @@ async def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4106,7 +4110,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4659,8 +4664,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5007,7 +5012,7 @@ async def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5239,7 +5244,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6296,8 +6302,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6505,8 +6511,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7094,8 +7100,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7363,8 +7369,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7824,8 +7830,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8038,7 +8044,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8290,7 +8297,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8596,8 +8603,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -8799,8 +8806,8 @@ async def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9363,7 +9370,7 @@ async def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9500,7 +9507,7 @@ async def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py index b96740187fce..e1b963f09078 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py @@ -64,8 +64,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -121,8 +121,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -162,7 +162,7 @@ class AliasPathMetadata(_serialization.Model): "attributes": {"key": "attributes", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -192,8 +192,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -229,7 +229,7 @@ class ApiProfile(_serialization.Model): "api_version": {"key": "apiVersion", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.profile_version = None @@ -259,8 +259,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -291,7 +291,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -332,8 +332,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2020_06_01.models.BasicDependency] @@ -380,8 +380,8 @@ def __init__( properties: "_models.DeploymentProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -407,7 +407,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -457,8 +457,8 @@ def __init__( location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -488,7 +488,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -517,7 +517,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] @@ -552,7 +552,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -622,7 +622,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_operation = None @@ -657,7 +657,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation] @@ -734,8 +734,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -871,7 +871,7 @@ class DeploymentPropertiesExtended(_serialization.Model): # pylint: disable=too "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -914,7 +914,7 @@ class DeploymentValidateResult(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any) -> None: """ :keyword properties: The template deployment properties. :paramtype properties: @@ -946,7 +946,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -1031,8 +1033,8 @@ def __init__( on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -1099,7 +1101,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -1131,7 +1135,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1139,7 +1143,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1172,7 +1177,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1199,7 +1204,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1215,7 +1220,8 @@ def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[s class ExpressionEvaluationOptions(_serialization.Model): - """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + """Specifies whether template expressions are evaluated within the scope of the parent template or + nested template. :ivar scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1227,7 +1233,9 @@ class ExpressionEvaluationOptions(_serialization.Model): "scope": {"key": "scope", "type": "str"}, } - def __init__(self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs): + def __init__( + self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs: Any + ) -> None: """ :keyword scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1269,7 +1277,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1344,8 +1352,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1448,8 +1456,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1507,8 +1515,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1534,7 +1542,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1579,8 +1587,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.IdentityUserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1619,7 +1627,7 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1646,8 +1654,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1689,8 +1697,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1718,7 +1726,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1757,8 +1767,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1777,7 +1787,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2020_06_01.models.Operation] @@ -1790,7 +1801,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2020_06_01.models.Operation] @@ -1822,7 +1835,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1865,8 +1878,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1920,7 +1933,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1953,7 +1966,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2020_06_01.models.Provider] @@ -2015,8 +2028,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -2093,8 +2106,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -2131,7 +2144,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -2157,7 +2172,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2189,7 +2204,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup] @@ -2226,8 +2241,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2263,7 +2278,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2289,7 +2304,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2331,8 +2346,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2370,7 +2385,7 @@ class ResourceReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2390,7 +2405,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2432,8 +2449,8 @@ def __init__( location: str, properties: "_models.DeploymentProperties", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2470,7 +2487,7 @@ class ScopedDeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs): + def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs: Any) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2518,8 +2535,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2557,7 +2574,9 @@ class StatusMessage(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword status: Status of the deployment operation. :paramtype status: str @@ -2580,7 +2599,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2603,7 +2622,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2648,8 +2667,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2677,7 +2696,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -2706,7 +2725,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2020_06_01.models.TagDetails] @@ -2736,8 +2755,8 @@ def __init__( *, operation: Optional[Union[str, "_models.TagsPatchOperation"]] = None, properties: Optional["_models.Tags"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operation: The operation type for the patch API. Known values are: "Replace", "Merge", and "Delete". @@ -2782,7 +2801,7 @@ class TagsResource(_serialization.Model): "properties": {"key": "properties", "type": "Tags"}, } - def __init__(self, *, properties: "_models.Tags", **kwargs): + def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: """ :keyword properties: The set of tags. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags @@ -2817,7 +2836,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2853,8 +2874,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2870,7 +2891,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2883,7 +2905,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -2923,8 +2947,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin relative_path: Optional[str] = None, content_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword uri: The URI of the template to deploy. Use either the uri or id property, but not both. @@ -2985,8 +3009,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -3010,7 +3034,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -3032,8 +3057,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -3088,8 +3113,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -3127,7 +3152,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py index aa81cf76c98a..72fde17f2df7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py @@ -13,74 +13,74 @@ class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The attributes of the token that the alias path is referring to.""" - #: The token that the alias path is referring to has no attributes. NONE = "None" - #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + """The token that the alias path is referring to has no attributes.""" MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the token that the alias path is referring to.""" - #: The token type is not specified. NOT_SPECIFIED = "NotSpecified" - #: The token type can be anything. + """The token type is not specified.""" ANY = "Any" - #: The token type is string. + """The token type can be anything.""" STRING = "String" - #: The token type is object. + """The token type is string.""" OBJECT = "Object" - #: The token type is array. + """The token type is object.""" ARRAY = "Array" - #: The token type is integer. + """The token type is array.""" INTEGER = "Integer" - #: The token type is number. + """The token type is integer.""" NUMBER = "Number" - #: The token type is boolean. + """The token type is number.""" BOOLEAN = "Boolean" + """The token type is boolean.""" class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -117,43 +117,43 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" + """The property is an array and contains nested changes.""" class ProvisioningOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the current provisioning operation.""" - #: The provisioning operation is not specified. NOT_SPECIFIED = "NotSpecified" - #: The provisioning operation is create. + """The provisioning operation is not specified.""" CREATE = "Create" - #: The provisioning operation is delete. + """The provisioning operation is create.""" DELETE = "Delete" - #: The provisioning operation is waiting. + """The provisioning operation is delete.""" WAITING = "Waiting" - #: The provisioning operation is waiting Azure async operation. + """The provisioning operation is waiting.""" AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" - #: The provisioning operation is waiting for resource cache. + """The provisioning operation is waiting Azure async operation.""" RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" - #: The provisioning operation is action. + """The provisioning operation is waiting for resource cache.""" ACTION = "Action" - #: The provisioning operation is read. + """The provisioning operation is action.""" READ = "Read" - #: The provisioning operation is evaluate output. + """The provisioning operation is read.""" EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" - #: The provisioning operation is cleanup. This operation is part of the 'complete' mode - #: deployment. + """The provisioning operation is evaluate output.""" DEPLOYMENT_CLEANUP = "DeploymentCleanup" + """The provisioning operation is cleanup. This operation is part of the 'complete' mode + #: deployment.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -185,13 +185,13 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TagsPatchOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation type for the patch API.""" - #: The 'replace' option replaces the entire set of existing tags with a new set. REPLACE = "Replace" - #: The 'merge' option allows adding tags with new names and updating the values of tags with - #: existing names. + """The 'replace' option replaces the entire set of existing tags with a new set.""" MERGE = "Merge" - #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + """The 'merge' option allows adding tags with new names and updating the values of tags with + #: existing names.""" DELETE = "Delete" + """The 'delete' option allows selectively deleting tags based on given names or name/value pairs.""" class WhatIfResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py index 199c53a8c466..0afb0b2ba0e6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py @@ -3270,8 +3270,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3600,7 +3600,7 @@ def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4118,8 +4118,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4433,7 +4433,8 @@ def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4638,7 +4639,8 @@ def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5179,8 +5181,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5521,7 +5523,8 @@ def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5741,7 +5744,8 @@ def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6273,8 +6277,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6595,7 +6599,7 @@ def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6801,7 +6805,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7354,8 +7359,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7702,7 +7707,7 @@ def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7934,7 +7939,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8989,8 +8995,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9198,8 +9204,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9787,8 +9793,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10056,8 +10062,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10517,8 +10523,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10731,7 +10737,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10983,7 +10990,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11289,8 +11296,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -11492,8 +11499,8 @@ def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12056,7 +12063,7 @@ def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12193,7 +12200,7 @@ def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json index 4deddc6694ca..b238c59f5c4e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py index 820323a65cba..9711f03cc05e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py @@ -125,5 +125,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py index ea8c219ffb64..b05640f284a9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py @@ -127,5 +127,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py index 4711fc4c64b7..aabee809dc26 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py @@ -572,8 +572,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -902,7 +902,7 @@ async def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1420,8 +1420,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1735,7 +1735,8 @@ async def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1940,7 +1941,8 @@ async def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2485,8 +2487,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2827,7 +2829,8 @@ async def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3047,7 +3050,8 @@ async def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3579,8 +3583,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3901,7 +3905,7 @@ async def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4107,7 +4111,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4660,8 +4665,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5008,7 +5013,7 @@ async def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5240,7 +5245,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6378,8 +6384,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6587,8 +6593,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7176,8 +7182,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7445,8 +7451,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7906,8 +7912,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8120,7 +8126,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8372,7 +8379,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8669,8 +8676,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -8872,8 +8879,8 @@ async def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9436,7 +9443,7 @@ async def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9573,7 +9580,7 @@ async def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py index 743d52c4a114..3b53a874d416 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py @@ -64,8 +64,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -121,8 +121,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -162,7 +162,7 @@ class AliasPathMetadata(_serialization.Model): "attributes": {"key": "attributes", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -192,8 +192,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -229,7 +229,7 @@ class ApiProfile(_serialization.Model): "api_version": {"key": "apiVersion", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.profile_version = None @@ -259,8 +259,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -291,7 +291,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -332,8 +332,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2020_10_01.models.BasicDependency] @@ -380,8 +380,8 @@ def __init__( properties: "_models.DeploymentProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -407,7 +407,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -457,8 +457,8 @@ def __init__( location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -488,7 +488,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -517,7 +517,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] @@ -552,7 +552,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -622,7 +622,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_operation = None @@ -657,7 +657,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation] @@ -734,8 +734,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -871,7 +871,7 @@ class DeploymentPropertiesExtended(_serialization.Model): # pylint: disable=too "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -914,7 +914,7 @@ class DeploymentValidateResult(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any) -> None: """ :keyword properties: The template deployment properties. :paramtype properties: @@ -946,7 +946,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -1031,8 +1033,8 @@ def __init__( on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -1099,7 +1101,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -1131,7 +1135,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1139,7 +1143,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1172,7 +1177,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1199,7 +1204,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1215,7 +1220,8 @@ def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[s class ExpressionEvaluationOptions(_serialization.Model): - """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + """Specifies whether template expressions are evaluated within the scope of the parent template or + nested template. :ivar scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1227,7 +1233,9 @@ class ExpressionEvaluationOptions(_serialization.Model): "scope": {"key": "scope", "type": "str"}, } - def __init__(self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs): + def __init__( + self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs: Any + ) -> None: """ :keyword scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1269,7 +1277,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1344,8 +1352,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1448,8 +1456,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1507,8 +1515,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1534,7 +1542,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1579,8 +1587,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.IdentityUserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1619,7 +1627,7 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1646,8 +1654,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1689,8 +1697,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1718,7 +1726,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1757,8 +1767,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1777,7 +1787,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.Operation] @@ -1790,7 +1801,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.Operation] @@ -1822,7 +1835,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1865,8 +1878,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1920,7 +1933,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -1956,8 +1969,8 @@ def __init__( location: Optional[str] = None, type: Optional[str] = None, extended_locations: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The azure location. :paramtype location: str @@ -1992,7 +2005,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.Provider] @@ -2059,8 +2072,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -2113,7 +2126,7 @@ class ProviderResourceTypeListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource types. :paramtype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderResourceType] @@ -2171,8 +2184,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -2209,7 +2222,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -2235,7 +2250,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2267,7 +2282,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup] @@ -2304,8 +2319,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2341,7 +2356,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2367,7 +2382,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2409,8 +2424,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2448,7 +2463,7 @@ class ResourceReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2468,7 +2483,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2510,8 +2527,8 @@ def __init__( location: str, properties: "_models.DeploymentProperties", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2548,7 +2565,7 @@ class ScopedDeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs): + def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs: Any) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2596,8 +2613,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2635,7 +2652,9 @@ class StatusMessage(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword status: Status of the deployment operation. :paramtype status: str @@ -2658,7 +2677,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2681,7 +2700,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2726,8 +2745,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2755,7 +2774,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -2784,7 +2803,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2020_10_01.models.TagDetails] @@ -2814,8 +2833,8 @@ def __init__( *, operation: Optional[Union[str, "_models.TagsPatchOperation"]] = None, properties: Optional["_models.Tags"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operation: The operation type for the patch API. Known values are: "Replace", "Merge", and "Delete". @@ -2860,7 +2879,7 @@ class TagsResource(_serialization.Model): "properties": {"key": "properties", "type": "Tags"}, } - def __init__(self, *, properties: "_models.Tags", **kwargs): + def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: """ :keyword properties: The set of tags. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2020_10_01.models.Tags @@ -2895,7 +2914,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2931,8 +2952,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -2948,7 +2969,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -2961,7 +2983,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -3008,8 +3032,8 @@ def __init__( relative_path: Optional[str] = None, content_version: Optional[str] = None, query_string: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword uri: The URI of the template to deploy. Use either the uri or id property, but not both. @@ -3076,8 +3100,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -3101,7 +3125,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -3123,8 +3148,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -3179,8 +3204,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -3218,7 +3243,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_resource_management_client_enums.py index aa81cf76c98a..72fde17f2df7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_resource_management_client_enums.py @@ -13,74 +13,74 @@ class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The attributes of the token that the alias path is referring to.""" - #: The token that the alias path is referring to has no attributes. NONE = "None" - #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + """The token that the alias path is referring to has no attributes.""" MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the token that the alias path is referring to.""" - #: The token type is not specified. NOT_SPECIFIED = "NotSpecified" - #: The token type can be anything. + """The token type is not specified.""" ANY = "Any" - #: The token type is string. + """The token type can be anything.""" STRING = "String" - #: The token type is object. + """The token type is string.""" OBJECT = "Object" - #: The token type is array. + """The token type is object.""" ARRAY = "Array" - #: The token type is integer. + """The token type is array.""" INTEGER = "Integer" - #: The token type is number. + """The token type is integer.""" NUMBER = "Number" - #: The token type is boolean. + """The token type is number.""" BOOLEAN = "Boolean" + """The token type is boolean.""" class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -117,43 +117,43 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" + """The property is an array and contains nested changes.""" class ProvisioningOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the current provisioning operation.""" - #: The provisioning operation is not specified. NOT_SPECIFIED = "NotSpecified" - #: The provisioning operation is create. + """The provisioning operation is not specified.""" CREATE = "Create" - #: The provisioning operation is delete. + """The provisioning operation is create.""" DELETE = "Delete" - #: The provisioning operation is waiting. + """The provisioning operation is delete.""" WAITING = "Waiting" - #: The provisioning operation is waiting Azure async operation. + """The provisioning operation is waiting.""" AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" - #: The provisioning operation is waiting for resource cache. + """The provisioning operation is waiting Azure async operation.""" RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" - #: The provisioning operation is action. + """The provisioning operation is waiting for resource cache.""" ACTION = "Action" - #: The provisioning operation is read. + """The provisioning operation is action.""" READ = "Read" - #: The provisioning operation is evaluate output. + """The provisioning operation is read.""" EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" - #: The provisioning operation is cleanup. This operation is part of the 'complete' mode - #: deployment. + """The provisioning operation is evaluate output.""" DEPLOYMENT_CLEANUP = "DeploymentCleanup" + """The provisioning operation is cleanup. This operation is part of the 'complete' mode + #: deployment.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -185,13 +185,13 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TagsPatchOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation type for the patch API.""" - #: The 'replace' option replaces the entire set of existing tags with a new set. REPLACE = "Replace" - #: The 'merge' option allows adding tags with new names and updating the values of tags with - #: existing names. + """The 'replace' option replaces the entire set of existing tags with a new set.""" MERGE = "Merge" - #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + """The 'merge' option allows adding tags with new names and updating the values of tags with + #: existing names.""" DELETE = "Delete" + """The 'delete' option allows selectively deleting tags based on given names or name/value pairs.""" class WhatIfResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py index c88669706528..41640a30dfa0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py @@ -3297,8 +3297,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3627,7 +3627,7 @@ def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4145,8 +4145,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4460,7 +4460,8 @@ def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4665,7 +4666,8 @@ def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5206,8 +5208,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5548,7 +5550,8 @@ def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5768,7 +5771,8 @@ def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6300,8 +6304,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6622,7 +6626,7 @@ def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6828,7 +6832,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7381,8 +7386,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7729,7 +7734,7 @@ def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7961,7 +7966,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9097,8 +9103,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9306,8 +9312,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9895,8 +9901,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10164,8 +10170,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10625,8 +10631,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10839,7 +10845,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11091,7 +11098,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11388,8 +11395,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -11591,8 +11598,8 @@ def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12155,7 +12162,7 @@ def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12292,7 +12299,7 @@ def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json index 27d2f75d9369..0fb268e0ebaa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The ID of the target subscription. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py index e8bf0bcd09e8..e3209838cbd5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py @@ -125,5 +125,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py index 4c528cf09371..34b43b8aa688 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py @@ -127,5 +127,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py index 5849d405465a..ebe70a96a748 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py @@ -572,8 +572,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -902,7 +902,7 @@ async def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1420,8 +1420,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1735,7 +1735,8 @@ async def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1940,7 +1941,8 @@ async def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2485,8 +2487,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2827,7 +2829,8 @@ async def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3047,7 +3050,8 @@ async def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3579,8 +3583,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3901,7 +3905,7 @@ async def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4107,7 +4111,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4660,8 +4665,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5008,7 +5013,7 @@ async def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5240,7 +5245,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6378,8 +6384,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6587,8 +6593,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7176,8 +7182,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7445,8 +7451,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7906,8 +7912,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8120,7 +8126,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8372,7 +8379,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8678,8 +8685,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -8881,8 +8888,8 @@ async def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9445,7 +9452,7 @@ async def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9582,7 +9589,7 @@ async def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py index f50dcd6c3e28..2464e8850ad8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py @@ -64,8 +64,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -121,8 +121,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -162,7 +162,7 @@ class AliasPathMetadata(_serialization.Model): "attributes": {"key": "attributes", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -192,8 +192,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -229,7 +229,7 @@ class ApiProfile(_serialization.Model): "api_version": {"key": "apiVersion", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.profile_version = None @@ -259,8 +259,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -291,7 +291,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -332,8 +332,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2021_01_01.models.BasicDependency] @@ -380,8 +380,8 @@ def __init__( properties: "_models.DeploymentProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -407,7 +407,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -457,8 +457,8 @@ def __init__( location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -488,7 +488,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -517,7 +517,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentExtended] @@ -552,7 +552,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -622,7 +622,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_operation = None @@ -657,7 +657,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentOperation] @@ -734,8 +734,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -871,7 +871,7 @@ class DeploymentPropertiesExtended(_serialization.Model): # pylint: disable=too "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -914,7 +914,7 @@ class DeploymentValidateResult(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any) -> None: """ :keyword properties: The template deployment properties. :paramtype properties: @@ -946,7 +946,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -1031,8 +1033,8 @@ def __init__( on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -1099,7 +1101,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -1131,7 +1135,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1139,7 +1143,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1172,7 +1177,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1199,7 +1204,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1215,7 +1220,8 @@ def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[s class ExpressionEvaluationOptions(_serialization.Model): - """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + """Specifies whether template expressions are evaluated within the scope of the parent template or + nested template. :ivar scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1227,7 +1233,9 @@ class ExpressionEvaluationOptions(_serialization.Model): "scope": {"key": "scope", "type": "str"}, } - def __init__(self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs): + def __init__( + self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs: Any + ) -> None: """ :keyword scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1253,8 +1261,12 @@ class ExtendedLocation(_serialization.Model): } def __init__( - self, *, type: Optional[Union[str, "_models.ExtendedLocationType"]] = None, name: Optional[str] = None, **kwargs - ): + self, + *, + type: Optional[Union[str, "_models.ExtendedLocationType"]] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword type: The extended location type. "EdgeZone" :paramtype type: str or ~azure.mgmt.resource.resources.v2021_01_01.models.ExtendedLocationType @@ -1306,8 +1318,8 @@ def __init__( location: Optional[str] = None, extended_location: Optional["_models.ExtendedLocation"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1391,8 +1403,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1503,8 +1515,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1566,8 +1578,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1593,7 +1605,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1638,8 +1650,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.IdentityUserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1678,7 +1690,7 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1705,8 +1717,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1748,8 +1760,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1777,7 +1789,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1816,8 +1830,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1836,7 +1850,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.Operation] @@ -1849,7 +1864,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.Operation] @@ -1881,7 +1898,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1924,8 +1941,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -1979,7 +1996,7 @@ class Provider(_serialization.Model): "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, } - def __init__(self, *, namespace: Optional[str] = None, **kwargs): + def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -2015,8 +2032,8 @@ def __init__( location: Optional[str] = None, type: Optional[str] = None, extended_locations: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The azure location. :paramtype location: str @@ -2051,7 +2068,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.Provider] @@ -2118,8 +2135,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -2172,7 +2189,7 @@ class ProviderResourceTypeListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource types. :paramtype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.ProviderResourceType] @@ -2230,8 +2247,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -2268,7 +2285,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -2294,7 +2313,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2326,7 +2345,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.ResourceGroup] @@ -2363,8 +2382,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2400,7 +2419,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2426,7 +2445,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2468,8 +2487,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2507,7 +2526,7 @@ class ResourceReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2527,7 +2546,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2569,8 +2590,8 @@ def __init__( location: str, properties: "_models.DeploymentProperties", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2607,7 +2628,7 @@ class ScopedDeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs): + def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs: Any) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2655,8 +2676,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2694,7 +2715,9 @@ class StatusMessage(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword status: Status of the deployment operation. :paramtype status: str @@ -2717,7 +2740,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2740,7 +2763,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -2785,8 +2808,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2814,7 +2837,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -2843,7 +2866,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2021_01_01.models.TagDetails] @@ -2873,8 +2896,8 @@ def __init__( *, operation: Optional[Union[str, "_models.TagsPatchOperation"]] = None, properties: Optional["_models.Tags"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operation: The operation type for the patch API. Known values are: "Replace", "Merge", and "Delete". @@ -2919,7 +2942,7 @@ class TagsResource(_serialization.Model): "properties": {"key": "properties", "type": "Tags"}, } - def __init__(self, *, properties: "_models.Tags", **kwargs): + def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: """ :keyword properties: The set of tags. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2021_01_01.models.Tags @@ -2954,7 +2977,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -2990,8 +3015,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -3007,7 +3032,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -3020,7 +3046,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -3067,8 +3095,8 @@ def __init__( relative_path: Optional[str] = None, content_version: Optional[str] = None, query_string: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword uri: The URI of the template to deploy. Use either the uri or id property, but not both. @@ -3139,8 +3167,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -3167,7 +3195,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -3189,8 +3218,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -3245,8 +3274,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -3284,7 +3313,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_resource_management_client_enums.py index 0fdf043d680e..c6488d6d2529 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_resource_management_client_enums.py @@ -13,76 +13,76 @@ class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The attributes of the token that the alias path is referring to.""" - #: The token that the alias path is referring to has no attributes. NONE = "None" - #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + """The token that the alias path is referring to has no attributes.""" MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the token that the alias path is referring to.""" - #: The token type is not specified. NOT_SPECIFIED = "NotSpecified" - #: The token type can be anything. + """The token type is not specified.""" ANY = "Any" - #: The token type is string. + """The token type can be anything.""" STRING = "String" - #: The token type is object. + """The token type is string.""" OBJECT = "Object" - #: The token type is array. + """The token type is object.""" ARRAY = "Array" - #: The token type is integer. + """The token type is array.""" INTEGER = "Integer" - #: The token type is number. + """The token type is integer.""" NUMBER = "Number" - #: The token type is boolean. + """The token type is number.""" BOOLEAN = "Boolean" + """The token type is boolean.""" class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" - #: The resource is not supported by What-If. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" UNSUPPORTED = "Unsupported" + """The resource is not supported by What-If.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -125,45 +125,45 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" - #: The property will not be set or updated. + """The property is an array and contains nested changes.""" NO_EFFECT = "NoEffect" + """The property will not be set or updated.""" class ProvisioningOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the current provisioning operation.""" - #: The provisioning operation is not specified. NOT_SPECIFIED = "NotSpecified" - #: The provisioning operation is create. + """The provisioning operation is not specified.""" CREATE = "Create" - #: The provisioning operation is delete. + """The provisioning operation is create.""" DELETE = "Delete" - #: The provisioning operation is waiting. + """The provisioning operation is delete.""" WAITING = "Waiting" - #: The provisioning operation is waiting Azure async operation. + """The provisioning operation is waiting.""" AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" - #: The provisioning operation is waiting for resource cache. + """The provisioning operation is waiting Azure async operation.""" RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" - #: The provisioning operation is action. + """The provisioning operation is waiting for resource cache.""" ACTION = "Action" - #: The provisioning operation is read. + """The provisioning operation is action.""" READ = "Read" - #: The provisioning operation is evaluate output. + """The provisioning operation is read.""" EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" - #: The provisioning operation is cleanup. This operation is part of the 'complete' mode - #: deployment. + """The provisioning operation is evaluate output.""" DEPLOYMENT_CLEANUP = "DeploymentCleanup" + """The provisioning operation is cleanup. This operation is part of the 'complete' mode + #: deployment.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -195,13 +195,13 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TagsPatchOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation type for the patch API.""" - #: The 'replace' option replaces the entire set of existing tags with a new set. REPLACE = "Replace" - #: The 'merge' option allows adding tags with new names and updating the values of tags with - #: existing names. + """The 'replace' option replaces the entire set of existing tags with a new set.""" MERGE = "Merge" - #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + """The 'merge' option allows adding tags with new names and updating the values of tags with + #: existing names.""" DELETE = "Delete" + """The 'delete' option allows selectively deleting tags based on given names or name/value pairs.""" class WhatIfResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py index 836434bc96ec..58cd02d60cb4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py @@ -3409,8 +3409,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3739,7 +3739,7 @@ def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4257,8 +4257,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4572,7 +4572,8 @@ def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4777,7 +4778,8 @@ def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5318,8 +5320,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5660,7 +5662,8 @@ def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5880,7 +5883,8 @@ def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6412,8 +6416,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6734,7 +6738,7 @@ def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6940,7 +6944,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7493,8 +7498,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7841,7 +7846,7 @@ def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8073,7 +8078,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9209,8 +9215,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9418,8 +9424,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group containing the resources to validate for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10007,8 +10013,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10276,8 +10282,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10737,8 +10743,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10951,7 +10957,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11203,7 +11210,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11509,8 +11516,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -11712,8 +11719,8 @@ def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12276,7 +12283,7 @@ def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12413,7 +12420,7 @@ def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_01_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json index 1e895e3bbc7d..d225c94a4e91 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The Microsoft Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py index 381498adccfe..b403024ce679 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py @@ -125,5 +125,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py index 82c2b11e5af5..aef894130e5a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py @@ -127,5 +127,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py index 132f6f75767d..0d48225c912a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py @@ -573,8 +573,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -903,7 +903,7 @@ async def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1421,8 +1421,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1736,7 +1736,8 @@ async def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1941,7 +1942,8 @@ async def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2486,8 +2488,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2828,7 +2830,8 @@ async def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3048,7 +3051,8 @@ async def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3580,8 +3584,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3902,7 +3906,7 @@ async def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4108,7 +4112,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4661,8 +4666,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5009,7 +5014,7 @@ async def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5241,7 +5246,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5785,8 +5791,8 @@ async def register( :param resource_provider_namespace: The namespace of the resource provider to register. Required. :type resource_provider_namespace: str - :param properties: The third party consent for S2S. Is either a model type or a IO type. - Default value is None. + :param properties: The third party consent for S2S. Is either a ProviderRegistrationRequest + type or a IO type. Default value is None. :type properties: ~azure.mgmt.resource.resources.v2021_04_01.models.ProviderRegistrationRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6506,8 +6512,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be moved. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6715,8 +6721,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be validated for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7314,8 +7320,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7583,8 +7589,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8047,8 +8053,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8261,7 +8267,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8513,7 +8520,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8819,8 +8826,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -9022,8 +9029,8 @@ async def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9586,7 +9593,7 @@ async def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9723,7 +9730,7 @@ async def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py index d6b553646be7..2b62dd94b7dd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py @@ -64,8 +64,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -121,8 +121,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -162,7 +162,7 @@ class AliasPathMetadata(_serialization.Model): "attributes": {"key": "attributes", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -192,8 +192,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -229,7 +229,7 @@ class ApiProfile(_serialization.Model): "api_version": {"key": "apiVersion", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.profile_version = None @@ -259,8 +259,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -291,7 +291,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -332,8 +332,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2021_04_01.models.BasicDependency] @@ -380,8 +380,8 @@ def __init__( properties: "_models.DeploymentProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -407,7 +407,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -457,8 +457,8 @@ def __init__( location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -488,7 +488,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -517,7 +517,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentExtended] @@ -552,7 +552,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -622,7 +622,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_operation = None @@ -657,7 +657,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentOperation] @@ -734,8 +734,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -871,7 +871,7 @@ class DeploymentPropertiesExtended(_serialization.Model): # pylint: disable=too "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -914,7 +914,7 @@ class DeploymentValidateResult(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any) -> None: """ :keyword properties: The template deployment properties. :paramtype properties: @@ -946,7 +946,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -1031,8 +1033,8 @@ def __init__( on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -1099,7 +1101,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -1131,7 +1135,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1139,7 +1143,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1172,7 +1177,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1199,7 +1204,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1215,7 +1220,8 @@ def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[s class ExpressionEvaluationOptions(_serialization.Model): - """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + """Specifies whether template expressions are evaluated within the scope of the parent template or + nested template. :ivar scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1227,7 +1233,9 @@ class ExpressionEvaluationOptions(_serialization.Model): "scope": {"key": "scope", "type": "str"}, } - def __init__(self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs): + def __init__( + self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs: Any + ) -> None: """ :keyword scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1253,8 +1261,12 @@ class ExtendedLocation(_serialization.Model): } def __init__( - self, *, type: Optional[Union[str, "_models.ExtendedLocationType"]] = None, name: Optional[str] = None, **kwargs - ): + self, + *, + type: Optional[Union[str, "_models.ExtendedLocationType"]] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword type: The extended location type. "EdgeZone" :paramtype type: str or ~azure.mgmt.resource.resources.v2021_04_01.models.ExtendedLocationType @@ -1306,8 +1318,8 @@ def __init__( location: Optional[str] = None, extended_location: Optional["_models.ExtendedLocation"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1391,8 +1403,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1503,8 +1515,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1566,8 +1578,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1593,7 +1605,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1638,8 +1650,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.IdentityUserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1678,7 +1690,7 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1705,8 +1717,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1748,8 +1760,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1777,7 +1789,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1816,8 +1830,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1836,7 +1850,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.Operation] @@ -1849,7 +1864,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.Operation] @@ -1881,7 +1898,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1920,8 +1937,8 @@ def __init__( not_actions: Optional[List[str]] = None, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Allowed actions. :paramtype actions: list[str] @@ -1970,8 +1987,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -2035,8 +2052,8 @@ def __init__( *, namespace: Optional[str] = None, provider_authorization_consent_state: Optional[Union[str, "_models.ProviderAuthorizationConsentState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -2065,7 +2082,7 @@ class ProviderConsentDefinition(_serialization.Model): "consent_to_authorization": {"key": "consentToAuthorization", "type": "bool"}, } - def __init__(self, *, consent_to_authorization: Optional[bool] = None, **kwargs): + def __init__(self, *, consent_to_authorization: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword consent_to_authorization: A value indicating whether authorization is consented or not. @@ -2098,8 +2115,8 @@ def __init__( location: Optional[str] = None, type: Optional[str] = None, extended_locations: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The azure location. :paramtype location: str @@ -2134,7 +2151,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.Provider] @@ -2174,8 +2191,8 @@ def __init__( role_definition: Optional["_models.RoleDefinition"] = None, managed_by_role_definition: Optional["_models.RoleDefinition"] = None, provider_authorization_consent_state: Optional[Union[str, "_models.ProviderAuthorizationConsentState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword application_id: The application id. :paramtype application_id: str @@ -2216,7 +2233,7 @@ class ProviderPermissionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of provider permissions. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.ProviderPermission] @@ -2238,7 +2255,9 @@ class ProviderRegistrationRequest(_serialization.Model): "third_party_provider_consent": {"key": "thirdPartyProviderConsent", "type": "ProviderConsentDefinition"}, } - def __init__(self, *, third_party_provider_consent: Optional["_models.ProviderConsentDefinition"] = None, **kwargs): + def __init__( + self, *, third_party_provider_consent: Optional["_models.ProviderConsentDefinition"] = None, **kwargs: Any + ) -> None: """ :keyword third_party_provider_consent: The provider consent. :paramtype third_party_provider_consent: @@ -2305,8 +2324,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -2359,7 +2378,7 @@ class ProviderResourceTypeListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource types. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.ProviderResourceType] @@ -2417,8 +2436,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -2455,7 +2474,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -2481,7 +2502,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2513,7 +2534,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.ResourceGroup] @@ -2550,8 +2571,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2587,7 +2608,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2613,7 +2634,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2655,8 +2676,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2694,7 +2715,7 @@ class ResourceReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2714,7 +2735,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2757,8 +2780,8 @@ def __init__( is_service_role: Optional[bool] = None, permissions: Optional[List["_models.Permission"]] = None, scopes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The role definition ID. :paramtype id: str @@ -2809,8 +2832,8 @@ def __init__( location: str, properties: "_models.DeploymentProperties", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2847,7 +2870,7 @@ class ScopedDeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs): + def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs: Any) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2895,8 +2918,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2934,7 +2957,9 @@ class StatusMessage(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword status: Status of the deployment operation. :paramtype status: str @@ -2957,7 +2982,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2980,7 +3005,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -3025,8 +3050,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -3054,7 +3079,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -3083,7 +3108,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2021_04_01.models.TagDetails] @@ -3113,8 +3138,8 @@ def __init__( *, operation: Optional[Union[str, "_models.TagsPatchOperation"]] = None, properties: Optional["_models.Tags"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operation: The operation type for the patch API. Known values are: "Replace", "Merge", and "Delete". @@ -3159,7 +3184,7 @@ class TagsResource(_serialization.Model): "properties": {"key": "properties", "type": "Tags"}, } - def __init__(self, *, properties: "_models.Tags", **kwargs): + def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: """ :keyword properties: The set of tags. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2021_04_01.models.Tags @@ -3194,7 +3219,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -3230,8 +3257,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -3247,7 +3274,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -3260,7 +3288,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -3307,8 +3337,8 @@ def __init__( relative_path: Optional[str] = None, content_version: Optional[str] = None, query_string: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword uri: The URI of the template to deploy. Use either the uri or id property, but not both. @@ -3379,8 +3409,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -3407,7 +3437,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -3429,8 +3460,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -3485,8 +3516,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -3524,7 +3555,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_resource_management_client_enums.py index 2778267e7da4..918cee87541a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_resource_management_client_enums.py @@ -13,76 +13,76 @@ class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The attributes of the token that the alias path is referring to.""" - #: The token that the alias path is referring to has no attributes. NONE = "None" - #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + """The token that the alias path is referring to has no attributes.""" MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the token that the alias path is referring to.""" - #: The token type is not specified. NOT_SPECIFIED = "NotSpecified" - #: The token type can be anything. + """The token type is not specified.""" ANY = "Any" - #: The token type is string. + """The token type can be anything.""" STRING = "String" - #: The token type is object. + """The token type is string.""" OBJECT = "Object" - #: The token type is array. + """The token type is object.""" ARRAY = "Array" - #: The token type is integer. + """The token type is array.""" INTEGER = "Integer" - #: The token type is number. + """The token type is integer.""" NUMBER = "Number" - #: The token type is boolean. + """The token type is number.""" BOOLEAN = "Boolean" + """The token type is boolean.""" class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" - #: The resource is not supported by What-If. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" UNSUPPORTED = "Unsupported" + """The resource is not supported by What-If.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -125,19 +125,19 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" - #: The property will not be set or updated. + """The property is an array and contains nested changes.""" NO_EFFECT = "NoEffect" + """The property will not be set or updated.""" class ProviderAuthorizationConsentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -152,27 +152,27 @@ class ProviderAuthorizationConsentState(str, Enum, metaclass=CaseInsensitiveEnum class ProvisioningOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the current provisioning operation.""" - #: The provisioning operation is not specified. NOT_SPECIFIED = "NotSpecified" - #: The provisioning operation is create. + """The provisioning operation is not specified.""" CREATE = "Create" - #: The provisioning operation is delete. + """The provisioning operation is create.""" DELETE = "Delete" - #: The provisioning operation is waiting. + """The provisioning operation is delete.""" WAITING = "Waiting" - #: The provisioning operation is waiting Azure async operation. + """The provisioning operation is waiting.""" AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" - #: The provisioning operation is waiting for resource cache. + """The provisioning operation is waiting Azure async operation.""" RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" - #: The provisioning operation is action. + """The provisioning operation is waiting for resource cache.""" ACTION = "Action" - #: The provisioning operation is read. + """The provisioning operation is action.""" READ = "Read" - #: The provisioning operation is evaluate output. + """The provisioning operation is read.""" EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" - #: The provisioning operation is cleanup. This operation is part of the 'complete' mode - #: deployment. + """The provisioning operation is evaluate output.""" DEPLOYMENT_CLEANUP = "DeploymentCleanup" + """The provisioning operation is cleanup. This operation is part of the 'complete' mode + #: deployment.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -204,13 +204,13 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TagsPatchOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation type for the patch API.""" - #: The 'replace' option replaces the entire set of existing tags with a new set. REPLACE = "Replace" - #: The 'merge' option allows adding tags with new names and updating the values of tags with - #: existing names. + """The 'replace' option replaces the entire set of existing tags with a new set.""" MERGE = "Merge" - #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + """The 'merge' option allows adding tags with new names and updating the values of tags with + #: existing names.""" DELETE = "Delete" + """The 'delete' option allows selectively deleting tags based on given names or name/value pairs.""" class WhatIfResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py index 2440fa3b865a..c36db3eba9e8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py @@ -3433,8 +3433,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3763,7 +3763,7 @@ def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4281,8 +4281,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4596,7 +4596,8 @@ def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4801,7 +4802,8 @@ def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5342,8 +5344,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5684,7 +5686,8 @@ def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5904,7 +5907,8 @@ def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6436,8 +6440,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6758,7 +6762,7 @@ def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6964,7 +6968,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7517,8 +7522,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7865,7 +7870,7 @@ def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8097,7 +8102,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8641,8 +8647,8 @@ def register( :param resource_provider_namespace: The namespace of the resource provider to register. Required. :type resource_provider_namespace: str - :param properties: The third party consent for S2S. Is either a model type or a IO type. - Default value is None. + :param properties: The third party consent for S2S. Is either a ProviderRegistrationRequest + type or a IO type. Default value is None. :type properties: ~azure.mgmt.resource.resources.v2021_04_01.models.ProviderRegistrationRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -9360,8 +9366,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be moved. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9569,8 +9575,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be validated for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10168,8 +10174,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10437,8 +10443,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10901,8 +10907,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11115,7 +11121,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11367,7 +11374,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11673,8 +11680,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -11876,8 +11883,8 @@ def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12440,7 +12447,7 @@ def create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12577,7 +12584,7 @@ def update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2021_04_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json index a06137c8967b..2c6fa72a2b76 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "The Microsoft Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py index e4d1f51fb68b..6a37fb9f4a25 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py @@ -125,5 +125,5 @@ def __enter__(self) -> "ResourceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py index 41fedfc7fbc3..ecd011e71ad7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py @@ -127,5 +127,5 @@ async def __aenter__(self) -> "ResourceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py index 7ab8e3d3f2cc..218146d65f07 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py @@ -573,8 +573,8 @@ async def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -903,7 +903,7 @@ async def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1421,8 +1421,8 @@ async def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1736,7 +1736,8 @@ async def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1941,7 +1942,8 @@ async def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -2486,8 +2488,8 @@ async def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2828,7 +2830,8 @@ async def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3048,7 +3051,8 @@ async def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -3580,8 +3584,8 @@ async def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3902,7 +3906,7 @@ async def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4108,7 +4112,8 @@ async def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4661,8 +4666,8 @@ async def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5009,7 +5014,7 @@ async def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5241,7 +5246,8 @@ async def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5785,8 +5791,8 @@ async def register( :param resource_provider_namespace: The namespace of the resource provider to register. Required. :type resource_provider_namespace: str - :param properties: The third party consent for S2S. Is either a model type or a IO type. - Default value is None. + :param properties: The third party consent for S2S. Is either a ProviderRegistrationRequest + type or a IO type. Default value is None. :type properties: ~azure.mgmt.resource.resources.v2022_09_01.models.ProviderRegistrationRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6506,8 +6512,8 @@ async def begin_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be moved. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6715,8 +6721,8 @@ async def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be validated for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7314,8 +7320,8 @@ async def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7583,8 +7589,8 @@ async def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8047,8 +8053,8 @@ async def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8261,7 +8267,8 @@ async def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8513,7 +8520,7 @@ async def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8819,8 +8826,8 @@ async def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -9022,8 +9029,8 @@ async def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9668,7 +9675,7 @@ async def begin_create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9886,7 +9893,7 @@ async def begin_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py index 3c634f905e53..d2a8923cc716 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py @@ -64,8 +64,8 @@ def __init__( type: Optional[Union[str, "_models.AliasType"]] = None, default_path: Optional[str] = None, default_pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The alias name. :paramtype name: str @@ -121,8 +121,8 @@ def __init__( path: Optional[str] = None, api_versions: Optional[List[str]] = None, pattern: Optional["_models.AliasPattern"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of an alias. :paramtype path: str @@ -162,7 +162,7 @@ class AliasPathMetadata(_serialization.Model): "attributes": {"key": "attributes", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -192,8 +192,8 @@ def __init__( phrase: Optional[str] = None, variable: Optional[str] = None, type: Optional[Union[str, "_models.AliasPatternType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phrase: The alias pattern phrase. :paramtype phrase: str @@ -229,7 +229,7 @@ class ApiProfile(_serialization.Model): "api_version": {"key": "apiVersion", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.profile_version = None @@ -259,8 +259,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the dependency. :paramtype id: str @@ -291,7 +291,7 @@ class DebugSetting(_serialization.Model): "detail_level": {"key": "detailLevel", "type": "str"}, } - def __init__(self, *, detail_level: Optional[str] = None, **kwargs): + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: """ :keyword detail_level: Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent @@ -332,8 +332,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_type: Optional[str] = None, resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword depends_on: The list of dependencies. :paramtype depends_on: list[~azure.mgmt.resource.resources.v2022_09_01.models.BasicDependency] @@ -380,8 +380,8 @@ def __init__( properties: "_models.DeploymentProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -407,7 +407,7 @@ class DeploymentExportResult(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -457,8 +457,8 @@ def __init__( location: Optional[str] = None, properties: Optional["_models.DeploymentPropertiesExtended"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the deployment. :paramtype location: str @@ -488,7 +488,7 @@ class DeploymentExtendedFilter(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: """ :keyword provisioning_state: The provisioning state. :paramtype provisioning_state: str @@ -517,7 +517,7 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployments. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentExtended] @@ -552,7 +552,7 @@ class DeploymentOperation(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, } - def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Deployment properties. :paramtype properties: @@ -622,7 +622,7 @@ class DeploymentOperationProperties(_serialization.Model): "response": {"key": "response", "type": "HttpMessage"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_operation = None @@ -657,7 +657,7 @@ class DeploymentOperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of deployment operations. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentOperation] @@ -734,8 +734,8 @@ def __init__( debug_setting: Optional["_models.DebugSetting"] = None, on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -871,7 +871,7 @@ class DeploymentPropertiesExtended(_serialization.Model): # pylint: disable=too "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -914,7 +914,7 @@ class DeploymentValidateResult(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, } - def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any) -> None: """ :keyword properties: The template deployment properties. :paramtype properties: @@ -946,7 +946,9 @@ class DeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. :paramtype location: str @@ -1031,8 +1033,8 @@ def __init__( on_error_deployment: Optional["_models.OnErrorDeployment"] = None, expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword template: The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a @@ -1099,7 +1101,9 @@ class DeploymentWhatIfSettings(_serialization.Model): "result_format": {"key": "resultFormat", "type": "str"}, } - def __init__(self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs): + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and "FullResourcePayloads". @@ -1131,7 +1135,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1139,7 +1143,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1172,7 +1177,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1199,7 +1204,7 @@ class ExportTemplateRequest(_serialization.Model): "options": {"key": "options", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs): + def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resources: The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. @@ -1215,7 +1220,8 @@ def __init__(self, *, resources: Optional[List[str]] = None, options: Optional[s class ExpressionEvaluationOptions(_serialization.Model): - """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + """Specifies whether template expressions are evaluated within the scope of the parent template or + nested template. :ivar scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1227,7 +1233,9 @@ class ExpressionEvaluationOptions(_serialization.Model): "scope": {"key": "scope", "type": "str"}, } - def __init__(self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs): + def __init__( + self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs: Any + ) -> None: """ :keyword scope: The scope to be used for evaluation of parameters, variables and functions in a nested template. Known values are: "NotSpecified", "Outer", and "Inner". @@ -1253,8 +1261,12 @@ class ExtendedLocation(_serialization.Model): } def __init__( - self, *, type: Optional[Union[str, "_models.ExtendedLocationType"]] = None, name: Optional[str] = None, **kwargs - ): + self, + *, + type: Optional[Union[str, "_models.ExtendedLocationType"]] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword type: The extended location type. "EdgeZone" :paramtype type: str or ~azure.mgmt.resource.resources.v2022_09_01.models.ExtendedLocationType @@ -1306,8 +1318,8 @@ def __init__( location: Optional[str] = None, extended_location: Optional["_models.ExtendedLocation"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1391,8 +1403,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1503,8 +1515,8 @@ def __init__( managed_by: Optional[str] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1566,8 +1578,8 @@ def __init__( resource_type: Optional[str] = None, tagname: Optional[str] = None, tagvalue: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -1593,7 +1605,7 @@ class HttpMessage(_serialization.Model): "content": {"key": "content", "type": "object"}, } - def __init__(self, *, content: Optional[JSON] = None, **kwargs): + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword content: HTTP message content. :paramtype content: JSON @@ -1638,8 +1650,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.IdentityUserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -1678,7 +1690,7 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -1705,8 +1717,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1748,8 +1760,8 @@ def __init__( *, type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, deployment_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". @@ -1777,7 +1789,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -1816,8 +1830,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -1836,7 +1850,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.Operation] @@ -1849,7 +1864,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.Operation] @@ -1881,7 +1898,7 @@ class ParametersLink(_serialization.Model): "content_version": {"key": "contentVersion", "type": "str"}, } - def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs): + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: The URI of the parameters file. Required. :paramtype uri: str @@ -1920,8 +1937,8 @@ def __init__( not_actions: Optional[List[str]] = None, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword actions: Allowed actions. :paramtype actions: list[str] @@ -1970,8 +1987,8 @@ def __init__( product: Optional[str] = None, promotion_code: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The plan ID. :paramtype name: str @@ -2035,8 +2052,8 @@ def __init__( *, namespace: Optional[str] = None, provider_authorization_consent_state: Optional[Union[str, "_models.ProviderAuthorizationConsentState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword namespace: The namespace of the resource provider. :paramtype namespace: str @@ -2065,7 +2082,7 @@ class ProviderConsentDefinition(_serialization.Model): "consent_to_authorization": {"key": "consentToAuthorization", "type": "bool"}, } - def __init__(self, *, consent_to_authorization: Optional[bool] = None, **kwargs): + def __init__(self, *, consent_to_authorization: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword consent_to_authorization: A value indicating whether authorization is consented or not. @@ -2098,8 +2115,8 @@ def __init__( location: Optional[str] = None, type: Optional[str] = None, extended_locations: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The azure location. :paramtype location: str @@ -2134,7 +2151,7 @@ class ProviderListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource providers. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.Provider] @@ -2174,8 +2191,8 @@ def __init__( role_definition: Optional["_models.RoleDefinition"] = None, managed_by_role_definition: Optional["_models.RoleDefinition"] = None, provider_authorization_consent_state: Optional[Union[str, "_models.ProviderAuthorizationConsentState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword application_id: The application id. :paramtype application_id: str @@ -2216,7 +2233,7 @@ class ProviderPermissionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of provider permissions. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.ProviderPermission] @@ -2238,7 +2255,9 @@ class ProviderRegistrationRequest(_serialization.Model): "third_party_provider_consent": {"key": "thirdPartyProviderConsent", "type": "ProviderConsentDefinition"}, } - def __init__(self, *, third_party_provider_consent: Optional["_models.ProviderConsentDefinition"] = None, **kwargs): + def __init__( + self, *, third_party_provider_consent: Optional["_models.ProviderConsentDefinition"] = None, **kwargs: Any + ) -> None: """ :keyword third_party_provider_consent: The provider consent. :paramtype third_party_provider_consent: @@ -2305,8 +2324,8 @@ def __init__( zone_mappings: Optional[List["_models.ZoneMapping"]] = None, capabilities: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The resource type. :paramtype resource_type: str @@ -2359,7 +2378,7 @@ class ProviderResourceTypeListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource types. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.ProviderResourceType] @@ -2417,8 +2436,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The resource group properties. :paramtype properties: @@ -2455,7 +2474,9 @@ class ResourceGroupExportResult(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, template: Optional[JSON] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword template: The template content. :paramtype template: JSON @@ -2481,7 +2502,7 @@ class ResourceGroupFilter(_serialization.Model): "tag_value": {"key": "tagValue", "type": "str"}, } - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs): + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -2513,7 +2534,7 @@ class ResourceGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resource groups. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.ResourceGroup] @@ -2550,8 +2571,8 @@ def __init__( properties: Optional["_models.ResourceGroupProperties"] = None, managed_by: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the resource group. :paramtype name: str @@ -2587,7 +2608,7 @@ class ResourceGroupProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -2613,7 +2634,7 @@ class ResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of resources. :paramtype value: @@ -2655,8 +2676,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Operation description. :paramtype publisher: str @@ -2694,7 +2715,7 @@ class ResourceReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2714,7 +2735,9 @@ class ResourcesMoveInfo(_serialization.Model): "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, } - def __init__(self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs): + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword resources: The IDs of the resources. :paramtype resources: list[str] @@ -2757,8 +2780,8 @@ def __init__( is_service_role: Optional[bool] = None, permissions: Optional[List["_models.Permission"]] = None, scopes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The role definition ID. :paramtype id: str @@ -2809,8 +2832,8 @@ def __init__( location: str, properties: "_models.DeploymentProperties", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2847,7 +2870,7 @@ class ScopedDeploymentWhatIf(_serialization.Model): "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, } - def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs): + def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs: Any) -> None: """ :keyword location: The location to store the deployment data. Required. :paramtype location: str @@ -2895,8 +2918,8 @@ def __init__( family: Optional[str] = None, model: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The SKU name. :paramtype name: str @@ -2934,7 +2957,9 @@ class StatusMessage(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__( + self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: """ :keyword status: Status of the deployment operation. :paramtype status: str @@ -2957,7 +2982,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -2980,7 +3005,7 @@ class TagCount(_serialization.Model): "value": {"key": "value", "type": "int"}, } - def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: """ :keyword type: Type of count. :paramtype type: str @@ -3025,8 +3050,8 @@ def __init__( tag_name: Optional[str] = None, count: Optional["_models.TagCount"] = None, values: Optional[List["_models.TagValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tag_name: The tag name. :paramtype tag_name: str @@ -3054,7 +3079,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -3083,7 +3108,7 @@ class TagsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of tags. :paramtype value: list[~azure.mgmt.resource.resources.v2022_09_01.models.TagDetails] @@ -3113,8 +3138,8 @@ def __init__( *, operation: Optional[Union[str, "_models.TagsPatchOperation"]] = None, properties: Optional["_models.Tags"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operation: The operation type for the patch API. Known values are: "Replace", "Merge", and "Delete". @@ -3159,7 +3184,7 @@ class TagsResource(_serialization.Model): "properties": {"key": "properties", "type": "Tags"}, } - def __init__(self, *, properties: "_models.Tags", **kwargs): + def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: """ :keyword properties: The set of tags. Required. :paramtype properties: ~azure.mgmt.resource.resources.v2022_09_01.models.Tags @@ -3194,7 +3219,9 @@ class TagValue(_serialization.Model): "count": {"key": "count", "type": "TagCount"}, } - def __init__(self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs): + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: """ :keyword tag_value: The tag value. :paramtype tag_value: str @@ -3230,8 +3257,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin resource_name: Optional[str] = None, resource_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the resource. :paramtype id: str @@ -3247,7 +3274,8 @@ def __init__( class TemplateHashResult(_serialization.Model): - """Result of the request to calculate template hash. It contains a string of minified template and its hash. + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. :ivar minified_template: The minified template string. :vartype minified_template: str @@ -3260,7 +3288,9 @@ class TemplateHashResult(_serialization.Model): "template_hash": {"key": "templateHash", "type": "str"}, } - def __init__(self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs): + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword minified_template: The minified template string. :paramtype minified_template: str @@ -3307,8 +3337,8 @@ def __init__( relative_path: Optional[str] = None, content_version: Optional[str] = None, query_string: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword uri: The URI of the template to deploy. Use either the uri or id property, but not both. @@ -3379,8 +3409,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, delta: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Resource ID. Required. :paramtype resource_id: str @@ -3407,7 +3437,8 @@ def __init__( class WhatIfOperationResult(_serialization.Model): - """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. :ivar status: Status of the What-If operation. :vartype status: str @@ -3429,8 +3460,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, changes: Optional[List["_models.WhatIfChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the What-If operation. :paramtype status: str @@ -3485,8 +3516,8 @@ def __init__( before: Optional[JSON] = None, after: Optional[JSON] = None, children: Optional[List["_models.WhatIfPropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The path of the property. Required. :paramtype path: str @@ -3524,7 +3555,7 @@ class ZoneMapping(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The location of the zone mapping. :paramtype location: str diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_resource_management_client_enums.py index 2778267e7da4..918cee87541a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_resource_management_client_enums.py @@ -13,76 +13,76 @@ class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The attributes of the token that the alias path is referring to.""" - #: The token that the alias path is referring to has no attributes. NONE = "None" - #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + """The token that the alias path is referring to has no attributes.""" MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the token that the alias path is referring to.""" - #: The token type is not specified. NOT_SPECIFIED = "NotSpecified" - #: The token type can be anything. + """The token type is not specified.""" ANY = "Any" - #: The token type is string. + """The token type can be anything.""" STRING = "String" - #: The token type is object. + """The token type is string.""" OBJECT = "Object" - #: The token type is array. + """The token type is object.""" ARRAY = "Array" - #: The token type is integer. + """The token type is array.""" INTEGER = "Integer" - #: The token type is number. + """The token type is integer.""" NUMBER = "Number" - #: The token type is boolean. + """The token type is number.""" BOOLEAN = "Boolean" + """The token type is boolean.""" class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of alias pattern.""" - #: NotSpecified is not allowed. NOT_SPECIFIED = "NotSpecified" - #: Extract is the only allowed value. + """NotSpecified is not allowed.""" EXTRACT = "Extract" + """Extract is the only allowed value.""" class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the alias.""" - #: Alias type is unknown (same as not providing alias type). NOT_SPECIFIED = "NotSpecified" - #: Alias value is not secret. + """Alias type is unknown (same as not providing alias type).""" PLAIN_TEXT = "PlainText" - #: Alias value is secret. + """Alias value is not secret.""" MASK = "Mask" + """Alias value is secret.""" class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of change that will be made to the resource when the deployment is executed.""" - #: The resource does not exist in the current state but is present in the desired state. The - #: resource will be created when the deployment is executed. CREATE = "Create" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will be deleted when the deployment is executed. + """The resource does not exist in the current state but is present in the desired state. The + #: resource will be created when the deployment is executed.""" DELETE = "Delete" - #: The resource exists in the current state and is missing from the desired state. The resource - #: will not be deployed or modified when the deployment is executed. + """The resource exists in the current state and is missing from the desired state. The resource + #: will be deleted when the deployment is executed.""" IGNORE = "Ignore" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource may or may not change. + """The resource exists in the current state and is missing from the desired state. The resource + #: will not be deployed or modified when the deployment is executed.""" DEPLOY = "Deploy" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will not change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource may or may not change.""" NO_CHANGE = "NoChange" - #: The resource exists in the current state and the desired state and will be redeployed when the - #: deployment is executed. The properties of the resource will change. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will not change.""" MODIFY = "Modify" - #: The resource is not supported by What-If. + """The resource exists in the current state and the desired state and will be redeployed when the + #: deployment is executed. The properties of the resource will change.""" UNSUPPORTED = "Unsupported" + """The resource is not supported by What-If.""" class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -125,19 +125,19 @@ class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of property change.""" - #: The property does not exist in the current state but is present in the desired state. The - #: property will be created when the deployment is executed. CREATE = "Create" - #: The property exists in the current state and is missing from the desired state. It will be - #: deleted when the deployment is executed. + """The property does not exist in the current state but is present in the desired state. The + #: property will be created when the deployment is executed.""" DELETE = "Delete" - #: The property exists in both current and desired state and is different. The value of the - #: property will change when the deployment is executed. + """The property exists in the current state and is missing from the desired state. It will be + #: deleted when the deployment is executed.""" MODIFY = "Modify" - #: The property is an array and contains nested changes. + """The property exists in both current and desired state and is different. The value of the + #: property will change when the deployment is executed.""" ARRAY = "Array" - #: The property will not be set or updated. + """The property is an array and contains nested changes.""" NO_EFFECT = "NoEffect" + """The property will not be set or updated.""" class ProviderAuthorizationConsentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -152,27 +152,27 @@ class ProviderAuthorizationConsentState(str, Enum, metaclass=CaseInsensitiveEnum class ProvisioningOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the current provisioning operation.""" - #: The provisioning operation is not specified. NOT_SPECIFIED = "NotSpecified" - #: The provisioning operation is create. + """The provisioning operation is not specified.""" CREATE = "Create" - #: The provisioning operation is delete. + """The provisioning operation is create.""" DELETE = "Delete" - #: The provisioning operation is waiting. + """The provisioning operation is delete.""" WAITING = "Waiting" - #: The provisioning operation is waiting Azure async operation. + """The provisioning operation is waiting.""" AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" - #: The provisioning operation is waiting for resource cache. + """The provisioning operation is waiting Azure async operation.""" RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" - #: The provisioning operation is action. + """The provisioning operation is waiting for resource cache.""" ACTION = "Action" - #: The provisioning operation is read. + """The provisioning operation is action.""" READ = "Read" - #: The provisioning operation is evaluate output. + """The provisioning operation is read.""" EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" - #: The provisioning operation is cleanup. This operation is part of the 'complete' mode - #: deployment. + """The provisioning operation is evaluate output.""" DEPLOYMENT_CLEANUP = "DeploymentCleanup" + """The provisioning operation is cleanup. This operation is part of the 'complete' mode + #: deployment.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -204,13 +204,13 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TagsPatchOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation type for the patch API.""" - #: The 'replace' option replaces the entire set of existing tags with a new set. REPLACE = "Replace" - #: The 'merge' option allows adding tags with new names and updating the values of tags with - #: existing names. + """The 'replace' option replaces the entire set of existing tags with a new set.""" MERGE = "Merge" - #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + """The 'merge' option allows adding tags with new names and updating the values of tags with + #: existing names.""" DELETE = "Delete" + """The 'delete' option allows selectively deleting tags based on given names or name/value pairs.""" class WhatIfResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py index 4f237631facc..324af147a975 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py @@ -3433,8 +3433,8 @@ def begin_create_or_update_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -3763,7 +3763,7 @@ def begin_validate_at_scope( :type scope: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4281,8 +4281,8 @@ def begin_create_or_update_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4596,7 +4596,8 @@ def begin_validate_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -4801,7 +4802,8 @@ def begin_what_if_at_tenant_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -5342,8 +5344,8 @@ def begin_create_or_update_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5684,7 +5686,8 @@ def begin_validate_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -5904,7 +5907,8 @@ def begin_what_if_at_management_group_scope( :type group_id: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ScopedDeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -6436,8 +6440,8 @@ def begin_create_or_update_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6758,7 +6762,7 @@ def begin_validate_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -6964,7 +6968,8 @@ def begin_what_if_at_subscription_scope( :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to What If. Is either a model type or a IO type. Required. + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7517,8 +7522,8 @@ def begin_create_or_update( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Additional parameters supplied to the operation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -7865,7 +7870,7 @@ def begin_validate( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a Deployment type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8097,7 +8102,8 @@ def begin_what_if( :type resource_group_name: str :param deployment_name: The name of the deployment. Required. :type deployment_name: str - :param parameters: Parameters to validate. Is either a model type or a IO type. Required. + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentWhatIf or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -8641,8 +8647,8 @@ def register( :param resource_provider_namespace: The namespace of the resource provider to register. Required. :type resource_provider_namespace: str - :param properties: The third party consent for S2S. Is either a model type or a IO type. - Default value is None. + :param properties: The third party consent for S2S. Is either a ProviderRegistrationRequest + type or a IO type. Default value is None. :type properties: ~azure.mgmt.resource.resources.v2022_09_01.models.ProviderRegistrationRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -9360,8 +9366,8 @@ def begin_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be moved. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -9569,8 +9575,8 @@ def begin_validate_move_resources( :param source_resource_group_name: The name of the resource group from the source subscription containing the resources to be validated for move. Required. :type source_resource_group_name: str - :param parameters: Parameters for moving resources. Is either a model type or a IO type. - Required. + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO + type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourcesMoveInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10168,8 +10174,8 @@ def begin_create_or_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for creating or updating the resource. Is either a model type or - a IO type. Required. + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10437,8 +10443,8 @@ def begin_update( :type resource_name: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Parameters for updating the resource. Is either a model type or a IO type. - Required. + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -10901,8 +10907,8 @@ def begin_create_or_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Create or update resource parameters. Is either a model type or a IO type. - Required. + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11115,7 +11121,8 @@ def begin_update_by_id( :type resource_id: str :param api_version: The API version to use for the operation. Required. :type api_version: str - :param parameters: Update resource parameters. Is either a model type or a IO type. Required. + :param parameters: Update resource parameters. Is either a GenericResource type or a IO type. + Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.GenericResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11367,7 +11374,7 @@ def create_or_update( that match the allowed characters. Required. :type resource_group_name: str :param parameters: Parameters supplied to the create or update a resource group. Is either a - model type or a IO type. Required. + ResourceGroup type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourceGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -11673,8 +11680,8 @@ def update( :param resource_group_name: The name of the resource group to update. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters supplied to update a resource group. Is either a model type or a - IO type. Required. + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ResourceGroupPatchable or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -11876,8 +11883,8 @@ def begin_export_template( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param parameters: Parameters for exporting the template. Is either a model type or a IO type. - Required. + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.ExportTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12522,7 +12529,7 @@ def begin_create_or_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -12740,7 +12747,7 @@ def begin_update_at_scope( :param scope: The resource scope. Required. :type scope: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a TagsPatchResource type or a IO type. Required. :type parameters: ~azure.mgmt.resource.resources.v2022_09_01.models.TagsPatchResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py index 98f7065cbf8c..518047646f56 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py @@ -27,7 +27,7 @@ def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py index e6fb46d3714f..b513725d63c5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py @@ -27,7 +27,7 @@ async def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json index d7f14dddd386..04478ecc9c32 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -39,19 +40,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -96,13 +103,13 @@ "check_resource_name" : { "sync": { "signature": "def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" }, "async": { "coroutine": true, "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py index 265624d84b5e..83b79e4d202e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py @@ -86,5 +86,5 @@ def __enter__(self) -> "SubscriptionClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_vendor.py index c99c26601b42..5c8832ef4c92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py index 9de159a4cef4..8fabf1236f0d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py @@ -87,5 +87,5 @@ async def __aenter__(self) -> "SubscriptionClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py index faa6d1d6d43c..e47139777a0b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py @@ -435,8 +435,8 @@ async def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -661,7 +661,7 @@ async def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py index 8ec7fb23dc3a..e56e51b13a91 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -36,7 +36,7 @@ class AvailabilityZonePeers(_serialization.Model): "peers": {"key": "peers", "type": "[Peers]"}, } - def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): + def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: Any) -> None: """ :keyword peers: Details of shared availability zone. :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Peers] @@ -47,7 +47,8 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): class CheckResourceNameResult(_serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start + with a reserved word. :ivar name: Name of Resource. :vartype name: str @@ -71,8 +72,8 @@ def __init__( name: Optional[str] = None, type: Optional[str] = None, status: Optional[Union[str, "_models.ResourceNameStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of Resource. :paramtype name: str @@ -103,7 +104,9 @@ class CheckZonePeersRequest(_serialization.Model): "subscription_ids": {"key": "subscriptionIds", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword location: The Microsoft location. :paramtype location: str @@ -144,8 +147,8 @@ def __init__( *, location: Optional[str] = None, availability_zone_peers: Optional[List["_models.AvailabilityZonePeers"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the subscription. :paramtype location: str @@ -180,7 +183,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -201,7 +204,7 @@ class ErrorDefinition(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: Description of the error. :paramtype message: str @@ -247,7 +250,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -258,7 +261,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDetail @@ -268,7 +272,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDetail @@ -288,7 +292,7 @@ class ErrorResponseAutoGenerated(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: The error details. :paramtype error: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDefinition @@ -335,7 +339,7 @@ class Location(_serialization.Model): "longitude": {"key": "longitude", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -357,7 +361,7 @@ class LocationListResult(_serialization.Model): "value": {"key": "value", "type": "[Location]"}, } - def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of locations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Location] @@ -380,7 +384,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -419,8 +425,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -439,7 +445,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Operation] @@ -452,7 +459,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Operation] @@ -485,7 +494,7 @@ class Peers(_serialization.Model): "availability_zone": {"key": "availabilityZone", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subscription_id = None @@ -513,7 +522,7 @@ class ResourceName(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: str, **kwargs): + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: """ :keyword name: Name of the resource. Required. :paramtype name: str @@ -570,8 +579,8 @@ def __init__( *, subscription_policies: Optional["_models.SubscriptionPolicies"] = None, authorization_source: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscription_policies: The subscription policies. :paramtype subscription_policies: @@ -610,7 +619,7 @@ class SubscriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs): + def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of subscriptions. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Subscription] @@ -651,7 +660,7 @@ class SubscriptionPolicies(_serialization.Model): "spending_limit": {"key": "spendingLimit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location_placement_id = None @@ -681,7 +690,7 @@ class TenantIdDescription(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -708,7 +717,9 @@ class TenantListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs): + def __init__( + self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of tenants. :paramtype value: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py index 6ed3f2630c08..8bdd9abd30bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py @@ -582,8 +582,8 @@ def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -808,7 +808,7 @@ def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json index d516e8549551..fc134633a65f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -39,19 +40,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -96,13 +103,13 @@ "check_resource_name" : { "sync": { "signature": "def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" }, "async": { "coroutine": true, "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py index b33c0a5ba0bc..475dc4de0895 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py @@ -86,5 +86,5 @@ def __enter__(self) -> "SubscriptionClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_vendor.py index c99c26601b42..5c8832ef4c92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py index 17008dc0582b..db8f45e40824 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py @@ -87,5 +87,5 @@ async def __aenter__(self) -> "SubscriptionClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py index b6ec637a56a6..29882ae8a20b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py @@ -435,8 +435,8 @@ async def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -661,7 +661,7 @@ async def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py index ca3f3def15b5..43964734f6a7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -36,7 +36,7 @@ class AvailabilityZonePeers(_serialization.Model): "peers": {"key": "peers", "type": "[Peers]"}, } - def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): + def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: Any) -> None: """ :keyword peers: Details of shared availability zone. :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2018_06_01.models.Peers] @@ -47,7 +47,8 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): class CheckResourceNameResult(_serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start + with a reserved word. :ivar name: Name of Resource. :vartype name: str @@ -71,8 +72,8 @@ def __init__( name: Optional[str] = None, type: Optional[str] = None, status: Optional[Union[str, "_models.ResourceNameStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of Resource. :paramtype name: str @@ -103,7 +104,9 @@ class CheckZonePeersRequest(_serialization.Model): "subscription_ids": {"key": "subscriptionIds", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword location: The Microsoft location. :paramtype location: str @@ -144,8 +147,8 @@ def __init__( *, location: Optional[str] = None, availability_zone_peers: Optional[List["_models.AvailabilityZonePeers"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the subscription. :paramtype location: str @@ -180,7 +183,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -201,7 +204,7 @@ class ErrorDefinition(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: Description of the error. :paramtype message: str @@ -247,7 +250,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -258,7 +261,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ErrorDetail @@ -268,7 +272,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ErrorDetail @@ -288,7 +292,7 @@ class ErrorResponseAutoGenerated(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: The error details. :paramtype error: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ErrorDefinition @@ -335,7 +339,7 @@ class Location(_serialization.Model): "longitude": {"key": "longitude", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -357,7 +361,7 @@ class LocationListResult(_serialization.Model): "value": {"key": "value", "type": "[Location]"}, } - def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of locations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2018_06_01.models.Location] @@ -380,7 +384,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -419,8 +425,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -439,7 +445,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.subscriptions.v2018_06_01.models.Operation] @@ -452,7 +459,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2018_06_01.models.Operation] @@ -485,7 +494,7 @@ class Peers(_serialization.Model): "availability_zone": {"key": "availabilityZone", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subscription_id = None @@ -513,7 +522,7 @@ class ResourceName(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: str, **kwargs): + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: """ :keyword name: Name of the resource. Required. :paramtype name: str @@ -574,8 +583,8 @@ def __init__( *, subscription_policies: Optional["_models.SubscriptionPolicies"] = None, authorization_source: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscription_policies: The subscription policies. :paramtype subscription_policies: @@ -615,7 +624,7 @@ class SubscriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs): + def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of subscriptions. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2018_06_01.models.Subscription] @@ -656,7 +665,7 @@ class SubscriptionPolicies(_serialization.Model): "spending_limit": {"key": "spendingLimit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location_placement_id = None @@ -702,7 +711,7 @@ class TenantIdDescription(_serialization.Model): "domains": {"key": "domains", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -733,7 +742,9 @@ class TenantListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs): + def __init__( + self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of tenants. :paramtype value: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py index a9ba8bdb5847..fb9deab9b11d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py @@ -582,8 +582,8 @@ def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -808,7 +808,7 @@ def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json index 6eb62fde90cc..623988ed6190 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -39,19 +40,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -96,13 +103,13 @@ "check_resource_name" : { "sync": { "signature": "def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" }, "async": { "coroutine": true, "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py index d7eaaad43dfb..04bfa3c03b5f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py @@ -86,5 +86,5 @@ def __enter__(self) -> "SubscriptionClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_vendor.py index c99c26601b42..5c8832ef4c92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py index 9c7f2a689619..22d8e6116970 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py @@ -87,5 +87,5 @@ async def __aenter__(self) -> "SubscriptionClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py index 44a25da2b3ee..0b0115b3924a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py @@ -435,8 +435,8 @@ async def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -661,7 +661,7 @@ async def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py index 1693d87ce420..91aaf1a2dec0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -36,7 +36,7 @@ class AvailabilityZonePeers(_serialization.Model): "peers": {"key": "peers", "type": "[Peers]"}, } - def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): + def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: Any) -> None: """ :keyword peers: Details of shared availability zone. :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.Peers] @@ -47,7 +47,8 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): class CheckResourceNameResult(_serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start + with a reserved word. :ivar name: Name of Resource. :vartype name: str @@ -71,8 +72,8 @@ def __init__( name: Optional[str] = None, type: Optional[str] = None, status: Optional[Union[str, "_models.ResourceNameStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of Resource. :paramtype name: str @@ -103,7 +104,9 @@ class CheckZonePeersRequest(_serialization.Model): "subscription_ids": {"key": "subscriptionIds", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword location: The Microsoft location. :paramtype location: str @@ -144,8 +147,8 @@ def __init__( *, location: Optional[str] = None, availability_zone_peers: Optional[List["_models.AvailabilityZonePeers"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the subscription. :paramtype location: str @@ -180,7 +183,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -201,7 +204,7 @@ class ErrorDefinition(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: Description of the error. :paramtype message: str @@ -247,7 +250,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -258,7 +261,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ErrorDetail @@ -268,7 +272,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ErrorDetail @@ -288,7 +292,7 @@ class ErrorResponseAutoGenerated(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: The error details. :paramtype error: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ErrorDefinition @@ -335,7 +339,7 @@ class Location(_serialization.Model): "longitude": {"key": "longitude", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -357,7 +361,7 @@ class LocationListResult(_serialization.Model): "value": {"key": "value", "type": "[Location]"}, } - def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of locations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.Location] @@ -383,7 +387,7 @@ class ManagedByTenant(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.tenant_id = None @@ -403,7 +407,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -442,8 +448,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -462,7 +468,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.Operation] @@ -475,7 +482,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.Operation] @@ -508,7 +517,7 @@ class Peers(_serialization.Model): "availability_zone": {"key": "availabilityZone", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subscription_id = None @@ -536,7 +545,7 @@ class ResourceName(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: str, **kwargs): + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: """ :keyword name: Name of the resource. Required. :paramtype name: str @@ -602,8 +611,8 @@ def __init__( subscription_policies: Optional["_models.SubscriptionPolicies"] = None, authorization_source: Optional[str] = None, managed_by_tenants: Optional[List["_models.ManagedByTenant"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscription_policies: The subscription policies. :paramtype subscription_policies: @@ -647,7 +656,7 @@ class SubscriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs): + def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of subscriptions. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.Subscription] @@ -688,7 +697,7 @@ class SubscriptionPolicies(_serialization.Model): "spending_limit": {"key": "spendingLimit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location_placement_id = None @@ -740,7 +749,7 @@ class TenantIdDescription(_serialization.Model): "domains": {"key": "domains", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -772,7 +781,9 @@ class TenantListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs): + def __init__( + self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of tenants. :paramtype value: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py index 9059f82f4615..8b6229e6184d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py @@ -582,8 +582,8 @@ def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -808,7 +808,7 @@ def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json index 54b7b4ba2e23..6d250876b583 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -39,19 +40,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -96,13 +103,13 @@ "check_resource_name" : { "sync": { "signature": "def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" }, "async": { "coroutine": true, "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py index d0a6b9a75eff..ff060185a4b4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py @@ -86,5 +86,5 @@ def __enter__(self) -> "SubscriptionClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_vendor.py index c99c26601b42..5c8832ef4c92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py index 0a6be7b2946a..ba8f8411dbfe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py @@ -87,5 +87,5 @@ async def __aenter__(self) -> "SubscriptionClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py index cd6903727580..34f7bb4b9c0c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py @@ -435,8 +435,8 @@ async def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -661,7 +661,7 @@ async def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py index 867ad4850f24..8a09c702070d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -36,7 +36,7 @@ class AvailabilityZonePeers(_serialization.Model): "peers": {"key": "peers", "type": "[Peers]"}, } - def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): + def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: Any) -> None: """ :keyword peers: Details of shared availability zone. :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Peers] @@ -47,7 +47,8 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): class CheckResourceNameResult(_serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start + with a reserved word. :ivar name: Name of Resource. :vartype name: str @@ -71,8 +72,8 @@ def __init__( name: Optional[str] = None, type: Optional[str] = None, status: Optional[Union[str, "_models.ResourceNameStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of Resource. :paramtype name: str @@ -103,7 +104,9 @@ class CheckZonePeersRequest(_serialization.Model): "subscription_ids": {"key": "subscriptionIds", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword location: The Microsoft location. :paramtype location: str @@ -144,8 +147,8 @@ def __init__( *, location: Optional[str] = None, availability_zone_peers: Optional[List["_models.AvailabilityZonePeers"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the subscription. :paramtype location: str @@ -180,7 +183,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -201,7 +204,7 @@ class ErrorDefinition(_serialization.Model): "code": {"key": "code", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, code: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: Description of the error. :paramtype message: str @@ -247,7 +250,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -258,7 +261,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDetail @@ -268,7 +272,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDetail @@ -288,7 +292,7 @@ class ErrorResponseAutoGenerated(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: The error details. :paramtype error: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDefinition @@ -334,7 +338,7 @@ class Location(_serialization.Model): "metadata": {"key": "metadata", "type": "LocationMetadata"}, } - def __init__(self, *, metadata: Optional["_models.LocationMetadata"] = None, **kwargs): + def __init__(self, *, metadata: Optional["_models.LocationMetadata"] = None, **kwargs: Any) -> None: """ :keyword metadata: Metadata of the location, such as lat/long, paired region, and others. :paramtype metadata: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.LocationMetadata @@ -359,7 +363,7 @@ class LocationListResult(_serialization.Model): "value": {"key": "value", "type": "[Location]"}, } - def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of locations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Location] @@ -410,7 +414,7 @@ class LocationMetadata(_serialization.Model): "paired_region": {"key": "pairedRegion", "type": "[PairedRegion]"}, } - def __init__(self, *, paired_region: Optional[List["_models.PairedRegion"]] = None, **kwargs): + def __init__(self, *, paired_region: Optional[List["_models.PairedRegion"]] = None, **kwargs: Any) -> None: """ :keyword paired_region: The regions paired to this region. :paramtype paired_region: @@ -443,7 +447,7 @@ class ManagedByTenant(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.tenant_id = None @@ -463,7 +467,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -502,8 +508,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -522,7 +528,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Operation] @@ -535,7 +542,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Operation] @@ -573,7 +582,7 @@ class PairedRegion(_serialization.Model): "subscription_id": {"key": "subscriptionId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -602,7 +611,7 @@ class Peers(_serialization.Model): "availability_zone": {"key": "availabilityZone", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subscription_id = None @@ -630,7 +639,7 @@ class ResourceName(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: str, **kwargs): + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: """ :keyword name: Name of the resource. Required. :paramtype name: str @@ -700,8 +709,8 @@ def __init__( authorization_source: Optional[str] = None, managed_by_tenants: Optional[List["_models.ManagedByTenant"]] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscription_policies: The subscription policies. :paramtype subscription_policies: @@ -748,7 +757,7 @@ class SubscriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs): + def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of subscriptions. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Subscription] @@ -789,7 +798,7 @@ class SubscriptionPolicies(_serialization.Model): "spending_limit": {"key": "spendingLimit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location_placement_id = None @@ -841,7 +850,7 @@ class TenantIdDescription(_serialization.Model): "domains": {"key": "domains", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -873,7 +882,9 @@ class TenantListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs): + def __init__( + self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of tenants. :paramtype value: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py index 671a1a99ea3b..3e21fe45e453 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py @@ -582,8 +582,8 @@ def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -808,7 +808,7 @@ def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json index 8fab0f01ac42..188eeb8d6aac 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -39,19 +40,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -95,13 +102,13 @@ "check_resource_name" : { "sync": { "signature": "def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" }, "async": { "coroutine": true, "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[Union[_models.ResourceName, IO]] = None,\n **kwargs: Any\n) -\u003e _models.CheckResourceNameResult:\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a model type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type. Is either a ResourceName type or a IO type. Default value is None.\n:type resource_name_definition:\n ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.CheckResourceNameResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "resource_name_definition, **kwargs" } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py index a831af295e49..c447fbaa8dd3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py @@ -83,5 +83,5 @@ def __enter__(self) -> "SubscriptionClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_vendor.py index c99c26601b42..5c8832ef4c92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py index 91e4a510b0da..1aa9f16bc089 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py @@ -84,5 +84,5 @@ async def __aenter__(self) -> "SubscriptionClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py index 124a9d4b020b..cebc394f3248 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py @@ -341,8 +341,8 @@ async def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -567,7 +567,7 @@ async def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py index 1c7432734601..34d55974c6f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -36,7 +36,7 @@ class AvailabilityZonePeers(_serialization.Model): "peers": {"key": "peers", "type": "[Peers]"}, } - def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): + def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: Any) -> None: """ :keyword peers: Details of shared availability zone. :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.Peers] @@ -47,7 +47,8 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs): class CheckResourceNameResult(_serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start + with a reserved word. :ivar name: Name of Resource. :vartype name: str @@ -71,8 +72,8 @@ def __init__( name: Optional[str] = None, type: Optional[str] = None, status: Optional[Union[str, "_models.ResourceNameStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of Resource. :paramtype name: str @@ -103,7 +104,9 @@ class CheckZonePeersRequest(_serialization.Model): "subscription_ids": {"key": "subscriptionIds", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, location: Optional[str] = None, subscription_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword location: The Microsoft location. :paramtype location: str @@ -144,8 +147,8 @@ def __init__( *, location: Optional[str] = None, availability_zone_peers: Optional[List["_models.AvailabilityZonePeers"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: the location of the subscription. :paramtype location: str @@ -180,7 +183,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -221,7 +224,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -232,7 +235,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -265,7 +269,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -276,7 +280,8 @@ def __init__(self, **kwargs): class ErrorResponseAutoGenerated(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ErrorDetail @@ -286,7 +291,7 @@ class ErrorResponseAutoGenerated(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ErrorDetail @@ -336,7 +341,7 @@ class Location(_serialization.Model): "metadata": {"key": "metadata", "type": "LocationMetadata"}, } - def __init__(self, *, metadata: Optional["_models.LocationMetadata"] = None, **kwargs): + def __init__(self, *, metadata: Optional["_models.LocationMetadata"] = None, **kwargs: Any) -> None: """ :keyword metadata: Metadata of the location, such as lat/long, paired region, and others. :paramtype metadata: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.LocationMetadata @@ -362,7 +367,7 @@ class LocationListResult(_serialization.Model): "value": {"key": "value", "type": "[Location]"}, } - def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Location"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of locations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.Location] @@ -418,7 +423,7 @@ class LocationMetadata(_serialization.Model): "home_location": {"key": "homeLocation", "type": "str"}, } - def __init__(self, *, paired_region: Optional[List["_models.PairedRegion"]] = None, **kwargs): + def __init__(self, *, paired_region: Optional[List["_models.PairedRegion"]] = None, **kwargs: Any) -> None: """ :keyword paired_region: The regions paired to this region. :paramtype paired_region: @@ -452,7 +457,7 @@ class ManagedByTenant(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.tenant_id = None @@ -472,7 +477,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -511,8 +518,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Resources. :paramtype provider: str @@ -531,7 +538,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of Microsoft.Resources operations. :vartype value: list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.Operation] @@ -544,7 +552,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Microsoft.Resources operations. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.Operation] @@ -582,7 +592,7 @@ class PairedRegion(_serialization.Model): "subscription_id": {"key": "subscriptionId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -611,7 +621,7 @@ class Peers(_serialization.Model): "availability_zone": {"key": "availabilityZone", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.subscription_id = None @@ -639,7 +649,7 @@ class ResourceName(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: str, **kwargs): + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: """ :keyword name: Name of the resource. Required. :paramtype name: str @@ -709,8 +719,8 @@ def __init__( authorization_source: Optional[str] = None, managed_by_tenants: Optional[List["_models.ManagedByTenant"]] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscription_policies: The subscription policies. :paramtype subscription_policies: @@ -757,7 +767,7 @@ class SubscriptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs): + def __init__(self, *, next_link: str, value: Optional[List["_models.Subscription"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of subscriptions. :paramtype value: list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.Subscription] @@ -798,7 +808,7 @@ class SubscriptionPolicies(_serialization.Model): "spending_limit": {"key": "spendingLimit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location_placement_id = None @@ -863,7 +873,7 @@ class TenantIdDescription(_serialization.Model): "tenant_branding_logo_url": {"key": "tenantBrandingLogoUrl", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -898,7 +908,9 @@ class TenantListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs): + def __init__( + self, *, next_link: str, value: Optional[List["_models.TenantIdDescription"]] = None, **kwargs: Any + ) -> None: """ :keyword value: An array of tenants. :paramtype value: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py index f3f2eaa157f8..2cf4ae985a72 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py @@ -476,8 +476,8 @@ def check_zone_peers( :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param parameters: Parameters for checking zone peers. Is either a model type or a IO type. - Required. + :param parameters: Parameters for checking zone peers. Is either a CheckZonePeersRequest type + or a IO type. Required. :type parameters: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.CheckZonePeersRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -702,7 +702,7 @@ def check_resource_name( does not start with a reserved word. :param resource_name_definition: Resource object with values for resource name and resource - type. Is either a model type or a IO type. Default value is None. + type. Is either a ResourceName type or a IO type. Default value is None. :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.ResourceName or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_serialization.py index 2c170e28dbca..25467dfc00bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +438,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +547,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +563,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +655,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1191,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py index d057768162b3..cc7d4ddc58e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json index e73a608c39f1..4755b99641a0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription Id which forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py index 319cb421cd20..2205e0bcc6aa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py @@ -94,5 +94,5 @@ def __enter__(self) -> "TemplateSpecsClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py index 74a310ffbf3e..5955e6a19afb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py @@ -94,5 +94,5 @@ async def __aenter__(self) -> "TemplateSpecsClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_operations.py index f74f5c0e2373..f35f219c172d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_operations.py @@ -141,8 +141,8 @@ async def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -293,8 +293,8 @@ async def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -801,7 +801,7 @@ async def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -963,7 +963,7 @@ async def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersionUpdateModel or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py index 2a162b7abde1..1e88496ab713 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py @@ -54,7 +54,7 @@ class AzureResourceBase(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -84,7 +84,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -92,7 +92,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -126,7 +127,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -175,8 +176,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -265,8 +266,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, display_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec. It cannot be changed after Template Spec creation. It must be one of the supported Azure locations. Required. @@ -313,7 +314,7 @@ class TemplateSpecArtifact(_serialization.Model): _subtype_map = {"kind": {"template": "TemplateSpecTemplateArtifact"}} - def __init__(self, *, path: str, **kwargs): + def __init__(self, *, path: str, **kwargs: Any) -> None: """ :keyword path: A filesystem safe relative path of the artifact. Required. :paramtype path: str @@ -335,7 +336,7 @@ class TemplateSpecsError(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -366,7 +367,7 @@ class TemplateSpecsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Specs. :paramtype value: @@ -403,7 +404,7 @@ class TemplateSpecTemplateArtifact(TemplateSpecArtifact): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, path: str, template: JSON, **kwargs): + def __init__(self, *, path: str, template: JSON, **kwargs: Any) -> None: """ :keyword path: A filesystem safe relative path of the artifact. Required. :paramtype path: str @@ -448,7 +449,7 @@ class TemplateSpecUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -516,8 +517,8 @@ def __init__( artifacts: Optional[List["_models.TemplateSpecArtifact"]] = None, description: Optional[str] = None, template: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec Version. It must match the location of the parent Template Spec. Required. @@ -565,7 +566,7 @@ class TemplateSpecVersionInfo(_serialization.Model): "time_modified": {"key": "timeModified", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.description = None @@ -594,7 +595,7 @@ class TemplateSpecVersionsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Spec versions. :paramtype value: @@ -638,7 +639,7 @@ class TemplateSpecVersionUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py index 2d5ab2574dfe..faf8ef7d0c65 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py @@ -22,12 +22,12 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TemplateSpecArtifactKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of artifact.""" - #: The artifact represents an embedded Azure Resource Manager template. TEMPLATE = "template" + """The artifact represents an embedded Azure Resource Manager template.""" class TemplateSpecExpandKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TemplateSpecExpandKind.""" - #: Includes version information with the Template Spec. VERSIONS = "versions" + """Includes version information with the Template Spec.""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_operations.py index 6c00f0e4c5e5..ef2e1218ac19 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_operations.py @@ -585,8 +585,8 @@ def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -737,8 +737,8 @@ def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1245,7 +1245,7 @@ def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1407,7 +1407,7 @@ def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersionUpdateModel or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_metadata.json index 35e32b01efe0..6af34a0d9f67 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription Id which forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_template_specs_client.py index 7e6dc6fad7ba..b852fd8d5635 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_template_specs_client.py @@ -94,5 +94,5 @@ def __enter__(self) -> "TemplateSpecsClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/_template_specs_client.py index e06a4eb6ac27..0c6892b113d4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/_template_specs_client.py @@ -94,5 +94,5 @@ async def __aenter__(self) -> "TemplateSpecsClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/operations/_operations.py index f93d6c48df47..9ab44b2abd52 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/aio/operations/_operations.py @@ -141,8 +141,8 @@ async def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -293,8 +293,8 @@ async def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -801,7 +801,7 @@ async def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -963,7 +963,7 @@ async def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpecVersionUpdateModel or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_models_py3.py index 62800ef74ac7..8f9ceb105df2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_models_py3.py @@ -54,7 +54,7 @@ class AzureResourceBase(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -84,7 +84,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -92,7 +92,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -126,7 +127,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -137,7 +138,8 @@ def __init__(self, **kwargs): class LinkedTemplateArtifact(_serialization.Model): - """Represents a Template Spec artifact containing an embedded Azure Resource Manager template for use as a linked template. + """Represents a Template Spec artifact containing an embedded Azure Resource Manager template for + use as a linked template. All required parameters must be populated in order to send to Azure. @@ -157,7 +159,7 @@ class LinkedTemplateArtifact(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, path: str, template: JSON, **kwargs): + def __init__(self, *, path: str, template: JSON, **kwargs: Any) -> None: """ :keyword path: A filesystem safe relative path of the artifact. Required. :paramtype path: str @@ -208,8 +210,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -303,8 +305,8 @@ def __init__( description: Optional[str] = None, display_name: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec. It cannot be changed after Template Spec creation. It must be one of the supported Azure locations. Required. @@ -340,7 +342,7 @@ class TemplateSpecsError(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -371,7 +373,7 @@ class TemplateSpecsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Specs. :paramtype value: @@ -415,7 +417,7 @@ class TemplateSpecUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -492,8 +494,8 @@ def __init__( metadata: Optional[JSON] = None, main_template: Optional[JSON] = None, ui_form_definition: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec Version. It must match the location of the parent Template Spec. Required. @@ -548,7 +550,7 @@ class TemplateSpecVersionInfo(_serialization.Model): "time_modified": {"key": "timeModified", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.description = None @@ -577,7 +579,7 @@ class TemplateSpecVersionsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Spec versions. :paramtype value: @@ -621,7 +623,7 @@ class TemplateSpecVersionUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_template_specs_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_template_specs_client_enums.py index ec0f6b2bc39a..4286981967d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_template_specs_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/models/_template_specs_client_enums.py @@ -22,5 +22,5 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TemplateSpecExpandKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TemplateSpecExpandKind.""" - #: Includes version information with the Template Spec. VERSIONS = "versions" + """Includes version information with the Template Spec.""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/operations/_operations.py index 1c87e3d196d4..b5d59fb29bec 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/operations/_operations.py @@ -585,8 +585,8 @@ def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -737,8 +737,8 @@ def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1245,7 +1245,7 @@ def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1407,7 +1407,7 @@ def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2021_03_01_preview.models.TemplateSpecVersionUpdateModel or IO diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_metadata.json index 7d884e0a44a7..480e0cfd5b63 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription Id which forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_template_specs_client.py index 07ad0b193a45..246492cad170 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_template_specs_client.py @@ -94,5 +94,5 @@ def __enter__(self) -> "TemplateSpecsClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/_template_specs_client.py index c9393a78ec66..9cccebca81fb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/_template_specs_client.py @@ -94,5 +94,5 @@ async def __aenter__(self) -> "TemplateSpecsClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/operations/_operations.py index 1eb19d282ce4..b26a632948f1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/aio/operations/_operations.py @@ -141,8 +141,8 @@ async def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -290,8 +290,8 @@ async def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -788,7 +788,7 @@ async def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -948,7 +948,7 @@ async def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpecVersionUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_models_py3.py index 341eee03d586..2a59458ab805 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_models_py3.py @@ -54,7 +54,7 @@ class AzureResourceBase(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -84,7 +84,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -92,7 +92,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -125,7 +126,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -136,7 +137,8 @@ def __init__(self, **kwargs): class LinkedTemplateArtifact(_serialization.Model): - """Represents a Template Spec artifact containing an embedded Azure Resource Manager template for use as a linked template. + """Represents a Template Spec artifact containing an embedded Azure Resource Manager template for + use as a linked template. All required parameters must be populated in order to send to Azure. @@ -156,7 +158,7 @@ class LinkedTemplateArtifact(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, path: str, template: JSON, **kwargs): + def __init__(self, *, path: str, template: JSON, **kwargs: Any) -> None: """ :keyword path: A filesystem safe relative path of the artifact. Required. :paramtype path: str @@ -207,8 +209,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -302,8 +304,8 @@ def __init__( description: Optional[str] = None, display_name: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec. It cannot be changed after Template Spec creation. It must be one of the supported Azure locations. Required. @@ -339,7 +341,7 @@ class TemplateSpecsError(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -369,7 +371,7 @@ class TemplateSpecsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Specs. :paramtype value: list[~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpec] @@ -412,7 +414,7 @@ class TemplateSpecUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -489,8 +491,8 @@ def __init__( metadata: Optional[JSON] = None, main_template: Optional[JSON] = None, ui_form_definition: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec Version. It must match the location of the parent Template Spec. Required. @@ -545,7 +547,7 @@ class TemplateSpecVersionInfo(_serialization.Model): "time_modified": {"key": "timeModified", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.description = None @@ -573,7 +575,7 @@ class TemplateSpecVersionsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Spec versions. :paramtype value: @@ -617,7 +619,7 @@ class TemplateSpecVersionUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_template_specs_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_template_specs_client_enums.py index ec0f6b2bc39a..4286981967d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_template_specs_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/models/_template_specs_client_enums.py @@ -22,5 +22,5 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TemplateSpecExpandKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TemplateSpecExpandKind.""" - #: Includes version information with the Template Spec. VERSIONS = "versions" + """Includes version information with the Template Spec.""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/operations/_operations.py index 693f432ef39a..099eda53387b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/operations/_operations.py @@ -563,8 +563,8 @@ def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -712,8 +712,8 @@ def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1210,7 +1210,7 @@ def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1370,7 +1370,7 @@ def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2021_05_01.models.TemplateSpecVersionUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_metadata.json index d2284499d9b8..af0362cafc6d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Subscription Id which forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -51,19 +53,22 @@ "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_template_specs_client.py index bc69bf82c704..cc945556f494 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_template_specs_client.py @@ -94,5 +94,5 @@ def __enter__(self) -> "TemplateSpecsClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_vendor.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_vendor.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py index 81b10eb08899..7d1c07827a02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "22.0.0" +VERSION = "22.1.0b1" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/_template_specs_client.py index f45735d47ee1..b3bd9c4de252 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/_template_specs_client.py @@ -94,5 +94,5 @@ async def __aenter__(self) -> "TemplateSpecsClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/operations/_operations.py index 9f62f5c28b93..41f4ccb524a1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/aio/operations/_operations.py @@ -145,8 +145,8 @@ async def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,8 +294,8 @@ async def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -944,7 +944,7 @@ async def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1104,7 +1104,7 @@ async def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpecVersionUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_models_py3.py index 705ec094f5d0..763ebd485315 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_models_py3.py @@ -54,7 +54,7 @@ class AzureResourceBase(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -84,7 +84,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -92,7 +92,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -125,7 +126,7 @@ class ErrorResponse(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -136,7 +137,8 @@ def __init__(self, **kwargs): class LinkedTemplateArtifact(_serialization.Model): - """Represents a Template Spec artifact containing an embedded Azure Resource Manager template for use as a linked template. + """Represents a Template Spec artifact containing an embedded Azure Resource Manager template for + use as a linked template. All required parameters must be populated in order to send to Azure. @@ -156,7 +158,7 @@ class LinkedTemplateArtifact(_serialization.Model): "template": {"key": "template", "type": "object"}, } - def __init__(self, *, path: str, template: JSON, **kwargs): + def __init__(self, *, path: str, template: JSON, **kwargs: Any) -> None: """ :keyword path: A filesystem safe relative path of the artifact. Required. :paramtype path: str @@ -207,8 +209,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -302,8 +304,8 @@ def __init__( description: Optional[str] = None, display_name: Optional[str] = None, metadata: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec. It cannot be changed after Template Spec creation. It must be one of the supported Azure locations. Required. @@ -339,7 +341,7 @@ class TemplateSpecsError(_serialization.Model): "error": {"key": "error", "type": "ErrorResponse"}, } - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: """ :keyword error: Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -369,7 +371,7 @@ class TemplateSpecsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpec"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Specs. :paramtype value: list[~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpec] @@ -412,7 +414,7 @@ class TemplateSpecUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -489,8 +491,8 @@ def __init__( metadata: Optional[JSON] = None, main_template: Optional[JSON] = None, ui_form_definition: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The location of the Template Spec Version. It must match the location of the parent Template Spec. Required. @@ -545,7 +547,7 @@ class TemplateSpecVersionInfo(_serialization.Model): "time_modified": {"key": "timeModified", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.description = None @@ -573,7 +575,7 @@ class TemplateSpecVersionsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TemplateSpecVersion"]] = None, **kwargs: Any) -> None: """ :keyword value: An array of Template Spec versions. :paramtype value: @@ -617,7 +619,7 @@ class TemplateSpecVersionUpdateModel(AzureResourceBase): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_template_specs_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_template_specs_client_enums.py index ec0f6b2bc39a..4286981967d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_template_specs_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/models/_template_specs_client_enums.py @@ -22,5 +22,5 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TemplateSpecExpandKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TemplateSpecExpandKind.""" - #: Includes version information with the Template Spec. VERSIONS = "versions" + """Includes version information with the Template Spec.""" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/operations/_operations.py index 0a1845676a22..31c394cc6d2a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/operations/_operations.py @@ -681,8 +681,8 @@ def create_or_update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. Is either a model type or a IO - type. Required. + :param template_spec: Template Spec supplied to the operation. Is either a TemplateSpec type or + a IO type. Required. :type template_spec: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpec or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -830,8 +830,8 @@ def update( :type resource_group_name: str :param template_spec_name: Name of the Template Spec. Required. :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. Is either a model - type or a IO type. Default value is None. + :param template_spec: Template Spec resource with the tags to be updated. Is either a + TemplateSpecUpdateModel type or a IO type. Default value is None. :type template_spec: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpecUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1480,7 +1480,7 @@ def create_or_update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_model: Template Spec Version supplied to the operation. Is either - a model type or a IO type. Required. + a TemplateSpecVersion type or a IO type. Required. :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpecVersion or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1640,7 +1640,7 @@ def update( :param template_spec_version: The version of the Template Spec. Required. :type template_spec_version: str :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. Is either a model type or a IO type. Default value is None. + updated. Is either a TemplateSpecVersionUpdateModel type or a IO type. Default value is None. :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2022_02_01.models.TemplateSpecVersionUpdateModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/calculate_template_hash.py b/sdk/resources/azure-mgmt-resource/generated_samples/calculate_template_hash.py new file mode 100644 index 000000000000..822f80d7469d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/calculate_template_hash.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python calculate_template_hash.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.deployments.calculate_template_hash( + template={ + "$schema": "http://schemas.management.azure.com/deploymentTemplate?api-version=2014-04-01-preview", + "contentVersion": "1.0.0.0", + "outputs": {"string": {"type": "string", "value": "myvalue"}}, + "parameters": {"string": {"type": "string"}}, + "resources": [], + "variables": { + "array": [1, 2, 3, 4], + "bool": True, + "int": 42, + "object": {"object": {"location": "West US", "vmSize": "Large"}}, + "string": "string", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/CalculateTemplateHash.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/create_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/create_resource_group.py new file mode 100644 index 000000000000..f879b73b2928 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/create_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python create_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.resource_groups.create_or_update( + resource_group_name="my-resource-group", + parameters={"location": "eastus"}, + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/CreateResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/delete_tags_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/delete_tags_resource.py new file mode 100644 index 000000000000..a8031610fef0 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/delete_tags_resource.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python delete_tags_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tags.begin_delete_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/DeleteTagsResource.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/delete_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/delete_tags_subscription.py new file mode 100644 index 000000000000..04d6c9ac38c3 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/delete_tags_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python delete_tags_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tags.begin_delete_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000", + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/DeleteTagsSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/export_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/export_resource_group.py new file mode 100644 index 000000000000..b9ce73521553 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/export_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python export_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.resource_groups.begin_export_template( + resource_group_name="my-resource-group", + parameters={"options": "IncludeParameterDefaultValue,IncludeComments", "resources": ["*"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/ExportResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/export_resource_group_with_filtering.py b/sdk/resources/azure-mgmt-resource/generated_samples/export_resource_group_with_filtering.py new file mode 100644 index 000000000000..94df698ee512 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/export_resource_group_with_filtering.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python export_resource_group_with_filtering.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.resource_groups.begin_export_template( + resource_group_name="my-resource-group", + parameters={ + "options": "SkipResourceNameParameterization", + "resources": [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/My.RP/myResourceType/myFirstResource" + ], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/ExportResourceGroupWithFiltering.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/force_delete_vms_and_vmss_in_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/force_delete_vms_and_vmss_in_resource_group.py new file mode 100644 index 000000000000..ffe30c88b5ac --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/force_delete_vms_and_vmss_in_resource_group.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python force_delete_vms_and_vmss_in_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.resource_groups.begin_delete( + resource_group_name="my-resource-group", + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/ForceDeleteVMsAndVMSSInResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/force_delete_vms_in_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/force_delete_vms_in_resource_group.py new file mode 100644 index 000000000000..275c56aa09c1 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/force_delete_vms_in_resource_group.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python force_delete_vms_in_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.resource_groups.begin_delete( + resource_group_name="my-resource-group", + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/ForceDeleteVMsInResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/get_named_provider_at_tenant.py b/sdk/resources/azure-mgmt-resource/generated_samples/get_named_provider_at_tenant.py new file mode 100644 index 000000000000..560383e15397 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/get_named_provider_at_tenant.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python get_named_provider_at_tenant.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.providers.get_at_tenant_scope( + resource_provider_namespace="Microsoft.Storage", + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetNamedProviderAtTenant.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/get_provider.py b/sdk/resources/azure-mgmt-resource/generated_samples/get_provider.py new file mode 100644 index 000000000000..796a0e87dfae --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/get_provider.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python get_provider.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.providers.get( + resource_provider_namespace="Microsoft.TestRP1", + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetProvider.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/get_provider_permissions.py b/sdk/resources/azure-mgmt-resource/generated_samples/get_provider_permissions.py new file mode 100644 index 000000000000..7c41e914b2a5 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/get_provider_permissions.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python get_provider_permissions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.providers.provider_permissions( + resource_provider_namespace="Microsoft.TestRP", + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetProviderPermissions.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/get_provider_resource_types.py b/sdk/resources/azure-mgmt-resource/generated_samples/get_provider_resource_types.py new file mode 100644 index 000000000000..84363839539c --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/get_provider_resource_types.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python get_provider_resource_types.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.provider_resource_types.list( + resource_provider_namespace="Microsoft.TestRP", + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetProviderResourceTypes.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/get_providers.py b/sdk/resources/azure-mgmt-resource/generated_samples/get_providers.py new file mode 100644 index 000000000000..d47beb09f906 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/get_providers.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python get_providers.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.providers.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetProviders.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/get_tags_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/get_tags_resource.py new file mode 100644 index 000000000000..9a4c30387dd5 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/get_tags_resource.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python get_tags_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tags.get_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetTagsResource.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/get_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/get_tags_subscription.py new file mode 100644 index 000000000000..b6d5553a8bab --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/get_tags_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python get_tags_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tags.get_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetTagsSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/patch_tags_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/patch_tags_resource.py new file mode 100644 index 000000000000..4d59de5197ed --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/patch_tags_resource.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python patch_tags_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tags.begin_update_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + parameters={ + "operation": "Replace", + "properties": {"tags": {"tagKey1": "tag-value-1", "tagKey2": "tag-value-2"}}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PatchTagsResource.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/patch_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/patch_tags_subscription.py new file mode 100644 index 000000000000..e0535f0aece6 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/patch_tags_subscription.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python patch_tags_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tags.begin_update_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000", + parameters={ + "operation": "Replace", + "properties": {"tags": {"tagKey1": "tag-value-1", "tagKey2": "tag-value-2"}}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PatchTagsSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_management_group.py similarity index 57% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py rename to sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_management_group.py index c44241a68e44..74fb523ddeea 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_management_group.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.resource import ResourceManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-resource # USAGE - python cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py + python post_deployment_what_if_on_management_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,23 +24,26 @@ def main(): - client = CosmosDBManagementClient( + client = ResourceManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.mongo_db_resources.begin_mongo_db_container_retrieve_throughput_distribution( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - collection_name="collectionName", - retrieve_throughput_parameters={ - "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + response = client.deployments.begin_what_if_at_management_group_scope( + group_id="myManagementGruop", + deployment_name="exampleDeploymentName", + parameters={ + "location": "eastus", + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + }, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBMongoDBCollectionRetrieveThroughputDistribution.json +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PostDeploymentWhatIfOnManagementGroup.json if __name__ == "__main__": main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_resource_group.py new file mode 100644 index 000000000000..e37244cabab8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_resource_group.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python post_deployment_what_if_on_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000001", + ) + + response = client.deployments.begin_what_if( + resource_group_name="my-resource-group", + deployment_name="my-deployment", + parameters={ + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PostDeploymentWhatIfOnResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_subscription.py new file mode 100644 index 000000000000..a1ed561d7e48 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_subscription.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python post_deployment_what_if_on_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000001", + ) + + response = client.deployments.begin_what_if_at_subscription_scope( + deployment_name="my-deployment", + parameters={ + "location": "westus", + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PostDeploymentWhatIfOnSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_retrieve_throughput_distribution.py b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_tenant.py similarity index 59% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_retrieve_throughput_distribution.py rename to sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_tenant.py index 033068f7d943..730fb62ec30a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_retrieve_throughput_distribution.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/post_deployment_what_if_on_tenant.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.resource import ResourceManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-resource # USAGE - python cosmos_db_sql_database_retrieve_throughput_distribution.py + python post_deployment_what_if_on_tenant.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,22 +24,25 @@ def main(): - client = CosmosDBManagementClient( + client = ResourceManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sql_resources.begin_sql_database_retrieve_throughput_distribution( - resource_group_name="rg1", - account_name="ddb1", - database_name="databaseName", - retrieve_throughput_parameters={ - "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + response = client.deployments.begin_what_if_at_tenant_scope( + deployment_name="exampleDeploymentName", + parameters={ + "location": "eastus", + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + }, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlDatabaseRetrieveThroughputDistribution.json +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PostDeploymentWhatIfOnTenant.json if __name__ == "__main__": main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_management_group.py new file mode 100644 index 000000000000..da5a21aae79e --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_management_group.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_deployment_at_management_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.deployments.begin_create_or_update_at_management_group_scope( + group_id="my-management-group-id", + deployment_name="my-deployment", + parameters={ + "location": "eastus", + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentAtManagementGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_scope.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_scope.py new file mode 100644 index 000000000000..df8e5016b243 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_scope.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_deployment_at_scope.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.deployments.begin_create_or_update_at_scope( + scope="providers/Microsoft.Management/managementGroups/my-management-group-id", + deployment_name="my-deployment", + parameters={ + "location": "eastus", + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + }, + "tags": {"tagKey1": "tag-value-1", "tagKey2": "tag-value-2"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentAtScope.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_tenant.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_tenant.py new file mode 100644 index 000000000000..73a479675733 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_at_tenant.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_deployment_at_tenant.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.deployments.begin_create_or_update_at_tenant_scope( + deployment_name="tenant-dep01", + parameters={ + "location": "eastus", + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + }, + "tags": {"tagKey1": "tag-value-1", "tagKey2": "tag-value-2"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentAtTenant.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_resource_group.py new file mode 100644 index 000000000000..cd6590d8ae85 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_resource_group.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_deployment_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000001", + ) + + response = client.deployments.begin_create_or_update( + resource_group_name="my-resource-group", + deployment_name="my-deployment", + parameters={ + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": { + "queryString": "sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d", + "uri": "https://example.com/exampleTemplate.json", + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_resource_group_template_specs_with_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_resource_group_template_specs_with_id.py new file mode 100644 index 000000000000..a9dff4494a92 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_resource_group_template_specs_with_id.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_deployment_resource_group_template_specs_with_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000001", + ) + + response = client.deployments.begin_create_or_update( + resource_group_name="my-resource-group", + deployment_name="my-deployment", + parameters={ + "properties": { + "mode": "Incremental", + "parameters": {}, + "templateLink": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1" + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentResourceGroupTemplateSpecsWithId.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_subscription_template_specs_with_id.py similarity index 55% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py rename to sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_subscription_template_specs_with_id.py index 9256e6689f41..22ff1ee44075 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_subscription_template_specs_with_id.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.resource import ResourceManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-resource # USAGE - python cosmos_db_cassandra_view_create_update.py + python put_deployment_subscription_template_specs_with_id.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,30 +24,27 @@ def main(): - client = CosmosDBManagementClient( + client = ResourceManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000001", ) - response = client.cassandra_resources.begin_create_update_cassandra_view( - resource_group_name="rg1", - account_name="ddb1", - keyspace_name="keyspacename", - view_name="viewname", - create_update_cassandra_view_parameters={ + response = client.deployments.begin_create_or_update_at_subscription_scope( + deployment_name="my-deployment", + parameters={ + "location": "eastus", "properties": { - "options": {}, - "resource": { - "id": "viewname", - "viewDefinition": "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY (columnc, columna)", + "mode": "Incremental", + "parameters": {}, + "templateLink": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1" }, }, - "tags": {}, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewCreateUpdate.json +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentSubscriptionTemplateSpecsWithId.json if __name__ == "__main__": main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_with_on_error_deployment_last_successful.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_with_on_error_deployment_last_successful.py new file mode 100644 index 000000000000..a4d1f6b595bd --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_with_on_error_deployment_last_successful.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_deployment_with_on_error_deployment_last_successful.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.begin_create_or_update( + resource_group_name="my-resource-group", + deployment_name="my-deployment", + parameters={ + "properties": { + "mode": "Complete", + "onErrorDeployment": {"type": "LastSuccessful"}, + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentWithOnErrorDeploymentLastSuccessful.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_with_on_error_deployment_specific_deployment.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_with_on_error_deployment_specific_deployment.py new file mode 100644 index 000000000000..c87724545dc8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_deployment_with_on_error_deployment_specific_deployment.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_deployment_with_on_error_deployment_specific_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.begin_create_or_update( + resource_group_name="my-resource-group", + deployment_name="my-deployment", + parameters={ + "properties": { + "mode": "Complete", + "onErrorDeployment": {"deploymentName": "name-of-deployment-to-use", "type": "SpecificDeployment"}, + "parameters": {}, + "templateLink": {"uri": "https://example.com/exampleTemplate.json"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutDeploymentWithOnErrorDeploymentSpecificDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_manual_throughput.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_tags_resource.py similarity index 63% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_manual_throughput.py rename to sdk/resources/azure-mgmt-resource/generated_samples/put_tags_resource.py index 570bbc9dfd82..996dc5621e6f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_manual_throughput.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_tags_resource.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.resource import ResourceManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-resource # USAGE - python cosmos_db_cassandra_view_migrate_to_manual_throughput.py + python put_tags_resource.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,20 +24,18 @@ def main(): - client = CosmosDBManagementClient( + client = ResourceManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.cassandra_resources.begin_migrate_cassandra_view_to_manual_throughput( - resource_group_name="rg1", - account_name="ddb1", - keyspace_name="keyspacename", - view_name="viewname", + response = client.tags.begin_create_or_update_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + parameters={"properties": {"tags": {"tagKey1": "tag-value-1", "tagKey2": "tag-value-2"}}}, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBCassandraViewMigrateToManualThroughput.json +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutTagsResource.json if __name__ == "__main__": main() diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/put_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/put_tags_subscription.py new file mode 100644 index 000000000000..367b5ebfec58 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/generated_samples/put_tags_subscription.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.resource import ResourceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resource +# USAGE + python put_tags_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ResourceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tags.begin_create_or_update_at_scope( + scope="subscriptions/00000000-0000-0000-0000-000000000000", + parameters={"properties": {"tags": {"tagKey1": "tag-value-1", "tagKey2": "tag-value-2"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/PutTagsSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_deployment_scripts.pyTestMgmtResourceDeploymentScripttest_deployment_scripts.json b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_deployment_scripts.pyTestMgmtResourceDeploymentScripttest_deployment_scripts.json index efe73eb045fd..a57abc654a08 100644 --- a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_deployment_scripts.pyTestMgmtResourceDeploymentScripttest_deployment_scripts.json +++ b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_deployment_scripts.pyTestMgmtResourceDeploymentScripttest_deployment_scripts.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:47:03 GMT", + "Date": "Thu, 16 Feb 2023 04:59:13 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14167.14 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:47:03 GMT", + "Date": "Thu, 16 Feb 2023 04:59:13 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14167.14 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "7e86d66a-4d1c-492f-99ba-6227adb242d0", + "client-request-id": "67df8423-8b2d-462f-a6d7-af166c6ef45d", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.20.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "7e86d66a-4d1c-492f-99ba-6227adb242d0", + "client-request-id": "67df8423-8b2d-462f-a6d7-af166c6ef45d", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:47:03 GMT", + "Date": "Thu, 16 Feb 2023 04:59:13 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14167.14 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "591", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "identity": { @@ -243,20 +243,20 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0?api-version=2019-10-01-preview", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83?api-version=2019-10-01-preview", "Cache-Control": "no-cache", "Content-Length": "1497", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:47:05 GMT", + "Date": "Thu, 16 Feb 2023 04:59:16 GMT", "Expires": "-1", "Pragma": "no-cache", "Retry-After": "17", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9093c190-ddc7-4299-bb7c-63450cdd5acd", + "x-ms-correlation-request-id": "0b52656b-7f4f-45e0-9842-b739e070c716", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "EASTUS2:20221118T034706Z:9093c190-ddc7-4299-bb7c-63450cdd5acd" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T045916Z:0b52656b-7f4f-45e0-9842-b739e070c716" }, "ResponseBody": { "kind": "AzurePowerShell", @@ -265,8 +265,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": { - "principalId": "d5beada6-4235-454f-b463-da1c2fde2160", - "clientId": "24ed5522-25f3-4138-882d-0deac9d2050c" + "principalId": "2d22129b-c0db-4647-8d1a-a6cbd4a43c83", + "clientId": "ce69882b-254e-42b6-9f38-ad61be5180d9" } } }, @@ -285,10 +285,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-11-18T03:47:04.7246875Z", + "createdAt": "2023-02-16T04:59:15.0840019Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-11-18T03:47:04.7246875Z" + "lastModifiedAt": "2023-02-16T04:59:15.0840019Z" }, "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Resources/deploymentScripts/scripttest", "type": "Microsoft.Resources/deploymentScripts", @@ -296,13 +296,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0?api-version=2019-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83?api-version=2019-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -310,7 +310,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:47:06 GMT", + "Date": "Thu, 16 Feb 2023 04:59:16 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -318,24 +318,24 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "13a05a5e-adf6-4a97-87b9-7a1047fa9d8a", + "x-ms-correlation-request-id": "9d52d311-8370-42e7-9af8-44eb77d7ef0d", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "EASTUS2:20221118T034706Z:13a05a5e-adf6-4a97-87b9-7a1047fa9d8a" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T045917Z:9d52d311-8370-42e7-9af8-44eb77d7ef0d" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0", - "name": "41cb44d0-b810-49fa-9edb-8f4a7888edb0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83", + "name": "b8814831-33a3-422f-b5d6-072f98624f83", "status": "creating" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0?api-version=2019-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83?api-version=2019-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -343,7 +343,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:47:36 GMT", + "Date": "Thu, 16 Feb 2023 04:59:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -351,28 +351,28 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0bf13764-daa9-400a-9219-19e52f59c61c", + "x-ms-correlation-request-id": "745a25e7-33c0-4d96-9831-edbafa95be1d", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "EASTUS2:20221118T034736Z:0bf13764-daa9-400a-9219-19e52f59c61c" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T045947Z:745a25e7-33c0-4d96-9831-edbafa95be1d" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0", - "name": "41cb44d0-b810-49fa-9edb-8f4a7888edb0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83", + "name": "b8814831-33a3-422f-b5d6-072f98624f83", "status": "provisioningResources", "error": { "code": "DeploymentScriptOperationFailed", - "message": "The client \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 with object id \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." + "message": "The client \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 with object id \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0?api-version=2019-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83?api-version=2019-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -380,7 +380,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:06 GMT", + "Date": "Thu, 16 Feb 2023 05:00:16 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -388,28 +388,28 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ba33e5a5-8492-401f-a8b2-af2f7b0c3e4f", + "x-ms-correlation-request-id": "000256b5-b3f6-4f4d-8440-7d8b60d0b00b", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "EASTUS2:20221118T034807Z:ba33e5a5-8492-401f-a8b2-af2f7b0c3e4f" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050017Z:000256b5-b3f6-4f4d-8440-7d8b60d0b00b" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0", - "name": "41cb44d0-b810-49fa-9edb-8f4a7888edb0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83", + "name": "b8814831-33a3-422f-b5d6-072f98624f83", "status": "provisioningResources", "error": { "code": "DeploymentScriptOperationFailed", - "message": "The client \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 with object id \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." + "message": "The client \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 with object id \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0?api-version=2019-10-01-preview", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83?api-version=2019-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -417,7 +417,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:37 GMT", + "Date": "Thu, 16 Feb 2023 05:00:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -425,17 +425,17 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9b76b9be-7990-4ca4-96fe-5c0aef0ed3cb", + "x-ms-correlation-request-id": "d4006424-02a7-4568-985b-c4bbf92e2de2", "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "EASTUS2:20221118T034837Z:9b76b9be-7990-4ca4-96fe-5c0aef0ed3cb" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050047Z:d4006424-02a7-4568-985b-c4bbf92e2de2" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/41cb44d0-b810-49fa-9edb-8f4a7888edb0", - "name": "41cb44d0-b810-49fa-9edb-8f4a7888edb0", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/locations/westus/deploymentScriptOperationResults/b8814831-33a3-422f-b5d6-072f98624f83", + "name": "b8814831-33a3-422f-b5d6-072f98624f83", "status": "failed", "error": { "code": "DeploymentScriptOperationFailed", - "message": "The client \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 with object id \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." + "message": "The client \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 with object id \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." } } }, @@ -448,7 +448,7 @@ "Connection": "keep-alive", "Content-Length": "28", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "tags": { @@ -460,7 +460,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:38 GMT", + "Date": "Thu, 16 Feb 2023 05:00:47 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -468,9 +468,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "cc4f4961-8f19-47da-a3ab-177e4bec08fc", + "x-ms-correlation-request-id": "86546306-e475-4217-aa0e-22cedc8ec7c1", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "EASTUS2:20221118T034838Z:cc4f4961-8f19-47da-a3ab-177e4bec08fc" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050048Z:86546306-e475-4217-aa0e-22cedc8ec7c1" }, "ResponseBody": { "kind": "AzurePowerShell", @@ -479,8 +479,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": { - "principalId": "d5beada6-4235-454f-b463-da1c2fde2160", - "clientId": "24ed5522-25f3-4138-882d-0deac9d2050c" + "principalId": "2d22129b-c0db-4647-8d1a-a6cbd4a43c83", + "clientId": "ce69882b-254e-42b6-9f38-ad61be5180d9" } } }, @@ -497,12 +497,12 @@ "timeout": "PT30M", "containerSettings": {}, "status": { - "startTime": "2022-11-18T03:48:19.6213662Z", - "endTime": "2022-11-18T03:48:20.0594991Z", - "expirationTime": "2022-11-19T05:48:20.0594991Z", + "startTime": "2023-02-16T05:00:30.84991Z", + "endTime": "2023-02-16T05:00:31.5551943Z", + "expirationTime": "2023-02-17T07:00:31.5551943Z", "error": { "code": "DeploymentScriptOperationFailed", - "message": "The client \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 with object id \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." + "message": "The client \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 with object id \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." } }, "cleanupPreference": "Always" @@ -510,10 +510,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-11-18T03:47:04.7246875Z", + "createdAt": "2023-02-16T04:59:15.0840019Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-11-18T03:48:37.4027226Z" + "lastModifiedAt": "2023-02-16T05:00:47.6774812Z" }, "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Resources/deploymentScripts/scripttest", "type": "Microsoft.Resources/deploymentScripts", @@ -527,7 +527,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -535,7 +535,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:38 GMT", + "Date": "Thu, 16 Feb 2023 05:00:47 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -543,9 +543,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "86b6a83d-2549-49ed-9e70-d65a718764ab", + "x-ms-correlation-request-id": "9b8c5446-d730-4c9b-a378-36e59d4c7007", "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "EASTUS2:20221118T034838Z:86b6a83d-2549-49ed-9e70-d65a718764ab" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050048Z:9b8c5446-d730-4c9b-a378-36e59d4c7007" }, "ResponseBody": { "kind": "AzurePowerShell", @@ -554,8 +554,8 @@ "tenantId": "00000000-0000-0000-0000-000000000000", "userAssignedIdentities": { "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": { - "principalId": "d5beada6-4235-454f-b463-da1c2fde2160", - "clientId": "24ed5522-25f3-4138-882d-0deac9d2050c" + "principalId": "2d22129b-c0db-4647-8d1a-a6cbd4a43c83", + "clientId": "ce69882b-254e-42b6-9f38-ad61be5180d9" } } }, @@ -572,12 +572,12 @@ "timeout": "PT30M", "containerSettings": {}, "status": { - "startTime": "2022-11-18T03:48:19.6213662Z", - "endTime": "2022-11-18T03:48:20.0594991Z", - "expirationTime": "2022-11-19T05:48:20.0594991Z", + "startTime": "2023-02-16T05:00:30.84991Z", + "endTime": "2023-02-16T05:00:31.5551943Z", + "expirationTime": "2023-02-17T07:00:31.5551943Z", "error": { "code": "DeploymentScriptOperationFailed", - "message": "The client \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 with object id \u0027d5beada6-4235-454f-b463-da1c2fde2160\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." + "message": "The client \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 with object id \u00272d22129b-c0db-4647-8d1a-a6cbd4a43c83\u0027 does not have authorization to perform action \u0027Microsoft.Resources/subscriptions/providers/read\u0027 over scope \u0027/subscriptions/00000000-0000-0000-0000-000000000000\u0027 or the scope is invalid. If access was recently granted, please refresh your credentials." } }, "cleanupPreference": "Always" @@ -585,10 +585,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-11-18T03:47:04.7246875Z", + "createdAt": "2023-02-16T04:59:15.0840019Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-11-18T03:48:37.4027226Z" + "lastModifiedAt": "2023-02-16T05:00:47.6774812Z" }, "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Resources/deploymentScripts/scripttest", "type": "Microsoft.Resources/deploymentScripts", @@ -602,7 +602,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -610,7 +610,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:38 GMT", + "Date": "Thu, 16 Feb 2023 05:00:47 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -618,9 +618,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8de70d34-0244-47ae-b49e-154b69af0bef", + "x-ms-correlation-request-id": "4e069c27-1626-4243-9e3e-036d94e0c271", "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "EASTUS2:20221118T034838Z:8de70d34-0244-47ae-b49e-154b69af0bef" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050048Z:4e069c27-1626-4243-9e3e-036d94e0c271" }, "ResponseBody": { "properties": {}, @@ -636,7 +636,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -644,7 +644,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:38 GMT", + "Date": "Thu, 16 Feb 2023 05:00:48 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -652,9 +652,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8af0e0e1-5940-4e55-8ecb-ebb6aef22c65", + "x-ms-correlation-request-id": "22f9dc7f-b65f-43a9-bb03-054f50b17409", "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "EASTUS2:20221118T034839Z:8af0e0e1-5940-4e55-8ecb-ebb6aef22c65" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050049Z:22f9dc7f-b65f-43a9-bb03-054f50b17409" }, "ResponseBody": { "value": [ @@ -675,22 +675,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Fri, 18 Nov 2022 03:48:44 GMT", + "Date": "Thu, 16 Feb 2023 05:00:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5531a5cc-5df2-4ea0-a968-fac00e020670", + "x-ms-correlation-request-id": "038cd6b3-e1b7-47e8-973d-e6a669ff3022", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "EASTUS2:20221118T034845Z:5531a5cc-5df2-4ea0-a968-fac00e020670" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050055Z:038cd6b3-e1b7-47e8-973d-e6a669ff3022" }, "ResponseBody": null } diff --git a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_links.pyTestMgmtResourceLinkstest_links.json b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_links.pyTestMgmtResourceLinkstest_links.json index 53c814904836..bbe4220715a3 100644 --- a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_links.pyTestMgmtResourceLinkstest_links.json +++ b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_links.pyTestMgmtResourceLinkstest_links.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:48 GMT", + "Date": "Thu, 16 Feb 2023 05:00:58 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14167.14 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:48 GMT", + "Date": "Thu, 16 Feb 2023 05:00:58 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.16 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "9c5c1fed-d9e1-417f-969b-fe5fe0866af3", + "client-request-id": "820894cb-1e51-4516-8515-85eaf27185e1", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.20.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "9c5c1fed-d9e1-417f-969b-fe5fe0866af3", + "client-request-id": "820894cb-1e51-4516-8515-85eaf27185e1", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:48 GMT", + "Date": "Thu, 16 Feb 2023 05:00:58 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14167.14 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "22", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "westus" @@ -231,7 +231,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:50 GMT", + "Date": "Thu, 16 Feb 2023 05:01:00 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -242,10 +242,10 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ea7508c7-efc7-4623-8c49-3458e4394454", + "x-ms-correlation-request-id": "8e03c90f-ff2c-4bf7-81d7-948729deaf96", "x-ms-ratelimit-remaining-resource": "Microsoft.Compute/PutVM3Min;239,Microsoft.Compute/PutVM30Min;1199", "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "EASTUS2:20221118T034850Z:ea7508c7-efc7-4623-8c49-3458e4394454" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050100Z:8e03c90f-ff2c-4bf7-81d7-948729deaf96" }, "ResponseBody": { "name": "pytestavset48042a90", @@ -270,7 +270,7 @@ "Connection": "keep-alive", "Content-Length": "22", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "westus" @@ -280,7 +280,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:51 GMT", + "Date": "Thu, 16 Feb 2023 05:01:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -291,10 +291,10 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0044e546-48dc-47e4-b08e-c0e8ed3e27a6", + "x-ms-correlation-request-id": "607fd8e8-b4c1-41e2-9f3f-96500605b5c9", "x-ms-ratelimit-remaining-resource": "Microsoft.Compute/PutVM3Min;238,Microsoft.Compute/PutVM30Min;1198", "x-ms-ratelimit-remaining-subscription-writes": "1196", - "x-ms-routing-request-id": "EASTUS2:20221118T034851Z:0044e546-48dc-47e4-b08e-c0e8ed3e27a6" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050101Z:607fd8e8-b4c1-41e2-9f3f-96500605b5c9" }, "ResponseBody": { "name": "pytestavset48042a902", @@ -317,7 +317,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -327,12 +327,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:51 GMT", + "Date": "Thu, 16 Feb 2023 05:01:01 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14167.14 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -411,7 +411,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -421,12 +421,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:51 GMT", + "Date": "Thu, 16 Feb 2023 05:01:01 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14167.14 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -482,28 +482,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "acfb87f9-75fe-44b6-bbe6-e7fb941604ea", + "client-request-id": "a5aca988-49a1-44c4-ad26-8f9ae2281520", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.20.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "acfb87f9-75fe-44b6-bbe6-e7fb941604ea", + "client-request-id": "a5aca988-49a1-44c4-ad26-8f9ae2281520", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:51 GMT", + "Date": "Thu, 16 Feb 2023 05:01:01 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -511,7 +511,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14167.14 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -531,7 +531,7 @@ "Connection": "keep-alive", "Content-Length": "197", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -544,14 +544,14 @@ "Cache-Control": "no-cache", "Content-Length": "587", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:48:51 GMT", + "Date": "Thu, 16 Feb 2023 05:01:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "71ebf087-fffd-4f50-9e16-7ec8ca74a7d4", + "x-ms-correlation-request-id": "b4622b7b-02b0-4080-94dd-dd00491c1a53", "x-ms-ratelimit-remaining-subscription-writes": "1195", - "x-ms-routing-request-id": "EASTUS2:20221118T034852Z:71ebf087-fffd-4f50-9e16-7ec8ca74a7d4" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050101Z:b4622b7b-02b0-4080-94dd-dd00491c1a53" }, "ResponseBody": { "properties": { @@ -571,7 +571,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -579,7 +579,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:01 GMT", + "Date": "Thu, 16 Feb 2023 05:01:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", @@ -589,9 +589,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5ea9debc-9f18-4ee6-98b0-f1bd5b91571e", + "x-ms-correlation-request-id": "b19bd047-f37d-4c92-b3ce-827ca7b661e4", "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "EASTUS2:20221118T034902Z:5ea9debc-9f18-4ee6-98b0-f1bd5b91571e" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050111Z:b19bd047-f37d-4c92-b3ce-827ca7b661e4" }, "ResponseBody": { "properties": { @@ -611,7 +611,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -619,7 +619,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:01 GMT", + "Date": "Thu, 16 Feb 2023 05:01:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", @@ -629,9 +629,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d047680b-2bf1-414c-828a-338b2f9d4bf0", + "x-ms-correlation-request-id": "402fce2d-c9bf-4a5c-9f82-983031857079", "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-routing-request-id": "EASTUS2:20221118T034902Z:d047680b-2bf1-414c-828a-338b2f9d4bf0" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050111Z:402fce2d-c9bf-4a5c-9f82-983031857079" }, "ResponseBody": { "value": [ @@ -655,7 +655,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -663,7 +663,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:01 GMT", + "Date": "Thu, 16 Feb 2023 05:01:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", @@ -673,9 +673,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1f756ed2-2c6a-4dd7-8f72-ee9eeefef72d", + "x-ms-correlation-request-id": "6841d8b9-325c-4f5c-b44f-50c26b7b0622", "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-routing-request-id": "EASTUS2:20221118T034902Z:1f756ed2-2c6a-4dd7-8f72-ee9eeefef72d" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050111Z:6841d8b9-325c-4f5c-b44f-50c26b7b0622" }, "ResponseBody": { "value": [ @@ -699,7 +699,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -707,7 +707,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:01 GMT", + "Date": "Thu, 16 Feb 2023 05:01:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", @@ -717,9 +717,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "92da33e4-4bb6-4781-8162-52c4852b1934", + "x-ms-correlation-request-id": "d568c37e-a573-494c-9aa9-d6b704514954", "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-routing-request-id": "EASTUS2:20221118T034902Z:92da33e4-4bb6-4781-8162-52c4852b1934" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050112Z:d568c37e-a573-494c-9aa9-d6b704514954" }, "ResponseBody": { "value": [ @@ -744,21 +744,21 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Fri, 18 Nov 2022 03:49:02 GMT", + "Date": "Thu, 16 Feb 2023 05:01:12 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c6cd5c49-96fd-4c2c-aea9-1723b2f7228d", + "x-ms-correlation-request-id": "b64f63e0-7059-4ef7-bb04-dc2bae646182", "x-ms-ratelimit-remaining-subscription-deletes": "14998", - "x-ms-routing-request-id": "EASTUS2:20221118T034902Z:c6cd5c49-96fd-4c2c-aea9-1723b2f7228d" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050112Z:b64f63e0-7059-4ef7-bb04-dc2bae646182" }, "ResponseBody": null } diff --git a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_subscriptions.json b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_subscriptions.json index ade4d639f544..145168187049 100644 --- a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_subscriptions.json +++ b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_subscriptions.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:03 GMT", + "Date": "Thu, 16 Feb 2023 05:01:13 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14167.14 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:03 GMT", + "Date": "Thu, 16 Feb 2023 05:01:13 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.16 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "e0437a1a-47a0-44cc-9866-0326ffdde212", + "client-request-id": "a255bb92-7e3b-44ab-a840-3f7e93a201e5", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.20.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "e0437a1a-47a0-44cc-9866-0326ffdde212", + "client-request-id": "a255bb92-7e3b-44ab-a840-3f7e93a201e5", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:03 GMT", + "Date": "Thu, 16 Feb 2023 05:01:13 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14167.14 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -219,7 +219,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -228,15 +228,15 @@ "Content-Encoding": "gzip", "Content-Length": "869", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:04 GMT", + "Date": "Thu, 16 Feb 2023 05:01:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fb9dd114-9605-444c-b3b1-214471435f05", + "x-ms-correlation-request-id": "b5ce2422-5181-4e5f-9b12-6e51c589e055", "x-ms-ratelimit-remaining-tenant-reads": "11999", - "x-ms-routing-request-id": "EASTUS2:20221118T034904Z:fb9dd114-9605-444c-b3b1-214471435f05" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050114Z:b5ce2422-5181-4e5f-9b12-6e51c589e055" }, "ResponseBody": { "value": [ @@ -282,24 +282,24 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", - "Content-Length": "30703", + "Content-Length": "32134", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:04 GMT", + "Date": "Thu, 16 Feb 2023 05:01:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6793767f-2554-4c04-9740-e23f781bb720", + "x-ms-correlation-request-id": "be7517de-05e4-40c2-86f4-cab4aab63e72", "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-routing-request-id": "EASTUS2:20221118T034905Z:6793767f-2554-4c04-9740-e23f781bb720" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050114Z:be7517de-05e4-40c2-86f4-cab4aab63e72" }, "ResponseBody": { "value": [ @@ -565,8 +565,8 @@ "regionType": "Physical", "regionCategory": "Recommended", "geographyGroup": "Africa", - "longitude": "28.218370", - "latitude": "-25.731340", + "longitude": "28.21837", + "latitude": "-25.73134", "physicalLocation": "Johannesburg", "pairedRegion": [ { @@ -649,7 +649,7 @@ "regionType": "Physical", "regionCategory": "Recommended", "geographyGroup": "Asia Pacific", - "longitude": "126.9780", + "longitude": "126.978", "latitude": "37.5665", "physicalLocation": "Seoul", "pairedRegion": [ @@ -691,7 +691,7 @@ "regionType": "Physical", "regionCategory": "Recommended", "geographyGroup": "Europe", - "longitude": "2.3730", + "longitude": "2.373", "latitude": "46.3772", "physicalLocation": "Paris", "pairedRegion": [ @@ -807,6 +807,27 @@ ] } }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/centraluseuap", + "name": "centraluseuap", + "type": "Region", + "displayName": "Central US EUAP", + "regionalDisplayName": "(US) Central US EUAP", + "metadata": { + "regionType": "Physical", + "regionCategory": "Recommended", + "geographyGroup": "US", + "longitude": "-93.6208", + "latitude": "41.5908", + "physicalLocation": "", + "pairedRegion": [ + { + "name": "eastus2euap", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2euap" + } + ] + } + }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2euap", "name": "eastus2euap", @@ -819,6 +840,7 @@ "geographyGroup": "US", "longitude": "-78.3889", "latitude": "36.6681", + "physicalLocation": "", "pairedRegion": [ { "name": "centraluseuap", @@ -840,12 +862,7 @@ "longitude": "51.439327", "latitude": "25.551462", "physicalLocation": "Doha", - "pairedRegion": [ - { - "name": "westeurope", - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/westeurope" - } - ] + "pairedRegion": [] } }, { @@ -1176,6 +1193,52 @@ "geographyGroup": "Asia Pacific" } }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazilus", + "name": "brazilus", + "type": "Region", + "displayName": "Brazil US", + "regionalDisplayName": "(South America) Brazil US", + "metadata": { + "regionType": "Physical", + "regionCategory": "Other", + "geographyGroup": "South America", + "longitude": "0", + "latitude": "0", + "physicalLocation": "", + "pairedRegion": [ + { + "name": "Brazil Southeast", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/Brazil Southeast" + }, + { + "name": "brazilus", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazilus" + } + ] + } + }, + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastusstg", + "name": "eastusstg", + "type": "Region", + "displayName": "East US STG", + "regionalDisplayName": "(US) East US STG", + "metadata": { + "regionType": "Physical", + "regionCategory": "Other", + "geographyGroup": "US", + "longitude": "-79.8164", + "latitude": "37.3719", + "physicalLocation": "Virginia", + "pairedRegion": [ + { + "name": "southcentralusstg", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/southcentralusstg" + } + ] + } + }, { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/northcentralus", "name": "northcentralus", @@ -1240,21 +1303,22 @@ } }, { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/centraluseuap", - "name": "centraluseuap", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/devfabric", + "name": "devfabric", "type": "Region", - "displayName": "Central US EUAP", - "regionalDisplayName": "(US) Central US EUAP", + "displayName": "devfabric", + "regionalDisplayName": "(US) devfabric", "metadata": { "regionType": "Physical", "regionCategory": "Other", "geographyGroup": "US", - "longitude": "-93.6208", - "latitude": "41.5908", + "longitude": "0", + "latitude": "0", + "physicalLocation": "DevFabric", "pairedRegion": [ { - "name": "eastus2euap", - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2euap" + "name": "devfabric", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/devfabric" } ] } @@ -1270,7 +1334,7 @@ "regionCategory": "Other", "geographyGroup": "US", "longitude": "-110.234", - "latitude": "40.890", + "latitude": "40.89", "physicalLocation": "Wyoming", "pairedRegion": [ { @@ -1647,7 +1711,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1656,15 +1720,15 @@ "Content-Encoding": "gzip", "Content-Length": "417", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:04 GMT", + "Date": "Thu, 16 Feb 2023 05:01:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5bf3415f-66d2-42a3-b70f-7a23f1824d0c", + "x-ms-correlation-request-id": "87804de8-3fc0-4768-a16b-ff2cb3d0e439", "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-routing-request-id": "EASTUS2:20221118T034905Z:5bf3415f-66d2-42a3-b70f-7a23f1824d0c" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050114Z:87804de8-3fc0-4768-a16b-ff2cb3d0e439" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000", diff --git a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_tenants.json b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_tenants.json index 30099d4ddc69..4cfcc0b76a59 100644 --- a/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_tenants.json +++ b/sdk/resources/azure-mgmt-resource/tests/recordings/test_mgmt_resource_subscriptions.pyTestMgmtResourceSubscriptionstest_tenants.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:04 GMT", + "Date": "Thu, 16 Feb 2023 05:01:14 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14167.14 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:05 GMT", + "Date": "Thu, 16 Feb 2023 05:01:14 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.16 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "aeaf0f21-831b-48a3-8b80-ec6cec620977", + "client-request-id": "f07b9ec4-5891-4ab9-b098-d59530e8a6d7", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.20.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "aeaf0f21-831b-48a3-8b80-ec6cec620977", + "client-request-id": "f07b9ec4-5891-4ab9-b098-d59530e8a6d7", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:05 GMT", + "Date": "Thu, 16 Feb 2023 05:01:14 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14167.14 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -219,7 +219,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-resource/22.1.0b1 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -228,15 +228,15 @@ "Content-Encoding": "gzip", "Content-Length": "140", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 18 Nov 2022 03:49:05 GMT", + "Date": "Thu, 16 Feb 2023 05:01:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "283ed273-e9af-41db-bcf4-f1494e0f9b90", + "x-ms-correlation-request-id": "ca480e99-6e52-4e83-b124-9aed1a54245f", "x-ms-ratelimit-remaining-tenant-reads": "11998", - "x-ms-routing-request-id": "EASTUS2:20221118T034905Z:283ed273-e9af-41db-bcf4-f1494e0f9b90" + "x-ms-routing-request-id": "NORTHCENTRALUS:20230216T050115Z:ca480e99-6e52-4e83-b124-9aed1a54245f" }, "ResponseBody": { "value": [ diff --git a/sdk/schemaregistry/azure-schemaregistry-avroencoder/pyproject.toml b/sdk/schemaregistry/azure-schemaregistry-avroencoder/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/schemaregistry/azure-schemaregistry-avroencoder/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/schemaregistry/azure-schemaregistry/pyproject.toml b/sdk/schemaregistry/azure-schemaregistry/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/schemaregistry/azure-schemaregistry/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/search/azure-mgmt-search/CHANGELOG.md b/sdk/search/azure-mgmt-search/CHANGELOG.md index 838b2a8b5233..be9537c1b298 100644 --- a/sdk/search/azure-mgmt-search/CHANGELOG.md +++ b/sdk/search/azure-mgmt-search/CHANGELOG.md @@ -1,5 +1,18 @@ # Release History +## 9.0.0 (2023-02-15) + +### Features Added + + - Model PrivateEndpointConnectionProperties has a new parameter group_id + - Model PrivateEndpointConnectionProperties has a new parameter provisioning_state + - Model SearchService has a new parameter auth_options + - Model SearchService has a new parameter disable_local_auth + - Model SearchService has a new parameter encryption_with_cmk + - Model SearchServiceUpdate has a new parameter auth_options + - Model SearchServiceUpdate has a new parameter disable_local_auth + - Model SearchServiceUpdate has a new parameter encryption_with_cmk + ## 9.0.0b1 (2022-10-28) ### Features Added diff --git a/sdk/search/azure-mgmt-search/README.md b/sdk/search/azure-mgmt-search/README.md index 66cda7593efd..44da800f36cb 100644 --- a/sdk/search/azure-mgmt-search/README.md +++ b/sdk/search/azure-mgmt-search/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/search) -Code samples for this package can be found at [Search Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/search) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-search +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = SearchManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Search Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/search/azure-mgmt-search/_meta.json b/sdk/search/azure-mgmt-search/_meta.json index afd8a5d75bc0..fd859248c293 100644 --- a/sdk/search/azure-mgmt-search/_meta.json +++ b/sdk/search/azure-mgmt-search/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e82a24def11ffc98cc263884f9f1742c99f2df5e", + "commit": "33a7dbc1743fdacb8e2259011a035154a98cad66", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/search/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2020-03 --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/search/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/search/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py index c723fbb9a1ce..a55bcb4e1a94 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py index e82d60ebe730..24b8b8361c5c 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py @@ -36,14 +36,14 @@ class SearchManagementClientConfiguration(Configuration): # pylint: disable=too :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SearchManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-03-13") # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", "2022-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-search/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py index 0097be44af47..eb9cd7e82f9e 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import SearchManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -22,6 +22,7 @@ PrivateLinkResourcesOperations, QueryKeysOperations, ServicesOperations, + SharedPrivateLinkResourcesOperations, ) if TYPE_CHECKING: @@ -29,7 +30,7 @@ from azure.core.credentials import TokenCredential -class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword +class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Client that can be used to manage Azure Cognitive Search services and API keys. :ivar operations: Operations operations @@ -45,6 +46,9 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.search.operations.PrivateEndpointConnectionsOperations + :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations + :vartype shared_private_link_resources: + azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can @@ -52,7 +56,7 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -71,7 +75,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -85,6 +89,9 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -108,15 +115,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SearchManagementClient + def __enter__(self) -> "SearchManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py index 7c1dedb5133d..f17c068e833e 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -606,13 +630,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py index 6dddc002d43d..b77ac9246082 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.0.0b1" +VERSION = "9.0.0" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py index b953852f8cc0..6baf3d114500 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py index fdbafb341183..b5ae1b276b46 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py @@ -36,14 +36,14 @@ class SearchManagementClientConfiguration(Configuration): # pylint: disable=too :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SearchManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-03-13") # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", "2022-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py index 2dd2fe22d5af..5f316590f2a2 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SearchManagementClientConfiguration from .operations import ( @@ -22,6 +22,7 @@ PrivateLinkResourcesOperations, QueryKeysOperations, ServicesOperations, + SharedPrivateLinkResourcesOperations, ) if TYPE_CHECKING: @@ -29,7 +30,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword +class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Client that can be used to manage Azure Cognitive Search services and API keys. :ivar operations: Operations operations @@ -46,6 +47,9 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations + :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations + :vartype shared_private_link_resources: + azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can @@ -53,7 +57,7 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -72,7 +76,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,6 +90,9 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py index 5f7e85a6a72d..b7967f39c207 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py @@ -12,9 +12,10 @@ from ._services_operations import ServicesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -24,6 +25,7 @@ "ServicesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", + "SharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py index 417849bb6c4e..17bd173e0489 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py @@ -90,10 +90,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -110,9 +110,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,7 +129,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys" + } @distributed_trace_async async def regenerate( @@ -171,10 +173,10 @@ async def regenerate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -192,9 +194,9 @@ async def regenerate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -211,4 +213,6 @@ async def regenerate( return deserialized - regenerate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}"} # type: ignore + regenerate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py index b722e2e982a4..59426db1af96 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py @@ -69,10 +69,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +92,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -108,7 +108,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +116,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -135,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Search/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Search/operations"} diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py index 3fb1f83e5f60..56690086adeb 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py @@ -75,7 +75,7 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -113,7 +113,7 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -149,7 +149,7 @@ async def update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -185,11 +185,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -217,9 +217,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -236,7 +236,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def get( @@ -247,7 +249,7 @@ async def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the details of the private endpoint connection to the Search service in the given resource + """Gets the details of the private endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You @@ -278,10 +280,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -299,9 +301,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -318,7 +320,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def delete( @@ -329,7 +333,7 @@ async def delete( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - """Disconnects the private endpoint connection and deletes it from the Search service. + """Disconnects the private endpoint connection and deletes it from the search service. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -359,10 +363,10 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -380,9 +384,9 @@ async def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -401,7 +405,9 @@ async def delete( return deserialized - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def list_by_service( @@ -432,10 +438,10 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -462,7 +468,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -478,7 +484,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -486,13 +492,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -505,4 +511,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py index a8b86c64aab2..34b0497a4323 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py @@ -84,10 +84,10 @@ def list_supported( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesResult] + ) + cls: ClsType[_models.PrivateLinkResourcesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +130,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +138,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,4 +157,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_supported.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources"} # type: ignore + list_supported.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py index 26d5e288a6a8..1c6a76a45b83 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py @@ -71,7 +71,7 @@ async def create( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.QueryKey: - """Generates a new query key for the specified Search service. You can create up to 50 query keys + """Generates a new query key for the specified search service. You can create up to 50 query keys per service. :param resource_group_name: The name of the resource group within the current subscription. You @@ -101,10 +101,10 @@ async def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryKey] + ) + cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -122,9 +122,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -141,7 +141,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}" + } @distributed_trace def list_by_search_service( @@ -170,10 +172,10 @@ def list_by_search_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListQueryKeysResult] + ) + cls: ClsType[_models.ListQueryKeysResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -200,7 +202,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -216,7 +218,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -224,13 +226,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListQueryKeysResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -243,7 +245,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_search_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys"} # type: ignore + list_by_search_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -285,10 +289,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -306,9 +310,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,4 +325,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py index cd7835aab771..da2d6969fc55 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py @@ -87,11 +87,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -118,9 +118,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -137,11 +137,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("SearchService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload async def begin_create_or_update( @@ -154,7 +156,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -167,7 +169,7 @@ async def begin_create_or_update( of the service URI (https://:code:``.search.windows.net). You cannot change the service name after the service is created. Required. :type search_service_name: str - :param service: The definition of the Search service to create or update. Required. + :param service: The definition of the search service to create or update. Required. :type service: ~azure.mgmt.search.models.SearchService :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -200,7 +202,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -213,7 +215,7 @@ async def begin_create_or_update( of the service URI (https://:code:``.search.windows.net). You cannot change the service name after the service is created. Required. :type search_service_name: str - :param service: The definition of the Search service to create or update. Required. + :param service: The definition of the search service to create or update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -244,7 +246,7 @@ async def begin_create_or_update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -257,7 +259,7 @@ async def begin_create_or_update( of the service URI (https://:code:``.search.windows.net). You cannot change the service name after the service is created. Required. :type search_service_name: str - :param service: The definition of the Search service to create or update. Is either a model + :param service: The definition of the search service to create or update. Is either a model type or a IO type. Required. :type service: ~azure.mgmt.search.models.SearchService or IO :param search_management_request_options: Parameter group. Default value is None. @@ -282,16 +284,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, search_service_name=search_service_name, service=service, @@ -312,7 +314,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -324,30 +326,32 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload async def update( self, resource_group_name: str, search_service_name: str, - service: _models.SearchService, + service: _models.SearchServiceUpdate, search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str :param search_service_name: The name of the Azure Cognitive Search service to update. Required. :type search_service_name: str - :param service: The definition of the Search service to update. Required. - :type service: ~azure.mgmt.search.models.SearchService + :param service: The definition of the search service to update. Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -371,14 +375,14 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str :param search_service_name: The name of the Azure Cognitive Search service to update. Required. :type search_service_name: str - :param service: The definition of the Search service to update. Required. + :param service: The definition of the search service to update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -397,20 +401,20 @@ async def update( self, resource_group_name: str, search_service_name: str, - service: Union[_models.SearchService, IO], + service: Union[_models.SearchServiceUpdate, IO], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str :param search_service_name: The name of the Azure Cognitive Search service to update. Required. :type search_service_name: str - :param service: The definition of the Search service to update. Is either a model type or a IO + :param service: The definition of the search service to update. Is either a model type or a IO type. Required. - :type service: ~azure.mgmt.search.models.SearchService or IO + :type service: ~azure.mgmt.search.models.SearchServiceUpdate or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -433,11 +437,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -448,7 +452,7 @@ async def update( if isinstance(service, (IO, bytes)): _content = service else: - _json = self._serialize.body(service, "SearchService") + _json = self._serialize.body(service, "SearchServiceUpdate") request = build_update_request( resource_group_name=resource_group_name, @@ -464,9 +468,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -483,7 +487,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace_async async def get( @@ -493,7 +499,7 @@ async def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Gets the Search service with the given name in the given resource group. + """Gets the search service with the given name in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -520,10 +526,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -540,9 +546,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -559,7 +565,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -569,7 +577,7 @@ async def delete( # pylint: disable=inconsistent-return-statements search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> None: - """Deletes a Search service in the given resource group, along with its associated resources. + """Deletes a search service in the given resource group, along with its associated resources. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -596,10 +604,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -616,9 +624,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +639,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def list_by_resource_group( @@ -656,10 +666,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -685,7 +695,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -701,7 +711,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -709,13 +719,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -728,7 +738,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices" + } @distributed_trace def list_by_subscription( @@ -747,10 +759,10 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -775,7 +787,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -791,7 +803,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -799,13 +811,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -818,7 +830,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} @distributed_trace_async async def check_name_availability( @@ -827,11 +839,11 @@ async def check_name_availability( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Checks whether or not the given Search service name is available for use. Search service names + """Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://:code:``.search.windows.net). - :param name: The Search service name to validate. Search service names must only contain + :param name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :type name: str @@ -858,12 +870,12 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - type = kwargs.pop("type", "searchServices") # type: Literal["searchServices"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + type: Literal["searchServices"] = kwargs.pop("type", "searchServices") + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -882,9 +894,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -901,4 +913,6 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py similarity index 53% rename from sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py rename to sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py index 99e6c5ecadf2..e5fc3dc81da5 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py @@ -31,15 +31,12 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._php_workloads_operations import ( +from ...operations._shared_private_link_resources_operations import ( build_create_or_update_request, build_delete_request, build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, + build_list_by_service_request, ) -from .._vendor import WorkloadsClientMixinABC if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -49,14 +46,14 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class PhpWorkloadsOperations: +class SharedPrivateLinkResourcesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s - :attr:`php_workloads` attribute. + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`shared_private_link_resources` attribute. """ models = _models @@ -68,253 +65,15 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PhpWorkloadResource"]: - """Lists PHP workload resources for a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PhpWorkloadResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PhpWorkloadResourceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PhpWorkloadResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/phpWorkloads" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PhpWorkloadResource"]: - """Lists PHP workload resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PhpWorkloadResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PhpWorkloadResourceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PhpWorkloadResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads" - } - - @distributed_trace_async - async def get(self, resource_group_name: str, php_workload_name: str, **kwargs: Any) -> _models.PhpWorkloadResource: - """Gets the PHP workload resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" - } - async def _create_or_update_initial( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: Union[_models.PhpWorkloadResource, IO], + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> _models.PhpWorkloadResource: + ) -> Optional[_models.SharedPrivateLinkResource]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -326,24 +85,29 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.SharedPrivateLinkResource]] = kwargs.pop("cls", None) + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id content_type = content_type or "application/json" _json = None _content = None - if isinstance(php_workload_resource, (IO, bytes)): - _content = php_workload_resource + if isinstance(shared_private_link_resource, (IO, bytes)): + _content = shared_private_link_resource else: - _json = self._serialize.body(php_workload_resource, "PhpWorkloadResource") + _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") request = build_create_or_update_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, api_version=api_version, content_type=content_type, json=_json, @@ -361,45 +125,53 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None if response.status_code == 200: - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: _models.PhpWorkloadResource, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: _models.SharedPrivateLinkResource, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PhpWorkloadResource]: - """Create or updated PHP workload resource. + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param php_workload_resource: Resource create or update request payload. Required. - :type php_workload_resource: ~azure.mgmt.workloads.models.PhpWorkloadResource + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -411,9 +183,9 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PhpWorkloadResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -421,21 +193,32 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: IO, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: IO, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PhpWorkloadResource]: - """Create or updated PHP workload resource. + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param php_workload_resource: Resource create or update request payload. Required. - :type php_workload_resource: IO + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: IO + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -447,9 +230,9 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PhpWorkloadResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -457,20 +240,30 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: Union[_models.PhpWorkloadResource, IO], + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.PhpWorkloadResource]: - """Create or updated PHP workload resource. + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param php_workload_resource: Resource create or update request payload. Is either a model type - or a IO type. Required. - :type php_workload_resource: ~azure.mgmt.workloads.models.PhpWorkloadResource or IO + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Is either a model type or a IO type. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or IO + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -482,27 +275,29 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PhpWorkloadResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - php_workload_resource=php_workload_resource, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + search_management_request_options=search_management_request_options, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -513,7 +308,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -537,89 +332,36 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" } - @overload - async def update( - self, - resource_group_name: str, - php_workload_name: str, - resource_patch_request_body: _models.PatchResourceRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PhpWorkloadResource: - """Update PHP workload resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param resource_patch_request_body: Workload resource update data. Required. - :type resource_patch_request_body: ~azure.mgmt.workloads.models.PatchResourceRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - php_workload_name: str, - resource_patch_request_body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PhpWorkloadResource: - """Update PHP workload resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param resource_patch_request_body: Workload resource update data. Required. - :type resource_patch_request_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def update( + async def get( self, resource_group_name: str, - php_workload_name: str, - resource_patch_request_body: Union[_models.PatchResourceRequestBody, IO], + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> _models.PhpWorkloadResource: - """Update PHP workload resource. + ) -> _models.SharedPrivateLinkResource: + """Gets the details of the shared private link resource managed by the search service in the given + resource group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param resource_patch_request_body: Workload resource update data. Is either a model type or a - IO type. Required. - :type resource_patch_request_body: ~azure.mgmt.workloads.models.PatchResourceRequestBody or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource + :return: SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -630,32 +372,26 @@ async def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource_patch_request_body, (IO, bytes)): - _content = resource_patch_request_body - else: - _json = self._serialize.body(resource_patch_request_body, "PatchResourceRequestBody") + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id - request = build_update_request( + request = build_get_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -670,22 +406,26 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, php_workload_name: str, delete_infra: Optional[str] = None, **kwargs: Any + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -698,16 +438,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + request = build_delete_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, subscription_id=self._config.subscription_id, - delete_infra=delete_infra, + client_request_id=_client_request_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -722,32 +467,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" } @distributed_trace_async async def begin_delete( - self, resource_group_name: str, php_workload_name: str, delete_infra: Optional[str] = None, **kwargs: Any + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete PHP workload resource. + """Initiates the deletion of the shared private link resource from the search service. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param delete_infra: Whether to delete infra along with workload resource. Default value is - None. - :type delete_infra: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -763,7 +516,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -773,8 +526,9 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - delete_infra=delete_infra, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + search_management_request_options=search_management_request_options, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -789,7 +543,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -805,5 +560,111 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedPrivateLinkResource"]: + """Gets a list of all shared private link resources managed by the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SharedPrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.list_by_service.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SharedPrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources" } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py index 2ef8cdcab221..8feb69069db5 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py @@ -7,9 +7,13 @@ # -------------------------------------------------------------------------- from ._models_py3 import AdminKeyResult +from ._models_py3 import AsyncOperationResult from ._models_py3 import CheckNameAvailabilityInput from ._models_py3 import CheckNameAvailabilityOutput from ._models_py3 import CloudErrorBody +from ._models_py3 import DataPlaneAadOrApiKeyAuthOption +from ._models_py3 import DataPlaneAuthOptions +from ._models_py3 import EncryptionWithCmk from ._models_py3 import Identity from ._models_py3 import IpRule from ._models_py3 import ListQueryKeysResult @@ -30,26 +34,44 @@ from ._models_py3 import SearchManagementRequestOptions from ._models_py3 import SearchService from ._models_py3 import SearchServiceListResult +from ._models_py3 import SearchServiceUpdate +from ._models_py3 import ShareablePrivateLinkResourceProperties +from ._models_py3 import ShareablePrivateLinkResourceType +from ._models_py3 import SharedPrivateLinkResource +from ._models_py3 import SharedPrivateLinkResourceListResult +from ._models_py3 import SharedPrivateLinkResourceProperties from ._models_py3 import Sku +from ._models_py3 import TrackedResource +from ._search_management_client_enums import AadAuthFailureMode from ._search_management_client_enums import AdminKeyKind from ._search_management_client_enums import HostingMode from ._search_management_client_enums import IdentityType +from ._search_management_client_enums import PrivateLinkServiceConnectionProvisioningState from ._search_management_client_enums import PrivateLinkServiceConnectionStatus from ._search_management_client_enums import ProvisioningState from ._search_management_client_enums import PublicNetworkAccess +from ._search_management_client_enums import SearchEncryptionComplianceStatus +from ._search_management_client_enums import SearchEncryptionWithCmk from ._search_management_client_enums import SearchServiceStatus +from ._search_management_client_enums import SharedPrivateLinkResourceAsyncOperationResult +from ._search_management_client_enums import SharedPrivateLinkResourceProvisioningState +from ._search_management_client_enums import SharedPrivateLinkResourceStatus from ._search_management_client_enums import SkuName from ._search_management_client_enums import UnavailableNameReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "AdminKeyResult", + "AsyncOperationResult", "CheckNameAvailabilityInput", "CheckNameAvailabilityOutput", "CloudErrorBody", + "DataPlaneAadOrApiKeyAuthOption", + "DataPlaneAuthOptions", + "EncryptionWithCmk", "Identity", "IpRule", "ListQueryKeysResult", @@ -70,14 +92,28 @@ "SearchManagementRequestOptions", "SearchService", "SearchServiceListResult", + "SearchServiceUpdate", + "ShareablePrivateLinkResourceProperties", + "ShareablePrivateLinkResourceType", + "SharedPrivateLinkResource", + "SharedPrivateLinkResourceListResult", + "SharedPrivateLinkResourceProperties", "Sku", + "TrackedResource", + "AadAuthFailureMode", "AdminKeyKind", "HostingMode", "IdentityType", + "PrivateLinkServiceConnectionProvisioningState", "PrivateLinkServiceConnectionStatus", "ProvisioningState", "PublicNetworkAccess", + "SearchEncryptionComplianceStatus", + "SearchEncryptionWithCmk", "SearchServiceStatus", + "SharedPrivateLinkResourceAsyncOperationResult", + "SharedPrivateLinkResourceProvisioningState", + "SharedPrivateLinkResourceStatus", "SkuName", "UnavailableNameReason", ] diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py index 24b6380225d8..7e1f8f58f53d 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py @@ -7,23 +7,31 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AdminKeyResult(_serialization.Model): - """Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. + """Response containing the primary and secondary admin API keys for a given Azure Cognitive Search + service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar primary_key: The primary admin API key of the Search service. + :ivar primary_key: The primary admin API key of the search service. :vartype primary_key: str - :ivar secondary_key: The secondary admin API key of the Search service. + :ivar secondary_key: The secondary admin API key of the search service. :vartype secondary_key: str """ @@ -37,13 +45,41 @@ class AdminKeyResult(_serialization.Model): "secondary_key": {"key": "secondaryKey", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.primary_key = None self.secondary_key = None +class AsyncOperationResult(_serialization.Model): + """The details of a long running asynchronous shared private link resource operation. + + :ivar status: The current status of the long running asynchronous shared private link resource + operation. Known values are: "Running", "Succeeded", and "Failed". + :vartype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.SharedPrivateLinkResourceAsyncOperationResult"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: The current status of the long running asynchronous shared private link + resource operation. Known values are: "Running", "Succeeded", and "Failed". + :paramtype status: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult + """ + super().__init__(**kwargs) + self.status = status + + class CheckNameAvailabilityInput(_serialization.Model): """Input of check name availability API. @@ -51,7 +87,7 @@ class CheckNameAvailabilityInput(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: The Search service name to validate. Search service names must only contain + :ivar name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :vartype name: str @@ -72,9 +108,9 @@ class CheckNameAvailabilityInput(_serialization.Model): type = "searchServices" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: The Search service name to validate. Search service names must only contain + :keyword name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :paramtype name: str @@ -112,7 +148,7 @@ class CheckNameAvailabilityOutput(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.is_name_available = None @@ -149,8 +185,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An error code that describes the error condition more precisely than an HTTP status code. Can be used to programmatically handle specific error cases. @@ -171,6 +207,107 @@ def __init__( self.details = details +class DataPlaneAadOrApiKeyAuthOption(_serialization.Model): + """Indicates that either the API key or an access token from Azure Active Directory can be used + for authentication. + + :ivar aad_auth_failure_mode: Describes what response the data plane API of a Search service + would send for requests that failed authentication. Known values are: "http403" and + "http401WithBearerChallenge". + :vartype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode + """ + + _attribute_map = { + "aad_auth_failure_mode": {"key": "aadAuthFailureMode", "type": "str"}, + } + + def __init__( + self, *, aad_auth_failure_mode: Optional[Union[str, "_models.AadAuthFailureMode"]] = None, **kwargs: Any + ) -> None: + """ + :keyword aad_auth_failure_mode: Describes what response the data plane API of a Search service + would send for requests that failed authentication. Known values are: "http403" and + "http401WithBearerChallenge". + :paramtype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode + """ + super().__init__(**kwargs) + self.aad_auth_failure_mode = aad_auth_failure_mode + + +class DataPlaneAuthOptions(_serialization.Model): + """Defines the options for how the data plane API of a Search service authenticates requests. This + cannot be set if 'disableLocalAuth' is set to true. + + :ivar api_key_only: Indicates that only the API key needs to be used for authentication. + :vartype api_key_only: JSON + :ivar aad_or_api_key: Indicates that either the API key or an access token from Azure Active + Directory can be used for authentication. + :vartype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption + """ + + _attribute_map = { + "api_key_only": {"key": "apiKeyOnly", "type": "object"}, + "aad_or_api_key": {"key": "aadOrApiKey", "type": "DataPlaneAadOrApiKeyAuthOption"}, + } + + def __init__( + self, + *, + api_key_only: Optional[JSON] = None, + aad_or_api_key: Optional["_models.DataPlaneAadOrApiKeyAuthOption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword api_key_only: Indicates that only the API key needs to be used for authentication. + :paramtype api_key_only: JSON + :keyword aad_or_api_key: Indicates that either the API key or an access token from Azure Active + Directory can be used for authentication. + :paramtype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption + """ + super().__init__(**kwargs) + self.api_key_only = api_key_only + self.aad_or_api_key = aad_or_api_key + + +class EncryptionWithCmk(_serialization.Model): + """Describes a policy that determines how resources within the search service are to be encrypted + with Customer Managed Keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar enforcement: Describes how a search service should enforce having one or more non + customer encrypted resources. Known values are: "Disabled", "Enabled", and "Unspecified". + :vartype enforcement: str or ~azure.mgmt.search.models.SearchEncryptionWithCmk + :ivar encryption_compliance_status: Describes whether the search service is compliant or not + with respect to having non customer encrypted resources. If a service has more than one non + customer encrypted resource and 'Enforcement' is 'enabled' then the service will be marked as + 'nonCompliant'. Known values are: "Compliant" and "NonCompliant". + :vartype encryption_compliance_status: str or + ~azure.mgmt.search.models.SearchEncryptionComplianceStatus + """ + + _validation = { + "encryption_compliance_status": {"readonly": True}, + } + + _attribute_map = { + "enforcement": {"key": "enforcement", "type": "str"}, + "encryption_compliance_status": {"key": "encryptionComplianceStatus", "type": "str"}, + } + + def __init__( + self, *, enforcement: Optional[Union[str, "_models.SearchEncryptionWithCmk"]] = None, **kwargs: Any + ) -> None: + """ + :keyword enforcement: Describes how a search service should enforce having one or more non + customer encrypted resources. Known values are: "Disabled", "Enabled", and "Unspecified". + :paramtype enforcement: str or ~azure.mgmt.search.models.SearchEncryptionWithCmk + """ + super().__init__(**kwargs) + self.enforcement = enforcement + self.encryption_compliance_status = None + + class Identity(_serialization.Model): """Identity for the resource. @@ -178,9 +315,9 @@ class Identity(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar principal_id: The principal ID of resource identity. + :ivar principal_id: The principal ID of the system-assigned identity of the search service. :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. + :ivar tenant_id: The tenant ID of the system-assigned identity of the search service. :vartype tenant_id: str :ivar type: The identity type. Required. Known values are: "None" and "SystemAssigned". :vartype type: str or ~azure.mgmt.search.models.IdentityType @@ -198,7 +335,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs): + def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs: Any) -> None: """ :keyword type: The identity type. Required. Known values are: "None" and "SystemAssigned". :paramtype type: str or ~azure.mgmt.search.models.IdentityType @@ -221,7 +358,7 @@ class IpRule(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format (eg., 123.1.2.3/24) to be allowed. @@ -253,7 +390,7 @@ class ListQueryKeysResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -276,7 +413,7 @@ class NetworkRuleSet(_serialization.Model): "ip_rules": {"key": "ipRules", "type": "[IpRule]"}, } - def __init__(self, *, ip_rules: Optional[List["_models.IpRule"]] = None, **kwargs): + def __init__(self, *, ip_rules: Optional[List["_models.IpRule"]] = None, **kwargs: Any) -> None: """ :keyword ip_rules: A list of IP restriction rules that defines the inbound network(s) with allowing access to the search service endpoint. At the meantime, all other public IP networks @@ -312,7 +449,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -348,7 +485,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -358,7 +495,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """The result of the request to list REST API operations. It contains a list of operations and a URL to get the next set of results. + """The result of the request to list REST API operations. It contains a list of operations and a + URL to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -378,24 +516,60 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class PrivateEndpointConnection(_serialization.Model): +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class PrivateEndpointConnection(Resource): """Describes an existing Private Endpoint connection to the Azure Cognitive Search service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the private endpoint connection. This can be used with the Azure Resource - Manager to link resources together. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the private endpoint connection. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar properties: Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. @@ -415,16 +589,15 @@ class PrivateEndpointConnection(_serialization.Model): "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } - def __init__(self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. :paramtype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None self.properties = properties @@ -451,7 +624,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -459,7 +632,8 @@ def __init__(self, **kwargs): class PrivateEndpointConnectionProperties(_serialization.Model): - """Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. + """Describes the properties of an existing Private Endpoint connection to the Azure Cognitive + Search service. :ivar private_endpoint: The private endpoint resource from Microsoft.Network provider. :vartype private_endpoint: @@ -468,6 +642,14 @@ class PrivateEndpointConnectionProperties(_serialization.Model): Link Service connection to the Azure Private Endpoint. :vartype private_link_service_connection_state: ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + :ivar group_id: The group id from the provider of resource the private link service connection + is for. + :vartype group_id: str + :ivar provisioning_state: The provisioning state of the private link service connection. Can be + Updating, Deleting, Failed, Succeeded, or Incomplete. Known values are: "Updating", "Deleting", + "Failed", "Succeeded", "Incomplete", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState """ _attribute_map = { @@ -476,6 +658,8 @@ class PrivateEndpointConnectionProperties(_serialization.Model): "key": "privateLinkServiceConnectionState", "type": "PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState", }, + "group_id": {"key": "groupId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -485,8 +669,10 @@ def __init__( private_link_service_connection_state: Optional[ "_models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState" ] = None, - **kwargs - ): + group_id: Optional[str] = None, + provisioning_state: Optional[Union[str, "_models.PrivateLinkServiceConnectionProvisioningState"]] = None, + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint resource from Microsoft.Network provider. :paramtype private_endpoint: @@ -495,10 +681,20 @@ def __init__( Private Link Service connection to the Azure Private Endpoint. :paramtype private_link_service_connection_state: ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + :keyword group_id: The group id from the provider of resource the private link service + connection is for. + :paramtype group_id: str + :keyword provisioning_state: The provisioning state of the private link service connection. Can + be Updating, Deleting, Failed, Succeeded, or Incomplete. Known values are: "Updating", + "Deleting", "Failed", "Succeeded", "Incomplete", and "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState """ super().__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state + self.group_id = group_id + self.provisioning_state = provisioning_state class PrivateEndpointConnectionPropertiesPrivateEndpoint(_serialization.Model): @@ -512,7 +708,7 @@ class PrivateEndpointConnectionPropertiesPrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The resource id of the private endpoint resource from Microsoft.Network provider. :paramtype id: str @@ -522,7 +718,8 @@ def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=re class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState(_serialization.Model): - """Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint. + """Describes the current state of an existing Private Link Service connection to the Azure Private + Endpoint. :ivar status: Status of the the private link service connection. Can be Pending, Approved, Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and @@ -546,8 +743,8 @@ def __init__( status: Optional[Union[str, "_models.PrivateLinkServiceConnectionStatus"]] = None, description: Optional[str] = None, actions_required: str = "None", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the the private link service connection. Can be Pending, Approved, Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and @@ -564,16 +761,18 @@ def __init__( self.actions_required = actions_required -class PrivateLinkResource(_serialization.Model): +class PrivateLinkResource(Resource): """Describes a supported private link resource for the Azure Cognitive Search service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the private link resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the private link resource. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar properties: Describes the properties of a supported private link resource for the Azure Cognitive Search service. @@ -594,17 +793,16 @@ class PrivateLinkResource(_serialization.Model): "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None self.properties = None class PrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of a supported private link resource for the Azure Cognitive Search service. + """Describes the properties of a supported private link resource for the Azure Cognitive Search + service. For a given API version, this represents the 'supported' groupIds when creating a + shared private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -614,26 +812,36 @@ class PrivateLinkResourceProperties(_serialization.Model): :vartype required_members: list[str] :ivar required_zone_names: The list of required DNS zone names of the private link resource. :vartype required_zone_names: list[str] + :ivar shareable_private_link_resource_types: The list of resources that are onboarded to + private link service, that are supported by Azure Cognitive Search. + :vartype shareable_private_link_resource_types: + list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] """ _validation = { "group_id": {"readonly": True}, "required_members": {"readonly": True}, "required_zone_names": {"readonly": True}, + "shareable_private_link_resource_types": {"readonly": True}, } _attribute_map = { "group_id": {"key": "groupId", "type": "str"}, "required_members": {"key": "requiredMembers", "type": "[str]"}, "required_zone_names": {"key": "requiredZoneNames", "type": "[str]"}, + "shareable_private_link_resource_types": { + "key": "shareablePrivateLinkResourceTypes", + "type": "[ShareablePrivateLinkResourceType]", + }, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.group_id = None self.required_members = None self.required_zone_names = None + self.shareable_private_link_resource_types = None class PrivateLinkResourcesResult(_serialization.Model): @@ -653,14 +861,15 @@ class PrivateLinkResourcesResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None class QueryKey(_serialization.Model): - """Describes an API key for a given Azure Cognitive Search service that has permissions for query operations only. + """Describes an API key for a given Azure Cognitive Search service that has permissions for query + operations only. Variables are only populated by the server, and will be ignored when sending a request. @@ -680,111 +889,340 @@ class QueryKey(_serialization.Model): "key": {"key": "key", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None self.key = None -class Resource(_serialization.Model): - """Base type for all Azure resources. +class SearchManagementRequestOptions(_serialization.Model): + """Parameter group. + + :ivar client_request_id: A client-generated GUID value that identifies this request. If + specified, this will be included in response information as a way to track the request. + :vartype client_request_id: str + """ + + _attribute_map = { + "client_request_id": {"key": "clientRequestId", "type": "str"}, + } + + def __init__(self, *, client_request_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword client_request_id: A client-generated GUID value that identifies this request. If + specified, this will be included in response information as a way to track the request. + :paramtype client_request_id: str + """ + super().__init__(**kwargs) + self.client_request_id = client_request_id + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the resource. This can be used with the Azure Resource Manager to link - resources together. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The geographic location of the resource. This must be one of the supported and - registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). - This property is required when creating a new resource. + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar tags: Tags to help categorize the resource in the Azure portal. + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class SearchService(TrackedResource): # pylint: disable=too-many-instance-attributes + """Describes an Azure Cognitive Search service and its current state. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar sku: The SKU of the Search Service, which determines price tier and capacity limits. This + property is required when creating a new Search Service. + :vartype sku: ~azure.mgmt.search.models.Sku :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.search.models.Identity + :ivar replica_count: The number of replicas in the search service. If specified, it must be a + value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + :vartype replica_count: int + :ivar partition_count: The number of partitions in the search service; if specified, it can be + 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + :vartype partition_count: int + :ivar hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable + up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' + or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: "default" + and "highDensity". + :vartype hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :ivar public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Known + values are: "enabled" and "disabled". + :vartype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error + state. If your service is in the degraded, disabled, or error states, it means the Azure + Cognitive Search team is actively investigating the underlying issue. Dedicated services in + these states are still chargeable based on the number of search units provisioned. Known values + are: "running", "provisioning", "deleting", "degraded", "disabled", "error", and "stopped". + :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus + :ivar status_details: The details of the search service status. + :vartype status_details: str + :ivar provisioning_state: The state of the last provisioning operation performed on the search + service. Provisioning is an intermediate state that occurs while service capacity is being + established. After capacity is set up, provisioningState changes to either 'succeeded' or + 'failed'. Client applications can poll provisioning status (the recommended polling interval is + from 30 seconds to one minute) by using the Get Search Service operation to see when an + operation is completed. If you are using the free service, this value tends to come back as + 'succeeded' directly in the call to Create search service. This is because the free service + uses capacity that is already set up. Known values are: "succeeded", "provisioning", and + "failed". + :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState + :ivar network_rule_set: Network specific rules that determine how the Azure Cognitive Search + service may be reached. + :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar encryption_with_cmk: Specifies any policy regarding encryption of resources (such as + indexes) using customer manager keys within a search service. + :vartype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk + :ivar disable_local_auth: When set to true, calls to the search service will not be permitted + to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' + are defined. + :vartype disable_local_auth: bool + :ivar auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :vartype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions + :ivar private_endpoint_connections: The list of private endpoint connections to the Azure + Cognitive Search service. + :vartype private_endpoint_connections: + list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "replica_count": {"maximum": 12, "minimum": 1}, + "partition_count": {"maximum": 12, "minimum": 1}, + "status": {"readonly": True}, + "status_details": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + "shared_private_link_resources": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, "identity": {"key": "identity", "type": "Identity"}, + "replica_count": {"key": "properties.replicaCount", "type": "int"}, + "partition_count": {"key": "properties.partitionCount", "type": "int"}, + "hosting_mode": {"key": "properties.hostingMode", "type": "str"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "status_details": {"key": "properties.statusDetails", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, + "encryption_with_cmk": {"key": "properties.encryptionWithCmk", "type": "EncryptionWithCmk"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "auth_options": {"key": "properties.authOptions", "type": "DataPlaneAuthOptions"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "shared_private_link_resources": { + "key": "properties.sharedPrivateLinkResources", + "type": "[SharedPrivateLinkResource]", + }, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, - **kwargs - ): + replica_count: int = 1, + partition_count: int = 1, + hosting_mode: Union[str, "_models.HostingMode"] = "default", + public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", + network_rule_set: Optional["_models.NetworkRuleSet"] = None, + encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, + disable_local_auth: Optional[bool] = None, + auth_options: Optional["_models.DataPlaneAuthOptions"] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The geographic location of the resource. This must be one of the supported - and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). - This property is required when creating a new resource. - :paramtype location: str - :keyword tags: Tags to help categorize the resource in the Azure portal. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :paramtype sku: ~azure.mgmt.search.models.Sku :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.search.models.Identity + :keyword replica_count: The number of replicas in the search service. If specified, it must be + a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic + SKU. + :paramtype replica_count: int + :keyword partition_count: The number of partitions in the search service; if specified, it can + be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For + 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 + and 3. + :paramtype partition_count: int + :keyword hosting_mode: Applicable only for the standard3 SKU. You can set this property to + enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than + the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either + 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: + "default" and "highDensity". + :paramtype hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :keyword public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Known + values are: "enabled" and "disabled". + :paramtype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :keyword network_rule_set: Network specific rules that determine how the Azure Cognitive Search + service may be reached. + :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :keyword encryption_with_cmk: Specifies any policy regarding encryption of resources (such as + indexes) using customer manager keys within a search service. + :paramtype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk + :keyword disable_local_auth: When set to true, calls to the search service will not be + permitted to utilize API keys for authentication. This cannot be set to true if + 'dataPlaneAuthOptions' are defined. + :paramtype disable_local_auth: bool + :keyword auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags + super().__init__(tags=tags, location=location, **kwargs) + self.sku = sku self.identity = identity + self.replica_count = replica_count + self.partition_count = partition_count + self.hosting_mode = hosting_mode + self.public_network_access = public_network_access + self.status = None + self.status_details = None + self.provisioning_state = None + self.network_rule_set = network_rule_set + self.encryption_with_cmk = encryption_with_cmk + self.disable_local_auth = disable_local_auth + self.auth_options = auth_options + self.private_endpoint_connections = None + self.shared_private_link_resources = None -class SearchManagementRequestOptions(_serialization.Model): - """Parameter group. +class SearchServiceListResult(_serialization.Model): + """Response containing a list of Azure Cognitive Search services. - :ivar client_request_id: A client-generated GUID value that identifies this request. If - specified, this will be included in response information as a way to track the request. - :vartype client_request_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Search services. + :vartype value: list[~azure.mgmt.search.models.SearchService] + :ivar next_link: Request URL that can be used to query next page of search services. Returned + when the total number of requested search services exceed maximum page size. + :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "client_request_id": {"key": "clientRequestId", "type": "str"}, + "value": {"key": "value", "type": "[SearchService]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, client_request_id: Optional[str] = None, **kwargs): - """ - :keyword client_request_id: A client-generated GUID value that identifies this request. If - specified, this will be included in response information as a way to track the request. - :paramtype client_request_id: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.client_request_id = client_request_id + self.value = None + self.next_link = None -class SearchService(Resource): # pylint: disable=too-many-instance-attributes - """Describes an Azure Cognitive Search service and its current state. +class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attributes + """The parameters used to update an Azure Cognitive Search service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the resource. This can be used with the Azure Resource Manager to link - resources together. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar sku: The SKU of the Search Service, which determines price tier and capacity limits. This + property is required when creating a new Search Service. + :vartype sku: ~azure.mgmt.search.models.Sku :ivar location: The geographic location of the resource. This must be one of the supported and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource. @@ -793,13 +1231,10 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.search.models.Identity - :ivar sku: The SKU of the Search Service, which determines price tier and capacity limits. This - property is required when creating a new Search Service. - :vartype sku: ~azure.mgmt.search.models.Sku - :ivar replica_count: The number of replicas in the Search service. If specified, it must be a + :ivar replica_count: The number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. :vartype replica_count: int - :ivar partition_count: The number of partitions in the Search service; if specified, it can be + :ivar partition_count: The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. :vartype partition_count: int @@ -814,37 +1249,51 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes is not allowed, and private endpoint connections would be the exclusive access method. Known values are: "enabled" and "disabled". :vartype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess - :ivar status: The status of the Search service. Possible values include: 'running': The Search - service is running and no provisioning operations are underway. 'provisioning': The Search - service is being provisioned or scaled up or down. 'deleting': The Search service is being - deleted. 'degraded': The Search service is degraded. This can occur when the underlying search - units are not healthy. The Search service is most likely operational, but performance might be - slow and some requests might be dropped. 'disabled': The Search service is disabled. In this - state, the service will reject all API requests. 'error': The Search service is in an error + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error state. If your service is in the degraded, disabled, or error states, it means the Azure Cognitive Search team is actively investigating the underlying issue. Dedicated services in these states are still chargeable based on the number of search units provisioned. Known values - are: "running", "provisioning", "deleting", "degraded", "disabled", and "error". + are: "running", "provisioning", "deleting", "degraded", "disabled", "error", and "stopped". :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus - :ivar status_details: The details of the Search service status. + :ivar status_details: The details of the search service status. :vartype status_details: str - :ivar provisioning_state: The state of the last provisioning operation performed on the Search + :ivar provisioning_state: The state of the last provisioning operation performed on the search service. Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is set up, provisioningState changes to either 'succeeded' or 'failed'. Client applications can poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If you are using the free service, this value tends to come back as - 'succeeded' directly in the call to Create Search service. This is because the free service + 'succeeded' directly in the call to Create search service. This is because the free service uses capacity that is already set up. Known values are: "succeeded", "provisioning", and "failed". :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState :ivar network_rule_set: Network specific rules that determine how the Azure Cognitive Search service may be reached. :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar encryption_with_cmk: Specifies any policy regarding encryption of resources (such as + indexes) using customer manager keys within a search service. + :vartype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk + :ivar disable_local_auth: When set to true, calls to the search service will not be permitted + to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' + are defined. + :vartype disable_local_auth: bool + :ivar auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :vartype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions :ivar private_endpoint_connections: The list of private endpoint connections to the Azure Cognitive Search service. :vartype private_endpoint_connections: list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] """ _validation = { @@ -857,16 +1306,17 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes "status_details": {"readonly": True}, "provisioning_state": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, + "shared_private_link_resources": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "Identity"}, - "sku": {"key": "sku", "type": "Sku"}, "replica_count": {"key": "properties.replicaCount", "type": "int"}, "partition_count": {"key": "properties.partitionCount", "type": "int"}, "hosting_mode": {"key": "properties.hostingMode", "type": "str"}, @@ -875,27 +1325,40 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes "status_details": {"key": "properties.statusDetails", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, + "encryption_with_cmk": {"key": "properties.encryptionWithCmk", "type": "EncryptionWithCmk"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "auth_options": {"key": "properties.authOptions", "type": "DataPlaneAuthOptions"}, "private_endpoint_connections": { "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, + "shared_private_link_resources": { + "key": "properties.sharedPrivateLinkResources", + "type": "[SharedPrivateLinkResource]", + }, } def __init__( self, *, + sku: Optional["_models.Sku"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.Identity"] = None, - sku: Optional["_models.Sku"] = None, replica_count: int = 1, partition_count: int = 1, hosting_mode: Union[str, "_models.HostingMode"] = "default", public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", network_rule_set: Optional["_models.NetworkRuleSet"] = None, - **kwargs - ): + encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, + disable_local_auth: Optional[bool] = None, + auth_options: Optional["_models.DataPlaneAuthOptions"] = None, + **kwargs: Any + ) -> None: """ + :keyword sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :paramtype sku: ~azure.mgmt.search.models.Sku :keyword location: The geographic location of the resource. This must be one of the supported and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource. @@ -904,14 +1367,11 @@ def __init__( :paramtype tags: dict[str, str] :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.search.models.Identity - :keyword sku: The SKU of the Search Service, which determines price tier and capacity limits. - This property is required when creating a new Search Service. - :paramtype sku: ~azure.mgmt.search.models.Sku - :keyword replica_count: The number of replicas in the Search service. If specified, it must be + :keyword replica_count: The number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. :paramtype replica_count: int - :keyword partition_count: The number of partitions in the Search service; if specified, it can + :keyword partition_count: The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. @@ -930,9 +1390,22 @@ def __init__( :keyword network_rule_set: Network specific rules that determine how the Azure Cognitive Search service may be reached. :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :keyword encryption_with_cmk: Specifies any policy regarding encryption of resources (such as + indexes) using customer manager keys within a search service. + :paramtype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk + :keyword disable_local_auth: When set to true, calls to the search service will not be + permitted to utilize API keys for authentication. This cannot be set to true if + 'dataPlaneAuthOptions' are defined. + :paramtype disable_local_auth: bool + :keyword auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(**kwargs) self.sku = sku + self.location = location + self.tags = tags + self.identity = identity self.replica_count = replica_count self.partition_count = partition_count self.hosting_mode = hosting_mode @@ -941,42 +1414,240 @@ def __init__( self.status_details = None self.provisioning_state = None self.network_rule_set = network_rule_set + self.encryption_with_cmk = encryption_with_cmk + self.disable_local_auth = disable_local_auth + self.auth_options = auth_options self.private_endpoint_connections = None + self.shared_private_link_resources = None -class SearchServiceListResult(_serialization.Model): - """Response containing a list of Azure Cognitive Search services. +class ShareablePrivateLinkResourceProperties(_serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service, + supported by Azure Cognitive Search. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of Search services. - :vartype value: list[~azure.mgmt.search.models.SearchService] - :ivar next_link: Request URL that can be used to query next page of search services. Returned - when the total number of requested search services exceed maximum page size. + :ivar type: The resource provider type for the resource that has been onboarded to private link + service, supported by Azure Cognitive Search. + :vartype type: str + :ivar group_id: The resource provider group id for the resource that has been onboarded to + private link service, supported by Azure Cognitive Search. + :vartype group_id: str + :ivar description: The description of the resource type that has been onboarded to private link + service, supported by Azure Cognitive Search. + :vartype description: str + """ + + _validation = { + "type": {"readonly": True}, + "group_id": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.group_id = None + self.description = None + + +class ShareablePrivateLinkResourceType(_serialization.Model): + """Describes an resource type that has been onboarded to private link service, supported by Azure + Cognitive Search. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the resource type that has been onboarded to private link service, + supported by Azure Cognitive Search. + :vartype name: str + :ivar properties: Describes the properties of a resource type that has been onboarded to + private link service, supported by Azure Cognitive Search. + :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties + """ + + _validation = { + "name": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "ShareablePrivateLinkResourceProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.properties = None + + +class SharedPrivateLinkResource(Resource): + """Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar properties: Describes the properties of a Shared Private Link Resource managed by the + Azure Cognitive Search service. + :vartype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "SharedPrivateLinkResourceProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SharedPrivateLinkResourceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Describes the properties of a Shared Private Link Resource managed by the + Azure Cognitive Search service. + :paramtype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SharedPrivateLinkResourceListResult(_serialization.Model): + """Response containing a list of Shared Private Link Resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Shared Private Link Resources. + :vartype value: list[~azure.mgmt.search.models.SharedPrivateLinkResource] + :ivar next_link: The URL to get the next set of shared private link resources, if there are + any. :vartype next_link: str """ _validation = { "value": {"readonly": True}, - "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SearchService]"}, + "value": {"key": "value", "type": "[SharedPrivateLinkResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The URL to get the next set of shared private link resources, if there are + any. + :paramtype next_link: str + """ super().__init__(**kwargs) self.value = None - self.next_link = None + self.next_link = next_link + + +class SharedPrivateLinkResourceProperties(_serialization.Model): + """Describes the properties of an existing Shared Private Link Resource managed by the Azure + Cognitive Search service. + + :ivar private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :vartype private_link_resource_id: str + :ivar group_id: The group id from the provider of resource the shared private link resource is + for. + :vartype group_id: str + :ivar request_message: The request message for requesting approval of the shared private link + resource. + :vartype request_message: str + :ivar resource_region: Optional. Can be used to specify the Azure Resource Manager location of + the resource to which a shared private link is to be created. This is only required for those + resources whose DNS configuration are regional (such as Azure Kubernetes Service). + :vartype resource_region: str + :ivar status: Status of the shared private link resource. Can be Pending, Approved, Rejected or + Disconnected. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus + :ivar provisioning_state: The provisioning state of the shared private link resource. Can be + Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", "Deleting", + "Failed", "Succeeded", and "Incomplete". + :vartype provisioning_state: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState + """ + + _attribute_map = { + "private_link_resource_id": {"key": "privateLinkResourceId", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "request_message": {"key": "requestMessage", "type": "str"}, + "resource_region": {"key": "resourceRegion", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + private_link_resource_id: Optional[str] = None, + group_id: Optional[str] = None, + request_message: Optional[str] = None, + resource_region: Optional[str] = None, + status: Optional[Union[str, "_models.SharedPrivateLinkResourceStatus"]] = None, + provisioning_state: Optional[Union[str, "_models.SharedPrivateLinkResourceProvisioningState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :paramtype private_link_resource_id: str + :keyword group_id: The group id from the provider of resource the shared private link resource + is for. + :paramtype group_id: str + :keyword request_message: The request message for requesting approval of the shared private + link resource. + :paramtype request_message: str + :keyword resource_region: Optional. Can be used to specify the Azure Resource Manager location + of the resource to which a shared private link is to be created. This is only required for + those resources whose DNS configuration are regional (such as Azure Kubernetes Service). + :paramtype resource_region: str + :keyword status: Status of the shared private link resource. Can be Pending, Approved, Rejected + or Disconnected. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :paramtype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus + :keyword provisioning_state: The provisioning state of the shared private link resource. Can be + Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", "Deleting", + "Failed", "Succeeded", and "Incomplete". + :paramtype provisioning_state: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState + """ + super().__init__(**kwargs) + self.private_link_resource_id = private_link_resource_id + self.group_id = group_id + self.request_message = request_message + self.resource_region = resource_region + self.status = status + self.provisioning_state = provisioning_state class Sku(_serialization.Model): - """Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity limits. + """Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity + limits. - :ivar name: The SKU of the Search service. Valid values include: 'free': Shared service. + :ivar name: The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or @@ -992,9 +1663,9 @@ class Sku(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs): + def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: """ - :keyword name: The SKU of the Search service. Valid values include: 'free': Shared service. + :keyword name: The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py index 04376879c857..991db6160eec 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py @@ -10,11 +10,26 @@ from azure.core import CaseInsensitiveEnumMeta +class AadAuthFailureMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what response the data plane API of a Search service would send for requests that + failed authentication. + """ + + HTTP403 = "http403" + """Indicates that requests that failed authentication should be presented with an HTTP status code + #: of 403 (Forbidden).""" + HTTP401_WITH_BEARER_CHALLENGE = "http401WithBearerChallenge" + """Indicates that requests that failed authentication should be presented with an HTTP status code + #: of 401 (Unauthorized) and present a Bearer Challenge.""" + + class AdminKeyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AdminKeyKind.""" PRIMARY = "primary" + """The primary API key for the search service.""" SECONDARY = "secondary" + """The secondary API key for the search service.""" class HostingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -25,7 +40,9 @@ class HostingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ DEFAULT = "default" + """The limit on number of indexes is determined by the default limits for the SKU.""" HIGH_DENSITY = "highDensity" + """Only application for standard3 SKU, where the search service can have up to 1000 indexes.""" class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -35,30 +52,58 @@ class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" +class PrivateLinkServiceConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the private link service connection. Can be Updating, Deleting, + Failed, Succeeded, or Incomplete. + """ + + UPDATING = "Updating" + """The private link service connection is in the process of being created along with other + #: resources for it to be fully functional.""" + DELETING = "Deleting" + """The private link service connection is in the process of being deleted.""" + FAILED = "Failed" + """The private link service connection has failed to be provisioned or deleted.""" + SUCCEEDED = "Succeeded" + """The private link service connection has finished provisioning and is ready for approval.""" + INCOMPLETE = "Incomplete" + """Provisioning request for the private link service connection resource has been accepted but the + #: process of creation has not commenced yet.""" + CANCELED = "Canceled" + """Provisioning request for the private link service connection resource has been canceled""" + + class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the the private link service connection. Can be Pending, Approved, Rejected, or Disconnected. """ PENDING = "Pending" + """The private endpoint connection has been created and is pending approval.""" APPROVED = "Approved" + """The private endpoint connection is approved and is ready for use.""" REJECTED = "Rejected" + """The private endpoint connection has been rejected and cannot be used.""" DISCONNECTED = "Disconnected" + """The private endpoint connection has been removed from the service.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the last provisioning operation performed on the Search service. Provisioning is + """The state of the last provisioning operation performed on the search service. Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is set up, provisioningState changes to either 'succeeded' or 'failed'. Client applications can poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If you are using the free service, this value tends to come back as 'succeeded' directly in the call to Create - Search service. This is because the free service uses capacity that is already set up. + search service. This is because the free service uses capacity that is already set up. """ SUCCEEDED = "succeeded" + """The last provisioning operation has completed successfully.""" PROVISIONING = "provisioning" + """The search service is being provisioned or scaled up or down.""" FAILED = "failed" + """The last provisioning operation has failed.""" class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -71,29 +116,95 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "disabled" +class SearchEncryptionComplianceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes whether the search service is compliant or not with respect to having non customer + encrypted resources. If a service has more than one non customer encrypted resource and + 'Enforcement' is 'enabled' then the service will be marked as 'nonCompliant'. + """ + + COMPLIANT = "Compliant" + """Indicates that the search service is compliant, either because number of non customer encrypted + #: resources is zero or enforcement is disabled.""" + NON_COMPLIANT = "NonCompliant" + """Indicates that the search service has more than 1 non customer encrypted resources.""" + + +class SearchEncryptionWithCmk(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes how a search service should enforce having one or more non customer encrypted + resources. + """ + + DISABLED = "Disabled" + """No enforcement will be made and the search service can have non customer encrypted resources.""" + ENABLED = "Enabled" + """Search service will be marked as non-compliant if there are one or more non customer encrypted + #: resources.""" + UNSPECIFIED = "Unspecified" + """Enforcement policy is not explicitly specified, with the behavior being the same as if it were + #: set to 'Disabled'.""" + + class SearchServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the Search service. Possible values include: 'running': The Search service is - running and no provisioning operations are underway. 'provisioning': The Search service is - being provisioned or scaled up or down. 'deleting': The Search service is being deleted. - 'degraded': The Search service is degraded. This can occur when the underlying search units are - not healthy. The Search service is most likely operational, but performance might be slow and - some requests might be dropped. 'disabled': The Search service is disabled. In this state, the - service will reject all API requests. 'error': The Search service is in an error state. If your + """The status of the search service. Possible values include: 'running': The search service is + running and no provisioning operations are underway. 'provisioning': The search service is + being provisioned or scaled up or down. 'deleting': The search service is being deleted. + 'degraded': The search service is degraded. This can occur when the underlying search units are + not healthy. The search service is most likely operational, but performance might be slow and + some requests might be dropped. 'disabled': The search service is disabled. In this state, the + service will reject all API requests. 'error': The search service is in an error state. If your service is in the degraded, disabled, or error states, it means the Azure Cognitive Search team is actively investigating the underlying issue. Dedicated services in these states are still chargeable based on the number of search units provisioned. """ RUNNING = "running" + """The search service is running and no provisioning operations are underway.""" PROVISIONING = "provisioning" + """The search service is being provisioned or scaled up or down.""" DELETING = "deleting" + """The search service is being deleted.""" DEGRADED = "degraded" + """The search service is degraded because underlying search units are not healthy.""" DISABLED = "disabled" + """The search service is disabled and all API requests will be rejected.""" ERROR = "error" + """The search service is in error state, indicating either a failure to provision or to be + #: deleted.""" + STOPPED = "stopped" + """The search service is in a subscription that's disabled.""" + + +class SharedPrivateLinkResourceAsyncOperationResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current status of the long running asynchronous shared private link resource operation.""" + + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class SharedPrivateLinkResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the shared private link resource. Can be Updating, Deleting, Failed, + Succeeded or Incomplete. + """ + + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + INCOMPLETE = "Incomplete" + + +class SharedPrivateLinkResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The SKU of the Search service. Valid values include: 'free': Shared service. 'basic': Dedicated + """The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 @@ -103,12 +214,20 @@ class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ FREE = "free" + """Free tier, with no SLA guarantees and a subset of features offered to paid tiers.""" BASIC = "basic" + """Paid tier dedicated service with up to 3 replicas.""" STANDARD = "standard" + """Paid tier dedicated service with up to 12 partitions and 12 replicas.""" STANDARD2 = "standard2" + """Similar to 'standard', but with more capacity per search unit.""" STANDARD3 = "standard3" + """The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions + #: with more indexes if you also set the hostingMode property to 'highDensity').""" STORAGE_OPTIMIZED_L1 = "storage_optimized_l1" + """Paid tier dedicated service that supports 1TB per partition, up to 12 partitions.""" STORAGE_OPTIMIZED_L2 = "storage_optimized_l2" + """Paid tier dedicated service that supports 2TB per partition, up to 12 partitions.""" class UnavailableNameReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -118,4 +237,6 @@ class UnavailableNameReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ INVALID = "Invalid" + """The search service name does not match naming requirements.""" ALREADY_EXISTS = "AlreadyExists" + """The search service name is already assigned to a different search service.""" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py index 5f7e85a6a72d..b7967f39c207 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py @@ -12,9 +12,10 @@ from ._services_operations import ServicesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -24,6 +25,7 @@ "ServicesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", + "SharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py index 43f46bede499..3af98f16d85a 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py @@ -50,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_regenerate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_regenerate_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,10 +171,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -191,9 +191,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,7 +210,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys" + } @distributed_trace def regenerate( @@ -252,10 +254,10 @@ def regenerate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -273,9 +275,9 @@ def regenerate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -292,4 +294,6 @@ def regenerate( return deserialized - regenerate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}"} # type: ignore + regenerate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py index 69e99087abf3..0db127672e2a 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +91,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +130,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +138,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,4 +157,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Search/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Search/operations"} diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py index dfef57105145..b935d3cc8fad 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py @@ -53,8 +53,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +98,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +140,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +181,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +195,7 @@ def build_list_by_service_request( "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +239,7 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -277,7 +277,7 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -313,7 +313,7 @@ def update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -349,11 +349,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -381,9 +381,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -400,7 +400,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def get( @@ -411,7 +413,7 @@ def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the details of the private endpoint connection to the Search service in the given resource + """Gets the details of the private endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You @@ -442,10 +444,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -463,9 +465,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -482,7 +484,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def delete( @@ -493,7 +497,7 @@ def delete( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - """Disconnects the private endpoint connection and deletes it from the Search service. + """Disconnects the private endpoint connection and deletes it from the search service. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -523,10 +527,10 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -544,9 +548,9 @@ def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -565,7 +569,9 @@ def delete( return deserialized - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def list_by_service( @@ -595,10 +601,10 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -625,7 +631,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -641,7 +647,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -649,13 +655,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -668,4 +674,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py index 3aeeb5b2f59d..ab8eaeaa4281 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py @@ -52,7 +52,7 @@ def build_list_supported_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_list_supported_request( "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,10 +125,10 @@ def list_supported( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesResult] + ) + cls: ClsType[_models.PrivateLinkResourcesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -155,7 +155,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -171,7 +171,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -179,13 +179,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -198,4 +198,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_supported.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources"} # type: ignore + list_supported.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py index adb8d6941283..cf19c6af0e6f 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py @@ -53,7 +53,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +92,7 @@ def build_list_by_search_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +106,7 @@ def build_list_by_search_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +131,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +146,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,7 +187,7 @@ def create( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.QueryKey: - """Generates a new query key for the specified Search service. You can create up to 50 query keys + """Generates a new query key for the specified search service. You can create up to 50 query keys per service. :param resource_group_name: The name of the resource group within the current subscription. You @@ -217,10 +217,10 @@ def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryKey] + ) + cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -238,9 +238,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -257,7 +257,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}" + } @distributed_trace def list_by_search_service( @@ -286,10 +288,10 @@ def list_by_search_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListQueryKeysResult] + ) + cls: ClsType[_models.ListQueryKeysResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -316,7 +318,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -332,7 +334,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -340,13 +342,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListQueryKeysResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -359,7 +361,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_search_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys"} # type: ignore + list_by_search_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -401,10 +405,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -422,9 +426,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -437,4 +441,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py index 125e2503e14e..cc4f88938792 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py @@ -54,8 +54,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,8 +95,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +110,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +188,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +207,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +220,7 @@ def build_list_by_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +239,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +248,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,8 +267,8 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") type = "searchServices" @@ -280,7 +280,7 @@ def build_check_name_availability_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -333,11 +333,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -364,9 +364,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -383,11 +383,13 @@ def _create_or_update_initial( deserialized = self._deserialize("SearchService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload def begin_create_or_update( @@ -400,7 +402,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -413,7 +415,7 @@ def begin_create_or_update( of the service URI (https://:code:``.search.windows.net). You cannot change the service name after the service is created. Required. :type search_service_name: str - :param service: The definition of the Search service to create or update. Required. + :param service: The definition of the search service to create or update. Required. :type service: ~azure.mgmt.search.models.SearchService :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -446,7 +448,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -459,7 +461,7 @@ def begin_create_or_update( of the service URI (https://:code:``.search.windows.net). You cannot change the service name after the service is created. Required. :type search_service_name: str - :param service: The definition of the Search service to create or update. Required. + :param service: The definition of the search service to create or update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -490,7 +492,7 @@ def begin_create_or_update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> LROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -503,7 +505,7 @@ def begin_create_or_update( of the service URI (https://:code:``.search.windows.net). You cannot change the service name after the service is created. Required. :type search_service_name: str - :param service: The definition of the Search service to create or update. Is either a model + :param service: The definition of the search service to create or update. Is either a model type or a IO type. Required. :type service: ~azure.mgmt.search.models.SearchService or IO :param search_management_request_options: Parameter group. Default value is None. @@ -528,16 +530,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, search_service_name=search_service_name, service=service, @@ -558,7 +560,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -570,30 +572,32 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload def update( self, resource_group_name: str, search_service_name: str, - service: _models.SearchService, + service: _models.SearchServiceUpdate, search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str :param search_service_name: The name of the Azure Cognitive Search service to update. Required. :type search_service_name: str - :param service: The definition of the Search service to update. Required. - :type service: ~azure.mgmt.search.models.SearchService + :param service: The definition of the search service to update. Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -617,14 +621,14 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str :param search_service_name: The name of the Azure Cognitive Search service to update. Required. :type search_service_name: str - :param service: The definition of the Search service to update. Required. + :param service: The definition of the search service to update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -643,20 +647,20 @@ def update( self, resource_group_name: str, search_service_name: str, - service: Union[_models.SearchService, IO], + service: Union[_models.SearchServiceUpdate, IO], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str :param search_service_name: The name of the Azure Cognitive Search service to update. Required. :type search_service_name: str - :param service: The definition of the Search service to update. Is either a model type or a IO + :param service: The definition of the search service to update. Is either a model type or a IO type. Required. - :type service: ~azure.mgmt.search.models.SearchService or IO + :type service: ~azure.mgmt.search.models.SearchServiceUpdate or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -679,11 +683,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -694,7 +698,7 @@ def update( if isinstance(service, (IO, bytes)): _content = service else: - _json = self._serialize.body(service, "SearchService") + _json = self._serialize.body(service, "SearchServiceUpdate") request = build_update_request( resource_group_name=resource_group_name, @@ -710,9 +714,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -729,7 +733,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def get( @@ -739,7 +745,7 @@ def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Gets the Search service with the given name in the given resource group. + """Gets the search service with the given name in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -766,10 +772,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -786,9 +792,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -805,7 +811,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -815,7 +823,7 @@ def delete( # pylint: disable=inconsistent-return-statements search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> None: - """Deletes a Search service in the given resource group, along with its associated resources. + """Deletes a search service in the given resource group, along with its associated resources. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -842,10 +850,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -862,9 +870,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -877,7 +885,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def list_by_resource_group( @@ -902,10 +912,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -931,7 +941,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -947,7 +957,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -955,13 +965,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -974,7 +984,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices" + } @distributed_trace def list_by_subscription( @@ -993,10 +1005,10 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1021,7 +1033,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1037,7 +1049,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1045,13 +1057,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1064,7 +1076,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} @distributed_trace def check_name_availability( @@ -1073,11 +1085,11 @@ def check_name_availability( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Checks whether or not the given Search service name is available for use. Search service names + """Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://:code:``.search.windows.net). - :param name: The Search service name to validate. Search service names must only contain + :param name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :type name: str @@ -1104,12 +1116,12 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - type = kwargs.pop("type", "searchServices") # type: Literal["searchServices"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + type: Literal["searchServices"] = kwargs.pop("type", "searchServices") + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -1128,9 +1140,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,4 +1159,6 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability" + } diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py new file mode 100644 index 000000000000..fd9dad1cbe97 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py @@ -0,0 +1,831 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_service_request( + resource_group_name: str, + search_service_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SharedPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`shared_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> Optional[_models.SharedPrivateLinkResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SharedPrivateLinkResource]] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shared_private_link_resource, (IO, bytes)): + _content = shared_private_link_resource + else: + _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: _models.SharedPrivateLinkResource, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: IO, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: IO + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Is either a model type or a IO type. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or IO + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + search_management_request_options=search_management_request_options, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Gets the details of the shared private link resource managed by the search service in the given + resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Initiates the deletion of the shared private link resource from the search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + search_management_request_options=search_management_request_options, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> Iterable["_models.SharedPrivateLinkResource"]: + """Gets a list of all shared private link resources managed by the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SharedPrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.list_by_service.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SharedPrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources" + } diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_create.py b/sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py similarity index 58% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_create.py rename to sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py index 4e126423aa74..f84dbc7b23c6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_create.py +++ b/sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.search import SearchManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-search # USAGE - python cosmos_db_data_transfer_job_create.py + python create_or_update_shared_private_link_resource.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,29 +24,27 @@ def main(): - client = CosmosDBManagementClient( + client = SearchManagementClient( credential=DefaultAzureCredential(), subscription_id="subid", ) - response = client.data_transfer_jobs.create( + response = client.shared_private_link_resources.begin_create_or_update( resource_group_name="rg1", - account_name="ddb1", - job_name="j1", - job_create_parameters={ + search_service_name="mysearchservice", + shared_private_link_resource_name="testResource", + shared_private_link_resource={ "properties": { - "destination": { - "component": "AzureBlobStorage", - "containerName": "blob_container", - "endpointUrl": "https://blob.windows.net", - }, - "source": {"component": "CosmosDBCassandra", "keyspaceName": "keyspace", "tableName": "table"}, + "groupId": "blob", + "privateLinkResourceId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName", + "requestMessage": "please approve", + "resourceRegion": None, } }, - ) + ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCreate.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/CreateOrUpdateSharedPrivateLinkResource.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_delete.py b/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py similarity index 93% rename from sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_delete.py rename to sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py index 2e5a63e93736..1703b4283f9c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-search # USAGE - python private_endpoint_connection_delete.py + python delete_private_endpoint_connection.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py b/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py new file mode 100644 index 000000000000..eb4c99f14469 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python delete_shared_private_link_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.shared_private_link_resources.begin_delete( + resource_group_name="rg1", + search_service_name="mysearchservice", + shared_private_link_resource_name="testResource", + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/DeleteSharedPrivateLinkResource.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_get.py b/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py similarity index 93% rename from sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_get.py rename to sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py index 25e9c1fff266..00905fc23153 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_get.py +++ b/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-search # USAGE - python private_endpoint_connection_get.py + python get_private_endpoint_connection.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py b/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py new file mode 100644 index 000000000000..f9fb209d9292 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python get_shared_private_link_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.shared_private_link_resources.get( + resource_group_name="rg1", + search_service_name="mysearchservice", + shared_private_link_resource_name="testResource", + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetSharedPrivateLinkResource.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py b/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py index 89bd5757c693..f0a40c5bfba7 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/ListPrivateEndpointConnectionsByService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListPrivateEndpointConnectionsByService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py b/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py new file mode 100644 index 000000000000..3d5cb425a597 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python list_shared_private_link_resources_by_service.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.shared_private_link_resources.list_by_service( + resource_group_name="rg1", + search_service_name="mysearchservice", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListSharedPrivateLinkResourcesByService.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py b/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py index f5691abeab66..1d0025e3a9de 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py +++ b/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/ListSupportedPrivateLinkResources.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListSupportedPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/operations_list.py b/sdk/search/azure-mgmt-search/generated_samples/operations_list.py new file mode 100644 index 000000000000..824242e1cfc3 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/OperationsList.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py index 693960b392f7..e3599986c349 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchCreateOrUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py new file mode 100644 index 000000000000..0862edaca7d8 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_create_or_update_service_auth_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.services.begin_create_or_update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "location": "westus", + "properties": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}}, + "hostingMode": "default", + "partitionCount": 1, + "replicaCount": 3, + }, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceAuthOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.py new file mode 100644 index 000000000000..d00cee29931b --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_create_or_update_service_disable_local_auth.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.services.begin_create_or_update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "location": "westus", + "properties": {"disableLocalAuth": True, "hostingMode": "default", "partitionCount": 1, "replicaCount": 3}, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py index 074757155549..2f9941264396 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py index c08b62a777c8..ca81bd351079 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_cmk_enforcement.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_cmk_enforcement.py new file mode 100644 index 000000000000..df9e485e9c49 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_cmk_enforcement.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_create_or_update_service_with_cmk_enforcement.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.services.begin_create_or_update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "location": "westus", + "properties": { + "encryptionWithCmk": {"enforcement": "Enabled"}, + "hostingMode": "default", + "partitionCount": 1, + "replicaCount": 3, + }, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py index 103769ca3be6..b3fb30cf4fec 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchCreateOrUpdateServiceWithIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceWithIdentity.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py index 5dad25522897..69beedfff28a 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchCreateQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateQueryKey.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py b/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py index 1f51486b1d7d..73fe4287a18c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchDeleteQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchDeleteQueryKey.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py index 343b89671b29..0dcfa2cbe1d6 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchDeleteService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchDeleteService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py b/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py index b91263f10e89..7db1238bd873 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchGetAdminKeys.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetAdminKeys.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py index 8ed7b40f1540..09df6af3aa06 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchGetService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py index 6ce8f5d03d26..fc8f51bc709c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchListQueryKeysBySearchService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListQueryKeysBySearchService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py index e45b9720d44c..0ada50f806a2 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchListServicesByResourceGroup.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListServicesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py index e1a0d430434a..d9b85d8beb45 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchListServicesBySubscription.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListServicesBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py b/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py index c5a2a7906d7c..0f33a958c13f 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchRegenerateAdminKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchRegenerateAdminKey.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py index 35d0f3c567c1..6e377951241c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py new file mode 100644 index 000000000000..cefac91e76d2 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_update_service_auth_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.services.update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "properties": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}}, + "replicaCount": 2, + }, + "tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceAuthOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.py new file mode 100644 index 000000000000..880e0e707bf4 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_update_service_disable_local_auth.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.services.update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "properties": {"disableLocalAuth": True, "replicaCount": 2}, + "tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceDisableLocalAuth.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py index 2f7dcfdc104a..1d095150ca08 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py index 05b981e33de5..a1c03d02847b 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py index 5bdd1dacdc0c..2547cdd49c40 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchUpdateServiceToRemoveIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToRemoveIdentity.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_cmk_enforcement.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_cmk_enforcement.py new file mode 100644 index 000000000000..720191edab95 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_cmk_enforcement.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_update_service_with_cmk_enforcement.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.services.update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "properties": {"encryptionWithCmk": {"enforcement": "Enabled"}, "replicaCount": 2}, + "tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceWithCmkEnforcement.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_update.py b/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py similarity index 93% rename from sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_update.py rename to sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py index bb7fbebd1af9..44510934209a 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_update.py +++ b/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-search # USAGE - python private_endpoint_connection_update.py + python update_private_endpoint_connection.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/UpdatePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/UpdatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/setup.py b/sdk/search/azure-mgmt-search/setup.py index d3d10489f763..e61037530108 100644 --- a/sdk/search/azure-mgmt-search/setup.py +++ b/sdk/search/azure-mgmt-search/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, diff --git a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_admin_keys.json b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_admin_keys.json index 44b64c373315..3d72d7dec6d6 100644 --- a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_admin_keys.json +++ b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_admin_keys.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:33 GMT", + "Date": "Fri, 10 Feb 2023 01:10:08 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.10 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:33 GMT", + "Date": "Fri, 10 Feb 2023 01:10:08 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.10 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,29 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "7e7aaee1-a9ef-4de1-b9eb-2f14f95ea12e", + "client-request-id": "fc2860fb-a518-4ebc-9add-5636ac3a5fc7", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", - "x-client-os": "win32", + "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.18.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "7e7aaee1-a9ef-4de1-b9eb-2f14f95ea12e", + "client-request-id": "fc2860fb-a518-4ebc-9add-5636ac3a5fc7", "Content-Length": "114", - "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-z3hgDXRjlOmrruhZU0aqGw\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:33 GMT", + "Date": "Fri, 10 Feb 2023 01:10:08 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -202,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14059.10 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -214,7 +213,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c44826ac/providers/Microsoft.Search/searchServices/ptvstestquerykeys?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c44826ac/providers/Microsoft.Search/searchServices/ptvstestquerykeys?api-version=2022-09-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -222,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "129", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "westus", @@ -238,19 +237,19 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "512", + "Content-Length": "601", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:39 GMT", - "elapsed-time": "2621", - "ETag": "W/\u0022datetime\u00272022-10-31T07%3A59%3A38.8652Z\u0027\u0022", + "Date": "Fri, 10 Feb 2023 01:10:14 GMT", + "elapsed-time": "3459", + "ETag": "W/\u0022datetime\u00272023-02-10T01%3A10%3A14.0234101Z\u0027\u0022", "Expires": "-1", "Pragma": "no-cache", - "request-id": "f4db53eb-58f1-11ed-9adc-e454e89e61d6", + "request-id": "a9652612-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f7f446f2-69e9-42d7-9f5f-1ba4a971c2fe", + "x-ms-correlation-request-id": "48594c92-eb39-49cb-a68a-8a81aa146a54", "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075939Z:f7f446f2-69e9-42d7-9f5f-1ba4a971c2fe" + "x-ms-routing-request-id": "EASTUS:20230210T011014Z:48594c92-eb39-49cb-a68a-8a81aa146a54" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c44826ac/providers/Microsoft.Search/searchServices/ptvstestquerykeys", @@ -269,7 +268,12 @@ "ipRules": [], "bypass": "None" }, - "privateEndpointConnections": [] + "privateEndpointConnections": [], + "sharedPrivateLinkResources": [], + "disableLocalAuth": false, + "authOptions": { + "apiKeyOnly": {} + } }, "sku": { "name": "free" @@ -277,14 +281,14 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c44826ac/providers/Microsoft.Search/searchServices/ptvstestquerykeys/listAdminKeys?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c44826ac/providers/Microsoft.Search/searchServices/ptvstestquerykeys/listAdminKeys?api-version=2022-09-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -292,11 +296,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:39 GMT", - "elapsed-time": "102", + "Date": "Fri, 10 Feb 2023 01:10:14 GMT", + "elapsed-time": "129", "Expires": "-1", "Pragma": "no-cache", - "request-id": "f89dc16c-58f1-11ed-88d4-e454e89e61d6", + "request-id": "acae5ae6-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -304,9 +308,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d3832c86-6ff4-43b8-997f-37c2f5fe2034", + "x-ms-correlation-request-id": "bc4701c8-53f8-4dd3-9642-3ce950d269c7", "x-ms-ratelimit-remaining-subscription-writes": "1195", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075940Z:d3832c86-6ff4-43b8-997f-37c2f5fe2034" + "x-ms-routing-request-id": "EASTUS:20230210T011015Z:bc4701c8-53f8-4dd3-9642-3ce950d269c7" }, "ResponseBody": { "primaryKey": "primaryKey", @@ -314,14 +318,14 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c44826ac/providers/Microsoft.Search/searchServices/ptvstestquerykeys/regenerateAdminKey/primary?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c44826ac/providers/Microsoft.Search/searchServices/ptvstestquerykeys/regenerateAdminKey/primary?api-version=2022-09-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -329,11 +333,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:40 GMT", - "elapsed-time": "726", + "Date": "Fri, 10 Feb 2023 01:10:15 GMT", + "elapsed-time": "257", "Expires": "-1", "Pragma": "no-cache", - "request-id": "f8f537eb-58f1-11ed-ad4b-e454e89e61d6", + "request-id": "acae5ae7-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -341,9 +345,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "813ac5da-215a-4440-a30c-135bff0b23f9", + "x-ms-correlation-request-id": "beebd45b-8bbb-429b-a906-13f574ef6dd4", "x-ms-ratelimit-remaining-subscription-writes": "1194", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075941Z:813ac5da-215a-4440-a30c-135bff0b23f9" + "x-ms-routing-request-id": "EASTUS:20230210T011015Z:beebd45b-8bbb-429b-a906-13f574ef6dd4" }, "ResponseBody": { "primaryKey": "primaryKey", diff --git a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_query_keys.json b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_query_keys.json index 35a23c08026f..cd167abb1f86 100644 --- a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_query_keys.json +++ b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_query_keys.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -16,14 +16,13 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "1753", - "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-DPQeaFNOT6DLFRXQ9gdDPg\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:16 GMT", + "Date": "Fri, 10 Feb 2023 01:09:56 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.10 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -102,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,14 +110,13 @@ "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", "Content-Length": "945", - "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-qOAUx8gehtwhfHYvevOMsQ\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027; object-src \u0027none\u0027; base-uri \u0027self\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:17 GMT", + "Date": "Fri, 10 Feb 2023 01:09:56 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.10 - KRSLR1 ProdSlices", + "x-ms-ests-server": "2.1.14526.6 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -174,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "5971f960-299c-420d-bec1-cb7061bea36c", + "client-request-id": "5419dd58-3f4e-4dee-9fdd-dee5b343f497", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", - "x-client-os": "win32", + "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.18.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "5971f960-299c-420d-bec1-cb7061bea36c", + "client-request-id": "5419dd58-3f4e-4dee-9fdd-dee5b343f497", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:17 GMT", + "Date": "Fri, 10 Feb 2023 01:09:56 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -203,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14059.10 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -215,7 +213,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c6fd26d9/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c6fd26d9/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy?api-version=2022-09-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -223,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "133", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "westus", @@ -239,19 +237,19 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "522", + "Content-Length": "611", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:23 GMT", - "elapsed-time": "3283", - "ETag": "W/\u0022datetime\u00272022-10-31T07%3A59%3A23.143759Z\u0027\u0022", + "Date": "Fri, 10 Feb 2023 01:10:03 GMT", + "elapsed-time": "4241", + "ETag": "W/\u0022datetime\u00272023-02-10T01%3A10%3A03.5443974Z\u0027\u0022", "Expires": "-1", "Pragma": "no-cache", - "request-id": "eaf270a0-58f1-11ed-924f-e454e89e61d6", + "request-id": "a248ce88-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a868e02b-6f7a-447a-85a5-50d985e85ca9", + "x-ms-correlation-request-id": "d50988a0-1ee6-4c1c-a9e9-8d435ed42bbc", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075924Z:a868e02b-6f7a-447a-85a5-50d985e85ca9" + "x-ms-routing-request-id": "EASTUS:20230210T011004Z:d50988a0-1ee6-4c1c-a9e9-8d435ed42bbc" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c6fd26d9/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy", @@ -270,7 +268,12 @@ "ipRules": [], "bypass": "None" }, - "privateEndpointConnections": [] + "privateEndpointConnections": [], + "sharedPrivateLinkResources": [], + "disableLocalAuth": false, + "authOptions": { + "apiKeyOnly": {} + } }, "sku": { "name": "standard" @@ -278,14 +281,14 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c6fd26d9/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy/createQueryKey/testkey?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c6fd26d9/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy/createQueryKey/testkey?api-version=2022-09-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -293,11 +296,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:24 GMT", - "elapsed-time": "233", + "Date": "Fri, 10 Feb 2023 01:10:04 GMT", + "elapsed-time": "177", "Expires": "-1", "Pragma": "no-cache", - "request-id": "ef509f47-58f1-11ed-a327-e454e89e61d6", + "request-id": "a67a3528-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -305,24 +308,24 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9a395e57-2a66-4064-a46d-9de2381f61c3", + "x-ms-correlation-request-id": "7ef06d9b-ef79-4751-804e-2206166409db", "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075924Z:9a395e57-2a66-4064-a46d-9de2381f61c3" + "x-ms-routing-request-id": "EASTUS:20230210T011004Z:7ef06d9b-ef79-4751-804e-2206166409db" }, "ResponseBody": { "name": "testkey", - "key": "m3kWceDMy85FFG5OYb9XE3jlHuCJo9GVeG1F3g2Tb0AzSeDsmB49" + "key": "xSGZxASHq4ptLtRcNBjnrpZ0jjy8AWIty9L4p11HS8AzSeChXAKJ" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c6fd26d9/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy/listQueryKeys?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/c6fd26d9/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy/listQueryKeys?api-version=2022-09-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -330,11 +333,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:25 GMT", - "elapsed-time": "110", + "Date": "Fri, 10 Feb 2023 01:10:04 GMT", + "elapsed-time": "129", "Expires": "-1", "Pragma": "no-cache", - "request-id": "efc69abe-58f1-11ed-ac01-e454e89e61d6", + "request-id": "a67a3529-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -342,19 +345,19 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8358d890-57c8-490f-b256-7a861d0cfc71", + "x-ms-correlation-request-id": "77f55b6e-a005-4a85-8b60-0c30d287de76", "x-ms-ratelimit-remaining-subscription-writes": "1196", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075925Z:8358d890-57c8-490f-b256-7a861d0cfc71" + "x-ms-routing-request-id": "EASTUS:20230210T011005Z:77f55b6e-a005-4a85-8b60-0c30d287de76" }, "ResponseBody": { "value": [ { "name": null, - "key": "vpnkLaNForIVMXm29YKjD40ppQMD9Cnwp9fCqs6Hy9AzSeCirGzZ" + "key": "bcTh76jvW2CJEwuxYS1rOFcsTju3ra3mHOPyX0Z1O5AzSeDNdvok" }, { "name": "testkey", - "key": "m3kWceDMy85FFG5OYb9XE3jlHuCJo9GVeG1F3g2Tb0AzSeDsmB49" + "key": "xSGZxASHq4ptLtRcNBjnrpZ0jjy8AWIty9L4p11HS8AzSeChXAKJ" } ], "nextLink": null diff --git a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_services.json b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_services.json index 5c9bc2473727..0390d99dbcf5 100644 --- a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_services.json +++ b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.pyTestMgmtSearchtest_search_services.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:58:49 GMT", + "Date": "Fri, 10 Feb 2023 01:09:38 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.10 - SEASLR1 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:58:49 GMT", + "Date": "Fri, 10 Feb 2023 01:09:38 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.14059.10 - SEASLR2 ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "c3f84ded-3b6b-4eca-b7e1-28d127ef9e32", + "client-request-id": "16f173b1-f933-4a7b-bb07-dfc4a7de680f", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.12.0 Python/3.8.4 (Windows-10-10.0.22621-SP0)", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", - "x-client-os": "win32", + "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.18.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "c3f84ded-3b6b-4eca-b7e1-28d127ef9e32", + "client-request-id": "16f173b1-f933-4a7b-bb07-dfc4a7de680f", "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:58:50 GMT", + "Date": "Fri, 10 Feb 2023 01:09:38 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.14059.10 - KRC ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -213,7 +213,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2022-09-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -221,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "52", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "name": "ptvstestsearch", @@ -232,11 +232,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:58:52 GMT", - "elapsed-time": "276", + "Date": "Fri, 10 Feb 2023 01:09:39 GMT", + "elapsed-time": "392", "Expires": "-1", "Pragma": "no-cache", - "request-id": "daa5bb12-58f1-11ed-a65e-e454e89e61d6", + "request-id": "9759bfe6-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -244,9 +244,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fbb97528-e5fd-470a-9c89-95d60ed5aee7", + "x-ms-correlation-request-id": "837b28d2-c5b7-4dee-81cd-4e0d73ba7c73", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075853Z:fbb97528-e5fd-470a-9c89-95d60ed5aee7" + "x-ms-routing-request-id": "EASTUS:20230210T010940Z:837b28d2-c5b7-4dee-81cd-4e0d73ba7c73" }, "ResponseBody": { "nameAvailable": true, @@ -255,7 +255,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2022-09-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -263,7 +263,7 @@ "Connection": "keep-alive", "Content-Length": "133", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "westus", @@ -279,19 +279,19 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "510", + "Content-Length": "599", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:00 GMT", - "elapsed-time": "2923", - "ETag": "W/\u0022datetime\u00272022-10-31T07%3A58%3A59.6387166Z\u0027\u0022", + "Date": "Fri, 10 Feb 2023 01:09:46 GMT", + "elapsed-time": "3795", + "ETag": "W/\u0022datetime\u00272023-02-10T01%3A09%3A46.0843732Z\u0027\u0022", "Expires": "-1", "Pragma": "no-cache", - "request-id": "dcddfae8-58f1-11ed-b9d3-e454e89e61d6", + "request-id": "98312652-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6b4fc720-aec3-4c73-9684-8756a8a0b036", + "x-ms-correlation-request-id": "74f47df5-d5f3-465f-94c1-fc8baffa23df", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075901Z:6b4fc720-aec3-4c73-9684-8756a8a0b036" + "x-ms-routing-request-id": "EASTUS:20230210T010946Z:74f47df5-d5f3-465f-94c1-fc8baffa23df" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch", @@ -310,7 +310,12 @@ "ipRules": [], "bypass": "None" }, - "privateEndpointConnections": [] + "privateEndpointConnections": [], + "sharedPrivateLinkResources": [], + "disableLocalAuth": false, + "authOptions": { + "apiKeyOnly": {} + } }, "sku": { "name": "standard" @@ -318,7 +323,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2022-09-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -326,7 +331,7 @@ "Connection": "keep-alive", "Content-Length": "52", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "name": "ptvstestsearch", @@ -337,11 +342,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:01 GMT", - "elapsed-time": "142", + "Date": "Fri, 10 Feb 2023 01:09:46 GMT", + "elapsed-time": "288", "Expires": "-1", "Pragma": "no-cache", - "request-id": "e18aa18a-58f1-11ed-a1cb-e454e89e61d6", + "request-id": "9c02b93a-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -349,9 +354,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "bd4ee170-ec6b-4f83-b0e6-8099fe950ec5", + "x-ms-correlation-request-id": "ade10d91-b926-4e49-aeea-501fa4e39553", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075901Z:bd4ee170-ec6b-4f83-b0e6-8099fe950ec5" + "x-ms-routing-request-id": "EASTUS:20230210T010947Z:ade10d91-b926-4e49-aeea-501fa4e39553" }, "ResponseBody": { "nameAvailable": false, @@ -360,13 +365,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2022-09-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -374,12 +379,12 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:01 GMT", - "elapsed-time": "52", - "ETag": "W/\u0022datetime\u00272022-10-31T07%3A58%3A59.6387166Z\u0027\u0022", + "Date": "Fri, 10 Feb 2023 01:09:47 GMT", + "elapsed-time": "170", + "ETag": "W/\u0022datetime\u00272023-02-10T01%3A09%3A46.0843732Z\u0027\u0022", "Expires": "-1", "Pragma": "no-cache", - "request-id": "e1ced2eb-58f1-11ed-8a00-e454e89e61d6", + "request-id": "9c02b93b-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -387,9 +392,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "304690eb-8336-4a8c-ad47-9b4cbe34a08a", + "x-ms-correlation-request-id": "98f9357c-c360-467d-a2ee-1479b87802ed", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075902Z:304690eb-8336-4a8c-ad47-9b4cbe34a08a" + "x-ms-routing-request-id": "EASTUS:20230210T010947Z:98f9357c-c360-467d-a2ee-1479b87802ed" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch", @@ -408,7 +413,12 @@ "ipRules": [], "bypass": "None" }, - "privateEndpointConnections": [] + "privateEndpointConnections": [], + "sharedPrivateLinkResources": [], + "disableLocalAuth": false, + "authOptions": { + "apiKeyOnly": {} + } }, "sku": { "name": "standard" @@ -416,13 +426,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices?api-version=2022-09-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -430,11 +440,11 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 31 Oct 2022 07:59:01 GMT", - "elapsed-time": "86", + "Date": "Fri, 10 Feb 2023 01:09:47 GMT", + "elapsed-time": "227", "Expires": "-1", "Pragma": "no-cache", - "request-id": "e2209571-58f1-11ed-95bc-e454e89e61d6", + "request-id": "9c02b93c-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": [ @@ -442,9 +452,9 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5bb6158a-feff-465a-a2e3-e51ff6cd37ba", + "x-ms-correlation-request-id": "48040cdc-096d-41fb-a416-10e93b212f85", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075902Z:5bb6158a-feff-465a-a2e3-e51ff6cd37ba" + "x-ms-routing-request-id": "EASTUS:20230210T010947Z:48040cdc-096d-41fb-a416-10e93b212f85" }, "ResponseBody": { "value": [ @@ -466,7 +476,12 @@ "bypass": "None" }, "privateEndpointConnections": [], - "eTag": "W/\u0022datetime\u00272022-10-31T07%3A58%3A59.6387166Z\u0027\u0022" + "sharedPrivateLinkResources": [], + "eTag": "W/\u0022datetime\u00272023-02-10T01%3A09%3A46.0843732Z\u0027\u0022", + "disableLocalAuth": false, + "authOptions": { + "apiKeyOnly": {} + } }, "sku": { "name": "standard" @@ -477,30 +492,30 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2020-03-13", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/772d25ec/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2022-09-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-search/9.0.0b1 Python/3.8.4 (Windows-10-10.0.22621-SP0)" + "User-Agent": "azsdk-python-mgmt-search/9.0.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Mon, 31 Oct 2022 07:59:08 GMT", - "elapsed-time": "1408", + "Date": "Fri, 10 Feb 2023 01:09:52 GMT", + "elapsed-time": "2301", "Expires": "-1", "Pragma": "no-cache", - "request-id": "e25dd066-58f1-11ed-943c-e454e89e61d6", + "request-id": "9c02b93d-a8df-11ed-bcda-a7a062f181c1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "067d6ff5-a1aa-4ef6-b878-25e774b0374d", + "x-ms-correlation-request-id": "d0fca5c8-ec4f-45d1-9826-8ff50ede4d12", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "SOUTHEASTASIA:20221031T075908Z:067d6ff5-a1aa-4ef6-b878-25e774b0374d" + "x-ms-routing-request-id": "EASTUS:20230210T010953Z:d0fca5c8-ec4f-45d1-9826-8ff50ede4d12" }, "ResponseBody": null } diff --git a/sdk/search/azure-search-documents/pyproject.toml b/sdk/search/azure-search-documents/pyproject.toml new file mode 100644 index 000000000000..4b50916e3e10 --- /dev/null +++ b/sdk/search/azure-search-documents/pyproject.toml @@ -0,0 +1,3 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false diff --git a/sdk/security/azure-mgmt-security/CHANGELOG.md b/sdk/security/azure-mgmt-security/CHANGELOG.md index 9628dc43d174..372ae86d8dcd 100644 --- a/sdk/security/azure-mgmt-security/CHANGELOG.md +++ b/sdk/security/azure-mgmt-security/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 4.0.0b1 (2023-02-16) + +### Features Added + + - Added operation GovernanceRulesOperations.begin_execute + - Added operation GovernanceRulesOperations.list + - Added operation GovernanceRulesOperations.operation_results + - Model GovernanceRule has a new parameter excluded_scopes + - Model GovernanceRule has a new parameter include_member_scopes + - Model GovernanceRule has a new parameter metadata + - Model GovernanceRule has a new parameter tenant_id + +### Breaking Changes + + - Operation GovernanceRulesOperations.create_or_update has a new required parameter scope + - Operation GovernanceRulesOperations.get has a new required parameter scope + - Removed operation GovernanceRulesOperations.begin_rule_id_execute_single_security_connector + - Removed operation GovernanceRulesOperations.begin_rule_id_execute_single_subscription + - Removed operation group GovernanceRuleOperations + - Removed operation group SecurityConnectorGovernanceRuleOperations + - Removed operation group SecurityConnectorGovernanceRulesExecuteStatusOperations + - Removed operation group SecurityConnectorGovernanceRulesOperations + - Removed operation group SubscriptionGovernanceRulesExecuteStatusOperations + - Renamed operation GovernanceRulesOperations.delete to GovernanceRulesOperations.begin_delete + ## 3.0.0 (2022-11-17) ### Features Added diff --git a/sdk/security/azure-mgmt-security/README.md b/sdk/security/azure-mgmt-security/README.md index 8649cefa0e40..6e7f10301c42 100644 --- a/sdk/security/azure-mgmt-security/README.md +++ b/sdk/security/azure-mgmt-security/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Security Center Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-security +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = SecurityCenter(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Security Center Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/security/azure-mgmt-security/_meta.json b/sdk/security/azure-mgmt-security/_meta.json index a57d3149f444..3c413ac8367c 100644 --- a/sdk/security/azure-mgmt-security/_meta.json +++ b/sdk/security/azure-mgmt-security/_meta.json @@ -1,11 +1,11 @@ { - "commit": "8a20cee044fafde7ae0364edab45a577aa80d20f", + "commit": "51d4c24a011e300b9713179e0515fef35bf3f678", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/security/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py index 065a74405620..0bfeac5dfa1e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py @@ -36,9 +36,8 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -53,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py index a9cabbbfa717..d57ef4c5c1fb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py @@ -77,7 +77,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'discovered_security_solutions': '2020-01-01', 'external_security_solutions': '2020-01-01', 'governance_assignments': '2022-01-01-preview', - 'governance_rule': '2022-01-01-preview', 'governance_rules': '2022-01-01-preview', 'information_protection_policies': '2017-08-01-preview', 'ingestion_settings': '2021-01-15-preview', @@ -96,9 +95,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'secure_score_control_definitions': '2020-01-01', 'secure_score_controls': '2020-01-01', 'secure_scores': '2020-01-01', - 'security_connector_governance_rule': '2022-01-01-preview', - 'security_connector_governance_rules': '2022-01-01-preview', - 'security_connector_governance_rules_execute_status': '2022-01-01-preview', 'security_contacts': '2017-08-01-preview', 'security_solutions': '2020-01-01', 'security_solutions_reference_data': '2020-01-01', @@ -108,7 +104,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'sql_vulnerability_assessment_scan_results': '2020-07-01-preview', 'sql_vulnerability_assessment_scans': '2020-07-01-preview', 'sub_assessments': '2019-01-01-preview', - 'subscription_governance_rules_execute_status': '2022-01-01-preview', 'tasks': '2015-06-01-preview', 'topology': '2020-01-01', 'workspace_settings': '2017-08-01-preview', @@ -120,10 +115,10 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version=None, # type: Optional[str] + api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = SecurityCenterConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -542,20 +537,6 @@ def governance_assignments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GovernanceRuleOperations` - """ - api_version = self._get_api_version('governance_rule') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import GovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def governance_rules(self): """Instance depends on the API version: @@ -839,48 +820,6 @@ def security_connector_applications(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def security_connector_governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRuleOperations` - """ - api_version = self._get_api_version('security_connector_governance_rule') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRulesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def security_connectors(self): """Instance depends on the API version: @@ -1047,20 +986,6 @@ def sub_assessments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def subscription_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SubscriptionGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('subscription_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SubscriptionGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'subscription_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def tasks(self): """Instance depends on the API version: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py index 240df16c57f3..25467dfc00bb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,34 +38,50 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull -_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") # Name used in context CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -75,12 +92,12 @@ def deserialize_from_text(cls, data, content_type=None): :type data: str or bytes or IO :param str content_type: The content type. """ - if hasattr(data, 'read'): + if hasattr(data, "read"): # Assume a stream data = cast(IO, data).read() if isinstance(data, bytes): - data_as_str = data.decode(encoding='utf-8-sig') + data_as_str = data.decode(encoding="utf-8-sig") else: # Explain to mypy the correct type. data_as_str = cast(str, data) @@ -116,7 +133,8 @@ def _json_attemp(data): try: return True, json.loads(data) except ValueError: - return False, None # Don't care about this one + return False, None # Don't care about this one + success, json_result = _json_attemp(data) if success: return json_result @@ -129,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -139,8 +156,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): """ # Try to use content-type from headers if available content_type = None - if 'content-type' in headers: - content_type = headers['content-type'].split(";")[0].strip().lower() + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() # Ouch, this server did not declare what it sent... # Let's guess it's JSON... # Also, since Autorest was considering that an empty body was a valid JSON, @@ -152,20 +169,22 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return cls.deserialize_from_text(body_bytes, content_type) return None + try: basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) try: - _long_type = long # type: ignore + _long_type = long # type: ignore except NameError: _long_type = int + class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" @@ -181,9 +200,11 @@ def dst(self, dt): """No daylight saving for UTC.""" return datetime.timedelta(hours=1) + try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore """Fixed offset in minutes east from UTC. Copy/pasted from Python doc @@ -197,7 +218,7 @@ def utcoffset(self, dt): return self.__offset def tzname(self, dt): - return str(self.__offset.total_seconds()/3600) + return str(self.__offset.total_seconds() / 3600) def __repr__(self): return "".format(self.tzname(None)) @@ -208,14 +229,17 @@ def dst(self, dt): def __getinitargs__(self): return (self.__offset,) + try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore _FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -276,47 +304,42 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): - cls._attribute_map['additional_properties'] = {'key': '', 'type': '{object}'} + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @classmethod def _create_xml_node(cls): - """Create XML node. - """ + """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} - return _create_xml_node( - xml_map.get('name', cls.__name__), - xml_map.get("prefix", None), - xml_map.get("ns", None) - ) + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -330,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -367,7 +397,7 @@ def my_key_transformer(key, attr_desc, value): @classmethod def _infer_class_models(cls): try: - str_models = cls.__module__.rsplit('.', 1)[0] + str_models = cls.__module__.rsplit(".", 1)[0] models = sys.modules[str_models] client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: @@ -378,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -390,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -403,16 +438,20 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = [ - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor - ] if key_extractors is None else key_extractors + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) return deserializer(cls.__name__, data, content_type=content_type) @classmethod def _flatten_subtype(cls, key, objects): - if '_subtype_map' not in cls.__dict__: + if "_subtype_map" not in cls.__dict__: return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): @@ -425,18 +464,14 @@ def _classify(cls, response, objects): We want to ignore any inherited _subtype_maps. Remove the polymorphic key from the initial data. """ - for subtype_key in cls.__dict__.get('_subtype_map', {}).keys(): + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) else: - subtype_value = xml_key_extractor( - subtype_key, - cls._attribute_map[subtype_key], - response - ) + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: # Try to match base class. Can be class name only # (bug to fix in Autorest to support x-ms-discriminator-name) @@ -444,7 +479,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -453,11 +488,7 @@ def _classify(cls, response, objects): ) break else: - _LOGGER.warning( - "Discriminator %s is absent or null, use base class %s.", - subtype_key, - cls.__name__ - ) + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) break return cls @@ -468,29 +499,40 @@ def _get_rest_key_parts(cls, attr_key): :returns: A list of RestAPI part :rtype: list """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]['key']) + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] def _decode_attribute_map_key(key): """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. + inside the received data. - :param str key: A key string from the generated code + :param str key: A key string from the generated code """ - return key.replace('\\.', '.') + return key.replace("\\.", ".") class Serializer(object): """Request object model serializer.""" - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} - - _xml_basic_types_serializers = {'bool': lambda x:str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", - 4: "Fri", 5: "Sat", 6: "Sun"} - months = {1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", - 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec"} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } validation = { "min_length": lambda x, y: len(x) < y, "max_length": lambda x, y: len(x) > y, @@ -502,26 +544,26 @@ class Serializer(object): "max_items": lambda x, y: len(x) > y, "pattern": lambda x, y: not re.match(y, x, re.UNICODE), "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0 - } + "multiple": lambda x, y: x % y != 0, + } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { - 'iso-8601': Serializer.serialize_iso, - 'rfc-1123': Serializer.serialize_rfc, - 'unix-time': Serializer.serialize_unix, - 'duration': Serializer.serialize_duration, - 'date': Serializer.serialize_date, - 'time': Serializer.serialize_time, - 'decimal': Serializer.serialize_decimal, - 'long': Serializer.serialize_long, - 'bytearray': Serializer.serialize_bytearray, - 'base64': Serializer.serialize_base64, - 'object': self.serialize_object, - '[]': self.serialize_iter, - '{}': self.serialize_dict - } - self.dependencies = dict(classes) if classes else {} + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -542,14 +584,12 @@ def _serialize(self, target_obj, data_type=None, **kwargs): class_name = target_obj.__class__.__name__ if data_type: - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) if not hasattr(target_obj, "_attribute_map"): data_type = type(target_obj).__name__ if data_type in self.basic_types.values(): - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) # Force "is_xml" kwargs if we detect a XML model try: @@ -564,10 +604,10 @@ def _serialize(self, target_obj, data_type=None, **kwargs): attributes = target_obj._attribute_map for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): continue - if attr_name == "additional_properties" and attr_desc["key"] == '': + if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: serialized.update(target_obj.additional_properties) continue @@ -575,68 +615,60 @@ def _serialize(self, target_obj, data_type=None, **kwargs): orig_attr = getattr(target_obj, attr) if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) keys = keys if isinstance(keys, list) else [keys] - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) - + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) if is_xml_model_serialization: - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) - xml_prefix = xml_desc.get('prefix', None) - xml_ns = xml_desc.get('ns', None) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if 'name' not in getattr(orig_attr, '_xml_map', {}): + if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace + if len(splitted_tag) == 2: # Namespace new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary - local_node = _create_xml_node( - xml_name, - xml_prefix, - xml_ns - ) + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format( - attr_name, class_name, str(target_obj)) + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise_with_traceback(SerializationError, msg, err) else: return serialized @@ -652,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip('[]{}') - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -668,19 +700,18 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: deserializer.key_extractors = [ rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor + last_rest_key_case_insensitive_extractor, ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback( - SerializationError, "Unable to build a model: "+str(err), err) + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) return self._serialize(data, data_type, **kwargs) @@ -695,13 +726,13 @@ def url(self, name, data, data_type, **kwargs): """ try: output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -720,27 +751,19 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [ - self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" - for d - in data - ] - if not kwargs.get('skip_quote', False): - data = [ - quote(str(d), safe='') - for d - in data - ] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] return str(self.serialize_iter(data, internal_data_type, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -756,11 +779,11 @@ def header(self, name, data, data_type, **kwargs): :raises: ValueError if data is None """ try: - if data_type in ['[str]']: + if data_type in ["[str]"]: data = ["" if d is None else d for d in data] output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) @@ -782,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -796,13 +821,11 @@ def serialize_data(self, data, data_type, **kwargs): iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: - return self.serialize_type[iter_type]( - data, data_type[1:-1], **kwargs) + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback( - SerializationError, msg.format(data, data_type), err) + raise_with_traceback(SerializationError, msg.format(data, data_type), err) else: return self._serialize(data, **kwargs) @@ -829,7 +852,7 @@ def serialize_basic(cls, data, data_type, **kwargs): custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) - if data_type == 'str': + if data_type == "str": return cls.serialize_unicode(data) return eval(data_type)(data) # nosec @@ -847,7 +870,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -886,25 +909,21 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialized.append(None) if div: - serialized = ['' if s is None else str(s) for s in serialized] + serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) - if 'xml' in serialization_ctxt or is_xml: + if "xml" in serialization_ctxt or is_xml: # XML serialization is more complicated - xml_desc = serialization_ctxt.get('xml', {}) - xml_name = xml_desc.get('name') + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") if not xml_name: - xml_name = serialization_ctxt['key'] + xml_name = serialization_ctxt["key"] # Create a wrap node if necessary (use the fact that Element and list have "append") is_wrapped = xml_desc.get("wrapped", False) node_name = xml_desc.get("itemsName", xml_name) if is_wrapped: - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) else: final_result = [] # All list elements to "local_node" @@ -912,11 +931,7 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): if isinstance(el, ET.Element): el_node = el else: - el_node = _create_xml_node( - node_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) if el is not None: # Otherwise it writes "None" :-p el_node.text = str(el) final_result.append(el_node) @@ -936,21 +951,16 @@ def serialize_dict(self, attr, dict_type, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_data( - value, dict_type, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None - if 'xml' in serialization_ctxt: + if "xml" in serialization_ctxt: # XML serialization is more complicated - xml_desc = serialization_ctxt['xml'] - xml_name = xml_desc['name'] + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) for key, value in serialized.items(): ET.SubElement(final_result, key).text = value return final_result @@ -996,8 +1006,7 @@ def serialize_object(self, attr, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_object( - value, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None return serialized @@ -1006,8 +1015,7 @@ def serialize_object(self, attr, **kwargs): serialized = [] for obj in attr: try: - serialized.append(self.serialize_object( - obj, **kwargs)) + serialized.append(self.serialize_object(obj, **kwargs)) except ValueError: pass return serialized @@ -1020,10 +1028,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1045,8 +1053,8 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr).decode('ascii') - return encoded.strip('=').replace('+', '-').replace('/', '_') + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod def serialize_decimal(attr, **kwargs): @@ -1113,16 +1121,20 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], utc.tm_mday, - Serializer.months[utc.tm_mon], utc.tm_year, - utc.tm_hour, utc.tm_min, utc.tm_sec) + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) @staticmethod def serialize_iso(attr, **kwargs): @@ -1136,19 +1148,18 @@ def serialize_iso(attr, **kwargs): attr = isodate.parse_datetime(attr) try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") - microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") if microseconds: - microseconds = '.'+microseconds + microseconds = "." + microseconds date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, - utc.tm_hour, utc.tm_min, utc.tm_sec) - return date + microseconds + 'Z' + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) @@ -1169,18 +1180,19 @@ def serialize_unix(attr, **kwargs): return attr try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") + def rest_key_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: - dict_keys = _FLATTEN.split(key) + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1191,15 +1203,16 @@ def rest_key_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) return working_data.get(key) + def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1211,30 +1224,33 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) if working_data: return attribute_key_case_insensitive_extractor(key, None, working_data) + def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - """ - key = attr_desc['key'] + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) + def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" """ - key = attr_desc['key'] + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + def attribute_key_extractor(attr, _, data): return data.get(attr) + def attribute_key_case_insensitive_extractor(attr, _, data): found_key = None lower_attr = attr.lower() @@ -1245,6 +1261,7 @@ def attribute_key_case_insensitive_extractor(attr, _, data): return data.get(found_key) + def _extract_name_from_internal_type(internal_type): """Given an internal type XML description, extract correct XML name with namespace. @@ -1253,7 +1270,7 @@ def _extract_name_from_internal_type(internal_type): :returns: A tuple XML name + namespace dict """ internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1268,17 +1285,17 @@ def xml_key_extractor(attr, attr_desc, data): if not isinstance(data, ET.Element): return None - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) # Look for a children - is_iter_type = attr_desc['type'].startswith("[") + is_iter_type = attr_desc["type"].startswith("[") is_wrapped = xml_desc.get("wrapped", False) internal_type = attr_desc.get("internalType", None) internal_type_xml_map = getattr(internal_type, "_xml_map", {}) # Integrate namespace if necessary - xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1294,15 +1311,15 @@ def xml_key_extractor(attr, attr_desc, data): # - Wrapped node # - Internal type is an enum (considered basic types) # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): children = data.findall(xml_name) # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: xml_name = _extract_name_from_internal_type(internal_type) children = data.findall(xml_name) # That's an array else: - if internal_type: # Complex type, ignore itemsName and use the complex type name + if internal_type: # Complex type, ignore itemsName and use the complex type name items_name = _extract_name_from_internal_type(internal_type) else: items_name = xml_desc.get("itemsName", xml_name) @@ -1311,21 +1328,22 @@ def xml_key_extractor(attr, attr_desc, data): if len(children) == 0: if is_iter_type: if is_wrapped: - return None # is_wrapped no node, we want None + return None # is_wrapped no node, we want None else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) + else: # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name - )) + ) + ) return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty @@ -1333,6 +1351,7 @@ def xml_key_extractor(attr, attr_desc, data): raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) return children[0] + class Deserializer(object): """Response object model deserializer. @@ -1340,37 +1359,32 @@ class Deserializer(object): :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. """ - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile( - r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' - r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { - 'iso-8601': Deserializer.deserialize_iso, - 'rfc-1123': Deserializer.deserialize_rfc, - 'unix-time': Deserializer.deserialize_unix, - 'duration': Deserializer.deserialize_duration, - 'date': Deserializer.deserialize_date, - 'time': Deserializer.deserialize_time, - 'decimal': Deserializer.deserialize_decimal, - 'long': Deserializer.deserialize_long, - 'bytearray': Deserializer.deserialize_bytearray, - 'base64': Deserializer.deserialize_base64, - 'object': self.deserialize_object, - '[]': self.deserialize_iter, - '{}': self.deserialize_dict - } + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } self.deserialize_expected_types = { - 'duration': (isodate.Duration, datetime.timedelta), - 'iso-8601': (datetime.datetime) + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [ - rest_key_extractor, - xml_key_extractor - ] + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much # complicated, with no real scenario for now. @@ -1403,8 +1417,7 @@ def _deserialize(self, target_obj, data): """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, '_validation', {}).items() - if config.get('constant')] + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: for attr, mapconfig in data._attribute_map.items(): if attr in constants: @@ -1412,15 +1425,11 @@ def _deserialize(self, target_obj, data): value = getattr(data, attr) if value is None: continue - local_type = mapconfig['type'] - internal_data_type = local_type.strip('[]{}') + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): continue - setattr( - data, - attr, - self._deserialize(local_type, value) - ) + setattr(data, attr, self._deserialize(local_type, value)) return data except AttributeError: return @@ -1435,16 +1444,16 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == '': + if attr == "additional_properties" and attr_desc["key"] == "": continue raw_value = None # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip('[]{}') + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") if internal_data_type in self.dependencies: attr_desc["internalType"] = self.dependencies[internal_data_type] @@ -1452,21 +1461,18 @@ def _deserialize(self, target_obj, data): found_value = key_extractor(attr, attr_desc, data) if found_value is not None: if raw_value is not None and raw_value != found_value: - msg = ("Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" ) - _LOGGER.warning( - msg, - found_value, - key_extractor, - attr + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning(msg, found_value, key_extractor, attr) continue raw_value = found_value - value = self.deserialize_data(raw_value, attr_desc['type']) + value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1475,14 +1481,17 @@ def _deserialize(self, target_obj, data): def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": # Check empty string. If it's not empty, someone has a real "additionalProperties" return None if isinstance(data, ET.Element): data = {el.tag: el.text for el in data} - known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) - for desc in attribute_map.values() if desc['key'] != ''} + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } present_keys = set(data.keys()) missing_keys = present_keys - known_keys return {key: data[key] for key in missing_keys} @@ -1493,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1508,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1518,15 +1527,14 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: return self(target_obj, data, content_type=content_type) except: _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None @@ -1554,22 +1562,16 @@ def _unpack_content(raw_data, content_type=None): return context[RawDeserializer.CONTEXT_NAME] raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - #Assume this is enough to recognize universal_http.ClientResponse without importing it + # Assume this is enough to recognize universal_http.ClientResponse without importing it if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text(), - raw_data.headers - ) + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, '_content_consumed'): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text, - raw_data.headers - ) + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1579,14 +1581,11 @@ def _instantiate_model(self, response, attrs, additional_properties=None): :param d_attrs: The deserialized response attributes. """ if callable(response): - subtype = getattr(response, '_subtype_map', {}) + subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() - if v.get('readonly')] - const = [k for k, v in response._validation.items() - if v.get('constant')] - kwargs = {k: v for k, v in attrs.items() - if k not in subtype and k not in readonly + const} + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) @@ -1594,8 +1593,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format( - kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1659,13 +1657,10 @@ def deserialize_iter(self, attr, iter_type): """ if attr is None: return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children + if isinstance(attr, ET.Element): # If I receive an element here, get the children attr = list(attr) if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( - iter_type, - type(attr) - )) + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) return [self.deserialize_data(a, iter_type) for a in attr] def deserialize_dict(self, attr, dict_type): @@ -1677,7 +1672,7 @@ def deserialize_dict(self, attr, dict_type): :rtype: dict """ if isinstance(attr, list): - return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} if isinstance(attr, ET.Element): # Transform value into {"Key": "value"} @@ -1698,7 +1693,7 @@ def deserialize_object(self, attr, **kwargs): # Do no recurse on XML, just return the tree as-is return attr if isinstance(attr, basestring): - return self.deserialize_basic(attr, 'str') + return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: return self.deserialize_basic(attr, self.basic_types[obj_type]) @@ -1709,8 +1704,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = {} for key, value in attr.items(): try: - deserialized[key] = self.deserialize_object( - value, **kwargs) + deserialized[key] = self.deserialize_object(value, **kwargs) except ValueError: deserialized[key] = None return deserialized @@ -1719,8 +1713,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = [] for obj in attr: try: - deserialized.append(self.deserialize_object( - obj, **kwargs)) + deserialized.append(self.deserialize_object(obj, **kwargs)) except ValueError: pass return deserialized @@ -1747,23 +1740,23 @@ def deserialize_basic(self, attr, data_type): if not attr: if data_type == "str": # None or '', node is empty string. - return '' + return "" else: # None or '', node with a strong type is None. # Don't try to model "empty bool" or "empty int" return None - if data_type == 'bool': + if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) elif isinstance(attr, basestring): - if attr.lower() in ['true', '1']: + if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ['false', '0']: + elif attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) - if data_type == 'str': + if data_type == "str": return self.deserialize_unicode(attr) return eval(data_type)(attr) # nosec @@ -1782,7 +1775,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1833,7 +1826,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1845,9 +1838,9 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = '=' * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace('-', '+').replace('_', '/') + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @staticmethod @@ -1861,7 +1854,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1876,7 +1869,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1890,7 +1883,7 @@ def deserialize_duration(attr): attr = attr.text try: duration = isodate.parse_duration(attr) - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1906,7 +1899,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1921,7 +1914,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1936,10 +1929,9 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], - tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -1960,12 +1952,12 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) - check_decimal = attr.split('.') + check_decimal = attr.split(".") if len(check_decimal) > 1: decimal_str = "" for digit in check_decimal[1]: @@ -1980,7 +1972,7 @@ def deserialize_iso(attr): test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1996,7 +1988,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py index 1e7bb939778c..f085bcc1fe5d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py index 88bde0dbc421..cbeead71e00f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py @@ -77,7 +77,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'discovered_security_solutions': '2020-01-01', 'external_security_solutions': '2020-01-01', 'governance_assignments': '2022-01-01-preview', - 'governance_rule': '2022-01-01-preview', 'governance_rules': '2022-01-01-preview', 'information_protection_policies': '2017-08-01-preview', 'ingestion_settings': '2021-01-15-preview', @@ -96,9 +95,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'secure_score_control_definitions': '2020-01-01', 'secure_score_controls': '2020-01-01', 'secure_scores': '2020-01-01', - 'security_connector_governance_rule': '2022-01-01-preview', - 'security_connector_governance_rules': '2022-01-01-preview', - 'security_connector_governance_rules_execute_status': '2022-01-01-preview', 'security_contacts': '2017-08-01-preview', 'security_solutions': '2020-01-01', 'security_solutions_reference_data': '2020-01-01', @@ -108,7 +104,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'sql_vulnerability_assessment_scan_results': '2020-07-01-preview', 'sql_vulnerability_assessment_scans': '2020-07-01-preview', 'sub_assessments': '2019-01-01-preview', - 'subscription_governance_rules_execute_status': '2022-01-01-preview', 'tasks': '2015-06-01-preview', 'topology': '2020-01-01', 'workspace_settings': '2017-08-01-preview', @@ -123,7 +118,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = SecurityCenterConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -542,20 +537,6 @@ def governance_assignments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GovernanceRuleOperations` - """ - api_version = self._get_api_version('governance_rule') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import GovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def governance_rules(self): """Instance depends on the API version: @@ -839,48 +820,6 @@ def security_connector_applications(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def security_connector_governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRuleOperations` - """ - api_version = self._get_api_version('security_connector_governance_rule') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRulesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def security_connectors(self): """Instance depends on the API version: @@ -1047,20 +986,6 @@ def sub_assessments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def subscription_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SubscriptionGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('subscription_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SubscriptionGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'subscription_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def tasks(self): """Instance depends on the API version: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py index c5a559682c88..9b461ff85596 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: Literal["2015-06-01-preview"] + api_version: Literal["2015-06-01-preview"] = kwargs.pop("api_version", "2015-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json index 251d12e3010f..74a5f9aa461b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py index ac8a0bbd061b..2c1ba8059d29 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import LocationsOperations, Operations, TasksOperations @@ -52,7 +52,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -82,15 +82,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py index acdf00c88a84..bce3cb945a73 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: Literal["2015-06-01-preview"] + api_version: Literal["2015-06-01-preview"] = kwargs.pop("api_version", "2015-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py index f2384c2be350..1866c0a8886d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import LocationsOperations, Operations, TasksOperations @@ -52,7 +52,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -89,5 +89,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py index 85fff64e04d6..8e1c2e52e196 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._tasks_operations import TasksOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py index 8192e2fba9ae..e15ffc68efa5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py @@ -73,10 +73,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocationList] + ) + cls: ClsType[_models.AscLocationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -97,7 +97,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -113,7 +113,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +121,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AscLocationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +140,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} @distributed_trace_async async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: @@ -165,10 +165,10 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocation] + ) + cls: ClsType[_models.AscLocation] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -179,9 +179,9 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,4 +198,4 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py index 29ad792ed595..58597ddf56a5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py @@ -70,10 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] + ) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,4 +136,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/operations"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py index b29058c24837..c70a4822519c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py @@ -81,10 +81,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,7 +106,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -122,7 +122,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,13 +130,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -149,7 +149,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} @distributed_trace def list_by_home_region( @@ -171,10 +171,10 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -197,7 +197,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -213,7 +213,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -221,13 +221,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -240,7 +240,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace_async async def get_subscription_level_task( @@ -269,10 +271,10 @@ async def get_subscription_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_subscription_level_task_request( asc_location=asc_location, @@ -284,9 +286,9 @@ async def get_subscription_level_task( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -303,7 +305,9 @@ async def get_subscription_level_task( return deserialized - get_subscription_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_subscription_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace_async async def update_subscription_level_task_state( # pylint: disable=inconsistent-return-statements @@ -340,10 +344,10 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_task_state_request( asc_location=asc_location, @@ -356,9 +360,9 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -371,7 +375,9 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_subscription_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } @distributed_trace def list_by_resource_group( @@ -396,10 +402,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -423,7 +429,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -439,7 +445,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -447,13 +453,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -466,7 +472,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace_async async def get_resource_group_level_task( @@ -498,10 +506,10 @@ async def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_resource_group_level_task_request( resource_group_name=resource_group_name, @@ -514,9 +522,9 @@ async def get_resource_group_level_task( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -533,7 +541,9 @@ async def get_resource_group_level_task( return deserialized - get_resource_group_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_resource_group_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace_async async def update_resource_group_level_task_state( # pylint: disable=inconsistent-return-statements @@ -574,10 +584,10 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_task_state_request( resource_group_name=resource_group_name, @@ -591,9 +601,9 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -606,4 +616,6 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_resource_group_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py index b37bdd7f8291..66eeb1a94bdd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py @@ -20,7 +20,7 @@ from ._security_center_enums import TaskUpdateActionType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py index 01d1fdf0e11b..d44f89cb8219 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py @@ -48,7 +48,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -84,7 +84,7 @@ class AscLocation(Resource): "properties": {"key": "properties", "type": "object"}, } - def __init__(self, *, properties: Optional[JSON] = None, **kwargs): + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword properties: An empty set of properties. :paramtype properties: JSON @@ -114,7 +114,7 @@ class AscLocationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -155,7 +155,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -186,7 +186,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -217,7 +217,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Security operation display. :paramtype display: ~azure.mgmt.security.v2015_06_01_preview.models.OperationDisplay @@ -257,7 +257,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -286,7 +286,7 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Security operations. :paramtype value: list[~azure.mgmt.security.v2015_06_01_preview.models.Operation] @@ -342,7 +342,9 @@ class SecurityTask(Resource): "sub_state": {"key": "properties.subState", "type": "str"}, } - def __init__(self, *, security_task_parameters: Optional["_models.SecurityTaskParameters"] = None, **kwargs): + def __init__( + self, *, security_task_parameters: Optional["_models.SecurityTaskParameters"] = None, **kwargs: Any + ) -> None: """ :keyword security_task_parameters: Changing set of properties, depending on the task type that is derived from the name field. @@ -378,7 +380,7 @@ class SecurityTaskList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -406,7 +408,7 @@ class SecurityTaskParameters(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py index 85fff64e04d6..8e1c2e52e196 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py @@ -11,7 +11,7 @@ from ._tasks_operations import TasksOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py index a6ae0bc51282..9d9391357360 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(asc_location: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_get_request(asc_location: str, subscription_id: str, **kwargs: Any) -> "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,10 +134,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocationList] + ) + cls: ClsType[_models.AscLocationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -158,7 +158,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -174,7 +174,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -182,13 +182,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AscLocationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -201,7 +201,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} @distributed_trace def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: @@ -226,10 +226,10 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocation] + ) + cls: ClsType[_models.AscLocation] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -240,9 +240,9 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -259,4 +259,4 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py index 49b52920f5cf..1a99a755c7b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py @@ -45,9 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +93,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] + ) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +116,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +132,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,13 +140,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -159,4 +159,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/operations"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py index bd53fab9ae24..68b2b57bcb57 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,9 +77,9 @@ def build_list_by_home_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_list_by_home_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,9 +112,9 @@ def build_get_subscription_level_task_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_get_subscription_level_task_request( "taskName": _SERIALIZER.url("task_name", task_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,9 +151,9 @@ def build_update_subscription_level_task_state_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +170,7 @@ def build_update_subscription_level_task_state_request( "taskUpdateActionType": _SERIALIZER.url("task_update_action_type", task_update_action_type, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,9 +187,9 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_list_by_resource_group_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_get_resource_group_level_task_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,7 +247,7 @@ def build_get_resource_group_level_task_request( "taskName": _SERIALIZER.url("task_name", task_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,9 +269,9 @@ def build_update_resource_group_level_task_state_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +291,7 @@ def build_update_resource_group_level_task_state_request( "taskUpdateActionType": _SERIALIZER.url("task_update_action_type", task_update_action_type, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -336,10 +336,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -361,7 +361,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -377,7 +377,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -385,13 +385,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -404,7 +404,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} @distributed_trace def list_by_home_region( @@ -426,10 +426,10 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -452,7 +452,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -468,7 +468,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -476,13 +476,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -495,7 +495,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace def get_subscription_level_task(self, asc_location: str, task_name: str, **kwargs: Any) -> _models.SecurityTask: @@ -522,10 +524,10 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_subscription_level_task_request( asc_location=asc_location, @@ -537,9 +539,9 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -556,7 +558,9 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg return deserialized - get_subscription_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_subscription_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace def update_subscription_level_task_state( # pylint: disable=inconsistent-return-statements @@ -593,10 +597,10 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_task_state_request( asc_location=asc_location, @@ -609,9 +613,9 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -624,7 +628,9 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - update_subscription_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_subscription_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } @distributed_trace def list_by_resource_group( @@ -649,10 +655,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -676,7 +682,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -692,7 +698,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -700,13 +706,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -719,7 +725,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace def get_resource_group_level_task( @@ -751,10 +759,10 @@ def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_resource_group_level_task_request( resource_group_name=resource_group_name, @@ -767,9 +775,9 @@ def get_resource_group_level_task( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -786,7 +794,9 @@ def get_resource_group_level_task( return deserialized - get_resource_group_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_resource_group_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace def update_resource_group_level_task_state( # pylint: disable=inconsistent-return-statements @@ -827,10 +837,10 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_task_state_request( resource_group_name=resource_group_name, @@ -844,9 +854,9 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +869,6 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_resource_group_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py index 7c2f0329f3c1..9bf93a6f2872 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01") # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", "2017-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json index a3d9e73ca6f8..4e5c275338ef 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py index 018a0d49e1c4..2e3c6c212728 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ComplianceResultsOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -73,15 +73,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py index a9eb28389fa5..df97c25cd544 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01") # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", "2017-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py index 2f640b6ea119..8a7602d796bc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ComplianceResultsOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -80,5 +80,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py index 05cc3fb3f4a0..7cfcb2ac627d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._compliance_results_operations import ComplianceResultsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py index 0c69edc315df..9932b6aded1c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py @@ -75,8 +75,8 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.ComplianceRe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResultList] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResultList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -97,7 +97,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -113,7 +113,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +121,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceResultList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +140,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} @distributed_trace_async async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _models.ComplianceResult: @@ -166,8 +166,8 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResult] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResult] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -178,9 +178,9 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +197,4 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py index 6cae848e2e56..1303df6fb8f4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import ResourceStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py index 83794a205d77..8c1f38087f62 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List +from typing import Any, List, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class CloudErrorBody(_serialization.Model): """The error detail. @@ -45,7 +49,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +84,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -118,7 +122,7 @@ class ComplianceResult(Resource): "resource_status": {"key": "properties.resourceStatus", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_status = None @@ -147,7 +151,7 @@ class ComplianceResultList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ComplianceResult"], **kwargs): + def __init__(self, *, value: List["_models.ComplianceResult"], **kwargs: Any) -> None: """ :keyword value: List of compliance results. Required. :paramtype value: list[~azure.mgmt.security.v2017_08_01.models.ComplianceResult] @@ -178,7 +182,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py index 18ebcfc26cc5..06b060062754 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py @@ -13,11 +13,11 @@ class ResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the resource regarding a single assessment.""" - #: This assessment on the resource is healthy HEALTHY = "Healthy" - #: This assessment is not applicable to this resource + """This assessment on the resource is healthy""" NOT_APPLICABLE = "NotApplicable" - #: This assessment is turned off by policy on this subscription + """This assessment is not applicable to this resource""" OFF_BY_POLICY = "OffByPolicy" - #: This assessment on the resource is not healthy + """This assessment is turned off by policy on this subscription""" NOT_HEALTHY = "NotHealthy" + """This assessment on the resource is not healthy""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py index 05cc3fb3f4a0..7cfcb2ac627d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._compliance_results_operations import ComplianceResultsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py index b62b7604b5c2..2b0aa1bd0821 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py @@ -45,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(resource_id: str, compliance_result_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request(resource_id: str, compliance_result_name: str, **kwargs: A "complianceResultName": _SERIALIZER.url("compliance_result_name", compliance_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,8 +127,8 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.ComplianceResult" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResultList] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResultList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -149,7 +149,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -165,7 +165,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -173,13 +173,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceResultList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -192,7 +192,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} @distributed_trace def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _models.ComplianceResult: @@ -218,8 +218,8 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResult] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResult] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -230,9 +230,9 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -249,4 +249,4 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py index 93d7fbe4adcb..46fd8eba8b0e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: Literal["2017-08-01-preview"] + api_version: Literal["2017-08-01-preview"] = kwargs.pop("api_version", "2017-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json index b1b962d4083c..5e7fa8c664a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py index d08c19685330..6855a38c5f93 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -66,7 +66,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -106,15 +106,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py index 00d25b5afc26..e6b9dee820a5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: Literal["2017-08-01-preview"] + api_version: Literal["2017-08-01-preview"] = kwargs.pop("api_version", "2017-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py index 65faa86f575d..1879d0a465f1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -67,7 +67,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -114,5 +114,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py index 44edabecfaab..a09258020a82 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._workspace_settings_operations import WorkspaceSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py index 3550d9f4a2b4..1da9bc450965 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py @@ -76,10 +76,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AutoProvisioningSetting" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSettingList] + ) + cls: ClsType[_models.AutoProvisioningSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AutoProvisioningSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} @distributed_trace_async async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetting: @@ -167,10 +167,10 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -181,9 +181,9 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,7 +200,9 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } @overload async def create( @@ -253,7 +255,8 @@ async def create( :param setting_name: Auto provisioning setting key. Required. :type setting_name: str - :param setting: Auto provisioning setting key. Is either a model type or a IO type. Required. + :param setting: Auto provisioning setting key. Is either a AutoProvisioningSetting type or a IO + type. Required. :type setting: ~azure.mgmt.security.v2017_08_01_preview.models.AutoProvisioningSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -274,11 +277,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -300,9 +303,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,4 +322,6 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py index 461dcaad1f17..69bf49d94075 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py @@ -75,10 +75,10 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Compliance"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceList] + ) + cls: ClsType[_models.ComplianceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -99,7 +99,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -115,7 +115,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -123,13 +123,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -142,7 +142,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} @distributed_trace_async async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compliance: @@ -170,10 +170,10 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Compliance] + ) + cls: ClsType[_models.Compliance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -184,9 +184,9 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,4 +203,4 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py index 089089b739d3..4863d3e0f66d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py @@ -95,10 +95,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -109,9 +109,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -128,7 +128,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @overload async def create_or_update( @@ -211,8 +213,8 @@ async def create_or_update( values are: "effective" and "custom". Required. :type information_protection_policy_name: str or ~azure.mgmt.security.v2017_08_01_preview.models.InformationProtectionPolicyName - :param information_protection_policy: Information protection policy. Is either a model type or - a IO type. Required. + :param information_protection_policy: Information protection policy. Is either a + InformationProtectionPolicy type or a IO type. Required. :type information_protection_policy: ~azure.mgmt.security.v2017_08_01_preview.models.InformationProtectionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -234,11 +236,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -260,9 +262,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -279,11 +281,13 @@ async def create_or_update( deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.InformationProtectionPolicy"]: @@ -303,10 +307,10 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.InformationP _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicyList] + ) + cls: ClsType[_models.InformationProtectionPolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -327,7 +331,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -343,7 +347,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -351,13 +355,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InformationProtectionPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -370,4 +374,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py index 3c4645fac8a9..335bc48b61ba 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py @@ -77,10 +77,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContactList] + ) + cls: ClsType[_models.SecurityContactList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +101,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +117,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityContactList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,7 +144,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} @distributed_trace_async async def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityContact: @@ -168,10 +168,10 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) request = build_get_request( security_contact_name=security_contact_name, @@ -182,9 +182,9 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -201,7 +201,9 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload async def create( @@ -254,8 +256,8 @@ async def create( :param security_contact_name: Name of the security contact object. Required. :type security_contact_name: str - :param security_contact: Security contact object. Is either a model type or a IO type. - Required. + :param security_contact: Security contact object. Is either a SecurityContact type or a IO + type. Required. :type security_contact: ~azure.mgmt.security.v2017_08_01_preview.models.SecurityContact or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -276,11 +278,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -302,9 +304,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,7 +323,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -347,10 +351,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( security_contact_name=security_contact_name, @@ -361,9 +365,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -376,7 +380,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload async def update( @@ -429,8 +435,8 @@ async def update( :param security_contact_name: Name of the security contact object. Required. :type security_contact_name: str - :param security_contact: Security contact object. Is either a model type or a IO type. - Required. + :param security_contact: Security contact object. Is either a SecurityContact type or a IO + type. Required. :type security_contact: ~azure.mgmt.security.v2017_08_01_preview.models.SecurityContact or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -451,11 +457,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -477,9 +483,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -496,4 +502,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py index 3aadca5bb094..f1b735a95af8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py @@ -78,10 +78,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSettingList] + ) + cls: ClsType[_models.WorkspaceSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -118,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,7 +145,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} @distributed_trace_async async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSetting: @@ -170,10 +170,10 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) request = build_get_request( workspace_setting_name=workspace_setting_name, @@ -184,9 +184,9 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +203,9 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload async def create( @@ -261,8 +263,8 @@ async def create( :param workspace_setting_name: Name of the security setting. Required. :type workspace_setting_name: str - :param workspace_setting: Security data setting object. Is either a model type or a IO type. - Required. + :param workspace_setting: Security data setting object. Is either a WorkspaceSetting type or a + IO type. Required. :type workspace_setting: ~azure.mgmt.security.v2017_08_01_preview.models.WorkspaceSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -283,11 +285,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -309,9 +311,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -328,7 +330,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload async def update( @@ -386,8 +390,8 @@ async def update( :param workspace_setting_name: Name of the security setting. Required. :type workspace_setting_name: str - :param workspace_setting: Security data setting object. Is either a model type or a IO type. - Required. + :param workspace_setting: Security data setting object. Is either a WorkspaceSetting type or a + IO type. Required. :type workspace_setting: ~azure.mgmt.security.v2017_08_01_preview.models.WorkspaceSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -408,11 +412,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -434,9 +438,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -453,7 +457,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -480,10 +486,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( workspace_setting_name=workspace_setting_name, @@ -494,9 +500,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -509,4 +515,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py index 244166e9bdfb..d832d981d78d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py @@ -30,7 +30,7 @@ from ._security_center_enums import InformationProtectionPolicyName from ._security_center_enums import Rank from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py index ddc32bace03c..a091483957fc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -41,7 +41,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -78,7 +78,7 @@ class AutoProvisioningSetting(Resource): "auto_provision": {"key": "properties.autoProvision", "type": "str"}, } - def __init__(self, *, auto_provision: Optional[Union[str, "_models.AutoProvision"]] = None, **kwargs): + def __init__(self, *, auto_provision: Optional[Union[str, "_models.AutoProvision"]] = None, **kwargs: Any) -> None: """ :keyword auto_provision: Describes what kind of security agent provisioning action to take. Known values are: "On" and "Off". @@ -108,7 +108,7 @@ class AutoProvisioningSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.AutoProvisioningSetting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AutoProvisioningSetting"]] = None, **kwargs: Any) -> None: """ :keyword value: List of all the auto provisioning settings. :paramtype value: list[~azure.mgmt.security.v2017_08_01_preview.models.AutoProvisioningSetting] @@ -152,7 +152,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -202,7 +202,7 @@ class Compliance(Resource): "assessment_result": {"key": "properties.assessmentResult", "type": "[ComplianceSegment]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.assessment_timestamp_utc_date = None @@ -230,7 +230,7 @@ class ComplianceList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Compliance"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Compliance"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Compliance objects. :paramtype value: list[~azure.mgmt.security.v2017_08_01_preview.models.Compliance] @@ -262,7 +262,7 @@ class ComplianceSegment(_serialization.Model): "percentage": {"key": "percentage", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.segment_type = None @@ -290,7 +290,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -324,8 +324,8 @@ def __init__( custom: Optional[bool] = None, can_be_numeric: Optional[bool] = None, excluded: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pattern: The keyword pattern. :paramtype pattern: str @@ -388,8 +388,8 @@ def __init__( *, labels: Optional[Dict[str, "_models.SensitivityLabel"]] = None, information_types: Optional[Dict[str, "_models.InformationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword labels: Dictionary of sensitivity labels. :paramtype labels: dict[str, ~azure.mgmt.security.v2017_08_01_preview.models.SensitivityLabel] @@ -425,7 +425,7 @@ class InformationProtectionPolicyList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.InformationProtectionPolicy"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.InformationProtectionPolicy"]] = None, **kwargs: Any) -> None: """ :keyword value: List of information protection policies. :paramtype value: @@ -477,8 +477,8 @@ def __init__( enabled: Optional[bool] = None, custom: Optional[bool] = None, keywords: Optional[List["_models.InformationProtectionKeyword"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the information type. :paramtype display_name: str @@ -555,8 +555,8 @@ def __init__( phone: Optional[str] = None, alert_notifications: Optional[Union[str, "_models.AlertNotifications"]] = None, alerts_to_admins: Optional[Union[str, "_models.AlertsToAdmins"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword email: The email of this security contact. :paramtype email: str @@ -599,7 +599,7 @@ class SecurityContactList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -638,8 +638,8 @@ def __init__( rank: Optional[Union[str, "_models.Rank"]] = None, order: Optional[int] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the sensitivity label. :paramtype display_name: str @@ -693,7 +693,7 @@ class WorkspaceSetting(Resource): "scope": {"key": "properties.scope", "type": "str"}, } - def __init__(self, *, workspace_id: Optional[str] = None, scope: Optional[str] = None, **kwargs): + def __init__(self, *, workspace_id: Optional[str] = None, scope: Optional[str] = None, **kwargs: Any) -> None: """ :keyword workspace_id: The full Azure ID of the workspace to save the data in. :paramtype workspace_id: str @@ -729,7 +729,7 @@ class WorkspaceSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.WorkspaceSetting"], **kwargs): + def __init__(self, *, value: List["_models.WorkspaceSetting"], **kwargs: Any) -> None: """ :keyword value: List of workspace settings. Required. :paramtype value: list[~azure.mgmt.security.v2017_08_01_preview.models.WorkspaceSetting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py index f0bd20d296e4..2250b56a7e1f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py @@ -13,28 +13,28 @@ class AlertNotifications(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to send security alerts notifications to the security contact.""" - #: Get notifications on new alerts ON = "On" - #: Don't get notifications on new alerts + """Get notifications on new alerts""" OFF = "Off" + """Don't get notifications on new alerts""" class AlertsToAdmins(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to send security alerts notifications to subscription admins.""" - #: Send notification on new alerts to the subscription's admins ON = "On" - #: Don't send notification on new alerts to the subscription's admins + """Send notification on new alerts to the subscription's admins""" OFF = "Off" + """Don't send notification on new alerts to the subscription's admins""" class AutoProvision(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes what kind of security agent provisioning action to take.""" - #: Install missing security agent on VMs automatically ON = "On" - #: Do not install security agent on the VMs automatically + """Install missing security agent on VMs automatically""" OFF = "Off" + """Do not install security agent on the VMs automatically""" class InformationProtectionPolicyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py index 44edabecfaab..a09258020a82 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py @@ -13,7 +13,7 @@ from ._workspace_settings_operations import WorkspaceSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py index c4caaaa8c4ca..524da36b0d87 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,9 +75,9 @@ def build_get_request(setting_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_get_request(setting_name: str, subscription_id: str, **kwargs: Any) -> "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,10 +107,10 @@ def build_create_request(setting_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,7 @@ def build_create_request(setting_name: str, subscription_id: str, **kwargs: Any) "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,10 +171,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.AutoProvisioningSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSettingList] + ) + cls: ClsType[_models.AutoProvisioningSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -195,7 +195,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -211,7 +211,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -219,13 +219,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AutoProvisioningSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -238,7 +238,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} @distributed_trace def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetting: @@ -262,10 +262,10 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -276,9 +276,9 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -295,7 +295,9 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } @overload def create( @@ -348,7 +350,8 @@ def create( :param setting_name: Auto provisioning setting key. Required. :type setting_name: str - :param setting: Auto provisioning setting key. Is either a model type or a IO type. Required. + :param setting: Auto provisioning setting key. Is either a AutoProvisioningSetting type or a IO + type. Required. :type setting: ~azure.mgmt.security.v2017_08_01_preview.models.AutoProvisioningSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -369,11 +372,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -395,9 +398,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,4 +417,6 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py index d29f85ec3a43..2eaed77478d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py @@ -45,9 +45,9 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_get_request(scope: str, compliance_name: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request(scope: str, compliance_name: str, **kwargs: Any) -> HttpRe "complianceName": _SERIALIZER.url("compliance_name", compliance_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,10 +130,10 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.Compliance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceList] + ) + cls: ClsType[_models.ComplianceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -154,7 +154,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -170,7 +170,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +178,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,7 +197,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} @distributed_trace def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compliance: @@ -225,10 +225,10 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Compliance] + ) + cls: ClsType[_models.Compliance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -239,9 +239,9 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,4 +258,4 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py index 63720c65bf74..733120b093d6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py @@ -47,9 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,10 +81,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,9 +116,9 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,10 +190,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -204,9 +204,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -223,7 +223,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @overload def create_or_update( @@ -306,8 +308,8 @@ def create_or_update( values are: "effective" and "custom". Required. :type information_protection_policy_name: str or ~azure.mgmt.security.v2017_08_01_preview.models.InformationProtectionPolicyName - :param information_protection_policy: Information protection policy. Is either a model type or - a IO type. Required. + :param information_protection_policy: Information protection policy. Is either a + InformationProtectionPolicy type or a IO type. Required. :type information_protection_policy: ~azure.mgmt.security.v2017_08_01_preview.models.InformationProtectionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -329,11 +331,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -355,9 +357,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -374,11 +376,13 @@ def create_or_update( deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.InformationProtectionPolicy"]: @@ -398,10 +402,10 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.InformationProtec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicyList] + ) + cls: ClsType[_models.InformationProtectionPolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -422,7 +426,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -438,7 +442,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -446,13 +450,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InformationProtectionPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -465,4 +469,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py index 26de75d54020..7f5c31bd9ab7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(security_contact_name: str, subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_get_request(security_contact_name: str, subscription_id: str, **kwargs "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_create_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,9 +140,9 @@ def build_delete_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_delete_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,10 +172,10 @@ def build_update_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_update_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,10 +235,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContactList] + ) + cls: ClsType[_models.SecurityContactList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -259,7 +259,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -275,7 +275,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -283,13 +283,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityContactList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -302,7 +302,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} @distributed_trace def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityContact: @@ -326,10 +326,10 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) request = build_get_request( security_contact_name=security_contact_name, @@ -340,9 +340,9 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -359,7 +359,9 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload def create( @@ -412,8 +414,8 @@ def create( :param security_contact_name: Name of the security contact object. Required. :type security_contact_name: str - :param security_contact: Security contact object. Is either a model type or a IO type. - Required. + :param security_contact: Security contact object. Is either a SecurityContact type or a IO + type. Required. :type security_contact: ~azure.mgmt.security.v2017_08_01_preview.models.SecurityContact or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -434,11 +436,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -460,9 +462,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -479,7 +481,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -505,10 +509,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( security_contact_name=security_contact_name, @@ -519,9 +523,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -534,7 +538,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload def update( @@ -587,8 +593,8 @@ def update( :param security_contact_name: Name of the security contact object. Required. :type security_contact_name: str - :param security_contact: Security contact object. Is either a model type or a IO type. - Required. + :param security_contact: Security contact object. Is either a SecurityContact type or a IO + type. Required. :type security_contact: ~azure.mgmt.security.v2017_08_01_preview.models.SecurityContact or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -609,11 +615,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -635,9 +641,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -654,4 +660,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py index e246cf1e71b5..15a1d777e099 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(workspace_setting_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_get_request(workspace_setting_name: str, subscription_id: str, **kwarg "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_create_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,10 +140,10 @@ def build_update_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_update_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,9 +175,9 @@ def build_delete_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +192,7 @@ def build_delete_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -236,10 +236,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSettingList] + ) + cls: ClsType[_models.WorkspaceSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -260,7 +260,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -276,7 +276,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -284,13 +284,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -303,7 +303,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} @distributed_trace def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSetting: @@ -328,10 +328,10 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) request = build_get_request( workspace_setting_name=workspace_setting_name, @@ -342,9 +342,9 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -361,7 +361,9 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload def create( @@ -419,8 +421,8 @@ def create( :param workspace_setting_name: Name of the security setting. Required. :type workspace_setting_name: str - :param workspace_setting: Security data setting object. Is either a model type or a IO type. - Required. + :param workspace_setting: Security data setting object. Is either a WorkspaceSetting type or a + IO type. Required. :type workspace_setting: ~azure.mgmt.security.v2017_08_01_preview.models.WorkspaceSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -441,11 +443,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -467,9 +469,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -486,7 +488,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload def update( @@ -544,8 +548,8 @@ def update( :param workspace_setting_name: Name of the security setting. Required. :type workspace_setting_name: str - :param workspace_setting: Security data setting object. Is either a model type or a IO type. - Required. + :param workspace_setting: Security data setting object. Is either a WorkspaceSetting type or a + IO type. Required. :type workspace_setting: ~azure.mgmt.security.v2017_08_01_preview.models.WorkspaceSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -566,11 +570,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -592,9 +596,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -611,7 +615,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -638,10 +644,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( workspace_setting_name=workspace_setting_name, @@ -652,9 +658,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -667,4 +673,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py index 1a9383b9ca50..51e623ca6fe7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-06-01") # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", "2018-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json index a257924c29e6..2f8418e09f10 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py index e0d6757c1d68..6045d1355712 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py index 71ecbf233ba3..00ef4f7e6b54 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-06-01") # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", "2018-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py index 86c43ee8c1f2..94cc7b61ca9f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -83,5 +83,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py index 16cf1bb363a4..57bb9986a19c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -86,9 +86,9 @@ async def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +105,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace_async async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -129,8 +129,8 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -141,9 +141,9 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -160,7 +160,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload async def update( @@ -206,7 +206,7 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * :param pricing_name: name of the pricing configuration. Required. :type pricing_name: str - :param pricing: Pricing object. Is either a model type or a IO type. Required. + :param pricing: Pricing object. Is either a Pricing type or a IO type. Required. :type pricing: ~azure.mgmt.security.v2018_06_01.models.Pricing or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,9 +227,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -251,9 +251,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +270,4 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py index a6335e2b1d2d..82e99d49aec6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import PricingTier from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py index 862abf08fbe4..0b221dd84f01 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -49,7 +49,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +80,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -112,7 +112,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -121,7 +121,9 @@ def __init__(self, **kwargs): class Pricing(Resource): - """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. + """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the + standard tier available with a trial period. The standard tier offers advanced security + capabilities, while the free tier offers basic security features. Variables are only populated by the server, and will be ignored when sending a request. @@ -156,7 +158,7 @@ class Pricing(Resource): "free_trial_remaining_time": {"key": "properties.freeTrialRemainingTime", "type": "duration"}, } - def __init__(self, *, pricing_tier: Optional[Union[str, "_models.PricingTier"]] = None, **kwargs): + def __init__(self, *, pricing_tier: Optional[Union[str, "_models.PricingTier"]] = None, **kwargs: Any) -> None: """ :keyword pricing_tier: The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The @@ -186,7 +188,7 @@ class PricingList(_serialization.Model): "value": {"key": "value", "type": "[Pricing]"}, } - def __init__(self, *, value: List["_models.Pricing"], **kwargs): + def __init__(self, *, value: List["_models.Pricing"], **kwargs: Any) -> None: """ :keyword value: List of pricing configurations. Required. :paramtype value: list[~azure.mgmt.security.v2018_06_01.models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py index 3a3bb1f34505..340d6e87274f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py @@ -16,7 +16,7 @@ class PricingTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): advanced security capabilities, while the free tier offers basic security features. """ - #: Get free Microsoft Defender for Cloud experience with basic security features FREE = "Free" - #: Get the standard Microsoft Defender for Cloud experience with advanced security features + """Get free Microsoft Defender for Cloud experience with basic security features""" STANDARD = "Standard" + """Get the standard Microsoft Defender for Cloud experience with advanced security features""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py index f45646b09a91..d60942675a82 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py @@ -43,7 +43,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,8 +165,8 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -176,9 +176,9 @@ def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -195,7 +195,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -219,8 +219,8 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -231,9 +231,9 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,7 +250,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload def update( @@ -296,7 +296,7 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg :param pricing_name: name of the pricing configuration. Required. :type pricing_name: str - :param pricing: Pricing object. Is either a model type or a IO type. Required. + :param pricing: Pricing object. Is either a Pricing type or a IO type. Required. :type pricing: ~azure.mgmt.security.v2018_06_01.models.Pricing or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -317,9 +317,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -341,9 +341,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -360,4 +360,4 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py index e06429a27991..045475e6f425 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01") # type: Literal["2019-01-01"] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", "2019-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json index 5b738d4c8656..650d1efaf70d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py index ccfc826e7e45..92ab1b501926 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AdvancedThreatProtectionOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -73,15 +73,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py index 5d8fbb0d22b9..6bb593062b3f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01") # type: Literal["2019-01-01"] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", "2019-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py index 17f3bffc91f0..ab0e06a83328 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AdvancedThreatProtectionOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -80,5 +80,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py index 6da7520b4298..950166c69a9b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._advanced_threat_protection_operations import AdvancedThreatProtectionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py index 28684d54f261..1bd36d95319c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py @@ -80,9 +80,9 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -93,9 +93,9 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +112,7 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} @overload async def create( @@ -181,7 +181,7 @@ async def create( :param resource_id: The identifier of the resource. Required. :type resource_id: str :param advanced_threat_protection_setting: Advanced Threat Protection Settings. Is either a - model type or a IO type. Required. + AdvancedThreatProtectionSetting type or a IO type. Required. :type advanced_threat_protection_setting: ~azure.mgmt.security.v2019_01_01.models.AdvancedThreatProtectionSetting or IO :keyword setting_name: Advanced Threat Protection setting name. Default value is "current". @@ -206,10 +206,10 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -231,9 +231,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,4 +250,6 @@ async def create( return deserialized - create.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py index d04090e27218..8c7246cc6182 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py @@ -11,7 +11,7 @@ from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import Resource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py index 32dcb0acd2ac..f6957b29d889 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Optional +from typing import Any, Optional from ... import _serialization @@ -37,7 +37,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -73,7 +73,7 @@ class AdvancedThreatProtectionSetting(Resource): "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, } - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_enabled: Indicates whether Advanced Threat Protection is enabled. :paramtype is_enabled: bool @@ -115,7 +115,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -146,7 +146,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py index 6da7520b4298..950166c69a9b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._advanced_threat_protection_operations import AdvancedThreatProtectionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py index 28b043a74cbb..371279c72de3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py @@ -43,8 +43,8 @@ def build_get_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_get_request(resource_id: str, **kwargs: Any) -> HttpRequest: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_create_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_create_request(resource_id: str, **kwargs: Any) -> HttpRequest: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,9 +142,9 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -155,9 +155,9 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -174,7 +174,7 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} @overload def create( @@ -243,7 +243,7 @@ def create( :param resource_id: The identifier of the resource. Required. :type resource_id: str :param advanced_threat_protection_setting: Advanced Threat Protection Settings. Is either a - model type or a IO type. Required. + AdvancedThreatProtectionSetting type or a IO type. Required. :type advanced_threat_protection_setting: ~azure.mgmt.security.v2019_01_01.models.AdvancedThreatProtectionSetting or IO :keyword setting_name: Advanced Threat Protection setting name. Default value is "current". @@ -268,10 +268,10 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -293,9 +293,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -312,4 +312,6 @@ def create( return deserialized - create.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py index e0525d39cb17..e9a2fdedb7a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: Literal["2019-01-01-preview"] + api_version: Literal["2019-01-01-preview"] = kwargs.pop("api_version", "2019-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json index 65712a8b6388..d5413f04762c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py index a5196bde8981..b9a9740befe9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -70,7 +70,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -111,15 +111,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py index 6cd221fea7b4..e2e92c2aa6a9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: Literal["2019-01-01-preview"] + api_version: Literal["2019-01-01-preview"] = kwargs.pop("api_version", "2019-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py index 5e6f806c4263..8e843681d6f6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -71,7 +71,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -119,5 +119,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py index aeb88535eb28..e25e3fcfcdf1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py @@ -14,7 +14,7 @@ from ._alerts_suppression_rules_operations import AlertsSuppressionRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py index eeb3135f3277..665b8ae24481 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py @@ -79,10 +79,10 @@ def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRulesList] + ) + cls: ClsType[_models.AlertsSuppressionRulesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +104,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +120,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +128,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertsSuppressionRulesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,7 +147,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} @distributed_trace_async async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.AlertsSuppressionRule: @@ -171,10 +171,10 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) request = build_get_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -185,9 +185,9 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +204,9 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @overload async def update( @@ -266,8 +268,8 @@ async def update( :param alerts_suppression_rule_name: The unique name of the suppression alert rule. Required. :type alerts_suppression_rule_name: str - :param alerts_suppression_rule: Suppression rule object. Is either a model type or a IO type. - Required. + :param alerts_suppression_rule: Suppression rule object. Is either a AlertsSuppressionRule type + or a IO type. Required. :type alerts_suppression_rule: ~azure.mgmt.security.v2019_01_01_preview.models.AlertsSuppressionRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -289,11 +291,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +317,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -334,7 +336,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -360,10 +364,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -374,9 +378,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,4 +393,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py index 6947366b1082..893d69272f89 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Automation"]: @@ -165,10 +165,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -190,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -206,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,13 +214,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -233,7 +233,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations" + } @distributed_trace_async async def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> _models.Automation: @@ -260,10 +262,10 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -275,9 +277,9 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -294,7 +296,9 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload async def create_or_update( @@ -366,7 +370,7 @@ async def create_or_update( :type resource_group_name: str :param automation_name: The security automation name. Required. :type automation_name: str - :param automation: The security automation resource. Is either a model type or a IO type. + :param automation: The security automation resource. Is either a Automation type or a IO type. Required. :type automation: ~azure.mgmt.security.v2019_01_01_preview.models.Automation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -388,11 +392,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -415,9 +419,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -434,11 +438,13 @@ async def create_or_update( deserialized = self._deserialize("Automation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -467,10 +473,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -482,9 +488,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -497,7 +503,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload async def validate( @@ -569,7 +577,7 @@ async def validate( :type resource_group_name: str :param automation_name: The security automation name. Required. :type automation_name: str - :param automation: The security automation resource. Is either a model type or a IO type. + :param automation: The security automation resource. Is either a Automation type or a IO type. Required. :type automation: ~azure.mgmt.security.v2019_01_01_preview.models.Automation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -591,11 +599,11 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationValidationStatus] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationValidationStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -618,9 +626,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -637,4 +645,6 @@ async def validate( return deserialized - validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate"} # type: ignore + validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py index 0da66fe3d056..c1cfd144eeb2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py @@ -86,10 +86,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessmentList] + ) + cls: ClsType[_models.RegulatoryComplianceAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,7 +113,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -129,7 +129,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,13 +137,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -156,7 +156,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments" + } @distributed_trace_async async def get( @@ -193,10 +195,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessment] + ) + cls: ClsType[_models.RegulatoryComplianceAssessment] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -209,9 +211,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -228,4 +230,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py index c33dad3da474..24d41d68eaf8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py @@ -79,10 +79,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControlList] + ) + cls: ClsType[_models.RegulatoryComplianceControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +105,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -121,7 +121,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -129,13 +129,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -148,7 +148,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls" + } @distributed_trace_async async def get( @@ -178,10 +180,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControl] + ) + cls: ClsType[_models.RegulatoryComplianceControl] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -193,9 +195,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,4 +214,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py index a1a59794d533..7e008acf9f61 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py @@ -76,10 +76,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandardList] + ) + cls: ClsType[_models.RegulatoryComplianceStandardList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +101,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +117,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceStandardList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + } @distributed_trace_async async def get( @@ -171,10 +173,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandard] + ) + cls: ClsType[_models.RegulatoryComplianceStandard] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -185,9 +187,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,4 +206,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py index 3522593c3c28..024190bec6fb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py @@ -76,10 +76,10 @@ def list_all(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} # type: ignore + list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable["_models.SecuritySubAssessment"]: @@ -165,10 +165,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -190,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -206,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,13 +214,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -233,7 +233,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} @distributed_trace_async async def get( @@ -266,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessment] + ) + cls: ClsType[_models.SecuritySubAssessment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -281,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -300,4 +300,6 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py index 09a25196df77..93bc6625aac2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py @@ -61,7 +61,7 @@ from ._security_center_enums import State from ._security_center_enums import SubAssessmentStatusCode from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py index 2c43420efd06..2aec4b3ea73f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py @@ -48,10 +48,10 @@ class AdditionalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = None # type: Optional[str] + self.assessed_resource_type: Optional[str] = None class Resource(_serialization.Model): @@ -79,7 +79,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -146,8 +146,8 @@ def __init__( state: Optional[Union[str, "_models.RuleState"]] = None, comment: Optional[str] = None, suppression_alerts_scope: Optional["_models.SuppressionAlertsScope"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_type: Type of the alert to automatically suppress. For all alert types, use '*'. :paramtype alert_type: str @@ -198,7 +198,7 @@ class AlertsSuppressionRulesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.AlertsSuppressionRule"], **kwargs): + def __init__(self, *, value: List["_models.AlertsSuppressionRule"], **kwargs: Any) -> None: """ :keyword value: Required. :paramtype value: list[~azure.mgmt.security.v2019_01_01_preview.models.AlertsSuppressionRule] @@ -219,7 +219,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -240,7 +240,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -261,7 +261,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -281,7 +281,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -335,8 +335,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -427,8 +427,8 @@ def __init__( scopes: Optional[List["_models.AutomationScope"]] = None, sources: Optional[List["_models.AutomationSource"]] = None, actions: Optional[List["_models.AutomationAction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -491,14 +491,15 @@ class AutomationAction(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.action_type = None # type: Optional[str] + self.action_type: Optional[str] = None class AutomationActionEventHub(AutomationAction): - """The target Event Hub to which event data will be exported. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. + """The target Event Hub to which event data will be exported. To learn more about Microsoft + Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. Variables are only populated by the server, and will be ignored when sending a request. @@ -529,8 +530,8 @@ class AutomationActionEventHub(AutomationAction): } def __init__( - self, *, event_hub_resource_id: Optional[str] = None, connection_string: Optional[str] = None, **kwargs - ): + self, *, event_hub_resource_id: Optional[str] = None, connection_string: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword event_hub_resource_id: The target Event Hub Azure Resource ID. :paramtype event_hub_resource_id: str @@ -539,14 +540,15 @@ def __init__( :paramtype connection_string: str """ super().__init__(**kwargs) - self.action_type = "EventHub" # type: str + self.action_type: str = "EventHub" self.event_hub_resource_id = event_hub_resource_id self.sas_policy_name = None self.connection_string = connection_string class AutomationActionLogicApp(AutomationAction): - """The logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore. + """The logic app action that should be triggered. To learn more about Microsoft Defender for + Cloud's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore. All required parameters must be populated in order to send to Azure. @@ -570,7 +572,9 @@ class AutomationActionLogicApp(AutomationAction): "uri": {"key": "uri", "type": "str"}, } - def __init__(self, *, logic_app_resource_id: Optional[str] = None, uri: Optional[str] = None, **kwargs): + def __init__( + self, *, logic_app_resource_id: Optional[str] = None, uri: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword logic_app_resource_id: The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App. @@ -579,13 +583,18 @@ def __init__(self, *, logic_app_resource_id: Optional[str] = None, uri: Optional :paramtype uri: str """ super().__init__(**kwargs) - self.action_type = "LogicApp" # type: str + self.action_type: str = "LogicApp" self.logic_app_resource_id = logic_app_resource_id self.uri = uri class AutomationActionWorkspace(AutomationAction): - """The Log Analytics Workspace to which event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. + """The Log Analytics Workspace to which event data will be exported. Security alerts data will + reside in the 'SecurityAlert' table and the assessments data will reside in the + 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that + in order to view the data in the workspace, the Security Center Log Analytics free/standard + solution needs to be enabled on that workspace. To learn more about Microsoft Defender for + Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. All required parameters must be populated in order to send to Azure. @@ -605,13 +614,13 @@ class AutomationActionWorkspace(AutomationAction): "workspace_resource_id": {"key": "workspaceResourceId", "type": "str"}, } - def __init__(self, *, workspace_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, workspace_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword workspace_resource_id: The fully qualified Log Analytics Workspace Azure Resource ID. :paramtype workspace_resource_id: str """ super().__init__(**kwargs) - self.action_type = "Workspace" # type: str + self.action_type: str = "Workspace" self.workspace_resource_id = workspace_resource_id @@ -638,7 +647,7 @@ class AutomationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Automation"], **kwargs): + def __init__(self, *, value: List["_models.Automation"], **kwargs: Any) -> None: """ :keyword value: The list of security automations under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2019_01_01_preview.models.Automation] @@ -649,7 +658,8 @@ def __init__(self, *, value: List["_models.Automation"], **kwargs): class AutomationRuleSet(_serialization.Model): - """A rule set which evaluates all its rules upon an event interception. Only when all the included rules in the rule set will be evaluated as 'true', will the event trigger the defined actions. + """A rule set which evaluates all its rules upon an event interception. Only when all the included + rules in the rule set will be evaluated as 'true', will the event trigger the defined actions. :ivar rules: :vartype rules: list[~azure.mgmt.security.v2019_01_01_preview.models.AutomationTriggeringRule] @@ -659,7 +669,7 @@ class AutomationRuleSet(_serialization.Model): "rules": {"key": "rules", "type": "[AutomationTriggeringRule]"}, } - def __init__(self, *, rules: Optional[List["_models.AutomationTriggeringRule"]] = None, **kwargs): + def __init__(self, *, rules: Optional[List["_models.AutomationTriggeringRule"]] = None, **kwargs: Any) -> None: """ :keyword rules: :paramtype rules: @@ -684,7 +694,7 @@ class AutomationScope(_serialization.Model): "scope_path": {"key": "scopePath", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, scope_path: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, scope_path: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: The resources scope description. :paramtype description: str @@ -698,7 +708,9 @@ def __init__(self, *, description: Optional[str] = None, scope_path: Optional[st class AutomationSource(_serialization.Model): - """The source event types which evaluate the security automation set of rules. For example - security alerts and security assessments. To learn more about the supported security events data models schemas - please visit https://aka.ms/ASCAutomationSchemas. + """The source event types which evaluate the security automation set of rules. For example - + security alerts and security assessments. To learn more about the supported security events + data models schemas - please visit https://aka.ms/ASCAutomationSchemas. :ivar event_source: A valid event source type. Known values are: "Assessments", "AssessmentsSnapshot", "SubAssessments", "SubAssessmentsSnapshot", "Alerts", "SecureScores", @@ -720,8 +732,8 @@ def __init__( *, event_source: Optional[Union[str, "_models.EventSource"]] = None, rule_sets: Optional[List["_models.AutomationRuleSet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword event_source: A valid event source type. Known values are: "Assessments", "AssessmentsSnapshot", "SubAssessments", "SubAssessmentsSnapshot", "Alerts", "SecureScores", @@ -738,7 +750,9 @@ def __init__( class AutomationTriggeringRule(_serialization.Model): - """A rule which is evaluated upon event interception. The rule is configured by comparing a specific value from the event model to an expected value. This comparison is done by using one of the supported operators set. + """A rule which is evaluated upon event interception. The rule is configured by comparing a + specific value from the event model to an expected value. This comparison is done by using one + of the supported operators set. :ivar property_j_path: The JPath of the entity model property that should be checked. :vartype property_j_path: str @@ -768,8 +782,8 @@ def __init__( property_type: Optional[Union[str, "_models.PropertyType"]] = None, expected_value: Optional[str] = None, operator: Optional[Union[str, "_models.Operator"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property_j_path: The JPath of the entity model property that should be checked. :paramtype property_j_path: str @@ -806,7 +820,7 @@ class AutomationValidationStatus(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, is_valid: Optional[bool] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, is_valid: Optional[bool] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword is_valid: Indicates whether the model is valid or not. :paramtype is_valid: bool @@ -841,10 +855,10 @@ class ResourceDetails(_serialization.Model): _subtype_map = {"source": {"Azure": "AzureResourceDetails", "OnPremise": "OnPremiseResourceDetails"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = None # type: Optional[str] + self.source: Optional[str] = None class AzureResourceDetails(ResourceDetails): @@ -871,10 +885,10 @@ class AzureResourceDetails(ResourceDetails): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = "Azure" # type: str + self.source: str = "Azure" self.id = None @@ -912,7 +926,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -977,10 +991,10 @@ class ContainerRegistryVulnerabilityProperties(AdditionalData): "image_digest": {"key": "imageDigest", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = "ContainerRegistryVulnerability" # type: str + self.assessed_resource_type: str = "ContainerRegistryVulnerability" self.type = None self.cvss = None self.patchable = None @@ -1012,7 +1026,7 @@ class CVE(_serialization.Model): "link": {"key": "link", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.title = None @@ -1036,7 +1050,7 @@ class CVSS(_serialization.Model): "base": {"key": "base", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.base = None @@ -1063,7 +1077,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1109,7 +1123,9 @@ class OnPremiseResourceDetails(ResourceDetails): _subtype_map = {"source": {"OnPremiseSql": "OnPremiseSqlResourceDetails"}} - def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs): + def __init__( + self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -1121,7 +1137,7 @@ def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, m :paramtype machine_name: str """ super().__init__(**kwargs) - self.source = "OnPremise" # type: str + self.source: str = "OnPremise" self.workspace_id = workspace_id self.vmuuid = vmuuid self.source_computer_id = source_computer_id @@ -1179,8 +1195,8 @@ def __init__( machine_name: str, server_name: str, database_name: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -1202,7 +1218,7 @@ def __init__( machine_name=machine_name, **kwargs ) - self.source = "OnPremiseSql" # type: str + self.source: str = "OnPremiseSql" self.server_name = server_name self.database_name = database_name @@ -1266,7 +1282,7 @@ class RegulatoryComplianceAssessment(Resource): # pylint: disable=too-many-inst "unsupported_resources": {"key": "properties.unsupportedResources", "type": "int"}, } - def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs): + def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs: Any) -> None: """ :keyword state: Aggregative state based on the assessment's scanned resources states. Known values are: "Passed", "Failed", "Skipped", and "Unsupported". @@ -1307,7 +1323,7 @@ class RegulatoryComplianceAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.RegulatoryComplianceAssessment"], **kwargs): + def __init__(self, *, value: List["_models.RegulatoryComplianceAssessment"], **kwargs: Any) -> None: """ :keyword value: Required. :paramtype value: @@ -1366,7 +1382,7 @@ class RegulatoryComplianceControl(Resource): "skipped_assessments": {"key": "properties.skippedAssessments", "type": "int"}, } - def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs): + def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs: Any) -> None: """ :keyword state: Aggregative state based on the control's supported assessments states. Known values are: "Passed", "Failed", "Skipped", and "Unsupported". @@ -1404,7 +1420,7 @@ class RegulatoryComplianceControlList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.RegulatoryComplianceControl"], **kwargs): + def __init__(self, *, value: List["_models.RegulatoryComplianceControl"], **kwargs: Any) -> None: """ :keyword value: List of regulatory compliance controls. Required. :paramtype value: @@ -1464,7 +1480,7 @@ class RegulatoryComplianceStandard(Resource): "unsupported_controls": {"key": "properties.unsupportedControls", "type": "int"}, } - def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs): + def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs: Any) -> None: """ :keyword state: Aggregative state based on the standard's supported controls states. Known values are: "Passed", "Failed", "Skipped", and "Unsupported". @@ -1502,7 +1518,7 @@ class RegulatoryComplianceStandardList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.RegulatoryComplianceStandard"], **kwargs): + def __init__(self, *, value: List["_models.RegulatoryComplianceStandard"], **kwargs: Any) -> None: """ :keyword value: Required. :paramtype value: @@ -1529,8 +1545,8 @@ class ScopeElement(_serialization.Model): } def __init__( - self, *, additional_properties: Optional[Dict[str, Any]] = None, field: Optional[str] = None, **kwargs - ): + self, *, additional_properties: Optional[Dict[str, Any]] = None, field: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1611,8 +1627,8 @@ def __init__( status: Optional["_models.SubAssessmentStatus"] = None, resource_details: Optional["_models.ResourceDetails"] = None, additional_data: Optional["_models.AdditionalData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the sub-assessment. :paramtype status: ~azure.mgmt.security.v2019_01_01_preview.models.SubAssessmentStatus @@ -1655,7 +1671,7 @@ class SecuritySubAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1713,10 +1729,10 @@ class ServerVulnerabilityProperties(AdditionalData): "vendor_references": {"key": "vendorReferences", "type": "[VendorReference]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = "ServerVulnerabilityAssessment" # type: str + self.assessed_resource_type: str = "ServerVulnerabilityAssessment" self.type = None self.cvss = None self.patchable = None @@ -1755,10 +1771,10 @@ class SqlServerVulnerabilityProperties(AdditionalData): "query": {"key": "query", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = "SqlServerVulnerability" # type: str + self.assessed_resource_type: str = "SqlServerVulnerability" self.type = None self.query = None @@ -1794,7 +1810,7 @@ class SubAssessmentStatus(_serialization.Model): "severity": {"key": "severity", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1821,7 +1837,7 @@ class SuppressionAlertsScope(_serialization.Model): "all_of": {"key": "allOf", "type": "[ScopeElement]"}, } - def __init__(self, *, all_of: List["_models.ScopeElement"], **kwargs): + def __init__(self, *, all_of: List["_models.ScopeElement"], **kwargs: Any) -> None: """ :keyword all_of: All the conditions inside need to be true in order to suppress the alert. Required. @@ -1852,7 +1868,7 @@ class VendorReference(_serialization.Model): "link": {"key": "link", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.title = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py index c3e4411eb8a6..4eb15a289fb5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py @@ -47,24 +47,24 @@ class Operator(str, Enum, metaclass=CaseInsensitiveEnumMeta): PropertyType. """ - #: Applies for decimal and non-decimal operands EQUALS = "Equals" - #: Applies only for decimal operands + """Applies for decimal and non-decimal operands""" GREATER_THAN = "GreaterThan" - #: Applies only for decimal operands + """Applies only for decimal operands""" GREATER_THAN_OR_EQUAL_TO = "GreaterThanOrEqualTo" - #: Applies only for decimal operands + """Applies only for decimal operands""" LESSER_THAN = "LesserThan" - #: Applies only for decimal operands + """Applies only for decimal operands""" LESSER_THAN_OR_EQUAL_TO = "LesserThanOrEqualTo" - #: Applies for decimal and non-decimal operands + """Applies only for decimal operands""" NOT_EQUALS = "NotEquals" - #: Applies only for non-decimal operands + """Applies for decimal and non-decimal operands""" CONTAINS = "Contains" - #: Applies only for non-decimal operands + """Applies only for non-decimal operands""" STARTS_WITH = "StartsWith" - #: Applies only for non-decimal operands + """Applies only for non-decimal operands""" ENDS_WITH = "EndsWith" + """Applies only for non-decimal operands""" class PropertyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -97,34 +97,34 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The platform where the assessed resource resides.""" - #: Resource is in Azure AZURE = "Azure" - #: Resource in an on premise machine connected to Azure cloud + """Resource is in Azure""" ON_PREMISE = "OnPremise" - #: SQL Resource in an on premise machine connected to Azure cloud + """Resource in an on premise machine connected to Azure cloud""" ON_PREMISE_SQL = "OnPremiseSql" + """SQL Resource in an on premise machine connected to Azure cloud""" class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Aggregative state based on the standard's supported controls states.""" - #: All supported regulatory compliance controls in the given standard have a passed state PASSED = "Passed" - #: At least one supported regulatory compliance control in the given standard has a state of - #: failed + """All supported regulatory compliance controls in the given standard have a passed state""" FAILED = "Failed" - #: All supported regulatory compliance controls in the given standard have a state of skipped + """At least one supported regulatory compliance control in the given standard has a state of + #: failed""" SKIPPED = "Skipped" - #: No supported regulatory compliance data for the given standard + """All supported regulatory compliance controls in the given standard have a state of skipped""" UNSUPPORTED = "Unsupported" + """No supported regulatory compliance data for the given standard""" class SubAssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Programmatic code for the status of the assessment.""" - #: The resource is healthy HEALTHY = "Healthy" - #: The resource has a security issue that needs to be addressed + """The resource is healthy""" UNHEALTHY = "Unhealthy" - #: Assessment for this resource did not happen + """The resource has a security issue that needs to be addressed""" NOT_APPLICABLE = "NotApplicable" + """Assessment for this resource did not happen""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py index aeb88535eb28..e25e3fcfcdf1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py @@ -14,7 +14,7 @@ from ._alerts_suppression_rules_operations import AlertsSuppressionRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py index 276f7999f3a4..43a47232b67a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, *, alert_type: Optional[str] = None _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request(subscription_id: str, *, alert_type: Optional[str] = None ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,9 +77,9 @@ def build_get_request(alerts_suppression_rule_name: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request(alerts_suppression_rule_name: str, subscription_id: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,10 +111,10 @@ def build_update_request(alerts_suppression_rule_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_update_request(alerts_suppression_rule_name: str, subscription_id: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,9 +148,9 @@ def build_delete_request(alerts_suppression_rule_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_delete_request(alerts_suppression_rule_name: str, subscription_id: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,10 +213,10 @@ def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRulesList] + ) + cls: ClsType[_models.AlertsSuppressionRulesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -238,7 +238,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -254,7 +254,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -262,13 +262,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertsSuppressionRulesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -281,7 +281,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} @distributed_trace def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.AlertsSuppressionRule: @@ -305,10 +305,10 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) request = build_get_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -319,9 +319,9 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -338,7 +338,9 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @overload def update( @@ -400,8 +402,8 @@ def update( :param alerts_suppression_rule_name: The unique name of the suppression alert rule. Required. :type alerts_suppression_rule_name: str - :param alerts_suppression_rule: Suppression rule object. Is either a model type or a IO type. - Required. + :param alerts_suppression_rule: Suppression rule object. Is either a AlertsSuppressionRule type + or a IO type. Required. :type alerts_suppression_rule: ~azure.mgmt.security.v2019_01_01_preview.models.AlertsSuppressionRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -423,11 +425,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -449,9 +451,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -468,7 +470,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -494,10 +498,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -508,9 +512,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -523,4 +527,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py index 0a0b26b9ab24..6680bae8733f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,9 +186,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -206,7 +206,7 @@ def build_delete_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -223,10 +223,10 @@ def build_validate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +244,7 @@ def build_validate_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Automation"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations" + } @distributed_trace def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> _models.Automation: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload def create_or_update( @@ -577,7 +581,7 @@ def create_or_update( :type resource_group_name: str :param automation_name: The security automation name. Required. :type automation_name: str - :param automation: The security automation resource. Is either a model type or a IO type. + :param automation: The security automation resource. Is either a Automation type or a IO type. Required. :type automation: ~azure.mgmt.security.v2019_01_01_preview.models.Automation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -599,11 +603,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -626,9 +630,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -645,11 +649,13 @@ def create_or_update( deserialized = self._deserialize("Automation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -678,10 +684,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -693,9 +699,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -708,7 +714,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload def validate( @@ -780,7 +788,7 @@ def validate( :type resource_group_name: str :param automation_name: The security automation name. Required. :type automation_name: str - :param automation: The security automation resource. Is either a model type or a IO type. + :param automation: The security automation resource. Is either a Automation type or a IO type. Required. :type automation: ~azure.mgmt.security.v2019_01_01_preview.models.Automation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -802,11 +810,11 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationValidationStatus] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationValidationStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -829,9 +837,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -848,4 +856,6 @@ def validate( return deserialized - validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate"} # type: ignore + validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py index 60392fa32a0e..9e043552b7e7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py @@ -52,9 +52,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,9 +97,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,10 +180,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessmentList] + ) + cls: ClsType[_models.RegulatoryComplianceAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -207,7 +207,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -223,7 +223,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -231,13 +231,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -250,7 +250,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments" + } @distributed_trace def get( @@ -287,10 +289,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessment] + ) + cls: ClsType[_models.RegulatoryComplianceAssessment] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -303,9 +305,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -322,4 +324,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py index ece9fd34ccb4..d3286ad449f5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py @@ -47,9 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,9 +88,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +110,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,10 +161,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControlList] + ) + cls: ClsType[_models.RegulatoryComplianceControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -187,7 +187,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -203,7 +203,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -211,13 +211,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -230,7 +230,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls" + } @distributed_trace def get( @@ -260,10 +262,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControl] + ) + cls: ClsType[_models.RegulatoryComplianceControl] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -275,9 +277,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -294,4 +296,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py index 6a5a0161789e..4e0c65184249 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,9 +77,9 @@ def build_get_request(regulatory_compliance_standard_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request(regulatory_compliance_standard_name: str, subscription_id: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,10 +142,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandardList] + ) + cls: ClsType[_models.RegulatoryComplianceStandardList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -167,7 +167,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -183,7 +183,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -191,13 +191,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceStandardList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -210,7 +210,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + } @distributed_trace def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _models.RegulatoryComplianceStandard: @@ -235,10 +237,10 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandard] + ) + cls: ClsType[_models.RegulatoryComplianceStandard] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -249,9 +251,9 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -268,4 +270,6 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py index a4ddd7978895..5fb21919cc2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py @@ -45,9 +45,9 @@ def build_list_all_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_all_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,9 +100,9 @@ def build_get_request(scope: str, assessment_name: str, sub_assessment_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +116,7 @@ def build_get_request(scope: str, assessment_name: str, sub_assessment_name: str "subAssessmentName": _SERIALIZER.url("sub_assessment_name", sub_assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,10 +164,10 @@ def list_all(self, scope: str, **kwargs: Any) -> Iterable["_models.SecuritySubAs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -188,7 +188,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -204,7 +204,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -212,13 +212,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -231,7 +231,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} # type: ignore + list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_models.SecuritySubAssessment"]: @@ -253,10 +253,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -278,7 +278,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -294,7 +294,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -302,13 +302,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -321,7 +321,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} @distributed_trace def get( @@ -354,10 +354,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessment] + ) + cls: ClsType[_models.SecuritySubAssessment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -369,9 +369,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -388,4 +388,6 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py index 0eef7f710a06..194b5d0e8368 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01") # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", "2019-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json index fb4dc9f00646..d7f4b984bafa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py index 355a95c07258..5239529650f9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -69,7 +69,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -111,15 +111,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py index ad5b17e974bf..63f3bee448f3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01") # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", "2019-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py index aedc96bb370a..1f3a6152802d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -69,7 +69,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -118,5 +118,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py index 9659bbd2cebc..8f30c8ed00eb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py @@ -17,7 +17,7 @@ from ._iot_security_solution_operations import IotSecuritySolutionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py index cbbc47d24a29..e840e3306112 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py @@ -78,8 +78,8 @@ def list(self, resource_id: str, **kwargs: Any) -> AsyncIterable["_models.Device _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroupList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroupList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DeviceSecurityGroupList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} @distributed_trace_async async def get( @@ -172,8 +172,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -184,9 +184,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +203,7 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} @overload async def create_or_update( @@ -279,8 +279,8 @@ async def create_or_update( :param device_security_group_name: The name of the device security group. Note that the name of the device security group is case insensitive. Required. :type device_security_group_name: str - :param device_security_group: Security group object. Is either a model type or a IO type. - Required. + :param device_security_group: Security group object. Is either a DeviceSecurityGroup type or a + IO type. Required. :type device_security_group: ~azure.mgmt.security.v2019_08_01.models.DeviceSecurityGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -301,9 +301,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -325,9 +325,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,11 +344,13 @@ async def create_or_update( deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -377,8 +379,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -389,9 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -404,4 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py index d2a8e768d80e..b1fab1d6d21d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py @@ -82,8 +82,8 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -95,9 +95,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -114,7 +114,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels" + } @distributed_trace_async async def get( @@ -143,8 +145,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -156,9 +158,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -175,4 +177,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py index 864360becbec..5f15a286249c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py @@ -84,8 +84,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -150,7 +150,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace def list_by_resource_group( @@ -174,8 +176,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -198,7 +200,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -214,7 +216,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -222,13 +224,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -241,7 +243,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace_async async def get( @@ -270,8 +274,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -283,9 +287,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -302,7 +306,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload async def create_or_update( @@ -376,8 +382,8 @@ async def create_or_update( :type resource_group_name: str :param solution_name: The name of the IoT Security solution. Required. :type solution_name: str - :param iot_security_solution_data: The security solution data. Is either a model type or a IO - type. Required. + :param iot_security_solution_data: The security solution data. Is either a + IoTSecuritySolutionModel type or a IO type. Required. :type iot_security_solution_data: ~azure.mgmt.security.v2019_08_01.models.IoTSecuritySolutionModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -399,9 +405,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +430,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +449,13 @@ async def create_or_update( deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload async def update( @@ -524,8 +532,8 @@ async def update( :type resource_group_name: str :param solution_name: The name of the IoT Security solution. Required. :type solution_name: str - :param update_iot_security_solution_data: The security solution data. Is either a model type or - a IO type. Required. + :param update_iot_security_solution_data: The security solution data. Is either a + UpdateIotSecuritySolutionData type or a IO type. Required. :type update_iot_security_solution_data: ~azure.mgmt.security.v2019_08_01.models.UpdateIotSecuritySolutionData or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -547,9 +555,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,9 +580,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -591,7 +599,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -620,8 +630,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +643,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +658,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index 313373854892..8e655a3712b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -85,8 +85,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlertList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedAlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts" + } @distributed_trace_async async def get( @@ -185,8 +187,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlert] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlert] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -199,9 +201,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -218,7 +220,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}" + } @distributed_trace_async async def dismiss( # pylint: disable=inconsistent-return-statements @@ -249,8 +253,8 @@ async def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_dismiss_request( resource_group_name=resource_group_name, @@ -263,9 +267,9 @@ async def dismiss( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,4 +282,6 @@ async def dismiss( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss"} # type: ignore + dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py index 363466f760d9..d658762c9fa6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -92,8 +92,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendation] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -106,9 +106,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -125,7 +125,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}" + } @distributed_trace def list( @@ -151,8 +153,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendationList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -176,7 +178,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -192,7 +194,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -200,13 +202,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedRecommendationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -219,4 +221,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py index de83203b486b..e29bbfcaafc5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py @@ -70,7 +70,7 @@ from ._security_center_enums import UnmaskedIpLoggingStatus from ._security_center_enums import ValueType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py index 9b2f75b45dcf..2c8a55b12d04 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -58,7 +58,7 @@ class CustomAlertRule(_serialization.Model): } } - def __init__(self, *, is_enabled: bool, **kwargs): + def __init__(self, *, is_enabled: bool, **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -67,11 +67,12 @@ def __init__(self, *, is_enabled: bool, **kwargs): self.display_name = None self.description = None self.is_enabled = is_enabled - self.rule_type = None # type: Optional[str] + self.rule_type: Optional[str] = None class ThresholdCustomAlertRule(CustomAlertRule): - """A custom alert rule that checks if a value (depends on the custom alert type) is within the given range. + """A custom alert rule that checks if a value (depends on the custom alert type) is within the + given range. You probably want to use the sub-classes and not this class directly. Known sub-classes are: TimeWindowCustomAlertRule @@ -114,7 +115,7 @@ class ThresholdCustomAlertRule(CustomAlertRule): _subtype_map = {"rule_type": {"TimeWindowCustomAlertRule": "TimeWindowCustomAlertRule"}} - def __init__(self, *, is_enabled: bool, min_threshold: int, max_threshold: int, **kwargs): + def __init__(self, *, is_enabled: bool, min_threshold: int, max_threshold: int, **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -124,13 +125,14 @@ def __init__(self, *, is_enabled: bool, min_threshold: int, max_threshold: int, :paramtype max_threshold: int """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "ThresholdCustomAlertRule" # type: str + self.rule_type: str = "ThresholdCustomAlertRule" self.min_threshold = min_threshold self.max_threshold = max_threshold class TimeWindowCustomAlertRule(ThresholdCustomAlertRule): - """A custom alert rule that checks if the number of activities (depends on the custom alert type) in a time window is within the given range. + """A custom alert rule that checks if the number of activities (depends on the custom alert type) + in a time window is within the given range. You probably want to use the sub-classes and not this class directly. Known sub-classes are: ActiveConnectionsNotInAllowedRange, AmqpC2DMessagesNotInAllowedRange, @@ -210,8 +212,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -223,7 +225,7 @@ def __init__( :paramtype time_window_size: ~datetime.timedelta """ super().__init__(is_enabled=is_enabled, min_threshold=min_threshold, max_threshold=max_threshold, **kwargs) - self.rule_type = "TimeWindowCustomAlertRule" # type: str + self.rule_type: str = "TimeWindowCustomAlertRule" self.time_window_size = time_window_size @@ -277,8 +279,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -296,7 +298,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "ActiveConnectionsNotInAllowedRange" # type: str + self.rule_type: str = "ActiveConnectionsNotInAllowedRange" class AdditionalWorkspacesProperties(_serialization.Model): @@ -323,8 +325,8 @@ def __init__( workspace: Optional[str] = None, type: Union[str, "_models.AdditionalWorkspaceType"] = "Sentinel", data_types: Optional[List[Union[str, "_models.AdditionalWorkspaceDataType"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace: Workspace resource id. :paramtype workspace: str @@ -386,13 +388,13 @@ class ListCustomAlertRule(CustomAlertRule): } } - def __init__(self, *, is_enabled: bool, **kwargs): + def __init__(self, *, is_enabled: bool, **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "ListCustomAlertRule" # type: str + self.rule_type: str = "ListCustomAlertRule" self.value_type = None @@ -449,7 +451,7 @@ class AllowlistCustomAlertRule(ListCustomAlertRule): } } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -458,7 +460,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "AllowlistCustomAlertRule" # type: str + self.rule_type: str = "AllowlistCustomAlertRule" self.allowlist_values = allowlist_values @@ -512,8 +514,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -531,7 +533,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "AmqpC2DMessagesNotInAllowedRange" # type: str + self.rule_type: str = "AmqpC2DMessagesNotInAllowedRange" class AmqpC2DRejectedMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -584,8 +586,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -603,7 +605,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "AmqpC2DRejectedMessagesNotInAllowedRange" # type: str + self.rule_type: str = "AmqpC2DRejectedMessagesNotInAllowedRange" class AmqpD2CMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -656,8 +658,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -675,7 +677,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "AmqpD2CMessagesNotInAllowedRange" # type: str + self.rule_type: str = "AmqpD2CMessagesNotInAllowedRange" class CloudErrorBody(_serialization.Model): @@ -711,7 +713,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -722,7 +724,8 @@ def __init__(self, **kwargs): class ConnectionFromIpNotAllowed(AllowlistCustomAlertRule): - """Inbound connection from an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. + """Inbound connection from an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in + CIDR notation. Variables are only populated by the server, and will be ignored when sending a request. @@ -762,7 +765,7 @@ class ConnectionFromIpNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -771,11 +774,12 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "ConnectionFromIpNotAllowed" # type: str + self.rule_type: str = "ConnectionFromIpNotAllowed" class ConnectionToIpNotAllowed(AllowlistCustomAlertRule): - """Outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. + """Outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in + CIDR notation. Variables are only populated by the server, and will be ignored when sending a request. @@ -815,7 +819,7 @@ class ConnectionToIpNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -824,7 +828,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "ConnectionToIpNotAllowed" # type: str + self.rule_type: str = "ConnectionToIpNotAllowed" class DenylistCustomAlertRule(ListCustomAlertRule): @@ -868,7 +872,7 @@ class DenylistCustomAlertRule(ListCustomAlertRule): "denylist_values": {"key": "denylistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, denylist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, denylist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -877,7 +881,7 @@ def __init__(self, *, is_enabled: bool, denylist_values: List[str], **kwargs): :paramtype denylist_values: list[str] """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "DenylistCustomAlertRule" # type: str + self.rule_type: str = "DenylistCustomAlertRule" self.denylist_values = denylist_values @@ -906,7 +910,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -961,8 +965,8 @@ def __init__( time_window_rules: Optional[List["_models.TimeWindowCustomAlertRule"]] = None, allowlist_rules: Optional[List["_models.AllowlistCustomAlertRule"]] = None, denylist_rules: Optional[List["_models.DenylistCustomAlertRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword threshold_rules: The list of custom alert threshold rules. :paramtype threshold_rules: @@ -1004,7 +1008,7 @@ class DeviceSecurityGroupList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeviceSecurityGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeviceSecurityGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: List of device security group objects. :paramtype value: list[~azure.mgmt.security.v2019_08_01.models.DeviceSecurityGroup] @@ -1064,8 +1068,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1083,7 +1087,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "DirectMethodInvokesNotInAllowedRange" # type: str + self.rule_type: str = "DirectMethodInvokesNotInAllowedRange" class ErrorAdditionalInfo(_serialization.Model): @@ -1107,7 +1111,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1164,8 +1168,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1183,7 +1187,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "FailedLocalLoginsNotInAllowedRange" # type: str + self.rule_type: str = "FailedLocalLoginsNotInAllowedRange" class FileUploadsNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1236,8 +1240,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1255,7 +1259,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "FileUploadsNotInAllowedRange" # type: str + self.rule_type: str = "FileUploadsNotInAllowedRange" class HttpC2DMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1308,8 +1312,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1327,7 +1331,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "HttpC2DMessagesNotInAllowedRange" # type: str + self.rule_type: str = "HttpC2DMessagesNotInAllowedRange" class HttpC2DRejectedMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1380,8 +1384,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1399,7 +1403,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "HttpC2DRejectedMessagesNotInAllowedRange" # type: str + self.rule_type: str = "HttpC2DRejectedMessagesNotInAllowedRange" class HttpD2CMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1452,8 +1456,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1471,7 +1475,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "HttpD2CMessagesNotInAllowedRange" # type: str + self.rule_type: str = "HttpD2CMessagesNotInAllowedRange" class TagsResource(_serialization.Model): @@ -1485,7 +1489,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1580,7 +1584,7 @@ class IoTSecurityAggregatedAlert(Resource, TagsResource): # pylint: disable=too }, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1629,7 +1633,7 @@ class IoTSecurityAggregatedAlertList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecurityAggregatedAlert"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecurityAggregatedAlert"], **kwargs: Any) -> None: """ :keyword value: List of aggregated alerts data. Required. :paramtype value: list[~azure.mgmt.security.v2019_08_01.models.IoTSecurityAggregatedAlert] @@ -1664,7 +1668,7 @@ class IoTSecurityAggregatedAlertPropertiesTopDevicesListItem(_serialization.Mode "last_occurrence": {"key": "lastOccurrence", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.device_id = None @@ -1740,7 +1744,9 @@ class IoTSecurityAggregatedRecommendation(Resource, TagsResource): # pylint: di "log_analytics_query": {"key": "properties.logAnalyticsQuery", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, recommendation_name: Optional[str] = None, **kwargs): + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, recommendation_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1789,7 +1795,7 @@ class IoTSecurityAggregatedRecommendationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecurityAggregatedRecommendation"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecurityAggregatedRecommendation"], **kwargs: Any) -> None: """ :keyword value: List of aggregated recommendations data. Required. :paramtype value: @@ -1821,7 +1827,7 @@ class IoTSecurityAlertedDevice(_serialization.Model): "alerts_count": {"key": "alertsCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.device_id = None @@ -1829,7 +1835,8 @@ def __init__(self, **kwargs): class IoTSecurityDeviceAlert(_serialization.Model): - """Statistical information about the number of alerts per alert type during last set number of days. + """Statistical information about the number of alerts per alert type during last set number of + days. Variables are only populated by the server, and will be ignored when sending a request. @@ -1854,7 +1861,7 @@ class IoTSecurityDeviceAlert(_serialization.Model): "alerts_count": {"key": "alertsCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.alert_display_name = None @@ -1863,7 +1870,8 @@ def __init__(self, **kwargs): class IoTSecurityDeviceRecommendation(_serialization.Model): - """Statistical information about the number of recommendations per device, per recommendation type. + """Statistical information about the number of recommendations per device, per recommendation + type. Variables are only populated by the server, and will be ignored when sending a request. @@ -1888,7 +1896,7 @@ class IoTSecurityDeviceRecommendation(_serialization.Model): "devices_count": {"key": "devicesCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.recommendation_display_name = None @@ -1962,8 +1970,8 @@ def __init__( top_alerted_devices: Optional[List["_models.IoTSecurityAlertedDevice"]] = None, most_prevalent_device_alerts: Optional[List["_models.IoTSecurityDeviceAlert"]] = None, most_prevalent_device_recommendations: Optional[List["_models.IoTSecurityDeviceRecommendation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword top_alerted_devices: List of the 3 devices with the most alerts. :paramtype top_alerted_devices: @@ -2009,7 +2017,7 @@ class IoTSecuritySolutionAnalyticsModelList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecuritySolutionAnalyticsModel"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecuritySolutionAnalyticsModel"], **kwargs: Any) -> None: """ :keyword value: List of Security analytics of your IoT Security solution. Required. :paramtype value: @@ -2039,8 +2047,8 @@ def __init__( *, date: Optional[datetime.datetime] = None, devices_metrics: Optional["_models.IoTSeverityMetrics"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword date: Aggregation of IoT Security solution device alert metrics by date. :paramtype date: ~datetime.datetime @@ -2148,8 +2156,8 @@ def __init__( recommendations_configuration: Optional[List["_models.RecommendationConfigurationProperties"]] = None, unmasked_ip_logging_status: Union[str, "_models.UnmaskedIpLoggingStatus"] = "Disabled", additional_workspaces: Optional[List["_models.AdditionalWorkspacesProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2229,7 +2237,7 @@ class IoTSecuritySolutionsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecuritySolutionModel"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecuritySolutionModel"], **kwargs: Any) -> None: """ :keyword value: List of IoT Security solutions. Required. :paramtype value: list[~azure.mgmt.security.v2019_08_01.models.IoTSecuritySolutionModel] @@ -2257,8 +2265,8 @@ class IoTSeverityMetrics(_serialization.Model): } def __init__( - self, *, high: Optional[int] = None, medium: Optional[int] = None, low: Optional[int] = None, **kwargs - ): + self, *, high: Optional[int] = None, medium: Optional[int] = None, low: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword high: Count of high severity alerts/recommendations. :paramtype high: int @@ -2314,7 +2322,7 @@ class LocalUserNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2323,7 +2331,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "LocalUserNotAllowed" # type: str + self.rule_type: str = "LocalUserNotAllowed" class MqttC2DMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2376,8 +2384,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2395,7 +2403,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "MqttC2DMessagesNotInAllowedRange" # type: str + self.rule_type: str = "MqttC2DMessagesNotInAllowedRange" class MqttC2DRejectedMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2448,8 +2456,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2467,7 +2475,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "MqttC2DRejectedMessagesNotInAllowedRange" # type: str + self.rule_type: str = "MqttC2DRejectedMessagesNotInAllowedRange" class MqttD2CMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2520,8 +2528,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2539,7 +2547,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "MqttD2CMessagesNotInAllowedRange" # type: str + self.rule_type: str = "MqttD2CMessagesNotInAllowedRange" class ProcessNotAllowed(AllowlistCustomAlertRule): @@ -2583,7 +2591,7 @@ class ProcessNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2592,7 +2600,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "ProcessNotAllowed" # type: str + self.rule_type: str = "ProcessNotAllowed" class QueuePurgesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2645,8 +2653,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2664,7 +2672,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "QueuePurgesNotInAllowedRange" # type: str + self.rule_type: str = "QueuePurgesNotInAllowedRange" class RecommendationConfigurationProperties(_serialization.Model): @@ -2706,8 +2714,8 @@ def __init__( *, recommendation_type: Union[str, "_models.RecommendationType"], status: Union[str, "_models.RecommendationConfigStatus"] = "Enabled", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword recommendation_type: The type of IoT Security recommendation. Required. Known values are: "IoT_ACRAuthentication", "IoT_AgentSendsUnutilizedMessages", "IoT_Baseline", @@ -2765,8 +2773,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2842,8 +2850,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2861,7 +2869,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "TwinUpdatesNotInAllowedRange" # type: str + self.rule_type: str = "TwinUpdatesNotInAllowedRange" class UnauthorizedOperationsNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2914,8 +2922,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2933,7 +2941,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "UnauthorizedOperationsNotInAllowedRange" # type: str + self.rule_type: str = "UnauthorizedOperationsNotInAllowedRange" class UpdateIotSecuritySolutionData(TagsResource): @@ -2965,8 +2973,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, user_defined_resources: Optional["_models.UserDefinedResourcesProperties"] = None, recommendations_configuration: Optional[List["_models.RecommendationConfigurationProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3007,7 +3015,7 @@ class UserDefinedResourcesProperties(_serialization.Model): "query_subscriptions": {"key": "querySubscriptions", "type": "[str]"}, } - def __init__(self, *, query: str, query_subscriptions: List[str], **kwargs): + def __init__(self, *, query: str, query_subscriptions: List[str], **kwargs: Any) -> None: """ :keyword query: Azure Resource Graph query which represents the security solution's user defined resources. Required to start with "where type != "Microsoft.Devices/IotHubs"". diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py index 4231c6d82e58..0f31acb84795 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py @@ -35,15 +35,15 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DataSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DataSource.""" - #: Devices twin data TWIN_DATA = "TwinData" + """Devices twin data""" class ExportData(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExportData.""" - #: Agent raw events RAW_EVENTS = "RawEvents" + """Agent raw events""" class RecommendationConfigStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -58,50 +58,50 @@ class RecommendationConfigStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RecommendationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of IoT Security recommendation.""" - #: Authentication schema used for pull an edge module from an ACR repository does not use Service - #: Principal Authentication. IO_T_ACRAUTHENTICATION = "IoT_ACRAuthentication" - #: IoT agent message size capacity is currently underutilized, causing an increase in the number - #: of sent messages. Adjust message intervals for better utilization. + """Authentication schema used for pull an edge module from an ACR repository does not use Service + #: Principal Authentication.""" IO_T_AGENT_SENDS_UNUTILIZED_MESSAGES = "IoT_AgentSendsUnutilizedMessages" - #: Identified security related system configuration issues. + """IoT agent message size capacity is currently underutilized, causing an increase in the number + #: of sent messages. Adjust message intervals for better utilization.""" IO_T_BASELINE = "IoT_Baseline" - #: You can optimize Edge Hub memory usage by turning off protocol heads for any protocols not used - #: by Edge modules in your solution. + """Identified security related system configuration issues.""" IO_T_EDGE_HUB_MEM_OPTIMIZE = "IoT_EdgeHubMemOptimize" - #: Logging is disabled for this edge module. + """You can optimize Edge Hub memory usage by turning off protocol heads for any protocols not used + #: by Edge modules in your solution.""" IO_T_EDGE_LOGGING_OPTIONS = "IoT_EdgeLoggingOptions" - #: A minority within a device security group has inconsistent Edge Module settings with the rest - #: of their group. + """Logging is disabled for this edge module.""" IO_T_INCONSISTENT_MODULE_SETTINGS = "IoT_InconsistentModuleSettings" - #: Install the Azure Security of Things Agent. + """A minority within a device security group has inconsistent Edge Module settings with the rest + #: of their group.""" IO_T_INSTALL_AGENT = "IoT_InstallAgent" - #: IP Filter Configuration should have rules defined for allowed traffic and should deny all other - #: traffic by default. + """Install the Azure Security of Things Agent.""" IO_T_IPFILTER_DENY_ALL = "IoT_IPFilter_DenyAll" - #: An Allow IP Filter rules source IP range is too large. Overly permissive rules might expose - #: your IoT hub to malicious intenders. + """IP Filter Configuration should have rules defined for allowed traffic and should deny all other + #: traffic by default.""" IO_T_IPFILTER_PERMISSIVE_RULE = "IoT_IPFilter_PermissiveRule" - #: A listening endpoint was found on the device. + """An Allow IP Filter rules source IP range is too large. Overly permissive rules might expose + #: your IoT hub to malicious intenders.""" IO_T_OPEN_PORTS = "IoT_OpenPorts" - #: An Allowed firewall policy was found (INPUT/OUTPUT). The policy should Deny all traffic by - #: default and define rules to allow necessary communication to/from the device. + """A listening endpoint was found on the device.""" IO_T_PERMISSIVE_FIREWALL_POLICY = "IoT_PermissiveFirewallPolicy" - #: A rule in the firewall has been found that contains a permissive pattern for a wide range of IP - #: addresses or Ports. + """An Allowed firewall policy was found (INPUT/OUTPUT). The policy should Deny all traffic by + #: default and define rules to allow necessary communication to/from the device.""" IO_T_PERMISSIVE_INPUT_FIREWALL_RULES = "IoT_PermissiveInputFirewallRules" - #: A rule in the firewall has been found that contains a permissive pattern for a wide range of IP - #: addresses or Ports. + """A rule in the firewall has been found that contains a permissive pattern for a wide range of IP + #: addresses or Ports.""" IO_T_PERMISSIVE_OUTPUT_FIREWALL_RULES = "IoT_PermissiveOutputFirewallRules" - #: Edge module is configured to run in privileged mode, with extensive Linux capabilities or with - #: host-level network access (send/receive data to host machine). + """A rule in the firewall has been found that contains a permissive pattern for a wide range of IP + #: addresses or Ports.""" IO_T_PRIVILEGED_DOCKER_OPTIONS = "IoT_PrivilegedDockerOptions" - #: Same authentication credentials to the IoT Hub used by multiple devices. This could indicate an - #: illegitimate device impersonating a legitimate device. It also exposes the risk of device - #: impersonation by an attacker. + """Edge module is configured to run in privileged mode, with extensive Linux capabilities or with + #: host-level network access (send/receive data to host machine).""" IO_T_SHARED_CREDENTIALS = "IoT_SharedCredentials" - #: Insecure TLS configurations detected. Immediate upgrade recommended. + """Same authentication credentials to the IoT Hub used by multiple devices. This could indicate an + #: illegitimate device impersonating a legitimate device. It also exposes the risk of device + #: impersonation by an attacker.""" IO_T_VULNERABLE_TLS_CIPHER_SUITE = "IoT_VulnerableTLSCipherSuite" + """Insecure TLS configurations detected. Immediate upgrade recommended.""" class ReportedSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -123,16 +123,16 @@ class SecuritySolutionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class UnmaskedIpLoggingStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Unmasked IP address logging status.""" - #: Unmasked IP logging is disabled DISABLED = "Disabled" - #: Unmasked IP logging is enabled + """Unmasked IP logging is disabled""" ENABLED = "Enabled" + """Unmasked IP logging is enabled""" class ValueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The value type of the items in the list.""" - #: An IP range in CIDR format (e.g. '192.168.0.1/8'). IP_CIDR = "IpCidr" - #: Any string value. + """An IP range in CIDR format (e.g. '192.168.0.1/8').""" STRING = "String" + """Any string value.""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py index 9659bbd2cebc..8f30c8ed00eb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py @@ -17,7 +17,7 @@ from ._iot_security_solution_operations import IotSecuritySolutionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py index 4d8448b0db33..67726150d0e4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py @@ -45,7 +45,7 @@ def build_list_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(resource_id: str, **kwargs: Any) -> HttpRequest: "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(resource_id: str, device_security_group_name: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request(resource_id: str, device_security_group_name: str, **kwarg "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,8 +96,8 @@ def build_create_or_update_request(resource_id: str, device_security_group_name: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_or_update_request(resource_id: str, device_security_group_name: "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +126,7 @@ def build_delete_request(resource_id: str, device_security_group_name: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +138,7 @@ def build_delete_request(resource_id: str, device_security_group_name: str, **kw "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,8 +183,8 @@ def list(self, resource_id: str, **kwargs: Any) -> Iterable["_models.DeviceSecur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroupList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroupList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -205,7 +205,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -221,7 +221,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -229,13 +229,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DeviceSecurityGroupList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -248,7 +248,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} @distributed_trace def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) -> _models.DeviceSecurityGroup: @@ -275,8 +275,8 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -287,9 +287,9 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -306,7 +306,7 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} @overload def create_or_update( @@ -382,8 +382,8 @@ def create_or_update( :param device_security_group_name: The name of the device security group. Note that the name of the device security group is case insensitive. Required. :type device_security_group_name: str - :param device_security_group: Security group object. Is either a model type or a IO type. - Required. + :param device_security_group: Security group object. Is either a DeviceSecurityGroup type or a + IO type. Required. :type device_security_group: ~azure.mgmt.security.v2019_08_01.models.DeviceSecurityGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -404,9 +404,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -428,9 +428,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -447,11 +447,13 @@ def create_or_update( deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -480,8 +482,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -492,9 +494,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -507,4 +509,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py index 4388c6b46011..949a677a614b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py @@ -45,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +63,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +78,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,8 +153,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -166,9 +166,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -185,7 +185,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels" + } @distributed_trace def get( @@ -214,8 +216,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -227,9 +229,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -246,4 +248,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py index 51e5cf8b82f6..0a1334f6b6ab 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py @@ -47,7 +47,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_by_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_list_by_resource_group_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +148,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,8 +186,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +205,7 @@ def build_update_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,7 +224,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +242,7 @@ def build_delete_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -291,8 +291,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace def list_by_resource_group( @@ -381,8 +383,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -405,7 +407,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -421,7 +423,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -429,13 +431,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -448,7 +450,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _models.IoTSecuritySolutionModel: @@ -475,8 +479,8 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -488,9 +492,9 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -507,7 +511,9 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload def create_or_update( @@ -581,8 +587,8 @@ def create_or_update( :type resource_group_name: str :param solution_name: The name of the IoT Security solution. Required. :type solution_name: str - :param iot_security_solution_data: The security solution data. Is either a model type or a IO - type. Required. + :param iot_security_solution_data: The security solution data. Is either a + IoTSecuritySolutionModel type or a IO type. Required. :type iot_security_solution_data: ~azure.mgmt.security.v2019_08_01.models.IoTSecuritySolutionModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -604,9 +610,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -629,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload def update( @@ -729,8 +737,8 @@ def update( :type resource_group_name: str :param solution_name: The name of the IoT Security solution. Required. :type solution_name: str - :param update_iot_security_solution_data: The security solution data. Is either a model type or - a IO type. Required. + :param update_iot_security_solution_data: The security solution data. Is either a + UpdateIotSecuritySolutionData type or a IO type. Required. :type update_iot_security_solution_data: ~azure.mgmt.security.v2019_08_01.models.UpdateIotSecuritySolutionData or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -752,9 +760,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +785,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +804,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,8 +835,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -838,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -853,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index bee10b9a1908..f953883c6126 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -47,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +65,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +103,7 @@ def build_get_request( "aggregatedAlertName": _SERIALIZER.url("aggregated_alert_name", aggregated_alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +120,7 @@ def build_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_dismiss_request( "aggregatedAlertName": _SERIALIZER.url("aggregated_alert_name", aggregated_alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,8 +192,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlertList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -217,7 +217,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -233,7 +233,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -241,13 +241,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedAlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -260,7 +260,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts" + } @distributed_trace def get( @@ -292,8 +294,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlert] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlert] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -306,9 +308,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -325,7 +327,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}" + } @distributed_trace def dismiss( # pylint: disable=inconsistent-return-statements @@ -356,8 +360,8 @@ def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_dismiss_request( resource_group_name=resource_group_name, @@ -370,9 +374,9 @@ def dismiss( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -385,4 +389,6 @@ def dismiss( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss"} # type: ignore + dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py index c29f12f7c3b0..c143feaa349b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -51,7 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +107,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,8 +170,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendation] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -184,9 +184,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +203,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}" + } @distributed_trace def list( @@ -229,8 +231,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendationList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -254,7 +256,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -270,7 +272,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -278,13 +280,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedRecommendationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -297,4 +299,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py index fa080065851b..64f740d2b832 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01") # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", "2020-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json index ba0549615a76..c4119e2e2f6d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py index cfe27e5eb433..4bf1a0c76d3c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -106,7 +106,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -172,15 +172,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py index 9847128e0ae1..f80d5f1e3b1c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01") # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", "2020-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py index bffa59af0435..01c3f8bff3fa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -106,7 +106,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -179,5 +179,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py index 8f44c7940e4b..d0f4c9a78a25 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py @@ -23,7 +23,7 @@ from ._security_solutions_operations import SecuritySolutionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py index bfd1f3c2973c..55f68a501794 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py @@ -86,8 +86,8 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroups] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -99,9 +99,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,7 +118,7 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} @distributed_trace_async async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.AdaptiveApplicationControlGroup: @@ -145,8 +145,8 @@ async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -158,9 +158,9 @@ async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _model params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -177,7 +177,9 @@ async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _model return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @overload async def put( @@ -244,7 +246,7 @@ async def put( :type asc_location: str :param group_name: Name of an application control machine group. Required. :type group_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a AdaptiveApplicationControlGroup type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -265,9 +267,9 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -290,9 +292,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -309,7 +311,9 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -338,8 +342,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( asc_location=asc_location, @@ -351,9 +355,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -366,4 +370,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py index 42a8ec4659a4..a30388d959fd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py @@ -89,8 +89,8 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardeningsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -131,7 +131,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -139,13 +139,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AdaptiveNetworkHardeningsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings" + } @distributed_trace_async async def get( @@ -200,8 +202,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardening] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -216,9 +218,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,7 +237,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}" + } async def _enforce_initial( # pylint: disable=inconsistent-return-statements self, @@ -258,12 +262,12 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -290,9 +294,9 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -305,7 +309,9 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _enforce_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + _enforce_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } @overload async def begin_enforce( @@ -430,7 +436,7 @@ async def begin_enforce( :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening resource. Required. :type adaptive_network_hardening_resource_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a AdaptiveNetworkHardeningEnforceRequest type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardeningEnforceRequest or IO :keyword adaptive_network_hardening_enforce_action: Enforces the given rules on the NSG(s) @@ -455,15 +461,15 @@ async def begin_enforce( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._enforce_initial( # type: ignore resource_group_name=resource_group_name, @@ -487,7 +493,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -499,6 +505,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_enforce.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + begin_enforce.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py index cb341ce95ec9..09cec20e976e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py @@ -76,8 +76,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AllowedConnectionsResour _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,7 +141,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} @distributed_trace def list_by_home_region( @@ -162,8 +162,8 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections" + } @distributed_trace_async async def get( @@ -266,8 +268,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -280,9 +282,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -299,4 +301,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py index e6ac957eedaa..532ac59a5107 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py @@ -79,8 +79,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetada _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace_async async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadata: @@ -168,8 +168,8 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -179,9 +179,9 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,7 +198,7 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadata"]: @@ -214,8 +214,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -236,7 +236,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -252,7 +252,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,13 +260,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -279,7 +279,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace_async async def get_in_subscription( @@ -306,8 +308,8 @@ async def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -318,9 +320,9 @@ async def get_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -337,7 +339,9 @@ async def get_in_subscription( return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload async def create_in_subscription( @@ -401,8 +405,8 @@ async def create_in_subscription( :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_metadata_name: str - :param assessment_metadata: AssessmentMetadata object. Is either a model type or a IO type. - Required. + :param assessment_metadata: AssessmentMetadata object. Is either a SecurityAssessmentMetadata + type or a IO type. Required. :type assessment_metadata: ~azure.mgmt.security.v2020_01_01.models.SecurityAssessmentMetadata or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -424,9 +428,9 @@ async def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -448,9 +452,9 @@ async def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -467,7 +471,9 @@ async def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace_async async def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -495,8 +501,8 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -507,9 +513,9 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -522,4 +528,6 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py index 1761db658ea4..676c55112039 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py @@ -80,8 +80,8 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAsse _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -118,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,7 +145,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace_async async def get( @@ -180,8 +180,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -193,9 +193,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,7 +212,7 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload async def create_or_update( @@ -282,7 +282,7 @@ async def create_or_update( :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_name: str :param assessment: Calculated assessment on a pre-defined assessment metadata. Is either a - model type or a IO type. Required. + SecurityAssessment type or a IO type. Required. :type assessment: ~azure.mgmt.security.v2020_01_01.models.SecurityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -303,9 +303,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,9 +327,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -346,11 +346,11 @@ async def create_or_update( deserialized = self._deserialize("SecurityAssessment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -379,8 +379,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -391,9 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -406,4 +406,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py index 48d2baa9aead..68dcc7918ed6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py @@ -76,8 +76,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredSecuritySoluti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,7 +141,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} @distributed_trace def list_by_home_region( @@ -162,8 +162,8 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions" + } @distributed_trace_async async def get( @@ -260,8 +262,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -274,9 +276,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -293,4 +295,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py index 180037abff08..e49da1c7c58c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py @@ -76,8 +76,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ExternalSecuritySolution _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,7 +141,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} @distributed_trace def list_by_home_region( @@ -162,8 +162,8 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions" + } @distributed_trace_async async def get( @@ -260,8 +262,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -274,9 +276,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -293,4 +295,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py index d5a6f0671157..4eba991cc329 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py @@ -81,8 +81,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} @distributed_trace def list_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: @@ -166,8 +166,8 @@ def list_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -189,7 +189,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -205,7 +205,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -213,13 +213,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -232,7 +232,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group( @@ -254,8 +256,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -277,7 +279,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -293,7 +295,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -301,13 +303,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -320,7 +322,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group_and_region( @@ -345,8 +349,8 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -369,7 +373,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -385,7 +389,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -393,13 +397,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -412,7 +416,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group_and_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group_and_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace_async async def get( @@ -446,8 +452,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -460,9 +466,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -479,7 +485,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload async def create_or_update( @@ -567,7 +575,7 @@ async def create_or_update( :param jit_network_access_policy_name: Name of a Just-in-Time access configuration policy. Required. :type jit_network_access_policy_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a JitNetworkAccessPolicy type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.JitNetworkAccessPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -588,9 +596,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -614,9 +622,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -633,7 +641,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -666,8 +676,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -680,9 +690,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -695,7 +705,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload async def initiate( @@ -791,7 +803,7 @@ async def initiate( :param jit_network_access_policy_name: Name of a Just-in-Time access configuration policy. Required. :type jit_network_access_policy_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a JitNetworkAccessPolicyInitiateRequest type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.JitNetworkAccessPolicyInitiateRequest or IO :keyword jit_network_access_policy_initiate_type: Type of the action to do on the Just-in-Time access policy. Default value is "initiate". Note that overriding this default value may result @@ -816,12 +828,12 @@ async def initiate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - jit_network_access_policy_initiate_type = kwargs.pop( + jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: Literal["initiate"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessRequest] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -846,9 +858,9 @@ async def initiate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -865,4 +877,6 @@ async def initiate( return deserialized - initiate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}"} # type: ignore + initiate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py index 1666c3f2a99e..a9a7d7af47e4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py @@ -74,8 +74,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefini _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,7 +95,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -111,7 +111,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,13 +119,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,7 +138,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefinitionItem"]: @@ -155,8 +155,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecureSc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -177,7 +177,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -193,7 +193,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -201,13 +201,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -220,4 +220,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py index d935cbe380ac..7c34c6c9b877 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py @@ -78,8 +78,8 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -118,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,7 +145,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_secure_score.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls"} # type: ignore + list_by_secure_score.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls" + } @distributed_trace def list( @@ -165,8 +167,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -188,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -204,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -212,13 +214,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -231,4 +233,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py index c4821406dd76..eef4aa404d3c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py @@ -72,8 +72,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreItem"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoresList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +94,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +110,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +137,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} @distributed_trace_async async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: @@ -163,8 +163,8 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreItem] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreItem] = kwargs.pop("cls", None) request = build_get_request( secure_score_name=secure_score_name, @@ -175,9 +175,9 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,4 +194,6 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py index dd8c2bd37cad..3424b3848fce 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} @distributed_trace_async async def get( @@ -168,8 +168,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -182,9 +182,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -201,4 +201,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py index 5e79c73762c7..3e018804af72 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py @@ -78,8 +78,8 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -89,9 +89,9 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -108,7 +108,9 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData" + } @distributed_trace_async async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: @@ -133,8 +135,8 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_by_home_region_request( asc_location=asc_location, @@ -145,9 +147,9 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +166,6 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models return deserialized - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py index 3b7016783df2..53e820321c65 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py @@ -93,8 +93,8 @@ async def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessmentsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessmentsList] = kwargs.pop("cls", None) request = build_list_by_extended_resource_request( resource_group_name=resource_group_name, @@ -108,9 +108,9 @@ async def list_by_extended_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,7 +127,9 @@ async def list_by_extended_resource( return deserialized - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" + } @distributed_trace_async async def get( @@ -164,11 +166,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -183,9 +183,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -202,7 +202,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace_async async def create_or_update( @@ -240,11 +242,9 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -259,9 +259,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,7 +278,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any @@ -294,11 +296,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -313,9 +313,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -328,7 +328,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace_async async def begin_delete( @@ -364,14 +366,12 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -392,9 +392,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -406,6 +406,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py index 8568c81fb33c..bd94c2a441b3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: @@ -154,8 +154,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -177,7 +177,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -193,7 +193,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -201,13 +201,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -220,7 +220,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies" + } @distributed_trace_async async def get( @@ -252,8 +254,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -266,9 +268,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -285,4 +287,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py index 22cb443808b0..696464205ce0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py @@ -118,7 +118,7 @@ from ._security_center_enums import TransportProtocol from ._security_center_enums import UserImpact from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py index f912e7b9bdda..973f6bc5f9b1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py @@ -31,8 +31,8 @@ class AadConnectivityState(_serialization.Model): } def __init__( - self, *, connectivity_state: Optional[Union[str, "_models.AadConnectivityStateEnum"]] = None, **kwargs - ): + self, *, connectivity_state: Optional[Union[str, "_models.AadConnectivityStateEnum"]] = None, **kwargs: Any + ) -> None: """ :keyword connectivity_state: The connectivity state of the external AAD solution. Known values are: "Discovered", "NotLicensed", and "Connected". @@ -60,7 +60,7 @@ class Location(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -77,7 +77,9 @@ class ExternalSecuritySolutionKind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs): + def __init__( + self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -112,7 +114,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -121,7 +123,8 @@ def __init__(self, **kwargs): class ExternalSecuritySolution(Resource, ExternalSecuritySolutionKind, Location): - """Represents a security solution external to Microsoft Defender for Cloud which sends information to an OMS workspace and whose data is displayed by Microsoft Defender for Cloud. + """Represents a security solution external to Microsoft Defender for Cloud which sends information + to an OMS workspace and whose data is displayed by Microsoft Defender for Cloud. Variables are only populated by the server, and will be ignored when sending a request. @@ -152,7 +155,9 @@ class ExternalSecuritySolution(Resource, ExternalSecuritySolutionKind, Location) "type": {"key": "type", "type": "str"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs): + def __init__( + self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -206,8 +211,8 @@ def __init__( *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, properties: Optional["_models.AadSolutionProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -247,8 +252,8 @@ def __init__( device_vendor: Optional[str] = None, device_type: Optional[str] = None, workspace: Optional["_models.ConnectedWorkspace"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -301,8 +306,8 @@ def __init__( device_vendor: Optional[str] = None, device_type: Optional[str] = None, workspace: Optional["_models.ConnectedWorkspace"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connectivity_state: The connectivity state of the external AAD solution. Known values are: "Discovered", "NotLicensed", and "Connected". @@ -405,8 +410,8 @@ def __init__( protection_mode: Optional["_models.ProtectionMode"] = None, vm_recommendations: Optional[List["_models.VmRecommendation"]] = None, path_recommendations: Optional[List["_models.PathRecommendation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enforcement_mode: The application control policy enforcement/protection mode of the machine group. Known values are: "Audit", "Enforce", and "None". @@ -436,7 +441,8 @@ def __init__( class AdaptiveApplicationControlGroups(_serialization.Model): - """Represents a list of VM/server groups and set of rules that are Recommended by Microsoft Defender for Cloud to be allowed. + """Represents a list of VM/server groups and set of rules that are Recommended by Microsoft + Defender for Cloud to be allowed. :ivar value: :vartype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup] @@ -446,7 +452,9 @@ class AdaptiveApplicationControlGroups(_serialization.Model): "value": {"key": "value", "type": "[AdaptiveApplicationControlGroup]"}, } - def __init__(self, *, value: Optional[List["_models.AdaptiveApplicationControlGroup"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.AdaptiveApplicationControlGroup"]] = None, **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup] @@ -476,8 +484,8 @@ def __init__( *, issue: Optional[Union[str, "_models.AdaptiveApplicationControlIssue"]] = None, number_of_vms: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword issue: An alert that machines within a group can have. Known values are: "ViolationsAudited", "ViolationsBlocked", "MsiAndScriptViolationsAudited", @@ -493,7 +501,8 @@ def __init__( class AdaptiveNetworkHardening(Resource): - """The resource whose properties describes the Adaptive Network Hardening settings for some Azure resource. + """The resource whose properties describes the Adaptive Network Hardening settings for some Azure + resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -537,8 +546,8 @@ def __init__( rules: Optional[List["_models.Rule"]] = None, rules_calculation_time: Optional[datetime.datetime] = None, effective_network_security_groups: Optional[List["_models.EffectiveNetworkSecurityGroups"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rules: The security rules which are recommended to be effective on the VM. :paramtype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] @@ -578,7 +587,7 @@ class AdaptiveNetworkHardeningEnforceRequest(_serialization.Model): "network_security_groups": {"key": "networkSecurityGroups", "type": "[str]"}, } - def __init__(self, *, rules: List["_models.Rule"], network_security_groups: List[str], **kwargs): + def __init__(self, *, rules: List["_models.Rule"], network_security_groups: List[str], **kwargs: Any) -> None: """ :keyword rules: The rules to enforce. Required. :paramtype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] @@ -611,8 +620,8 @@ def __init__( *, value: Optional[List["_models.AdaptiveNetworkHardening"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A list of Adaptive Network Hardenings resources. :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening] @@ -645,7 +654,7 @@ class AllowedConnectionsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -691,7 +700,7 @@ class AllowedConnectionsResource(Resource, Location): "connectable_resources": {"key": "properties.connectableResources", "type": "[ConnectableResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -719,7 +728,7 @@ class AssessmentLinks(_serialization.Model): "azure_portal_uri": {"key": "azurePortalUri", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.azure_portal_uri = None @@ -755,8 +764,8 @@ def __init__( code: Union[str, "_models.AssessmentStatusCode"], cause: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Programmatic code for the status of the assessment. Required. Known values are: "Healthy", "Unhealthy", and "NotApplicable". @@ -812,8 +821,8 @@ def __init__( *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, properties: Optional["_models.AtaSolutionProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -857,8 +866,8 @@ def __init__( device_type: Optional[str] = None, workspace: Optional["_models.ConnectedWorkspace"] = None, last_event_received: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -905,10 +914,10 @@ class ResourceDetails(_serialization.Model): _subtype_map = {"source": {"Azure": "AzureResourceDetails", "OnPremise": "OnPremiseResourceDetails"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = None # type: Optional[str] + self.source: Optional[str] = None class AzureResourceDetails(ResourceDetails): @@ -935,10 +944,10 @@ class AzureResourceDetails(ResourceDetails): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = "Azure" # type: str + self.source: str = "Azure" self.id = None @@ -959,7 +968,7 @@ class AzureResourceLink(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1005,8 +1014,8 @@ def __init__( *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, properties: Optional["_models.CefSolutionProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -1058,8 +1067,8 @@ def __init__( hostname: Optional[str] = None, agent: Optional[str] = None, last_event_received: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1122,7 +1131,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1161,7 +1170,7 @@ class ConnectableResource(_serialization.Model): "outbound_connected_resources": {"key": "outboundConnectedResources", "type": "[ConnectedResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1194,7 +1203,7 @@ class ConnectedResource(_serialization.Model): "udp_ports": {"key": "udpPorts", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.connected_resource_id = None @@ -1213,7 +1222,7 @@ class ConnectedWorkspace(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Azure resource ID of the connected OMS workspace. :paramtype id: str @@ -1271,8 +1280,14 @@ class DiscoveredSecuritySolution(Resource, Location): } def __init__( - self, *, security_family: Union[str, "_models.SecurityFamily"], offer: str, publisher: str, sku: str, **kwargs - ): + self, + *, + security_family: Union[str, "_models.SecurityFamily"], + offer: str, + publisher: str, + sku: str, + **kwargs: Any + ) -> None: """ :keyword security_family: The security family of the discovered solution. Required. Known values are: "Waf", "Ngfw", "SaasWaf", and "Va". @@ -1315,7 +1330,7 @@ class DiscoveredSecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DiscoveredSecuritySolution"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DiscoveredSecuritySolution"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.DiscoveredSecuritySolution] @@ -1340,8 +1355,12 @@ class EffectiveNetworkSecurityGroups(_serialization.Model): } def __init__( - self, *, network_interface: Optional[str] = None, network_security_groups: Optional[List[str]] = None, **kwargs - ): + self, + *, + network_interface: Optional[str] = None, + network_security_groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ :keyword network_interface: The Azure resource ID of the network interface. :paramtype network_interface: str @@ -1375,7 +1394,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1402,7 +1421,7 @@ class ExternalSecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ExternalSecuritySolution"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ExternalSecuritySolution"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.ExternalSecuritySolution] @@ -1432,7 +1451,7 @@ class JitNetworkAccessPoliciesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JitNetworkAccessPolicy"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JitNetworkAccessPolicy"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.JitNetworkAccessPolicy] @@ -1453,7 +1472,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -1515,8 +1534,8 @@ def __init__( virtual_machines: List["_models.JitNetworkAccessPolicyVirtualMachine"], kind: Optional[str] = None, requests: Optional[List["_models.JitNetworkAccessRequest"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -1569,8 +1588,8 @@ def __init__( number: int, end_time_utc: datetime.datetime, allowed_source_address_prefix: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword number: Required. :paramtype number: int @@ -1612,8 +1631,8 @@ def __init__( *, virtual_machines: List["_models.JitNetworkAccessPolicyInitiateVirtualMachine"], justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword virtual_machines: A list of virtual machines & ports to open access for. Required. :paramtype virtual_machines: @@ -1653,8 +1672,8 @@ def __init__( *, id: str, # pylint: disable=redefined-builtin ports: List["_models.JitNetworkAccessPolicyInitiatePort"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Resource ID of the virtual machine that is linked to this policy. Required. :paramtype id: str @@ -1698,8 +1717,8 @@ def __init__( id: str, # pylint: disable=redefined-builtin ports: List["_models.JitNetworkAccessPortRule"], public_ip_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Resource ID of the virtual machine that is linked to this policy. Required. :paramtype id: str @@ -1757,8 +1776,8 @@ def __init__( max_request_access_duration: str, allowed_source_address_prefix: Optional[str] = None, allowed_source_address_prefixes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword number: Required. :paramtype number: int @@ -1819,8 +1838,8 @@ def __init__( start_time_utc: datetime.datetime, requestor: str, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword virtual_machines: Required. :paramtype virtual_machines: @@ -1891,8 +1910,8 @@ def __init__( allowed_source_address_prefix: Optional[str] = None, allowed_source_address_prefixes: Optional[List[str]] = None, mapped_port: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword number: Required. :paramtype number: int @@ -1950,8 +1969,8 @@ def __init__( *, id: str, # pylint: disable=redefined-builtin ports: List["_models.JitNetworkAccessRequestPort"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Resource ID of the virtual machine that is linked to this policy. Required. :paramtype id: str @@ -2002,7 +2021,9 @@ class OnPremiseResourceDetails(ResourceDetails): _subtype_map = {"source": {"OnPremiseSql": "OnPremiseSqlResourceDetails"}} - def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs): + def __init__( + self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -2014,7 +2035,7 @@ def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, m :paramtype machine_name: str """ super().__init__(**kwargs) - self.source = "OnPremise" # type: str + self.source: str = "OnPremise" self.workspace_id = workspace_id self.vmuuid = vmuuid self.source_computer_id = source_computer_id @@ -2072,8 +2093,8 @@ def __init__( machine_name: str, server_name: str, database_name: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -2095,7 +2116,7 @@ def __init__( machine_name=machine_name, **kwargs ) - self.source = "OnPremiseSql" # type: str + self.source: str = "OnPremiseSql" self.server_name = server_name self.database_name = database_name @@ -2152,8 +2173,8 @@ def __init__( usernames: Optional[List["_models.UserRecommendation"]] = None, file_type: Optional[Union[str, "_models.FileType"]] = None, configuration_status: Optional[Union[str, "_models.ConfigurationStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The full path of the file, or an identifier of the application. :paramtype path: str @@ -2192,7 +2213,8 @@ def __init__( class ProtectionMode(_serialization.Model): - """The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, Executable is used for Linux. + """The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, + Executable is used for Linux. :ivar exe: The application control policy enforcement/protection mode of the machine group. Known values are: "Audit", "Enforce", and "None". @@ -2222,8 +2244,8 @@ def __init__( msi: Optional[Union[str, "_models.EnforcementMode"]] = None, script: Optional[Union[str, "_models.EnforcementMode"]] = None, executable: Optional[Union[str, "_models.EnforcementMode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword exe: The application control policy enforcement/protection mode of the machine group. Known values are: "Audit", "Enforce", and "None". @@ -2273,8 +2295,8 @@ def __init__( product_name: Optional[str] = None, binary_name: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher_name: The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = @@ -2295,7 +2317,8 @@ def __init__( class Rule(_serialization.Model): - """Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, Direction). All other remote addresses are recommended to be blocked. + """Describes remote addresses that is recommended to communicate with the Azure resource on some + (Protocol, Port, Direction). All other remote addresses are recommended to be blocked. :ivar name: The name of the rule. :vartype name: str @@ -2330,8 +2353,8 @@ def __init__( destination_port: Optional[int] = None, protocols: Optional[List[Union[str, "_models.TransportProtocol"]]] = None, ip_addresses: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the rule. :paramtype name: str @@ -2400,7 +2423,7 @@ class SecureScoreControlDefinitionItem(Resource): "assessment_definitions": {"key": "properties.assessmentDefinitions", "type": "[AzureResourceLink]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.display_name = None @@ -2431,7 +2454,7 @@ class SecureScoreControlDefinitionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2450,7 +2473,7 @@ class SecureScoreControlDefinitionSource(_serialization.Model): "source_type": {"key": "sourceType", "type": "str"}, } - def __init__(self, *, source_type: Optional[Union[str, "_models.ControlType"]] = None, **kwargs): + def __init__(self, *, source_type: Optional[Union[str, "_models.ControlType"]] = None, **kwargs: Any) -> None: """ :keyword source_type: The type of security control (for example, BuiltIn). Known values are: "BuiltIn" and "Custom". @@ -2522,7 +2545,9 @@ class SecureScoreControlDetails(Resource): # pylint: disable=too-many-instance- "percentage": {"key": "properties.score.percentage", "type": "float"}, } - def __init__(self, *, definition: Optional["_models.SecureScoreControlDefinitionItem"] = None, **kwargs): + def __init__( + self, *, definition: Optional["_models.SecureScoreControlDefinitionItem"] = None, **kwargs: Any + ) -> None: """ :keyword definition: Information about the security control. :paramtype definition: ~azure.mgmt.security.v2020_01_01.models.SecureScoreControlDefinitionItem @@ -2560,7 +2585,7 @@ class SecureScoreControlList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2594,7 +2619,7 @@ class SecureScoreControlScore(_serialization.Model): "percentage": {"key": "percentage", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.max = None @@ -2649,7 +2674,7 @@ class SecureScoreItem(Resource): "percentage": {"key": "properties.score.percentage", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.display_name = None @@ -2680,7 +2705,7 @@ class SecureScoresList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2743,8 +2768,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. :paramtype resource_details: ~azure.mgmt.security.v2020_01_01.models.ResourceDetails @@ -2789,7 +2814,7 @@ class SecurityAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2881,8 +2906,8 @@ def __init__( preview: Optional[bool] = None, assessment_type: Optional[Union[str, "_models.AssessmentType"]] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. :paramtype display_name: str @@ -2951,7 +2976,7 @@ class SecurityAssessmentMetadataList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2983,7 +3008,7 @@ class SecurityAssessmentMetadataPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs): + def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -3077,8 +3102,8 @@ def __init__( threats: Optional[List[Union[str, "_models.Threats"]]] = None, preview: Optional[bool] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. Required. :paramtype display_name: str @@ -3147,7 +3172,7 @@ class SecurityAssessmentPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, **kwargs): + def __init__(self, *, partner_name: str, secret: str, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -3209,8 +3234,8 @@ def __init__( provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, template: Optional[str] = None, protection_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword security_family: The security family of the security solution. Known values are: "Waf", "Ngfw", "SaasWaf", and "Va". @@ -3254,7 +3279,7 @@ class SecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SecuritySolution"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.SecuritySolution"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.SecuritySolution] @@ -3334,8 +3359,8 @@ def __init__( publisher: str, publisher_display_name: str, template: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword security_family: The security family of the security solution. Required. Known values are: "Waf", "Ngfw", "SaasWaf", and "Va". @@ -3378,7 +3403,9 @@ class SecuritySolutionsReferenceDataList(_serialization.Model): "value": {"key": "value", "type": "[SecuritySolutionsReferenceData]"}, } - def __init__(self, *, value: Optional[List["_models.SecuritySolutionsReferenceData"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SecuritySolutionsReferenceData"]] = None, **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.SecuritySolutionsReferenceData] @@ -3419,7 +3446,7 @@ class ServerVulnerabilityAssessment(Resource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -3436,7 +3463,7 @@ class ServerVulnerabilityAssessmentsList(_serialization.Model): "value": {"key": "value", "type": "[ServerVulnerabilityAssessment]"}, } - def __init__(self, *, value: Optional[List["_models.ServerVulnerabilityAssessment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ServerVulnerabilityAssessment"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.ServerVulnerabilityAssessment] @@ -3466,7 +3493,7 @@ class TopologyList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -3511,7 +3538,7 @@ class TopologyResource(Resource, Location): "topology_resources": {"key": "properties.topologyResources", "type": "[TopologySingleResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -3570,7 +3597,7 @@ class TopologySingleResource(_serialization.Model): "children": {"key": "children", "type": "[TopologySingleResourceChild]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None @@ -3600,7 +3627,7 @@ class TopologySingleResourceChild(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None @@ -3623,7 +3650,7 @@ class TopologySingleResourceParent(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None @@ -3650,8 +3677,8 @@ def __init__( *, username: Optional[str] = None, recommendation_action: Optional[Union[str, "_models.RecommendationAction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword username: Represents a user that is recommended to be allowed for a certain rule. :paramtype username: str @@ -3697,8 +3724,8 @@ def __init__( recommendation_action: Optional[Union[str, "_models.RecommendationAction"]] = None, resource_id: Optional[str] = None, enforcement_support: Optional[Union[str, "_models.EnforcementSupport"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword configuration_status: The configuration status of the machines group or machine or rule. Known values are: "Configured", "NotConfigured", "InProgress", "Failed", and "NoStatus". diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py index 3521c0d26140..71cd7a4099ea 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py @@ -32,12 +32,12 @@ class AdaptiveApplicationControlIssue(str, Enum, metaclass=CaseInsensitiveEnumMe class AssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Programmatic code for the status of the assessment.""" - #: The resource is healthy HEALTHY = "Healthy" - #: The resource has a security issue that needs to be addressed + """The resource is healthy""" UNHEALTHY = "Unhealthy" - #: Assessment for this resource did not happen + """The resource has a security issue that needs to be addressed""" NOT_APPLICABLE = "NotApplicable" + """Assessment for this resource did not happen""" class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -45,16 +45,16 @@ class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): based on custom Azure Policy definition. """ - #: Microsoft Defender for Cloud managed assessments BUILT_IN = "BuiltIn" - #: User defined policies that are automatically ingested from Azure Policy to Microsoft Defender - #: for Cloud + """Microsoft Defender for Cloud managed assessments""" CUSTOM_POLICY = "CustomPolicy" - #: User assessments pushed directly by the user or other third party to Microsoft Defender for - #: Cloud + """User defined policies that are automatically ingested from Azure Policy to Microsoft Defender + #: for Cloud""" CUSTOMER_MANAGED = "CustomerManaged" - #: An assessment that was created by a verified 3rd party if the user connected it to ASC + """User assessments pushed directly by the user or other third party to Microsoft Defender for + #: Cloud""" VERIFIED_PARTNER = "VerifiedPartner" + """An assessment that was created by a verified 3rd party if the user connected it to ASC""" class Categories(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -87,10 +87,10 @@ class ConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ControlType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of security control (for example, BuiltIn).""" - #: Microsoft Defender for Cloud managed assessments BUILT_IN = "BuiltIn" - #: Non Microsoft Defender for Cloud managed assessments + """Microsoft Defender for Cloud managed assessments""" CUSTOM = "Custom" + """Non Microsoft Defender for Cloud managed assessments""" class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -119,17 +119,17 @@ class EnforcementSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ExpandControlsEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandControlsEnum.""" - #: Add definition object for each control DEFINITION = "definition" + """Add definition object for each control""" class ExpandEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandEnum.""" - #: All links associated with an assessment LINKS = "links" - #: Assessment metadata + """All links associated with an assessment""" METADATA = "metadata" + """Assessment metadata""" class ExternalSecuritySolutionKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -233,12 +233,12 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The platform where the assessed resource resides.""" - #: Resource is in Azure AZURE = "Azure" - #: Resource in an on premise machine connected to Azure cloud + """Resource is in Azure""" ON_PREMISE = "OnPremise" - #: SQL Resource in an on premise machine connected to Azure cloud + """Resource in an on premise machine connected to Azure cloud""" ON_PREMISE_SQL = "OnPremiseSql" + """SQL Resource in an on premise machine connected to Azure cloud""" class SourceSystem(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py index 8f44c7940e4b..d0f4c9a78a25 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py @@ -23,7 +23,7 @@ from ._security_solutions_operations import SecuritySolutionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py index fff0749da585..67791d1a8b56 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py @@ -49,7 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_get_request(asc_location: str, group_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_get_request(asc_location: str, group_name: str, subscription_id: str, "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +114,8 @@ def build_put_request(asc_location: str, group_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_put_request(asc_location: str, group_name: str, subscription_id: str, "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,7 +148,7 @@ def build_delete_request(asc_location: str, group_name: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_delete_request(asc_location: str, group_name: str, subscription_id: st "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,8 +220,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroups] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -233,9 +233,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -252,7 +252,7 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} @distributed_trace def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.AdaptiveApplicationControlGroup: @@ -279,8 +279,8 @@ def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.Adap _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -292,9 +292,9 @@ def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.Adap params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +311,9 @@ def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.Adap return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @overload def put( @@ -378,7 +380,7 @@ def put( :type asc_location: str :param group_name: Name of an application control machine group. Required. :type group_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a AdaptiveApplicationControlGroup type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -399,9 +401,9 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +426,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,7 +445,9 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -472,8 +476,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( asc_location=asc_location, @@ -485,9 +489,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -500,4 +504,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py index 306da09fb4c1..3284e44c1be3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py @@ -54,7 +54,7 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +97,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,11 +143,11 @@ def build_enforce_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +173,7 @@ def build_enforce_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,8 +230,8 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardeningsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -256,7 +256,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -272,7 +272,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -280,13 +280,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AdaptiveNetworkHardeningsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -299,7 +299,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings" + } @distributed_trace def get( @@ -341,8 +343,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardening] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -357,9 +359,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -376,7 +378,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}" + } def _enforce_initial( # pylint: disable=inconsistent-return-statements self, @@ -399,12 +403,12 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -431,9 +435,9 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -446,7 +450,9 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _enforce_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + _enforce_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } @overload def begin_enforce( @@ -571,7 +577,7 @@ def begin_enforce( :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening resource. Required. :type adaptive_network_hardening_resource_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a AdaptiveNetworkHardeningEnforceRequest type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardeningEnforceRequest or IO :keyword adaptive_network_hardening_enforce_action: Enforces the given rules on the NSG(s) @@ -596,15 +602,15 @@ def begin_enforce( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._enforce_initial( # type: ignore resource_group_name=resource_group_name, @@ -628,7 +634,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -640,6 +646,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_enforce.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + begin_enforce.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py index 6929ecb0f58a..5a8f7cd2cb3a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +107,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,7 @@ def build_get_request( "connectionType": _SERIALIZER.url("connection_type", connection_type, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,8 +170,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.AllowedConnectionsResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.AllowedConnectionsResource"]: @@ -254,8 +254,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -277,7 +277,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -293,7 +293,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -301,13 +301,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -320,7 +320,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections" + } @distributed_trace def get( @@ -358,8 +360,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -372,9 +374,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -391,4 +393,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py index 437167903c12..5700b170ea5e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque "assessmentMetadataName": _SERIALIZER.url("assessment_metadata_name", assessment_metadata_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +88,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +116,7 @@ def build_get_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_get_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +148,8 @@ def build_create_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_create_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +183,7 @@ def build_delete_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +198,7 @@ def build_delete_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,8 +242,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadata"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -263,7 +263,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -279,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,13 +287,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -306,7 +306,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadata: @@ -331,8 +331,8 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -342,9 +342,9 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -361,7 +361,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadata"]: @@ -377,8 +377,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAsses _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -399,7 +399,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -415,7 +415,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -423,13 +423,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -442,7 +442,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadata: @@ -467,8 +469,8 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -479,9 +481,9 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -498,7 +500,9 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload def create_in_subscription( @@ -562,8 +566,8 @@ def create_in_subscription( :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_metadata_name: str - :param assessment_metadata: AssessmentMetadata object. Is either a model type or a IO type. - Required. + :param assessment_metadata: AssessmentMetadata object. Is either a SecurityAssessmentMetadata + type or a IO type. Required. :type assessment_metadata: ~azure.mgmt.security.v2020_01_01.models.SecurityAssessmentMetadata or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -585,9 +589,9 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -609,9 +613,9 @@ def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -628,7 +632,9 @@ def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -656,8 +662,8 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -668,9 +674,9 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -683,4 +689,6 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py index 6ed562817062..46bfe35dbc56 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py @@ -45,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request( "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +126,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,8 +183,8 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessmen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -205,7 +205,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -221,7 +221,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -229,13 +229,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -248,7 +248,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace def get( @@ -283,8 +283,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -296,9 +296,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +315,7 @@ def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload def create_or_update( @@ -385,7 +385,7 @@ def create_or_update( :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_name: str :param assessment: Calculated assessment on a pre-defined assessment metadata. Is either a - model type or a IO type. Required. + SecurityAssessment type or a IO type. Required. :type assessment: ~azure.mgmt.security.v2020_01_01.models.SecurityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -406,9 +406,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -430,9 +430,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -449,11 +449,11 @@ def create_or_update( deserialized = self._deserialize("SecurityAssessment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -482,8 +482,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -494,9 +494,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -509,4 +509,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py index e5fc10eda33b..2e5d99582fe2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,8 +174,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.DiscoveredSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +196,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +212,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +220,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +239,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.DiscoveredSecuritySolution"]: @@ -258,8 +258,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -281,7 +281,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -297,7 +297,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -305,13 +305,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -324,7 +324,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions" + } @distributed_trace def get( @@ -356,8 +358,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -370,9 +372,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,4 +391,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py index 00a0e84c865b..749008b84624 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,8 +174,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExternalSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +196,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +212,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +220,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +239,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.ExternalSecuritySolution"]: @@ -258,8 +258,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -281,7 +281,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -297,7 +297,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -305,13 +305,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -324,7 +324,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions" + } @distributed_trace def get( @@ -356,8 +358,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -370,9 +372,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,4 +391,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py index 6f6bd6431853..3a63cf0cb580 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_region_request(asc_location: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_by_region_request(asc_location: str, subscription_id: str, **kwar "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +103,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +137,7 @@ def build_list_by_resource_group_and_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +155,7 @@ def build_list_by_resource_group_and_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +176,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +197,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,8 +218,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +240,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -263,7 +263,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +284,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,11 +305,11 @@ def build_initiate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - jit_network_access_policy_initiate_type = kwargs.pop( + jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: Literal["initiate"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -333,7 +333,7 @@ def build_initiate_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -379,8 +379,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.JitNetworkAccessPolicy"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} @distributed_trace def list_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.JitNetworkAccessPolicy"]: @@ -464,8 +464,8 @@ def list_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -487,7 +487,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -503,7 +503,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -511,13 +511,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -530,7 +530,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group( @@ -552,8 +554,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -575,7 +577,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -591,7 +593,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -599,13 +601,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -618,7 +620,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group_and_region( @@ -643,8 +647,8 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -667,7 +671,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -683,7 +687,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -691,13 +695,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -710,7 +714,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group_and_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group_and_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace def get( @@ -744,8 +750,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -758,9 +764,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -777,7 +783,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload def create_or_update( @@ -865,7 +873,7 @@ def create_or_update( :param jit_network_access_policy_name: Name of a Just-in-Time access configuration policy. Required. :type jit_network_access_policy_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a JitNetworkAccessPolicy type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.JitNetworkAccessPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -886,9 +894,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -912,9 +920,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -931,7 +939,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -964,8 +974,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -978,9 +988,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -993,7 +1003,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload def initiate( @@ -1089,7 +1101,7 @@ def initiate( :param jit_network_access_policy_name: Name of a Just-in-Time access configuration policy. Required. :type jit_network_access_policy_name: str - :param body: Is either a model type or a IO type. Required. + :param body: Is either a JitNetworkAccessPolicyInitiateRequest type or a IO type. Required. :type body: ~azure.mgmt.security.v2020_01_01.models.JitNetworkAccessPolicyInitiateRequest or IO :keyword jit_network_access_policy_initiate_type: Type of the action to do on the Just-in-Time access policy. Default value is "initiate". Note that overriding this default value may result @@ -1114,12 +1126,12 @@ def initiate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - jit_network_access_policy_initiate_type = kwargs.pop( + jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: Literal["initiate"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessRequest] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1144,9 +1156,9 @@ def initiate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1163,4 +1175,6 @@ def initiate( return deserialized - initiate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}"} # type: ignore + initiate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py index 3bb1cbd8d86d..fb6bb747c736 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +77,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,8 +121,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreControlDefinitionI _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,7 +142,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -158,7 +158,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -166,13 +166,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -185,7 +185,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecureScoreControlDefinitionItem"]: @@ -202,8 +202,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecureScoreCo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -224,7 +224,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -240,7 +240,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -248,13 +248,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -267,4 +267,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py index e5720ed24935..8120267e2fe1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py @@ -51,7 +51,7 @@ def build_list_by_secure_score_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_list_by_secure_score_request( "secureScoreName": _SERIALIZER.url("secure_score_name", secure_score_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +85,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,8 +151,8 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -175,7 +175,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -191,7 +191,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -199,13 +199,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -218,7 +218,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_secure_score.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls"} # type: ignore + list_by_secure_score.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls" + } @distributed_trace def list( @@ -238,8 +240,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -261,7 +263,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -277,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -285,13 +287,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -304,4 +306,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py index 42a221dadd27..b7da91e18772 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request(secure_score_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request(secure_score_name: str, subscription_id: str, **kwargs: An "secureScoreName": _SERIALIZER.url("secure_score_name", secure_score_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,8 +128,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreItem"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoresList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -150,7 +150,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -166,7 +166,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -174,13 +174,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -193,7 +193,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} @distributed_trace def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: @@ -219,8 +219,8 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreItem] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreItem] = kwargs.pop("cls", None) request = build_get_request( secure_score_name=secure_score_name, @@ -231,9 +231,9 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,4 +250,6 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py index d32ce7c086dd..c66f6d9e697a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_get_request( "securitySolutionName": _SERIALIZER.url("security_solution_name", security_solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,8 +134,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -156,7 +156,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -172,7 +172,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -180,13 +180,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -199,7 +199,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} @distributed_trace def get( @@ -231,8 +231,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -245,9 +245,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -264,4 +264,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py index 44d4baec6c5a..8762517d4e67 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py @@ -43,7 +43,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,8 +136,8 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -147,9 +147,9 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -166,7 +166,9 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData" + } @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: @@ -191,8 +193,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_by_home_region_request( asc_location=asc_location, @@ -203,9 +205,9 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,4 +224,6 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur return deserialized - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py index f49d3fd4d88f..8be762c8dc3b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py @@ -52,7 +52,7 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,10 +94,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +118,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,10 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +164,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,10 +186,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +210,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -277,8 +271,8 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessmentsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessmentsList] = kwargs.pop("cls", None) request = build_list_by_extended_resource_request( resource_group_name=resource_group_name, @@ -292,9 +286,9 @@ def list_by_extended_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +305,9 @@ def list_by_extended_resource( return deserialized - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" + } @distributed_trace def get( @@ -348,11 +344,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -367,9 +361,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -386,7 +380,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace def create_or_update( @@ -424,11 +420,9 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -443,9 +437,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -462,7 +456,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any @@ -478,11 +474,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -497,9 +491,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -512,7 +506,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace def begin_delete( @@ -548,14 +544,12 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -576,9 +570,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -590,6 +584,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py index c0e23166eb5f..a08384eb63e3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +103,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,7 @@ def build_get_request( "topologyResourceName": _SERIALIZER.url("topology_resource_name", topology_resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,8 +164,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.TopologyResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -186,7 +186,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -202,7 +202,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -210,13 +210,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -229,7 +229,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.TopologyResource"]: @@ -246,8 +246,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -269,7 +269,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -285,7 +285,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -293,13 +293,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -312,7 +312,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies" + } @distributed_trace def get( @@ -344,8 +346,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -358,9 +360,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -377,4 +379,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py index 16b000307558..2291fa8addec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01-preview") # type: Literal["2020-01-01-preview"] + api_version: Literal["2020-01-01-preview"] = kwargs.pop("api_version", "2020-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json index 3e2097810054..202fd18686be 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py index c2ef228454d9..dd66b950fc94 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ConnectorsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py index 4c63533d8d8d..a264326b4945 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01-preview") # type: Literal["2020-01-01-preview"] + api_version: Literal["2020-01-01-preview"] = kwargs.pop("api_version", "2020-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py index 2c1984123c43..47950100618c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -84,5 +84,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py index 36717e9887ca..28d52bdd565d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._connectors_operations import ConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py index e71f9e9c6b8e..d1faef2edd49 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py @@ -76,10 +76,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ConnectorSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSettingList] + ) + cls: ClsType[_models.ConnectorSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConnectorSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} @distributed_trace_async async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: @@ -167,10 +167,10 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) request = build_get_request( connector_name=connector_name, @@ -181,9 +181,9 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,7 +200,7 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} @overload async def create_or_update( @@ -259,8 +259,8 @@ async def create_or_update( :param connector_name: Name of the cloud account connector. Required. :type connector_name: str - :param connector_setting: Settings for the cloud account connector. Is either a model type or a - IO type. Required. + :param connector_setting: Settings for the cloud account connector. Is either a + ConnectorSetting type or a IO type. Required. :type connector_setting: ~azure.mgmt.security.v2020_01_01_preview.models.ConnectorSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -281,11 +281,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -307,9 +307,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -326,7 +326,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -352,10 +354,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( connector_name=connector_name, @@ -366,9 +368,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,4 +383,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py index 4d965dbf3b31..ddfe12e9e53d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py @@ -25,7 +25,7 @@ from ._security_center_enums import HybridComputeProvisioningState from ._security_center_enums import PermissionProperty from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py index 7b508a23d1f2..6723a290455e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -61,16 +61,20 @@ class AuthenticationDetailsProperties(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.authentication_provisioning_state = None self.granted_permissions = None - self.authentication_type = None # type: Optional[str] + self.authentication_type: Optional[str] = None class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsProperties): - """AWS cloud account connector based assume role, the role enables delegating access to your AWS resources. The role is composed of role Amazon Resource Name (ARN) and external ID. For more details, refer to :code:`Creating a Role to Delegate Permissions to an IAM User (write only)`. + """AWS cloud account connector based assume role, the role enables delegating access to your AWS + resources. The role is composed of role Amazon Resource Name (ARN) and external ID. For more + details, refer to :code:`Creating + a Role to Delegate Permissions to an IAM User (write only)`. Variables are only populated by the server, and will be ignored when sending a request. @@ -116,7 +120,7 @@ class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsPropertie "aws_external_id": {"key": "awsExternalId", "type": "str"}, } - def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs): + def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs: Any) -> None: """ :keyword aws_assume_role_arn: Assumed role ID is an identifier that you can use to create temporary security credentials. Required. @@ -126,14 +130,17 @@ def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs): :paramtype aws_external_id: str """ super().__init__(**kwargs) - self.authentication_type = "awsAssumeRole" # type: str + self.authentication_type: str = "awsAssumeRole" self.account_id = None self.aws_assume_role_arn = aws_assume_role_arn self.aws_external_id = aws_external_id class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): - """AWS cloud account connector based credentials, the credentials is composed of access key ID and secret key, for more details, refer to :code:`Creating an IAM User in Your AWS Account (write only)`. + """AWS cloud account connector based credentials, the credentials is composed of access key ID and + secret key, for more details, refer to :code:`Creating an IAM + User in Your AWS Account (write only)`. Variables are only populated by the server, and will be ignored when sending a request. @@ -179,7 +186,7 @@ class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): "aws_secret_access_key": {"key": "awsSecretAccessKey", "type": "str"}, } - def __init__(self, *, aws_access_key_id: str, aws_secret_access_key: str, **kwargs): + def __init__(self, *, aws_access_key_id: str, aws_secret_access_key: str, **kwargs: Any) -> None: """ :keyword aws_access_key_id: Public key element of the AWS credential object (write only). Required. @@ -189,7 +196,7 @@ def __init__(self, *, aws_access_key_id: str, aws_secret_access_key: str, **kwar :paramtype aws_secret_access_key: str """ super().__init__(**kwargs) - self.authentication_type = "awsCreds" # type: str + self.authentication_type: str = "awsCreds" self.account_id = None self.aws_access_key_id = aws_access_key_id self.aws_secret_access_key = aws_secret_access_key @@ -229,7 +236,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -264,7 +271,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -318,8 +325,8 @@ def __init__( *, hybrid_compute_settings: Optional["_models.HybridComputeSettingsProperties"] = None, authentication_details: Optional["_models.AuthenticationDetailsProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword hybrid_compute_settings: Settings for hybrid compute management. These settings are relevant only for Arc autoProvision (Hybrid Compute). @@ -355,7 +362,7 @@ class ConnectorSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ConnectorSetting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ConnectorSetting"]] = None, **kwargs: Any) -> None: """ :keyword value: List of all the cloud account connector settings. :paramtype value: list[~azure.mgmt.security.v2020_01_01_preview.models.ConnectorSetting] @@ -386,7 +393,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -394,7 +401,8 @@ def __init__(self, **kwargs): class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): # pylint: disable=too-many-instance-attributes - """GCP cloud account connector based service to service credentials, the credentials are composed of the organization ID and a JSON API key (write only). + """GCP cloud account connector based service to service credentials, the credentials are composed + of the organization ID and a JSON API key (write only). Variables are only populated by the server, and will be ignored when sending a request. @@ -486,8 +494,8 @@ def __init__( token_uri: str, auth_provider_x509_cert_url: str, client_x509_cert_url: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organization_id: The organization ID of the GCP cloud account. Required. :paramtype organization_id: str @@ -515,7 +523,7 @@ def __init__( :paramtype client_x509_cert_url: str """ super().__init__(**kwargs) - self.authentication_type = "gcpCredentials" # type: str + self.authentication_type: str = "gcpCredentials" self.organization_id = organization_id self.type = type self.project_id = project_id @@ -578,8 +586,8 @@ def __init__( region: Optional[str] = None, proxy_server: Optional["_models.ProxyServerProperties"] = None, service_principal: Optional["_models.ServicePrincipalProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword auto_provision: Whether or not to automatically install Azure Arc (hybrid compute) agents on machines. Required. Known values are: "On" and "Off". @@ -607,7 +615,8 @@ def __init__( class ProxyServerProperties(_serialization.Model): - """For a non-Azure machine that is not connected directly to the internet, specify a proxy server that the non-Azure machine can use. + """For a non-Azure machine that is not connected directly to the internet, specify a proxy server + that the non-Azure machine can use. :ivar ip: Proxy server IP. :vartype ip: str @@ -620,7 +629,7 @@ class ProxyServerProperties(_serialization.Model): "port": {"key": "port", "type": "str"}, } - def __init__(self, *, ip: Optional[str] = None, port: Optional[str] = None, **kwargs): + def __init__(self, *, ip: Optional[str] = None, port: Optional[str] = None, **kwargs: Any) -> None: """ :keyword ip: Proxy server IP. :paramtype ip: str @@ -647,7 +656,7 @@ class ServicePrincipalProperties(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, application_id: Optional[str] = None, secret: Optional[str] = None, **kwargs): + def __init__(self, *, application_id: Optional[str] = None, secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword application_id: Application ID of service principal. :paramtype application_id: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py index 9c10c4fb9804..ba41abf7907c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py @@ -13,14 +13,14 @@ class AuthenticationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the multi-cloud connector.""" - #: Valid connector VALID = "Valid" - #: Invalid connector + """Valid connector""" INVALID = "Invalid" - #: the connection has expired + """Invalid connector""" EXPIRED = "Expired" - #: Incorrect policy of the connector + """the connection has expired""" INCORRECT_POLICY = "IncorrectPolicy" + """Incorrect policy of the connector""" class AuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -28,43 +28,43 @@ class AuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): authentication. For GCP use account organization credentials. """ - #: AWS cloud account connector user credentials authentication AWS_CREDS = "awsCreds" - #: AWS account connector assume role authentication + """AWS cloud account connector user credentials authentication""" AWS_ASSUME_ROLE = "awsAssumeRole" - #: GCP account connector service to service authentication + """AWS account connector assume role authentication""" GCP_CREDENTIALS = "gcpCredentials" + """GCP account connector service to service authentication""" class AutoProvision(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether or not to automatically install Azure Arc (hybrid compute) agents on machines.""" - #: Install missing Azure Arc agents on machines automatically ON = "On" - #: Do not install Azure Arc agent on the machines automatically + """Install missing Azure Arc agents on machines automatically""" OFF = "Off" + """Do not install Azure Arc agent on the machines automatically""" class HybridComputeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the service principal and its secret.""" - #: Valid service principal details. VALID = "Valid" - #: Invalid service principal details. + """Valid service principal details.""" INVALID = "Invalid" - #: the service principal details are expired + """Invalid service principal details.""" EXPIRED = "Expired" + """the service principal details are expired""" class PermissionProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A permission detected in the cloud account.""" - #: This permission provides read only access to AWS Security Hub resources. AWS_AWS_SECURITY_HUB_READ_ONLY_ACCESS = "AWS::AWSSecurityHubReadOnlyAccess" - #: This permission grants access to read security configuration metadata. + """This permission provides read only access to AWS Security Hub resources.""" AWS_SECURITY_AUDIT = "AWS::SecurityAudit" - #: The permission provides for EC2 Automation service to execute activities defined within - #: Automation documents. + """This permission grants access to read security configuration metadata.""" AWS_AMAZON_SSM_AUTOMATION_ROLE = "AWS::AmazonSSMAutomationRole" - #: This permission provides read only access to GCP Security Command Center. + """The permission provides for EC2 Automation service to execute activities defined within + #: Automation documents.""" GCP_SECURITY_CENTER_ADMIN_VIEWER = "GCP::Security Center Admin Viewer" + """This permission provides read only access to GCP Security Command Center.""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py index 36717e9887ca..28d52bdd565d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._connectors_operations import ConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py index f23c32136df7..a85ab08cf867 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(connector_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_get_request(connector_name: str, subscription_id: str, **kwargs: Any) "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,10 +104,10 @@ def build_create_or_update_request(connector_name: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_create_or_update_request(connector_name: str, subscription_id: str, ** "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,9 +138,9 @@ def build_delete_request(connector_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_delete_request(connector_name: str, subscription_id: str, **kwargs: An "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,10 +197,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.ConnectorSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSettingList] + ) + cls: ClsType[_models.ConnectorSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -221,7 +221,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -237,7 +237,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -245,13 +245,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConnectorSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -264,7 +264,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} @distributed_trace def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: @@ -288,10 +288,10 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) request = build_get_request( connector_name=connector_name, @@ -302,9 +302,9 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,7 +321,7 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} @overload def create_or_update( @@ -380,8 +380,8 @@ def create_or_update( :param connector_name: Name of the cloud account connector. Required. :type connector_name: str - :param connector_setting: Settings for the cloud account connector. Is either a model type or a - IO type. Required. + :param connector_setting: Settings for the cloud account connector. Is either a + ConnectorSetting type or a IO type. Required. :type connector_setting: ~azure.mgmt.security.v2020_01_01_preview.models.ConnectorSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -402,11 +402,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -428,9 +428,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -447,7 +447,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" + } @distributed_trace def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -471,10 +473,10 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( connector_name=connector_name, @@ -485,9 +487,9 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -500,4 +502,4 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py index e26ff92bc8dd..fc405211c560 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: Literal["2020-07-01-preview"] + api_version: Literal["2020-07-01-preview"] = kwargs.pop("api_version", "2020-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json index 097b59763bc9..35e311e5127d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py index fd77680bb793..44f0e9ce9345 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -55,7 +55,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -91,15 +91,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py index b5b327f05486..78d73e6c4290 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: Literal["2020-07-01-preview"] + api_version: Literal["2020-07-01-preview"] = kwargs.pop("api_version", "2020-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py index 9b2ad9c252a1..930d6f77f6a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -55,7 +55,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -98,5 +98,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py index 869887473bbe..d5f860621913 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._sql_vulnerability_assessment_baseline_rules_operations import SqlVulnerabilityAssessmentBaselineRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 3c06e26616f4..8c49aa5c80ed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -144,8 +144,8 @@ async def create_or_update( :type workspace_id: str :param resource_id: The identifier of the resource. Required. :type resource_id: str - :param body: The baseline results for this rule. Is either a model type or a IO type. Default - value is None. + :param body: The baseline results for this rule. Is either a RuleResultsInput type or a IO + type. Default value is None. :type body: ~azure.mgmt.security.v2020_07_01_preview.models.RuleResultsInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -166,11 +166,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -196,9 +196,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -215,7 +215,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace_async async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RuleResults: @@ -245,10 +247,10 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( rule_id=rule_id, @@ -260,9 +262,9 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -279,7 +281,9 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -311,10 +315,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( rule_id=rule_id, @@ -326,9 +330,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -341,7 +345,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace_async async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RulesResults: @@ -369,10 +375,10 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -383,9 +389,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -402,7 +408,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } @overload async def add( @@ -478,7 +486,8 @@ async def add( :type workspace_id: str :param resource_id: The identifier of the resource. Required. :type resource_id: str - :param body: The baseline rules. Is either a model type or a IO type. Default value is None. + :param body: The baseline rules. Is either a RulesResultsInput type or a IO type. Default value + is None. :type body: ~azure.mgmt.security.v2020_07_01_preview.models.RulesResultsInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -499,11 +508,11 @@ async def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -528,9 +537,9 @@ async def add( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -547,4 +556,6 @@ async def add( return deserialized - add.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + add.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py index f8a77971452d..d9f2422bc3b3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -88,10 +88,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResult] + ) + cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -104,9 +104,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -123,7 +123,9 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}" + } @distributed_trace_async async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.ScanResults: @@ -154,10 +156,10 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResults] + ) + cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) request = build_list_request( scan_id=scan_id, @@ -169,9 +171,9 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -188,4 +190,6 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py index dd43e5060c63..318bd6779198 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py @@ -84,10 +84,10 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scan] + ) + cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -99,9 +99,9 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,7 +118,9 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}" + } @distributed_trace_async async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scans: @@ -146,10 +148,10 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scans] + ) + cls: ClsType[_models.Scans] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -160,9 +162,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -179,4 +181,4 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py index 97bf09e33a17..f92a3a9e77b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py @@ -33,7 +33,7 @@ from ._security_center_enums import ScanState from ._security_center_enums import ScanTriggerType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py index 84a7a75cf28b..1c208f07adb8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -36,8 +36,8 @@ def __init__( *, expected_results: Optional[List[List[str]]] = None, updated_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expected_results: Expected results. :paramtype expected_results: list[list[str]] @@ -77,8 +77,8 @@ def __init__( status: Optional[Union[str, "_models.RuleStatus"]] = None, results_not_in_baseline: Optional[List[List[str]]] = None, results_only_in_baseline: Optional[List[List[str]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword baseline: Baseline details. :paramtype baseline: ~azure.mgmt.security.v2020_07_01_preview.models.Baseline @@ -111,7 +111,7 @@ class BenchmarkReference(_serialization.Model): "reference": {"key": "reference", "type": "str"}, } - def __init__(self, *, benchmark: Optional[str] = None, reference: Optional[str] = None, **kwargs): + def __init__(self, *, benchmark: Optional[str] = None, reference: Optional[str] = None, **kwargs: Any) -> None: """ :keyword benchmark: The benchmark name. :paramtype benchmark: str @@ -157,7 +157,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -188,7 +188,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -218,8 +218,8 @@ def __init__( query: Optional[str] = None, expected_result: Optional[List[List[str]]] = None, column_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword query: The rule query. :paramtype query: str @@ -261,8 +261,8 @@ def __init__( scripts: Optional[List[str]] = None, automated: Optional[bool] = None, portal_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Remediation description. :paramtype description: str @@ -305,7 +305,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -341,7 +341,7 @@ class RuleResults(Resource): "properties": {"key": "properties", "type": "RuleResultsProperties"}, } - def __init__(self, *, properties: Optional["_models.RuleResultsProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RuleResultsProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Rule results properties. :paramtype properties: ~azure.mgmt.security.v2020_07_01_preview.models.RuleResultsProperties @@ -365,7 +365,9 @@ class RuleResultsInput(_serialization.Model): "results": {"key": "results", "type": "[[str]]"}, } - def __init__(self, *, latest_scan: Optional[bool] = None, results: Optional[List[List[str]]] = None, **kwargs): + def __init__( + self, *, latest_scan: Optional[bool] = None, results: Optional[List[List[str]]] = None, **kwargs: Any + ) -> None: """ :keyword latest_scan: Take results from latest scan. :paramtype latest_scan: bool @@ -389,7 +391,7 @@ class RuleResultsProperties(_serialization.Model): "results": {"key": "results", "type": "[[str]]"}, } - def __init__(self, *, results: Optional[List[List[str]]] = None, **kwargs): + def __init__(self, *, results: Optional[List[List[str]]] = None, **kwargs: Any) -> None: """ :keyword results: Expected results in the baseline. :paramtype results: list[list[str]] @@ -409,7 +411,7 @@ class RulesResults(_serialization.Model): "value": {"key": "value", "type": "[RuleResults]"}, } - def __init__(self, *, value: Optional[List["_models.RuleResults"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RuleResults"]] = None, **kwargs: Any) -> None: """ :keyword value: List of rule results. :paramtype value: list[~azure.mgmt.security.v2020_07_01_preview.models.RuleResults] @@ -434,8 +436,8 @@ class RulesResultsInput(_serialization.Model): } def __init__( - self, *, latest_scan: Optional[bool] = None, results: Optional[Dict[str, List[List[str]]]] = None, **kwargs - ): + self, *, latest_scan: Optional[bool] = None, results: Optional[Dict[str, List[List[str]]]] = None, **kwargs: Any + ) -> None: """ :keyword latest_scan: Take results from latest scan. :paramtype latest_scan: bool @@ -476,7 +478,7 @@ class Scan(Resource): "properties": {"key": "properties", "type": "ScanProperties"}, } - def __init__(self, *, properties: Optional["_models.ScanProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ScanProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: A vulnerability assessment scan record properties. :paramtype properties: ~azure.mgmt.security.v2020_07_01_preview.models.ScanProperties @@ -553,8 +555,8 @@ def __init__( total_failed_rules_count: Optional[int] = None, total_rules_count: Optional[int] = None, is_baseline_applied: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword trigger_type: The scan trigger type. Known values are: "OnDemand" and "Recurring". :paramtype trigger_type: str or ~azure.mgmt.security.v2020_07_01_preview.models.ScanTriggerType @@ -631,7 +633,7 @@ class ScanResult(Resource): "properties": {"key": "properties", "type": "ScanResultProperties"}, } - def __init__(self, *, properties: Optional["_models.ScanResultProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ScanResultProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: A vulnerability assessment scan result properties for a single rule. :paramtype properties: ~azure.mgmt.security.v2020_07_01_preview.models.ScanResultProperties @@ -681,8 +683,8 @@ def __init__( remediation: Optional["_models.Remediation"] = None, baseline_adjusted_result: Optional["_models.BaselineAdjustedResult"] = None, rule_metadata: Optional["_models.VaRule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rule_id: The rule Id. :paramtype rule_id: str @@ -722,7 +724,7 @@ class ScanResults(_serialization.Model): "value": {"key": "value", "type": "[ScanResult]"}, } - def __init__(self, *, value: Optional[List["_models.ScanResult"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ScanResult"]] = None, **kwargs: Any) -> None: """ :keyword value: List of vulnerability assessment scan results. :paramtype value: list[~azure.mgmt.security.v2020_07_01_preview.models.ScanResult] @@ -742,7 +744,7 @@ class Scans(_serialization.Model): "value": {"key": "value", "type": "[Scan]"}, } - def __init__(self, *, value: Optional[List["_models.Scan"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Scan"]] = None, **kwargs: Any) -> None: """ :keyword value: List of vulnerability assessment scan records. :paramtype value: list[~azure.mgmt.security.v2020_07_01_preview.models.Scan] @@ -801,8 +803,8 @@ def __init__( rationale: Optional[str] = None, query_check: Optional["_models.QueryCheck"] = None, benchmark_references: Optional[List["_models.BenchmarkReference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rule_id: The rule Id. :paramtype rule_id: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py index 7661e82307b1..a75012e95df4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py @@ -13,59 +13,59 @@ class RuleSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule severity.""" - #: High HIGH = "High" - #: Medium + """High""" MEDIUM = "Medium" - #: Low + """Medium""" LOW = "Low" - #: Informational + """Low""" INFORMATIONAL = "Informational" - #: Obsolete + """Informational""" OBSOLETE = "Obsolete" + """Obsolete""" class RuleStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule result status.""" - #: NonFinding NON_FINDING = "NonFinding" - #: Finding + """NonFinding""" FINDING = "Finding" - #: InternalError + """Finding""" INTERNAL_ERROR = "InternalError" + """InternalError""" class RuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule type.""" - #: Binary BINARY = "Binary" - #: BaselineExpected + """Binary""" BASELINE_EXPECTED = "BaselineExpected" - #: PositiveList + """BaselineExpected""" POSITIVE_LIST = "PositiveList" - #: NegativeList + """PositiveList""" NEGATIVE_LIST = "NegativeList" + """NegativeList""" class ScanState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The scan status.""" - #: Failed FAILED = "Failed" - #: FailedToRun + """Failed""" FAILED_TO_RUN = "FailedToRun" - #: InProgress + """FailedToRun""" IN_PROGRESS = "InProgress" - #: Passed + """InProgress""" PASSED = "Passed" + """Passed""" class ScanTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The scan trigger type.""" - #: OnDemand ON_DEMAND = "OnDemand" - #: Recurring + """OnDemand""" RECURRING = "Recurring" + """Recurring""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py index 869887473bbe..d5f860621913 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py @@ -11,7 +11,7 @@ from ._sql_vulnerability_assessment_baseline_rules_operations import SqlVulnerabilityAssessmentBaselineRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index cfa641f0db7a..b0555e0cb2f4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -43,10 +43,10 @@ def build_create_or_update_request(rule_id: str, resource_id: str, *, workspace_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_create_or_update_request(rule_id: str, resource_id: str, *, workspace_ "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -77,9 +77,9 @@ def build_get_request(rule_id: str, resource_id: str, *, workspace_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_get_request(rule_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -108,9 +108,9 @@ def build_delete_request(rule_id: str, resource_id: str, *, workspace_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_delete_request(rule_id: str, resource_id: str, *, workspace_id: str, * "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -139,9 +139,9 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +152,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -168,10 +168,10 @@ def build_add_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +182,7 @@ def build_add_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -298,8 +298,8 @@ def create_or_update( :type workspace_id: str :param resource_id: The identifier of the resource. Required. :type resource_id: str - :param body: The baseline results for this rule. Is either a model type or a IO type. Default - value is None. + :param body: The baseline results for this rule. Is either a RuleResultsInput type or a IO + type. Default value is None. :type body: ~azure.mgmt.security.v2020_07_01_preview.models.RuleResultsInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -320,11 +320,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,9 +350,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -369,7 +369,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RuleResults: @@ -399,10 +401,10 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( rule_id=rule_id, @@ -414,9 +416,9 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -433,7 +435,9 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -465,10 +469,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( rule_id=rule_id, @@ -480,9 +484,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -495,7 +499,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RulesResults: @@ -523,10 +529,10 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -537,9 +543,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -556,7 +562,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } @overload def add( @@ -632,7 +640,8 @@ def add( :type workspace_id: str :param resource_id: The identifier of the resource. Required. :type resource_id: str - :param body: The baseline rules. Is either a model type or a IO type. Default value is None. + :param body: The baseline rules. Is either a RulesResultsInput type or a IO type. Default value + is None. :type body: ~azure.mgmt.security.v2020_07_01_preview.models.RulesResultsInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -653,11 +662,11 @@ def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -682,9 +691,9 @@ def add( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -701,4 +710,6 @@ def add( return deserialized - add.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + add.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py index 7b5825a52b1e..76b4de6ccd8b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -45,9 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_get_request( "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -77,9 +77,9 @@ def build_list_request(scan_id: str, resource_id: str, *, workspace_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_request(scan_id: str, resource_id: str, *, workspace_id: str, **k "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -156,10 +156,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResult] + ) + cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -172,9 +172,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -191,7 +191,9 @@ def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}" + } @distributed_trace def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.ScanResults: @@ -222,10 +224,10 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResults] + ) + cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) request = build_list_request( scan_id=scan_id, @@ -237,9 +239,9 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -256,4 +258,6 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py index 67b1fb530b27..eb26beaf8c90 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py @@ -43,9 +43,9 @@ def build_get_request(scan_id: str, resource_id: str, *, workspace_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_get_request(scan_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -73,9 +73,9 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -146,10 +146,10 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scan] + ) + cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -161,9 +161,9 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -180,7 +180,9 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}" + } @distributed_trace def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scans: @@ -208,10 +210,10 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scans] + ) + cls: ClsType[_models.Scans] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -222,9 +224,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -241,4 +243,4 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py index dc619b6e3a5e..931f3cd30b8d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", "2021-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json index 174825493d37..18561670e4bf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py index 3c5681588d3a..b15230445fd5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -78,15 +78,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py index e6a65f1057b1..13d4593305c6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", "2021-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py index 6bee95b3d333..4e706ccc1868 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -85,5 +85,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py index 0d4651467be4..4ae3030c3a20 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py @@ -86,8 +86,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +132,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,7 +151,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -168,8 +168,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -191,7 +191,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -207,7 +207,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -215,13 +215,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -234,7 +234,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -252,8 +254,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -275,7 +277,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -291,7 +293,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -299,13 +301,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -318,7 +320,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -341,8 +345,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -365,7 +369,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -381,7 +385,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -389,13 +393,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -408,7 +412,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace_async async def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -435,8 +441,8 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -448,9 +454,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -467,7 +473,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def get_resource_group_level( @@ -499,8 +507,8 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( asc_location=asc_location, @@ -513,9 +521,9 @@ async def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -532,7 +540,9 @@ async def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -561,8 +571,8 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -574,9 +584,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +599,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -618,8 +630,8 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -631,9 +643,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -646,7 +658,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -675,8 +689,8 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -688,9 +702,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -703,7 +717,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace_async async def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -735,8 +751,8 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( asc_location=asc_location, @@ -749,9 +765,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -764,7 +780,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -796,8 +814,8 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( asc_location=asc_location, @@ -810,9 +828,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -825,7 +843,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -857,8 +877,8 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( asc_location=asc_location, @@ -871,9 +891,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -886,7 +906,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } async def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -905,9 +927,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -929,9 +951,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -944,7 +966,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload async def begin_simulate( @@ -1023,8 +1047,8 @@ async def begin_simulate( :param asc_location: The location where ASC stores the data of the subscription. can be retrieved from Get locations. Required. :type asc_location: str - :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a model type - or a IO type. Required. + :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a + AlertSimulatorRequestBody type or a IO type. Required. :type alert_simulator_request_body: ~azure.mgmt.security.v2021_01_01.models.AlertSimulatorRequestBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1045,12 +1069,12 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1069,10 +1093,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1084,6 +1108,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py index 27a235f46f19..f0a4dbee8e8f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py @@ -26,7 +26,7 @@ from ._security_center_enums import KindEnum from ._security_center_enums import ResourceIdentifierType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py index 2518d4a817ac..9d786f4b09c4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py @@ -48,7 +48,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -190,8 +190,8 @@ class Alert(Resource): # pylint: disable=too-many-instance-attributes } def __init__( # pylint: disable=too-many-locals - self, *, extended_properties: Optional[Dict[str, str]] = None, **kwargs - ): + self, *, extended_properties: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: """ :keyword extended_properties: Custom properties for the alert. :paramtype extended_properties: dict[str, str] @@ -243,7 +243,7 @@ class AlertEntity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -274,7 +274,7 @@ class AlertList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs: Any) -> None: """ :keyword value: describes security alert properties. :paramtype value: list[~azure.mgmt.security.v2021_01_01.models.Alert] @@ -310,7 +310,7 @@ class AlertSimulatorRequestProperties(_serialization.Model): _subtype_map = {"kind": {"Bundles": "AlertSimulatorBundlesRequestProperties"}} - def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -318,7 +318,7 @@ def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, ** """ super().__init__(**kwargs) self.additional_properties = additional_properties - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSimulatorBundlesRequestProperties(AlertSimulatorRequestProperties): @@ -350,8 +350,8 @@ def __init__( *, additional_properties: Optional[Dict[str, Any]] = None, bundles: Optional[List[Union[str, "_models.BundleType"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -360,7 +360,7 @@ def __init__( :paramtype bundles: list[str or ~azure.mgmt.security.v2021_01_01.models.BundleType] """ super().__init__(additional_properties=additional_properties, **kwargs) - self.kind = "Bundles" # type: str + self.kind: str = "Bundles" self.bundles = bundles @@ -375,7 +375,9 @@ class AlertSimulatorRequestBody(_serialization.Model): "properties": {"key": "properties", "type": "AlertSimulatorRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Alert Simulator request body data. :paramtype properties: ~azure.mgmt.security.v2021_01_01.models.AlertSimulatorRequestProperties @@ -385,7 +387,8 @@ def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestPropert class ResourceIdentifier(_serialization.Model): - """A resource identifier for an alert which can be used to direct the alert to the right product exposure group (tenant, workspace, subscription etc.). + """A resource identifier for an alert which can be used to direct the alert to the right product + exposure group (tenant, workspace, subscription etc.). You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureResourceIdentifier, LogAnalyticsIdentifier @@ -407,10 +410,10 @@ class ResourceIdentifier(_serialization.Model): _subtype_map = {"type": {"AzureResource": "AzureResourceIdentifier", "LogAnalytics": "LogAnalyticsIdentifier"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None class AzureResourceIdentifier(ResourceIdentifier): @@ -437,10 +440,10 @@ class AzureResourceIdentifier(ResourceIdentifier): "azure_resource_id": {"key": "azureResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "AzureResource" # type: str + self.type: str = "AzureResource" self.azure_resource_id = None @@ -477,7 +480,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -508,7 +511,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -557,10 +560,10 @@ class LogAnalyticsIdentifier(ResourceIdentifier): "agent_id": {"key": "agentId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "LogAnalytics" # type: str + self.type: str = "LogAnalytics" self.workspace_id = None self.workspace_subscription_id = None self.workspace_resource_group = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py index 7ecd17e3f093..7b1c5b3762c3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py @@ -15,25 +15,25 @@ class AlertSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. """ - #: Informational INFORMATIONAL = "Informational" - #: Low + """Informational""" LOW = "Low" - #: Medium + """Low""" MEDIUM = "Medium" - #: High + """Medium""" HIGH = "High" + """High""" class AlertStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The life cycle status of the alert.""" - #: An alert which doesn't specify a value is assigned the status 'Active' ACTIVE = "Active" - #: Alert closed after handling + """An alert which doesn't specify a value is assigned the status 'Active'""" RESOLVED = "Resolved" - #: Alert dismissed as false positive + """Alert closed after handling""" DISMISSED = "Dismissed" + """Alert dismissed as false positive""" class BundleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -54,65 +54,65 @@ class Intent(str, Enum, metaclass=CaseInsensitiveEnumMeta): of Azure Security Center's supported kill chain intents. """ - #: Unknown UNKNOWN = "Unknown" - #: PreAttack could be either an attempt to access a certain resource regardless of a malicious + """Unknown""" + PRE_ATTACK = "PreAttack" + """PreAttack could be either an attempt to access a certain resource regardless of a malicious #: intent, or a failed attempt to gain access to a target system to gather information prior to #: exploitation. This step is usually detected as an attempt, originating from outside the #: network, to scan the target system and find a way in. Further details on the PreAttack stage - #: can be read in `MITRE Pre-Att&ck matrix `_. - PRE_ATTACK = "PreAttack" - #: InitialAccess is the stage where an attacker manages to get foothold on the attacked resource. + #: can be read in `MITRE Pre-Att&ck matrix `_.""" INITIAL_ACCESS = "InitialAccess" - #: Persistence is any access, action, or configuration change to a system that gives a threat - #: actor a persistent presence on that system. + """InitialAccess is the stage where an attacker manages to get foothold on the attacked resource.""" PERSISTENCE = "Persistence" - #: Privilege escalation is the result of actions that allow an adversary to obtain a higher level - #: of permissions on a system or network. + """Persistence is any access, action, or configuration change to a system that gives a threat + #: actor a persistent presence on that system.""" PRIVILEGE_ESCALATION = "PrivilegeEscalation" - #: Defense evasion consists of techniques an adversary may use to evade detection or avoid other - #: defenses. + """Privilege escalation is the result of actions that allow an adversary to obtain a higher level + #: of permissions on a system or network.""" DEFENSE_EVASION = "DefenseEvasion" - #: Credential access represents techniques resulting in access to or control over system, domain, - #: or service credentials that are used within an enterprise environment. + """Defense evasion consists of techniques an adversary may use to evade detection or avoid other + #: defenses.""" CREDENTIAL_ACCESS = "CredentialAccess" - #: Discovery consists of techniques that allow the adversary to gain knowledge about the system - #: and internal network. + """Credential access represents techniques resulting in access to or control over system, domain, + #: or service credentials that are used within an enterprise environment.""" DISCOVERY = "Discovery" - #: Lateral movement consists of techniques that enable an adversary to access and control remote - #: systems on a network and could, but does not necessarily, include execution of tools on remote - #: systems. + """Discovery consists of techniques that allow the adversary to gain knowledge about the system + #: and internal network.""" LATERAL_MOVEMENT = "LateralMovement" - #: The execution tactic represents techniques that result in execution of adversary-controlled - #: code on a local or remote system. + """Lateral movement consists of techniques that enable an adversary to access and control remote + #: systems on a network and could, but does not necessarily, include execution of tools on remote + #: systems.""" EXECUTION = "Execution" - #: Collection consists of techniques used to identify and gather information, such as sensitive - #: files, from a target network prior to exfiltration. + """The execution tactic represents techniques that result in execution of adversary-controlled + #: code on a local or remote system.""" COLLECTION = "Collection" - #: Exfiltration refers to techniques and attributes that result or aid in the adversary removing - #: files and information from a target network. + """Collection consists of techniques used to identify and gather information, such as sensitive + #: files, from a target network prior to exfiltration.""" EXFILTRATION = "Exfiltration" - #: The command and control tactic represents how adversaries communicate with systems under their - #: control within a target network. + """Exfiltration refers to techniques and attributes that result or aid in the adversary removing + #: files and information from a target network.""" COMMAND_AND_CONTROL = "CommandAndControl" - #: Impact events primarily try to directly reduce the availability or integrity of a system, - #: service, or network; including manipulation of data to impact a business or operational - #: process. + """The command and control tactic represents how adversaries communicate with systems under their + #: control within a target network.""" IMPACT = "Impact" - #: Probing could be either an attempt to access a certain resource regardless of a malicious - #: intent, or a failed attempt to gain access to a target system to gather information prior to - #: exploitation. + """Impact events primarily try to directly reduce the availability or integrity of a system, + #: service, or network; including manipulation of data to impact a business or operational + #: process.""" PROBING = "Probing" - #: Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. - #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc. + """Probing could be either an attempt to access a certain resource regardless of a malicious + #: intent, or a failed attempt to gain access to a target system to gather information prior to + #: exploitation.""" EXPLOITATION = "Exploitation" + """Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. + #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc.""" class KindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of alert simulation.""" - #: Simulate alerts according to bundles BUNDLES = "Bundles" + """Simulate alerts according to bundles""" class ResourceIdentifierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py index b96170f2f9d9..65d2af8da9a3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py @@ -47,7 +47,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +107,7 @@ def build_list_subscription_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_list_subscription_level_by_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,7 +138,7 @@ def build_list_resource_group_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_list_resource_group_level_by_region_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_get_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_get_subscription_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +206,7 @@ def build_get_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +225,7 @@ def build_get_resource_group_level_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +242,7 @@ def build_update_subscription_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,7 +258,7 @@ def build_update_subscription_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +275,7 @@ def build_update_subscription_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +291,7 @@ def build_update_subscription_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,7 +308,7 @@ def build_update_subscription_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +324,7 @@ def build_update_subscription_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -341,7 +341,7 @@ def build_update_resource_group_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -360,7 +360,7 @@ def build_update_resource_group_level_state_to_resolve_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -377,7 +377,7 @@ def build_update_resource_group_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -396,7 +396,7 @@ def build_update_resource_group_level_state_to_dismiss_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -413,7 +413,7 @@ def build_update_resource_group_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -432,7 +432,7 @@ def build_update_resource_group_level_state_to_activate_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -447,8 +447,8 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -463,7 +463,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -507,8 +507,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -529,7 +529,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -545,7 +545,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -553,13 +553,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -572,7 +572,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -589,8 +589,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -612,7 +612,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -628,7 +628,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -636,13 +636,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -655,7 +655,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -673,8 +675,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -696,7 +698,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -712,7 +714,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -720,13 +722,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -739,7 +741,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -762,8 +766,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -786,7 +790,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -802,7 +806,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -810,13 +814,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -829,7 +833,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -856,8 +862,8 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -869,9 +875,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -888,7 +894,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def get_resource_group_level( @@ -920,8 +928,8 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( asc_location=asc_location, @@ -934,9 +942,9 @@ def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -953,7 +961,9 @@ def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -982,8 +992,8 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -995,9 +1005,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1010,7 +1020,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1039,8 +1051,8 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -1052,9 +1064,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1067,7 +1079,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1096,8 +1110,8 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -1109,9 +1123,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1124,7 +1138,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1156,8 +1172,8 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( asc_location=asc_location, @@ -1170,9 +1186,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1185,7 +1201,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -1217,8 +1235,8 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( asc_location=asc_location, @@ -1231,9 +1249,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1246,7 +1264,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1278,8 +1298,8 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( asc_location=asc_location, @@ -1292,9 +1312,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1307,7 +1327,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1326,9 +1348,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1350,9 +1372,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1365,7 +1387,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload def begin_simulate( @@ -1444,8 +1468,8 @@ def begin_simulate( :param asc_location: The location where ASC stores the data of the subscription. can be retrieved from Get locations. Required. :type asc_location: str - :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a model type - or a IO type. Required. + :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a + AlertSimulatorRequestBody type or a IO type. Required. :type alert_simulator_request_body: ~azure.mgmt.security.v2021_01_01.models.AlertSimulatorRequestBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1466,12 +1490,12 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1490,9 +1514,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1504,6 +1528,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py index 29eb554b4669..6ed4f0ee5795 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: Literal["2021-01-15-preview"] + api_version: Literal["2021-01-15-preview"] = kwargs.pop("api_version", "2021-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json index 44fe3aad2097..f6245c812961 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py index 4aa5c10b58ce..9a4d14c86da2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import IngestionSettingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py index ed15395c07e2..d5a61c66e7b1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: Literal["2021-01-15-preview"] + api_version: Literal["2021-01-15-preview"] = kwargs.pop("api_version", "2021-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py index e50ff084bfd9..ff5dfdfef0b7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import IngestionSettingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,5 +86,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py index af84327affac..e0aa0c4329cb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._ingestion_settings_operations import IngestionSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py index 783c50fa9756..d8e55252cea5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.IngestionSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingList] + ) + cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IngestionSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} @distributed_trace_async async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: @@ -171,10 +171,10 @@ async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Inges _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) request = build_get_request( ingestion_setting_name=ingestion_setting_name, @@ -185,9 +185,9 @@ async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Inges params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +204,9 @@ async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Inges return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @overload async def create( @@ -265,8 +267,8 @@ async def create( :param ingestion_setting_name: Name of the ingestion setting. Required. :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Is either a model type or a IO type. - Required. + :param ingestion_setting: Ingestion setting object. Is either a IngestionSetting type or a IO + type. Required. :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -287,11 +289,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -313,9 +315,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -332,7 +334,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -358,10 +362,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( ingestion_setting_name=ingestion_setting_name, @@ -372,9 +376,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -387,7 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace_async async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: @@ -412,10 +418,10 @@ async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingToken] + ) + cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) request = build_list_tokens_request( ingestion_setting_name=ingestion_setting_name, @@ -426,9 +432,9 @@ async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -445,7 +451,9 @@ async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _mode return deserialized - list_tokens.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens"} # type: ignore + list_tokens.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" + } @distributed_trace_async async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: @@ -469,10 +477,10 @@ async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectionStrings] + ) + cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) request = build_list_connection_strings_request( ingestion_setting_name=ingestion_setting_name, @@ -483,9 +491,9 @@ async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -502,4 +510,6 @@ async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: A return deserialized - list_connection_strings.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings"} # type: ignore + list_connection_strings.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py index 35a794f76866..439fe0cadcea 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py @@ -15,7 +15,7 @@ from ._models_py3 import IngestionSettingToken from ._models_py3 import Resource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py index a653aa7d1ce6..3b276818e2d8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import sys -from typing import Any, List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization @@ -16,6 +16,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -53,7 +57,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +84,7 @@ class ConnectionStrings(_serialization.Model): "value": {"key": "value", "type": "[IngestionConnectionString]"}, } - def __init__(self, *, value: List["_models.IngestionConnectionString"], **kwargs): + def __init__(self, *, value: List["_models.IngestionConnectionString"], **kwargs: Any) -> None: """ :keyword value: Connection strings. Required. :paramtype value: @@ -111,7 +115,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -139,7 +143,7 @@ class IngestionConnectionString(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -171,7 +175,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -207,7 +211,7 @@ class IngestionSetting(Resource): "properties": {"key": "properties", "type": "object"}, } - def __init__(self, *, properties: Optional[JSON] = None, **kwargs): + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword properties: Ingestion setting data. :paramtype properties: JSON @@ -237,7 +241,7 @@ class IngestionSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -262,7 +266,7 @@ class IngestionSettingToken(_serialization.Model): "token": {"key": "token", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.token = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py index af84327affac..e0aa0c4329cb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._ingestion_settings_operations import IngestionSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py index b59efd30e6fd..9bc30b7557e2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(ingestion_setting_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_get_request(ingestion_setting_name: str, subscription_id: str, **kwarg "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_request(ingestion_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_create_request(ingestion_setting_name: str, subscription_id: str, **kw "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,9 +140,9 @@ def build_delete_request(ingestion_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_delete_request(ingestion_setting_name: str, subscription_id: str, **kw "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,9 +172,9 @@ def build_list_tokens_request(ingestion_setting_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_list_tokens_request(ingestion_setting_name: str, subscription_id: str, "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,9 +206,9 @@ def build_list_connection_strings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,7 +223,7 @@ def build_list_connection_strings_request( "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,10 +267,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.IngestionSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingList] + ) + cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -291,7 +291,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -307,7 +307,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -315,13 +315,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IngestionSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -334,7 +334,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} @distributed_trace def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: @@ -359,10 +359,10 @@ def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) request = build_get_request( ingestion_setting_name=ingestion_setting_name, @@ -373,9 +373,9 @@ def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSe params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -392,7 +392,9 @@ def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSe return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @overload def create( @@ -453,8 +455,8 @@ def create( :param ingestion_setting_name: Name of the ingestion setting. Required. :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Is either a model type or a IO type. - Required. + :param ingestion_setting: Ingestion setting object. Is either a IngestionSetting type or a IO + type. Required. :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -475,11 +477,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -501,9 +503,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -520,7 +522,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -546,10 +550,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( ingestion_setting_name=ingestion_setting_name, @@ -560,9 +564,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -575,7 +579,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: @@ -600,10 +606,10 @@ def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Ing _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingToken] + ) + cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) request = build_list_tokens_request( ingestion_setting_name=ingestion_setting_name, @@ -614,9 +620,9 @@ def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Ing params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -633,7 +639,9 @@ def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Ing return deserialized - list_tokens.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens"} # type: ignore + list_tokens.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" + } @distributed_trace def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: @@ -657,10 +665,10 @@ def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectionStrings] + ) + cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) request = build_list_connection_strings_request( ingestion_setting_name=ingestion_setting_name, @@ -671,9 +679,9 @@ def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -690,4 +698,6 @@ def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> return deserialized - list_connection_strings.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings"} # type: ignore + list_connection_strings.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py index 3614699fc08f..c99cb4ba72ed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: Literal["2021-05-01-preview"] + api_version: Literal["2021-05-01-preview"] = kwargs.pop("api_version", "2021-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json index 51725a878d15..52975dbb5d13 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py index b8f322040926..7f6ea45533e2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SoftwareInventoriesOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py index 938dfefc1977..60efdbca3565 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: Literal["2021-05-01-preview"] + api_version: Literal["2021-05-01-preview"] = kwargs.pop("api_version", "2021-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py index 38a819cef40a..b6f1a9f7c81f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SoftwareInventoriesOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,5 +86,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py index e7e69c997540..7bacc485fce7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._software_inventories_operations import SoftwareInventoriesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py index efd086d3f9d3..d88d411affed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py @@ -86,10 +86,10 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +130,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +138,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,7 +157,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Software"]: @@ -172,10 +174,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Software _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +198,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +214,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +222,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +241,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace_async async def get( @@ -280,10 +284,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Software] + ) + cls: ClsType[_models.Software] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -298,9 +302,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +321,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py index b98811f9a86c..75809ee4c6fa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import EndOfSupportStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py index 86b4572d6192..40293222c062 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -50,7 +50,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -81,7 +81,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -113,7 +113,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -189,8 +189,8 @@ def __init__( end_of_support_date: Optional[str] = None, number_of_known_vulnerabilities: Optional[int] = None, first_seen_at: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword device_id: Unique identifier for the virtual machine in the service. :paramtype device_id: str @@ -247,7 +247,7 @@ class SoftwaresList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Software"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Software"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2021_05_01_preview.models.Software] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py index e7e69c997540..7bacc485fce7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._software_inventories_operations import SoftwareInventoriesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py index 1cb5f3c1fad4..aa3e9df00754 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py @@ -52,9 +52,9 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,9 +89,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,9 +127,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_get_request( "softwareName": _SERIALIZER.url("software_name", software_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,10 +203,10 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -231,7 +231,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -247,7 +247,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -255,13 +255,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -274,7 +274,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Software"]: @@ -288,10 +290,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Software"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -312,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -328,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -336,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -355,7 +357,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace def get( @@ -396,10 +400,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Software] + ) + cls: ClsType[_models.Software] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -414,9 +418,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -433,4 +437,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py index a751a5a17000..11f9ff4b52af 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", "2021-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json index 79bc9c66c629..1aad3ca349cd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py index f665df89b9c3..3eda299f3da6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AssessmentsMetadataOperations, AssessmentsOperations, SettingsOperations @@ -53,7 +53,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -85,15 +85,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py index dd03c6205884..b30183a57923 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", "2021-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py index 436951dc7106..369b46c16cc0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AssessmentsMetadataOperations, AssessmentsOperations, SettingsOperations @@ -53,7 +53,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -92,5 +92,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py index 560b419352e7..11c9d4115be9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._assessments_operations import AssessmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py index dcb5a52502f5..ba2fe223dcb3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py @@ -79,8 +79,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetada _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace_async async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadataResponse: @@ -168,8 +168,8 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -179,9 +179,9 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,7 +198,7 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadataResponse"]: @@ -214,8 +214,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -236,7 +236,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -252,7 +252,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,13 +260,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -279,7 +279,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace_async async def get_in_subscription( @@ -306,8 +308,8 @@ async def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -318,9 +320,9 @@ async def get_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -337,7 +339,9 @@ async def get_in_subscription( return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload async def create_in_subscription( @@ -402,8 +406,8 @@ async def create_in_subscription( :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_metadata_name: str - :param assessment_metadata: AssessmentMetadata object. Is either a model type or a IO type. - Required. + :param assessment_metadata: AssessmentMetadata object. Is either a + SecurityAssessmentMetadataResponse type or a IO type. Required. :type assessment_metadata: ~azure.mgmt.security.v2021_06_01.models.SecurityAssessmentMetadataResponse or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -425,9 +429,9 @@ async def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -449,9 +453,9 @@ async def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -468,7 +472,9 @@ async def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace_async async def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -496,8 +502,8 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -508,9 +514,9 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -523,4 +529,6 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py index c212a1adcd27..a73dbe89c7c9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py @@ -81,8 +81,8 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAsse _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace_async async def get( @@ -181,8 +181,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -194,9 +194,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -213,7 +213,7 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload async def create_or_update( @@ -283,7 +283,7 @@ async def create_or_update( :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_name: str :param assessment: Calculated assessment on a pre-defined assessment metadata. Is either a - model type or a IO type. Required. + SecurityAssessment type or a IO type. Required. :type assessment: ~azure.mgmt.security.v2021_06_01.models.SecurityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -304,9 +304,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -328,9 +328,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -347,11 +347,11 @@ async def create_or_update( deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -380,8 +380,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -392,9 +392,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -407,4 +407,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py index a26ac7f2970e..78afe2bbd936 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace_async async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models.Setting: @@ -161,8 +161,8 @@ async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -173,9 +173,9 @@ async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -192,7 +192,7 @@ async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload async def update( @@ -253,7 +253,7 @@ async def update( :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", and "Sentinel". Required. :type setting_name: str or ~azure.mgmt.security.v2021_06_01.models.Enum1 - :param setting: Setting object. Is either a model type or a IO type. Required. + :param setting: Setting object. Is either a Setting type or a IO type. Required. :type setting: ~azure.mgmt.security.v2021_06_01.models.Setting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -274,9 +274,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,9 +298,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +317,4 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py index cf002ba6c053..fed88292bc78 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py @@ -49,7 +49,7 @@ from ._security_center_enums import Threats from ._security_center_enums import UserImpact from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py index 9697815fecc0..4f876f6c77d6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -41,7 +41,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -86,10 +86,10 @@ class Setting(Resource): _subtype_map = {"kind": {"AlertSyncSettings": "AlertSyncSettings", "DataExportSettings": "DataExportSettings"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSyncSettings(Setting): @@ -127,13 +127,13 @@ class AlertSyncSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the alert sync setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "AlertSyncSettings" # type: str + self.kind: str = "AlertSyncSettings" self.enabled = enabled @@ -154,7 +154,7 @@ class AssessmentLinks(_serialization.Model): "azure_portal_uri": {"key": "azurePortalUri", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.azure_portal_uri = None @@ -190,8 +190,8 @@ def __init__( code: Union[str, "_models.AssessmentStatusCode"], cause: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Programmatic code for the status of the assessment. Required. Known values are: "Healthy", "Unhealthy", and "NotApplicable". @@ -249,8 +249,8 @@ def __init__( code: Union[str, "_models.AssessmentStatusCode"], cause: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Programmatic code for the status of the assessment. Required. Known values are: "Healthy", "Unhealthy", and "NotApplicable". @@ -288,10 +288,10 @@ class ResourceDetails(_serialization.Model): _subtype_map = {"source": {"Azure": "AzureResourceDetails", "OnPremise": "OnPremiseResourceDetails"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = None # type: Optional[str] + self.source: Optional[str] = None class AzureResourceDetails(ResourceDetails): @@ -318,10 +318,10 @@ class AzureResourceDetails(ResourceDetails): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = "Azure" # type: str + self.source: str = "Azure" self.id = None @@ -358,7 +358,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -403,13 +403,13 @@ class DataExportSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the data export setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "DataExportSettings" # type: str + self.kind: str = "DataExportSettings" self.enabled = enabled @@ -434,7 +434,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -480,7 +480,9 @@ class OnPremiseResourceDetails(ResourceDetails): _subtype_map = {"source": {"OnPremiseSql": "OnPremiseSqlResourceDetails"}} - def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs): + def __init__( + self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -492,7 +494,7 @@ def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, m :paramtype machine_name: str """ super().__init__(**kwargs) - self.source = "OnPremise" # type: str + self.source: str = "OnPremise" self.workspace_id = workspace_id self.vmuuid = vmuuid self.source_computer_id = source_computer_id @@ -550,8 +552,8 @@ def __init__( machine_name: str, server_name: str, database_name: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -573,7 +575,7 @@ def __init__( machine_name=machine_name, **kwargs ) - self.source = "OnPremiseSql" # type: str + self.source: str = "OnPremiseSql" self.server_name = server_name self.database_name = database_name @@ -634,8 +636,8 @@ def __init__( metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, status: Optional["_models.AssessmentStatus"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -680,7 +682,7 @@ class SecurityAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -772,8 +774,8 @@ def __init__( preview: Optional[bool] = None, assessment_type: Optional[Union[str, "_models.AssessmentType"]] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. :paramtype display_name: str @@ -846,7 +848,7 @@ class SecurityAssessmentMetadataPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs): + def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -940,8 +942,8 @@ def __init__( threats: Optional[List[Union[str, "_models.Threats"]]] = None, preview: Optional[bool] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. Required. :paramtype display_name: str @@ -1087,8 +1089,8 @@ def __init__( planned_deprecation_date: Optional[str] = None, tactics: Optional[List[Union[str, "_models.Tactics"]]] = None, techniques: Optional[List[Union[str, "_models.Techniques"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. Required. :paramtype display_name: str @@ -1171,7 +1173,7 @@ class SecurityAssessmentMetadataPropertiesResponsePublishDates(_serialization.Mo "public": {"key": "public", "type": "str"}, } - def __init__(self, *, public: str, ga: Optional[str] = None, **kwargs): + def __init__(self, *, public: str, ga: Optional[str] = None, **kwargs: Any) -> None: """ :keyword ga: :paramtype ga: str @@ -1289,8 +1291,8 @@ def __init__( planned_deprecation_date: Optional[str] = None, tactics: Optional[List[Union[str, "_models.Tactics"]]] = None, techniques: Optional[List[Union[str, "_models.Techniques"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. :paramtype display_name: str @@ -1373,7 +1375,7 @@ class SecurityAssessmentMetadataResponseList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1401,7 +1403,7 @@ class SecurityAssessmentPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, **kwargs): + def __init__(self, *, partner_name: str, secret: str, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -1456,8 +1458,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. Required. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1526,8 +1528,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. Required. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1599,8 +1601,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. Required. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1680,8 +1682,8 @@ def __init__( metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, status: Optional["_models.AssessmentStatusResponse"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1725,7 +1727,7 @@ class SettingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs: Any) -> None: """ :keyword value: The settings list. :paramtype value: list[~azure.mgmt.security.v2021_06_01.models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py index 4326c66f40e8..af224976fe8e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py @@ -13,12 +13,12 @@ class AssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Programmatic code for the status of the assessment.""" - #: The resource is healthy HEALTHY = "Healthy" - #: The resource has a security issue that needs to be addressed + """The resource is healthy""" UNHEALTHY = "Unhealthy" - #: Assessment for this resource did not happen + """The resource has a security issue that needs to be addressed""" NOT_APPLICABLE = "NotApplicable" + """Assessment for this resource did not happen""" class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -26,16 +26,16 @@ class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): based on custom Azure Policy definition. """ - #: Microsoft Defender for Cloud managed assessments BUILT_IN = "BuiltIn" - #: User defined policies that are automatically ingested from Azure Policy to Microsoft Defender - #: for Cloud + """Microsoft Defender for Cloud managed assessments""" CUSTOM_POLICY = "CustomPolicy" - #: User assessments pushed directly by the user or other third party to Microsoft Defender for - #: Cloud + """User defined policies that are automatically ingested from Azure Policy to Microsoft Defender + #: for Cloud""" CUSTOMER_MANAGED = "CustomerManaged" - #: An assessment that was created by a verified 3rd party if the user connected it to ASC + """User assessments pushed directly by the user or other third party to Microsoft Defender for + #: Cloud""" VERIFIED_PARTNER = "VerifiedPartner" + """An assessment that was created by a verified 3rd party if the user connected it to ASC""" class Categories(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -59,10 +59,10 @@ class Enum1(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ExpandEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandEnum.""" - #: All links associated with an assessment LINKS = "links" - #: Assessment metadata + """All links associated with an assessment""" METADATA = "metadata" + """Assessment metadata""" class ImplementationEffort(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -92,12 +92,12 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The platform where the assessed resource resides.""" - #: Resource is in Azure AZURE = "Azure" - #: Resource in an on premise machine connected to Azure cloud + """Resource is in Azure""" ON_PREMISE = "OnPremise" - #: SQL Resource in an on premise machine connected to Azure cloud + """Resource in an on premise machine connected to Azure cloud""" ON_PREMISE_SQL = "OnPremiseSql" + """SQL Resource in an on premise machine connected to Azure cloud""" class Tactics(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py index 560b419352e7..11c9d4115be9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py @@ -11,7 +11,7 @@ from ._assessments_operations import AssessmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py index adb88f6af608..4d8e51bfb30c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque "assessmentMetadataName": _SERIALIZER.url("assessment_metadata_name", assessment_metadata_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +88,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +116,7 @@ def build_get_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_get_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +148,8 @@ def build_create_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_create_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +183,7 @@ def build_delete_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +198,7 @@ def build_delete_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,8 +242,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadataRes _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -263,7 +263,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -279,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,13 +287,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -306,7 +306,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadataResponse: @@ -331,8 +331,8 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -342,9 +342,9 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -361,7 +361,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadataResponse"]: @@ -377,8 +377,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAsses _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -399,7 +399,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -415,7 +415,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -423,13 +423,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -442,7 +442,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace def get_in_subscription( @@ -469,8 +471,8 @@ def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -481,9 +483,9 @@ def get_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -500,7 +502,9 @@ def get_in_subscription( return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload def create_in_subscription( @@ -565,8 +569,8 @@ def create_in_subscription( :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_metadata_name: str - :param assessment_metadata: AssessmentMetadata object. Is either a model type or a IO type. - Required. + :param assessment_metadata: AssessmentMetadata object. Is either a + SecurityAssessmentMetadataResponse type or a IO type. Required. :type assessment_metadata: ~azure.mgmt.security.v2021_06_01.models.SecurityAssessmentMetadataResponse or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -588,9 +592,9 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -612,9 +616,9 @@ def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +635,9 @@ def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -659,8 +665,8 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -671,9 +677,9 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -686,4 +692,6 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py index 1c27f11a49ec..c0cdccc2c568 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py @@ -45,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request( "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +126,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,8 +184,8 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessmen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -206,7 +206,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -222,7 +222,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -230,13 +230,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -249,7 +249,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace def get( @@ -284,8 +284,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -297,9 +297,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -316,7 +316,7 @@ def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload def create_or_update( @@ -386,7 +386,7 @@ def create_or_update( :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. :type assessment_name: str :param assessment: Calculated assessment on a pre-defined assessment metadata. Is either a - model type or a IO type. Required. + SecurityAssessment type or a IO type. Required. :type assessment: ~azure.mgmt.security.v2021_06_01.models.SecurityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -407,9 +407,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -431,9 +431,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -450,11 +450,11 @@ def create_or_update( deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -483,8 +483,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -495,9 +495,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -510,4 +510,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py index bb9185702e90..2a425dd8e04f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request(setting_name: Union[str, _models.Enum1], subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request(setting_name: Union[str, _models.Enum1], subscription_id: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +100,8 @@ def build_update_request(setting_name: Union[str, _models.Enum1], subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ def build_update_request(setting_name: Union[str, _models.Enum1], subscription_i "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,8 +159,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -181,7 +181,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -197,7 +197,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -205,13 +205,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -224,7 +224,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models.Setting: @@ -249,8 +249,8 @@ def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -261,9 +261,9 @@ def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -280,7 +280,7 @@ def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload def update( @@ -341,7 +341,7 @@ def update( :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", and "Sentinel". Required. :type setting_name: str or ~azure.mgmt.security.v2021_06_01.models.Enum1 - :param setting: Setting object. Is either a model type or a IO type. Required. + :param setting: Setting object. Is either a Setting type or a IO type. Required. :type setting: ~azure.mgmt.security.v2021_06_01.models.Setting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -362,9 +362,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -386,9 +386,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,4 +405,4 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py index 9194a3328c1b..54f911a1dc08 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01") # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", "2021-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json index efc901abd95d..912f306173a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py index 3dc330c4f3f9..56b55e6d6242 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py index f3efe1774dd1..9275091da426 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01") # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", "2021-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py index de5852103e68..965ef9d9bcde 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -83,5 +83,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py index fa070305ec9f..0a30194f43a9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace_async async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -161,8 +161,8 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -173,9 +173,9 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -192,7 +192,7 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload async def update( @@ -253,7 +253,7 @@ async def update( :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", "WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW", and "Sentinel". Required. :type setting_name: str or ~azure.mgmt.security.v2021_07_01.models.SettingName - :param setting: Setting object. Is either a model type or a IO type. Required. + :param setting: Setting object. Is either a Setting type or a IO type. Required. :type setting: ~azure.mgmt.security.v2021_07_01.models.Setting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -274,9 +274,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,9 +298,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +317,4 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py index 63e5f8c91733..ce862c57b5f2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py @@ -17,7 +17,7 @@ from ._security_center_enums import SettingKind from ._security_center_enums import SettingName from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py index 614e2db39baa..2cbfde35592d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class Resource(_serialization.Model): """Describes an Azure resource. @@ -37,7 +41,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -82,10 +86,10 @@ class Setting(Resource): _subtype_map = {"kind": {"AlertSyncSettings": "AlertSyncSettings", "DataExportSettings": "DataExportSettings"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSyncSettings(Setting): @@ -123,13 +127,13 @@ class AlertSyncSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the alert sync setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "AlertSyncSettings" # type: str + self.kind: str = "AlertSyncSettings" self.enabled = enabled @@ -166,7 +170,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -211,13 +215,13 @@ class DataExportSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the data export setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "DataExportSettings" # type: str + self.kind: str = "DataExportSettings" self.enabled = enabled @@ -242,7 +246,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -269,7 +273,7 @@ class SettingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs: Any) -> None: """ :keyword value: The settings list. :paramtype value: list[~azure.mgmt.security.v2021_07_01.models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py index e5e076466b76..de2cfb8d592d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_get_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,8 +104,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_update_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,8 +163,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -253,8 +253,8 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -265,9 +265,9 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -284,7 +284,7 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload def update( @@ -345,7 +345,7 @@ def update( :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", "WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW", and "Sentinel". Required. :type setting_name: str or ~azure.mgmt.security.v2021_07_01.models.SettingName - :param setting: Setting object. Is either a model type or a IO type. Required. + :param setting: Setting object. Is either a Setting type or a IO type. Required. :type setting: ~azure.mgmt.security.v2021_07_01.models.Setting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -366,9 +366,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -390,9 +390,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -409,4 +409,4 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py index ff11a8f61b7d..5e3789643869 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: Literal["2021-07-01-preview"] + api_version: Literal["2021-07-01-preview"] = kwargs.pop("api_version", "2021-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json index 374729f3205b..9f045af2d917 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py index 3cd90ad4ba88..3695fb1e484a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -59,7 +59,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -95,15 +95,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py index 5e96849ba4bc..e13c808ad346 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: Literal["2021-07-01-preview"] + api_version: Literal["2021-07-01-preview"] = kwargs.pop("api_version", "2021-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py index 3ae750e64250..981a81644591 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -59,7 +59,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -102,5 +102,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py index f8be4db79c2f..395581c73e89 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py index 1a0c4fffaf31..fd9deb0b0293 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py @@ -94,10 +94,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -109,9 +109,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -128,7 +128,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @overload async def create( @@ -211,8 +213,8 @@ async def create( :type resource_group_name: str :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Is either a model - type or a IO type. Required. + :param custom_assessment_automation_body: Custom Assessment Automation body. Is either a + CustomAssessmentAutomationRequest type or a IO type. Required. :type custom_assessment_automation_body: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomationRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -234,11 +236,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -261,9 +263,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -280,11 +282,13 @@ async def create( deserialized = self._deserialize("CustomAssessmentAutomation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -315,10 +319,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -330,9 +334,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -345,7 +349,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace def list_by_resource_group( @@ -368,10 +374,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -393,7 +399,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -409,7 +415,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -417,13 +423,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -436,7 +442,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomAssessmentAutomation"]: @@ -454,10 +462,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomAs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -478,7 +486,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -494,7 +502,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -502,13 +510,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -521,4 +529,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py index 389ec974975e..c140dcb70a8c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py @@ -95,10 +95,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -110,9 +110,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,7 +129,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @overload async def create( @@ -215,7 +217,7 @@ async def create( Generated name is GUID. Required. :type custom_entity_store_assignment_name: str :param custom_entity_store_assignment_request_body: Custom entity store assignment body. Is - either a model type or a IO type. Required. + either a CustomEntityStoreAssignmentRequest type or a IO type. Required. :type custom_entity_store_assignment_request_body: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignmentRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -237,11 +239,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -266,9 +268,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -285,11 +287,13 @@ async def create( deserialized = self._deserialize("CustomEntityStoreAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -321,10 +325,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -336,9 +340,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -351,7 +355,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace def list_by_resource_group( @@ -374,10 +380,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -399,7 +405,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -415,7 +421,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -423,13 +429,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -442,7 +448,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomEntityStoreAssignment"]: @@ -460,10 +468,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomEn _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -484,7 +492,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -500,7 +508,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -508,13 +516,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -527,4 +535,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py index cbdaa5a77d2b..780c56005acd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group( @@ -167,10 +167,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace_async async def get( @@ -264,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -279,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +300,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def create_or_update( @@ -374,8 +378,8 @@ async def create_or_update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2021_07_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -397,11 +401,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +428,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +447,13 @@ async def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def update( @@ -520,8 +526,8 @@ async def update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2021_07_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -543,11 +549,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -570,9 +576,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +595,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -618,10 +626,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +641,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +656,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py index 6aa5de755b0b..4e9aeed6ee6e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py @@ -46,7 +46,7 @@ from ._security_center_enums import SeverityEnum from ._security_center_enums import SupportedCloudEnum from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py index 4f32f10cb1e8..2c8cfa075004 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -28,7 +28,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -71,7 +71,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -119,10 +119,10 @@ class CloudOffering(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = None # type: Optional[str] + self.offering_type: Optional[str] = None self.description = None @@ -162,15 +162,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorAwsOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2021_07_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAws" # type: str + self.offering_type: str = "CspmMonitorAws" self.native_cloud_connection = native_cloud_connection @@ -185,7 +185,7 @@ class CspmMonitorAwsOfferingNativeCloudConnection(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -219,7 +219,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -296,8 +296,8 @@ def __init__( description: Optional[str] = None, remediation_description: Optional[str] = None, assessment_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword compressed_query: GZip encoded KQL query representing the assessment automation results required. @@ -392,8 +392,8 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, remediation_description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword compressed_query: Base 64 encoded KQL query representing the assessment automation results required. @@ -445,7 +445,7 @@ class CustomAssessmentAutomationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str @@ -492,7 +492,9 @@ class CustomEntityStoreAssignment(Resource): "entity_store_database_link": {"key": "properties.entityStoreDatabaseLink", "type": "str"}, } - def __init__(self, *, principal: Optional[str] = None, entity_store_database_link: Optional[str] = None, **kwargs): + def __init__( + self, *, principal: Optional[str] = None, entity_store_database_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword principal: The principal assigned with entity store. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. @@ -518,7 +520,7 @@ class CustomEntityStoreAssignmentRequest(_serialization.Model): "principal": {"key": "properties.principal", "type": "str"}, } - def __init__(self, *, principal: Optional[str] = None, **kwargs): + def __init__(self, *, principal: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal: The principal assigned with entity store. If not provided, will use caller principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. @@ -549,7 +551,7 @@ class CustomEntityStoreAssignmentsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str @@ -613,8 +615,8 @@ def __init__( kubernetes_scuba_reader: Optional["_models.DefenderForContainersAwsOfferingKubernetesScubaReader"] = None, cloud_watch_to_kinesis: Optional["_models.DefenderForContainersAwsOfferingCloudWatchToKinesis"] = None, kinesis_to_s3: Optional["_models.DefenderForContainersAwsOfferingKinesisToS3"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kubernetes_service: The kubernetes service connection configuration. :paramtype kubernetes_service: @@ -630,7 +632,7 @@ def __init__( ~azure.mgmt.security.v2021_07_01_preview.models.DefenderForContainersAwsOfferingKinesisToS3 """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersAws" # type: str + self.offering_type: str = "DefenderForContainersAws" self.kubernetes_service = kubernetes_service self.kubernetes_scuba_reader = kubernetes_scuba_reader self.cloud_watch_to_kinesis = cloud_watch_to_kinesis @@ -648,7 +650,7 @@ class DefenderForContainersAwsOfferingCloudWatchToKinesis(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -668,7 +670,7 @@ class DefenderForContainersAwsOfferingKinesisToS3(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -688,7 +690,7 @@ class DefenderForContainersAwsOfferingKubernetesScubaReader(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -708,7 +710,7 @@ class DefenderForContainersAwsOfferingKubernetesService(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -761,8 +763,8 @@ def __init__( *, defender_for_servers: Optional["_models.DefenderForServersAwsOfferingDefenderForServers"] = None, arc_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingArcAutoProvisioning"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -772,7 +774,7 @@ def __init__( ~azure.mgmt.security.v2021_07_01_preview.models.DefenderForServersAwsOfferingArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersAws" # type: str + self.offering_type: str = "DefenderForServersAws" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning @@ -803,8 +805,8 @@ def __init__( service_principal_secret_metadata: Optional[ "_models.DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -841,8 +843,8 @@ def __init__( expiry_date: Optional[str] = None, parameter_store_region: Optional[str] = None, parameter_name_in_store: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expiry_date: expiration date of service principal secret. :paramtype expiry_date: str @@ -868,7 +870,7 @@ class DefenderForServersAwsOfferingDefenderForServers(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -898,7 +900,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -917,7 +919,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -963,15 +965,15 @@ def __init__( self, *, information_protection: Optional["_models.InformationProtectionAwsOfferingInformationProtection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword information_protection: The native cloud connection configuration. :paramtype information_protection: ~azure.mgmt.security.v2021_07_01_preview.models.InformationProtectionAwsOfferingInformationProtection """ super().__init__(**kwargs) - self.offering_type = "InformationProtectionAws" # type: str + self.offering_type: str = "InformationProtectionAws" self.information_protection = information_protection @@ -986,7 +988,7 @@ class InformationProtectionAwsOfferingInformationProtection(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1006,7 +1008,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -1026,7 +1028,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -1080,8 +1082,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -1175,8 +1177,8 @@ def __init__( cloud_name: Optional[Union[str, "_models.CloudName"]] = None, offerings: Optional[List["_models.CloudOffering"]] = None, organizational_data: Optional["_models.SecurityConnectorPropertiesOrganizationalData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -1239,8 +1241,8 @@ def __init__( parent_hierarchy_id: Optional[str] = None, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organization_membership_type: The multi cloud account's membership type in the organization. Known values are: "Member" and "Organization". @@ -1286,7 +1288,7 @@ class SecurityConnectorsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs): + def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs: Any) -> None: """ :keyword value: The list of security connectors under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2021_07_01_preview.models.SecurityConnector] @@ -1334,8 +1336,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py index f8be4db79c2f..395581c73e89 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py @@ -11,7 +11,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py index 69b42c942dcd..a2fb5f9cac81 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py @@ -47,9 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,10 +86,10 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,9 +128,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,9 +165,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,9 +199,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +214,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -274,10 +274,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -289,9 +289,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -308,7 +308,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @overload def create( @@ -391,8 +393,8 @@ def create( :type resource_group_name: str :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Is either a model - type or a IO type. Required. + :param custom_assessment_automation_body: Custom Assessment Automation body. Is either a + CustomAssessmentAutomationRequest type or a IO type. Required. :type custom_assessment_automation_body: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomationRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -414,11 +416,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -441,9 +443,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -460,11 +462,13 @@ def create( deserialized = self._deserialize("CustomAssessmentAutomation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -495,10 +499,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -510,9 +514,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -525,7 +529,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace def list_by_resource_group( @@ -548,10 +554,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -573,7 +579,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -589,7 +595,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -597,13 +603,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -616,7 +622,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomAssessmentAutomation"]: @@ -634,10 +642,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomAssessm _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -658,7 +666,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -674,7 +682,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -682,13 +690,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -701,4 +709,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py index e1ec5f2bdfaf..8a223b24761d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py @@ -47,9 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,10 +86,10 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,9 +128,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,9 +165,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,9 +199,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +214,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,10 +275,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -290,9 +290,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -309,7 +309,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @overload def create( @@ -395,7 +397,7 @@ def create( Generated name is GUID. Required. :type custom_entity_store_assignment_name: str :param custom_entity_store_assignment_request_body: Custom entity store assignment body. Is - either a model type or a IO type. Required. + either a CustomEntityStoreAssignmentRequest type or a IO type. Required. :type custom_entity_store_assignment_request_body: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignmentRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -417,11 +419,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -446,9 +448,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -465,11 +467,13 @@ def create( deserialized = self._deserialize("CustomEntityStoreAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -501,10 +505,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -516,9 +520,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -531,7 +535,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace def list_by_resource_group( @@ -554,10 +560,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -579,7 +585,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -595,7 +601,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -603,13 +609,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -622,7 +628,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomEntityStoreAssignment"]: @@ -640,10 +648,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomEntityS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -664,7 +672,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -680,7 +688,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -688,13 +696,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -707,4 +715,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py index ad867e4287d4..baaa40375a3d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,10 +186,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace def get(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> _models.SecurityConnector: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def create_or_update( @@ -581,8 +585,8 @@ def create_or_update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2021_07_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -604,11 +608,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -650,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def update( @@ -727,8 +733,8 @@ def update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2021_07_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -750,11 +756,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +783,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +802,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,10 +833,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -840,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -855,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py index 9c10b6b87859..543fbef3c8f7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: Literal["2021-10-01-preview"] + api_version: Literal["2021-10-01-preview"] = kwargs.pop("api_version", "2021-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json index 99191c265762..9c0620f4c7cc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py index fd10b637870a..5780d92a0dae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import MdeOnboardingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -77,15 +77,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py index bf874fb09566..50bafc8fc86f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: Literal["2021-10-01-preview"] + api_version: Literal["2021-10-01-preview"] = kwargs.pop("api_version", "2021-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py index 7d42b3093fde..4beb1bebc1d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import MdeOnboardingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -84,5 +84,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py index 1c4389328fa3..cf82df5f135a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._mde_onboardings_operations import MdeOnboardingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py index 5ade8af29984..aaf59e91077d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py @@ -75,10 +75,10 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingDataList] + ) + cls: ClsType[_models.MdeOnboardingDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -88,9 +88,9 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -107,7 +107,7 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} @distributed_trace_async async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: @@ -129,10 +129,10 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingData] + ) + cls: ClsType[_models.MdeOnboardingData] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -142,9 +142,9 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -161,4 +161,4 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py index b94357acce61..cb8c7cea8637 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py @@ -12,7 +12,7 @@ from ._models_py3 import MdeOnboardingDataList from ._models_py3 import Resource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py index f6f240ff2eb8..b54da6ab16d9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class CloudErrorBody(_serialization.Model): """The error detail. @@ -46,7 +50,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -77,7 +81,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -109,7 +113,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -155,8 +159,8 @@ def __init__( *, onboarding_package_windows: Optional[bytes] = None, onboarding_package_linux: Optional[bytes] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword onboarding_package_windows: The onboarding package used to onboard Windows machines to MDE, coded in base64. This can also be used for onboarding using the dedicated VM Extension. @@ -182,7 +186,7 @@ class MdeOnboardingDataList(_serialization.Model): "value": {"key": "value", "type": "[MdeOnboardingData]"}, } - def __init__(self, *, value: Optional[List["_models.MdeOnboardingData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.MdeOnboardingData"]] = None, **kwargs: Any) -> None: """ :keyword value: List of the resources of the configuration or data needed to onboard the machine to MDE. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py index 1c4389328fa3..cf82df5f135a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._mde_onboardings_operations import MdeOnboardingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py index 537642b6028f..089a030d543e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py @@ -43,9 +43,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,10 +136,10 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingDataList] + ) + cls: ClsType[_models.MdeOnboardingDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -149,9 +149,9 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -168,7 +168,7 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} @distributed_trace def get(self, **kwargs: Any) -> _models.MdeOnboardingData: @@ -190,10 +190,10 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingData] + ) + cls: ClsType[_models.MdeOnboardingData] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -203,9 +203,9 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,4 +222,4 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py index f82e49827e0f..2584275a45a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01") # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", "2022-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json index d019af3e33e5..f30c7c644cbe 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py index 7715a7f00326..cf81bd7d9e28 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -78,15 +78,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py index 2959d8611ba3..32a9bf18a2df 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01") # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", "2022-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py index d10128e19d60..dff07a4ae9bc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -85,5 +85,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py index 5322d47bdfc7..6bf9eeeb226c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py @@ -88,8 +88,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +153,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -170,8 +170,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -193,7 +193,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -209,7 +209,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -217,13 +217,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -236,7 +236,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -254,8 +256,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -277,7 +279,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -293,7 +295,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -301,13 +303,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -320,7 +322,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -343,8 +347,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -367,7 +371,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -383,7 +387,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -391,13 +395,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,7 +414,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace_async async def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -437,8 +443,8 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -450,9 +456,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -469,7 +475,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def get_resource_group_level( @@ -501,8 +509,8 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( resource_group_name=resource_group_name, @@ -515,9 +523,9 @@ async def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -534,7 +542,9 @@ async def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -563,8 +573,8 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -576,9 +586,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -591,7 +601,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -620,8 +632,8 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -633,9 +645,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,7 +660,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -677,8 +691,8 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -690,9 +704,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -705,7 +719,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace_async async def update_subscription_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -734,8 +750,8 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_in_progress_request( asc_location=asc_location, @@ -747,9 +763,9 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -762,7 +778,9 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_subscription_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } @distributed_trace_async async def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -794,8 +812,8 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( resource_group_name=resource_group_name, @@ -808,9 +826,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -823,7 +841,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -855,8 +875,8 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( resource_group_name=resource_group_name, @@ -869,9 +889,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -884,7 +904,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -916,8 +938,8 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( resource_group_name=resource_group_name, @@ -930,9 +952,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -945,7 +967,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace_async async def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -977,8 +1001,8 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_in_progress_request( resource_group_name=resource_group_name, @@ -991,9 +1015,9 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1006,7 +1030,9 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_resource_group_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } async def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1025,9 +1051,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1049,9 +1075,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1064,7 +1090,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload async def begin_simulate( @@ -1143,8 +1171,8 @@ async def begin_simulate( :param asc_location: The location where ASC stores the data of the subscription. can be retrieved from Get locations. Required. :type asc_location: str - :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a model type - or a IO type. Required. + :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a + AlertSimulatorRequestBody type or a IO type. Required. :type alert_simulator_request_body: ~azure.mgmt.security.v2022_01_01.models.AlertSimulatorRequestBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1165,12 +1193,12 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1189,10 +1217,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1204,6 +1232,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py index 5ecc2f93a8b7..21ba3cd6f9a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py @@ -27,7 +27,7 @@ from ._security_center_enums import KindEnum from ._security_center_enums import ResourceIdentifierType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py index d06450ef6ea1..1b29705baf4b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py @@ -48,7 +48,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -210,8 +210,8 @@ def __init__( # pylint: disable=too-many-locals *, extended_properties: Optional[Dict[str, str]] = None, supporting_evidence: Optional["_models.AlertPropertiesSupportingEvidence"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword extended_properties: Custom properties for the alert. :paramtype extended_properties: dict[str, str] @@ -271,7 +271,7 @@ class AlertEntity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -302,7 +302,7 @@ class AlertList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs: Any) -> None: """ :keyword value: describes security alert properties. :paramtype value: list[~azure.mgmt.security.v2022_01_01.models.Alert] @@ -333,7 +333,7 @@ class AlertPropertiesSupportingEvidence(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -370,7 +370,7 @@ class AlertSimulatorRequestProperties(_serialization.Model): _subtype_map = {"kind": {"Bundles": "AlertSimulatorBundlesRequestProperties"}} - def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -378,7 +378,7 @@ def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, ** """ super().__init__(**kwargs) self.additional_properties = additional_properties - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSimulatorBundlesRequestProperties(AlertSimulatorRequestProperties): @@ -410,8 +410,8 @@ def __init__( *, additional_properties: Optional[Dict[str, Any]] = None, bundles: Optional[List[Union[str, "_models.BundleType"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -420,7 +420,7 @@ def __init__( :paramtype bundles: list[str or ~azure.mgmt.security.v2022_01_01.models.BundleType] """ super().__init__(additional_properties=additional_properties, **kwargs) - self.kind = "Bundles" # type: str + self.kind: str = "Bundles" self.bundles = bundles @@ -435,7 +435,9 @@ class AlertSimulatorRequestBody(_serialization.Model): "properties": {"key": "properties", "type": "AlertSimulatorRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Alert Simulator request body data. :paramtype properties: ~azure.mgmt.security.v2022_01_01.models.AlertSimulatorRequestProperties @@ -445,7 +447,8 @@ def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestPropert class ResourceIdentifier(_serialization.Model): - """A resource identifier for an alert which can be used to direct the alert to the right product exposure group (tenant, workspace, subscription etc.). + """A resource identifier for an alert which can be used to direct the alert to the right product + exposure group (tenant, workspace, subscription etc.). You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureResourceIdentifier, LogAnalyticsIdentifier @@ -467,10 +470,10 @@ class ResourceIdentifier(_serialization.Model): _subtype_map = {"type": {"AzureResource": "AzureResourceIdentifier", "LogAnalytics": "LogAnalyticsIdentifier"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None class AzureResourceIdentifier(ResourceIdentifier): @@ -497,10 +500,10 @@ class AzureResourceIdentifier(ResourceIdentifier): "azure_resource_id": {"key": "azureResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "AzureResource" # type: str + self.type: str = "AzureResource" self.azure_resource_id = None @@ -537,7 +540,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -568,7 +571,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -617,10 +620,10 @@ class LogAnalyticsIdentifier(ResourceIdentifier): "agent_id": {"key": "agentId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "LogAnalytics" # type: str + self.type: str = "LogAnalytics" self.workspace_id = None self.workspace_subscription_id = None self.workspace_resource_group = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py index cc9cbc0e1cc0..f4110fe68b30 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py @@ -15,27 +15,27 @@ class AlertSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. """ - #: Informational INFORMATIONAL = "Informational" - #: Low + """Informational""" LOW = "Low" - #: Medium + """Low""" MEDIUM = "Medium" - #: High + """Medium""" HIGH = "High" + """High""" class AlertStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The life cycle status of the alert.""" - #: An alert which doesn't specify a value is assigned the status 'Active' ACTIVE = "Active" - #: An alert which is in handling state + """An alert which doesn't specify a value is assigned the status 'Active'""" IN_PROGRESS = "InProgress" - #: Alert closed after handling + """An alert which is in handling state""" RESOLVED = "Resolved" - #: Alert dismissed as false positive + """Alert closed after handling""" DISMISSED = "Dismissed" + """Alert dismissed as false positive""" class BundleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -57,65 +57,65 @@ class Intent(str, Enum, metaclass=CaseInsensitiveEnumMeta): of Azure Security Center's supported kill chain intents. """ - #: Unknown UNKNOWN = "Unknown" - #: PreAttack could be either an attempt to access a certain resource regardless of a malicious + """Unknown""" + PRE_ATTACK = "PreAttack" + """PreAttack could be either an attempt to access a certain resource regardless of a malicious #: intent, or a failed attempt to gain access to a target system to gather information prior to #: exploitation. This step is usually detected as an attempt, originating from outside the #: network, to scan the target system and find a way in. Further details on the PreAttack stage - #: can be read in `MITRE Pre-Att&ck matrix `_. - PRE_ATTACK = "PreAttack" - #: InitialAccess is the stage where an attacker manages to get foothold on the attacked resource. + #: can be read in `MITRE Pre-Att&ck matrix `_.""" INITIAL_ACCESS = "InitialAccess" - #: Persistence is any access, action, or configuration change to a system that gives a threat - #: actor a persistent presence on that system. + """InitialAccess is the stage where an attacker manages to get foothold on the attacked resource.""" PERSISTENCE = "Persistence" - #: Privilege escalation is the result of actions that allow an adversary to obtain a higher level - #: of permissions on a system or network. + """Persistence is any access, action, or configuration change to a system that gives a threat + #: actor a persistent presence on that system.""" PRIVILEGE_ESCALATION = "PrivilegeEscalation" - #: Defense evasion consists of techniques an adversary may use to evade detection or avoid other - #: defenses. + """Privilege escalation is the result of actions that allow an adversary to obtain a higher level + #: of permissions on a system or network.""" DEFENSE_EVASION = "DefenseEvasion" - #: Credential access represents techniques resulting in access to or control over system, domain, - #: or service credentials that are used within an enterprise environment. + """Defense evasion consists of techniques an adversary may use to evade detection or avoid other + #: defenses.""" CREDENTIAL_ACCESS = "CredentialAccess" - #: Discovery consists of techniques that allow the adversary to gain knowledge about the system - #: and internal network. + """Credential access represents techniques resulting in access to or control over system, domain, + #: or service credentials that are used within an enterprise environment.""" DISCOVERY = "Discovery" - #: Lateral movement consists of techniques that enable an adversary to access and control remote - #: systems on a network and could, but does not necessarily, include execution of tools on remote - #: systems. + """Discovery consists of techniques that allow the adversary to gain knowledge about the system + #: and internal network.""" LATERAL_MOVEMENT = "LateralMovement" - #: The execution tactic represents techniques that result in execution of adversary-controlled - #: code on a local or remote system. + """Lateral movement consists of techniques that enable an adversary to access and control remote + #: systems on a network and could, but does not necessarily, include execution of tools on remote + #: systems.""" EXECUTION = "Execution" - #: Collection consists of techniques used to identify and gather information, such as sensitive - #: files, from a target network prior to exfiltration. + """The execution tactic represents techniques that result in execution of adversary-controlled + #: code on a local or remote system.""" COLLECTION = "Collection" - #: Exfiltration refers to techniques and attributes that result or aid in the adversary removing - #: files and information from a target network. + """Collection consists of techniques used to identify and gather information, such as sensitive + #: files, from a target network prior to exfiltration.""" EXFILTRATION = "Exfiltration" - #: The command and control tactic represents how adversaries communicate with systems under their - #: control within a target network. + """Exfiltration refers to techniques and attributes that result or aid in the adversary removing + #: files and information from a target network.""" COMMAND_AND_CONTROL = "CommandAndControl" - #: Impact events primarily try to directly reduce the availability or integrity of a system, - #: service, or network; including manipulation of data to impact a business or operational - #: process. + """The command and control tactic represents how adversaries communicate with systems under their + #: control within a target network.""" IMPACT = "Impact" - #: Probing could be either an attempt to access a certain resource regardless of a malicious - #: intent, or a failed attempt to gain access to a target system to gather information prior to - #: exploitation. + """Impact events primarily try to directly reduce the availability or integrity of a system, + #: service, or network; including manipulation of data to impact a business or operational + #: process.""" PROBING = "Probing" - #: Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. - #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc. + """Probing could be either an attempt to access a certain resource regardless of a malicious + #: intent, or a failed attempt to gain access to a target system to gather information prior to + #: exploitation.""" EXPLOITATION = "Exploitation" + """Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. + #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc.""" class KindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of alert simulation.""" - #: Simulate alerts according to bundles BUNDLES = "Bundles" + """Simulate alerts according to bundles""" class ResourceIdentifierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py index 8b4e64307f33..d16c0201e300 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py @@ -47,7 +47,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +107,7 @@ def build_list_subscription_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_list_subscription_level_by_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,7 +138,7 @@ def build_list_resource_group_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_list_resource_group_level_by_region_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_get_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_get_subscription_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +206,7 @@ def build_get_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +225,7 @@ def build_get_resource_group_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +242,7 @@ def build_update_subscription_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,7 +258,7 @@ def build_update_subscription_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +275,7 @@ def build_update_subscription_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +291,7 @@ def build_update_subscription_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,7 +308,7 @@ def build_update_subscription_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +324,7 @@ def build_update_subscription_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -341,7 +341,7 @@ def build_update_subscription_level_state_to_in_progress_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -357,7 +357,7 @@ def build_update_subscription_level_state_to_in_progress_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -374,7 +374,7 @@ def build_update_resource_group_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +393,7 @@ def build_update_resource_group_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -410,7 +410,7 @@ def build_update_resource_group_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -429,7 +429,7 @@ def build_update_resource_group_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -446,7 +446,7 @@ def build_update_resource_group_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -465,7 +465,7 @@ def build_update_resource_group_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -482,7 +482,7 @@ def build_update_resource_group_level_state_to_in_progress_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -501,7 +501,7 @@ def build_update_resource_group_level_state_to_in_progress_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -516,8 +516,8 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -532,7 +532,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -576,8 +576,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -598,7 +598,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -614,7 +614,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -622,13 +622,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -641,7 +641,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -658,8 +658,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -681,7 +681,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -697,7 +697,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -705,13 +705,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -724,7 +724,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -742,8 +744,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -765,7 +767,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -781,7 +783,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -789,13 +791,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -808,7 +810,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -831,8 +835,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -855,7 +859,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -871,7 +875,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -879,13 +883,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -898,7 +902,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -925,8 +931,8 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -938,9 +944,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -957,7 +963,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def get_resource_group_level( @@ -989,8 +997,8 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( resource_group_name=resource_group_name, @@ -1003,9 +1011,9 @@ def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1022,7 +1030,9 @@ def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -1051,8 +1061,8 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -1064,9 +1074,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1079,7 +1089,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1108,8 +1120,8 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -1121,9 +1133,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1136,7 +1148,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1165,8 +1179,8 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -1178,9 +1192,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1193,7 +1207,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace def update_subscription_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -1222,8 +1238,8 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_in_progress_request( asc_location=asc_location, @@ -1235,9 +1251,9 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1250,7 +1266,9 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_subscription_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } @distributed_trace def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1282,8 +1300,8 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( resource_group_name=resource_group_name, @@ -1296,9 +1314,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1311,7 +1329,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -1343,8 +1363,8 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( resource_group_name=resource_group_name, @@ -1357,9 +1377,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1372,7 +1392,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1404,8 +1426,8 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( resource_group_name=resource_group_name, @@ -1418,9 +1440,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1433,7 +1455,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -1465,8 +1489,8 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_in_progress_request( resource_group_name=resource_group_name, @@ -1479,9 +1503,9 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1494,7 +1518,9 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_resource_group_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1513,9 +1539,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1537,9 +1563,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1552,7 +1578,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload def begin_simulate( @@ -1631,8 +1659,8 @@ def begin_simulate( :param asc_location: The location where ASC stores the data of the subscription. can be retrieved from Get locations. Required. :type asc_location: str - :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a model type - or a IO type. Required. + :param alert_simulator_request_body: Alert Simulator Request Properties. Is either a + AlertSimulatorRequestBody type or a IO type. Required. :type alert_simulator_request_body: ~azure.mgmt.security.v2022_01_01.models.AlertSimulatorRequestBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1653,12 +1681,12 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1677,9 +1705,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1691,6 +1719,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py index d57df2945327..5c46ff4bf08c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py @@ -33,33 +33,25 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: Literal["2022-01-01-preview"] + api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential - self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json index 557420da04a7..24cb0f4dd520 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json @@ -19,13 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -34,36 +29,33 @@ "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true } }, "constant": { }, - "call": "credential, subscription_id", + "call": "credential", "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -97,12 +92,7 @@ "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "governance_rule": "GovernanceRuleOperations", "governance_rules": "GovernanceRulesOperations", - "security_connector_governance_rule": "SecurityConnectorGovernanceRuleOperations", - "security_connector_governance_rules": "SecurityConnectorGovernanceRulesOperations", - "subscription_governance_rules_execute_status": "SubscriptionGovernanceRulesExecuteStatusOperations", - "security_connector_governance_rules_execute_status": "SecurityConnectorGovernanceRulesExecuteStatusOperations", "governance_assignments": "GovernanceAssignmentsOperations" } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py index a12a5f9f4461..326cfae78540 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py @@ -12,55 +12,27 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration -from .operations import ( - GovernanceAssignmentsOperations, - GovernanceRuleOperations, - GovernanceRulesOperations, - SecurityConnectorGovernanceRuleOperations, - SecurityConnectorGovernanceRulesExecuteStatusOperations, - SecurityConnectorGovernanceRulesOperations, - SubscriptionGovernanceRulesExecuteStatusOperations, -) +from .operations import GovernanceAssignmentsOperations, GovernanceRulesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar governance_rule: GovernanceRuleOperations operations - :vartype governance_rule: - azure.mgmt.security.v2022_01_01_preview.operations.GovernanceRuleOperations :ivar governance_rules: GovernanceRulesOperations operations :vartype governance_rules: azure.mgmt.security.v2022_01_01_preview.operations.GovernanceRulesOperations - :ivar security_connector_governance_rule: SecurityConnectorGovernanceRuleOperations operations - :vartype security_connector_governance_rule: - azure.mgmt.security.v2022_01_01_preview.operations.SecurityConnectorGovernanceRuleOperations - :ivar security_connector_governance_rules: SecurityConnectorGovernanceRulesOperations - operations - :vartype security_connector_governance_rules: - azure.mgmt.security.v2022_01_01_preview.operations.SecurityConnectorGovernanceRulesOperations - :ivar subscription_governance_rules_execute_status: - SubscriptionGovernanceRulesExecuteStatusOperations operations - :vartype subscription_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.operations.SubscriptionGovernanceRulesExecuteStatusOperations - :ivar security_connector_governance_rules_execute_status: - SecurityConnectorGovernanceRulesExecuteStatusOperations operations - :vartype security_connector_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.operations.SecurityConnectorGovernanceRulesExecuteStatusOperations :ivar governance_assignments: GovernanceAssignmentsOperations operations :vartype governance_assignments: azure.mgmt.security.v2022_01_01_preview.operations.GovernanceAssignmentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding @@ -71,37 +43,18 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too- """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.governance_rule = GovernanceRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.governance_rules = GovernanceRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.security_connector_governance_rule = SecurityConnectorGovernanceRuleOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules = SecurityConnectorGovernanceRulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_governance_rules_execute_status = SubscriptionGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules_execute_status = ( - SecurityConnectorGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - ) self.governance_assignments = GovernanceAssignmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -128,15 +81,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py index b57abce4011b..c202d941d402 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py @@ -33,24 +33,19 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: Literal["2022-01-01-preview"] + api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential - self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py index e2595715763a..0a9cb226afa1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py @@ -12,55 +12,27 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration -from .operations import ( - GovernanceAssignmentsOperations, - GovernanceRuleOperations, - GovernanceRulesOperations, - SecurityConnectorGovernanceRuleOperations, - SecurityConnectorGovernanceRulesExecuteStatusOperations, - SecurityConnectorGovernanceRulesOperations, - SubscriptionGovernanceRulesExecuteStatusOperations, -) +from .operations import GovernanceAssignmentsOperations, GovernanceRulesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar governance_rule: GovernanceRuleOperations operations - :vartype governance_rule: - azure.mgmt.security.v2022_01_01_preview.aio.operations.GovernanceRuleOperations :ivar governance_rules: GovernanceRulesOperations operations :vartype governance_rules: azure.mgmt.security.v2022_01_01_preview.aio.operations.GovernanceRulesOperations - :ivar security_connector_governance_rule: SecurityConnectorGovernanceRuleOperations operations - :vartype security_connector_governance_rule: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SecurityConnectorGovernanceRuleOperations - :ivar security_connector_governance_rules: SecurityConnectorGovernanceRulesOperations - operations - :vartype security_connector_governance_rules: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SecurityConnectorGovernanceRulesOperations - :ivar subscription_governance_rules_execute_status: - SubscriptionGovernanceRulesExecuteStatusOperations operations - :vartype subscription_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SubscriptionGovernanceRulesExecuteStatusOperations - :ivar security_connector_governance_rules_execute_status: - SecurityConnectorGovernanceRulesExecuteStatusOperations operations - :vartype security_connector_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SecurityConnectorGovernanceRulesExecuteStatusOperations :ivar governance_assignments: GovernanceAssignmentsOperations operations :vartype governance_assignments: azure.mgmt.security.v2022_01_01_preview.aio.operations.GovernanceAssignmentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding @@ -71,37 +43,18 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too- """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.governance_rule = GovernanceRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.governance_rules = GovernanceRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.security_connector_governance_rule = SecurityConnectorGovernanceRuleOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules = SecurityConnectorGovernanceRulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_governance_rules_execute_status = SubscriptionGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules_execute_status = ( - SecurityConnectorGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - ) self.governance_assignments = GovernanceAssignmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -135,5 +88,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py index 504e37b2c881..860a6a4ae0a3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py @@ -6,27 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._governance_rule_operations import GovernanceRuleOperations from ._governance_rules_operations import GovernanceRulesOperations -from ._security_connector_governance_rule_operations import SecurityConnectorGovernanceRuleOperations -from ._security_connector_governance_rules_operations import SecurityConnectorGovernanceRulesOperations -from ._subscription_governance_rules_execute_status_operations import SubscriptionGovernanceRulesExecuteStatusOperations -from ._security_connector_governance_rules_execute_status_operations import ( - SecurityConnectorGovernanceRulesExecuteStatusOperations, -) from ._governance_assignments_operations import GovernanceAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "GovernanceRuleOperations", "GovernanceRulesOperations", - "SecurityConnectorGovernanceRuleOperations", - "SecurityConnectorGovernanceRulesOperations", - "SubscriptionGovernanceRulesExecuteStatusOperations", - "SecurityConnectorGovernanceRulesExecuteStatusOperations", "GovernanceAssignmentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py index 7be4f81e6edc..3b44f11a95a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py @@ -65,13 +65,14 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable["_models.GovernanceAssignment"]: - """Get security governanceAssignments on all your resources inside a scope. + """Get governance assignments on all of your resources inside a scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GovernanceAssignment or the result of @@ -83,10 +84,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignmentsList] + ) + cls: ClsType[_models.GovernanceAssignmentsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +109,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +125,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GovernanceAssignmentsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,7 +152,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} @distributed_trace_async async def get( @@ -159,14 +160,15 @@ async def get( ) -> _models.GovernanceAssignment: """Get a specific governanceAssignment for the requested scope by AssignmentKey. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GovernanceAssignment or the result of cls(response) @@ -184,10 +186,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -199,9 +201,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -218,7 +220,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @overload async def create_or_update( @@ -231,18 +235,19 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -265,18 +270,19 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -296,19 +302,20 @@ async def create_or_update( governance_assignment: Union[_models.GovernanceAssignment, IO], **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Is either a model - type or a IO type. Required. + :param governance_assignment: Governance assignment over a subscription scope. Is either a + GovernanceAssignment type or a IO type. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -330,11 +337,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -357,9 +364,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -376,11 +383,13 @@ async def create_or_update( deserialized = self._deserialize("GovernanceAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -388,14 +397,15 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a GovernanceAssignment over a given scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -413,10 +423,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -428,9 +438,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,4 +453,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py deleted file mode 100644 index 2927ce84c770..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py +++ /dev/null @@ -1,140 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._governance_rule_operations import build_list_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a subscription level scope. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py index d0f4a162976f..38fca60b2a2c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py @@ -7,8 +7,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -21,6 +23,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,9 +34,10 @@ from ...operations._governance_rules_operations import ( build_create_or_update_request, build_delete_request, + build_execute_request, build_get_request, - build_rule_id_execute_single_security_connector_request, - build_rule_id_execute_single_subscription_request, + build_list_request, + build_operation_results_request, ) if sys.version_info >= (3, 8): @@ -63,11 +67,105 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.GovernanceRule"]: + """Get a list of all relevant governance rules over a scope. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GovernanceRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.GovernanceRuleList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + scope=scope, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GovernanceRuleList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules"} + @distributed_trace_async - async def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. + async def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: + """Get a specific governance rule for the requested scope by ruleId. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,23 +184,23 @@ async def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) request = build_get_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -119,23 +217,30 @@ async def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} @overload async def create_or_update( self, + scope: str, rule_id: str, governance_rule: _models.GovernanceRule, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -148,14 +253,20 @@ async def create_or_update( @overload async def create_or_update( - self, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any + self, scope: str, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -168,15 +279,21 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any + self, scope: str, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. + :param governance_rule: Governance rule over a given scope. Is either a GovernanceRule type or + a IO type. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -197,11 +314,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -212,8 +329,8 @@ async def create_or_update( _json = self._serialize.body(governance_rule, "GovernanceRule") request = build_create_or_update_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -223,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -242,24 +359,15 @@ async def create_or_update( deserialized = self._deserialize("GovernanceRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - @distributed_trace_async - async def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a GovernanceRule over a given scope. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, scope: str, rule_id: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -271,189 +379,54 @@ async def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable= _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs ) + cls: ClsType[None] = kwargs.pop("cls", None) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - async def _rule_id_execute_single_subscription_initial( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(execute_governance_rule_params, (IO, bytes)): - _content = execute_governance_rule_params - else: - if execute_governance_rule_params is not None: - _json = self._serialize.body(execute_governance_rule_params, "ExecuteGovernanceRuleParams") - else: - _json = None - - request = build_rule_id_execute_single_subscription_request( + request = build_delete_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._rule_id_execute_single_subscription_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_subscription_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore - - @overload - async def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _delete_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} @distributed_trace_async - async def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given subscription. + async def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a Governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a - model type or a IO type. Default value is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -466,23 +439,21 @@ async def begin_rule_id_execute_single_subscription( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._rule_id_execute_single_subscription_initial( # type: ignore + raw_result = await self._delete_initial( # type: ignore + scope=scope, rule_id=rule_id, - execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -495,7 +466,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -507,14 +480,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_rule_id_execute_single_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + begin_delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - async def _rule_id_execute_single_security_connector_initial( # pylint: disable=inconsistent-return-statements + async def _execute_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any @@ -530,11 +502,11 @@ async def _rule_id_execute_single_security_connector_initial( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,23 +519,21 @@ async def _rule_id_execute_single_security_connector_initial( # pylint: disable else: _json = None - request = build_rule_id_execute_single_security_connector_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + request = build_execute_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._rule_id_execute_single_security_connector_initial.metadata["url"], + template_url=self._execute_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -579,31 +549,31 @@ async def _rule_id_execute_single_security_connector_initial( # pylint: disable if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_security_connector_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + _execute_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} @overload - async def begin_rule_id_execute_single_security_connector( + async def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -623,28 +593,28 @@ async def begin_rule_id_execute_single_security_connector( """ @overload - async def begin_rule_id_execute_single_security_connector( + async def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -663,26 +633,26 @@ async def begin_rule_id_execute_single_security_connector( """ @distributed_trace_async - async def begin_rule_id_execute_single_security_connector( + async def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a - model type or a IO type. Default value is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Is either a + ExecuteGovernanceRuleParams type or a IO type. Default value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -703,18 +673,17 @@ async def begin_rule_id_execute_single_security_connector( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._rule_id_execute_single_security_connector_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + raw_result = await self._execute_initial( # type: ignore + scope=scope, rule_id=rule_id, execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, @@ -731,7 +700,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -743,6 +714,84 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_execute.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} + + @distributed_trace_async + async def operation_results( + self, scope: str, rule_id: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.OperationResultAutoGenerated]: + """Get governance rules long run operation result for the requested scope by ruleId and + operationId. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). + Required. + :type rule_id: str + :param operation_id: The governance rule long running operation unique key. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResultAutoGenerated or None or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.OperationResultAutoGenerated or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[Optional[_models.OperationResultAutoGenerated]] = kwargs.pop("cls", None) + + request = build_operation_results_request( + scope=scope, + rule_id=rule_id, + operation_id=operation_id, + api_version=api_version, + template_url=self.operation_results.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized - begin_rule_id_execute_single_security_connector.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py deleted file mode 100644 index b7e5ea958c44..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._security_connector_governance_rule_operations import build_list_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SecurityConnectorGovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`security_connector_governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a security connector level scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py deleted file mode 100644 index f11ac5a5538a..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,195 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._security_connector_governance_rules_execute_status_operations import build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SecurityConnectorGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`security_connector_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _get_initial( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace_async - async def begin_get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._get_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py deleted file mode 100644 index 8446d9e5c7d3..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py +++ /dev/null @@ -1,348 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._security_connector_governance_rules_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SecurityConnectorGovernanceRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`security_connector_governance_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: _models.GovernanceRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: Union[_models.GovernanceRule, IO], - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(governance_rule, (IO, bytes)): - _content = governance_rule - else: - _json = self._serialize.body(governance_rule, "GovernanceRule") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> None: - """Delete a GovernanceRule over a given scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py deleted file mode 100644 index 792b2aacd816..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,184 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._subscription_governance_rules_execute_status_operations import build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SubscriptionGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`subscription_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _get_initial(self, rule_id: str, operation_id: str, **kwargs: Any) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace_async - async def begin_get( - self, rule_id: str, operation_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._get_initial( # type: ignore - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py index 33ca71a193ab..7cecb4ad458c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import Condition from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ExecuteGovernanceRuleParams -from ._models_py3 import ExecuteRuleStatus from ._models_py3 import GovernanceAssignment from ._models_py3 import GovernanceAssignmentAdditionalData from ._models_py3 import GovernanceAssignmentsList @@ -18,7 +17,9 @@ from ._models_py3 import GovernanceRule from ._models_py3 import GovernanceRuleEmailNotification from ._models_py3 import GovernanceRuleList +from ._models_py3 import GovernanceRuleMetadata from ._models_py3 import GovernanceRuleOwnerSource +from ._models_py3 import OperationResultAutoGenerated from ._models_py3 import RemediationEta from ._models_py3 import Resource @@ -26,8 +27,9 @@ from ._security_center_enums import GovernanceRuleOwnerSourceType from ._security_center_enums import GovernanceRuleSourceResourceType from ._security_center_enums import GovernanceRuleType +from ._security_center_enums import OperationResult from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -35,7 +37,6 @@ "Condition", "ErrorAdditionalInfo", "ExecuteGovernanceRuleParams", - "ExecuteRuleStatus", "GovernanceAssignment", "GovernanceAssignmentAdditionalData", "GovernanceAssignmentsList", @@ -43,13 +44,16 @@ "GovernanceRule", "GovernanceRuleEmailNotification", "GovernanceRuleList", + "GovernanceRuleMetadata", "GovernanceRuleOwnerSource", + "OperationResultAutoGenerated", "RemediationEta", "Resource", "GovernanceRuleConditionOperator", "GovernanceRuleOwnerSourceType", "GovernanceRuleSourceResourceType", "GovernanceRuleType", + "OperationResult", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py index 576f80d26382..e20d116571be 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py @@ -58,7 +58,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -92,11 +92,11 @@ class Condition(_serialization.Model): def __init__( self, *, - property: Optional[str] = None, + property: Optional[str] = None, # pylint: disable=redefined-builtin value: Optional[str] = None, operator: Optional[Union[str, "_models.GovernanceRuleConditionOperator"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property: The governance rule Condition's Property, e.g. Severity or AssessmentKey, see examples. @@ -136,7 +136,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -154,7 +154,7 @@ class ExecuteGovernanceRuleParams(_serialization.Model): "override": {"key": "override", "type": "bool"}, } - def __init__(self, *, override: Optional[bool] = None, **kwargs): + def __init__(self, *, override: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword override: Describe if governance rule should be override. :paramtype override: bool @@ -163,29 +163,6 @@ def __init__(self, *, override: Optional[bool] = None, **kwargs): self.override = override -class ExecuteRuleStatus(_serialization.Model): - """Execute status of Security GovernanceRule over a given scope. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation_id: Unique key for the execution of GovernanceRule. - :vartype operation_id: str - """ - - _validation = { - "operation_id": {"readonly": True}, - } - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.operation_id = None - - class Resource(_serialization.Model): """Describes an Azure resource. @@ -211,7 +188,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -220,7 +197,7 @@ def __init__(self, **kwargs): class GovernanceAssignment(Resource): - """Security GovernanceAssignment over a given scope. + """Governance assignment over a given scope. Variables are only populated by the server, and will be ignored when sending a request. @@ -280,8 +257,8 @@ def __init__( is_grace_period: Optional[bool] = None, governance_email_notification: Optional["_models.GovernanceEmailNotification"] = None, additional_data: Optional["_models.GovernanceAssignmentAdditionalData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword owner: The Owner for the governance assignment - e.g. user@contoso.com - see example. :paramtype owner: str @@ -312,15 +289,15 @@ def __init__( class GovernanceAssignmentAdditionalData(_serialization.Model): - """Describe the additional data of GovernanceAssignment - optional. + """Describe the additional data of governance assignment - optional. - :ivar ticket_number: Ticket number associated with this GovernanceAssignment. + :ivar ticket_number: Ticket number associated with this governance assignment. :vartype ticket_number: int - :ivar ticket_link: Ticket link associated with this GovernanceAssignment - for example: + :ivar ticket_link: Ticket link associated with this governance assignment - for example: https://snow.com. :vartype ticket_link: str - :ivar ticket_status: The ticket status associated with this GovernanceAssignment - for example: - Active. + :ivar ticket_status: The ticket status associated with this governance assignment - for + example: Active. :vartype ticket_status: str """ @@ -340,15 +317,15 @@ def __init__( ticket_number: Optional[int] = None, ticket_link: Optional[str] = None, ticket_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword ticket_number: Ticket number associated with this GovernanceAssignment. + :keyword ticket_number: Ticket number associated with this governance assignment. :paramtype ticket_number: int - :keyword ticket_link: Ticket link associated with this GovernanceAssignment - for example: + :keyword ticket_link: Ticket link associated with this governance assignment - for example: https://snow.com. :paramtype ticket_link: str - :keyword ticket_status: The ticket status associated with this GovernanceAssignment - for + :keyword ticket_status: The ticket status associated with this governance assignment - for example: Active. :paramtype ticket_status: str """ @@ -359,7 +336,7 @@ def __init__( class GovernanceAssignmentsList(_serialization.Model): - """Page of a security governance assignments list. + """Page of a governance assignments list. Variables are only populated by the server, and will be ignored when sending a request. @@ -379,7 +356,7 @@ class GovernanceAssignmentsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -405,8 +382,8 @@ def __init__( *, disable_manager_email_notification: Optional[bool] = None, disable_owner_email_notification: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword disable_manager_email_notification: Exclude manager from weekly email notification. :paramtype disable_manager_email_notification: bool @@ -419,7 +396,7 @@ def __init__( class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes - """Security GovernanceRule over a given scope. + """Governance rule over a given scope. Variables are only populated by the server, and will be ignored when sending a request. @@ -429,9 +406,11 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar display_name: display name of the governanceRule. + :ivar tenant_id: The tenantId (GUID). + :vartype tenant_id: str + :ivar display_name: Display name of the governance rule. :vartype display_name: str - :ivar description: description of the governanceRule. + :ivar description: Description of the governance rule. :vartype description: str :ivar remediation_timeframe: Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. 7.00:00:00 - means 7 days. @@ -439,7 +418,7 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes :ivar is_grace_period: Defines whether there is a grace period on the governance rule. :vartype is_grace_period: bool :ivar rule_priority: The governance rule priority, priority to the lower number. Rules with the - same priority on the same subscription will not be allowed. + same priority on the same scope will not be allowed. :vartype rule_priority: int :ivar is_disabled: Defines whether the rule is active/inactive. :vartype is_disabled: bool @@ -450,9 +429,15 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes Assessments. "Assessments" :vartype source_resource_type: str or ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleSourceResourceType + :ivar excluded_scopes: Excluded scopes, filter out the descendants of the scope (on management + scopes). + :vartype excluded_scopes: list[str] :ivar condition_sets: The governance rule conditionSets - see examples. :vartype condition_sets: list[JSON] - :ivar owner_source: The Owner source for the governance rule - e.g. Manually by + :ivar include_member_scopes: Defines whether the rule is management scope rule (master + connector as a single scope or management scope). + :vartype include_member_scopes: bool + :ivar owner_source: The owner source for the governance rule - e.g. Manually by user@contoso.com - see example. :vartype owner_source: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleOwnerSource @@ -460,12 +445,16 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes states whether to disable notifications for mangers and owners. :vartype governance_email_notification: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleEmailNotification + :ivar metadata: The governance rule metadata. + :vartype metadata: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleMetadata """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "tenant_id": {"readonly": True}, + "remediation_timeframe": {"pattern": r"^[0-9]+\.[0-9]{2}:[0-9]{2}:[0-9]{2}$"}, "rule_priority": {"maximum": 1000, "minimum": 0}, } @@ -473,6 +462,7 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "remediation_timeframe": {"key": "properties.remediationTimeframe", "type": "str"}, @@ -481,12 +471,15 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes "is_disabled": {"key": "properties.isDisabled", "type": "bool"}, "rule_type": {"key": "properties.ruleType", "type": "str"}, "source_resource_type": {"key": "properties.sourceResourceType", "type": "str"}, + "excluded_scopes": {"key": "properties.excludedScopes", "type": "[str]"}, "condition_sets": {"key": "properties.conditionSets", "type": "[object]"}, + "include_member_scopes": {"key": "properties.includeMemberScopes", "type": "bool"}, "owner_source": {"key": "properties.ownerSource", "type": "GovernanceRuleOwnerSource"}, "governance_email_notification": { "key": "properties.governanceEmailNotification", "type": "GovernanceRuleEmailNotification", }, + "metadata": {"key": "properties.metadata", "type": "GovernanceRuleMetadata"}, } def __init__( @@ -500,15 +493,18 @@ def __init__( is_disabled: Optional[bool] = None, rule_type: Optional[Union[str, "_models.GovernanceRuleType"]] = None, source_resource_type: Optional[Union[str, "_models.GovernanceRuleSourceResourceType"]] = None, + excluded_scopes: Optional[List[str]] = None, condition_sets: Optional[List[JSON]] = None, + include_member_scopes: Optional[bool] = None, owner_source: Optional["_models.GovernanceRuleOwnerSource"] = None, governance_email_notification: Optional["_models.GovernanceRuleEmailNotification"] = None, - **kwargs - ): + metadata: Optional["_models.GovernanceRuleMetadata"] = None, + **kwargs: Any + ) -> None: """ - :keyword display_name: display name of the governanceRule. + :keyword display_name: Display name of the governance rule. :paramtype display_name: str - :keyword description: description of the governanceRule. + :keyword description: Description of the governance rule. :paramtype description: str :keyword remediation_timeframe: Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. 7.00:00:00 - means 7 days. @@ -516,7 +512,7 @@ def __init__( :keyword is_grace_period: Defines whether there is a grace period on the governance rule. :paramtype is_grace_period: bool :keyword rule_priority: The governance rule priority, priority to the lower number. Rules with - the same priority on the same subscription will not be allowed. + the same priority on the same scope will not be allowed. :paramtype rule_priority: int :keyword is_disabled: Defines whether the rule is active/inactive. :paramtype is_disabled: bool @@ -527,9 +523,15 @@ def __init__( Assessments. "Assessments" :paramtype source_resource_type: str or ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleSourceResourceType + :keyword excluded_scopes: Excluded scopes, filter out the descendants of the scope (on + management scopes). + :paramtype excluded_scopes: list[str] :keyword condition_sets: The governance rule conditionSets - see examples. :paramtype condition_sets: list[JSON] - :keyword owner_source: The Owner source for the governance rule - e.g. Manually by + :keyword include_member_scopes: Defines whether the rule is management scope rule (master + connector as a single scope or management scope). + :paramtype include_member_scopes: bool + :keyword owner_source: The owner source for the governance rule - e.g. Manually by user@contoso.com - see example. :paramtype owner_source: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleOwnerSource @@ -537,8 +539,11 @@ def __init__( rule, states whether to disable notifications for mangers and owners. :paramtype governance_email_notification: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleEmailNotification + :keyword metadata: The governance rule metadata. + :paramtype metadata: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleMetadata """ super().__init__(**kwargs) + self.tenant_id = None self.display_name = display_name self.description = description self.remediation_timeframe = remediation_timeframe @@ -547,9 +552,12 @@ def __init__( self.is_disabled = is_disabled self.rule_type = rule_type self.source_resource_type = source_resource_type + self.excluded_scopes = excluded_scopes self.condition_sets = condition_sets + self.include_member_scopes = include_member_scopes self.owner_source = owner_source self.governance_email_notification = governance_email_notification + self.metadata = metadata class GovernanceRuleEmailNotification(_serialization.Model): @@ -572,8 +580,8 @@ def __init__( *, disable_manager_email_notification: Optional[bool] = None, disable_owner_email_notification: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword disable_manager_email_notification: Defines whether manager email notifications are disabled. @@ -588,11 +596,11 @@ def __init__( class GovernanceRuleList(_serialization.Model): - """Page of a security governanceRules list. + """Page of a governance rules list. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Collection of governanceRules in this page. + :ivar value: Collection of governance rules in this page. :vartype value: list[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] :ivar next_link: The URI to fetch the next page. :vartype next_link: str @@ -608,13 +616,51 @@ class GovernanceRuleList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None +class GovernanceRuleMetadata(_serialization.Model): + """The governance rule metadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_by: Governance rule Created by object id (GUID). + :vartype created_by: str + :ivar created_on: Governance rule creation date. + :vartype created_on: ~datetime.datetime + :ivar updated_by: Governance rule last updated by object id (GUID). + :vartype updated_by: str + :ivar updated_on: Governance rule last update date. + :vartype updated_on: ~datetime.datetime + """ + + _validation = { + "created_by": {"readonly": True}, + "created_on": {"readonly": True}, + "updated_by": {"readonly": True}, + "updated_on": {"readonly": True}, + } + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "updated_by": {"key": "updatedBy", "type": "str"}, + "updated_on": {"key": "updatedOn", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_by = None + self.created_on = None + self.updated_by = None + self.updated_on = None + + class GovernanceRuleOwnerSource(_serialization.Model): """Describe the owner source of governance rule. @@ -636,8 +682,8 @@ def __init__( *, type: Optional[Union[str, "_models.GovernanceRuleOwnerSourceType"]] = None, value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The owner type for the governance rule owner source. Known values are: "ByTag" and "Manually". @@ -651,6 +697,30 @@ def __init__( self.value = value +class OperationResultAutoGenerated(_serialization.Model): + """Long run operation status of governance rule over a given scope. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the long run operation result of governance rule. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype status: str or ~azure.mgmt.security.v2022_01_01_preview.models.OperationResult + """ + + _validation = { + "status": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + + class RemediationEta(_serialization.Model): """The ETA (estimated time of arrival) for remediation. @@ -672,7 +742,7 @@ class RemediationEta(_serialization.Model): "justification": {"key": "justification", "type": "str"}, } - def __init__(self, *, eta: datetime.datetime, justification: str, **kwargs): + def __init__(self, *, eta: datetime.datetime, justification: str, **kwargs: Any) -> None: """ :keyword eta: ETA for remediation. Required. :paramtype eta: ~datetime.datetime diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py index 997e5a68c329..fea6722b179f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py @@ -15,33 +15,44 @@ class GovernanceRuleConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMe assessments, see examples. """ - #: Checks that the string value of the data defined in Property equals the given value - exact fit EQUALS = "Equals" - #: Checks that the string value of the data defined in Property equals any of the given values - #: (exact fit) + """Checks that the string value of the data defined in Property equals the given value - exact fit""" IN = "In" + """Checks that the string value of the data defined in Property equals any of the given values + #: (exact fit)""" class GovernanceRuleOwnerSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The owner type for the governance rule owner source.""" - #: The rule source type defined using resource tag BY_TAG = "ByTag" - #: The rule source type defined manually + """The rule source type defined using resource tag""" MANUALLY = "Manually" + """The rule source type defined manually""" class GovernanceRuleSourceResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The governance rule source, what the rule affects, e.g. Assessments.""" - #: The source of the governance rule is assessments ASSESSMENTS = "Assessments" + """The source of the governance rule is assessments""" class GovernanceRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule type of the governance rule, defines the source of the rule e.g. Integrated.""" - #: The source of the rule type definition is integrated INTEGRATED = "Integrated" - #: The source of the rule type definition is ServiceNow + """The source of the rule type definition is integrated""" SERVICE_NOW = "ServiceNow" + """The source of the rule type definition is ServiceNow""" + + +class OperationResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the long run operation result of governance rule.""" + + SUCCEEDED = "Succeeded" + """The operation succeeded""" + FAILED = "Failed" + """The operation failed""" + CANCELED = "Canceled" + """The operation canceled""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py index 504e37b2c881..860a6a4ae0a3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py @@ -6,27 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._governance_rule_operations import GovernanceRuleOperations from ._governance_rules_operations import GovernanceRulesOperations -from ._security_connector_governance_rule_operations import SecurityConnectorGovernanceRuleOperations -from ._security_connector_governance_rules_operations import SecurityConnectorGovernanceRulesOperations -from ._subscription_governance_rules_execute_status_operations import SubscriptionGovernanceRulesExecuteStatusOperations -from ._security_connector_governance_rules_execute_status_operations import ( - SecurityConnectorGovernanceRulesExecuteStatusOperations, -) from ._governance_assignments_operations import GovernanceAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "GovernanceRuleOperations", "GovernanceRulesOperations", - "SecurityConnectorGovernanceRuleOperations", - "SecurityConnectorGovernanceRulesOperations", - "SubscriptionGovernanceRulesExecuteStatusOperations", - "SecurityConnectorGovernanceRulesExecuteStatusOperations", "GovernanceAssignmentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py index b5e0bcae48b5..b677fec8ea02 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py @@ -45,9 +45,9 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,11 +55,11 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR "template_url", "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments" ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,9 +74,9 @@ def build_get_request(scope: str, assessment_name: str, assignment_key: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,12 +85,12 @@ def build_get_request(scope: str, assessment_name: str, assignment_key: str, **k "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,12 +117,12 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,21 +138,21 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ def build_delete_request(scope: str, assessment_name: str, assignment_key: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,13 +181,14 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_models.GovernanceAssignment"]: - """Get security governanceAssignments on all your resources inside a scope. + """Get governance assignments on all of your resources inside a scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GovernanceAssignment or the result of @@ -199,10 +200,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignmentsList] + ) + cls: ClsType[_models.GovernanceAssignmentsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -224,7 +225,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -240,7 +241,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -248,13 +249,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GovernanceAssignmentsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -267,20 +268,21 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} @distributed_trace def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: Any) -> _models.GovernanceAssignment: """Get a specific governanceAssignment for the requested scope by AssignmentKey. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GovernanceAssignment or the result of cls(response) @@ -298,10 +300,10 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -313,9 +315,9 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -332,7 +334,9 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @overload def create_or_update( @@ -345,18 +349,19 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -379,18 +384,19 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -410,19 +416,20 @@ def create_or_update( governance_assignment: Union[_models.GovernanceAssignment, IO], **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Is either a model - type or a IO type. Required. + :param governance_assignment: Governance assignment over a subscription scope. Is either a + GovernanceAssignment type or a IO type. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -444,11 +451,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -471,9 +478,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -490,11 +497,13 @@ def create_or_update( deserialized = self._deserialize("GovernanceAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -502,14 +511,15 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a GovernanceAssignment over a given scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -527,10 +537,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -542,9 +552,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -557,4 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py deleted file mode 100644 index 79400be6e24d..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py +++ /dev/null @@ -1,171 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a subscription level scope. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py index 3871d0f36948..b42102d6c6ef 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +18,7 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -41,27 +43,49 @@ _SERIALIZER.client_side_validation = False -def build_get_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,28 +96,24 @@ def build_get_request(rule_id: str, subscription_id: str, **kwargs: Any) -> Http return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,24 +126,20 @@ def build_create_or_update_request(rule_id: str, subscription_id: str, **kwargs: return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_delete_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,28 +147,24 @@ def build_delete_request(rule_id: str, subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_rule_id_execute_single_subscription_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_execute_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,45 +177,34 @@ def build_rule_id_execute_single_subscription_request(rule_id: str, subscription return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rule_id_execute_single_security_connector_request( - resource_group_name: str, security_connector_name: str, rule_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_operation_results_request(scope: str, rule_id: str, operation_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute", + "template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) class GovernanceRulesOperations: @@ -226,10 +227,104 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. + def list(self, scope: str, **kwargs: Any) -> Iterable["_models.GovernanceRule"]: + """Get a list of all relevant governance rules over a scope. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GovernanceRule or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.GovernanceRuleList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + scope=scope, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GovernanceRuleList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules"} + + @distributed_trace + def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: + """Get a specific governance rule for the requested scope by ruleId. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -248,23 +343,23 @@ def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) request = build_get_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -281,23 +376,30 @@ def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} @overload def create_or_update( self, + scope: str, rule_id: str, governance_rule: _models.GovernanceRule, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -310,14 +412,20 @@ def create_or_update( @overload def create_or_update( - self, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any + self, scope: str, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -330,15 +438,21 @@ def create_or_update( @distributed_trace def create_or_update( - self, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any + self, scope: str, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. + :param governance_rule: Governance rule over a given scope. Is either a GovernanceRule type or + a IO type. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -359,11 +473,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -374,8 +488,8 @@ def create_or_update( _json = self._serialize.body(governance_rule, "GovernanceRule") request = build_create_or_update_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -385,9 +499,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -404,24 +518,15 @@ def create_or_update( deserialized = self._deserialize("GovernanceRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + return deserialized # type: ignore - @distributed_trace - def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a GovernanceRule over a given scope. + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, scope: str, rule_id: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -433,157 +538,54 @@ def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs ) + cls: ClsType[None] = kwargs.pop("cls", None) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - def _rule_id_execute_single_subscription_initial( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(execute_governance_rule_params, (IO, bytes)): - _content = execute_governance_rule_params - else: - if execute_governance_rule_params is not None: - _json = self._serialize.body(execute_governance_rule_params, "ExecuteGovernanceRuleParams") - else: - _json = None - - request = build_rule_id_execute_single_subscription_request( + request = build_delete_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._rule_id_execute_single_subscription_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_subscription_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + _delete_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - @overload - def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given subscription. + @distributed_trace + def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -596,55 +598,21 @@ def begin_rule_id_execute_single_subscription( :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - - @distributed_trace - def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a - model type or a IO type. Default value is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._rule_id_execute_single_subscription_initial( # type: ignore + raw_result = self._delete_initial( # type: ignore + scope=scope, rule_id=rule_id, - execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -657,7 +625,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -669,14 +639,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_rule_id_execute_single_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + begin_delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - def _rule_id_execute_single_security_connector_initial( # pylint: disable=inconsistent-return-statements + def _execute_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any @@ -692,11 +661,11 @@ def _rule_id_execute_single_security_connector_initial( # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -709,23 +678,21 @@ def _rule_id_execute_single_security_connector_initial( # pylint: disable=incon else: _json = None - request = build_rule_id_execute_single_security_connector_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + request = build_execute_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._rule_id_execute_single_security_connector_initial.metadata["url"], + template_url=self._execute_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -741,31 +708,31 @@ def _rule_id_execute_single_security_connector_initial( # pylint: disable=incon if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_security_connector_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + _execute_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} @overload - def begin_rule_id_execute_single_security_connector( + def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -785,28 +752,28 @@ def begin_rule_id_execute_single_security_connector( """ @overload - def begin_rule_id_execute_single_security_connector( + def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -825,26 +792,26 @@ def begin_rule_id_execute_single_security_connector( """ @distributed_trace - def begin_rule_id_execute_single_security_connector( + def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a - model type or a IO type. Default value is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Is either a + ExecuteGovernanceRuleParams type or a IO type. Default value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -865,18 +832,17 @@ def begin_rule_id_execute_single_security_connector( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._rule_id_execute_single_security_connector_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + raw_result = self._execute_initial( # type: ignore + scope=scope, rule_id=rule_id, execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, @@ -893,7 +859,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -905,6 +873,84 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_rule_id_execute_single_security_connector.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + begin_execute.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} + + @distributed_trace + def operation_results( + self, scope: str, rule_id: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.OperationResultAutoGenerated]: + """Get governance rules long run operation result for the requested scope by ruleId and + operationId. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). + Required. + :type rule_id: str + :param operation_id: The governance rule long running operation unique key. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResultAutoGenerated or None or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.OperationResultAutoGenerated or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[Optional[_models.OperationResultAutoGenerated]] = kwargs.pop("cls", None) + + request = build_operation_results_request( + scope=scope, + rule_id=rule_id, + operation_id=operation_id, + api_version=api_version, + template_url=self.operation_results.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py deleted file mode 100644 index 3c1dbacd1a65..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py +++ /dev/null @@ -1,189 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, security_connector_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SecurityConnectorGovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`security_connector_governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> Iterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a security connector level scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py deleted file mode 100644 index 506e10ad39a4..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,242 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - security_connector_name: str, - rule_id: str, - operation_id: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SecurityConnectorGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`security_connector_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _get_initial( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace - def begin_get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> LROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._get_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py deleted file mode 100644 index 2df8e4d1fa94..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py +++ /dev/null @@ -1,458 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, security_connector_name: str, rule_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, security_connector_name: str, rule_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, security_connector_name: str, rule_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -class SecurityConnectorGovernanceRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`security_connector_governance_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: _models.GovernanceRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: Union[_models.GovernanceRule, IO], - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(governance_rule, (IO, bytes)): - _content = governance_rule - else: - _json = self._serialize.body(governance_rule, "GovernanceRule") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> None: - """Delete a GovernanceRule over a given scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py deleted file mode 100644 index cc18a6fa6af6..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,218 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(rule_id: str, operation_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SubscriptionGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`subscription_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _get_initial(self, rule_id: str, operation_id: str, **kwargs: Any) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace - def begin_get(self, rule_id: str, operation_id: str, **kwargs: Any) -> LROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._get_initial( # type: ignore - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py index 1f9210f091e9..617179e3e3e1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-01") # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", "2022-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json index 89b310cffc2b..2a7e13032785 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py index 939eccf165e7..e2ce16f0c42d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py index f46270fe370c..9e619b0f90e8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-01") # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", "2022-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py index fab10ae9528a..383f3800e69a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -83,5 +83,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py index f7139469b6e8..5113cd8630ae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -86,9 +86,9 @@ async def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +105,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace_async async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -129,8 +129,8 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -141,9 +141,9 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -160,7 +160,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload async def update( @@ -206,7 +206,7 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * :param pricing_name: name of the pricing configuration. Required. :type pricing_name: str - :param pricing: Pricing object. Is either a model type or a IO type. Required. + :param pricing: Pricing object. Is either a Pricing type or a IO type. Required. :type pricing: ~azure.mgmt.security.v2022_03_01.models.Pricing or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -227,9 +227,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -251,9 +251,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +270,4 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py index a6335e2b1d2d..82e99d49aec6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import PricingTier from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py index 93779d1c9a8a..c621e73948f6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -49,7 +49,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +80,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -112,7 +112,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -121,7 +121,9 @@ def __init__(self, **kwargs): class Pricing(Resource): - """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. + """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the + standard tier available with a trial period. The standard tier offers advanced security + capabilities, while the free tier offers basic security features. Variables are only populated by the server, and will be ignored when sending a request. @@ -176,8 +178,8 @@ def __init__( *, pricing_tier: Optional[Union[str, "_models.PricingTier"]] = None, sub_plan: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pricing_tier: The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The @@ -214,7 +216,7 @@ class PricingList(_serialization.Model): "value": {"key": "value", "type": "[Pricing]"}, } - def __init__(self, *, value: List["_models.Pricing"], **kwargs): + def __init__(self, *, value: List["_models.Pricing"], **kwargs: Any) -> None: """ :keyword value: List of pricing configurations. Required. :paramtype value: list[~azure.mgmt.security.v2022_03_01.models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py index 3a3bb1f34505..340d6e87274f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py @@ -16,7 +16,7 @@ class PricingTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): advanced security capabilities, while the free tier offers basic security features. """ - #: Get free Microsoft Defender for Cloud experience with basic security features FREE = "Free" - #: Get the standard Microsoft Defender for Cloud experience with advanced security features + """Get free Microsoft Defender for Cloud experience with basic security features""" STANDARD = "Standard" + """Get the standard Microsoft Defender for Cloud experience with advanced security features""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py index ae0053fbc7f8..b01ccb828084 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py @@ -43,7 +43,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,8 +165,8 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -176,9 +176,9 @@ def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -195,7 +195,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -219,8 +219,8 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -231,9 +231,9 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,7 +250,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload def update( @@ -296,7 +296,7 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg :param pricing_name: name of the pricing configuration. Required. :type pricing_name: str - :param pricing: Pricing object. Is either a model type or a IO type. Required. + :param pricing: Pricing object. Is either a Pricing type or a IO type. Required. :type pricing: ~azure.mgmt.security.v2022_03_01.models.Pricing or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -317,9 +317,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -341,9 +341,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -360,4 +360,4 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py index cc031b97ea90..a89bf26be25f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json index 47a3ee3d7feb..e8407f15d8d0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py index 0a472cc8411e..f7b26f6719e8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py index 74da18d1fbd7..4e3b5f425006 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py index 69a74305392a..b8a06a7b0447 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -83,5 +83,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py index fc65f030d9dd..20e737d0299c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace_async async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -161,8 +161,8 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -173,9 +173,9 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -192,7 +192,7 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload async def update( @@ -253,7 +253,7 @@ async def update( :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", "WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW", "WDATP_UNIFIED_SOLUTION", and "Sentinel". Required. :type setting_name: str or ~azure.mgmt.security.v2022_05_01.models.SettingName - :param setting: Setting object. Is either a model type or a IO type. Required. + :param setting: Setting object. Is either a Setting type or a IO type. Required. :type setting: ~azure.mgmt.security.v2022_05_01.models.Setting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -274,9 +274,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,9 +298,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +317,4 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py index 63e5f8c91733..ce862c57b5f2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py @@ -17,7 +17,7 @@ from ._security_center_enums import SettingKind from ._security_center_enums import SettingName from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py index 32f113ef85a8..71c2cc833bcb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class Resource(_serialization.Model): """Describes an Azure resource. @@ -37,7 +41,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -82,10 +86,10 @@ class Setting(Resource): _subtype_map = {"kind": {"AlertSyncSettings": "AlertSyncSettings", "DataExportSettings": "DataExportSettings"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSyncSettings(Setting): @@ -123,13 +127,13 @@ class AlertSyncSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the alert sync setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "AlertSyncSettings" # type: str + self.kind: str = "AlertSyncSettings" self.enabled = enabled @@ -166,7 +170,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -211,13 +215,13 @@ class DataExportSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the data export setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "DataExportSettings" # type: str + self.kind: str = "DataExportSettings" self.enabled = enabled @@ -242,7 +246,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -269,7 +273,7 @@ class SettingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs: Any) -> None: """ :keyword value: The settings list. :paramtype value: list[~azure.mgmt.security.v2022_05_01.models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py index 9bfd1bb6817b..3677c4288fd9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_get_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,8 +104,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_update_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,8 +163,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -253,8 +253,8 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -265,9 +265,9 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -284,7 +284,7 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload def update( @@ -345,7 +345,7 @@ def update( :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", "WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW", "WDATP_UNIFIED_SOLUTION", and "Sentinel". Required. :type setting_name: str or ~azure.mgmt.security.v2022_05_01.models.SettingName - :param setting: Setting object. Is either a model type or a IO type. Required. + :param setting: Setting object. Is either a Setting type or a IO type. Required. :type setting: ~azure.mgmt.security.v2022_05_01.models.Setting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -366,9 +366,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -390,9 +390,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -409,4 +409,4 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py index 28502606ce6d..d8bc7452ee6d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: Literal["2022-05-01-preview"] + api_version: Literal["2022-05-01-preview"] = kwargs.pop("api_version", "2022-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json index 8f808801f946..601eac915219 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py index c460ae0e2da1..36d27f50047a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py index 2c12da03e992..736771f1e9a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: Literal["2022-05-01-preview"] + api_version: Literal["2022-05-01-preview"] = kwargs.pop("api_version", "2022-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py index 2aecef4febdc..4c6fad83fc75 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,5 +86,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py index 3f7a149b2b74..3b02820439ee 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group( @@ -167,10 +167,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace_async async def get( @@ -264,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -279,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +300,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def create_or_update( @@ -374,8 +378,8 @@ async def create_or_update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_05_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -397,11 +401,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +428,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +447,13 @@ async def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def update( @@ -520,8 +526,8 @@ async def update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_05_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -543,11 +549,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -570,9 +576,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +595,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -618,10 +626,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +641,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +656,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py index 53ad2709ca23..a72e752d54cd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py @@ -83,7 +83,7 @@ from ._security_center_enums import SubPlan from ._security_center_enums import Type from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py index 7328d7eb9110..29af470f1e98 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py @@ -56,10 +56,10 @@ class EnvironmentData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = None # type: Optional[str] + self.environment_type: Optional[str] = None class AWSEnvironmentData(EnvironmentData): @@ -85,14 +85,14 @@ class AWSEnvironmentData(EnvironmentData): "organizational_data": {"key": "organizationalData", "type": "AwsOrganizationalData"}, } - def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs): + def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs: Any) -> None: """ :keyword organizational_data: The AWS account's organizational data. :paramtype organizational_data: ~azure.mgmt.security.v2022_05_01_preview.models.AwsOrganizationalData """ super().__init__(**kwargs) - self.environment_type = "AwsAccount" # type: str + self.environment_type: str = "AwsAccount" self.organizational_data = organizational_data @@ -125,10 +125,10 @@ class AwsOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class AwsOrganizationalDataMaster(AwsOrganizationalData): @@ -159,8 +159,8 @@ class AwsOrganizationalDataMaster(AwsOrganizationalData): } def __init__( - self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs - ): + self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword stackset_name: If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. @@ -170,7 +170,7 @@ def __init__( :paramtype excluded_account_ids: list[str] """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.stackset_name = stackset_name self.excluded_account_ids = excluded_account_ids @@ -198,14 +198,14 @@ class AwsOrganizationalDataMember(AwsOrganizationalData): "parent_hierarchy_id": {"key": "parentHierarchyId", "type": "str"}, } - def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs): + def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. :paramtype parent_hierarchy_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id @@ -228,10 +228,10 @@ class AzureDevOpsScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "AzureDevOpsScope" # type: str + self.environment_type: str = "AzureDevOpsScope" class AzureTrackedResourceLocation(_serialization.Model): @@ -245,7 +245,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -288,7 +288,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -347,10 +347,10 @@ class CloudOffering(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = None # type: Optional[str] + self.offering_type: Optional[str] = None self.description = None @@ -392,15 +392,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorAwsOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_05_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAws" # type: str + self.offering_type: str = "CspmMonitorAws" self.native_cloud_connection = native_cloud_connection @@ -415,7 +415,7 @@ class CspmMonitorAwsOfferingNativeCloudConnection(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -451,10 +451,10 @@ class CspmMonitorAzureDevOpsOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAzureDevOps" # type: str + self.offering_type: str = "CspmMonitorAzureDevOps" class CspmMonitorGcpOffering(CloudOffering): @@ -495,15 +495,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorGcpOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_05_01_preview.models.CspmMonitorGcpOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGcp" # type: str + self.offering_type: str = "CspmMonitorGcp" self.native_cloud_connection = native_cloud_connection @@ -527,8 +527,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The GCP workload identity provider id for the offering. :paramtype workload_identity_provider_id: str @@ -568,10 +568,10 @@ class CspmMonitorGithubOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGithub" # type: str + self.offering_type: str = "CspmMonitorGithub" class DefenderFoDatabasesAwsOffering(CloudOffering): @@ -612,15 +612,15 @@ def __init__( self, *, arc_auto_provisioning: Optional["_models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: ~azure.mgmt.security.v2022_05_01_preview.models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesAws" # type: str + self.offering_type: str = "DefenderForDatabasesAws" self.arc_auto_provisioning = arc_auto_provisioning @@ -654,8 +654,8 @@ def __init__( service_principal_secret_metadata: Optional[ "_models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -695,8 +695,8 @@ def __init__( expiry_date: Optional[datetime.datetime] = None, parameter_store_region: Optional[str] = None, parameter_name_in_store: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expiry_date: expiration date of service principal secret. :paramtype expiry_date: ~datetime.datetime @@ -807,8 +807,8 @@ def __init__( auto_provisioning: Optional[bool] = None, kube_audit_retention_time: Optional[int] = None, scuba_external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kubernetes_service: The kubernetes service connection configuration. :paramtype kubernetes_service: @@ -843,7 +843,7 @@ def __init__( :paramtype scuba_external_id: str """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersAws" # type: str + self.offering_type: str = "DefenderForContainersAws" self.kubernetes_service = kubernetes_service self.kubernetes_scuba_reader = kubernetes_scuba_reader self.cloud_watch_to_kinesis = cloud_watch_to_kinesis @@ -868,7 +868,7 @@ class DefenderForContainersAwsOfferingCloudWatchToKinesis(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. @@ -889,7 +889,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(_serializ "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -909,7 +909,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(_seri "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -929,7 +929,7 @@ class DefenderForContainersAwsOfferingKinesisToS3(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by Kinesis to transfer data into S3. :paramtype cloud_role_arn: str @@ -949,7 +949,7 @@ class DefenderForContainersAwsOfferingKubernetesScubaReader(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for reading data. :paramtype cloud_role_arn: str @@ -970,7 +970,7 @@ class DefenderForContainersAwsOfferingKubernetesService(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for provisioning resources. @@ -1042,8 +1042,8 @@ def __init__( audit_logs_auto_provisioning_flag: Optional[bool] = None, defender_agent_auto_provisioning_flag: Optional[bool] = None, policy_agent_auto_provisioning_flag: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: @@ -1061,7 +1061,7 @@ def __init__( :paramtype policy_agent_auto_provisioning_flag: bool """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersGcp" # type: str + self.offering_type: str = "DefenderForContainersGcp" self.native_cloud_connection = native_cloud_connection self.data_pipeline_native_cloud_connection = data_pipeline_native_cloud_connection self.audit_logs_auto_provisioning_flag = audit_logs_auto_provisioning_flag @@ -1090,8 +1090,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The data collection service account email address in GCP for this offering. @@ -1125,8 +1125,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1188,8 +1188,8 @@ def __init__( defender_for_databases_arc_auto_provisioning: Optional[ "_models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: @@ -1200,7 +1200,7 @@ def __init__( ~azure.mgmt.security.v2022_05_01_preview.models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesGcp" # type: str + self.offering_type: str = "DefenderForDatabasesGcp" self.arc_auto_provisioning = arc_auto_provisioning self.defender_for_databases_arc_auto_provisioning = defender_for_databases_arc_auto_provisioning @@ -1228,8 +1228,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1262,8 +1262,8 @@ def __init__( *, client_id: Optional[str] = None, agent_onboarding_service_account_numeric_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: The Azure service principal client id for agent onboarding. :paramtype client_id: str @@ -1296,8 +1296,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1384,8 +1384,8 @@ def __init__( mde_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersAwsOfferingSubPlan"] = None, vm_scanners: Optional["_models.DefenderForServersAwsOfferingVmScanners"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1408,7 +1408,7 @@ def __init__( ~azure.mgmt.security.v2022_05_01_preview.models.DefenderForServersAwsOfferingVmScanners """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersAws" # type: str + self.offering_type: str = "DefenderForServersAws" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1447,8 +1447,8 @@ def __init__( service_principal_secret_metadata: Optional[ "_models.DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1488,8 +1488,8 @@ def __init__( expiry_date: Optional[str] = None, parameter_store_region: Optional[str] = None, parameter_name_in_store: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expiry_date: expiration date of service principal secret. :paramtype expiry_date: str @@ -1515,7 +1515,7 @@ class DefenderForServersAwsOfferingDefenderForServers(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1538,7 +1538,7 @@ class DefenderForServersAwsOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1561,7 +1561,7 @@ class DefenderForServersAwsOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_05_01_preview.models.SubPlan @@ -1593,8 +1593,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -1619,7 +1619,7 @@ class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -1649,8 +1649,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVmScannersConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. :paramtype enabled: bool @@ -1686,8 +1686,8 @@ def __init__( cloud_role_arn: Optional[str] = None, scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, exclusion_tags: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1770,8 +1770,8 @@ def __init__( va_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioning"] = None, mde_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersGcpOfferingSubPlan"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1791,7 +1791,7 @@ def __init__( ~azure.mgmt.security.v2022_05_01_preview.models.DefenderForServersGcpOfferingSubPlan """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersGcp" # type: str + self.offering_type: str = "DefenderForServersGcp" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1822,8 +1822,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersGcpOfferingArcAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1856,8 +1856,8 @@ def __init__( *, client_id: Optional[str] = None, agent_onboarding_service_account_numeric_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: The Azure service principal client id for agent onboarding. :paramtype client_id: str @@ -1889,8 +1889,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The workload identity provider id in GCP for this feature. @@ -1918,7 +1918,7 @@ class DefenderForServersGcpOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1941,7 +1941,7 @@ class DefenderForServersGcpOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_05_01_preview.models.SubPlan @@ -1973,8 +1973,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -1999,7 +1999,7 @@ class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -2030,7 +2030,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -2049,7 +2049,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -2088,10 +2088,10 @@ class GcpOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class GcpOrganizationalDataMember(GcpOrganizationalData): @@ -2122,8 +2122,12 @@ class GcpOrganizationalDataMember(GcpOrganizationalData): } def __init__( - self, *, parent_hierarchy_id: Optional[str] = None, management_project_number: Optional[str] = None, **kwargs - ): + self, + *, + parent_hierarchy_id: Optional[str] = None, + management_project_number: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. @@ -2133,7 +2137,7 @@ def __init__( :paramtype management_project_number: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id self.management_project_number = management_project_number @@ -2175,8 +2179,8 @@ def __init__( excluded_project_numbers: Optional[List[str]] = None, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword excluded_project_numbers: If the multi cloud account is of membership type organization, list of accounts excluded from offering. @@ -2189,7 +2193,7 @@ def __init__( :paramtype workload_identity_provider_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.excluded_project_numbers = excluded_project_numbers self.service_account_email_address = service_account_email_address self.workload_identity_provider_id = workload_identity_provider_id @@ -2218,7 +2222,9 @@ class GcpProjectDetails(_serialization.Model): "workload_identity_pool_id": {"key": "workloadIdentityPoolId", "type": "str"}, } - def __init__(self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs): + def __init__( + self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword project_number: The unique GCP Project number. :paramtype project_number: str @@ -2262,8 +2268,8 @@ def __init__( *, organizational_data: Optional["_models.GcpOrganizationalData"] = None, project_details: Optional["_models.GcpProjectDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organizational_data: The Gcp project's organizational data. :paramtype organizational_data: @@ -2272,7 +2278,7 @@ def __init__( :paramtype project_details: ~azure.mgmt.security.v2022_05_01_preview.models.GcpProjectDetails """ super().__init__(**kwargs) - self.environment_type = "GcpProject" # type: str + self.environment_type: str = "GcpProject" self.organizational_data = organizational_data self.project_details = project_details @@ -2296,10 +2302,10 @@ class GithubScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "GithubScope" # type: str + self.environment_type: str = "GithubScope" class InformationProtectionAwsOffering(CloudOffering): @@ -2340,15 +2346,15 @@ def __init__( self, *, information_protection: Optional["_models.InformationProtectionAwsOfferingInformationProtection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword information_protection: The native cloud connection configuration. :paramtype information_protection: ~azure.mgmt.security.v2022_05_01_preview.models.InformationProtectionAwsOfferingInformationProtection """ super().__init__(**kwargs) - self.offering_type = "InformationProtectionAws" # type: str + self.offering_type: str = "InformationProtectionAws" self.information_protection = information_protection @@ -2363,7 +2369,7 @@ class InformationProtectionAwsOfferingInformationProtection(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -2383,7 +2389,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -2417,7 +2423,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2436,7 +2442,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2490,8 +2496,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2589,8 +2595,8 @@ def __init__( environment_name: Optional[Union[str, "_models.CloudName"]] = None, offerings: Optional[List["_models.CloudOffering"]] = None, environment_data: Optional["_models.EnvironmentData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2644,7 +2650,7 @@ class SecurityConnectorsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs): + def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs: Any) -> None: """ :keyword value: The list of security connectors under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2022_05_01_preview.models.SecurityConnector] @@ -2692,8 +2698,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py index dfc75e6d5f8c..5120e43984c2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,10 +186,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace def get(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> _models.SecurityConnector: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def create_or_update( @@ -581,8 +585,8 @@ def create_or_update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_05_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -604,11 +608,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -650,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def update( @@ -727,8 +733,8 @@ def update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_05_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -750,11 +756,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +783,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +802,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,10 +833,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -840,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -855,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py index 19075a8c40b3..98fe9a4d9888 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] + api_version: Literal["2022-07-01-preview"] = kwargs.pop("api_version", "2022-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json index 934d3a1b93c2..5af72eda52ec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py index 4b2867e2c902..b1f0ad705fb8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -62,7 +62,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -97,15 +97,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py index 5caa1ff7da9b..bd02ffa6504e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] + api_version: Literal["2022-07-01-preview"] = kwargs.pop("api_version", "2022-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py index eb0b06d00415..ce8e94581e91 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -63,7 +63,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -105,5 +105,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py index 61c6546366e5..c85f8d56b434 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py @@ -12,7 +12,7 @@ from ._security_connector_application_operations import SecurityConnectorApplicationOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py index 85dc02912d07..b1090781bf40 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py @@ -82,10 +82,10 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( application_id=application_id, @@ -96,9 +96,9 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -115,7 +115,7 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} @overload async def create_or_update( @@ -171,8 +171,8 @@ async def create_or_update( :param application_id: The security Application key - unique key for the standard application. Required. :type application_id: str - :param application: Application over a subscription scope. Is either a model type or a IO type. - Required. + :param application: Application over a subscription scope. Is either a Application type or a IO + type. Required. :type application: ~azure.mgmt.security.v2022_07_01_preview.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -193,11 +193,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -219,9 +219,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -238,11 +238,13 @@ async def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -269,10 +271,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( application_id=application_id, @@ -283,9 +285,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,4 +300,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py index 007fca2dda37..10450d905899 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py @@ -70,10 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +94,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +110,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py index 9d8b5af8b8ef..9df0d810c1b1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py @@ -89,10 +89,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -105,9 +105,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,7 +124,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @overload async def create_or_update( @@ -209,8 +211,8 @@ async def create_or_update( :param application_id: The security Application key - unique key for the standard application. Required. :type application_id: str - :param application: Application over a subscription scope. Is either a model type or a IO type. - Required. + :param application: Application over a subscription scope. Is either a Application type or a IO + type. Required. :type application: ~azure.mgmt.security.v2022_07_01_preview.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -231,11 +233,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -259,9 +261,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,11 +280,13 @@ async def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -314,10 +318,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -330,9 +334,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -345,4 +349,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py index 92eaa30a2497..e76ca3618db5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py @@ -77,10 +77,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,4 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py index 686374128fc6..0958c7d80773 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py @@ -16,7 +16,7 @@ from ._security_center_enums import ApplicationConditionOperator from ._security_center_enums import ApplicationSourceResourceType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py index 335ade6e169d..6f7d99436f2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py @@ -48,7 +48,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -102,8 +102,8 @@ def __init__( description: Optional[str] = None, source_resource_type: Optional[Union[str, "_models.ApplicationSourceResourceType"]] = None, condition_sets: Optional[List[JSON]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: display name of the application. :paramtype display_name: str @@ -145,11 +145,11 @@ class ApplicationCondition(_serialization.Model): def __init__( self, *, - property: Optional[str] = None, + property: Optional[str] = None, # pylint: disable=redefined-builtin value: Optional[str] = None, operator: Optional[Union[str, "_models.ApplicationConditionOperator"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property: The application Condition's Property, e.g. ID, see examples. :paramtype property: str @@ -188,7 +188,7 @@ class ApplicationsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -229,7 +229,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -260,7 +260,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py index 5b64e0a4d2a4..9c0d24557f3b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py @@ -15,17 +15,17 @@ class ApplicationConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta) IDs, see examples. """ - #: Checks that the string value of the data defined in Property contains the given value CONTAINS = "Contains" - #: Checks that the string value of the data defined in Property equals the given value + """Checks that the string value of the data defined in Property contains the given value""" EQUALS = "Equals" - #: Checks that the string value of the data defined in Property equals any of the given values - #: (exact fit) + """Checks that the string value of the data defined in Property equals the given value""" IN = "In" + """Checks that the string value of the data defined in Property equals any of the given values + #: (exact fit)""" class ApplicationSourceResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The application source, what it affects, e.g. Assessments.""" - #: The source of the application is assessments ASSESSMENTS = "Assessments" + """The source of the application is assessments""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py index 61c6546366e5..c85f8d56b434 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py @@ -12,7 +12,7 @@ from ._security_connector_application_operations import SecurityConnectorApplicationOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py index e84db16005c4..a0d76cf3b09b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py @@ -43,9 +43,9 @@ def build_get_request(application_id: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_get_request(application_id: str, subscription_id: str, **kwargs: Any) "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,10 +74,10 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,9 +107,9 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** def build_delete_request(application_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" @@ -121,7 +121,7 @@ def build_delete_request(application_id: str, subscription_id: str, **kwargs: An "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,10 +171,10 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( application_id=application_id, @@ -185,9 +185,9 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +204,7 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} @overload def create_or_update( @@ -260,8 +260,8 @@ def create_or_update( :param application_id: The security Application key - unique key for the standard application. Required. :type application_id: str - :param application: Application over a subscription scope. Is either a model type or a IO type. - Required. + :param application: Application over a subscription scope. Is either a Application type or a IO + type. Required. :type application: ~azure.mgmt.security.v2022_07_01_preview.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -282,11 +282,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -308,9 +308,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -327,11 +327,13 @@ def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -356,10 +358,10 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( application_id=application_id, @@ -370,9 +372,9 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -385,4 +387,6 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py index f8006290b71d..e8b5eb53e499 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,10 +101,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,7 +125,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -141,7 +141,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -149,13 +149,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -168,4 +168,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py index 291bb2803f03..677463723d84 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py @@ -45,9 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_get_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,10 +83,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +105,7 @@ def build_create_or_update_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,9 +123,9 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) # Construct URL _url = kwargs.pop( "template_url", @@ -142,7 +142,7 @@ def build_delete_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,10 +199,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -215,9 +215,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -234,7 +234,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @overload def create_or_update( @@ -319,8 +321,8 @@ def create_or_update( :param application_id: The security Application key - unique key for the standard application. Required. :type application_id: str - :param application: Application over a subscription scope. Is either a model type or a IO type. - Required. + :param application: Application over a subscription scope. Is either a Application type or a IO + type. Required. :type application: ~azure.mgmt.security.v2022_07_01_preview.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -341,11 +343,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -369,9 +371,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -388,11 +390,13 @@ def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -424,10 +428,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -440,9 +444,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -455,4 +459,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py index 858b1ef83b94..354fb4dc565d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py @@ -47,9 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,7 @@ def build_list_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,10 +117,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -143,7 +143,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -159,7 +159,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -167,13 +167,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -186,4 +186,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py index f5c6e9e2a86e..d05f1ca002f7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-08-01-preview") # type: Literal["2022-08-01-preview"] + api_version: Literal["2022-08-01-preview"] = kwargs.pop("api_version", "2022-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json index e9aceb5f52df..0d09b3295d0b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py index db8abdba93dc..31a1ba06cbd6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py index cac9f5d10f8b..3073d7c910a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "4.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py index c5692cc3dbe4..9c11d7c3fdd6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-08-01-preview") # type: Literal["2022-08-01-preview"] + api_version: Literal["2022-08-01-preview"] = kwargs.pop("api_version", "2022-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py index ce5d099e1e9a..4ff44da2b710 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,5 +86,5 @@ async def __aenter__(self) -> "SecurityCenter": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py index 342f7cc07e99..d69d3b36853d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group( @@ -167,10 +167,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace_async async def get( @@ -264,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -279,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +300,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def create_or_update( @@ -374,8 +378,8 @@ async def create_or_update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -397,11 +401,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +428,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +447,13 @@ async def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def update( @@ -520,8 +526,8 @@ async def update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -543,11 +549,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -570,9 +576,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +595,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -618,10 +626,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +641,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +656,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py index 3ae38c38dc10..15b0d0a8e79b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py @@ -86,7 +86,7 @@ from ._security_center_enums import SubPlan from ._security_center_enums import Type from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py index 29f7a7f69034..bf5f0d7320d1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py @@ -56,10 +56,10 @@ class EnvironmentData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = None # type: Optional[str] + self.environment_type: Optional[str] = None class AwsEnvironmentData(EnvironmentData): @@ -85,14 +85,14 @@ class AwsEnvironmentData(EnvironmentData): "organizational_data": {"key": "organizationalData", "type": "AwsOrganizationalData"}, } - def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs): + def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs: Any) -> None: """ :keyword organizational_data: The AWS account's organizational data. :paramtype organizational_data: ~azure.mgmt.security.v2022_08_01_preview.models.AwsOrganizationalData """ super().__init__(**kwargs) - self.environment_type = "AwsAccount" # type: str + self.environment_type: str = "AwsAccount" self.organizational_data = organizational_data @@ -125,10 +125,10 @@ class AwsOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class AwsOrganizationalDataMaster(AwsOrganizationalData): @@ -159,8 +159,8 @@ class AwsOrganizationalDataMaster(AwsOrganizationalData): } def __init__( - self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs - ): + self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword stackset_name: If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. @@ -170,7 +170,7 @@ def __init__( :paramtype excluded_account_ids: list[str] """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.stackset_name = stackset_name self.excluded_account_ids = excluded_account_ids @@ -198,14 +198,14 @@ class AwsOrganizationalDataMember(AwsOrganizationalData): "parent_hierarchy_id": {"key": "parentHierarchyId", "type": "str"}, } - def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs): + def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. :paramtype parent_hierarchy_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id @@ -228,10 +228,10 @@ class AzureDevOpsScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "AzureDevOpsScope" # type: str + self.environment_type: str = "AzureDevOpsScope" class AzureTrackedResourceLocation(_serialization.Model): @@ -245,7 +245,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -288,7 +288,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -354,10 +354,10 @@ class CloudOffering(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = None # type: Optional[str] + self.offering_type: Optional[str] = None self.description = None @@ -400,15 +400,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorAwsOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAws" # type: str + self.offering_type: str = "CspmMonitorAws" self.native_cloud_connection = native_cloud_connection @@ -423,7 +423,7 @@ class CspmMonitorAwsOfferingNativeCloudConnection(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -460,10 +460,10 @@ class CspmMonitorAzureDevOpsOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAzureDevOps" # type: str + self.offering_type: str = "CspmMonitorAzureDevOps" class CspmMonitorGcpOffering(CloudOffering): @@ -505,15 +505,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorGcpOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorGcpOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGcp" # type: str + self.offering_type: str = "CspmMonitorGcp" self.native_cloud_connection = native_cloud_connection @@ -537,8 +537,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The GCP workload identity provider id for the offering. :paramtype workload_identity_provider_id: str @@ -579,10 +579,10 @@ class CspmMonitorGithubOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGithub" # type: str + self.offering_type: str = "CspmMonitorGithub" class DefenderCspmAwsOffering(CloudOffering): @@ -617,14 +617,16 @@ class DefenderCspmAwsOffering(CloudOffering): "vm_scanners": {"key": "vmScanners", "type": "DefenderCspmAwsOfferingVmScanners"}, } - def __init__(self, *, vm_scanners: Optional["_models.DefenderCspmAwsOfferingVmScanners"] = None, **kwargs): + def __init__( + self, *, vm_scanners: Optional["_models.DefenderCspmAwsOfferingVmScanners"] = None, **kwargs: Any + ) -> None: """ :keyword vm_scanners: The Microsoft Defender for Server VM scanning configuration. :paramtype vm_scanners: ~azure.mgmt.security.v2022_08_01_preview.models.DefenderCspmAwsOfferingVmScanners """ super().__init__(**kwargs) - self.offering_type = "DefenderCspmAws" # type: str + self.offering_type: str = "DefenderCspmAws" self.vm_scanners = vm_scanners @@ -648,8 +650,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderCspmAwsOfferingVmScannersConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. :paramtype enabled: bool @@ -685,8 +687,8 @@ def __init__( cloud_role_arn: Optional[str] = None, scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, exclusion_tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -729,10 +731,10 @@ class DefenderCspmGcpOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "DefenderCspmGcp" # type: str + self.offering_type: str = "DefenderCspmGcp" class DefenderFoDatabasesAwsOffering(CloudOffering): @@ -778,8 +780,8 @@ def __init__( *, arc_auto_provisioning: Optional["_models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning"] = None, rds: Optional["_models.DefenderFoDatabasesAwsOfferingRds"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: @@ -789,7 +791,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderFoDatabasesAwsOfferingRds """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesAws" # type: str + self.offering_type: str = "DefenderForDatabasesAws" self.arc_auto_provisioning = arc_auto_provisioning self.rds = rds @@ -808,7 +810,7 @@ class DefenderFoDatabasesAwsOfferingArcAutoProvisioning(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -834,7 +836,7 @@ class DefenderFoDatabasesAwsOfferingRds(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword enabled: Is RDS protection enabled. :paramtype enabled: bool @@ -943,8 +945,8 @@ def __init__( auto_provisioning: Optional[bool] = None, kube_audit_retention_time: Optional[int] = None, scuba_external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kubernetes_service: The kubernetes service connection configuration. :paramtype kubernetes_service: @@ -979,7 +981,7 @@ def __init__( :paramtype scuba_external_id: str """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersAws" # type: str + self.offering_type: str = "DefenderForContainersAws" self.kubernetes_service = kubernetes_service self.kubernetes_scuba_reader = kubernetes_scuba_reader self.cloud_watch_to_kinesis = cloud_watch_to_kinesis @@ -1004,7 +1006,7 @@ class DefenderForContainersAwsOfferingCloudWatchToKinesis(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. @@ -1025,7 +1027,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(_serializ "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1045,7 +1047,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(_seri "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1065,7 +1067,7 @@ class DefenderForContainersAwsOfferingKinesisToS3(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by Kinesis to transfer data into S3. :paramtype cloud_role_arn: str @@ -1085,7 +1087,7 @@ class DefenderForContainersAwsOfferingKubernetesScubaReader(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for reading data. :paramtype cloud_role_arn: str @@ -1106,7 +1108,7 @@ class DefenderForContainersAwsOfferingKubernetesService(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for provisioning resources. @@ -1179,8 +1181,8 @@ def __init__( audit_logs_auto_provisioning_flag: Optional[bool] = None, defender_agent_auto_provisioning_flag: Optional[bool] = None, policy_agent_auto_provisioning_flag: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: @@ -1198,7 +1200,7 @@ def __init__( :paramtype policy_agent_auto_provisioning_flag: bool """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersGcp" # type: str + self.offering_type: str = "DefenderForContainersGcp" self.native_cloud_connection = native_cloud_connection self.data_pipeline_native_cloud_connection = data_pipeline_native_cloud_connection self.audit_logs_auto_provisioning_flag = audit_logs_auto_provisioning_flag @@ -1227,8 +1229,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The data collection service account email address in GCP for this offering. @@ -1262,8 +1264,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1326,8 +1328,8 @@ def __init__( defender_for_databases_arc_auto_provisioning: Optional[ "_models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: @@ -1338,7 +1340,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesGcp" # type: str + self.offering_type: str = "DefenderForDatabasesGcp" self.arc_auto_provisioning = arc_auto_provisioning self.defender_for_databases_arc_auto_provisioning = defender_for_databases_arc_auto_provisioning @@ -1354,7 +1356,7 @@ class DefenderForDatabasesGcpOfferingArcAutoProvisioning(_serialization.Model): "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1383,8 +1385,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1426,10 +1428,10 @@ class DefenderForDevOpsAzureDevOpsOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "DefenderForDevOpsAzureDevOps" # type: str + self.offering_type: str = "DefenderForDevOpsAzureDevOps" class DefenderForDevOpsGithubOffering(CloudOffering): @@ -1460,10 +1462,10 @@ class DefenderForDevOpsGithubOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "DefenderForDevOpsGithub" # type: str + self.offering_type: str = "DefenderForDevOpsGithub" class DefenderForServersAwsOffering(CloudOffering): @@ -1540,8 +1542,8 @@ def __init__( mde_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersAwsOfferingSubPlan"] = None, vm_scanners: Optional["_models.DefenderForServersAwsOfferingVmScanners"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1564,7 +1566,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVmScanners """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersAws" # type: str + self.offering_type: str = "DefenderForServersAws" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1587,7 +1589,7 @@ class DefenderForServersAwsOfferingArcAutoProvisioning(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1610,7 +1612,7 @@ class DefenderForServersAwsOfferingDefenderForServers(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1633,7 +1635,7 @@ class DefenderForServersAwsOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1656,7 +1658,7 @@ class DefenderForServersAwsOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan @@ -1688,8 +1690,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -1714,7 +1716,7 @@ class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -1744,8 +1746,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVmScannersConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. :paramtype enabled: bool @@ -1781,8 +1783,8 @@ def __init__( cloud_role_arn: Optional[str] = None, scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, exclusion_tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1866,8 +1868,8 @@ def __init__( va_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioning"] = None, mde_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersGcpOfferingSubPlan"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1887,7 +1889,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingSubPlan """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersGcp" # type: str + self.offering_type: str = "DefenderForServersGcp" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1906,7 +1908,7 @@ class DefenderForServersGcpOfferingArcAutoProvisioning(_serialization.Model): "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1934,8 +1936,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The workload identity provider id in GCP for this feature. @@ -1963,7 +1965,7 @@ class DefenderForServersGcpOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1986,7 +1988,7 @@ class DefenderForServersGcpOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan @@ -2018,8 +2020,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -2044,7 +2046,7 @@ class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -2075,7 +2077,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -2094,7 +2096,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -2133,10 +2135,10 @@ class GcpOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class GcpOrganizationalDataMember(GcpOrganizationalData): @@ -2167,8 +2169,12 @@ class GcpOrganizationalDataMember(GcpOrganizationalData): } def __init__( - self, *, parent_hierarchy_id: Optional[str] = None, management_project_number: Optional[str] = None, **kwargs - ): + self, + *, + parent_hierarchy_id: Optional[str] = None, + management_project_number: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. @@ -2178,7 +2184,7 @@ def __init__( :paramtype management_project_number: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id self.management_project_number = management_project_number @@ -2220,8 +2226,8 @@ def __init__( excluded_project_numbers: Optional[List[str]] = None, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword excluded_project_numbers: If the multi cloud account is of membership type organization, list of accounts excluded from offering. @@ -2234,7 +2240,7 @@ def __init__( :paramtype workload_identity_provider_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.excluded_project_numbers = excluded_project_numbers self.service_account_email_address = service_account_email_address self.workload_identity_provider_id = workload_identity_provider_id @@ -2263,7 +2269,9 @@ class GcpProjectDetails(_serialization.Model): "workload_identity_pool_id": {"key": "workloadIdentityPoolId", "type": "str"}, } - def __init__(self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs): + def __init__( + self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword project_number: The unique GCP Project number. :paramtype project_number: str @@ -2307,8 +2315,8 @@ def __init__( *, organizational_data: Optional["_models.GcpOrganizationalData"] = None, project_details: Optional["_models.GcpProjectDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organizational_data: The Gcp project's organizational data. :paramtype organizational_data: @@ -2317,7 +2325,7 @@ def __init__( :paramtype project_details: ~azure.mgmt.security.v2022_08_01_preview.models.GcpProjectDetails """ super().__init__(**kwargs) - self.environment_type = "GcpProject" # type: str + self.environment_type: str = "GcpProject" self.organizational_data = organizational_data self.project_details = project_details @@ -2341,10 +2349,10 @@ class GithubScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "GithubScope" # type: str + self.environment_type: str = "GithubScope" class InformationProtectionAwsOffering(CloudOffering): @@ -2386,15 +2394,15 @@ def __init__( self, *, information_protection: Optional["_models.InformationProtectionAwsOfferingInformationProtection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword information_protection: The native cloud connection configuration. :paramtype information_protection: ~azure.mgmt.security.v2022_08_01_preview.models.InformationProtectionAwsOfferingInformationProtection """ super().__init__(**kwargs) - self.offering_type = "InformationProtectionAws" # type: str + self.offering_type: str = "InformationProtectionAws" self.information_protection = information_protection @@ -2409,7 +2417,7 @@ class InformationProtectionAwsOfferingInformationProtection(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -2429,7 +2437,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -2463,7 +2471,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2482,7 +2490,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2536,8 +2544,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2635,8 +2643,8 @@ def __init__( environment_name: Optional[Union[str, "_models.CloudName"]] = None, offerings: Optional[List["_models.CloudOffering"]] = None, environment_data: Optional["_models.EnvironmentData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2690,7 +2698,7 @@ class SecurityConnectorsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs): + def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs: Any) -> None: """ :keyword value: The list of security connectors under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] @@ -2738,8 +2746,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py index 908cc9cbd6fd..2576410ce08b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,10 +186,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace def get(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> _models.SecurityConnector: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def create_or_update( @@ -581,8 +585,8 @@ def create_or_update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -604,11 +608,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -650,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def update( @@ -727,8 +733,8 @@ def update( :type resource_group_name: str :param security_connector_name: The security connector name. Required. :type security_connector_name: str - :param security_connector: The security connector resource. Is either a model type or a IO - type. Required. + :param security_connector: The security connector resource. Is either a SecurityConnector type + or a IO type. Required. :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -750,11 +756,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +783,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +802,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,10 +833,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -840,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -855,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_setting_example.py new file mode 100644 index 000000000000..74ab8f8896ab --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_setting_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.settings.get( + setting_name="MCAS", + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_settings_example.py new file mode 100644 index 000000000000..d8c175b7622f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_settings_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.settings.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_setting_example.py new file mode 100644 index 000000000000..f67a29e0cd77 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_setting_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.settings.update( + setting_name="MCAS", + setting={"kind": "DataExportSettings", "properties": {"enabled": True}}, + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/UpdateSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md b/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md index e788c26f2fa7..7482dd6c2a9d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md +++ b/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 8.2.0 (2023-02-15) + +### Features Added + + - Model SBNamespace has a new parameter premium_messaging_partitions + ## 8.1.0 (2022-08-10) ### Features Added diff --git a/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in b/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in index 1b993ffc0e88..28983897258e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in +++ b/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in @@ -1,5 +1,6 @@ include _meta.json recursive-include tests *.py *.json +recursive-include samples *.py *.md include *.md include azure/__init__.py include azure/mgmt/__init__.py diff --git a/sdk/servicebus/azure-mgmt-servicebus/README.md b/sdk/servicebus/azure-mgmt-servicebus/README.md index 9122e85018f0..5aaf9fcac8fa 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/README.md +++ b/sdk/servicebus/azure-mgmt-servicebus/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/servicebus) -Code samples for this package can be found at [Service Bus Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/servicebus) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-servicebus +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = ServiceBusManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Service Bus Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/servicebus/azure-mgmt-servicebus/_meta.json b/sdk/servicebus/azure-mgmt-servicebus/_meta.json index 0ce811f5e239..de3b4ae76715 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/_meta.json +++ b/sdk/servicebus/azure-mgmt-servicebus/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.7.2", + "commit": "19f98c9f526f8db961f172276dd6d6882a86ed86", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@5.16.0", - "@autorest/modelerfour@4.19.3" + "@autorest/python@6.4.0", + "@autorest/modelerfour@4.24.3" ], - "commit": "124789ad0942fcafded1c1dbd6d2a703b23d10c7", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/servicebus/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/servicebus/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/servicebus/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py index f640dac181bb..d3e8cda5f049 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py @@ -14,3 +14,7 @@ patch_sdk() except ImportError: pass + +from ._version import VERSION + +__version__ = VERSION diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py index a5b79adab717..e1cc3df80b32 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -18,8 +18,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class ServiceBusManagementClientConfiguration(Configuration): @@ -28,19 +26,18 @@ class ServiceBusManagementClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -55,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_serialization.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_serialization.py new file mode 100644 index 000000000000..25467dfc00bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_serialization.py @@ -0,0 +1,1998 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to azure from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py index e19cd082a6e3..04370dce633f 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py @@ -9,20 +9,17 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import ServiceBusManagementClientConfiguration +from ._serialization import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -43,9 +40,9 @@ class ServiceBusManagementClient(MultiApiClientMixin, _SDKClient): The api-version parameter sets the default API version if the operation group is not described in the profile. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -70,12 +67,12 @@ class ServiceBusManagementClient(MultiApiClientMixin, _SDKClient): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - api_version=None, # type: Optional[str] - base_url="https://management.azure.com", # type: str - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + credential: "TokenCredential", + subscription_id: str, + api_version: Optional[str]=None, + base_url: str = "https://management.azure.com", + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -99,6 +96,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-11-01: :mod:`v2021_11_01.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` + * 2022-10-01-preview: :mod:`v2022_10_01_preview.models` """ if api_version == '2015-08-01': from .v2015_08_01 import models @@ -121,6 +119,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-01-01-preview': from .v2022_01_01_preview import models return models + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -133,6 +134,7 @@ def disaster_recovery_configs(self): * 2021-06-01-preview: :class:`DisasterRecoveryConfigsOperations` * 2021-11-01: :class:`DisasterRecoveryConfigsOperations` * 2022-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2022-10-01-preview: :class:`DisasterRecoveryConfigsOperations` """ api_version = self._get_api_version('disaster_recovery_configs') if api_version == '2017-04-01': @@ -147,8 +149,11 @@ def disaster_recovery_configs(self): from .v2021_11_01.operations import DisasterRecoveryConfigsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -165,6 +170,7 @@ def event_hubs(self): from .v2018_01_01_preview.operations import EventHubsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -177,6 +183,7 @@ def migration_configs(self): * 2021-06-01-preview: :class:`MigrationConfigsOperations` * 2021-11-01: :class:`MigrationConfigsOperations` * 2022-01-01-preview: :class:`MigrationConfigsOperations` + * 2022-10-01-preview: :class:`MigrationConfigsOperations` """ api_version = self._get_api_version('migration_configs') if api_version == '2017-04-01': @@ -191,8 +198,11 @@ def migration_configs(self): from .v2021_11_01.operations import MigrationConfigsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import MigrationConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'migration_configs'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -206,6 +216,7 @@ def namespaces(self): * 2021-06-01-preview: :class:`NamespacesOperations` * 2021-11-01: :class:`NamespacesOperations` * 2022-01-01-preview: :class:`NamespacesOperations` + * 2022-10-01-preview: :class:`NamespacesOperations` """ api_version = self._get_api_version('namespaces') if api_version == '2015-08-01': @@ -222,8 +233,11 @@ def namespaces(self): from .v2021_11_01.operations import NamespacesOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import NamespacesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import NamespacesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -237,6 +251,7 @@ def operations(self): * 2021-06-01-preview: :class:`Operations` * 2021-11-01: :class:`Operations` * 2022-01-01-preview: :class:`Operations` + * 2022-10-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-08-01': @@ -253,8 +268,11 @@ def operations(self): from .v2021_11_01.operations import Operations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import Operations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -271,6 +289,7 @@ def premium_messaging_regions(self): from .v2018_01_01_preview.operations import PremiumMessagingRegionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'premium_messaging_regions'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -282,6 +301,7 @@ def private_endpoint_connections(self): * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-11-01: :class:`PrivateEndpointConnectionsOperations` * 2022-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-10-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-01-01-preview': @@ -294,8 +314,11 @@ def private_endpoint_connections(self): from .v2021_11_01.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -307,6 +330,7 @@ def private_link_resources(self): * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-11-01: :class:`PrivateLinkResourcesOperations` * 2022-01-01-preview: :class:`PrivateLinkResourcesOperations` + * 2022-10-01-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-01-01-preview': @@ -319,8 +343,11 @@ def private_link_resources(self): from .v2021_11_01.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -334,6 +361,7 @@ def queues(self): * 2021-06-01-preview: :class:`QueuesOperations` * 2021-11-01: :class:`QueuesOperations` * 2022-01-01-preview: :class:`QueuesOperations` + * 2022-10-01-preview: :class:`QueuesOperations` """ api_version = self._get_api_version('queues') if api_version == '2015-08-01': @@ -350,8 +378,11 @@ def queues(self): from .v2021_11_01.operations import QueuesOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import QueuesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import QueuesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'queues'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -368,6 +399,7 @@ def regions(self): from .v2018_01_01_preview.operations import RegionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regions'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -380,6 +412,7 @@ def rules(self): * 2021-06-01-preview: :class:`RulesOperations` * 2021-11-01: :class:`RulesOperations` * 2022-01-01-preview: :class:`RulesOperations` + * 2022-10-01-preview: :class:`RulesOperations` """ api_version = self._get_api_version('rules') if api_version == '2017-04-01': @@ -394,8 +427,11 @@ def rules(self): from .v2021_11_01.operations import RulesOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import RulesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import RulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'rules'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -409,6 +445,7 @@ def subscriptions(self): * 2021-06-01-preview: :class:`SubscriptionsOperations` * 2021-11-01: :class:`SubscriptionsOperations` * 2022-01-01-preview: :class:`SubscriptionsOperations` + * 2022-10-01-preview: :class:`SubscriptionsOperations` """ api_version = self._get_api_version('subscriptions') if api_version == '2015-08-01': @@ -425,8 +462,11 @@ def subscriptions(self): from .v2021_11_01.operations import SubscriptionsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import SubscriptionsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import SubscriptionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'subscriptions'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -440,6 +480,7 @@ def topics(self): * 2021-06-01-preview: :class:`TopicsOperations` * 2021-11-01: :class:`TopicsOperations` * 2022-01-01-preview: :class:`TopicsOperations` + * 2022-10-01-preview: :class:`TopicsOperations` """ api_version = self._get_api_version('topics') if api_version == '2015-08-01': @@ -456,8 +497,11 @@ def topics(self): from .v2021_11_01.operations import TopicsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import TopicsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from .v2022_10_01_preview.operations import TopicsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'topics'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) def close(self): diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py index d5711226f3eb..76cccb27826c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py @@ -26,9 +26,9 @@ class ServiceBusManagementClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str """ @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py index 36bf80f71f2e..6e3785c2f85a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py @@ -11,17 +11,15 @@ from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -42,9 +40,9 @@ class ServiceBusManagementClient(MultiApiClientMixin, _SDKClient): The api-version parameter sets the default API version if the operation group is not described in the profile. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -74,7 +72,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -98,6 +96,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-11-01: :mod:`v2021_11_01.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` + * 2022-10-01-preview: :mod:`v2022_10_01_preview.models` """ if api_version == '2015-08-01': from ..v2015_08_01 import models @@ -120,6 +119,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview import models return models + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -132,6 +134,7 @@ def disaster_recovery_configs(self): * 2021-06-01-preview: :class:`DisasterRecoveryConfigsOperations` * 2021-11-01: :class:`DisasterRecoveryConfigsOperations` * 2022-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2022-10-01-preview: :class:`DisasterRecoveryConfigsOperations` """ api_version = self._get_api_version('disaster_recovery_configs') if api_version == '2017-04-01': @@ -146,8 +149,11 @@ def disaster_recovery_configs(self): from ..v2021_11_01.aio.operations import DisasterRecoveryConfigsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -164,6 +170,7 @@ def event_hubs(self): from ..v2018_01_01_preview.aio.operations import EventHubsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -176,6 +183,7 @@ def migration_configs(self): * 2021-06-01-preview: :class:`MigrationConfigsOperations` * 2021-11-01: :class:`MigrationConfigsOperations` * 2022-01-01-preview: :class:`MigrationConfigsOperations` + * 2022-10-01-preview: :class:`MigrationConfigsOperations` """ api_version = self._get_api_version('migration_configs') if api_version == '2017-04-01': @@ -190,8 +198,11 @@ def migration_configs(self): from ..v2021_11_01.aio.operations import MigrationConfigsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import MigrationConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'migration_configs'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -205,6 +216,7 @@ def namespaces(self): * 2021-06-01-preview: :class:`NamespacesOperations` * 2021-11-01: :class:`NamespacesOperations` * 2022-01-01-preview: :class:`NamespacesOperations` + * 2022-10-01-preview: :class:`NamespacesOperations` """ api_version = self._get_api_version('namespaces') if api_version == '2015-08-01': @@ -221,8 +233,11 @@ def namespaces(self): from ..v2021_11_01.aio.operations import NamespacesOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import NamespacesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -236,6 +251,7 @@ def operations(self): * 2021-06-01-preview: :class:`Operations` * 2021-11-01: :class:`Operations` * 2022-01-01-preview: :class:`Operations` + * 2022-10-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-08-01': @@ -252,8 +268,11 @@ def operations(self): from ..v2021_11_01.aio.operations import Operations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -270,6 +289,7 @@ def premium_messaging_regions(self): from ..v2018_01_01_preview.aio.operations import PremiumMessagingRegionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'premium_messaging_regions'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -281,6 +301,7 @@ def private_endpoint_connections(self): * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-11-01: :class:`PrivateEndpointConnectionsOperations` * 2022-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-10-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-01-01-preview': @@ -293,8 +314,11 @@ def private_endpoint_connections(self): from ..v2021_11_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -306,6 +330,7 @@ def private_link_resources(self): * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-11-01: :class:`PrivateLinkResourcesOperations` * 2022-01-01-preview: :class:`PrivateLinkResourcesOperations` + * 2022-10-01-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-01-01-preview': @@ -318,8 +343,11 @@ def private_link_resources(self): from ..v2021_11_01.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -333,6 +361,7 @@ def queues(self): * 2021-06-01-preview: :class:`QueuesOperations` * 2021-11-01: :class:`QueuesOperations` * 2022-01-01-preview: :class:`QueuesOperations` + * 2022-10-01-preview: :class:`QueuesOperations` """ api_version = self._get_api_version('queues') if api_version == '2015-08-01': @@ -349,8 +378,11 @@ def queues(self): from ..v2021_11_01.aio.operations import QueuesOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import QueuesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import QueuesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'queues'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -367,6 +399,7 @@ def regions(self): from ..v2018_01_01_preview.aio.operations import RegionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regions'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -379,6 +412,7 @@ def rules(self): * 2021-06-01-preview: :class:`RulesOperations` * 2021-11-01: :class:`RulesOperations` * 2022-01-01-preview: :class:`RulesOperations` + * 2022-10-01-preview: :class:`RulesOperations` """ api_version = self._get_api_version('rules') if api_version == '2017-04-01': @@ -393,8 +427,11 @@ def rules(self): from ..v2021_11_01.aio.operations import RulesOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import RulesOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import RulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'rules'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -408,6 +445,7 @@ def subscriptions(self): * 2021-06-01-preview: :class:`SubscriptionsOperations` * 2021-11-01: :class:`SubscriptionsOperations` * 2022-01-01-preview: :class:`SubscriptionsOperations` + * 2022-10-01-preview: :class:`SubscriptionsOperations` """ api_version = self._get_api_version('subscriptions') if api_version == '2015-08-01': @@ -424,8 +462,11 @@ def subscriptions(self): from ..v2021_11_01.aio.operations import SubscriptionsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import SubscriptionsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import SubscriptionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'subscriptions'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property @@ -439,6 +480,7 @@ def topics(self): * 2021-06-01-preview: :class:`TopicsOperations` * 2021-11-01: :class:`TopicsOperations` * 2022-01-01-preview: :class:`TopicsOperations` + * 2022-10-01-preview: :class:`TopicsOperations` """ api_version = self._get_api_version('topics') if api_version == '2015-08-01': @@ -455,8 +497,11 @@ def topics(self): from ..v2021_11_01.aio.operations import TopicsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import TopicsOperations as OperationClass + elif api_version == '2022-10-01-preview': + from ..v2022_10_01_preview.aio.operations import TopicsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'topics'".format(api_version)) + self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) async def close(self): diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py index 221541a00fb6..2e171d69863b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py index ad9251b95ca2..5c8a1a34b850 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2015-08-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2015-08-01") # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", "2015-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,23 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json index fa76a032b89e..4039d4a5044f 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -103,4 +111,4 @@ "topics": "TopicsOperations", "subscriptions": "SubscriptionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py index 5cf4dd237f60..cd110f46ae19 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration from .operations import NamespacesOperations, Operations, QueuesOperations, SubscriptionsOperations, TopicsOperations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceBusManagementClient: + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword """Azure Service Bus client. :ivar operations: Operations operations @@ -35,10 +35,10 @@ class ServiceBusManagementClient: :vartype topics: azure.mgmt.servicebus.v2015_08_01.operations.TopicsOperations :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2015_08_01.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -56,35 +56,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -93,7 +80,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -106,15 +93,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient + def __enter__(self) -> "ServiceBusManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_vendor.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py index e7dd87df1f93..530b8638dfd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py index ac7564916ab6..dc556ef9932c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2015-08-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2015-08-01") # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", "2015-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,22 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py index d825e42c9329..c535d8d09c81 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration from .operations import NamespacesOperations, Operations, QueuesOperations, SubscriptionsOperations, TopicsOperations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceBusManagementClient: + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword """Azure Service Bus client. :ivar operations: Operations operations @@ -36,10 +36,10 @@ class ServiceBusManagementClient: :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2015_08_01.aio.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -57,35 +57,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -94,7 +81,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -114,5 +101,5 @@ async def __aenter__(self) -> "ServiceBusManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py index b0ee9242d985..2051d27d13ae 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py @@ -13,14 +13,15 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'NamespacesOperations', - 'QueuesOperations', - 'TopicsOperations', - 'SubscriptionsOperations', + "Operations", + "NamespacesOperations", + "QueuesOperations", + "TopicsOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py index 60aa3a847eaa..ef1cb0fe7021 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,30 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._namespaces_operations import build_check_name_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_request_initial, build_delete_authorization_rule_request, build_delete_request_initial, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_keys_request, build_regenerate_keys_request, build_update_request -T = TypeVar('T') +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_list_keys_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class NamespacesOperations: """ .. warning:: @@ -45,116 +74,169 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> AsyncIterable[_models.NamespaceListResult]: + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NamespaceResource"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :return: An iterator like instance of either NamespaceResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], + template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -162,16 +244,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -181,64 +261,70 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.NamespaceListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NamespaceResource"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :return: An iterator like instance of either NamespaceResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -246,16 +332,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -265,52 +349,61 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } async def _create_or_update_initial( self, resource_group_name: str, namespace_name: str, - parameters: _models.NamespaceCreateOrUpdateParameters, + parameters: Union[_models.NamespaceCreateOrUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.NamespaceResource]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.NamespaceResource]] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamespaceResource]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NamespaceCreateOrUpdateParameters") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -319,36 +412,125 @@ async def _create_or_update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.NamespaceCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NamespaceResource]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NamespaceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NamespaceResource]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NamespaceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, namespace_name: str, - parameters: _models.NamespaceCreateOrUpdateParameters, + parameters: Union[_models.NamespaceCreateOrUpdateParameters, IO], **kwargs: Any ) -> AsyncLROPoller[_models.NamespaceResource]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Is either a + NamespaceCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -361,96 +543,89 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceResource] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NamespaceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -460,22 +635,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -487,154 +661,218 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.NamespaceResource: + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.NamespaceResource: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NamespaceResource, or the result of cls(response) + :return: NamespaceResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.NamespaceResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, namespace_name: str, parameters: _models.NamespaceUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.NamespaceResource]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NamespaceResource, or the result of cls(response) + :return: NamespaceResource or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.NamespaceResource]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.NamespaceResource]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + NamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.NamespaceResource]] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamespaceResource]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -643,18 +881,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -663,77 +901,84 @@ async def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SharedAccessAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleResource"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + :return: An iterator like instance of either SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -741,16 +986,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -760,50 +1003,134 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a + SharedAccessAuthorizationRuleCreateOrUpdateParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedAccessAuthorizationRuleCreateOrUpdateParameters") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -813,85 +1140,86 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -901,180 +1229,265 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.ResourceListKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateKeysParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceListKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateKeysParameters, IO], + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateKeysParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateKeysParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateKeysParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1084,30 +1497,31 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py index 94a1178bd32f..bc5436afd1d8 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,52 +57,57 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -95,16 +115,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +132,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py index 2d121cca8b22..8bfbc923b3e5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,28 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queues_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_all_request, build_list_authorization_rules_request, build_list_keys_request, build_post_authorization_rule_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_all_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_post_authorization_rule_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class QueuesOperations: """ .. warning:: @@ -43,64 +70,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_all( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.QueueListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.QueueResource"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either QueueListResult or the result of cls(response) + :return: An iterator like instance of either QueueResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.QueueListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.QueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_all_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_all.metadata['url'], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_all_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,16 +140,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("QueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,49 +157,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.QueueCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.QueueResource: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.QueueResource: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.QueueCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.QueueResource: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + QueueCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueueResource, or the result of cls(response) + :return: QueueResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.QueueResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueueResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'QueueCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "QueueCreateOrUpdateParameters") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -179,85 +291,86 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueueResource', pipeline_response) + deserialized = self._deserialize("QueueResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -267,139 +380,145 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.QueueResource: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueueResource, or the result of cls(response) + :return: QueueResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.QueueResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.QueueResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueueResource', pipeline_response) + deserialized = self._deserialize("QueueResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SharedAccessAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleResource"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + :return: An iterator like instance of either SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -407,16 +526,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -426,13 +543,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -440,39 +557,120 @@ async def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a + SharedAccessAuthorizationRuleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedAccessAuthorizationRuleCreateOrUpdateParameters") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -483,33 +681,34 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def post_authorization_rule( @@ -522,31 +721,36 @@ async def post_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_post_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -554,33 +758,33 @@ async def post_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.post_authorization_rule.metadata['url'], + template_url=self.post_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + post_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -593,31 +797,36 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -625,18 +834,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -646,8 +854,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -660,31 +869,36 @@ async def get_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -692,33 +906,33 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -731,31 +945,36 @@ async def list_keys( ) -> _models.ResourceListKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -763,35 +982,35 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -799,38 +1018,126 @@ async def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateKeysParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceListKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateKeysParameters, IO], + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateKeysParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateKeysParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateKeysParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -841,30 +1148,31 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py index 466a3e2d1a2d..f7d7f63b7e52 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_all_request -T = TypeVar('T') +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_all_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SubscriptionsOperations: """ .. warning:: @@ -43,70 +63,73 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_all( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SubscriptionListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SubscriptionResource"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionListResult or the result of + :return: An iterator like instance of either SubscriptionResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_all_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_all.metadata['url'], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_all_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +137,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,13 +154,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -147,39 +168,128 @@ async def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SubscriptionCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SubscriptionResource: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SubscriptionResource: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SubscriptionResource, or the result of cls(response) + :return: SubscriptionResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SubscriptionCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.SubscriptionResource: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SubscriptionCreateOrUpdateParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubscriptionResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SubscriptionCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SubscriptionCreateOrUpdateParameters") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -190,70 +300,71 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SubscriptionResource', pipeline_response) + deserialized = self._deserialize("SubscriptionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -261,18 +372,17 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -282,45 +392,46 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SubscriptionResource: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SubscriptionResource, or the result of cls(response) + :return: SubscriptionResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SubscriptionResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -328,30 +439,30 @@ async def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SubscriptionResource', pipeline_response) + deserialized = self._deserialize("SubscriptionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py index 13690278409c..c5dec383da88 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,28 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._topics_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_all_request, build_list_authorization_rules_request, build_list_keys_request, build_post_authorization_rule_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_all_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_post_authorization_rule_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopicsOperations: """ .. warning:: @@ -43,64 +70,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_all( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.TopicListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TopicResource"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TopicListResult or the result of cls(response) + :return: An iterator like instance of either TopicResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopicListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.TopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_all_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_all.metadata['url'], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_all_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,16 +140,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,49 +157,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.TopicCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TopicResource: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TopicResource: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.TopicCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.TopicResource: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a + TopicCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TopicResource, or the result of cls(response) + :return: TopicResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopicResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TopicResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'TopicCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TopicCreateOrUpdateParameters") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -179,85 +291,86 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TopicResource', pipeline_response) + deserialized = self._deserialize("TopicResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -267,139 +380,145 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.TopicResource: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TopicResource, or the result of cls(response) + :return: TopicResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopicResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.TopicResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TopicResource', pipeline_response) + deserialized = self._deserialize("TopicResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SharedAccessAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleResource"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + :return: An iterator like instance of either SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -407,16 +526,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -426,13 +543,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -440,39 +557,129 @@ async def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a + SharedAccessAuthorizationRuleCreateOrUpdateParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedAccessAuthorizationRuleCreateOrUpdateParameters") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -483,33 +690,34 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def post_authorization_rule( @@ -522,31 +730,36 @@ async def post_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_post_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -554,33 +767,33 @@ async def post_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.post_authorization_rule.metadata['url'], + template_url=self.post_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + post_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -593,31 +806,36 @@ async def get_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -625,33 +843,33 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -664,31 +882,36 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -696,18 +919,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -717,8 +939,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -731,31 +954,36 @@ async def list_keys( ) -> _models.ResourceListKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -763,35 +991,35 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -799,38 +1027,126 @@ async def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateKeysParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceListKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateKeysParameters, IO], + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateKeysParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateKeysParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateKeysParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -841,30 +1157,31 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py index c44dce4e28b6..1992ae248260 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py @@ -34,56 +34,54 @@ from ._models_py3 import TopicResource from ._models_py3 import TrackedResource - -from ._service_bus_management_client_enums import ( - AccessRights, - EntityAvailabilityStatus, - EntityStatus, - NamespaceState, - Policykey, - SkuName, - SkuTier, - UnavailableReason, -) +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import EntityAvailabilityStatus +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import NamespaceState +from ._service_bus_management_client_enums import Policykey +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import UnavailableReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CheckNameAvailability', - 'CheckNameAvailabilityResult', - 'MessageCountDetails', - 'NamespaceCreateOrUpdateParameters', - 'NamespaceListResult', - 'NamespaceResource', - 'NamespaceUpdateParameters', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'QueueCreateOrUpdateParameters', - 'QueueListResult', - 'QueueResource', - 'RegenerateKeysParameters', - 'Resource', - 'ResourceListKeys', - 'SharedAccessAuthorizationRuleCreateOrUpdateParameters', - 'SharedAccessAuthorizationRuleListResult', - 'SharedAccessAuthorizationRuleResource', - 'Sku', - 'SubscriptionCreateOrUpdateParameters', - 'SubscriptionListResult', - 'SubscriptionResource', - 'TopicCreateOrUpdateParameters', - 'TopicListResult', - 'TopicResource', - 'TrackedResource', - 'AccessRights', - 'EntityAvailabilityStatus', - 'EntityStatus', - 'NamespaceState', - 'Policykey', - 'SkuName', - 'SkuTier', - 'UnavailableReason', + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "MessageCountDetails", + "NamespaceCreateOrUpdateParameters", + "NamespaceListResult", + "NamespaceResource", + "NamespaceUpdateParameters", + "Operation", + "OperationDisplay", + "OperationListResult", + "QueueCreateOrUpdateParameters", + "QueueListResult", + "QueueResource", + "RegenerateKeysParameters", + "Resource", + "ResourceListKeys", + "SharedAccessAuthorizationRuleCreateOrUpdateParameters", + "SharedAccessAuthorizationRuleListResult", + "SharedAccessAuthorizationRuleResource", + "Sku", + "SubscriptionCreateOrUpdateParameters", + "SubscriptionListResult", + "SubscriptionResource", + "TopicCreateOrUpdateParameters", + "TopicListResult", + "TopicResource", + "TrackedResource", + "AccessRights", + "EntityAvailabilityStatus", + "EntityStatus", + "NamespaceState", + "Policykey", + "SkuName", + "SkuTier", + "UnavailableReason", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py index c418f4487af8..24f00cc8a435 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -6,51 +7,46 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class CheckNameAvailability(msrest.serialization.Model): +class CheckNameAvailability(_serialization.Model): """Description of a Check Name availability request properties. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The Name to check the namespace name availability and The namespace name - can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it - must end with a letter or number. + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The Name to check the namespace name availability and The namespace - name can contain only letters, numbers, and hyphens. The namespace must start with a letter, - and it must end with a letter or number. + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :paramtype name: str """ - super(CheckNameAvailability, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(msrest.serialization.Model): +class CheckNameAvailabilityResult(_serialization.Model): """Description of a Check Name availability request properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -59,7 +55,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): available; otherwise, false. :vartype name_available: bool :ivar reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :vartype reason: str or ~azure.mgmt.servicebus.v2015_08_01.models.UnavailableReason :ivar message: The detailed info regarding the reason associated with the namespace. @@ -67,13 +63,13 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): """ _validation = { - 'message': {'readonly': True}, + "message": {"readonly": True}, } _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, } def __init__( @@ -81,64 +77,60 @@ def __init__( *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.UnavailableReason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Value indicating namespace is availability, true if the namespace is available; otherwise, false. :paramtype name_available: bool :keyword reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :paramtype reason: str or ~azure.mgmt.servicebus.v2015_08_01.models.UnavailableReason """ - super(CheckNameAvailabilityResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = None -class MessageCountDetails(msrest.serialization.Model): +class MessageCountDetails(_serialization.Model): """Message Count Details. Variables are only populated by the server, and will be ignored when sending a request. :ivar active_message_count: Number of active messages in the queue, topic, or subscription. - :vartype active_message_count: long + :vartype active_message_count: int :ivar dead_letter_message_count: Number of messages that are dead lettered. - :vartype dead_letter_message_count: long + :vartype dead_letter_message_count: int :ivar scheduled_message_count: Number of scheduled messages. - :vartype scheduled_message_count: long + :vartype scheduled_message_count: int :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. - :vartype transfer_dead_letter_message_count: long + :vartype transfer_dead_letter_message_count: int :ivar transfer_message_count: Number of messages transferred to another queue, topic, or subscription. - :vartype transfer_message_count: long + :vartype transfer_message_count: int """ _validation = { - 'active_message_count': {'readonly': True}, - 'dead_letter_message_count': {'readonly': True}, - 'scheduled_message_count': {'readonly': True}, - 'transfer_dead_letter_message_count': {'readonly': True}, - 'transfer_message_count': {'readonly': True}, + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, } _attribute_map = { - 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, - 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, - 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, - 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, - 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MessageCountDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.active_message_count = None self.dead_letter_message_count = None self.scheduled_message_count = None @@ -146,24 +138,24 @@ def __init__( self.transfer_message_count = None -class NamespaceCreateOrUpdateParameters(msrest.serialization.Model): +class NamespaceCreateOrUpdateParameters(_serialization.Model): """Parameters supplied to the Create Or Update Namespace operation. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar location: Required. Namespace location. + :ivar location: Namespace location. Required. :vartype location: str :ivar sku: SKU of the namespace. :vartype sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku - :ivar tags: A set of tags. Namespace tags. + :ivar tags: Namespace tags. :vartype tags: dict[str, str] :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str :ivar status: State of the namespace. Known values are: "Unknown", "Creating", "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", "SoftDeleted", - "Removing", "Removed", "Failed". + "Removing", "Removed", and "Failed". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState :ivar created_at: The time the namespace was created. :vartype created_at: ~datetime.datetime @@ -178,24 +170,24 @@ class NamespaceCreateOrUpdateParameters(msrest.serialization.Model): """ _validation = { - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, } _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "tags": {"key": "tags", "type": "{str}"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "create_acs_namespace": {"key": "properties.createACSNamespace", "type": "bool"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, } def __init__( @@ -207,25 +199,25 @@ def __init__( status: Optional[Union[str, "_models.NamespaceState"]] = None, create_acs_namespace: Optional[bool] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Required. Namespace location. + :keyword location: Namespace location. Required. :paramtype location: str :keyword sku: SKU of the namespace. :paramtype sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku - :keyword tags: A set of tags. Namespace tags. + :keyword tags: Namespace tags. :paramtype tags: dict[str, str] :keyword status: State of the namespace. Known values are: "Unknown", "Creating", "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", "SoftDeleted", - "Removing", "Removed", "Failed". + "Removing", "Removed", and "Failed". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState :keyword create_acs_namespace: Indicates whether to create an ACS namespace. :paramtype create_acs_namespace: bool :keyword enabled: Specifies whether this instance is enabled. :paramtype enabled: bool """ - super(NamespaceCreateOrUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.sku = sku self.tags = tags @@ -238,7 +230,7 @@ def __init__( self.enabled = enabled -class NamespaceListResult(msrest.serialization.Model): +class NamespaceListResult(_serialization.Model): """The response of the List Namespace operation. :ivar value: Result of the List Namespace operation. @@ -249,8 +241,8 @@ class NamespaceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NamespaceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NamespaceResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -258,8 +250,8 @@ def __init__( *, value: Optional[List["_models.NamespaceResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Namespace operation. :paramtype value: list[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] @@ -267,12 +259,12 @@ def __init__( list of Namespaces. :paramtype next_link: str """ - super(NamespaceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource definition for other than namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -288,29 +280,24 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - location: Optional[str] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.location = location @@ -330,42 +317,36 @@ class TrackedResource(Resource): :vartype location: str :ivar type: Resource type. :vartype type: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(location=location, **kwargs) + super().__init__(location=location, **kwargs) self.tags = tags -class NamespaceResource(TrackedResource): +class NamespaceResource(TrackedResource): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -378,7 +359,7 @@ class NamespaceResource(TrackedResource): :vartype location: str :ivar type: Resource type. :vartype type: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: SKU of the namespace. :vartype sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku @@ -386,7 +367,7 @@ class NamespaceResource(TrackedResource): :vartype provisioning_state: str :ivar status: State of the namespace. Known values are: "Unknown", "Creating", "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", "SoftDeleted", - "Removing", "Removed", "Failed". + "Removing", "Removed", and "Failed". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState :ivar created_at: The time the namespace was created. :vartype created_at: ~datetime.datetime @@ -401,29 +382,29 @@ class NamespaceResource(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "create_acs_namespace": {"key": "properties.createACSNamespace", "type": "bool"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, } def __init__( @@ -435,25 +416,25 @@ def __init__( status: Optional[Union[str, "_models.NamespaceState"]] = None, create_acs_namespace: Optional[bool] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: SKU of the namespace. :paramtype sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku :keyword status: State of the namespace. Known values are: "Unknown", "Creating", "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", "SoftDeleted", - "Removing", "Removed", "Failed". + "Removing", "Removed", and "Failed". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState :keyword create_acs_namespace: Indicates whether to create an ACS namespace. :paramtype create_acs_namespace: bool :keyword enabled: Specifies whether this instance is enabled. :paramtype enabled: bool """ - super(NamespaceResource, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.provisioning_state = None self.status = status @@ -464,39 +445,35 @@ def __init__( self.enabled = enabled -class NamespaceUpdateParameters(msrest.serialization.Model): +class NamespaceUpdateParameters(_serialization.Model): """Parameters supplied to the Patch Namespace operation. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The sku of the created namespace. :vartype sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, } def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - **kwargs - ): + self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.Sku"] = None, **kwargs: Any + ) -> None: """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The sku of the created namespace. :paramtype sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku """ - super(NamespaceUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.sku = sku -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """A ServiceBus REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -508,30 +485,25 @@ class Operation(msrest.serialization.Model): """ _validation = { - 'name': {'readonly': True}, + "name": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__( - self, - *, - display: Optional["_models.OperationDisplay"] = None, - **kwargs - ): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.servicebus.v2015_08_01.models.OperationDisplay """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.display = display -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """The object that represents the operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -545,31 +517,28 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None -class OperationListResult(msrest.serialization.Model): - """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -581,27 +550,23 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class QueueCreateOrUpdateParameters(msrest.serialization.Model): +class QueueCreateOrUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters supplied to the Create Or Update Queue operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -610,7 +575,7 @@ class QueueCreateOrUpdateParameters(msrest.serialization.Model): :ivar name: Queue name. :vartype name: str - :ivar location: Required. location of the resource. + :ivar location: location of the resource. Required. :vartype location: str :ivar lock_duration: The duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default @@ -623,7 +588,7 @@ class QueueCreateOrUpdateParameters(msrest.serialization.Model): deleted. The minimum duration is 5 minutes. :vartype auto_delete_on_idle: str :ivar entity_availability_status: Entity availability status for the queue. Known values are: - "Available", "Limited", "Renaming", "Restoring", "Unknown". + "Available", "Limited", "Renaming", "Restoring", and "Unknown". :vartype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :ivar created_at: The exact time the message was created. @@ -655,9 +620,9 @@ class QueueCreateOrUpdateParameters(msrest.serialization.Model): :vartype max_delivery_count: int :ivar max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. - :vartype max_size_in_megabytes: long + :vartype max_size_in_megabytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar count_details: Message Count Details. :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails :ivar requires_duplicate_detection: A value indicating if this queue requires duplicate @@ -667,10 +632,10 @@ class QueueCreateOrUpdateParameters(msrest.serialization.Model): sessions. :vartype requires_session: bool :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", "Restoring", - "SendDisabled", "Unknown". + "SendDisabled", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :ivar support_ordering: A value that indicates whether the queue supports ordering. :vartype support_ordering: bool @@ -679,43 +644,46 @@ class QueueCreateOrUpdateParameters(msrest.serialization.Model): """ _validation = { - 'location': {'required': True}, - 'accessed_at': {'readonly': True}, - 'created_at': {'readonly': True}, - 'message_count': {'readonly': True}, - 'count_details': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'updated_at': {'readonly': True}, + "location": {"required": True}, + "accessed_at": {"readonly": True}, + "created_at": {"readonly": True}, + "message_count": {"readonly": True}, + "count_details": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "updated_at": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, - 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "lock_duration": {"key": "properties.lockDuration", "type": "str"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "str"}, + "entity_availability_status": {"key": "properties.entityAvailabilityStatus", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "str"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "str", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "is_anonymous_accessible": {"key": "properties.isAnonymousAccessible", "type": "bool"}, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -736,12 +704,12 @@ def __init__( requires_session: Optional[bool] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, support_ordering: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Queue name. :paramtype name: str - :keyword location: Required. location of the resource. + :keyword location: location of the resource. Required. :paramtype location: str :keyword lock_duration: The duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the @@ -751,7 +719,7 @@ def __init__( deleted. The minimum duration is 5 minutes. :paramtype auto_delete_on_idle: str :keyword entity_availability_status: Entity availability status for the queue. Known values - are: "Available", "Limited", "Renaming", "Restoring", "Unknown". + are: "Available", "Limited", "Renaming", "Restoring", and "Unknown". :paramtype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :keyword default_message_time_to_live: The default message time to live value. This is the @@ -781,7 +749,7 @@ def __init__( :paramtype max_delivery_count: int :keyword max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. - :paramtype max_size_in_megabytes: long + :paramtype max_size_in_megabytes: int :keyword requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -790,12 +758,12 @@ def __init__( :paramtype requires_session: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", - "Restoring", "SendDisabled", "Unknown". + "Restoring", "SendDisabled", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :keyword support_ordering: A value that indicates whether the queue supports ordering. :paramtype support_ordering: bool """ - super(QueueCreateOrUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.location = location self.lock_duration = lock_duration @@ -822,7 +790,7 @@ def __init__( self.updated_at = None -class QueueListResult(msrest.serialization.Model): +class QueueListResult(_serialization.Model): """The response to the List Queues operation. :ivar value: Result of the List Queues operation. @@ -833,17 +801,13 @@ class QueueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[QueueResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[QueueResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.QueueResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.QueueResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Queues operation. :paramtype value: list[~azure.mgmt.servicebus.v2015_08_01.models.QueueResource] @@ -851,12 +815,12 @@ def __init__( list of queues. :paramtype next_link: str """ - super(QueueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class QueueResource(Resource): +class QueueResource(Resource): # pylint: disable=too-many-instance-attributes """Description of queue Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -880,7 +844,7 @@ class QueueResource(Resource): deleted. The minimum duration is 5 minutes. :vartype auto_delete_on_idle: str :ivar entity_availability_status: Entity availability status for the queue. Known values are: - "Available", "Limited", "Renaming", "Restoring", "Unknown". + "Available", "Limited", "Renaming", "Restoring", and "Unknown". :vartype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :ivar created_at: The exact time the message was created. @@ -912,9 +876,9 @@ class QueueResource(Resource): :vartype max_delivery_count: int :ivar max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. - :vartype max_size_in_megabytes: long + :vartype max_size_in_megabytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar count_details: Message Count Details. :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails :ivar requires_duplicate_detection: A value indicating if this queue requires duplicate @@ -924,10 +888,10 @@ class QueueResource(Resource): sessions. :vartype requires_session: bool :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", "Restoring", - "SendDisabled", "Unknown". + "SendDisabled", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :ivar support_ordering: A value that indicates whether the queue supports ordering. :vartype support_ordering: bool @@ -936,47 +900,50 @@ class QueueResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'created_at': {'readonly': True}, - 'message_count': {'readonly': True}, - 'count_details': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'updated_at': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "accessed_at": {"readonly": True}, + "created_at": {"readonly": True}, + "message_count": {"readonly": True}, + "count_details": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "updated_at": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, - 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "lock_duration": {"key": "properties.lockDuration", "type": "str"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "str"}, + "entity_availability_status": {"key": "properties.entityAvailabilityStatus", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "str"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "str", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "is_anonymous_accessible": {"key": "properties.isAnonymousAccessible", "type": "bool"}, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: Optional[str] = None, @@ -996,8 +963,8 @@ def __init__( requires_session: Optional[bool] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, support_ordering: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1009,7 +976,7 @@ def __init__( deleted. The minimum duration is 5 minutes. :paramtype auto_delete_on_idle: str :keyword entity_availability_status: Entity availability status for the queue. Known values - are: "Available", "Limited", "Renaming", "Restoring", "Unknown". + are: "Available", "Limited", "Renaming", "Restoring", and "Unknown". :paramtype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :keyword default_message_time_to_live: The default message time to live value. This is the @@ -1039,7 +1006,7 @@ def __init__( :paramtype max_delivery_count: int :keyword max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. - :paramtype max_size_in_megabytes: long + :paramtype max_size_in_megabytes: int :keyword requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -1048,12 +1015,12 @@ def __init__( :paramtype requires_session: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", - "Restoring", "SendDisabled", "Unknown". + "Restoring", "SendDisabled", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :keyword support_ordering: A value that indicates whether the queue supports ordering. :paramtype support_ordering: bool """ - super(QueueResource, self).__init__(location=location, **kwargs) + super().__init__(location=location, **kwargs) self.lock_duration = lock_duration self.accessed_at = None self.auto_delete_on_idle = auto_delete_on_idle @@ -1078,34 +1045,29 @@ def __init__( self.updated_at = None -class RegenerateKeysParameters(msrest.serialization.Model): +class RegenerateKeysParameters(_serialization.Model): """Parameters supplied to the Regenerate Authorization Rule operation. - :ivar policykey: Key that needs to be regenerated. Known values are: "PrimaryKey", + :ivar policykey: Key that needs to be regenerated. Known values are: "PrimaryKey" and "SecondaryKey". :vartype policykey: str or ~azure.mgmt.servicebus.v2015_08_01.models.Policykey """ _attribute_map = { - 'policykey': {'key': 'Policykey', 'type': 'str'}, + "policykey": {"key": "Policykey", "type": "str"}, } - def __init__( - self, - *, - policykey: Optional[Union[str, "_models.Policykey"]] = None, - **kwargs - ): + def __init__(self, *, policykey: Optional[Union[str, "_models.Policykey"]] = None, **kwargs: Any) -> None: """ - :keyword policykey: Key that needs to be regenerated. Known values are: "PrimaryKey", + :keyword policykey: Key that needs to be regenerated. Known values are: "PrimaryKey" and "SecondaryKey". :paramtype policykey: str or ~azure.mgmt.servicebus.v2015_08_01.models.Policykey """ - super(RegenerateKeysParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.policykey = policykey -class ResourceListKeys(msrest.serialization.Model): +class ResourceListKeys(_serialization.Model): """Namespace/ServiceBus Connection String. :ivar primary_connection_string: Primary connection string of the created namespace @@ -1125,11 +1087,11 @@ class ResourceListKeys(msrest.serialization.Model): """ _attribute_map = { - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, } def __init__( @@ -1140,8 +1102,8 @@ def __init__( primary_key: Optional[str] = None, secondary_key: Optional[str] = None, key_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_connection_string: Primary connection string of the created namespace authorization rule. @@ -1158,7 +1120,7 @@ def __init__( :keyword key_name: A string that describes the authorization rule. :paramtype key_name: str """ - super(ResourceListKeys, self).__init__(**kwargs) + super().__init__(**kwargs) self.primary_connection_string = primary_connection_string self.secondary_connection_string = secondary_connection_string self.primary_key = primary_key @@ -1166,7 +1128,7 @@ def __init__( self.key_name = key_name -class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization.Model): +class SharedAccessAuthorizationRuleCreateOrUpdateParameters(_serialization.Model): """Parameters supplied to the Create Or Update Authorization Rules operation. :ivar location: data center location. @@ -1178,9 +1140,9 @@ class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization """ _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "location": {"key": "location", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } def __init__( @@ -1189,8 +1151,8 @@ def __init__( location: Optional[str] = None, name: Optional[str] = None, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: data center location. :paramtype location: str @@ -1199,13 +1161,13 @@ def __init__( :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] """ - super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.name = name self.rights = rights -class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): +class SharedAccessAuthorizationRuleListResult(_serialization.Model): """The response to the List Namespace operation. :ivar value: Result of the List Authorization Rules operation. @@ -1217,8 +1179,8 @@ class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SharedAccessAuthorizationRuleResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1226,8 +1188,8 @@ def __init__( *, value: Optional[List["_models.SharedAccessAuthorizationRuleResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Authorization Rules operation. :paramtype value: @@ -1236,7 +1198,7 @@ def __init__( list of Authorization Rules. :paramtype next_link: str """ - super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1259,17 +1221,17 @@ class SharedAccessAuthorizationRuleResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } def __init__( @@ -1277,40 +1239,40 @@ def __init__( *, location: Optional[str] = None, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] """ - super(SharedAccessAuthorizationRuleResource, self).__init__(location=location, **kwargs) + super().__init__(location=location, **kwargs) self.rights = rights -class Sku(msrest.serialization.Model): +class Sku(_serialization.Model): """SKU of the namespace. All required parameters must be populated in order to send to Azure. - :ivar name: Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :ivar name: Name of this SKU. Known values are: "Basic", "Standard", and "Premium". :vartype name: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuName - :ivar tier: Required. The billing tier of this particular SKU. Known values are: "Basic", - "Standard", "Premium". + :ivar tier: The billing tier of this particular SKU. Required. Known values are: "Basic", + "Standard", and "Premium". :vartype tier: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuTier :ivar capacity: The specified messaging units for the tier. :vartype capacity: int """ _validation = { - 'tier': {'required': True}, + "tier": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( @@ -1319,31 +1281,31 @@ def __init__( tier: Union[str, "_models.SkuTier"], name: Optional[Union[str, "_models.SkuName"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :keyword name: Name of this SKU. Known values are: "Basic", "Standard", and "Premium". :paramtype name: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuName - :keyword tier: Required. The billing tier of this particular SKU. Known values are: "Basic", - "Standard", "Premium". + :keyword tier: The billing tier of this particular SKU. Required. Known values are: "Basic", + "Standard", and "Premium". :paramtype tier: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuTier :keyword capacity: The specified messaging units for the tier. :paramtype capacity: int """ - super(Sku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SubscriptionCreateOrUpdateParameters(msrest.serialization.Model): +class SubscriptionCreateOrUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters supplied to the Create Or Update Subscription operation. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar location: Required. Subscription data center location. + :ivar location: Subscription data center location. Required. :vartype location: str :ivar type: Resource manager type of the resource. :vartype type: str @@ -1370,7 +1332,7 @@ class SubscriptionCreateOrUpdateParameters(msrest.serialization.Model): are enabled. :vartype enable_batched_operations: bool :ivar entity_availability_status: Entity availability status for the topic. Known values are: - "Available", "Limited", "Renaming", "Restoring", "Unknown". + "Available", "Limited", "Renaming", "Restoring", and "Unknown". :vartype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :ivar is_read_only: Value that indicates whether the entity description is read-only. @@ -1380,45 +1342,48 @@ class SubscriptionCreateOrUpdateParameters(msrest.serialization.Model): :ivar max_delivery_count: Number of maximum deliveries. :vartype max_delivery_count: int :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar requires_session: Value indicating if a subscription supports the concept of sessions. :vartype requires_session: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", "Restoring", - "SendDisabled", "Unknown". + "SendDisabled", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :ivar updated_at: The exact time the message was updated. :vartype updated_at: ~datetime.datetime """ _validation = { - 'location': {'required': True}, - 'accessed_at': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'message_count': {'readonly': True}, - 'updated_at': {'readonly': True}, + "location": {"required": True}, + "accessed_at": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "message_count": {"readonly": True}, + "updated_at": {"readonly": True}, } _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, - 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "str"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "str"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "entity_availability_status": {"key": "properties.entityAvailabilityStatus", "type": "str"}, + "is_read_only": {"key": "properties.isReadOnly", "type": "bool"}, + "lock_duration": {"key": "properties.lockDuration", "type": "str"}, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, } def __init__( @@ -1437,10 +1402,10 @@ def __init__( max_delivery_count: Optional[int] = None, requires_session: Optional[bool] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Required. Subscription data center location. + :keyword location: Subscription data center location. Required. :paramtype location: str :keyword type: Resource manager type of the resource. :paramtype type: str @@ -1461,7 +1426,7 @@ def __init__( are enabled. :paramtype enable_batched_operations: bool :keyword entity_availability_status: Entity availability status for the topic. Known values - are: "Available", "Limited", "Renaming", "Restoring", "Unknown". + are: "Available", "Limited", "Renaming", "Restoring", and "Unknown". :paramtype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :keyword is_read_only: Value that indicates whether the entity description is read-only. @@ -1474,10 +1439,10 @@ def __init__( :paramtype requires_session: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", - "Restoring", "SendDisabled", "Unknown". + "Restoring", "SendDisabled", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus """ - super(SubscriptionCreateOrUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.type = type self.accessed_at = None @@ -1498,7 +1463,7 @@ def __init__( self.updated_at = None -class SubscriptionListResult(msrest.serialization.Model): +class SubscriptionListResult(_serialization.Model): """The response to the List Subscriptions operation. :ivar value: Result of the List Subscriptions operation. @@ -1509,8 +1474,8 @@ class SubscriptionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SubscriptionResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SubscriptionResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1518,8 +1483,8 @@ def __init__( *, value: Optional[List["_models.SubscriptionResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Subscriptions operation. :paramtype value: list[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource] @@ -1527,12 +1492,12 @@ def __init__( list of subscriptions. :paramtype next_link: str """ - super(SubscriptionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SubscriptionResource(Resource): +class SubscriptionResource(Resource): # pylint: disable=too-many-instance-attributes """Description of subscription resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1568,7 +1533,7 @@ class SubscriptionResource(Resource): are enabled. :vartype enable_batched_operations: bool :ivar entity_availability_status: Entity availability status for the topic. Known values are: - "Available", "Limited", "Renaming", "Restoring", "Unknown". + "Available", "Limited", "Renaming", "Restoring", and "Unknown". :vartype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :ivar is_read_only: Value that indicates whether the entity description is read-only. @@ -1578,49 +1543,52 @@ class SubscriptionResource(Resource): :ivar max_delivery_count: Number of maximum deliveries. :vartype max_delivery_count: int :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar requires_session: Value indicating if a subscription supports the concept of sessions. :vartype requires_session: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", "Restoring", - "SendDisabled", "Unknown". + "SendDisabled", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :ivar updated_at: The exact time the message was updated. :vartype updated_at: ~datetime.datetime """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'message_count': {'readonly': True}, - 'updated_at': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "accessed_at": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "message_count": {"readonly": True}, + "updated_at": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, - 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "str"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "str"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "entity_availability_status": {"key": "properties.entityAvailabilityStatus", "type": "str"}, + "is_read_only": {"key": "properties.isReadOnly", "type": "bool"}, + "lock_duration": {"key": "properties.lockDuration", "type": "str"}, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, } def __init__( @@ -1638,8 +1606,8 @@ def __init__( max_delivery_count: Optional[int] = None, requires_session: Optional[bool] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1660,7 +1628,7 @@ def __init__( are enabled. :paramtype enable_batched_operations: bool :keyword entity_availability_status: Entity availability status for the topic. Known values - are: "Available", "Limited", "Renaming", "Restoring", "Unknown". + are: "Available", "Limited", "Renaming", "Restoring", and "Unknown". :paramtype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :keyword is_read_only: Value that indicates whether the entity description is read-only. @@ -1673,10 +1641,10 @@ def __init__( :paramtype requires_session: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", - "Restoring", "SendDisabled", "Unknown". + "Restoring", "SendDisabled", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus """ - super(SubscriptionResource, self).__init__(location=location, **kwargs) + super().__init__(location=location, **kwargs) self.accessed_at = None self.auto_delete_on_idle = auto_delete_on_idle self.count_details = None @@ -1695,7 +1663,7 @@ def __init__( self.updated_at = None -class TopicCreateOrUpdateParameters(msrest.serialization.Model): +class TopicCreateOrUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters supplied to the Create Or Update Topic operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1704,7 +1672,7 @@ class TopicCreateOrUpdateParameters(msrest.serialization.Model): :ivar name: Topic name. :vartype name: str - :ivar location: Required. Location of the resource. + :ivar location: Location of the resource. Required. :vartype location: str :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. :vartype accessed_at: ~datetime.datetime @@ -1712,7 +1680,7 @@ class TopicCreateOrUpdateParameters(msrest.serialization.Model): deleted. The minimum duration is 5 minutes. :vartype auto_delete_on_idle: str :ivar entity_availability_status: Entity availability status for the topic. Known values are: - "Available", "Limited", "Renaming", "Restoring", "Unknown". + "Available", "Limited", "Renaming", "Restoring", and "Unknown". :vartype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :ivar created_at: Exact time the message was created. @@ -1745,15 +1713,15 @@ class TopicCreateOrUpdateParameters(msrest.serialization.Model): :vartype is_express: bool :ivar max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. - :vartype max_size_in_megabytes: long + :vartype max_size_in_megabytes: int :ivar requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :vartype requires_duplicate_detection: bool :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", "Restoring", - "SendDisabled", "Unknown". + "SendDisabled", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :ivar subscription_count: Number of subscriptions. :vartype subscription_count: int @@ -1764,38 +1732,41 @@ class TopicCreateOrUpdateParameters(msrest.serialization.Model): """ _validation = { - 'location': {'required': True}, - 'accessed_at': {'readonly': True}, - 'created_at': {'readonly': True}, - 'count_details': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'updated_at': {'readonly': True}, + "location": {"required": True}, + "accessed_at": {"readonly": True}, + "created_at": {"readonly": True}, + "count_details": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "subscription_count": {"readonly": True}, + "updated_at": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, - 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, - 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, - 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "str"}, + "entity_availability_status": {"key": "properties.entityAvailabilityStatus", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "str"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "str", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "filtering_messages_before_publishing": {"key": "properties.filteringMessagesBeforePublishing", "type": "bool"}, + "is_anonymous_accessible": {"key": "properties.isAnonymousAccessible", "type": "bool"}, + "is_express": {"key": "properties.isExpress", "type": "bool"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, } def __init__( @@ -1817,18 +1788,18 @@ def __init__( requires_duplicate_detection: Optional[bool] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, support_ordering: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Topic name. :paramtype name: str - :keyword location: Required. Location of the resource. + :keyword location: Location of the resource. Required. :paramtype location: str :keyword auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. :paramtype auto_delete_on_idle: str :keyword entity_availability_status: Entity availability status for the topic. Known values - are: "Available", "Limited", "Renaming", "Restoring", "Unknown". + are: "Available", "Limited", "Renaming", "Restoring", and "Unknown". :paramtype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :keyword default_message_time_to_live: Default message time to live value. This is the duration @@ -1857,18 +1828,18 @@ def __init__( :paramtype is_express: bool :keyword max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. - :paramtype max_size_in_megabytes: long + :paramtype max_size_in_megabytes: int :keyword requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :paramtype requires_duplicate_detection: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", - "Restoring", "SendDisabled", "Unknown". + "Restoring", "SendDisabled", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool """ - super(TopicCreateOrUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.location = location self.accessed_at = None @@ -1893,7 +1864,7 @@ def __init__( self.updated_at = None -class TopicListResult(msrest.serialization.Model): +class TopicListResult(_serialization.Model): """The response to the List Topics operation. :ivar value: Result of the List Topics operation. @@ -1904,17 +1875,13 @@ class TopicListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[TopicResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TopicResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.TopicResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.TopicResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Topics operation. :paramtype value: list[~azure.mgmt.servicebus.v2015_08_01.models.TopicResource] @@ -1922,12 +1889,12 @@ def __init__( list of topics. :paramtype next_link: str """ - super(TopicListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class TopicResource(Resource): +class TopicResource(Resource): # pylint: disable=too-many-instance-attributes """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1946,7 +1913,7 @@ class TopicResource(Resource): deleted. The minimum duration is 5 minutes. :vartype auto_delete_on_idle: str :ivar entity_availability_status: Entity availability status for the topic. Known values are: - "Available", "Limited", "Renaming", "Restoring", "Unknown". + "Available", "Limited", "Renaming", "Restoring", and "Unknown". :vartype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :ivar created_at: Exact time the message was created. @@ -1979,15 +1946,15 @@ class TopicResource(Resource): :vartype is_express: bool :ivar max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. - :vartype max_size_in_megabytes: long + :vartype max_size_in_megabytes: int :ivar requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :vartype requires_duplicate_detection: bool :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", "Restoring", - "SendDisabled", "Unknown". + "SendDisabled", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :ivar subscription_count: Number of subscriptions. :vartype subscription_count: int @@ -1998,45 +1965,48 @@ class TopicResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'created_at': {'readonly': True}, - 'count_details': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'updated_at': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "accessed_at": {"readonly": True}, + "created_at": {"readonly": True}, + "count_details": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "subscription_count": {"readonly": True}, + "updated_at": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, - 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, - 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, - 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "str"}, + "entity_availability_status": {"key": "properties.entityAvailabilityStatus", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "str"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "str", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "filtering_messages_before_publishing": {"key": "properties.filteringMessagesBeforePublishing", "type": "bool"}, + "is_anonymous_accessible": {"key": "properties.isAnonymousAccessible", "type": "bool"}, + "is_express": {"key": "properties.isExpress", "type": "bool"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: Optional[str] = None, @@ -2054,8 +2024,8 @@ def __init__( requires_duplicate_detection: Optional[bool] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, support_ordering: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -2063,7 +2033,7 @@ def __init__( deleted. The minimum duration is 5 minutes. :paramtype auto_delete_on_idle: str :keyword entity_availability_status: Entity availability status for the topic. Known values - are: "Available", "Limited", "Renaming", "Restoring", "Unknown". + are: "Available", "Limited", "Renaming", "Restoring", and "Unknown". :paramtype entity_availability_status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus :keyword default_message_time_to_live: Default message time to live value. This is the duration @@ -2092,18 +2062,18 @@ def __init__( :paramtype is_express: bool :keyword max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. - :paramtype max_size_in_megabytes: long + :paramtype max_size_in_megabytes: int :keyword requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :paramtype requires_duplicate_detection: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", - "Restoring", "SendDisabled", "Unknown". + "Restoring", "SendDisabled", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool """ - super(TopicResource, self).__init__(location=location, **kwargs) + super().__init__(location=location, **kwargs) self.accessed_at = None self.auto_delete_on_idle = auto_delete_on_idle self.entity_availability_status = entity_availability_status diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py index c594d57bdc64..cbd05dcaf049 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py @@ -11,14 +11,15 @@ class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" + class EntityAvailabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity availability status. - """ + """Entity availability status.""" AVAILABLE = "Available" LIMITED = "Limited" @@ -26,9 +27,9 @@ class EntityAvailabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): RESTORING = "Restoring" UNKNOWN = "Unknown" + class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity status. - """ + """Entity status.""" ACTIVE = "Active" CREATING = "Creating" @@ -40,9 +41,9 @@ class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): SEND_DISABLED = "SendDisabled" UNKNOWN = "Unknown" + class NamespaceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the namespace. - """ + """State of the namespace.""" UNKNOWN = "Unknown" CREATING = "Creating" @@ -58,32 +59,32 @@ class NamespaceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): REMOVED = "Removed" FAILED = "Failed" + class Policykey(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Key that needs to be regenerated. - """ + """Key that needs to be regenerated.""" PRIMARY_KEY = "PrimaryKey" SECONDARY_KEY = "SecondaryKey" + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of this SKU. - """ + """Name of this SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The billing tier of this particular SKU. - """ + """The billing tier of this particular SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the reason for the unavailability of the service. - """ + """Specifies the reason for the unavailability of the service.""" NONE = "None" INVALID_NAME = "InvalidName" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py index b0ee9242d985..2051d27d13ae 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py @@ -13,14 +13,15 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'NamespacesOperations', - 'QueuesOperations', - 'TopicsOperations', - 'SubscriptionsOperations', + "Operations", + "NamespacesOperations", + "QueuesOperations", + "TopicsOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py index dede4df2a374..f12b816d5f70 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,518 +29,447 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NamespaceCreateOrUpdateParameters] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NamespaceUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_get_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.RegenerateKeysParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class NamespacesOperations: """ @@ -554,116 +490,169 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> Iterable[_models.NamespaceListResult]: + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NamespaceResource"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :return: An iterator like instance of either NamespaceResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], + template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -671,16 +660,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -690,64 +677,68 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.NamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NamespaceResource"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :return: An iterator like instance of either NamespaceResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -755,16 +746,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -774,52 +763,61 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } def _create_or_update_initial( self, resource_group_name: str, namespace_name: str, - parameters: _models.NamespaceCreateOrUpdateParameters, + parameters: Union[_models.NamespaceCreateOrUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.NamespaceResource]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.NamespaceResource]] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamespaceResource]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NamespaceCreateOrUpdateParameters") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -828,36 +826,125 @@ def _create_or_update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.NamespaceCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NamespaceResource]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NamespaceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NamespaceResource]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NamespaceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create_or_update( self, resource_group_name: str, namespace_name: str, - parameters: _models.NamespaceCreateOrUpdateParameters, + parameters: Union[_models.NamespaceCreateOrUpdateParameters, IO], **kwargs: Any ) -> LROPoller[_models.NamespaceResource]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Is either a + NamespaceCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -870,96 +957,89 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceResource] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NamespaceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -969,22 +1049,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -996,154 +1075,218 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.NamespaceResource: + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.NamespaceResource: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NamespaceResource, or the result of cls(response) + :return: NamespaceResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NamespaceResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.NamespaceResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def update( self, resource_group_name: str, namespace_name: str, parameters: _models.NamespaceUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.NamespaceResource]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.NamespaceResource]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.NamespaceResource]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + NamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NamespaceResource, or the result of cls(response) + :return: NamespaceResource or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.NamespaceResource]] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NamespaceResource]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1152,18 +1295,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1172,77 +1315,84 @@ def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('NamespaceResource', pipeline_response) + deserialized = self._deserialize("NamespaceResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.SharedAccessAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SharedAccessAuthorizationRuleResource"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + :return: An iterator like instance of either SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1250,16 +1400,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1269,50 +1417,134 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, IO], **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Is either a + SharedAccessAuthorizationRuleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedAccessAuthorizationRuleCreateOrUpdateParameters") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -1322,85 +1554,86 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1410,180 +1643,265 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.ResourceListKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateKeysParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceListKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateKeysParameters, IO], + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateKeysParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateKeysParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateKeysParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1593,30 +1911,31 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py index 2eb93e39c63f..3f3dbe4e489c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +27,38 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,52 +79,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,16 +136,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +153,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py index a7935179f693..4e0526611f66 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,205 +27,184 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_all_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - *, - json: Optional[_models.QueueCreateOrUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -227,47 +213,43 @@ def build_create_or_update_authorization_rule_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_post_authorization_rule_request( @@ -281,34 +263,35 @@ def build_post_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -321,28 +304,30 @@ def build_delete_authorization_rule_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_get_authorization_rule_request( @@ -356,34 +341,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -397,34 +383,35 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -433,47 +420,44 @@ def build_regenerate_keys_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateKeysParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class QueuesOperations: """ @@ -494,63 +478,68 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_all( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.QueueListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.QueueResource"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either QueueListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either QueueResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.QueueListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.QueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_all_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_all.metadata['url'], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_all_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -558,16 +547,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("QueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -577,49 +564,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.QueueCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.QueueResource: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.QueueResource: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueueResource, or the result of cls(response) + :return: QueueResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.QueueCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.QueueResource: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + QueueCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.QueueResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueueResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'QueueCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "QueueCreateOrUpdateParameters") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -629,85 +698,86 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueueResource', pipeline_response) + deserialized = self._deserialize("QueueResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -717,139 +787,145 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.QueueResource: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueueResource, or the result of cls(response) + :return: QueueResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.QueueResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.QueueResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueueResource', pipeline_response) + deserialized = self._deserialize("QueueResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> Iterable[_models.SharedAccessAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SharedAccessAuthorizationRuleResource"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + :return: An iterator like instance of either SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -857,16 +933,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -876,13 +950,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -890,39 +964,120 @@ def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a + SharedAccessAuthorizationRuleCreateOrUpdateParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedAccessAuthorizationRuleCreateOrUpdateParameters") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -933,33 +1088,34 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def post_authorization_rule( @@ -972,31 +1128,36 @@ def post_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_post_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1004,33 +1165,33 @@ def post_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.post_authorization_rule.metadata['url'], + template_url=self.post_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + post_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -1043,31 +1204,36 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1075,18 +1241,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1096,8 +1261,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -1110,31 +1276,36 @@ def get_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1142,33 +1313,33 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -1181,31 +1352,36 @@ def list_keys( ) -> _models.ResourceListKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1213,35 +1389,35 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -1249,38 +1425,126 @@ def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateKeysParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceListKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateKeysParameters, IO], + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateKeysParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateKeysParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateKeysParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1291,30 +1555,31 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py index d4663e9a9beb..c759d4db527c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,52 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_all_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -72,47 +81,41 @@ def build_create_or_update_request( topic_name: str, subscription_name: str, subscription_id: str, - *, - json: Optional[_models.SubscriptionCreateOrUpdateParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -125,28 +128,28 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_get_request( @@ -160,34 +163,34 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SubscriptionsOperations: """ @@ -208,70 +211,73 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_all( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SubscriptionListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SubscriptionResource"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionListResult or the result of + :return: An iterator like instance of either SubscriptionResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_all_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_all.metadata['url'], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_all_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -279,16 +285,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -298,13 +302,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -312,39 +316,128 @@ def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SubscriptionCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SubscriptionResource: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SubscriptionResource, or the result of cls(response) + :return: SubscriptionResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SubscriptionResource: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SubscriptionCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.SubscriptionResource: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SubscriptionCreateOrUpdateParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SubscriptionResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SubscriptionCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SubscriptionCreateOrUpdateParameters") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -355,70 +448,71 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SubscriptionResource', pipeline_response) + deserialized = self._deserialize("SubscriptionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -426,18 +520,17 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -447,45 +540,46 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SubscriptionResource: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SubscriptionResource, or the result of cls(response) + :return: SubscriptionResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SubscriptionResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -493,30 +587,30 @@ def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SubscriptionResource', pipeline_response) + deserialized = self._deserialize("SubscriptionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py index 12313316a6e4..40631f9e5bba 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,205 +27,184 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_all_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - *, - json: Optional[_models.TopicCreateOrUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -227,47 +213,43 @@ def build_create_or_update_authorization_rule_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_post_authorization_rule_request( @@ -281,34 +263,35 @@ def build_post_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -322,34 +305,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -362,28 +346,30 @@ def build_delete_authorization_rule_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_list_keys_request( @@ -397,34 +383,35 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -433,47 +420,44 @@ def build_regenerate_keys_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateKeysParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class TopicsOperations: """ @@ -494,63 +478,68 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_all( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.TopicListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.TopicResource"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TopicListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either TopicResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopicListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.TopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_all_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_all.metadata['url'], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_all_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -558,16 +547,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -577,49 +564,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.TopicCreateOrUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TopicResource: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TopicResource: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TopicResource, or the result of cls(response) + :return: TopicResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.TopicCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.TopicResource: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a + TopicCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopicResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TopicResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'TopicCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TopicCreateOrUpdateParameters") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -629,85 +698,86 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TopicResource', pipeline_response) + deserialized = self._deserialize("TopicResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -717,139 +787,145 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.TopicResource: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TopicResource, or the result of cls(response) + :return: TopicResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopicResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.TopicResource] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TopicResource', pipeline_response) + deserialized = self._deserialize("TopicResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SharedAccessAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SharedAccessAuthorizationRuleResource"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + :return: An iterator like instance of either SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleListResult] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -857,16 +933,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -876,13 +950,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -890,39 +964,129 @@ def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SharedAccessAuthorizationRuleResource: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.SharedAccessAuthorizationRuleResource: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a + SharedAccessAuthorizationRuleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedAccessAuthorizationRuleCreateOrUpdateParameters") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -933,33 +1097,34 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def post_authorization_rule( @@ -972,31 +1137,36 @@ def post_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_post_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1004,33 +1174,33 @@ def post_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.post_authorization_rule.metadata['url'], + template_url=self.post_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + post_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -1043,31 +1213,36 @@ def get_authorization_rule( ) -> _models.SharedAccessAuthorizationRuleResource: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :return: SharedAccessAuthorizationRuleResource or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SharedAccessAuthorizationRuleResource] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.SharedAccessAuthorizationRuleResource] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1075,33 +1250,33 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -1114,31 +1289,36 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1146,18 +1326,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1167,8 +1346,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -1181,31 +1361,36 @@ def list_keys( ) -> _models.ResourceListKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1213,35 +1398,35 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -1249,38 +1434,126 @@ def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateKeysParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceListKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListKeys, or the result of cls(response) + :return: ResourceListKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateKeysParameters, IO], + **kwargs: Any + ) -> _models.ResourceListKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateKeysParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListKeys] + api_version: Literal["2015-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceListKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateKeysParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateKeysParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1291,30 +1564,31 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceListKeys', pipeline_response) + deserialized = self._deserialize("ResourceListKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py index 221541a00fb6..2e171d69863b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py index 9d9d0c72d087..4e54d8afb8a3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2017-04-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2017-04-01") # type: str + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", "2017-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,23 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json index d03a673a307f..888cb0596824 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -109,4 +117,4 @@ "regions": "RegionsOperations", "subscriptions": "SubscriptionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py index 249f40ddf467..7882d2121d23 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, EventHubsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PremiumMessagingRegionsOperations, QueuesOperations, RegionsOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + EventHubsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PremiumMessagingRegionsOperations, + QueuesOperations, + RegionsOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client. :ivar namespaces: NamespacesOperations operations @@ -50,10 +62,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :vartype regions: azure.mgmt.servicebus.v2017_04_01.operations.RegionsOperations :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2017_04_01.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,53 +83,34 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.event_hubs = EventHubsOperations(self._client, self._config, self._serialize, self._deserialize) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.premium_messaging_regions = PremiumMessagingRegionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -126,7 +119,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -139,15 +132,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient + def __enter__(self) -> "ServiceBusManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_vendor.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py index e7dd87df1f93..530b8638dfd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py index 866336bb0959..9e93f841b2de 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2017-04-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2017-04-01") # type: str + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", "2017-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,22 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py index 749cedf823ea..bb082599b797 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, EventHubsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PremiumMessagingRegionsOperations, QueuesOperations, RegionsOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + EventHubsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PremiumMessagingRegionsOperations, + QueuesOperations, + RegionsOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client. :ivar namespaces: NamespacesOperations operations @@ -51,10 +63,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2017_04_01.aio.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -72,53 +84,34 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.event_hubs = EventHubsOperations(self._client, self._config, self._serialize, self._deserialize) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.premium_messaging_regions = PremiumMessagingRegionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -127,7 +120,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -147,5 +140,5 @@ async def __aenter__(self) -> "ServiceBusManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py index 02badefef72e..dbb5c8284b01 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py @@ -19,20 +19,21 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'QueuesOperations', - 'TopicsOperations', - 'DisasterRecoveryConfigsOperations', - 'EventHubsOperations', - 'MigrationConfigsOperations', - 'Operations', - 'PremiumMessagingRegionsOperations', - 'RulesOperations', - 'RegionsOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "QueuesOperations", + "TopicsOperations", + "DisasterRecoveryConfigsOperations", + "EventHubsOperations", + "MigrationConfigsOperations", + "Operations", + "PremiumMessagingRegionsOperations", + "RulesOperations", + "RegionsOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py index 743016e9ff7d..149eff5eebc9 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._disaster_recovery_configs_operations import build_break_pairing_request, build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_fail_over_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request -T = TypeVar('T') +from ...operations._disaster_recovery_configs_operations import ( + build_break_pairing_request, + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_fail_over_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class DisasterRecoveryConfigsOperations: """ .. warning:: @@ -43,41 +69,107 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -86,18 +178,18 @@ async def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,74 +197,77 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -180,16 +275,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -200,49 +293,124 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -252,18 +420,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -273,67 +441,65 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,60 +510,58 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,68 +569,66 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,60 +639,58 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } @distributed_trace_async async def fail_over( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_fail_over_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.fail_over.metadata['url'], + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,72 +701,76 @@ async def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -614,16 +778,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -634,48 +796,48 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -683,18 +845,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -702,52 +863,53 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -755,18 +917,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -774,12 +935,13 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py index 07825d2e1437..31bfd2435a9a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._event_hubs_operations import build_list_by_namespace_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class EventHubsOperations: """ .. warning:: @@ -42,64 +57,66 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_namespace( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.EventHubListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Eventhub"]: """Gets all the Event Hubs in a service bus Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :return: An iterator like instance of either Eventhub or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.EventHubListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.Eventhub] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.EventHubListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_namespace.metadata['url'], + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -107,16 +124,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,8 +142,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py index 83016da8a6d6..803bb1b36ce4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,23 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._migration_configs_operations import build_complete_migration_request, build_create_and_start_migration_request_initial, build_delete_request, build_get_request, build_list_request, build_revert_request -T = TypeVar('T') +from ...operations._migration_configs_operations import ( + build_complete_migration_request, + build_create_and_start_migration_request, + build_delete_request, + build_get_request, + build_list_request, + build_revert_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MigrationConfigsOperations: """ .. warning:: @@ -45,65 +67,67 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +135,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,35 +153,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } async def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'MigrationConfigProperties') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") - request = build_create_and_start_migration_request_initial( + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -167,56 +198,142 @@ async def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } - - @distributed_trace_async + @overload async def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -229,113 +346,109 @@ async def begin_create_and_start_migration( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_and_start_migration_initial( # type: ignore + raw_result = await self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -346,60 +459,62 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,69 +522,71 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -480,60 +597,62 @@ async def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace_async async def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -544,5 +663,6 @@ async def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py index bb8e82ba64c7..5d6188e5b73a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,34 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._namespaces_operations import build_check_name_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_network_rule_set_request, build_create_or_update_request_initial, build_delete_authorization_rule_request, build_delete_request_initial, build_get_authorization_rule_request, build_get_network_rule_set_request, build_get_request, build_list_authorization_rules_request, build_list_by_resource_group_request, build_list_keys_request, build_list_network_rule_sets_request, build_list_request, build_migrate_request, build_regenerate_keys_request, build_update_request -T = TypeVar('T') +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_network_rule_set_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_network_rule_set_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_keys_request, + build_list_network_rule_sets_request, + build_list_request, + build_migrate_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class NamespacesOperations: """ .. warning:: @@ -45,65 +78,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +148,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,49 +166,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -183,18 +300,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,67 +319,68 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -273,60 +391,61 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,67 +453,68 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -402,53 +522,136 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -458,18 +661,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,62 +680,108 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -540,50 +789,118 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } - @distributed_trace_async + @overload async def migrate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceMigrate, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """This operation Migrate the given namespace to provided name type. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to migrate namespace type. + :param parameters: Parameters supplied to migrate namespace type. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceMigrate, IO], + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Is either a + SBNamespaceMigrate type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceMigrate') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceMigrate") request = build_migrate_request( resource_group_name=resource_group_name, @@ -592,18 +909,18 @@ async def migrate( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.migrate.metadata['url'], + content=_content, + template_url=self.migrate.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -614,57 +931,65 @@ async def migrate( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - migrate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate"} # type: ignore - + migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate" + } @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -672,16 +997,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -692,65 +1015,68 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -758,16 +1084,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -778,90 +1102,105 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } async def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespace') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -874,121 +1213,189 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1000,103 +1407,97 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1104,51 +1505,121 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1157,18 +1628,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1178,53 +1649,121 @@ async def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - - @distributed_trace_async + @overload async def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -1233,18 +1772,18 @@ async def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1252,63 +1791,62 @@ async def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace_async async def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1316,74 +1854,77 @@ async def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1391,16 +1932,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1411,8 +1950,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py index 956ee24cfe1b..df484d5a7b51 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,52 +57,57 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -95,16 +115,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,8 +133,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py index a9cf8690163e..15819c78877f 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._premium_messaging_regions_operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PremiumMessagingRegionsOperations: """ .. warning:: @@ -42,55 +57,59 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.PremiumMessagingRegionsListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.PremiumMessagingRegions"]: """Gets the available premium messaging regions for servicebus. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -98,16 +117,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -118,8 +135,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py index 5fbdc0c15c43..e5c34f151029 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queues_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class QueuesOperations: """ .. warning:: @@ -43,70 +69,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +142,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +160,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +174,117 @@ async def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +295,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +314,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -230,31 +336,36 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +373,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -284,8 +394,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -298,31 +409,36 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -330,18 +446,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,15 +464,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +486,36 @@ async def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +523,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +541,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,38 +560,126 @@ async def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -481,18 +690,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -500,15 +709,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -518,12 +728,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBQueueListResult]: + ) -> AsyncIterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -533,53 +746,57 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :return: An iterator like instance of either SBQueue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -587,16 +804,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -607,49 +822,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -659,18 +956,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -678,67 +975,68 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -749,60 +1047,61 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -810,12 +1109,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py index 67a69b7ed6c5..25e1cf16f489 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._regions_operations import build_list_by_sku_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RegionsOperations: """ .. warning:: @@ -42,60 +57,62 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_sku( - self, - sku: str, - **kwargs: Any - ) -> AsyncIterable[_models.PremiumMessagingRegionsListResult]: + def list_by_sku(self, sku: str, **kwargs: Any) -> AsyncIterable["_models.PremiumMessagingRegions"]: """Gets the available Regions for a given sku. - :param sku: The sku type. + :param sku: The sku type. Required. :type sku: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, sku=sku, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_sku.metadata['url'], + template_url=self.list_by_sku.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, - sku=sku, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -103,16 +120,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,8 +138,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_sku.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} # type: ignore + list_by_sku.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py index 9ca2cb43ddca..da6f3e0af17d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscriptions_request -T = TypeVar('T') +from ...operations._rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscriptions_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RulesOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -54,16 +73,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.RuleListResult]: + ) -> AsyncIterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -73,57 +92,58 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,16 +151,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,13 +169,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -166,40 +184,125 @@ async def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -211,18 +314,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,15 +333,16 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -252,33 +356,35 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -287,18 +393,17 @@ async def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -309,8 +414,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def get( @@ -324,33 +430,35 @@ async def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -359,18 +467,17 @@ async def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,12 +485,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py index 861b32e683c2..42aa40b3e8eb 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_topic_request -T = TypeVar('T') +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_topic_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SubscriptionsOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -53,14 +72,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBSubscriptionListResult]: + ) -> AsyncIterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -70,56 +92,58 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,16 +151,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,13 +169,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -161,38 +183,126 @@ async def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -203,18 +313,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -222,52 +332,53 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -275,18 +386,17 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -297,45 +407,46 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -343,18 +454,17 @@ async def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -362,12 +472,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py index 4814085f44a2..1872dafc2292 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._topics_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopicsOperations: """ .. warning:: @@ -43,70 +69,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +142,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +160,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +174,126 @@ async def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +304,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +323,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -230,31 +345,36 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +382,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,15 +400,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -302,31 +422,36 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -334,18 +459,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -356,8 +480,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +495,36 @@ async def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +532,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +550,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,38 +569,126 @@ async def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -481,18 +699,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -500,15 +718,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -518,12 +737,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBTopicListResult]: + ) -> AsyncIterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -533,53 +755,57 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :return: An iterator like instance of either SBTopic or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -587,16 +813,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -607,49 +831,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -659,18 +965,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -678,67 +984,68 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -749,60 +1056,61 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -810,12 +1118,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py index 9757ddefc7b6..b4d14fae1e81 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py @@ -56,90 +56,88 @@ from ._models_py3 import Subnet from ._models_py3 import TrackedResource - -from ._service_bus_management_client_enums import ( - AccessRights, - DefaultAction, - EncodingCaptureDescription, - EntityStatus, - FilterType, - KeyType, - MigrationConfigurationName, - NameSpaceType, - NetworkRuleIPAction, - ProvisioningStateDR, - RoleDisasterRecovery, - SkuName, - SkuTier, - UnavailableReason, -) +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import DefaultAction +from ._service_bus_management_client_enums import EncodingCaptureDescription +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import FilterType +from ._service_bus_management_client_enums import KeyType +from ._service_bus_management_client_enums import MigrationConfigurationName +from ._service_bus_management_client_enums import NameSpaceType +from ._service_bus_management_client_enums import NetworkRuleIPAction +from ._service_bus_management_client_enums import ProvisioningStateDR +from ._service_bus_management_client_enums import RoleDisasterRecovery +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import UnavailableReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccessKeys', - 'Action', - 'ArmDisasterRecovery', - 'ArmDisasterRecoveryListResult', - 'CaptureDescription', - 'CheckNameAvailability', - 'CheckNameAvailabilityResult', - 'CorrelationFilter', - 'Destination', - 'ErrorAdditionalInfo', - 'ErrorResponse', - 'ErrorResponseError', - 'EventHubListResult', - 'Eventhub', - 'MessageCountDetails', - 'MigrationConfigListResult', - 'MigrationConfigProperties', - 'NWRuleSetIpRules', - 'NWRuleSetVirtualNetworkRules', - 'NetworkRuleSet', - 'NetworkRuleSetListResult', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'PremiumMessagingRegions', - 'PremiumMessagingRegionsListResult', - 'PremiumMessagingRegionsProperties', - 'RegenerateAccessKeyParameters', - 'Resource', - 'ResourceNamespacePatch', - 'Rule', - 'RuleListResult', - 'SBAuthorizationRule', - 'SBAuthorizationRuleListResult', - 'SBNamespace', - 'SBNamespaceListResult', - 'SBNamespaceMigrate', - 'SBNamespaceUpdateParameters', - 'SBQueue', - 'SBQueueListResult', - 'SBSku', - 'SBSubscription', - 'SBSubscriptionListResult', - 'SBTopic', - 'SBTopicListResult', - 'SqlFilter', - 'SqlRuleAction', - 'Subnet', - 'TrackedResource', - 'AccessRights', - 'DefaultAction', - 'EncodingCaptureDescription', - 'EntityStatus', - 'FilterType', - 'KeyType', - 'MigrationConfigurationName', - 'NameSpaceType', - 'NetworkRuleIPAction', - 'ProvisioningStateDR', - 'RoleDisasterRecovery', - 'SkuName', - 'SkuTier', - 'UnavailableReason', + "AccessKeys", + "Action", + "ArmDisasterRecovery", + "ArmDisasterRecoveryListResult", + "CaptureDescription", + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "CorrelationFilter", + "Destination", + "ErrorAdditionalInfo", + "ErrorResponse", + "ErrorResponseError", + "EventHubListResult", + "Eventhub", + "MessageCountDetails", + "MigrationConfigListResult", + "MigrationConfigProperties", + "NWRuleSetIpRules", + "NWRuleSetVirtualNetworkRules", + "NetworkRuleSet", + "NetworkRuleSetListResult", + "Operation", + "OperationDisplay", + "OperationListResult", + "PremiumMessagingRegions", + "PremiumMessagingRegionsListResult", + "PremiumMessagingRegionsProperties", + "RegenerateAccessKeyParameters", + "Resource", + "ResourceNamespacePatch", + "Rule", + "RuleListResult", + "SBAuthorizationRule", + "SBAuthorizationRuleListResult", + "SBNamespace", + "SBNamespaceListResult", + "SBNamespaceMigrate", + "SBNamespaceUpdateParameters", + "SBQueue", + "SBQueueListResult", + "SBSku", + "SBSubscription", + "SBSubscriptionListResult", + "SBTopic", + "SBTopicListResult", + "SqlFilter", + "SqlRuleAction", + "Subnet", + "TrackedResource", + "AccessRights", + "DefaultAction", + "EncodingCaptureDescription", + "EntityStatus", + "FilterType", + "KeyType", + "MigrationConfigurationName", + "NameSpaceType", + "NetworkRuleIPAction", + "ProvisioningStateDR", + "RoleDisasterRecovery", + "SkuName", + "SkuTier", + "UnavailableReason", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py index 919aaa6fd79c..3eaa006e7a79 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class AccessKeys(msrest.serialization.Model): +class AccessKeys(_serialization.Model): """Namespace/ServiceBus Connection String. Variables are only populated by the server, and will be ignored when sending a request. @@ -45,32 +45,28 @@ class AccessKeys(msrest.serialization.Model): """ _validation = { - 'primary_connection_string': {'readonly': True}, - 'secondary_connection_string': {'readonly': True}, - 'alias_primary_connection_string': {'readonly': True}, - 'alias_secondary_connection_string': {'readonly': True}, - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - 'key_name': {'readonly': True}, + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + "alias_primary_connection_string": {"readonly": True}, + "alias_secondary_connection_string": {"readonly": True}, + "primary_key": {"readonly": True}, + "secondary_key": {"readonly": True}, + "key_name": {"readonly": True}, } _attribute_map = { - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, - 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AccessKeys, self).__init__(**kwargs) + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "alias_primary_connection_string": {"key": "aliasPrimaryConnectionString", "type": "str"}, + "alias_secondary_connection_string": {"key": "aliasSecondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.primary_connection_string = None self.secondary_connection_string = None self.alias_primary_connection_string = None @@ -80,8 +76,9 @@ def __init__( self.key_name = None -class Action(msrest.serialization.Model): - """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. +class Action(_serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have + been matched by a filter expression. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -94,9 +91,9 @@ class Action(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -104,9 +101,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -117,13 +114,13 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource definition for other than namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -137,24 +134,20 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -173,11 +166,11 @@ class ArmDisasterRecovery(Resource): :vartype type: str :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Known values are: "Accepted", - "Succeeded", "Failed". + "Succeeded", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2017_04_01.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. :vartype partner_namespace: str @@ -185,37 +178,33 @@ class ArmDisasterRecovery(Resource): pairing. :vartype alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' - or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", "Secondary". + or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", and "Secondary". :vartype role: str or ~azure.mgmt.servicebus.v2017_04_01.models.RoleDisasterRecovery """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'role': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "role": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "partner_namespace": {"key": "properties.partnerNamespace", "type": "str"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "role": {"key": "properties.role", "type": "str"}, } def __init__( - self, - *, - partner_namespace: Optional[str] = None, - alternate_name: Optional[str] = None, - **kwargs - ): + self, *, partner_namespace: Optional[str] = None, alternate_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. @@ -224,7 +213,7 @@ def __init__( pairing. :paramtype alternate_name: str """ - super(ArmDisasterRecovery, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.pending_replication_operations_count = None self.partner_namespace = partner_namespace @@ -232,7 +221,7 @@ def __init__( self.role = None -class ArmDisasterRecoveryListResult(msrest.serialization.Model): +class ArmDisasterRecoveryListResult(_serialization.Model): """The result of the List Alias(Disaster Recovery configuration) operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -245,36 +234,31 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ArmDisasterRecovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ArmDisasterRecovery"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ArmDisasterRecovery"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Alias(Disaster Recovery configurations). :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery] """ - super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CaptureDescription(msrest.serialization.Model): +class CaptureDescription(_serialization.Model): """Properties to configure capture description for eventhub. :ivar enabled: A value that indicates whether capture description is enabled. :vartype enabled: bool :ivar encoding: Enumerates the possible values for the encoding format of capture description. - Known values are: "Avro", "AvroDeflate". + Known values are: "Avro" and "AvroDeflate". :vartype encoding: str or ~azure.mgmt.servicebus.v2017_04_01.models.EncodingCaptureDescription :ivar interval_in_seconds: The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. @@ -288,16 +272,16 @@ class CaptureDescription(msrest.serialization.Model): """ _validation = { - 'interval_in_seconds': {'maximum': 900, 'minimum': 60}, - 'size_limit_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + "interval_in_seconds": {"maximum": 900, "minimum": 60}, + "size_limit_in_bytes": {"maximum": 524288000, "minimum": 10485760}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encoding': {'key': 'encoding', 'type': 'str'}, - 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, - 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, - 'destination': {'key': 'destination', 'type': 'Destination'}, + "enabled": {"key": "enabled", "type": "bool"}, + "encoding": {"key": "encoding", "type": "str"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + "size_limit_in_bytes": {"key": "sizeLimitInBytes", "type": "int"}, + "destination": {"key": "destination", "type": "Destination"}, } def __init__( @@ -308,13 +292,13 @@ def __init__( interval_in_seconds: Optional[int] = None, size_limit_in_bytes: Optional[int] = None, destination: Optional["_models.Destination"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: A value that indicates whether capture description is enabled. :paramtype enabled: bool :keyword encoding: Enumerates the possible values for the encoding format of capture - description. Known values are: "Avro", "AvroDeflate". + description. Known values are: "Avro" and "AvroDeflate". :paramtype encoding: str or ~azure.mgmt.servicebus.v2017_04_01.models.EncodingCaptureDescription :keyword interval_in_seconds: The time window allows you to set the frequency with which the @@ -327,7 +311,7 @@ def __init__( Blob Names). :paramtype destination: ~azure.mgmt.servicebus.v2017_04_01.models.Destination """ - super(CaptureDescription, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.encoding = encoding self.interval_in_seconds = interval_in_seconds @@ -335,42 +319,37 @@ def __init__( self.destination = destination -class CheckNameAvailability(msrest.serialization.Model): +class CheckNameAvailability(_serialization.Model): """Description of a Check Name availability request properties. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The Name to check the namespace name availability and The namespace name - can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it - must end with a letter or number. + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The Name to check the namespace name availability and The namespace - name can contain only letters, numbers, and hyphens. The namespace must start with a letter, - and it must end with a letter or number. + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :paramtype name: str """ - super(CheckNameAvailability, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(msrest.serialization.Model): +class CheckNameAvailabilityResult(_serialization.Model): """Description of a Check Name availability request properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -381,19 +360,19 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): available; otherwise, false. :vartype name_available: bool :ivar reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :vartype reason: str or ~azure.mgmt.servicebus.v2017_04_01.models.UnavailableReason """ _validation = { - 'message': {'readonly': True}, + "message": {"readonly": True}, } _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "message": {"key": "message", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, } def __init__( @@ -401,24 +380,24 @@ def __init__( *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.UnavailableReason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Value indicating namespace is availability, true if the namespace is available; otherwise, false. :paramtype name_available: bool :keyword reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :paramtype reason: str or ~azure.mgmt.servicebus.v2017_04_01.models.UnavailableReason """ - super(CheckNameAvailabilityResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.message = None self.name_available = name_available self.reason = reason -class CorrelationFilter(msrest.serialization.Model): +class CorrelationFilter(_serialization.Model): """Represents the correlation filter expression. :ivar properties: dictionary object for custom filters. @@ -445,16 +424,16 @@ class CorrelationFilter(msrest.serialization.Model): """ _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'message_id': {'key': 'messageId', 'type': 'str'}, - 'to': {'key': 'to', 'type': 'str'}, - 'reply_to': {'key': 'replyTo', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "properties": {"key": "properties", "type": "{str}"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "message_id": {"key": "messageId", "type": "str"}, + "to": {"key": "to", "type": "str"}, + "reply_to": {"key": "replyTo", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "session_id": {"key": "sessionId", "type": "str"}, + "reply_to_session_id": {"key": "replyToSessionId", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -469,9 +448,9 @@ def __init__( session_id: Optional[str] = None, reply_to_session_id: Optional[str] = None, content_type: Optional[str] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword properties: dictionary object for custom filters. :paramtype properties: dict[str, str] @@ -495,7 +474,7 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(CorrelationFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties self.correlation_id = correlation_id self.message_id = message_id @@ -508,7 +487,7 @@ def __init__( self.requires_preprocessing = requires_preprocessing -class Destination(msrest.serialization.Model): +class Destination(_serialization.Model): """Capture storage details for capture description. :ivar name: Name for capture destination. @@ -525,10 +504,10 @@ class Destination(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'blob_container': {'key': 'properties.blobContainer', 'type': 'str'}, - 'archive_name_format': {'key': 'properties.archiveNameFormat', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "storage_account_resource_id": {"key": "properties.storageAccountResourceId", "type": "str"}, + "blob_container": {"key": "properties.blobContainer", "type": "str"}, + "archive_name_format": {"key": "properties.archiveNameFormat", "type": "str"}, } def __init__( @@ -538,8 +517,8 @@ def __init__( storage_account_resource_id: Optional[str] = None, blob_container: Optional[str] = None, archive_name_format: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name for capture destination. :paramtype name: str @@ -553,14 +532,14 @@ def __init__( the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. :paramtype archive_name_format: str """ - super(Destination, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.storage_account_resource_id = storage_account_resource_id self.blob_container = blob_container self.archive_name_format = archive_name_format -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -568,31 +547,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -600,24 +575,19 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + "error": {"key": "error", "type": "ErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponseError """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ErrorResponseError(msrest.serialization.Model): +class ErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -635,28 +605,24 @@ class ErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -683,40 +649,40 @@ class Eventhub(Resource): :vartype updated_at: ~datetime.datetime :ivar message_retention_in_days: Number of days to retain the events for this Event Hub, value should be 1 to 7 days. - :vartype message_retention_in_days: long + :vartype message_retention_in_days: int :ivar partition_count: Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. - :vartype partition_count: long + :vartype partition_count: int :ivar status: Enumerates the possible values for the status of a Event Hub. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", - "Renaming", "Unknown". + "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :ivar capture_description: Properties of capture description. :vartype capture_description: ~azure.mgmt.servicebus.v2017_04_01.models.CaptureDescription """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'partition_ids': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'message_retention_in_days': {'maximum': 7, 'minimum': 1}, - 'partition_count': {'maximum': 32, 'minimum': 1}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "partition_ids": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "message_retention_in_days": {"maximum": 7, "minimum": 1}, + "partition_count": {"maximum": 32, "minimum": 1}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'partition_ids': {'key': 'properties.partitionIds', 'type': '[str]'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'message_retention_in_days': {'key': 'properties.messageRetentionInDays', 'type': 'long'}, - 'partition_count': {'key': 'properties.partitionCount', 'type': 'long'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'capture_description': {'key': 'properties.captureDescription', 'type': 'CaptureDescription'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "partition_ids": {"key": "properties.partitionIds", "type": "[str]"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "message_retention_in_days": {"key": "properties.messageRetentionInDays", "type": "int"}, + "partition_count": {"key": "properties.partitionCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "capture_description": {"key": "properties.captureDescription", "type": "CaptureDescription"}, } def __init__( @@ -726,23 +692,23 @@ def __init__( partition_count: Optional[int] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, capture_description: Optional["_models.CaptureDescription"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message_retention_in_days: Number of days to retain the events for this Event Hub, value should be 1 to 7 days. - :paramtype message_retention_in_days: long + :paramtype message_retention_in_days: int :keyword partition_count: Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. - :paramtype partition_count: long + :paramtype partition_count: int :keyword status: Enumerates the possible values for the status of a Event Hub. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :keyword capture_description: Properties of capture description. :paramtype capture_description: ~azure.mgmt.servicebus.v2017_04_01.models.CaptureDescription """ - super(Eventhub, self).__init__(**kwargs) + super().__init__(**kwargs) self.partition_ids = None self.created_at = None self.updated_at = None @@ -752,7 +718,7 @@ def __init__( self.capture_description = capture_description -class EventHubListResult(msrest.serialization.Model): +class EventHubListResult(_serialization.Model): """The result of the List EventHubs operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -765,70 +731,61 @@ class EventHubListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Eventhub]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Eventhub]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Eventhub"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Eventhub"]] = None, **kwargs: Any) -> None: """ :keyword value: Result of the List EventHubs operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.Eventhub] """ - super(EventHubListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class MessageCountDetails(msrest.serialization.Model): +class MessageCountDetails(_serialization.Model): """Message Count Details. Variables are only populated by the server, and will be ignored when sending a request. :ivar active_message_count: Number of active messages in the queue, topic, or subscription. - :vartype active_message_count: long + :vartype active_message_count: int :ivar dead_letter_message_count: Number of messages that are dead lettered. - :vartype dead_letter_message_count: long + :vartype dead_letter_message_count: int :ivar scheduled_message_count: Number of scheduled messages. - :vartype scheduled_message_count: long + :vartype scheduled_message_count: int :ivar transfer_message_count: Number of messages transferred to another queue, topic, or subscription. - :vartype transfer_message_count: long + :vartype transfer_message_count: int :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. - :vartype transfer_dead_letter_message_count: long + :vartype transfer_dead_letter_message_count: int """ _validation = { - 'active_message_count': {'readonly': True}, - 'dead_letter_message_count': {'readonly': True}, - 'scheduled_message_count': {'readonly': True}, - 'transfer_message_count': {'readonly': True}, - 'transfer_dead_letter_message_count': {'readonly': True}, + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, } _attribute_map = { - 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, - 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, - 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, - 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, - 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MessageCountDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.active_message_count = None self.dead_letter_message_count = None self.scheduled_message_count = None @@ -836,7 +793,7 @@ def __init__( self.transfer_dead_letter_message_count = None -class MigrationConfigListResult(msrest.serialization.Model): +class MigrationConfigListResult(_serialization.Model): """The result of the List migrationConfigurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -849,25 +806,20 @@ class MigrationConfigListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationConfigProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MigrationConfigProperties"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MigrationConfigProperties"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Migration Configs. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] """ - super(MigrationConfigListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None @@ -886,7 +838,7 @@ class MigrationConfigProperties(Resource): :ivar provisioning_state: Provisioning state of Migration Configuration. :vartype provisioning_state: str :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. :vartype target_namespace: str @@ -898,32 +850,28 @@ class MigrationConfigProperties(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'migration_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "migration_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, - 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, - 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "target_namespace": {"key": "properties.targetNamespace", "type": "str"}, + "post_migration_name": {"key": "properties.postMigrationName", "type": "str"}, + "migration_state": {"key": "properties.migrationState", "type": "str"}, } def __init__( - self, - *, - target_namespace: Optional[str] = None, - post_migration_name: Optional[str] = None, - **kwargs - ): + self, *, target_namespace: Optional[str] = None, post_migration_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. @@ -931,7 +879,7 @@ def __init__( :keyword post_migration_name: Name to access Standard Namespace after migration. :paramtype post_migration_name: str """ - super(MigrationConfigProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.pending_replication_operations_count = None self.target_namespace = target_namespace @@ -950,7 +898,8 @@ class NetworkRuleSet(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow", "Deny". + :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". :vartype default_action: str or ~azure.mgmt.servicebus.v2017_04_01.models.DefaultAction :ivar virtual_network_rules: List VirtualNetwork Rules. :vartype virtual_network_rules: @@ -960,18 +909,18 @@ class NetworkRuleSet(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "default_action": {"key": "properties.defaultAction", "type": "str"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[NWRuleSetVirtualNetworkRules]"}, + "ip_rules": {"key": "properties.ipRules", "type": "[NWRuleSetIpRules]"}, } def __init__( @@ -980,10 +929,10 @@ def __init__( default_action: Optional[Union[str, "_models.DefaultAction"]] = None, virtual_network_rules: Optional[List["_models.NWRuleSetVirtualNetworkRules"]] = None, ip_rules: Optional[List["_models.NWRuleSetIpRules"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow", + :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow" and "Deny". :paramtype default_action: str or ~azure.mgmt.servicebus.v2017_04_01.models.DefaultAction :keyword virtual_network_rules: List VirtualNetwork Rules. @@ -992,13 +941,13 @@ def __init__( :keyword ip_rules: List of IpRules. :paramtype ip_rules: list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetIpRules] """ - super(NetworkRuleSet, self).__init__(**kwargs) + super().__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules self.ip_rules = ip_rules -class NetworkRuleSetListResult(msrest.serialization.Model): +class NetworkRuleSetListResult(_serialization.Model): """The response of the List NetworkRuleSet operation. :ivar value: Result of the List NetworkRuleSet operation. @@ -1009,17 +958,13 @@ class NetworkRuleSetListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NetworkRuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.NetworkRuleSet"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.NetworkRuleSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List NetworkRuleSet operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet] @@ -1027,44 +972,44 @@ def __init__( list of NetworkRuleSet. :paramtype next_link: str """ - super(NetworkRuleSetListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class NWRuleSetIpRules(msrest.serialization.Model): +class NWRuleSetIpRules(_serialization.Model): """Description of NetWorkRuleSet - IpRules resource. :ivar ip_mask: IP Mask. :vartype ip_mask: str - :ivar action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :ivar action: The IP Filter Action. "Allow" :vartype action: str or ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleIPAction """ _attribute_map = { - 'ip_mask': {'key': 'ipMask', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, + "ip_mask": {"key": "ipMask", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "_models.NetworkRuleIPAction"]] = "Allow", - **kwargs - ): + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword ip_mask: IP Mask. :paramtype ip_mask: str - :keyword action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :keyword action: The IP Filter Action. "Allow" :paramtype action: str or ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleIPAction """ - super(NWRuleSetIpRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_mask = ip_mask self.action = action -class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): +class NWRuleSetVirtualNetworkRules(_serialization.Model): """Description of VirtualNetworkRules - NetworkRules resource. :ivar subnet: Subnet properties. @@ -1075,8 +1020,8 @@ class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): """ _attribute_map = { - 'subnet': {'key': 'subnet', 'type': 'Subnet'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + "subnet": {"key": "subnet", "type": "Subnet"}, + "ignore_missing_vnet_service_endpoint": {"key": "ignoreMissingVnetServiceEndpoint", "type": "bool"}, } def __init__( @@ -1084,8 +1029,8 @@ def __init__( *, subnet: Optional["_models.Subnet"] = None, ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet: Subnet properties. :paramtype subnet: ~azure.mgmt.servicebus.v2017_04_01.models.Subnet @@ -1093,12 +1038,12 @@ def __init__( VNet Service Endpoint. :paramtype ignore_missing_vnet_service_endpoint: bool """ - super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.subnet = subnet self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """A ServiceBus REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1110,30 +1055,25 @@ class Operation(msrest.serialization.Model): """ _validation = { - 'name': {'readonly': True}, + "name": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__( - self, - *, - display: Optional["_models.OperationDisplay"] = None, - **kwargs - ): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.servicebus.v2017_04_01.models.OperationDisplay """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.display = display -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """The object that represents the operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1147,31 +1087,28 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None -class OperationListResult(msrest.serialization.Model): - """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1183,22 +1120,18 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None @@ -1216,38 +1149,32 @@ class ResourceNamespacePatch(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(ResourceNamespacePatch, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags @@ -1265,7 +1192,7 @@ class PremiumMessagingRegions(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar properties: :vartype properties: @@ -1273,18 +1200,18 @@ class PremiumMessagingRegions(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'PremiumMessagingRegionsProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "PremiumMessagingRegionsProperties"}, } def __init__( @@ -1293,22 +1220,22 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.PremiumMessagingRegionsProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword properties: :paramtype properties: ~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsProperties """ - super(PremiumMessagingRegions, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.properties = properties -class PremiumMessagingRegionsListResult(msrest.serialization.Model): +class PremiumMessagingRegionsListResult(_serialization.Model): """The response of the List PremiumMessagingRegions operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1321,30 +1248,25 @@ class PremiumMessagingRegionsListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[PremiumMessagingRegions]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PremiumMessagingRegions]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.PremiumMessagingRegions"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PremiumMessagingRegions"]] = None, **kwargs: Any) -> None: """ :keyword value: Result of the List PremiumMessagingRegions type. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] """ - super(PremiumMessagingRegionsListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PremiumMessagingRegionsProperties(msrest.serialization.Model): +class PremiumMessagingRegionsProperties(_serialization.Model): """PremiumMessagingRegionsProperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1356,32 +1278,29 @@ class PremiumMessagingRegionsProperties(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'full_name': {'readonly': True}, + "code": {"readonly": True}, + "full_name": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'full_name': {'key': 'fullName', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, + "full_name": {"key": "fullName", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PremiumMessagingRegionsProperties, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.full_name = None -class RegenerateAccessKeyParameters(msrest.serialization.Model): - """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. +class RegenerateAccessKeyParameters(_serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs + to be reset. All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :ivar key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :vartype key_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.KeyType :ivar key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key @@ -1390,30 +1309,24 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): """ _validation = { - 'key_type': {'required': True}, + "key_type": {"required": True}, } _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, + "key_type": {"key": "keyType", "type": "str"}, + "key": {"key": "key", "type": "str"}, } - def __init__( - self, - *, - key_type: Union[str, "_models.KeyType"], - key: Optional[str] = None, - **kwargs - ): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :keyword key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :paramtype key_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.KeyType :keyword key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :paramtype key: str """ - super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_type = key_type self.key = key @@ -1433,7 +1346,7 @@ class Rule(Resource): message that have been matched by a filter expression. :vartype action: ~azure.mgmt.servicebus.v2017_04_01.models.Action :ivar filter_type: Filter type that is evaluated against a BrokeredMessage. Known values are: - "SqlFilter", "CorrelationFilter". + "SqlFilter" and "CorrelationFilter". :vartype filter_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.FilterType :ivar sql_filter: Properties of sqlFilter. :vartype sql_filter: ~azure.mgmt.servicebus.v2017_04_01.models.SqlFilter @@ -1442,19 +1355,19 @@ class Rule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'action': {'key': 'properties.action', 'type': 'Action'}, - 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, - 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, - 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "action": {"key": "properties.action", "type": "Action"}, + "filter_type": {"key": "properties.filterType", "type": "str"}, + "sql_filter": {"key": "properties.sqlFilter", "type": "SqlFilter"}, + "correlation_filter": {"key": "properties.correlationFilter", "type": "CorrelationFilter"}, } def __init__( @@ -1464,28 +1377,28 @@ def __init__( filter_type: Optional[Union[str, "_models.FilterType"]] = None, sql_filter: Optional["_models.SqlFilter"] = None, correlation_filter: Optional["_models.CorrelationFilter"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. :paramtype action: ~azure.mgmt.servicebus.v2017_04_01.models.Action :keyword filter_type: Filter type that is evaluated against a BrokeredMessage. Known values - are: "SqlFilter", "CorrelationFilter". + are: "SqlFilter" and "CorrelationFilter". :paramtype filter_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.FilterType :keyword sql_filter: Properties of sqlFilter. :paramtype sql_filter: ~azure.mgmt.servicebus.v2017_04_01.models.SqlFilter :keyword correlation_filter: Properties of correlationFilter. :paramtype correlation_filter: ~azure.mgmt.servicebus.v2017_04_01.models.CorrelationFilter """ - super(Rule, self).__init__(**kwargs) + super().__init__(**kwargs) self.action = action self.filter_type = filter_type self.sql_filter = sql_filter self.correlation_filter = correlation_filter -class RuleListResult(msrest.serialization.Model): +class RuleListResult(_serialization.Model): """The response of the List rule operation. :ivar value: Result of the List Rules operation. @@ -1496,17 +1409,13 @@ class RuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.Rule"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Rule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.Rule] @@ -1514,7 +1423,7 @@ def __init__( list of rules. :paramtype next_link: str """ - super(RuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1535,33 +1444,28 @@ class SBAuthorizationRule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } - def __init__( - self, - *, - rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + def __init__(self, *, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, **kwargs: Any) -> None: """ :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2017_04_01.models.AccessRights] """ - super(SBAuthorizationRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.rights = rights -class SBAuthorizationRuleListResult(msrest.serialization.Model): +class SBAuthorizationRuleListResult(_serialization.Model): """The response to the List Namespace operation. :ivar value: Result of the List Authorization Rules operation. @@ -1572,8 +1476,8 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBAuthorizationRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1581,8 +1485,8 @@ def __init__( *, value: Optional[List["_models.SBAuthorizationRule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Authorization Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] @@ -1590,7 +1494,7 @@ def __init__( list of Authorization Rules. :paramtype next_link: str """ - super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1608,46 +1512,40 @@ class TrackedResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags -class SBNamespace(TrackedResource): +class SBNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1660,9 +1558,9 @@ class SBNamespace(TrackedResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of Sku. :vartype sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku @@ -1679,29 +1577,29 @@ class SBNamespace(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, } def __init__( @@ -1710,17 +1608,17 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.SBSku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of Sku. :paramtype sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku """ - super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.provisioning_state = None self.created_at = None @@ -1729,7 +1627,7 @@ def __init__( self.metric_id = None -class SBNamespaceListResult(msrest.serialization.Model): +class SBNamespaceListResult(_serialization.Model): """The response of the List Namespace operation. :ivar value: Result of the List Namespace operation. @@ -1740,17 +1638,13 @@ class SBNamespaceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBNamespace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBNamespace]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBNamespace"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBNamespace"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Namespace operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] @@ -1758,46 +1652,41 @@ def __init__( list of Namespaces. :paramtype next_link: str """ - super(SBNamespaceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBNamespaceMigrate(msrest.serialization.Model): +class SBNamespaceMigrate(_serialization.Model): """Namespace Migrate Object. All required parameters must be populated in order to send to Azure. - :ivar target_namespace_type: Required. Type of namespaces. Known values are: "Messaging", - "NotificationHub", "Mixed", "EventHub", "Relay". + :ivar target_namespace_type: Type of namespaces. Required. Known values are: "Messaging", + "NotificationHub", "Mixed", "EventHub", and "Relay". :vartype target_namespace_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.NameSpaceType """ _validation = { - 'target_namespace_type': {'required': True}, + "target_namespace_type": {"required": True}, } _attribute_map = { - 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'str'}, + "target_namespace_type": {"key": "targetNamespaceType", "type": "str"}, } - def __init__( - self, - *, - target_namespace_type: Union[str, "_models.NameSpaceType"], - **kwargs - ): + def __init__(self, *, target_namespace_type: Union[str, "_models.NameSpaceType"], **kwargs: Any) -> None: """ - :keyword target_namespace_type: Required. Type of namespaces. Known values are: "Messaging", - "NotificationHub", "Mixed", "EventHub", "Relay". + :keyword target_namespace_type: Type of namespaces. Required. Known values are: "Messaging", + "NotificationHub", "Mixed", "EventHub", and "Relay". :paramtype target_namespace_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.NameSpaceType """ - super(SBNamespaceMigrate, self).__init__(**kwargs) + super().__init__(**kwargs) self.target_namespace_type = target_namespace_type -class SBNamespaceUpdateParameters(ResourceNamespacePatch): +class SBNamespaceUpdateParameters(ResourceNamespacePatch): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1810,7 +1699,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of Sku. :vartype sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku @@ -1827,28 +1716,28 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, } def __init__( @@ -1857,17 +1746,17 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.SBSku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of Sku. :paramtype sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku """ - super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.provisioning_state = None self.created_at = None @@ -1876,7 +1765,7 @@ def __init__( self.metric_id = None -class SBQueue(Resource): +class SBQueue(Resource): # pylint: disable=too-many-instance-attributes """Description of queue Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1897,9 +1786,9 @@ class SBQueue(Resource): to this queue. :vartype accessed_at: ~datetime.datetime :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. @@ -1928,7 +1817,7 @@ class SBQueue(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -1949,45 +1838,48 @@ class SBQueue(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'message_count': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "message_count": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2005,8 +1897,8 @@ def __init__( enable_express: Optional[bool] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 @@ -2036,7 +1928,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2056,7 +1948,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBQueue, self).__init__(**kwargs) + super().__init__(**kwargs) self.count_details = None self.created_at = None self.updated_at = None @@ -2080,7 +1972,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBQueueListResult(msrest.serialization.Model): +class SBQueueListResult(_serialization.Model): """The response to the List Queues operation. :ivar value: Result of the List Queues operation. @@ -2091,17 +1983,13 @@ class SBQueueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBQueue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBQueue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBQueue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Queues operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBQueue] @@ -2109,19 +1997,19 @@ def __init__( list of queues. :paramtype next_link: str """ - super(SBQueueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBSku(msrest.serialization.Model): +class SBSku(_serialization.Model): """SKU of the namespace. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :ivar name: Name of this SKU. Required. Known values are: "Basic", "Standard", and "Premium". :vartype name: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuName - :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", + :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", and "Premium". :vartype tier: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuTier :ivar capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 @@ -2130,13 +2018,13 @@ class SBSku(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( @@ -2145,25 +2033,26 @@ def __init__( name: Union[str, "_models.SkuName"], tier: Optional[Union[str, "_models.SkuTier"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :keyword name: Name of this SKU. Required. Known values are: "Basic", "Standard", and + "Premium". :paramtype name: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuName :keyword tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", - "Premium". + and "Premium". :paramtype tier: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuTier :keyword capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :paramtype capacity: int """ - super(SBSku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SBSubscription(Resource): +class SBSubscription(Resource): # pylint: disable=too-many-instance-attributes """Description of subscription resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2175,7 +2064,7 @@ class SBSubscription(Resource): :ivar type: Resource type. :vartype type: str :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar accessed_at: Last time there was a receive request to this subscription. @@ -2206,7 +2095,7 @@ class SBSubscription(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2221,37 +2110,43 @@ class SBSubscription(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'message_count': {'readonly': True}, - 'created_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "message_count": {"readonly": True}, + "created_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, } def __init__( @@ -2269,8 +2164,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. @@ -2294,7 +2189,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2308,7 +2203,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBSubscription, self).__init__(**kwargs) + super().__init__(**kwargs) self.message_count = None self.created_at = None self.accessed_at = None @@ -2328,7 +2223,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBSubscriptionListResult(msrest.serialization.Model): +class SBSubscriptionListResult(_serialization.Model): """The response to the List Subscriptions operation. :ivar value: Result of the List Subscriptions operation. @@ -2339,17 +2234,13 @@ class SBSubscriptionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBSubscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBSubscription"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBSubscription"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Subscriptions operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription] @@ -2357,12 +2248,12 @@ def __init__( list of subscriptions. :paramtype next_link: str """ - super(SBSubscriptionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBTopic(Resource): +class SBTopic(Resource): # pylint: disable=too-many-instance-attributes """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2374,7 +2265,7 @@ class SBTopic(Resource): :ivar type: Resource type. :vartype type: str :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2403,7 +2294,7 @@ class SBTopic(Resource): :vartype enable_batched_operations: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :ivar support_ordering: Value that indicates whether the topic supports ordering. :vartype support_ordering: bool @@ -2419,37 +2310,40 @@ class SBTopic(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "subscription_count": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, } def __init__( @@ -2465,8 +2359,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, enable_partitioning: Optional[bool] = None, enable_express: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -2486,7 +2380,7 @@ def __init__( :paramtype enable_batched_operations: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool @@ -2500,7 +2394,7 @@ def __init__( topic holds a message in memory temporarily before writing it to persistent storage. :paramtype enable_express: bool """ - super(SBTopic, self).__init__(**kwargs) + super().__init__(**kwargs) self.size_in_bytes = None self.created_at = None self.updated_at = None @@ -2519,7 +2413,7 @@ def __init__( self.enable_express = enable_express -class SBTopicListResult(msrest.serialization.Model): +class SBTopicListResult(_serialization.Model): """The response to the List Topics operation. :ivar value: Result of the List Topics operation. @@ -2530,17 +2424,13 @@ class SBTopicListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBTopic]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBTopic"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBTopic"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Topics operation. :paramtype value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBTopic] @@ -2548,13 +2438,14 @@ def __init__( list of topics. :paramtype next_link: str """ - super(SBTopicListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SqlFilter(msrest.serialization.Model): - """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. +class SqlFilter(_serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in + the pub/sub pipeline. :ivar sql_expression: The SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2567,23 +2458,23 @@ class SqlFilter(msrest.serialization.Model): """ _validation = { - 'compatibility_level': {'maximum': 20, 'minimum': 20}, + "compatibility_level": {"maximum": 20, "minimum": 20}, } _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( self, *, sql_expression: Optional[str] = None, - compatibility_level: Optional[int] = 20, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + compatibility_level: int = 20, + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: The SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -2594,14 +2485,15 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing class SqlRuleAction(Action): - """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + """Represents set of actions written in SQL language-based syntax that is performed against a + ServiceBus.Messaging.BrokeredMessage. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2614,9 +2506,9 @@ class SqlRuleAction(Action): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -2624,9 +2516,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -2637,35 +2529,35 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + super().__init__( + sql_expression=sql_expression, + compatibility_level=compatibility_level, + requires_preprocessing=requires_preprocessing, + **kwargs + ) -class Subnet(msrest.serialization.Model): +class Subnet(_serialization.Model): """Properties supplied for Subnet. All required parameters must be populated in order to send to Azure. - :ivar id: Required. Resource ID of Virtual Network Subnet. + :ivar id: Resource ID of Virtual Network Subnet. Required. :vartype id: str """ _validation = { - 'id': {'required': True}, + "id": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: str, - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Required. Resource ID of Virtual Network Subnet. + :keyword id: Resource ID of Virtual Network Subnet. Required. :paramtype id: str """ - super(Subnet, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py index c1bc966d4444..ccd7445092c7 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py @@ -11,28 +11,29 @@ class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" + class DefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Default Action for Network Rule Set - """ + """Default Action for Network Rule Set.""" ALLOW = "Allow" DENY = "Deny" + class EncodingCaptureDescription(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enumerates the possible values for the encoding format of capture description. - """ + """Enumerates the possible values for the encoding format of capture description.""" AVRO = "Avro" AVRO_DEFLATE = "AvroDeflate" + class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity status. - """ + """Entity status.""" ACTIVE = "Active" DISABLED = "Disabled" @@ -44,27 +45,29 @@ class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENAMING = "Renaming" UNKNOWN = "Unknown" + class FilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Rule filter types - """ + """Rule filter types.""" SQL_FILTER = "SqlFilter" CORRELATION_FILTER = "CorrelationFilter" + class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The access key to regenerate. - """ + """The access key to regenerate.""" PRIMARY_KEY = "PrimaryKey" SECONDARY_KEY = "SecondaryKey" + class MigrationConfigurationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationConfigurationName.""" _DEFAULT = "$default" + class NameSpaceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of namespaces - """ + """Type of namespaces.""" MESSAGING = "Messaging" NOTIFICATION_HUB = "NotificationHub" @@ -72,49 +75,51 @@ class NameSpaceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): EVENT_HUB = "EventHub" RELAY = "Relay" + class NetworkRuleIPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP Filter Action - """ + """The IP Filter Action.""" ALLOW = "Allow" + class ProvisioningStateDR(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' - or 'Succeeded' or 'Failed' + or 'Succeeded' or 'Failed'. """ ACCEPTED = "Accepted" SUCCEEDED = "Succeeded" FAILED = "Failed" + class RoleDisasterRecovery(str, Enum, metaclass=CaseInsensitiveEnumMeta): """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or - 'Secondary' + 'Secondary'. """ PRIMARY = "Primary" PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" SECONDARY = "Secondary" + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of this SKU. - """ + """Name of this SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The billing tier of this particular SKU. - """ + """The billing tier of this particular SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the reason for the unavailability of the service. - """ + """Specifies the reason for the unavailability of the service.""" NONE = "None" INVALID_NAME = "InvalidName" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py index 02badefef72e..dbb5c8284b01 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py @@ -19,20 +19,21 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'QueuesOperations', - 'TopicsOperations', - 'DisasterRecoveryConfigsOperations', - 'EventHubsOperations', - 'MigrationConfigsOperations', - 'Operations', - 'PremiumMessagingRegionsOperations', - 'RulesOperations', - 'RegionsOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "QueuesOperations", + "TopicsOperations", + "DisasterRecoveryConfigsOperations", + "EventHubsOperations", + "MigrationConfigsOperations", + "Operations", + "PremiumMessagingRegionsOperations", + "RulesOperations", + "RegionsOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py index f46ad7068852..d23a66e6dc0a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,335 +27,294 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_check_name_availability_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.ArmDisasterRecovery] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_break_pairing_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_fail_over_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -362,34 +328,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -403,34 +370,36 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class DisasterRecoveryConfigsOperations: """ @@ -451,41 +420,107 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace + @overload def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -494,18 +529,18 @@ def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,74 +548,77 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +626,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +644,124 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +771,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -681,67 +792,65 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -752,60 +861,58 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -813,68 +920,66 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -885,60 +990,58 @@ def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } @distributed_trace def fail_over( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_fail_over_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.fail_over.metadata['url'], + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -949,72 +1052,76 @@ def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1022,16 +1129,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1042,48 +1147,48 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1091,18 +1196,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,52 +1214,53 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1163,18 +1268,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1182,12 +1286,13 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py index cb56d50dbebc..dd1cd965cd6d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,48 +27,52 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_namespace_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class EventHubsOperations: """ @@ -82,64 +93,65 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_namespace( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.EventHubListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.Eventhub"]: """Gets all the Event Hubs in a service bus Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventHubListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.EventHubListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Eventhub or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.Eventhub] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.EventHubListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_namespace.metadata['url'], + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -147,16 +159,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -167,8 +177,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py index 883b733d3232..4eae6cca3dfd 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,251 +29,245 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_and_start_migration_request_initial( +def build_create_and_start_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, - *, - json: Optional[_models.MigrationConfigProperties] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_complete_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_revert_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MigrationConfigsOperations: """ @@ -287,65 +288,67 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,16 +356,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -373,35 +374,44 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'MigrationConfigProperties') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") - request = build_create_and_start_migration_request_initial( + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -409,56 +419,63 @@ def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } - @distributed_trace + @overload def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -471,113 +488,188 @@ def begin_create_and_start_migration( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_and_start_migration_initial( # type: ignore + raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -588,60 +680,62 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -649,69 +743,71 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -722,60 +818,62 @@ def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -786,5 +884,6 @@ def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py index e5bbab201477..8a8bf7d8c426 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,696 +29,597 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_migrate_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceMigrate] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespace] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NetworkRuleSet] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_network_rule_sets_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class NamespacesOperations: """ @@ -732,65 +640,69 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -798,16 +710,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -818,49 +728,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -870,18 +862,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -889,67 +881,68 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -960,60 +953,61 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1021,67 +1015,68 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1089,53 +1084,136 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1145,18 +1223,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1164,62 +1242,108 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1227,50 +1351,118 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } - @distributed_trace + @overload def migrate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceMigrate, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """This operation Migrate the given namespace to provided name type. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to migrate namespace type. + :param parameters: Parameters supplied to migrate namespace type. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceMigrate, IO], + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Is either a + SBNamespaceMigrate type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceMigrate') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceMigrate") request = build_migrate_request( resource_group_name=resource_group_name, @@ -1279,18 +1471,18 @@ def migrate( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.migrate.metadata['url'], + content=_content, + template_url=self.migrate.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1301,57 +1493,64 @@ def migrate( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - migrate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate"} # type: ignore - + migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate" + } @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1359,16 +1558,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1379,65 +1576,67 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1445,16 +1644,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1465,90 +1662,144 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespace') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1560,121 +1811,148 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1686,103 +1964,97 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1790,51 +2062,121 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1843,18 +2185,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1864,53 +2206,121 @@ def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -1919,18 +2329,18 @@ def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1938,63 +2348,62 @@ def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2002,74 +2411,76 @@ def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2077,16 +2488,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2097,8 +2506,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py index d45dbc6315d6..a1814cc45836 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +27,38 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,52 +79,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,16 +136,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,8 +154,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py index ff17dfe25d29..63faa8aa98f5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,44 +27,45 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PremiumMessagingRegionsOperations: """ @@ -78,55 +86,59 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.PremiumMessagingRegionsListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.PremiumMessagingRegions"]: """Gets the available premium messaging regions for servicebus. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,16 +146,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,8 +164,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py index 979a0614b863..c2b63ab7f372 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,52 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +81,43 @@ def build_create_or_update_authorization_rule_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -126,34 +131,35 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -167,34 +173,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +215,35 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +252,43 @@ def build_regenerate_keys_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +303,141 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - *, - json: Optional[_models.SBQueue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class QueuesOperations: """ @@ -474,70 +458,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +531,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +549,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +563,117 @@ def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +684,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +703,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -661,31 +725,36 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +762,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -715,8 +783,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -729,31 +798,36 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -761,18 +835,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,15 +853,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +875,36 @@ def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +912,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +930,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,38 +949,126 @@ def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -912,18 +1079,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -931,15 +1098,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -949,12 +1117,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBQueueListResult]: + ) -> Iterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -964,53 +1135,56 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1018,16 +1192,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1038,49 +1210,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1090,18 +1344,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1109,67 +1363,68 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1180,60 +1435,59 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> _models.SBQueue: + def get(self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1241,12 +1495,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py index d0b4fce6a80d..864e5d33591c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,46 +27,46 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_by_sku_request( - subscription_id: str, - sku: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_sku_request(sku: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "sku": _SERIALIZER.url("sku", sku, 'str', max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "sku": _SERIALIZER.url("sku", sku, "str", max_length=50, min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class RegionsOperations: """ @@ -80,60 +87,62 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_sku( - self, - sku: str, - **kwargs: Any - ) -> Iterable[_models.PremiumMessagingRegionsListResult]: + def list_by_sku(self, sku: str, **kwargs: Any) -> Iterable["_models.PremiumMessagingRegions"]: """Gets the available Regions for a given sku. - :param sku: The sku type. + :param sku: The sku type. Required. :type sku: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, sku=sku, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_sku.metadata['url'], + template_url=self.list_by_sku.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, - sku=sku, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -141,16 +150,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,8 +168,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_sku.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} # type: ignore + list_by_sku.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py index 29ff6684739f..7f7f881e4e85 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_subscriptions_request( resource_group_name: str, namespace_name: str, @@ -41,38 +55,37 @@ def build_list_by_subscriptions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -82,48 +95,42 @@ def build_create_or_update_request( subscription_name: str, rule_name: str, subscription_id: str, - *, - json: Optional[_models.Rule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -138,35 +145,34 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -181,35 +187,35 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class RulesOperations: """ @@ -230,7 +236,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -241,16 +246,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.RuleListResult]: + ) -> Iterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -260,56 +265,58 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -317,16 +324,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -337,13 +342,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -352,40 +357,125 @@ def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -397,18 +487,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -416,15 +506,16 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -438,33 +529,35 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -473,18 +566,17 @@ def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -495,8 +587,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def get( @@ -510,33 +603,35 @@ def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -545,18 +640,17 @@ def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -564,12 +658,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py index 3a7086fd12db..bd3923bda091 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_topic_request( resource_group_name: str, namespace_name: str, @@ -40,37 +54,36 @@ def build_list_by_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -79,47 +92,41 @@ def build_create_or_update_request( topic_name: str, subscription_name: str, subscription_id: str, - *, - json: Optional[_models.SBSubscription] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -133,34 +140,33 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -174,34 +180,34 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SubscriptionsOperations: """ @@ -222,7 +228,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -232,14 +237,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBSubscriptionListResult]: + ) -> Iterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -249,56 +257,57 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBSubscription or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -306,16 +315,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -326,13 +333,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -340,38 +347,126 @@ def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -382,18 +477,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,52 +496,53 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -454,18 +550,17 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -476,45 +571,46 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -522,18 +618,17 @@ def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,12 +636,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py index 11c7c9d66fe2..d8166660d0d8 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,52 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +81,43 @@ def build_create_or_update_authorization_rule_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -126,34 +131,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -167,34 +173,35 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +215,35 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +252,43 @@ def build_regenerate_keys_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +303,141 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - *, - json: Optional[_models.SBTopic] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TopicsOperations: """ @@ -474,70 +458,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +531,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +549,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +563,126 @@ def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +693,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +712,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -661,31 +734,36 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +771,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,15 +789,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -733,31 +811,36 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -765,18 +848,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -787,8 +869,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +884,36 @@ def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +921,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +939,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,38 +958,126 @@ def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -912,18 +1088,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -931,15 +1107,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -949,12 +1126,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBTopicListResult]: + ) -> Iterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -964,53 +1144,56 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1018,16 +1201,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1038,49 +1219,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1090,18 +1353,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1109,67 +1372,68 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1180,60 +1444,59 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> _models.SBTopic: + def get(self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2017-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-04-01")) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1241,12 +1504,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py index 221541a00fb6..2e171d69863b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py index 3c8663a0c0b6..8f3614615856 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-01-01-preview") # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop("api_version", "2018-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,23 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json index 6a6601651a9e..124ea4f8b47a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -111,4 +119,4 @@ "rules": "RulesOperations", "operations": "Operations" } -} \ No newline at end of file +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py index fd3c7382e5a3..97eb76382f8b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py @@ -9,20 +9,34 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, EventHubsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PremiumMessagingRegionsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RegionsOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + EventHubsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PremiumMessagingRegionsOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RegionsOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. @@ -58,10 +72,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :vartype rules: azure.mgmt.servicebus.v2018_01_01_preview.operations.RulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicebus.v2018_01_01_preview.operations.Operations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -79,16 +93,16 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -98,40 +112,21 @@ def __init__( self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations(self._client, self._config, self._serialize, self._deserialize) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.premium_messaging_regions = PremiumMessagingRegionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.regions = RegionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -140,7 +135,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -153,15 +148,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient + def __enter__(self) -> "ServiceBusManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_vendor.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py index e7dd87df1f93..530b8638dfd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py index 6808f4a0adc0..0699138d61e4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-01-01-preview") # type: str + api_version: Literal["2018-01-01-preview"] = kwargs.pop("api_version", "2018-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,22 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py index 14922a368644..730924e84f32 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py @@ -9,20 +9,34 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, EventHubsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PremiumMessagingRegionsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RegionsOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + EventHubsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PremiumMessagingRegionsOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RegionsOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. @@ -60,10 +74,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :vartype rules: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.RulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.Operations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -81,16 +95,16 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -100,40 +114,21 @@ def __init__( self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations(self._client, self._config, self._serialize, self._deserialize) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.premium_messaging_regions = PremiumMessagingRegionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.regions = RegionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -142,7 +137,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -162,5 +157,5 @@ async def __aenter__(self) -> "ServiceBusManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py index a21798eafb6a..7209ae076025 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py @@ -21,22 +21,23 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'DisasterRecoveryConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'EventHubsOperations', - 'MigrationConfigsOperations', - 'PremiumMessagingRegionsOperations', - 'RegionsOperations', - 'SubscriptionsOperations', - 'RulesOperations', - 'Operations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "DisasterRecoveryConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "EventHubsOperations", + "MigrationConfigsOperations", + "PremiumMessagingRegionsOperations", + "RegionsOperations", + "SubscriptionsOperations", + "RulesOperations", + "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py index b5580e25977e..4bbbb6fad357 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._disaster_recovery_configs_operations import build_break_pairing_request, build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_fail_over_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request -T = TypeVar('T') +from ...operations._disaster_recovery_configs_operations import ( + build_break_pairing_request, + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_fail_over_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class DisasterRecoveryConfigsOperations: """ .. warning:: @@ -43,41 +69,109 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -86,18 +180,18 @@ async def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,74 +199,79 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -180,16 +279,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -200,49 +297,126 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -252,18 +426,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -273,67 +447,67 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,60 +518,60 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,68 +579,68 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,50 +651,127 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - - @distributed_trace_async + @overload async def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -530,18 +781,18 @@ async def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -552,72 +803,78 @@ async def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -625,16 +882,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -645,48 +900,50 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -694,18 +951,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -713,52 +969,55 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -766,18 +1025,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -785,12 +1043,13 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py index 3a22807df094..1d378bc5ea2c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._event_hubs_operations import build_list_by_namespace_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class EventHubsOperations: """ .. warning:: @@ -42,64 +57,68 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_namespace( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.EventHubListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Eventhub"]: """Gets all the Event Hubs in a service bus Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :return: An iterator like instance of either Eventhub or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.EventHubListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.Eventhub] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.EventHubListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_namespace.metadata['url'], + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -107,16 +126,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EventHubListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,8 +144,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py index e0e6603c1964..ce264964c6b9 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,23 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._migration_configs_operations import build_complete_migration_request, build_create_and_start_migration_request_initial, build_delete_request, build_get_request, build_list_request, build_revert_request -T = TypeVar('T') +from ...operations._migration_configs_operations import ( + build_complete_migration_request, + build_create_and_start_migration_request, + build_delete_request, + build_get_request, + build_list_request, + build_revert_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MigrationConfigsOperations: """ .. warning:: @@ -45,65 +67,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +137,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,35 +155,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } async def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -167,57 +202,146 @@ async def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> AsyncLROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -230,114 +354,114 @@ async def begin_create_and_start_migration( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_and_start_migration_initial( # type: ignore + raw_result = await self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -348,61 +472,65 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,70 +538,74 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,61 +616,65 @@ async def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace_async async def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -549,5 +685,6 @@ async def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py index 9f0518438612..f53af6b22677 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,42 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._namespaces_operations import build_check_name_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_ip_filter_rule_request, build_create_or_update_network_rule_set_request, build_create_or_update_request_initial, build_create_or_update_virtual_network_rule_request, build_delete_authorization_rule_request, build_delete_ip_filter_rule_request, build_delete_request_initial, build_delete_virtual_network_rule_request, build_get_authorization_rule_request, build_get_ip_filter_rule_request, build_get_network_rule_set_request, build_get_request, build_get_virtual_network_rule_request, build_list_authorization_rules_request, build_list_by_resource_group_request, build_list_ip_filter_rules_request, build_list_keys_request, build_list_network_rule_sets_request, build_list_request, build_list_virtual_network_rules_request, build_migrate_request, build_regenerate_keys_request, build_update_request -T = TypeVar('T') +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_ip_filter_rule_request, + build_create_or_update_network_rule_set_request, + build_create_or_update_request, + build_create_or_update_virtual_network_rule_request, + build_delete_authorization_rule_request, + build_delete_ip_filter_rule_request, + build_delete_request, + build_delete_virtual_network_rule_request, + build_get_authorization_rule_request, + build_get_ip_filter_rule_request, + build_get_network_rule_set_request, + build_get_request, + build_get_virtual_network_rule_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_ip_filter_rules_request, + build_list_keys_request, + build_list_network_rule_sets_request, + build_list_request, + build_list_virtual_network_rules_request, + build_migrate_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class NamespacesOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,65 +86,68 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_ip_filter_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.IpFilterRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.IpFilterRule"]: """Gets a list of IP Filter rules for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IpFilterRuleListResult or the result of - cls(response) + :return: An iterator like instance of either IpFilterRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.IpFilterRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.IpFilterRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_ip_filter_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_ip_filter_rules.metadata['url'], + template_url=self.list_ip_filter_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_ip_filter_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +155,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IpFilterRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,49 +173,124 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_ip_filter_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules"} # type: ignore + list_ip_filter_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules" + } - @distributed_trace_async + @overload async def create_or_update_ip_filter_rule( self, resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, parameters: _models.IpFilterRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.IpFilterRule: """Creates or updates an IpFilterRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param ip_filter_rule_name: The IP Filter Rule name. + :param ip_filter_rule_name: The IP Filter Rule name. Required. :type ip_filter_rule_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpFilterRule: + """Creates or updates an IpFilterRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param ip_filter_rule_name: The IP Filter Rule name. Required. + :type ip_filter_rule_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + parameters: Union[_models.IpFilterRule, IO], + **kwargs: Any + ) -> _models.IpFilterRule: + """Creates or updates an IpFilterRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param ip_filter_rule_name: The IP Filter Rule name. Required. + :type ip_filter_rule_name: str + :param parameters: The Namespace IpFilterRule. Is either a IpFilterRule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IpFilterRule, or the result of cls(response) + :return: IpFilterRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.IpFilterRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpFilterRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'IpFilterRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "IpFilterRule") request = build_create_or_update_ip_filter_rule_request( resource_group_name=resource_group_name, @@ -183,18 +300,18 @@ async def create_or_update_ip_filter_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_ip_filter_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_ip_filter_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,67 +319,67 @@ async def create_or_update_ip_filter_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IpFilterRule', pipeline_response) + deserialized = self._deserialize("IpFilterRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_ip_filter_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}"} # type: ignore - + create_or_update_ip_filter_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}" + } @distributed_trace_async async def delete_ip_filter_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - ip_filter_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, **kwargs: Any ) -> None: """Deletes an IpFilterRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param ip_filter_rule_name: The IP Filter Rule name. + :param ip_filter_rule_name: The IP Filter Rule name. Required. :type ip_filter_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_ip_filter_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, ip_filter_rule_name=ip_filter_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_ip_filter_rule.metadata['url'], + template_url=self.delete_ip_filter_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -273,60 +390,60 @@ async def delete_ip_filter_rule( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - delete_ip_filter_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}"} # type: ignore - + delete_ip_filter_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}" + } @distributed_trace_async async def get_ip_filter_rule( - self, - resource_group_name: str, - namespace_name: str, - ip_filter_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, **kwargs: Any ) -> _models.IpFilterRule: """Gets an IpFilterRule for a Namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param ip_filter_rule_name: The IP Filter Rule name. + :param ip_filter_rule_name: The IP Filter Rule name. Required. :type ip_filter_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IpFilterRule, or the result of cls(response) + :return: IpFilterRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.IpFilterRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.IpFilterRule] = kwargs.pop("cls", None) - request = build_get_ip_filter_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, ip_filter_rule_name=ip_filter_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_ip_filter_rule.metadata['url'], + template_url=self.get_ip_filter_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,64 +451,74 @@ async def get_ip_filter_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IpFilterRule', pipeline_response) + deserialized = self._deserialize("IpFilterRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_ip_filter_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}"} # type: ignore - + get_ip_filter_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}" + } @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -399,16 +526,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -419,65 +544,70 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -485,16 +615,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -505,90 +633,182 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } async def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -601,121 +821,118 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -727,103 +944,101 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -831,51 +1046,124 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -884,18 +1172,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -905,77 +1193,82 @@ async def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace def list_virtual_network_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.VirtualNetworkRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkRule"]: """Gets a list of VirtualNetwork rules for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of - cls(response) + :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.VirtualNetworkRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_virtual_network_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_virtual_network_rules.metadata['url'], + template_url=self.list_virtual_network_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_virtual_network_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -983,16 +1276,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1003,51 +1294,126 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_virtual_network_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules"} # type: ignore + list_virtual_network_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules" + } - @distributed_trace_async + @overload async def create_or_update_virtual_network_rule( self, resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, parameters: _models.VirtualNetworkRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.VirtualNetworkRule: """Creates or updates an VirtualNetworkRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param virtual_network_rule_name: The Virtual Network Rule name. + :param virtual_network_rule_name: The Virtual Network Rule name. Required. :type virtual_network_rule_name: str - :param parameters: The Namespace VirtualNetworkRule. + :param parameters: The Namespace VirtualNetworkRule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.VirtualNetworkRule] - _json = self._serialize.body(parameters, 'VirtualNetworkRule') - - request = build_create_or_update_virtual_network_rule_request( + @overload + async def create_or_update_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates an VirtualNetworkRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param virtual_network_rule_name: The Virtual Network Rule name. Required. + :type virtual_network_rule_name: str + :param parameters: The Namespace VirtualNetworkRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + parameters: Union[_models.VirtualNetworkRule, IO], + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates an VirtualNetworkRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param virtual_network_rule_name: The Virtual Network Rule name. Required. + :type virtual_network_rule_name: str + :param parameters: The Namespace VirtualNetworkRule. Is either a VirtualNetworkRule type or a + IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualNetworkRule") + + request = build_create_or_update_virtual_network_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, virtual_network_rule_name=virtual_network_rule_name, @@ -1055,18 +1421,18 @@ async def create_or_update_virtual_network_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_virtual_network_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_virtual_network_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1074,67 +1440,67 @@ async def create_or_update_virtual_network_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_virtual_network_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}"} # type: ignore - + create_or_update_virtual_network_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}" + } @distributed_trace_async async def delete_virtual_network_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - virtual_network_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, **kwargs: Any ) -> None: """Deletes an VirtualNetworkRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param virtual_network_rule_name: The Virtual Network Rule name. + :param virtual_network_rule_name: The Virtual Network Rule name. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_virtual_network_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_virtual_network_rule.metadata['url'], + template_url=self.delete_virtual_network_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1145,60 +1511,60 @@ async def delete_virtual_network_rule( # pylint: disable=inconsistent-return-st if cls: return cls(pipeline_response, None, {}) - delete_virtual_network_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}"} # type: ignore - + delete_virtual_network_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}" + } @distributed_trace_async async def get_virtual_network_rule( - self, - resource_group_name: str, - namespace_name: str, - virtual_network_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, **kwargs: Any ) -> _models.VirtualNetworkRule: """Gets an VirtualNetworkRule for a Namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param virtual_network_rule_name: The Virtual Network Rule name. + :param virtual_network_rule_name: The Virtual Network Rule name. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.VirtualNetworkRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) - request = build_get_virtual_network_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_virtual_network_rule.metadata['url'], + template_url=self.get_virtual_network_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1206,74 +1572,82 @@ async def get_virtual_network_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_virtual_network_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}"} # type: ignore - + get_virtual_network_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1281,16 +1655,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1301,49 +1673,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -1353,18 +1809,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1372,67 +1828,70 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1443,60 +1902,63 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1504,67 +1966,70 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1572,54 +2037,140 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1629,18 +2180,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1648,62 +2199,110 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1711,50 +2310,120 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } - - @distributed_trace_async + @overload async def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -1763,18 +2432,18 @@ async def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1782,63 +2451,64 @@ async def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace_async async def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1846,74 +2516,79 @@ async def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1921,16 +2596,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1941,46 +2614,115 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } - @distributed_trace_async + @overload async def migrate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceMigrate, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """This operation Migrate the given namespace to provided name type. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to migrate namespace type. + :param parameters: Parameters supplied to migrate namespace type. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceMigrate, IO], + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Is either a + SBNamespaceMigrate type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceMigrate') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceMigrate") request = build_migrate_request( resource_group_name=resource_group_name, @@ -1989,18 +2731,18 @@ async def migrate( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.migrate.metadata['url'], + content=_content, + template_url=self.migrate.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2011,5 +2753,6 @@ async def migrate( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - migrate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate"} # type: ignore - + migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py index f8ab56066078..49b19883879c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,52 +57,59 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -95,16 +117,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,8 +135,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py index 03b00dcbcaaf..443dba878258 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._premium_messaging_regions_operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PremiumMessagingRegionsOperations: """ .. warning:: @@ -42,55 +57,61 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.PremiumMessagingRegionsListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.PremiumMessagingRegions"]: """Gets the available premium messaging regions for servicebus. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -98,16 +119,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -118,8 +137,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py index 1e16f39f953a..e74d4dc736fb 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -45,65 +65,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +138,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,71 +156,157 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -204,83 +315,84 @@ async def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -292,108 +404,107 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,12 +512,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py index 69a99ba81b3c..7ff04e51e726 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py @@ -6,9 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +27,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,54 +55,56 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,12 +112,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py index b62f75b67b4b..2ee4b5b0aaea 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queues_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class QueuesOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,119 @@ async def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +299,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +318,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -230,31 +340,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +379,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -284,8 +400,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -298,31 +415,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -330,18 +454,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,15 +472,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +494,38 @@ async def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +533,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +551,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +570,130 @@ async def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +704,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +723,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +742,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBQueueListResult]: + ) -> AsyncIterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +760,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :return: An iterator like instance of either SBQueue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +820,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +838,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +974,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +993,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1067,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1131,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py index f946843d4e8b..413939a86dd5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._regions_operations import build_list_by_sku_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RegionsOperations: """ .. warning:: @@ -42,60 +57,64 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_sku( - self, - sku: str, - **kwargs: Any - ) -> AsyncIterable[_models.PremiumMessagingRegionsListResult]: + def list_by_sku(self, sku: str, **kwargs: Any) -> AsyncIterable["_models.PremiumMessagingRegions"]: """Gets the available Regions for a given sku. - :param sku: The sku type. + :param sku: The sku type. Required. :type sku: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, sku=sku, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_sku.metadata['url'], + template_url=self.list_by_sku.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, - sku=sku, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -103,16 +122,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,8 +140,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_sku.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} # type: ignore + list_by_sku.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py index 77b438181854..40471d677f80 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscriptions_request -T = TypeVar('T') +from ...operations._rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscriptions_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RulesOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -54,16 +73,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.RuleListResult]: + ) -> AsyncIterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -73,57 +92,61 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) + :return: An iterator like instance of either Rule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,16 +154,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,13 +172,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -166,40 +187,127 @@ async def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -211,18 +319,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,15 +338,16 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -252,33 +361,37 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -287,18 +400,17 @@ async def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -309,8 +421,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def get( @@ -324,33 +437,37 @@ async def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -359,18 +476,17 @@ async def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,12 +494,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py index 5c61d6d6e7f8..9b1c9aca68d7 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_topic_request -T = TypeVar('T') +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_topic_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SubscriptionsOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -53,14 +72,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBSubscriptionListResult]: + ) -> AsyncIterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -70,56 +92,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,16 +153,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,13 +171,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -161,38 +185,128 @@ async def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -203,18 +317,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -222,52 +336,55 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -275,18 +392,17 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -297,45 +413,48 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -343,18 +462,17 @@ async def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -362,12 +480,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py index e1551fb4e9f6..5a33c0720873 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._topics_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopicsOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,128 @@ async def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +308,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +327,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -230,31 +349,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +388,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,15 +406,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -302,31 +428,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -334,18 +467,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -356,8 +488,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +503,38 @@ async def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +542,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +560,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +579,130 @@ async def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +713,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +732,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +751,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBTopicListResult]: + ) -> AsyncIterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +769,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :return: An iterator like instance of either SBTopic or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +829,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +847,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +983,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +1002,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1076,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1140,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py index 4f7e18adf2a1..490670e8543a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py @@ -70,110 +70,108 @@ from ._models_py3 import VirtualNetworkRule from ._models_py3 import VirtualNetworkRuleListResult - -from ._service_bus_management_client_enums import ( - AccessRights, - DefaultAction, - EncodingCaptureDescription, - EndPointProvisioningState, - EntityStatus, - FilterType, - IPAction, - KeyType, - MigrationConfigurationName, - NameSpaceType, - NetworkRuleIPAction, - PrivateLinkConnectionStatus, - ProvisioningStateDR, - RoleDisasterRecovery, - SkuName, - SkuTier, - UnavailableReason, -) +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import DefaultAction +from ._service_bus_management_client_enums import EncodingCaptureDescription +from ._service_bus_management_client_enums import EndPointProvisioningState +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import FilterType +from ._service_bus_management_client_enums import IPAction +from ._service_bus_management_client_enums import KeyType +from ._service_bus_management_client_enums import MigrationConfigurationName +from ._service_bus_management_client_enums import NameSpaceType +from ._service_bus_management_client_enums import NetworkRuleIPAction +from ._service_bus_management_client_enums import PrivateLinkConnectionStatus +from ._service_bus_management_client_enums import ProvisioningStateDR +from ._service_bus_management_client_enums import RoleDisasterRecovery +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import UnavailableReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccessKeys', - 'Action', - 'ArmDisasterRecovery', - 'ArmDisasterRecoveryListResult', - 'CaptureDescription', - 'CheckNameAvailability', - 'CheckNameAvailabilityResult', - 'ConnectionState', - 'CorrelationFilter', - 'Destination', - 'Encryption', - 'ErrorAdditionalInfo', - 'ErrorResponse', - 'ErrorResponseError', - 'EventHubListResult', - 'Eventhub', - 'FailoverProperties', - 'Identity', - 'IpFilterRule', - 'IpFilterRuleListResult', - 'KeyVaultProperties', - 'MessageCountDetails', - 'MigrationConfigListResult', - 'MigrationConfigProperties', - 'NWRuleSetIpRules', - 'NWRuleSetVirtualNetworkRules', - 'NetworkRuleSet', - 'NetworkRuleSetListResult', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'PremiumMessagingRegions', - 'PremiumMessagingRegionsListResult', - 'PremiumMessagingRegionsProperties', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'RegenerateAccessKeyParameters', - 'Resource', - 'ResourceNamespacePatch', - 'Rule', - 'RuleListResult', - 'SBAuthorizationRule', - 'SBAuthorizationRuleListResult', - 'SBNamespace', - 'SBNamespaceListResult', - 'SBNamespaceMigrate', - 'SBNamespaceUpdateParameters', - 'SBQueue', - 'SBQueueListResult', - 'SBSku', - 'SBSubscription', - 'SBSubscriptionListResult', - 'SBTopic', - 'SBTopicListResult', - 'SqlFilter', - 'SqlRuleAction', - 'Subnet', - 'TrackedResource', - 'VirtualNetworkRule', - 'VirtualNetworkRuleListResult', - 'AccessRights', - 'DefaultAction', - 'EncodingCaptureDescription', - 'EndPointProvisioningState', - 'EntityStatus', - 'FilterType', - 'IPAction', - 'KeyType', - 'MigrationConfigurationName', - 'NameSpaceType', - 'NetworkRuleIPAction', - 'PrivateLinkConnectionStatus', - 'ProvisioningStateDR', - 'RoleDisasterRecovery', - 'SkuName', - 'SkuTier', - 'UnavailableReason', + "AccessKeys", + "Action", + "ArmDisasterRecovery", + "ArmDisasterRecoveryListResult", + "CaptureDescription", + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "ConnectionState", + "CorrelationFilter", + "Destination", + "Encryption", + "ErrorAdditionalInfo", + "ErrorResponse", + "ErrorResponseError", + "EventHubListResult", + "Eventhub", + "FailoverProperties", + "Identity", + "IpFilterRule", + "IpFilterRuleListResult", + "KeyVaultProperties", + "MessageCountDetails", + "MigrationConfigListResult", + "MigrationConfigProperties", + "NWRuleSetIpRules", + "NWRuleSetVirtualNetworkRules", + "NetworkRuleSet", + "NetworkRuleSetListResult", + "Operation", + "OperationDisplay", + "OperationListResult", + "PremiumMessagingRegions", + "PremiumMessagingRegionsListResult", + "PremiumMessagingRegionsProperties", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "RegenerateAccessKeyParameters", + "Resource", + "ResourceNamespacePatch", + "Rule", + "RuleListResult", + "SBAuthorizationRule", + "SBAuthorizationRuleListResult", + "SBNamespace", + "SBNamespaceListResult", + "SBNamespaceMigrate", + "SBNamespaceUpdateParameters", + "SBQueue", + "SBQueueListResult", + "SBSku", + "SBSubscription", + "SBSubscriptionListResult", + "SBTopic", + "SBTopicListResult", + "SqlFilter", + "SqlRuleAction", + "Subnet", + "TrackedResource", + "VirtualNetworkRule", + "VirtualNetworkRuleListResult", + "AccessRights", + "DefaultAction", + "EncodingCaptureDescription", + "EndPointProvisioningState", + "EntityStatus", + "FilterType", + "IPAction", + "KeyType", + "MigrationConfigurationName", + "NameSpaceType", + "NetworkRuleIPAction", + "PrivateLinkConnectionStatus", + "ProvisioningStateDR", + "RoleDisasterRecovery", + "SkuName", + "SkuTier", + "UnavailableReason", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py index 13873fc55731..f78064380939 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,22 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class AccessKeys(msrest.serialization.Model): +class AccessKeys(_serialization.Model): """Namespace/ServiceBus Connection String. Variables are only populated by the server, and will be ignored when sending a request. @@ -45,32 +51,28 @@ class AccessKeys(msrest.serialization.Model): """ _validation = { - 'primary_connection_string': {'readonly': True}, - 'secondary_connection_string': {'readonly': True}, - 'alias_primary_connection_string': {'readonly': True}, - 'alias_secondary_connection_string': {'readonly': True}, - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - 'key_name': {'readonly': True}, + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + "alias_primary_connection_string": {"readonly": True}, + "alias_secondary_connection_string": {"readonly": True}, + "primary_key": {"readonly": True}, + "secondary_key": {"readonly": True}, + "key_name": {"readonly": True}, } _attribute_map = { - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, - 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AccessKeys, self).__init__(**kwargs) + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "alias_primary_connection_string": {"key": "aliasPrimaryConnectionString", "type": "str"}, + "alias_secondary_connection_string": {"key": "aliasSecondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.primary_connection_string = None self.secondary_connection_string = None self.alias_primary_connection_string = None @@ -80,8 +82,9 @@ def __init__( self.key_name = None -class Action(msrest.serialization.Model): - """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. +class Action(_serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have + been matched by a filter expression. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -94,9 +97,9 @@ class Action(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -104,9 +107,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -117,13 +120,13 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource definition for other than namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -137,24 +140,20 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -173,11 +172,11 @@ class ArmDisasterRecovery(Resource): :vartype type: str :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Known values are: "Accepted", - "Succeeded", "Failed". + "Succeeded", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. :vartype partner_namespace: str @@ -185,37 +184,33 @@ class ArmDisasterRecovery(Resource): pairing. :vartype alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' - or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", "Secondary". + or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", and "Secondary". :vartype role: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.RoleDisasterRecovery """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'role': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "role": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "partner_namespace": {"key": "properties.partnerNamespace", "type": "str"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "role": {"key": "properties.role", "type": "str"}, } def __init__( - self, - *, - partner_namespace: Optional[str] = None, - alternate_name: Optional[str] = None, - **kwargs - ): + self, *, partner_namespace: Optional[str] = None, alternate_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. @@ -224,7 +219,7 @@ def __init__( pairing. :paramtype alternate_name: str """ - super(ArmDisasterRecovery, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.pending_replication_operations_count = None self.partner_namespace = partner_namespace @@ -232,7 +227,7 @@ def __init__( self.role = None -class ArmDisasterRecoveryListResult(msrest.serialization.Model): +class ArmDisasterRecoveryListResult(_serialization.Model): """The result of the List Alias(Disaster Recovery configuration) operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -245,36 +240,31 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ArmDisasterRecovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ArmDisasterRecovery"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ArmDisasterRecovery"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Alias(Disaster Recovery configurations). :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery] """ - super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CaptureDescription(msrest.serialization.Model): +class CaptureDescription(_serialization.Model): """Properties to configure capture description for eventhub. :ivar enabled: A value that indicates whether capture description is enabled. :vartype enabled: bool :ivar encoding: Enumerates the possible values for the encoding format of capture description. - Known values are: "Avro", "AvroDeflate". + Known values are: "Avro" and "AvroDeflate". :vartype encoding: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EncodingCaptureDescription :ivar interval_in_seconds: The time window allows you to set the frequency with which the @@ -289,16 +279,16 @@ class CaptureDescription(msrest.serialization.Model): """ _validation = { - 'interval_in_seconds': {'maximum': 900, 'minimum': 60}, - 'size_limit_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + "interval_in_seconds": {"maximum": 900, "minimum": 60}, + "size_limit_in_bytes": {"maximum": 524288000, "minimum": 10485760}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encoding': {'key': 'encoding', 'type': 'str'}, - 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, - 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, - 'destination': {'key': 'destination', 'type': 'Destination'}, + "enabled": {"key": "enabled", "type": "bool"}, + "encoding": {"key": "encoding", "type": "str"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + "size_limit_in_bytes": {"key": "sizeLimitInBytes", "type": "int"}, + "destination": {"key": "destination", "type": "Destination"}, } def __init__( @@ -309,13 +299,13 @@ def __init__( interval_in_seconds: Optional[int] = None, size_limit_in_bytes: Optional[int] = None, destination: Optional["_models.Destination"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: A value that indicates whether capture description is enabled. :paramtype enabled: bool :keyword encoding: Enumerates the possible values for the encoding format of capture - description. Known values are: "Avro", "AvroDeflate". + description. Known values are: "Avro" and "AvroDeflate". :paramtype encoding: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EncodingCaptureDescription :keyword interval_in_seconds: The time window allows you to set the frequency with which the @@ -328,7 +318,7 @@ def __init__( Blob Names). :paramtype destination: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Destination """ - super(CaptureDescription, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.encoding = encoding self.interval_in_seconds = interval_in_seconds @@ -336,42 +326,37 @@ def __init__( self.destination = destination -class CheckNameAvailability(msrest.serialization.Model): +class CheckNameAvailability(_serialization.Model): """Description of a Check Name availability request properties. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The Name to check the namespace name availability and The namespace name - can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it - must end with a letter or number. + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The Name to check the namespace name availability and The namespace - name can contain only letters, numbers, and hyphens. The namespace must start with a letter, - and it must end with a letter or number. + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :paramtype name: str """ - super(CheckNameAvailability, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(msrest.serialization.Model): +class CheckNameAvailabilityResult(_serialization.Model): """Description of a Check Name availability request properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -382,19 +367,19 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): available; otherwise, false. :vartype name_available: bool :ivar reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :vartype reason: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.UnavailableReason """ _validation = { - 'message': {'readonly': True}, + "message": {"readonly": True}, } _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "message": {"key": "message", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, } def __init__( @@ -402,28 +387,28 @@ def __init__( *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.UnavailableReason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Value indicating namespace is availability, true if the namespace is available; otherwise, false. :paramtype name_available: bool :keyword reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :paramtype reason: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.UnavailableReason """ - super(CheckNameAvailabilityResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.message = None self.name_available = name_available self.reason = reason -class ConnectionState(msrest.serialization.Model): +class ConnectionState(_serialization.Model): """ConnectionState information. :ivar status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :vartype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkConnectionStatus :ivar description: Description of the connection state. @@ -431,8 +416,8 @@ class ConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -440,22 +425,22 @@ def __init__( *, status: Optional[Union[str, "_models.PrivateLinkConnectionStatus"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :paramtype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkConnectionStatus :keyword description: Description of the connection state. :paramtype description: str """ - super(ConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class CorrelationFilter(msrest.serialization.Model): +class CorrelationFilter(_serialization.Model): """Represents the correlation filter expression. :ivar properties: dictionary object for custom filters. @@ -482,16 +467,16 @@ class CorrelationFilter(msrest.serialization.Model): """ _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'message_id': {'key': 'messageId', 'type': 'str'}, - 'to': {'key': 'to', 'type': 'str'}, - 'reply_to': {'key': 'replyTo', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "properties": {"key": "properties", "type": "{str}"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "message_id": {"key": "messageId", "type": "str"}, + "to": {"key": "to", "type": "str"}, + "reply_to": {"key": "replyTo", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "session_id": {"key": "sessionId", "type": "str"}, + "reply_to_session_id": {"key": "replyToSessionId", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -506,9 +491,9 @@ def __init__( session_id: Optional[str] = None, reply_to_session_id: Optional[str] = None, content_type: Optional[str] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword properties: dictionary object for custom filters. :paramtype properties: dict[str, str] @@ -532,7 +517,7 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(CorrelationFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties self.correlation_id = correlation_id self.message_id = message_id @@ -545,7 +530,7 @@ def __init__( self.requires_preprocessing = requires_preprocessing -class Destination(msrest.serialization.Model): +class Destination(_serialization.Model): """Capture storage details for capture description. :ivar name: Name for capture destination. @@ -562,10 +547,10 @@ class Destination(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'blob_container': {'key': 'properties.blobContainer', 'type': 'str'}, - 'archive_name_format': {'key': 'properties.archiveNameFormat', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "storage_account_resource_id": {"key": "properties.storageAccountResourceId", "type": "str"}, + "blob_container": {"key": "properties.blobContainer", "type": "str"}, + "archive_name_format": {"key": "properties.archiveNameFormat", "type": "str"}, } def __init__( @@ -575,8 +560,8 @@ def __init__( storage_account_resource_id: Optional[str] = None, blob_container: Optional[str] = None, archive_name_format: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name for capture destination. :paramtype name: str @@ -590,52 +575,50 @@ def __init__( the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. :paramtype archive_name_format: str """ - super(Destination, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.storage_account_resource_id = storage_account_resource_id self.blob_container = blob_container self.archive_name_format = archive_name_format -class Encryption(msrest.serialization.Model): +class Encryption(_serialization.Model): """Properties to configure Encryption. :ivar key_vault_properties: Properties of KeyVault. :vartype key_vault_properties: ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyVaultProperties - :ivar key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value is "Microsoft.KeyVault". :vartype key_source: str """ _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, + "key_source": {"key": "keySource", "type": "str"}, } def __init__( self, *, key_vault_properties: Optional["_models.KeyVaultProperties"] = None, - key_source: Optional[str] = "Microsoft.KeyVault", - **kwargs - ): + key_source: Literal["Microsoft.KeyVault"] = "Microsoft.KeyVault", + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Properties of KeyVault. :paramtype key_vault_properties: ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyVaultProperties - :keyword key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is - "Microsoft.KeyVault". + :keyword key_source: Enumerates the possible value of keySource for Encryption. Default value + is "Microsoft.KeyVault". :paramtype key_source: str """ - super(Encryption, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_vault_properties = key_vault_properties self.key_source = key_source -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -643,31 +626,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -675,24 +654,19 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + "error": {"key": "error", "type": "ErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponseError """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ErrorResponseError(msrest.serialization.Model): +class ErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -711,28 +685,24 @@ class ErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -759,13 +729,13 @@ class Eventhub(Resource): :vartype updated_at: ~datetime.datetime :ivar message_retention_in_days: Number of days to retain the events for this Event Hub, value should be 1 to 7 days. - :vartype message_retention_in_days: long + :vartype message_retention_in_days: int :ivar partition_count: Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. - :vartype partition_count: long + :vartype partition_count: int :ivar status: Enumerates the possible values for the status of a Event Hub. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", - "Renaming", "Unknown". + "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :ivar capture_description: Properties of capture description. :vartype capture_description: @@ -773,27 +743,27 @@ class Eventhub(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'partition_ids': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'message_retention_in_days': {'maximum': 7, 'minimum': 1}, - 'partition_count': {'maximum': 32, 'minimum': 1}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "partition_ids": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "message_retention_in_days": {"maximum": 7, "minimum": 1}, + "partition_count": {"maximum": 32, "minimum": 1}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'partition_ids': {'key': 'properties.partitionIds', 'type': '[str]'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'message_retention_in_days': {'key': 'properties.messageRetentionInDays', 'type': 'long'}, - 'partition_count': {'key': 'properties.partitionCount', 'type': 'long'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'capture_description': {'key': 'properties.captureDescription', 'type': 'CaptureDescription'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "partition_ids": {"key": "properties.partitionIds", "type": "[str]"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "message_retention_in_days": {"key": "properties.messageRetentionInDays", "type": "int"}, + "partition_count": {"key": "properties.partitionCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "capture_description": {"key": "properties.captureDescription", "type": "CaptureDescription"}, } def __init__( @@ -803,24 +773,24 @@ def __init__( partition_count: Optional[int] = None, status: Optional[Union[str, "_models.EntityStatus"]] = None, capture_description: Optional["_models.CaptureDescription"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message_retention_in_days: Number of days to retain the events for this Event Hub, value should be 1 to 7 days. - :paramtype message_retention_in_days: long + :paramtype message_retention_in_days: int :keyword partition_count: Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. - :paramtype partition_count: long + :paramtype partition_count: int :keyword status: Enumerates the possible values for the status of a Event Hub. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :keyword capture_description: Properties of capture description. :paramtype capture_description: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CaptureDescription """ - super(Eventhub, self).__init__(**kwargs) + super().__init__(**kwargs) self.partition_ids = None self.created_at = None self.updated_at = None @@ -830,7 +800,7 @@ def __init__( self.capture_description = capture_description -class EventHubListResult(msrest.serialization.Model): +class EventHubListResult(_serialization.Model): """The result of the List EventHubs operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -843,31 +813,27 @@ class EventHubListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Eventhub]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Eventhub]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Eventhub"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Eventhub"]] = None, **kwargs: Any) -> None: """ :keyword value: Result of the List EventHubs operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Eventhub] """ - super(EventHubListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class FailoverProperties(msrest.serialization.Model): - """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. +class FailoverProperties(_serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before + switching to the secondary. :ivar is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. @@ -875,25 +841,20 @@ class FailoverProperties(msrest.serialization.Model): """ _attribute_map = { - 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + "is_safe_failover": {"key": "properties.IsSafeFailover", "type": "bool"}, } - def __init__( - self, - *, - is_safe_failover: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, is_safe_failover: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. :paramtype is_safe_failover: bool """ - super(FailoverProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_safe_failover = is_safe_failover -class Identity(msrest.serialization.Model): +class Identity(_serialization.Model): """Properties to configure Identity for Bring your Own Keys. :ivar principal_id: ObjectId from the KeyVault. @@ -901,15 +862,14 @@ class Identity(msrest.serialization.Model): :ivar tenant_id: TenantId from the KeyVault. :vartype tenant_id: str :ivar type: Enumerates the possible value Identity type, which currently supports only - 'SystemAssigned'. The only acceptable values to pass in are None and "SystemAssigned". The - default value is "SystemAssigned". + 'SystemAssigned'. Default value is "SystemAssigned". :vartype type: str """ _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -917,20 +877,19 @@ def __init__( *, principal_id: Optional[str] = None, tenant_id: Optional[str] = None, - type: Optional[str] = "SystemAssigned", - **kwargs - ): + type: Literal["SystemAssigned"] = "SystemAssigned", + **kwargs: Any + ) -> None: """ :keyword principal_id: ObjectId from the KeyVault. :paramtype principal_id: str :keyword tenant_id: TenantId from the KeyVault. :paramtype tenant_id: str :keyword type: Enumerates the possible value Identity type, which currently supports only - 'SystemAssigned'. The only acceptable values to pass in are None and "SystemAssigned". The - default value is "SystemAssigned". + 'SystemAssigned'. Default value is "SystemAssigned". :paramtype type: str """ - super(Identity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id self.type = type @@ -949,25 +908,25 @@ class IpFilterRule(Resource): :vartype type: str :ivar ip_mask: IP Mask. :vartype ip_mask: str - :ivar action: The IP Filter Action. Known values are: "Accept", "Reject". + :ivar action: The IP Filter Action. Known values are: "Accept" and "Reject". :vartype action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.IPAction :ivar filter_name: IP Filter name. :vartype filter_name: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'ip_mask': {'key': 'properties.ipMask', 'type': 'str'}, - 'action': {'key': 'properties.action', 'type': 'str'}, - 'filter_name': {'key': 'properties.filterName', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "ip_mask": {"key": "properties.ipMask", "type": "str"}, + "action": {"key": "properties.action", "type": "str"}, + "filter_name": {"key": "properties.filterName", "type": "str"}, } def __init__( @@ -976,23 +935,23 @@ def __init__( ip_mask: Optional[str] = None, action: Optional[Union[str, "_models.IPAction"]] = None, filter_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword ip_mask: IP Mask. :paramtype ip_mask: str - :keyword action: The IP Filter Action. Known values are: "Accept", "Reject". + :keyword action: The IP Filter Action. Known values are: "Accept" and "Reject". :paramtype action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.IPAction :keyword filter_name: IP Filter name. :paramtype filter_name: str """ - super(IpFilterRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_mask = ip_mask self.action = action self.filter_name = filter_name -class IpFilterRuleListResult(msrest.serialization.Model): +class IpFilterRuleListResult(_serialization.Model): """The response from the List namespace operation. :ivar value: Result of the List IpFilter Rules operation. @@ -1003,17 +962,13 @@ class IpFilterRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[IpFilterRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[IpFilterRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.IpFilterRule"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.IpFilterRule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List IpFilter Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule] @@ -1021,12 +976,12 @@ def __init__( list of IpFilter Rules. :paramtype next_link: str """ - super(IpFilterRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class KeyVaultProperties(msrest.serialization.Model): +class KeyVaultProperties(_serialization.Model): """Properties to configure keyVault Properties. :ivar key_name: Name of the Key from KeyVault. @@ -1036,69 +991,59 @@ class KeyVaultProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + "key_name": {"key": "keyName", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, } - def __init__( - self, - *, - key_name: Optional[str] = None, - key_vault_uri: Optional[str] = None, - **kwargs - ): + def __init__(self, *, key_name: Optional[str] = None, key_vault_uri: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key_name: Name of the Key from KeyVault. :paramtype key_name: str :keyword key_vault_uri: Uri of KeyVault. :paramtype key_vault_uri: str """ - super(KeyVaultProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name self.key_vault_uri = key_vault_uri -class MessageCountDetails(msrest.serialization.Model): +class MessageCountDetails(_serialization.Model): """Message Count Details. Variables are only populated by the server, and will be ignored when sending a request. :ivar active_message_count: Number of active messages in the queue, topic, or subscription. - :vartype active_message_count: long + :vartype active_message_count: int :ivar dead_letter_message_count: Number of messages that are dead lettered. - :vartype dead_letter_message_count: long + :vartype dead_letter_message_count: int :ivar scheduled_message_count: Number of scheduled messages. - :vartype scheduled_message_count: long + :vartype scheduled_message_count: int :ivar transfer_message_count: Number of messages transferred to another queue, topic, or subscription. - :vartype transfer_message_count: long + :vartype transfer_message_count: int :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. - :vartype transfer_dead_letter_message_count: long + :vartype transfer_dead_letter_message_count: int """ _validation = { - 'active_message_count': {'readonly': True}, - 'dead_letter_message_count': {'readonly': True}, - 'scheduled_message_count': {'readonly': True}, - 'transfer_message_count': {'readonly': True}, - 'transfer_dead_letter_message_count': {'readonly': True}, + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, } _attribute_map = { - 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, - 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, - 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, - 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, - 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MessageCountDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.active_message_count = None self.dead_letter_message_count = None self.scheduled_message_count = None @@ -1106,7 +1051,7 @@ def __init__( self.transfer_dead_letter_message_count = None -class MigrationConfigListResult(msrest.serialization.Model): +class MigrationConfigListResult(_serialization.Model): """The result of the List migrationConfigurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1120,26 +1065,21 @@ class MigrationConfigListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationConfigProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MigrationConfigProperties"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MigrationConfigProperties"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Migration Configs. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] """ - super(MigrationConfigListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None @@ -1158,7 +1098,7 @@ class MigrationConfigProperties(Resource): :ivar provisioning_state: Provisioning state of Migration Configuration. :vartype provisioning_state: str :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. :vartype target_namespace: str @@ -1170,32 +1110,28 @@ class MigrationConfigProperties(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'migration_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "migration_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, - 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, - 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "target_namespace": {"key": "properties.targetNamespace", "type": "str"}, + "post_migration_name": {"key": "properties.postMigrationName", "type": "str"}, + "migration_state": {"key": "properties.migrationState", "type": "str"}, } def __init__( - self, - *, - target_namespace: Optional[str] = None, - post_migration_name: Optional[str] = None, - **kwargs - ): + self, *, target_namespace: Optional[str] = None, post_migration_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. @@ -1203,7 +1139,7 @@ def __init__( :keyword post_migration_name: Name to access Standard Namespace after migration. :paramtype post_migration_name: str """ - super(MigrationConfigProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.pending_replication_operations_count = None self.target_namespace = target_namespace @@ -1222,7 +1158,8 @@ class NetworkRuleSet(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow", "Deny". + :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". :vartype default_action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.DefaultAction :ivar virtual_network_rules: List VirtualNetwork Rules. :vartype virtual_network_rules: @@ -1232,18 +1169,18 @@ class NetworkRuleSet(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "default_action": {"key": "properties.defaultAction", "type": "str"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[NWRuleSetVirtualNetworkRules]"}, + "ip_rules": {"key": "properties.ipRules", "type": "[NWRuleSetIpRules]"}, } def __init__( @@ -1252,10 +1189,10 @@ def __init__( default_action: Optional[Union[str, "_models.DefaultAction"]] = None, virtual_network_rules: Optional[List["_models.NWRuleSetVirtualNetworkRules"]] = None, ip_rules: Optional[List["_models.NWRuleSetIpRules"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow", + :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow" and "Deny". :paramtype default_action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.DefaultAction @@ -1265,13 +1202,13 @@ def __init__( :keyword ip_rules: List of IpRules. :paramtype ip_rules: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetIpRules] """ - super(NetworkRuleSet, self).__init__(**kwargs) + super().__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules self.ip_rules = ip_rules -class NetworkRuleSetListResult(msrest.serialization.Model): +class NetworkRuleSetListResult(_serialization.Model): """The response of the List NetworkRuleSet operation. :ivar value: Result of the List NetworkRuleSet operation. @@ -1282,17 +1219,13 @@ class NetworkRuleSetListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NetworkRuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.NetworkRuleSet"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.NetworkRuleSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List NetworkRuleSet operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet] @@ -1300,44 +1233,44 @@ def __init__( list of NetworkRuleSet. :paramtype next_link: str """ - super(NetworkRuleSetListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class NWRuleSetIpRules(msrest.serialization.Model): +class NWRuleSetIpRules(_serialization.Model): """Description of NetWorkRuleSet - IpRules resource. :ivar ip_mask: IP Mask. :vartype ip_mask: str - :ivar action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :ivar action: The IP Filter Action. "Allow" :vartype action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleIPAction """ _attribute_map = { - 'ip_mask': {'key': 'ipMask', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, + "ip_mask": {"key": "ipMask", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "_models.NetworkRuleIPAction"]] = "Allow", - **kwargs - ): + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword ip_mask: IP Mask. :paramtype ip_mask: str - :keyword action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :keyword action: The IP Filter Action. "Allow" :paramtype action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleIPAction """ - super(NWRuleSetIpRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_mask = ip_mask self.action = action -class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): +class NWRuleSetVirtualNetworkRules(_serialization.Model): """Description of VirtualNetworkRules - NetworkRules resource. :ivar subnet: Subnet properties. @@ -1348,8 +1281,8 @@ class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): """ _attribute_map = { - 'subnet': {'key': 'subnet', 'type': 'Subnet'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + "subnet": {"key": "subnet", "type": "Subnet"}, + "ignore_missing_vnet_service_endpoint": {"key": "ignoreMissingVnetServiceEndpoint", "type": "bool"}, } def __init__( @@ -1357,8 +1290,8 @@ def __init__( *, subnet: Optional["_models.Subnet"] = None, ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet: Subnet properties. :paramtype subnet: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Subnet @@ -1366,12 +1299,12 @@ def __init__( VNet Service Endpoint. :paramtype ignore_missing_vnet_service_endpoint: bool """ - super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.subnet = subnet self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """A ServiceBus REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1383,30 +1316,25 @@ class Operation(msrest.serialization.Model): """ _validation = { - 'name': {'readonly': True}, + "name": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__( - self, - *, - display: Optional["_models.OperationDisplay"] = None, - **kwargs - ): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationDisplay """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.display = display -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """The object that represents the operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1420,31 +1348,28 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None -class OperationListResult(msrest.serialization.Model): - """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1456,22 +1381,18 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None @@ -1489,38 +1410,32 @@ class ResourceNamespacePatch(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(ResourceNamespacePatch, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags @@ -1538,7 +1453,7 @@ class PremiumMessagingRegions(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar properties: :vartype properties: @@ -1546,18 +1461,18 @@ class PremiumMessagingRegions(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'PremiumMessagingRegionsProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "PremiumMessagingRegionsProperties"}, } def __init__( @@ -1566,22 +1481,22 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.PremiumMessagingRegionsProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword properties: :paramtype properties: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsProperties """ - super(PremiumMessagingRegions, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.properties = properties -class PremiumMessagingRegionsListResult(msrest.serialization.Model): +class PremiumMessagingRegionsListResult(_serialization.Model): """The response of the List PremiumMessagingRegions operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1594,31 +1509,26 @@ class PremiumMessagingRegionsListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[PremiumMessagingRegions]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PremiumMessagingRegions]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.PremiumMessagingRegions"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PremiumMessagingRegions"]] = None, **kwargs: Any) -> None: """ :keyword value: Result of the List PremiumMessagingRegions type. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] """ - super(PremiumMessagingRegionsListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PremiumMessagingRegionsProperties(msrest.serialization.Model): +class PremiumMessagingRegionsProperties(_serialization.Model): """PremiumMessagingRegionsProperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1630,27 +1540,23 @@ class PremiumMessagingRegionsProperties(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'full_name': {'readonly': True}, + "code": {"readonly": True}, + "full_name": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'full_name': {'key': 'fullName', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, + "full_name": {"key": "fullName", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PremiumMessagingRegionsProperties, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.full_name = None -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """PrivateEndpoint information. :ivar id: The ARM identifier for Private Endpoint. @@ -1658,20 +1564,15 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The ARM identifier for Private Endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id @@ -1692,24 +1593,27 @@ class PrivateEndpointConnection(Resource): :vartype private_link_service_connection_state: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ConnectionState :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Known values - are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EndPointProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "ConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( @@ -1718,8 +1622,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.ConnectionState"] = None, provisioning_state: Optional[Union[str, "_models.EndPointProvisioningState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The Private Endpoint resource for this Connection. :paramtype private_endpoint: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpoint @@ -1727,17 +1631,17 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ConnectionState :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :paramtype provisioning_state: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EndPointProvisioningState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """Result of the list of all private endpoint connections operation. :ivar value: A collection of private endpoint connection resources. @@ -1748,8 +1652,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1757,8 +1661,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private endpoint connection resources. :paramtype value: @@ -1766,12 +1670,12 @@ def __init__( :keyword next_link: A link for the next page of private endpoint connection resources. :paramtype next_link: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """Information of the private link resource. :ivar id: Fully qualified identifier of the resource. @@ -1789,25 +1693,25 @@ class PrivateLinkResource(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the resource. :paramtype id: str @@ -1822,7 +1726,7 @@ def __init__( :keyword required_zone_names: Required Zone Names. :paramtype required_zone_names: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -1831,7 +1735,7 @@ def __init__( self.required_zone_names = required_zone_names -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """Result of the List private link resources operation. :ivar value: A collection of private link resources. @@ -1841,8 +1745,8 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1850,25 +1754,26 @@ def __init__( *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private link resources. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResource] :keyword next_link: A link for the next page of private link resources. :paramtype next_link: str """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RegenerateAccessKeyParameters(msrest.serialization.Model): - """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. +class RegenerateAccessKeyParameters(_serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs + to be reset. All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :ivar key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :vartype key_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyType :ivar key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key @@ -1877,30 +1782,24 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): """ _validation = { - 'key_type': {'required': True}, + "key_type": {"required": True}, } _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, + "key_type": {"key": "keyType", "type": "str"}, + "key": {"key": "key", "type": "str"}, } - def __init__( - self, - *, - key_type: Union[str, "_models.KeyType"], - key: Optional[str] = None, - **kwargs - ): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :keyword key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :paramtype key_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyType :keyword key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :paramtype key: str """ - super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_type = key_type self.key = key @@ -1920,7 +1819,7 @@ class Rule(Resource): message that have been matched by a filter expression. :vartype action: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Action :ivar filter_type: Filter type that is evaluated against a BrokeredMessage. Known values are: - "SqlFilter", "CorrelationFilter". + "SqlFilter" and "CorrelationFilter". :vartype filter_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.FilterType :ivar sql_filter: Properties of sqlFilter. :vartype sql_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SqlFilter @@ -1930,19 +1829,19 @@ class Rule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'action': {'key': 'properties.action', 'type': 'Action'}, - 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, - 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, - 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "action": {"key": "properties.action", "type": "Action"}, + "filter_type": {"key": "properties.filterType", "type": "str"}, + "sql_filter": {"key": "properties.sqlFilter", "type": "SqlFilter"}, + "correlation_filter": {"key": "properties.correlationFilter", "type": "CorrelationFilter"}, } def __init__( @@ -1952,14 +1851,14 @@ def __init__( filter_type: Optional[Union[str, "_models.FilterType"]] = None, sql_filter: Optional["_models.SqlFilter"] = None, correlation_filter: Optional["_models.CorrelationFilter"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. :paramtype action: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Action :keyword filter_type: Filter type that is evaluated against a BrokeredMessage. Known values - are: "SqlFilter", "CorrelationFilter". + are: "SqlFilter" and "CorrelationFilter". :paramtype filter_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.FilterType :keyword sql_filter: Properties of sqlFilter. :paramtype sql_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SqlFilter @@ -1967,14 +1866,14 @@ def __init__( :paramtype correlation_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CorrelationFilter """ - super(Rule, self).__init__(**kwargs) + super().__init__(**kwargs) self.action = action self.filter_type = filter_type self.sql_filter = sql_filter self.correlation_filter = correlation_filter -class RuleListResult(msrest.serialization.Model): +class RuleListResult(_serialization.Model): """The response of the List rule operation. :ivar value: Result of the List Rules operation. @@ -1985,17 +1884,13 @@ class RuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.Rule"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Rule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule] @@ -2003,7 +1898,7 @@ def __init__( list of rules. :paramtype next_link: str """ - super(RuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -2024,33 +1919,28 @@ class SBAuthorizationRule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } - def __init__( - self, - *, - rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + def __init__(self, *, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, **kwargs: Any) -> None: """ :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessRights] """ - super(SBAuthorizationRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.rights = rights -class SBAuthorizationRuleListResult(msrest.serialization.Model): +class SBAuthorizationRuleListResult(_serialization.Model): """The response to the List Namespace operation. :ivar value: Result of the List Authorization Rules operation. @@ -2061,8 +1951,8 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBAuthorizationRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -2070,8 +1960,8 @@ def __init__( *, value: Optional[List["_models.SBAuthorizationRule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Authorization Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] @@ -2079,7 +1969,7 @@ def __init__( list of Authorization Rules. :paramtype next_link: str """ - super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -2097,46 +1987,40 @@ class TrackedResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags -class SBNamespace(TrackedResource): +class SBNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2149,9 +2033,9 @@ class SBNamespace(TrackedResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku @@ -2177,34 +2061,34 @@ class SBNamespace(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, } def __init__( @@ -2216,12 +2100,12 @@ def __init__( identity: Optional["_models.Identity"] = None, zone_redundant: Optional[bool] = None, encryption: Optional["_models.Encryption"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku @@ -2233,7 +2117,7 @@ def __init__( :keyword encryption: Properties of BYOK Encryption description. :paramtype encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ - super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.provisioning_state = None @@ -2246,7 +2130,7 @@ def __init__( self.encryption = encryption -class SBNamespaceListResult(msrest.serialization.Model): +class SBNamespaceListResult(_serialization.Model): """The response of the List Namespace operation. :ivar value: Result of the List Namespace operation. @@ -2257,17 +2141,13 @@ class SBNamespaceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBNamespace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBNamespace]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBNamespace"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBNamespace"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Namespace operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] @@ -2275,47 +2155,42 @@ def __init__( list of Namespaces. :paramtype next_link: str """ - super(SBNamespaceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBNamespaceMigrate(msrest.serialization.Model): +class SBNamespaceMigrate(_serialization.Model): """Namespace Migrate Object. All required parameters must be populated in order to send to Azure. - :ivar target_namespace_type: Required. Type of namespaces. Known values are: "Messaging", - "NotificationHub", "Mixed", "EventHub", "Relay". + :ivar target_namespace_type: Type of namespaces. Required. Known values are: "Messaging", + "NotificationHub", "Mixed", "EventHub", and "Relay". :vartype target_namespace_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NameSpaceType """ _validation = { - 'target_namespace_type': {'required': True}, + "target_namespace_type": {"required": True}, } _attribute_map = { - 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'str'}, + "target_namespace_type": {"key": "targetNamespaceType", "type": "str"}, } - def __init__( - self, - *, - target_namespace_type: Union[str, "_models.NameSpaceType"], - **kwargs - ): + def __init__(self, *, target_namespace_type: Union[str, "_models.NameSpaceType"], **kwargs: Any) -> None: """ - :keyword target_namespace_type: Required. Type of namespaces. Known values are: "Messaging", - "NotificationHub", "Mixed", "EventHub", "Relay". + :keyword target_namespace_type: Type of namespaces. Required. Known values are: "Messaging", + "NotificationHub", "Mixed", "EventHub", and "Relay". :paramtype target_namespace_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NameSpaceType """ - super(SBNamespaceMigrate, self).__init__(**kwargs) + super().__init__(**kwargs) self.target_namespace_type = target_namespace_type -class SBNamespaceUpdateParameters(ResourceNamespacePatch): +class SBNamespaceUpdateParameters(ResourceNamespacePatch): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2328,7 +2203,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku @@ -2354,33 +2229,33 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, } def __init__( @@ -2392,12 +2267,12 @@ def __init__( identity: Optional["_models.Identity"] = None, zone_redundant: Optional[bool] = None, encryption: Optional["_models.Encryption"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku @@ -2409,7 +2284,7 @@ def __init__( :keyword encryption: Properties of BYOK Encryption description. :paramtype encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ - super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.provisioning_state = None @@ -2422,7 +2297,7 @@ def __init__( self.encryption = encryption -class SBQueue(Resource): +class SBQueue(Resource): # pylint: disable=too-many-instance-attributes """Description of queue Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2443,9 +2318,9 @@ class SBQueue(Resource): to this queue. :vartype accessed_at: ~datetime.datetime :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. @@ -2474,7 +2349,7 @@ class SBQueue(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2495,45 +2370,48 @@ class SBQueue(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'message_count': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "message_count": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2551,8 +2429,8 @@ def __init__( enable_express: Optional[bool] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 @@ -2582,7 +2460,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2602,7 +2480,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBQueue, self).__init__(**kwargs) + super().__init__(**kwargs) self.count_details = None self.created_at = None self.updated_at = None @@ -2626,7 +2504,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBQueueListResult(msrest.serialization.Model): +class SBQueueListResult(_serialization.Model): """The response to the List Queues operation. :ivar value: Result of the List Queues operation. @@ -2637,17 +2515,13 @@ class SBQueueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBQueue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBQueue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBQueue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Queues operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue] @@ -2655,19 +2529,19 @@ def __init__( list of queues. :paramtype next_link: str """ - super(SBQueueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBSku(msrest.serialization.Model): +class SBSku(_serialization.Model): """SKU of the namespace. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :ivar name: Name of this SKU. Required. Known values are: "Basic", "Standard", and "Premium". :vartype name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuName - :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", + :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", and "Premium". :vartype tier: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuTier :ivar capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 @@ -2676,13 +2550,13 @@ class SBSku(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( @@ -2691,25 +2565,26 @@ def __init__( name: Union[str, "_models.SkuName"], tier: Optional[Union[str, "_models.SkuTier"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :keyword name: Name of this SKU. Required. Known values are: "Basic", "Standard", and + "Premium". :paramtype name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuName :keyword tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", - "Premium". + and "Premium". :paramtype tier: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuTier :keyword capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :paramtype capacity: int """ - super(SBSku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SBSubscription(Resource): +class SBSubscription(Resource): # pylint: disable=too-many-instance-attributes """Description of subscription resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2721,7 +2596,7 @@ class SBSubscription(Resource): :ivar type: Resource type. :vartype type: str :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar accessed_at: Last time there was a receive request to this subscription. @@ -2752,7 +2627,7 @@ class SBSubscription(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2767,37 +2642,43 @@ class SBSubscription(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'message_count': {'readonly': True}, - 'created_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "message_count": {"readonly": True}, + "created_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, } def __init__( @@ -2815,8 +2696,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. @@ -2840,7 +2721,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2854,7 +2735,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBSubscription, self).__init__(**kwargs) + super().__init__(**kwargs) self.message_count = None self.created_at = None self.accessed_at = None @@ -2874,7 +2755,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBSubscriptionListResult(msrest.serialization.Model): +class SBSubscriptionListResult(_serialization.Model): """The response to the List Subscriptions operation. :ivar value: Result of the List Subscriptions operation. @@ -2885,17 +2766,13 @@ class SBSubscriptionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBSubscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBSubscription"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBSubscription"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Subscriptions operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription] @@ -2903,12 +2780,12 @@ def __init__( list of subscriptions. :paramtype next_link: str """ - super(SBSubscriptionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBTopic(Resource): +class SBTopic(Resource): # pylint: disable=too-many-instance-attributes """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2920,7 +2797,7 @@ class SBTopic(Resource): :ivar type: Resource type. :vartype type: str :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2949,7 +2826,7 @@ class SBTopic(Resource): :vartype enable_batched_operations: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :ivar support_ordering: Value that indicates whether the topic supports ordering. :vartype support_ordering: bool @@ -2965,37 +2842,40 @@ class SBTopic(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "subscription_count": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, } def __init__( @@ -3011,8 +2891,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, enable_partitioning: Optional[bool] = None, enable_express: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -3032,7 +2912,7 @@ def __init__( :paramtype enable_batched_operations: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool @@ -3046,7 +2926,7 @@ def __init__( topic holds a message in memory temporarily before writing it to persistent storage. :paramtype enable_express: bool """ - super(SBTopic, self).__init__(**kwargs) + super().__init__(**kwargs) self.size_in_bytes = None self.created_at = None self.updated_at = None @@ -3065,7 +2945,7 @@ def __init__( self.enable_express = enable_express -class SBTopicListResult(msrest.serialization.Model): +class SBTopicListResult(_serialization.Model): """The response to the List Topics operation. :ivar value: Result of the List Topics operation. @@ -3076,17 +2956,13 @@ class SBTopicListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBTopic]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBTopic"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBTopic"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Topics operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic] @@ -3094,13 +2970,14 @@ def __init__( list of topics. :paramtype next_link: str """ - super(SBTopicListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SqlFilter(msrest.serialization.Model): - """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. +class SqlFilter(_serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in + the pub/sub pipeline. :ivar sql_expression: The SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -3113,23 +2990,23 @@ class SqlFilter(msrest.serialization.Model): """ _validation = { - 'compatibility_level': {'maximum': 20, 'minimum': 20}, + "compatibility_level": {"maximum": 20, "minimum": 20}, } _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( self, *, sql_expression: Optional[str] = None, - compatibility_level: Optional[int] = 20, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + compatibility_level: int = 20, + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: The SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -3140,14 +3017,15 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing class SqlRuleAction(Action): - """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + """Represents set of actions written in SQL language-based syntax that is performed against a + ServiceBus.Messaging.BrokeredMessage. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -3160,9 +3038,9 @@ class SqlRuleAction(Action): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -3170,9 +3048,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -3183,37 +3061,37 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + super().__init__( + sql_expression=sql_expression, + compatibility_level=compatibility_level, + requires_preprocessing=requires_preprocessing, + **kwargs + ) -class Subnet(msrest.serialization.Model): +class Subnet(_serialization.Model): """Properties supplied for Subnet. All required parameters must be populated in order to send to Azure. - :ivar id: Required. Resource ID of Virtual Network Subnet. + :ivar id: Resource ID of Virtual Network Subnet. Required. :vartype id: str """ _validation = { - 'id': {'required': True}, + "id": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: str, - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Required. Resource ID of Virtual Network Subnet. + :keyword id: Resource ID of Virtual Network Subnet. Required. :paramtype id: str """ - super(Subnet, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id @@ -3233,33 +3111,28 @@ class VirtualNetworkRule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'virtual_network_subnet_id': {'key': 'properties.virtualNetworkSubnetId', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "virtual_network_subnet_id": {"key": "properties.virtualNetworkSubnetId", "type": "str"}, } - def __init__( - self, - *, - virtual_network_subnet_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, virtual_network_subnet_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword virtual_network_subnet_id: Resource ID of Virtual Network Subnet. :paramtype virtual_network_subnet_id: str """ - super(VirtualNetworkRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.virtual_network_subnet_id = virtual_network_subnet_id -class VirtualNetworkRuleListResult(msrest.serialization.Model): +class VirtualNetworkRuleListResult(_serialization.Model): """The response from the List namespace operation. :ivar value: Result of the List VirtualNetwork Rules operation. @@ -3270,8 +3143,8 @@ class VirtualNetworkRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualNetworkRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[VirtualNetworkRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -3279,8 +3152,8 @@ def __init__( *, value: Optional[List["_models.VirtualNetworkRule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List VirtualNetwork Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule] @@ -3288,6 +3161,6 @@ def __init__( list of VirtualNetwork Rules. :paramtype next_link: str """ - super(VirtualNetworkRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py index cf94f7f2109d..af42f8afb68f 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py @@ -11,28 +11,29 @@ class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" + class DefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Default Action for Network Rule Set - """ + """Default Action for Network Rule Set.""" ALLOW = "Allow" DENY = "Deny" + class EncodingCaptureDescription(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enumerates the possible values for the encoding format of capture description. - """ + """Enumerates the possible values for the encoding format of capture description.""" AVRO = "Avro" AVRO_DEFLATE = "AvroDeflate" + class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Private Endpoint Connection. - """ + """Provisioning state of the Private Endpoint Connection.""" CREATING = "Creating" UPDATING = "Updating" @@ -41,9 +42,9 @@ class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" FAILED = "Failed" + class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity status. - """ + """Entity status.""" ACTIVE = "Active" DISABLED = "Disabled" @@ -55,34 +56,36 @@ class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENAMING = "Renaming" UNKNOWN = "Unknown" + class FilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Rule filter types - """ + """Rule filter types.""" SQL_FILTER = "SqlFilter" CORRELATION_FILTER = "CorrelationFilter" + class IPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP Filter Action - """ + """The IP Filter Action.""" ACCEPT = "Accept" REJECT = "Reject" + class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The access key to regenerate. - """ + """The access key to regenerate.""" PRIMARY_KEY = "PrimaryKey" SECONDARY_KEY = "SecondaryKey" + class MigrationConfigurationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationConfigurationName.""" _DEFAULT = "$default" + class NameSpaceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of namespaces - """ + """Type of namespaces.""" MESSAGING = "Messaging" NOTIFICATION_HUB = "NotificationHub" @@ -90,58 +93,60 @@ class NameSpaceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): EVENT_HUB = "EventHub" RELAY = "Relay" + class NetworkRuleIPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP Filter Action - """ + """The IP Filter Action.""" ALLOW = "Allow" + class PrivateLinkConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the connection. - """ + """Status of the connection.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ProvisioningStateDR(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' - or 'Succeeded' or 'Failed' + or 'Succeeded' or 'Failed'. """ ACCEPTED = "Accepted" SUCCEEDED = "Succeeded" FAILED = "Failed" + class RoleDisasterRecovery(str, Enum, metaclass=CaseInsensitiveEnumMeta): """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or - 'Secondary' + 'Secondary'. """ PRIMARY = "Primary" PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" SECONDARY = "Secondary" + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of this SKU. - """ + """Name of this SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The billing tier of this particular SKU. - """ + """The billing tier of this particular SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the reason for the unavailability of the service. - """ + """Specifies the reason for the unavailability of the service.""" NONE = "None" INVALID_NAME = "InvalidName" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py index a21798eafb6a..7209ae076025 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py @@ -21,22 +21,23 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'DisasterRecoveryConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'EventHubsOperations', - 'MigrationConfigsOperations', - 'PremiumMessagingRegionsOperations', - 'RegionsOperations', - 'SubscriptionsOperations', - 'RulesOperations', - 'Operations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "DisasterRecoveryConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "EventHubsOperations", + "MigrationConfigsOperations", + "PremiumMessagingRegionsOperations", + "RegionsOperations", + "SubscriptionsOperations", + "RulesOperations", + "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py index 0f566aa173b3..268e3934a549 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,343 +27,313 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_check_name_availability_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.ArmDisasterRecovery] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_break_pairing_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_fail_over_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.FailoverProperties] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -370,34 +347,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -411,34 +391,38 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class DisasterRecoveryConfigsOperations: """ @@ -459,41 +443,109 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace + @overload def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -502,18 +554,18 @@ def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,74 +573,79 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -596,16 +653,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -616,49 +671,126 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -668,18 +800,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -689,67 +821,67 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -760,60 +892,60 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -821,68 +953,68 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -893,50 +1025,127 @@ def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - @distributed_trace + @overload def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -946,18 +1155,18 @@ def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -968,72 +1177,78 @@ def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1041,16 +1256,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1061,48 +1274,50 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1110,18 +1325,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1129,52 +1343,55 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1182,18 +1399,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1201,12 +1417,13 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py index 1cbbff68b736..1ff9a7a8ff59 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,48 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_namespace_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class EventHubsOperations: """ @@ -82,64 +95,68 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_namespace( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.EventHubListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.Eventhub"]: """Gets all the Event Hubs in a service bus Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :return: An iterator like instance of either Eventhub or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.EventHubListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.Eventhub] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.EventHubListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_namespace.metadata['url'], + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -147,16 +164,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EventHubListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -167,8 +182,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py index b08f30bed97b..b516773fdd7f 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,251 +29,257 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_and_start_migration_request_initial( +def build_create_and_start_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, - *, - json: Optional[_models.MigrationConfigProperties] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_complete_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_revert_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class MigrationConfigsOperations: """ @@ -287,65 +300,69 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,16 +370,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -373,35 +388,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -409,57 +435,146 @@ def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> LROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -472,114 +587,114 @@ def begin_create_and_start_migration( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_and_start_migration_initial( # type: ignore + raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -590,61 +705,65 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,70 +771,74 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,61 +849,65 @@ def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -791,5 +918,6 @@ def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py index 8cbcfe7bede7..97ce2ca928d5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,1020 +29,929 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_ip_filter_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_ip_filter_rule_request( - resource_group_name: str, - namespace_name: str, - ip_filter_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.IpFilterRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "ipFilterRuleName": _SERIALIZER.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "ipFilterRuleName": _SERIALIZER.url("ip_filter_rule_name", ip_filter_rule_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_ip_filter_rule_request( - resource_group_name: str, - namespace_name: str, - ip_filter_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "ipFilterRuleName": _SERIALIZER.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "ipFilterRuleName": _SERIALIZER.url("ip_filter_rule_name", ip_filter_rule_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_ip_filter_rule_request( - resource_group_name: str, - namespace_name: str, - ip_filter_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "ipFilterRuleName": _SERIALIZER.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "ipFilterRuleName": _SERIALIZER.url("ip_filter_rule_name", ip_filter_rule_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespace] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_list_virtual_network_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_virtual_network_rule_request( - resource_group_name: str, - namespace_name: str, - virtual_network_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.VirtualNetworkRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "virtualNetworkRuleName": _SERIALIZER.url( + "virtual_network_rule_name", virtual_network_rule_name, "str", min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_virtual_network_rule_request( - resource_group_name: str, - namespace_name: str, - virtual_network_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "virtualNetworkRuleName": _SERIALIZER.url( + "virtual_network_rule_name", virtual_network_rule_name, "str", min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_virtual_network_rule_request( - resource_group_name: str, - namespace_name: str, - virtual_network_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "virtualNetworkRuleName": _SERIALIZER.url( + "virtual_network_rule_name", virtual_network_rule_name, "str", min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NetworkRuleSet] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_network_rule_sets_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_migrate_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceMigrate] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class NamespacesOperations: # pylint: disable=too-many-public-methods """ @@ -1056,65 +972,68 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_ip_filter_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.IpFilterRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.IpFilterRule"]: """Gets a list of IP Filter rules for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IpFilterRuleListResult or the result of - cls(response) + :return: An iterator like instance of either IpFilterRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.IpFilterRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.IpFilterRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_ip_filter_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_ip_filter_rules.metadata['url'], + template_url=self.list_ip_filter_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_ip_filter_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1122,16 +1041,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IpFilterRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1142,49 +1059,124 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_ip_filter_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules"} # type: ignore + list_ip_filter_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules" + } - @distributed_trace + @overload def create_or_update_ip_filter_rule( self, resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, parameters: _models.IpFilterRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.IpFilterRule: """Creates or updates an IpFilterRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param ip_filter_rule_name: The IP Filter Rule name. + :param ip_filter_rule_name: The IP Filter Rule name. Required. :type ip_filter_rule_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpFilterRule: + """Creates or updates an IpFilterRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param ip_filter_rule_name: The IP Filter Rule name. Required. + :type ip_filter_rule_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + parameters: Union[_models.IpFilterRule, IO], + **kwargs: Any + ) -> _models.IpFilterRule: + """Creates or updates an IpFilterRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param ip_filter_rule_name: The IP Filter Rule name. Required. + :type ip_filter_rule_name: str + :param parameters: The Namespace IpFilterRule. Is either a IpFilterRule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IpFilterRule, or the result of cls(response) + :return: IpFilterRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.IpFilterRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpFilterRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'IpFilterRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "IpFilterRule") request = build_create_or_update_ip_filter_rule_request( resource_group_name=resource_group_name, @@ -1194,18 +1186,18 @@ def create_or_update_ip_filter_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_ip_filter_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_ip_filter_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1213,67 +1205,67 @@ def create_or_update_ip_filter_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IpFilterRule', pipeline_response) + deserialized = self._deserialize("IpFilterRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_ip_filter_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}"} # type: ignore - + create_or_update_ip_filter_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}" + } @distributed_trace def delete_ip_filter_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - ip_filter_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, **kwargs: Any ) -> None: """Deletes an IpFilterRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param ip_filter_rule_name: The IP Filter Rule name. + :param ip_filter_rule_name: The IP Filter Rule name. Required. :type ip_filter_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_ip_filter_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, ip_filter_rule_name=ip_filter_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_ip_filter_rule.metadata['url'], + template_url=self.delete_ip_filter_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1284,60 +1276,60 @@ def delete_ip_filter_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_ip_filter_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}"} # type: ignore - + delete_ip_filter_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}" + } @distributed_trace def get_ip_filter_rule( - self, - resource_group_name: str, - namespace_name: str, - ip_filter_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, **kwargs: Any ) -> _models.IpFilterRule: """Gets an IpFilterRule for a Namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param ip_filter_rule_name: The IP Filter Rule name. + :param ip_filter_rule_name: The IP Filter Rule name. Required. :type ip_filter_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IpFilterRule, or the result of cls(response) + :return: IpFilterRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.IpFilterRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.IpFilterRule] = kwargs.pop("cls", None) - request = build_get_ip_filter_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, ip_filter_rule_name=ip_filter_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_ip_filter_rule.metadata['url'], + template_url=self.get_ip_filter_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1345,64 +1337,74 @@ def get_ip_filter_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IpFilterRule', pipeline_response) + deserialized = self._deserialize("IpFilterRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_ip_filter_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}"} # type: ignore - + get_ip_filter_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}" + } @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1410,16 +1412,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1430,65 +1430,70 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1496,16 +1501,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1516,90 +1519,107 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1612,121 +1632,193 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - namespace_name=namespace_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + @overload + def begin_create_or_update( self, resource_group_name: str, namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx - - request = build_delete_request_initial( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - headers=_headers, - params=_params, - ) + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SBNamespace", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1738,103 +1830,101 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1842,51 +1932,124 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1895,18 +2058,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1916,77 +2079,82 @@ def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace def list_virtual_network_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.VirtualNetworkRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualNetworkRule"]: """Gets a list of VirtualNetwork rules for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of - cls(response) + :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.VirtualNetworkRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_virtual_network_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_virtual_network_rules.metadata['url'], + template_url=self.list_virtual_network_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_virtual_network_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1994,16 +2162,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2014,49 +2180,124 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_virtual_network_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules"} # type: ignore + list_virtual_network_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules" + } - @distributed_trace + @overload def create_or_update_virtual_network_rule( self, resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, parameters: _models.VirtualNetworkRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.VirtualNetworkRule: """Creates or updates an VirtualNetworkRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param virtual_network_rule_name: The Virtual Network Rule name. + :param virtual_network_rule_name: The Virtual Network Rule name. Required. :type virtual_network_rule_name: str - :param parameters: The Namespace VirtualNetworkRule. + :param parameters: The Namespace VirtualNetworkRule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates an VirtualNetworkRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param virtual_network_rule_name: The Virtual Network Rule name. Required. + :type virtual_network_rule_name: str + :param parameters: The Namespace VirtualNetworkRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + parameters: Union[_models.VirtualNetworkRule, IO], + **kwargs: Any + ) -> _models.VirtualNetworkRule: + """Creates or updates an VirtualNetworkRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param virtual_network_rule_name: The Virtual Network Rule name. Required. + :type virtual_network_rule_name: str + :param parameters: The Namespace VirtualNetworkRule. Is either a VirtualNetworkRule type or a + IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.VirtualNetworkRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'VirtualNetworkRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualNetworkRule") request = build_create_or_update_virtual_network_rule_request( resource_group_name=resource_group_name, @@ -2066,18 +2307,18 @@ def create_or_update_virtual_network_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_virtual_network_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_virtual_network_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2085,67 +2326,67 @@ def create_or_update_virtual_network_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_virtual_network_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}"} # type: ignore - + create_or_update_virtual_network_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}" + } @distributed_trace def delete_virtual_network_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - virtual_network_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, **kwargs: Any ) -> None: """Deletes an VirtualNetworkRule for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param virtual_network_rule_name: The Virtual Network Rule name. + :param virtual_network_rule_name: The Virtual Network Rule name. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_virtual_network_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_virtual_network_rule.metadata['url'], + template_url=self.delete_virtual_network_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -2156,60 +2397,60 @@ def delete_virtual_network_rule( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - delete_virtual_network_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}"} # type: ignore - + delete_virtual_network_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}" + } @distributed_trace def get_virtual_network_rule( - self, - resource_group_name: str, - namespace_name: str, - virtual_network_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, **kwargs: Any ) -> _models.VirtualNetworkRule: """Gets an VirtualNetworkRule for a Namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param virtual_network_rule_name: The Virtual Network Rule name. + :param virtual_network_rule_name: The Virtual Network Rule name. Required. :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworkRule, or the result of cls(response) + :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.VirtualNetworkRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) - request = build_get_virtual_network_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_virtual_network_rule.metadata['url'], + template_url=self.get_virtual_network_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2217,74 +2458,82 @@ def get_virtual_network_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_virtual_network_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}"} # type: ignore - + get_virtual_network_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2292,16 +2541,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2312,49 +2559,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -2364,18 +2695,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2383,67 +2714,70 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -2454,60 +2788,63 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2515,67 +2852,70 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2583,54 +2923,140 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -2640,18 +3066,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2659,62 +3085,110 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2722,50 +3196,120 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } - @distributed_trace + @overload def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -2774,18 +3318,18 @@ def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2793,63 +3337,64 @@ def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -2857,74 +3402,79 @@ def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2932,16 +3482,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2952,46 +3500,115 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } - @distributed_trace + @overload def migrate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceMigrate, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """This operation Migrate the given namespace to provided name type. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to migrate namespace type. + :param parameters: Parameters supplied to migrate namespace type. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def migrate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceMigrate, IO], + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. Is either a + SBNamespaceMigrate type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceMigrate') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceMigrate") request = build_migrate_request( resource_group_name=resource_group_name, @@ -3000,18 +3617,18 @@ def migrate( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.migrate.metadata['url'], + content=_content, + template_url=self.migrate.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -3022,5 +3639,6 @@ def migrate( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - migrate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate"} # type: ignore - + migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py index 17015193e603..dc34e51fcab1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +27,40 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class Operations: """ @@ -72,52 +81,59 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,16 +141,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,8 +159,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py index a5f3e7668937..34c6d1e7e243 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,44 +27,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PremiumMessagingRegionsOperations: """ @@ -78,55 +88,61 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.PremiumMessagingRegionsListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.PremiumMessagingRegions"]: """Gets the available premium messaging regions for servicebus. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,16 +150,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,8 +168,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py index f159fa5afd31..03c6d53765de 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,134 +29,140 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, namespace_name: str, - subscription_id: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -162,33 +175,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateEndpointConnectionsOperations: """ @@ -209,65 +226,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -275,16 +299,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,71 +317,157 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -368,83 +476,84 @@ def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -456,108 +565,107 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,12 +673,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py index d1ab1a13f50e..64c1d2bbd845 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py @@ -6,11 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +25,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateLinkResourcesOperations: """ @@ -81,54 +93,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,12 +150,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py index 38a618ede0a4..ed4b0e5339ca 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -126,34 +135,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -167,34 +179,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - *, - json: Optional[_models.SBQueue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class QueuesOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,119 @@ def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +708,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +727,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -661,31 +749,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +788,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -715,8 +809,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -729,31 +824,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -761,18 +863,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,15 +881,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +903,38 @@ def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +942,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +960,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +979,130 @@ def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1113,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1132,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1151,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBQueueListResult]: + ) -> Iterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1169,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1228,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1246,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1382,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1401,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1475,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> _models.SBQueue: + def get(self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1537,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py index 23272e4c8cb6..461e6270abf1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,46 +27,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_by_sku_request( - subscription_id: str, - sku: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_sku_request(sku: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "sku": _SERIALIZER.url("sku", sku, 'str', max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "sku": _SERIALIZER.url("sku", sku, "str", max_length=50, min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class RegionsOperations: """ @@ -80,60 +89,64 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_sku( - self, - sku: str, - **kwargs: Any - ) -> Iterable[_models.PremiumMessagingRegionsListResult]: + def list_by_sku(self, sku: str, **kwargs: Any) -> Iterable["_models.PremiumMessagingRegions"]: """Gets the available Regions for a given sku. - :param sku: The sku type. + :param sku: The sku type. Required. :type sku: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of + :return: An iterator like instance of either PremiumMessagingRegions or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PremiumMessagingRegionsListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.PremiumMessagingRegionsListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, sku=sku, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_sku.metadata['url'], + template_url=self.list_by_sku.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_sku_request( - subscription_id=self._config.subscription_id, - sku=sku, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -141,16 +154,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PremiumMessagingRegionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,8 +172,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_sku.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} # type: ignore + list_by_sku.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py index eb30400a3be8..05c8ea26b9a9 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_subscriptions_request( resource_group_name: str, namespace_name: str, @@ -41,38 +55,39 @@ def build_list_by_subscriptions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -82,48 +97,44 @@ def build_create_or_update_request( subscription_name: str, rule_name: str, subscription_id: str, - *, - json: Optional[_models.Rule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -138,35 +149,36 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -181,35 +193,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class RulesOperations: """ @@ -230,7 +244,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -241,16 +254,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.RuleListResult]: + ) -> Iterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -260,57 +273,60 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -318,16 +334,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -338,13 +352,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -353,40 +367,127 @@ def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -398,18 +499,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -417,15 +518,16 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -439,33 +541,37 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -474,18 +580,17 @@ def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -496,8 +601,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def get( @@ -511,33 +617,37 @@ def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -546,18 +656,17 @@ def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,12 +674,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py index 2a218a0afe1a..fa46d754912e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_topic_request( resource_group_name: str, namespace_name: str, @@ -40,37 +54,38 @@ def build_list_by_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -79,47 +94,43 @@ def build_create_or_update_request( topic_name: str, subscription_name: str, subscription_id: str, - *, - json: Optional[_models.SBSubscription] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -133,34 +144,35 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -174,34 +186,36 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class SubscriptionsOperations: """ @@ -222,7 +236,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -232,14 +245,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBSubscriptionListResult]: + ) -> Iterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -249,56 +265,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -306,16 +326,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -326,13 +344,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -340,38 +358,128 @@ def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -382,18 +490,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,52 +509,55 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -454,18 +565,17 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -476,45 +586,48 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -522,18 +635,17 @@ def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,12 +653,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py index 54a52eb8ba8e..afaebf7c1594 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -126,34 +135,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -167,34 +179,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - *, - json: Optional[_models.SBTopic] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class TopicsOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,128 @@ def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +717,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +736,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -661,31 +758,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +797,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,15 +815,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -733,31 +837,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -765,18 +876,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -787,8 +897,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +912,38 @@ def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +951,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +969,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +988,130 @@ def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1122,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1141,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1160,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBTopicListResult]: + ) -> Iterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1178,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1237,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1255,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1391,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1410,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1484,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> _models.SBTopic: + def get(self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2018-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2018-01-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1546,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py index 221541a00fb6..2e171d69863b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py index d78f9e92a5dc..4d9fd89ec82d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-01-01-preview") # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop("api_version", "2021-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,23 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json index 77f7bafcb300..234b7092f4b7 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -108,4 +116,4 @@ "rules": "RulesOperations", "subscriptions": "SubscriptionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py index fff867ece7b1..310e05555e94 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -50,10 +61,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2021_01_01_preview.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,50 +82,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -123,7 +119,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -136,15 +132,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient + def __enter__(self) -> "ServiceBusManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_vendor.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py index e7dd87df1f93..530b8638dfd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py index 52f2360f8f02..c1b21908084e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-01-01-preview") # type: str + api_version: Literal["2021-01-01-preview"] = kwargs.pop("api_version", "2021-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,22 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py index 5bc88f396797..43b5a6da403d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -51,10 +62,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -72,50 +83,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -124,7 +120,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -144,5 +140,5 @@ async def __aenter__(self) -> "ServiceBusManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py index a116fa6bf83a..bf7c62939c70 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._disaster_recovery_configs_operations import build_break_pairing_request, build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_fail_over_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request -T = TypeVar('T') +from ...operations._disaster_recovery_configs_operations import ( + build_break_pairing_request, + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_fail_over_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class DisasterRecoveryConfigsOperations: """ .. warning:: @@ -43,41 +69,109 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -86,18 +180,18 @@ async def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,74 +199,79 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -180,16 +279,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -200,49 +297,126 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -252,18 +426,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -273,67 +447,67 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,60 +518,60 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,68 +579,68 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,50 +651,127 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - - @distributed_trace_async + @overload async def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -530,18 +781,18 @@ async def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -552,72 +803,78 @@ async def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -625,16 +882,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -645,48 +900,50 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -694,18 +951,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -713,52 +969,55 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -766,18 +1025,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -785,12 +1043,13 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py index a50cd2ea520d..7699eca2fb9b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,23 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._migration_configs_operations import build_complete_migration_request, build_create_and_start_migration_request_initial, build_delete_request, build_get_request, build_list_request, build_revert_request -T = TypeVar('T') +from ...operations._migration_configs_operations import ( + build_complete_migration_request, + build_create_and_start_migration_request, + build_delete_request, + build_get_request, + build_list_request, + build_revert_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MigrationConfigsOperations: """ .. warning:: @@ -45,65 +67,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +137,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,35 +155,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } async def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -167,57 +202,146 @@ async def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> AsyncLROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -230,114 +354,114 @@ async def begin_create_and_start_migration( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_and_start_migration_initial( # type: ignore + raw_result = await self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -348,61 +472,65 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,70 +538,74 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,61 +616,65 @@ async def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace_async async def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -549,5 +685,6 @@ async def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py index ea9fa3f391b7..41f080f1d918 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._namespaces_operations import build_check_name_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_network_rule_set_request, build_create_or_update_request_initial, build_delete_authorization_rule_request, build_delete_request_initial, build_get_authorization_rule_request, build_get_network_rule_set_request, build_get_request, build_list_authorization_rules_request, build_list_by_resource_group_request, build_list_keys_request, build_list_network_rule_sets_request, build_list_request, build_regenerate_keys_request, build_update_request -T = TypeVar('T') +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_network_rule_set_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_network_rule_set_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_keys_request, + build_list_network_rule_sets_request, + build_list_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class NamespacesOperations: """ .. warning:: @@ -45,55 +77,63 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -101,16 +141,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -121,65 +159,70 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -187,16 +230,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,90 +248,182 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } async def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -303,121 +436,118 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -429,103 +559,101 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -533,51 +661,124 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -586,18 +787,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -607,53 +808,123 @@ async def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -662,18 +933,18 @@ async def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,63 +952,64 @@ async def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace_async async def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -745,74 +1017,79 @@ async def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -820,16 +1097,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -840,70 +1115,77 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -911,16 +1193,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -931,49 +1211,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -983,18 +1347,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1002,67 +1366,70 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1073,60 +1440,63 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1134,67 +1504,70 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1202,54 +1575,140 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1259,18 +1718,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1278,62 +1737,110 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1341,12 +1848,13 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py index 1dd31f0daad0..855233017b33 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,52 +57,59 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -95,16 +117,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,8 +135,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py index 31f68d205e98..06ebe190059b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -45,65 +65,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +138,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,71 +156,157 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -204,83 +315,84 @@ async def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -292,108 +404,107 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,12 +512,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py index e411d3ee57ee..93760a651880 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py @@ -6,9 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +27,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,54 +55,56 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,12 +112,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py index a0dd3b79f63a..e6c1923fe36b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queues_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class QueuesOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,119 @@ async def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +299,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +318,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -230,31 +340,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +379,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -284,8 +400,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -298,31 +415,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -330,18 +454,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,15 +472,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +494,38 @@ async def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +533,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +551,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +570,130 @@ async def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +704,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +723,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +742,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBQueueListResult]: + ) -> AsyncIterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +760,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :return: An iterator like instance of either SBQueue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +820,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +838,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +974,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +993,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1067,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1131,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py index 555da9b53416..bb87c7391cbf 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscriptions_request -T = TypeVar('T') +from ...operations._rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscriptions_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RulesOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -54,16 +73,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.RuleListResult]: + ) -> AsyncIterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -73,57 +92,61 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) + :return: An iterator like instance of either Rule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,16 +154,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,13 +172,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -166,40 +187,127 @@ async def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -211,18 +319,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,15 +338,16 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -252,33 +361,37 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -287,18 +400,17 @@ async def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -309,8 +421,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def get( @@ -324,33 +437,37 @@ async def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -359,18 +476,17 @@ async def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,12 +494,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py index 44c8226c8844..ca3c53066f32 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_topic_request -T = TypeVar('T') +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_topic_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SubscriptionsOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -53,14 +72,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBSubscriptionListResult]: + ) -> AsyncIterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -70,56 +92,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,16 +153,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,13 +171,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -161,38 +185,128 @@ async def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -203,18 +317,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -222,52 +336,55 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -275,18 +392,17 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -297,45 +413,48 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -343,18 +462,17 @@ async def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -362,12 +480,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py index 7bb7d6f6ac4c..b17bf3bb991d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._topics_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopicsOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,128 @@ async def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +308,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +327,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -230,31 +349,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +388,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,15 +406,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -302,31 +428,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -334,18 +467,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -356,8 +488,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +503,38 @@ async def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +542,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +560,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +579,130 @@ async def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +713,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +732,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +751,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBTopicListResult]: + ) -> AsyncIterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +769,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :return: An iterator like instance of either SBTopic or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +829,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +847,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +983,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +1002,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1076,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1140,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py index 8da943ad1f9b..ccc88d9ba3f9 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py @@ -61,99 +61,97 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserAssignedIdentityProperties - -from ._service_bus_management_client_enums import ( - AccessRights, - CreatedByType, - DefaultAction, - EndPointProvisioningState, - EntityStatus, - FilterType, - KeyType, - ManagedServiceIdentityType, - MigrationConfigurationName, - NetworkRuleIPAction, - PrivateLinkConnectionStatus, - ProvisioningStateDR, - RoleDisasterRecovery, - SkuName, - SkuTier, - UnavailableReason, -) +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import CreatedByType +from ._service_bus_management_client_enums import DefaultAction +from ._service_bus_management_client_enums import EndPointProvisioningState +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import FilterType +from ._service_bus_management_client_enums import KeyType +from ._service_bus_management_client_enums import ManagedServiceIdentityType +from ._service_bus_management_client_enums import MigrationConfigurationName +from ._service_bus_management_client_enums import NetworkRuleIPAction +from ._service_bus_management_client_enums import PrivateLinkConnectionStatus +from ._service_bus_management_client_enums import ProvisioningStateDR +from ._service_bus_management_client_enums import RoleDisasterRecovery +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import UnavailableReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccessKeys', - 'Action', - 'ArmDisasterRecovery', - 'ArmDisasterRecoveryListResult', - 'CheckNameAvailability', - 'CheckNameAvailabilityResult', - 'ConnectionState', - 'CorrelationFilter', - 'DictionaryValue', - 'Encryption', - 'ErrorAdditionalInfo', - 'ErrorResponse', - 'ErrorResponseError', - 'FailoverProperties', - 'Identity', - 'KeyVaultProperties', - 'MessageCountDetails', - 'MigrationConfigListResult', - 'MigrationConfigProperties', - 'NWRuleSetIpRules', - 'NWRuleSetVirtualNetworkRules', - 'NetworkRuleSet', - 'NetworkRuleSetListResult', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'RegenerateAccessKeyParameters', - 'Resource', - 'ResourceNamespacePatch', - 'Rule', - 'RuleListResult', - 'SBAuthorizationRule', - 'SBAuthorizationRuleListResult', - 'SBNamespace', - 'SBNamespaceListResult', - 'SBNamespaceUpdateParameters', - 'SBQueue', - 'SBQueueListResult', - 'SBSku', - 'SBSubscription', - 'SBSubscriptionListResult', - 'SBTopic', - 'SBTopicListResult', - 'SqlFilter', - 'SqlRuleAction', - 'Subnet', - 'SystemData', - 'TrackedResource', - 'UserAssignedIdentityProperties', - 'AccessRights', - 'CreatedByType', - 'DefaultAction', - 'EndPointProvisioningState', - 'EntityStatus', - 'FilterType', - 'KeyType', - 'ManagedServiceIdentityType', - 'MigrationConfigurationName', - 'NetworkRuleIPAction', - 'PrivateLinkConnectionStatus', - 'ProvisioningStateDR', - 'RoleDisasterRecovery', - 'SkuName', - 'SkuTier', - 'UnavailableReason', + "AccessKeys", + "Action", + "ArmDisasterRecovery", + "ArmDisasterRecoveryListResult", + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "ConnectionState", + "CorrelationFilter", + "DictionaryValue", + "Encryption", + "ErrorAdditionalInfo", + "ErrorResponse", + "ErrorResponseError", + "FailoverProperties", + "Identity", + "KeyVaultProperties", + "MessageCountDetails", + "MigrationConfigListResult", + "MigrationConfigProperties", + "NWRuleSetIpRules", + "NWRuleSetVirtualNetworkRules", + "NetworkRuleSet", + "NetworkRuleSetListResult", + "Operation", + "OperationDisplay", + "OperationListResult", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "RegenerateAccessKeyParameters", + "Resource", + "ResourceNamespacePatch", + "Rule", + "RuleListResult", + "SBAuthorizationRule", + "SBAuthorizationRuleListResult", + "SBNamespace", + "SBNamespaceListResult", + "SBNamespaceUpdateParameters", + "SBQueue", + "SBQueueListResult", + "SBSku", + "SBSubscription", + "SBSubscriptionListResult", + "SBTopic", + "SBTopicListResult", + "SqlFilter", + "SqlRuleAction", + "Subnet", + "SystemData", + "TrackedResource", + "UserAssignedIdentityProperties", + "AccessRights", + "CreatedByType", + "DefaultAction", + "EndPointProvisioningState", + "EntityStatus", + "FilterType", + "KeyType", + "ManagedServiceIdentityType", + "MigrationConfigurationName", + "NetworkRuleIPAction", + "PrivateLinkConnectionStatus", + "ProvisioningStateDR", + "RoleDisasterRecovery", + "SkuName", + "SkuTier", + "UnavailableReason", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py index 0a048bd15c49..93002e67af2e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,22 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class AccessKeys(msrest.serialization.Model): +class AccessKeys(_serialization.Model): """Namespace/ServiceBus Connection String. Variables are only populated by the server, and will be ignored when sending a request. @@ -45,32 +51,28 @@ class AccessKeys(msrest.serialization.Model): """ _validation = { - 'primary_connection_string': {'readonly': True}, - 'secondary_connection_string': {'readonly': True}, - 'alias_primary_connection_string': {'readonly': True}, - 'alias_secondary_connection_string': {'readonly': True}, - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - 'key_name': {'readonly': True}, + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + "alias_primary_connection_string": {"readonly": True}, + "alias_secondary_connection_string": {"readonly": True}, + "primary_key": {"readonly": True}, + "secondary_key": {"readonly": True}, + "key_name": {"readonly": True}, } _attribute_map = { - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, - 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AccessKeys, self).__init__(**kwargs) + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "alias_primary_connection_string": {"key": "aliasPrimaryConnectionString", "type": "str"}, + "alias_secondary_connection_string": {"key": "aliasSecondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.primary_connection_string = None self.secondary_connection_string = None self.alias_primary_connection_string = None @@ -80,8 +82,9 @@ def __init__( self.key_name = None -class Action(msrest.serialization.Model): - """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. +class Action(_serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have + been matched by a filter expression. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -94,9 +97,9 @@ class Action(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -104,9 +107,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -117,13 +120,13 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource definition for other than namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -137,24 +140,20 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -175,11 +174,11 @@ class ArmDisasterRecovery(Resource): :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Known values are: "Accepted", - "Succeeded", "Failed". + "Succeeded", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. :vartype partner_namespace: str @@ -187,39 +186,35 @@ class ArmDisasterRecovery(Resource): pairing. :vartype alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' - or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", "Secondary". + or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", and "Secondary". :vartype role: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.RoleDisasterRecovery """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'role': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "role": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "partner_namespace": {"key": "properties.partnerNamespace", "type": "str"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "role": {"key": "properties.role", "type": "str"}, } def __init__( - self, - *, - partner_namespace: Optional[str] = None, - alternate_name: Optional[str] = None, - **kwargs - ): + self, *, partner_namespace: Optional[str] = None, alternate_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. @@ -228,7 +223,7 @@ def __init__( pairing. :paramtype alternate_name: str """ - super(ArmDisasterRecovery, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -237,7 +232,7 @@ def __init__( self.role = None -class ArmDisasterRecoveryListResult(msrest.serialization.Model): +class ArmDisasterRecoveryListResult(_serialization.Model): """The result of the List Alias(Disaster Recovery configuration) operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -250,65 +245,55 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ArmDisasterRecovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ArmDisasterRecovery"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ArmDisasterRecovery"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Alias(Disaster Recovery configurations). :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery] """ - super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CheckNameAvailability(msrest.serialization.Model): +class CheckNameAvailability(_serialization.Model): """Description of a Check Name availability request properties. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The Name to check the namespace name availability and The namespace name - can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it - must end with a letter or number. + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The Name to check the namespace name availability and The namespace - name can contain only letters, numbers, and hyphens. The namespace must start with a letter, - and it must end with a letter or number. + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :paramtype name: str """ - super(CheckNameAvailability, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(msrest.serialization.Model): +class CheckNameAvailabilityResult(_serialization.Model): """Description of a Check Name availability request properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -319,19 +304,19 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): available; otherwise, false. :vartype name_available: bool :ivar reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :vartype reason: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.UnavailableReason """ _validation = { - 'message': {'readonly': True}, + "message": {"readonly": True}, } _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "message": {"key": "message", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, } def __init__( @@ -339,28 +324,28 @@ def __init__( *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.UnavailableReason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Value indicating namespace is availability, true if the namespace is available; otherwise, false. :paramtype name_available: bool :keyword reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :paramtype reason: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.UnavailableReason """ - super(CheckNameAvailabilityResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.message = None self.name_available = name_available self.reason = reason -class ConnectionState(msrest.serialization.Model): +class ConnectionState(_serialization.Model): """ConnectionState information. :ivar status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :vartype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkConnectionStatus :ivar description: Description of the connection state. @@ -368,8 +353,8 @@ class ConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -377,22 +362,22 @@ def __init__( *, status: Optional[Union[str, "_models.PrivateLinkConnectionStatus"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :paramtype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkConnectionStatus :keyword description: Description of the connection state. :paramtype description: str """ - super(ConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class CorrelationFilter(msrest.serialization.Model): +class CorrelationFilter(_serialization.Model): """Represents the correlation filter expression. :ivar properties: dictionary object for custom filters. @@ -419,16 +404,16 @@ class CorrelationFilter(msrest.serialization.Model): """ _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'message_id': {'key': 'messageId', 'type': 'str'}, - 'to': {'key': 'to', 'type': 'str'}, - 'reply_to': {'key': 'replyTo', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "properties": {"key": "properties", "type": "{str}"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "message_id": {"key": "messageId", "type": "str"}, + "to": {"key": "to", "type": "str"}, + "reply_to": {"key": "replyTo", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "session_id": {"key": "sessionId", "type": "str"}, + "reply_to_session_id": {"key": "replyToSessionId", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -443,9 +428,9 @@ def __init__( session_id: Optional[str] = None, reply_to_session_id: Optional[str] = None, content_type: Optional[str] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword properties: dictionary object for custom filters. :paramtype properties: dict[str, str] @@ -469,7 +454,7 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(CorrelationFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties self.correlation_id = correlation_id self.message_id = message_id @@ -482,7 +467,7 @@ def __init__( self.requires_preprocessing = requires_preprocessing -class DictionaryValue(msrest.serialization.Model): +class DictionaryValue(_serialization.Model): """Recognized Dictionary value. Variables are only populated by the server, and will be ignored when sending a request. @@ -494,34 +479,29 @@ class DictionaryValue(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DictionaryValue, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class Encryption(msrest.serialization.Model): +class Encryption(_serialization.Model): """Properties to configure Encryption. :ivar key_vault_properties: Properties of KeyVault. :vartype key_vault_properties: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyVaultProperties] - :ivar key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value is "Microsoft.KeyVault". :vartype key_source: str :ivar require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). @@ -529,38 +509,37 @@ class Encryption(msrest.serialization.Model): """ _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "[KeyVaultProperties]"}, + "key_source": {"key": "keySource", "type": "str"}, + "require_infrastructure_encryption": {"key": "requireInfrastructureEncryption", "type": "bool"}, } def __init__( self, *, key_vault_properties: Optional[List["_models.KeyVaultProperties"]] = None, - key_source: Optional[str] = "Microsoft.KeyVault", + key_source: Literal["Microsoft.KeyVault"] = "Microsoft.KeyVault", require_infrastructure_encryption: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Properties of KeyVault. :paramtype key_vault_properties: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyVaultProperties] - :keyword key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is - "Microsoft.KeyVault". + :keyword key_source: Enumerates the possible value of keySource for Encryption. Default value + is "Microsoft.KeyVault". :paramtype key_source: str :keyword require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). :paramtype require_infrastructure_encryption: bool """ - super(Encryption, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_vault_properties = key_vault_properties self.key_source = key_source self.require_infrastructure_encryption = require_infrastructure_encryption -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -568,31 +547,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -600,24 +575,19 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + "error": {"key": "error", "type": "ErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponseError """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ErrorResponseError(msrest.serialization.Model): +class ErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -636,28 +606,24 @@ class ErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -665,8 +631,9 @@ def __init__( self.additional_info = None -class FailoverProperties(msrest.serialization.Model): - """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. +class FailoverProperties(_serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before + switching to the secondary. :ivar is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. @@ -674,25 +641,20 @@ class FailoverProperties(msrest.serialization.Model): """ _attribute_map = { - 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + "is_safe_failover": {"key": "properties.IsSafeFailover", "type": "bool"}, } - def __init__( - self, - *, - is_safe_failover: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, is_safe_failover: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. :paramtype is_safe_failover: bool """ - super(FailoverProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_safe_failover = is_safe_failover -class Identity(msrest.serialization.Model): +class Identity(_serialization.Model): """Properties to configure User Assigned Identities for Bring your Own Keys. Variables are only populated by the server, and will be ignored when sending a request. @@ -702,7 +664,7 @@ class Identity(msrest.serialization.Model): :ivar tenant_id: TenantId from the KeyVault. :vartype tenant_id: str :ivar type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :vartype type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.ManagedServiceIdentityType :ivar user_assigned_identities: Properties for User Assigned Identities. @@ -711,15 +673,15 @@ class Identity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{DictionaryValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{DictionaryValue}"}, } def __init__( @@ -727,25 +689,25 @@ def __init__( *, type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.DictionaryValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.ManagedServiceIdentityType :keyword user_assigned_identities: Properties for User Assigned Identities. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.servicebus.v2021_01_01_preview.models.DictionaryValue] """ - super(Identity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class KeyVaultProperties(msrest.serialization.Model): +class KeyVaultProperties(_serialization.Model): """Properties to configure keyVault Properties. :ivar key_name: Name of the Key from KeyVault. @@ -760,10 +722,10 @@ class KeyVaultProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + "key_name": {"key": "keyName", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "key_version": {"key": "keyVersion", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentityProperties"}, } def __init__( @@ -773,8 +735,8 @@ def __init__( key_vault_uri: Optional[str] = None, key_version: Optional[str] = None, identity: Optional["_models.UserAssignedIdentityProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: Name of the Key from KeyVault. :paramtype key_name: str @@ -786,54 +748,50 @@ def __init__( :paramtype identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.UserAssignedIdentityProperties """ - super(KeyVaultProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name self.key_vault_uri = key_vault_uri self.key_version = key_version self.identity = identity -class MessageCountDetails(msrest.serialization.Model): +class MessageCountDetails(_serialization.Model): """Message Count Details. Variables are only populated by the server, and will be ignored when sending a request. :ivar active_message_count: Number of active messages in the queue, topic, or subscription. - :vartype active_message_count: long + :vartype active_message_count: int :ivar dead_letter_message_count: Number of messages that are dead lettered. - :vartype dead_letter_message_count: long + :vartype dead_letter_message_count: int :ivar scheduled_message_count: Number of scheduled messages. - :vartype scheduled_message_count: long + :vartype scheduled_message_count: int :ivar transfer_message_count: Number of messages transferred to another queue, topic, or subscription. - :vartype transfer_message_count: long + :vartype transfer_message_count: int :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. - :vartype transfer_dead_letter_message_count: long + :vartype transfer_dead_letter_message_count: int """ _validation = { - 'active_message_count': {'readonly': True}, - 'dead_letter_message_count': {'readonly': True}, - 'scheduled_message_count': {'readonly': True}, - 'transfer_message_count': {'readonly': True}, - 'transfer_dead_letter_message_count': {'readonly': True}, + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, } _attribute_map = { - 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, - 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, - 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, - 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, - 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MessageCountDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.active_message_count = None self.dead_letter_message_count = None self.scheduled_message_count = None @@ -841,7 +799,7 @@ def __init__( self.transfer_dead_letter_message_count = None -class MigrationConfigListResult(msrest.serialization.Model): +class MigrationConfigListResult(_serialization.Model): """The result of the List migrationConfigurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -855,26 +813,21 @@ class MigrationConfigListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationConfigProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MigrationConfigProperties"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MigrationConfigProperties"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Migration Configs. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] """ - super(MigrationConfigListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None @@ -895,7 +848,7 @@ class MigrationConfigProperties(Resource): :ivar provisioning_state: Provisioning state of Migration Configuration. :vartype provisioning_state: str :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. :vartype target_namespace: str @@ -907,34 +860,30 @@ class MigrationConfigProperties(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'migration_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "migration_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, - 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, - 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "target_namespace": {"key": "properties.targetNamespace", "type": "str"}, + "post_migration_name": {"key": "properties.postMigrationName", "type": "str"}, + "migration_state": {"key": "properties.migrationState", "type": "str"}, } def __init__( - self, - *, - target_namespace: Optional[str] = None, - post_migration_name: Optional[str] = None, - **kwargs - ): + self, *, target_namespace: Optional[str] = None, post_migration_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. @@ -942,7 +891,7 @@ def __init__( :keyword post_migration_name: Name to access Standard Namespace after migration. :paramtype post_migration_name: str """ - super(MigrationConfigProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -964,7 +913,8 @@ class NetworkRuleSet(Resource): :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData - :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow", "Deny". + :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". :vartype default_action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.DefaultAction :ivar virtual_network_rules: List VirtualNetwork Rules. :vartype virtual_network_rules: @@ -974,20 +924,20 @@ class NetworkRuleSet(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "default_action": {"key": "properties.defaultAction", "type": "str"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[NWRuleSetVirtualNetworkRules]"}, + "ip_rules": {"key": "properties.ipRules", "type": "[NWRuleSetIpRules]"}, } def __init__( @@ -996,10 +946,10 @@ def __init__( default_action: Optional[Union[str, "_models.DefaultAction"]] = None, virtual_network_rules: Optional[List["_models.NWRuleSetVirtualNetworkRules"]] = None, ip_rules: Optional[List["_models.NWRuleSetIpRules"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow", + :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow" and "Deny". :paramtype default_action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.DefaultAction @@ -1009,14 +959,14 @@ def __init__( :keyword ip_rules: List of IpRules. :paramtype ip_rules: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetIpRules] """ - super(NetworkRuleSet, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.default_action = default_action self.virtual_network_rules = virtual_network_rules self.ip_rules = ip_rules -class NetworkRuleSetListResult(msrest.serialization.Model): +class NetworkRuleSetListResult(_serialization.Model): """The response of the List NetworkRuleSet operation. :ivar value: Result of the List NetworkRuleSet operation. @@ -1027,17 +977,13 @@ class NetworkRuleSetListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NetworkRuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.NetworkRuleSet"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.NetworkRuleSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List NetworkRuleSet operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet] @@ -1045,44 +991,44 @@ def __init__( list of NetworkRuleSet. :paramtype next_link: str """ - super(NetworkRuleSetListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class NWRuleSetIpRules(msrest.serialization.Model): +class NWRuleSetIpRules(_serialization.Model): """Description of NetWorkRuleSet - IpRules resource. :ivar ip_mask: IP Mask. :vartype ip_mask: str - :ivar action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :ivar action: The IP Filter Action. "Allow" :vartype action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleIPAction """ _attribute_map = { - 'ip_mask': {'key': 'ipMask', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, + "ip_mask": {"key": "ipMask", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "_models.NetworkRuleIPAction"]] = "Allow", - **kwargs - ): + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword ip_mask: IP Mask. :paramtype ip_mask: str - :keyword action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :keyword action: The IP Filter Action. "Allow" :paramtype action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleIPAction """ - super(NWRuleSetIpRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_mask = ip_mask self.action = action -class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): +class NWRuleSetVirtualNetworkRules(_serialization.Model): """Description of VirtualNetworkRules - NetworkRules resource. :ivar subnet: Subnet properties. @@ -1093,8 +1039,8 @@ class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): """ _attribute_map = { - 'subnet': {'key': 'subnet', 'type': 'Subnet'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + "subnet": {"key": "subnet", "type": "Subnet"}, + "ignore_missing_vnet_service_endpoint": {"key": "ignoreMissingVnetServiceEndpoint", "type": "bool"}, } def __init__( @@ -1102,8 +1048,8 @@ def __init__( *, subnet: Optional["_models.Subnet"] = None, ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet: Subnet properties. :paramtype subnet: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Subnet @@ -1111,12 +1057,12 @@ def __init__( VNet Service Endpoint. :paramtype ignore_missing_vnet_service_endpoint: bool """ - super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.subnet = subnet self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """A ServiceBus REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1128,30 +1074,25 @@ class Operation(msrest.serialization.Model): """ _validation = { - 'name': {'readonly': True}, + "name": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__( - self, - *, - display: Optional["_models.OperationDisplay"] = None, - **kwargs - ): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationDisplay """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.display = display -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """The object that represents the operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1165,31 +1106,28 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None -class OperationListResult(msrest.serialization.Model): - """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1201,27 +1139,23 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """PrivateEndpoint information. :ivar id: The ARM identifier for Private Endpoint. @@ -1229,20 +1163,15 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The ARM identifier for Private Endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id @@ -1265,26 +1194,29 @@ class PrivateEndpointConnection(Resource): :vartype private_link_service_connection_state: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ConnectionState :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Known values - are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EndPointProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "ConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( @@ -1293,8 +1225,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.ConnectionState"] = None, provisioning_state: Optional[Union[str, "_models.EndPointProvisioningState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The Private Endpoint resource for this Connection. :paramtype private_endpoint: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpoint @@ -1302,18 +1234,18 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ConnectionState :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :paramtype provisioning_state: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EndPointProvisioningState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """Result of the list of all private endpoint connections operation. :ivar value: A collection of private endpoint connection resources. @@ -1324,8 +1256,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1333,8 +1265,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private endpoint connection resources. :paramtype value: @@ -1342,12 +1274,12 @@ def __init__( :keyword next_link: A link for the next page of private endpoint connection resources. :paramtype next_link: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """Information of the private link resource. :ivar id: Fully qualified identifier of the resource. @@ -1365,25 +1297,25 @@ class PrivateLinkResource(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the resource. :paramtype id: str @@ -1398,7 +1330,7 @@ def __init__( :keyword required_zone_names: Required Zone Names. :paramtype required_zone_names: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -1407,7 +1339,7 @@ def __init__( self.required_zone_names = required_zone_names -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """Result of the List private link resources operation. :ivar value: A collection of private link resources. @@ -1417,8 +1349,8 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1426,25 +1358,26 @@ def __init__( *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private link resources. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResource] :keyword next_link: A link for the next page of private link resources. :paramtype next_link: str """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RegenerateAccessKeyParameters(msrest.serialization.Model): - """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. +class RegenerateAccessKeyParameters(_serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs + to be reset. All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :ivar key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :vartype key_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyType :ivar key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key @@ -1453,30 +1386,24 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): """ _validation = { - 'key_type': {'required': True}, + "key_type": {"required": True}, } _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, + "key_type": {"key": "keyType", "type": "str"}, + "key": {"key": "key", "type": "str"}, } - def __init__( - self, - *, - key_type: Union[str, "_models.KeyType"], - key: Optional[str] = None, - **kwargs - ): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :keyword key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :paramtype key_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyType :keyword key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :paramtype key: str """ - super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_type = key_type self.key = key @@ -1494,38 +1421,32 @@ class ResourceNamespacePatch(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(ResourceNamespacePatch, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags @@ -1547,7 +1468,7 @@ class Rule(Resource): message that have been matched by a filter expression. :vartype action: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Action :ivar filter_type: Filter type that is evaluated against a BrokeredMessage. Known values are: - "SqlFilter", "CorrelationFilter". + "SqlFilter" and "CorrelationFilter". :vartype filter_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.FilterType :ivar sql_filter: Properties of sqlFilter. :vartype sql_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SqlFilter @@ -1557,21 +1478,21 @@ class Rule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'action': {'key': 'properties.action', 'type': 'Action'}, - 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, - 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, - 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "action": {"key": "properties.action", "type": "Action"}, + "filter_type": {"key": "properties.filterType", "type": "str"}, + "sql_filter": {"key": "properties.sqlFilter", "type": "SqlFilter"}, + "correlation_filter": {"key": "properties.correlationFilter", "type": "CorrelationFilter"}, } def __init__( @@ -1581,14 +1502,14 @@ def __init__( filter_type: Optional[Union[str, "_models.FilterType"]] = None, sql_filter: Optional["_models.SqlFilter"] = None, correlation_filter: Optional["_models.CorrelationFilter"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. :paramtype action: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Action :keyword filter_type: Filter type that is evaluated against a BrokeredMessage. Known values - are: "SqlFilter", "CorrelationFilter". + are: "SqlFilter" and "CorrelationFilter". :paramtype filter_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.FilterType :keyword sql_filter: Properties of sqlFilter. :paramtype sql_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SqlFilter @@ -1596,7 +1517,7 @@ def __init__( :paramtype correlation_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CorrelationFilter """ - super(Rule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.action = action self.filter_type = filter_type @@ -1604,7 +1525,7 @@ def __init__( self.correlation_filter = correlation_filter -class RuleListResult(msrest.serialization.Model): +class RuleListResult(_serialization.Model): """The response of the List rule operation. :ivar value: Result of the List Rules operation. @@ -1615,17 +1536,13 @@ class RuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.Rule"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Rule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule] @@ -1633,7 +1550,7 @@ def __init__( list of rules. :paramtype next_link: str """ - super(RuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1656,36 +1573,31 @@ class SBAuthorizationRule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } - def __init__( - self, - *, - rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + def __init__(self, *, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, **kwargs: Any) -> None: """ :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessRights] """ - super(SBAuthorizationRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.rights = rights -class SBAuthorizationRuleListResult(msrest.serialization.Model): +class SBAuthorizationRuleListResult(_serialization.Model): """The response to the List Namespace operation. :ivar value: Result of the List Authorization Rules operation. @@ -1696,8 +1608,8 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBAuthorizationRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1705,8 +1617,8 @@ def __init__( *, value: Optional[List["_models.SBAuthorizationRule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Authorization Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] @@ -1714,7 +1626,7 @@ def __init__( list of Authorization Rules. :paramtype next_link: str """ - super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1732,46 +1644,40 @@ class TrackedResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags -class SBNamespace(TrackedResource): +class SBNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1784,9 +1690,9 @@ class SBNamespace(TrackedResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku @@ -1817,37 +1723,40 @@ class SBNamespace(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, } def __init__( @@ -1860,12 +1769,12 @@ def __init__( zone_redundant: Optional[bool] = None, encryption: Optional["_models.Encryption"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku @@ -1880,7 +1789,7 @@ def __init__( :paramtype private_endpoint_connections: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] """ - super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.system_data = None @@ -1895,7 +1804,7 @@ def __init__( self.private_endpoint_connections = private_endpoint_connections -class SBNamespaceListResult(msrest.serialization.Model): +class SBNamespaceListResult(_serialization.Model): """The response of the List Namespace operation. :ivar value: Result of the List Namespace operation. @@ -1906,17 +1815,13 @@ class SBNamespaceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBNamespace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBNamespace]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBNamespace"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBNamespace"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Namespace operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] @@ -1924,12 +1829,12 @@ def __init__( list of Namespaces. :paramtype next_link: str """ - super(SBNamespaceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBNamespaceUpdateParameters(ResourceNamespacePatch): +class SBNamespaceUpdateParameters(ResourceNamespacePatch): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1942,7 +1847,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku @@ -1971,34 +1876,37 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, } def __init__( @@ -2011,12 +1919,12 @@ def __init__( zone_redundant: Optional[bool] = None, encryption: Optional["_models.Encryption"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku @@ -2031,7 +1939,7 @@ def __init__( :paramtype private_endpoint_connections: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] """ - super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.provisioning_state = None @@ -2045,7 +1953,7 @@ def __init__( self.private_endpoint_connections = private_endpoint_connections -class SBQueue(Resource): +class SBQueue(Resource): # pylint: disable=too-many-instance-attributes """Description of queue Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2068,9 +1976,9 @@ class SBQueue(Resource): to this queue. :vartype accessed_at: ~datetime.datetime :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. @@ -2099,7 +2007,7 @@ class SBQueue(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2120,47 +2028,50 @@ class SBQueue(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'message_count': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "message_count": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2178,8 +2089,8 @@ def __init__( enable_express: Optional[bool] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 @@ -2209,7 +2120,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2229,7 +2140,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBQueue, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.count_details = None self.created_at = None @@ -2254,7 +2165,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBQueueListResult(msrest.serialization.Model): +class SBQueueListResult(_serialization.Model): """The response to the List Queues operation. :ivar value: Result of the List Queues operation. @@ -2265,17 +2176,13 @@ class SBQueueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBQueue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBQueue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBQueue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Queues operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue] @@ -2283,19 +2190,19 @@ def __init__( list of queues. :paramtype next_link: str """ - super(SBQueueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBSku(msrest.serialization.Model): +class SBSku(_serialization.Model): """SKU of the namespace. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :ivar name: Name of this SKU. Required. Known values are: "Basic", "Standard", and "Premium". :vartype name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuName - :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", + :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", and "Premium". :vartype tier: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuTier :ivar capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 @@ -2304,13 +2211,13 @@ class SBSku(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( @@ -2319,25 +2226,26 @@ def __init__( name: Union[str, "_models.SkuName"], tier: Optional[Union[str, "_models.SkuTier"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :keyword name: Name of this SKU. Required. Known values are: "Basic", "Standard", and + "Premium". :paramtype name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuName :keyword tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", - "Premium". + and "Premium". :paramtype tier: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuTier :keyword capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :paramtype capacity: int """ - super(SBSku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SBSubscription(Resource): +class SBSubscription(Resource): # pylint: disable=too-many-instance-attributes """Description of subscription resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2351,7 +2259,7 @@ class SBSubscription(Resource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar accessed_at: Last time there was a receive request to this subscription. @@ -2382,7 +2290,7 @@ class SBSubscription(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2397,39 +2305,45 @@ class SBSubscription(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'message_count': {'readonly': True}, - 'created_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "message_count": {"readonly": True}, + "created_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, } def __init__( @@ -2447,8 +2361,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. @@ -2472,7 +2386,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2486,7 +2400,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBSubscription, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.message_count = None self.created_at = None @@ -2507,7 +2421,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBSubscriptionListResult(msrest.serialization.Model): +class SBSubscriptionListResult(_serialization.Model): """The response to the List Subscriptions operation. :ivar value: Result of the List Subscriptions operation. @@ -2518,17 +2432,13 @@ class SBSubscriptionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBSubscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBSubscription"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBSubscription"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Subscriptions operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription] @@ -2536,12 +2446,12 @@ def __init__( list of subscriptions. :paramtype next_link: str """ - super(SBSubscriptionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBTopic(Resource): +class SBTopic(Resource): # pylint: disable=too-many-instance-attributes """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2555,7 +2465,7 @@ class SBTopic(Resource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2584,7 +2494,7 @@ class SBTopic(Resource): :vartype enable_batched_operations: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus :ivar support_ordering: Value that indicates whether the topic supports ordering. :vartype support_ordering: bool @@ -2600,39 +2510,42 @@ class SBTopic(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "subscription_count": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, } def __init__( @@ -2648,8 +2561,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, enable_partitioning: Optional[bool] = None, enable_express: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -2669,7 +2582,7 @@ def __init__( :paramtype enable_batched_operations: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool @@ -2683,7 +2596,7 @@ def __init__( topic holds a message in memory temporarily before writing it to persistent storage. :paramtype enable_express: bool """ - super(SBTopic, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.size_in_bytes = None self.created_at = None @@ -2703,7 +2616,7 @@ def __init__( self.enable_express = enable_express -class SBTopicListResult(msrest.serialization.Model): +class SBTopicListResult(_serialization.Model): """The response to the List Topics operation. :ivar value: Result of the List Topics operation. @@ -2714,17 +2627,13 @@ class SBTopicListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBTopic]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBTopic"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBTopic"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Topics operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic] @@ -2732,13 +2641,14 @@ def __init__( list of topics. :paramtype next_link: str """ - super(SBTopicListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SqlFilter(msrest.serialization.Model): - """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. +class SqlFilter(_serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in + the pub/sub pipeline. :ivar sql_expression: The SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2751,23 +2661,23 @@ class SqlFilter(msrest.serialization.Model): """ _validation = { - 'compatibility_level': {'maximum': 20, 'minimum': 20}, + "compatibility_level": {"maximum": 20, "minimum": 20}, } _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( self, *, sql_expression: Optional[str] = None, - compatibility_level: Optional[int] = 20, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + compatibility_level: int = 20, + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: The SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -2778,14 +2688,15 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing class SqlRuleAction(Action): - """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + """Represents set of actions written in SQL language-based syntax that is performed against a + ServiceBus.Messaging.BrokeredMessage. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2798,9 +2709,9 @@ class SqlRuleAction(Action): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -2808,9 +2719,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -2821,47 +2732,47 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + super().__init__( + sql_expression=sql_expression, + compatibility_level=compatibility_level, + requires_preprocessing=requires_preprocessing, + **kwargs + ) -class Subnet(msrest.serialization.Model): +class Subnet(_serialization.Model): """Properties supplied for Subnet. All required parameters must be populated in order to send to Azure. - :ivar id: Required. Resource ID of Virtual Network Subnet. + :ivar id: Resource ID of Virtual Network Subnet. Required. :vartype id: str """ _validation = { - 'id': {'required': True}, + "id": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: str, - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Required. Resource ID of Virtual Network Subnet. + :keyword id: Resource ID of Virtual Network Subnet. Required. :paramtype id: str """ - super(Subnet, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -2869,7 +2780,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -2877,12 +2788,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -2894,13 +2805,13 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -2908,13 +2819,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -2923,7 +2834,7 @@ def __init__( self.last_modified_at = last_modified_at -class UserAssignedIdentityProperties(msrest.serialization.Model): +class UserAssignedIdentityProperties(_serialization.Model): """UserAssignedIdentityProperties. :ivar user_assigned_identity: ARM ID of user Identity selected for encryption. @@ -2931,18 +2842,13 @@ class UserAssignedIdentityProperties(msrest.serialization.Model): """ _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: ARM ID of user Identity selected for encryption. :paramtype user_assigned_identity: str """ - super(UserAssignedIdentityProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.user_assigned_identity = user_assigned_identity diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py index 6fa98eab2bd7..4eff4b68262a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py @@ -11,30 +11,31 @@ class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class DefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Default Action for Network Rule Set - """ + """Default Action for Network Rule Set.""" ALLOW = "Allow" DENY = "Deny" + class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Private Endpoint Connection. - """ + """Provisioning state of the Private Endpoint Connection.""" CREATING = "Creating" UPDATING = "Updating" @@ -43,9 +44,9 @@ class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" FAILED = "Failed" + class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity status. - """ + """Entity status.""" ACTIVE = "Active" DISABLED = "Disabled" @@ -57,85 +58,89 @@ class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENAMING = "Renaming" UNKNOWN = "Unknown" + class FilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Rule filter types - """ + """Rule filter types.""" SQL_FILTER = "SqlFilter" CORRELATION_FILTER = "CorrelationFilter" + class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The access key to regenerate. - """ + """The access key to regenerate.""" PRIMARY_KEY = "PrimaryKey" SECONDARY_KEY = "SecondaryKey" + class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity. - """ + """Type of managed service identity.""" SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" + class MigrationConfigurationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationConfigurationName.""" _DEFAULT = "$default" + class NetworkRuleIPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP Filter Action - """ + """The IP Filter Action.""" ALLOW = "Allow" + class PrivateLinkConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the connection. - """ + """Status of the connection.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ProvisioningStateDR(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' - or 'Succeeded' or 'Failed' + or 'Succeeded' or 'Failed'. """ ACCEPTED = "Accepted" SUCCEEDED = "Succeeded" FAILED = "Failed" + class RoleDisasterRecovery(str, Enum, metaclass=CaseInsensitiveEnumMeta): """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or - 'Secondary' + 'Secondary'. """ PRIMARY = "Primary" PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" SECONDARY = "Secondary" + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of this SKU. - """ + """Name of this SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The billing tier of this particular SKU. - """ + """The billing tier of this particular SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the reason for the unavailability of the service. - """ + """Specifies the reason for the unavailability of the service.""" NONE = "None" INVALID_NAME = "InvalidName" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py index 58c06a315379..fbfdc4f85b25 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,343 +27,313 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_check_name_availability_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.ArmDisasterRecovery] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_break_pairing_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_fail_over_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.FailoverProperties] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -370,34 +347,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -411,34 +391,38 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class DisasterRecoveryConfigsOperations: """ @@ -459,41 +443,109 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace + @overload def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -502,18 +554,18 @@ def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,74 +573,79 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -596,16 +653,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -616,49 +671,126 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -668,18 +800,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -689,67 +821,67 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -760,60 +892,60 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -821,68 +953,68 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -893,50 +1025,127 @@ def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - @distributed_trace + @overload def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -946,18 +1155,18 @@ def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -968,72 +1177,78 @@ def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1041,16 +1256,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1061,48 +1274,50 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1110,18 +1325,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1129,52 +1343,55 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1182,18 +1399,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1201,12 +1417,13 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py index 0f1c90d3644d..6f3475880284 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,251 +29,257 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_and_start_migration_request_initial( +def build_create_and_start_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, - *, - json: Optional[_models.MigrationConfigProperties] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_complete_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_revert_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class MigrationConfigsOperations: """ @@ -287,65 +300,69 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,16 +370,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -373,35 +388,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -409,57 +435,146 @@ def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> LROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -472,114 +587,114 @@ def begin_create_and_start_migration( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_and_start_migration_initial( # type: ignore + raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -590,61 +705,65 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,70 +771,74 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,61 +849,65 @@ def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -791,5 +918,6 @@ def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py index a81d7686daa0..d64a9983ffff 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,651 +29,593 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespace] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NetworkRuleSet] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_network_rule_sets_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class NamespacesOperations: """ @@ -687,55 +636,63 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -743,16 +700,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -763,65 +718,70 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -829,16 +789,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -849,90 +807,107 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -945,121 +920,193 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1071,103 +1118,101 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1175,51 +1220,124 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1228,18 +1346,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1249,53 +1367,123 @@ def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -1304,18 +1492,18 @@ def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1323,63 +1511,64 @@ def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1387,74 +1576,79 @@ def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1462,16 +1656,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1482,70 +1674,77 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1553,16 +1752,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1573,49 +1770,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -1625,18 +1906,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1644,67 +1925,70 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1715,60 +1999,63 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1776,67 +2063,70 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1844,54 +2134,140 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1901,18 +2277,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1920,62 +2296,110 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1983,12 +2407,13 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py index 9faec6420ec1..337adda20afd 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +27,40 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class Operations: """ @@ -72,52 +81,59 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,16 +141,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,8 +159,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py index f3a9dd347ae1..7281d9ed833e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,134 +29,140 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, namespace_name: str, - subscription_id: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -162,33 +175,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateEndpointConnectionsOperations: """ @@ -209,65 +226,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -275,16 +299,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,71 +317,157 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -368,83 +476,84 @@ def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -456,108 +565,107 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,12 +673,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py index 9fd9e6f03a90..18d6bf12fec2 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py @@ -6,11 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +25,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateLinkResourcesOperations: """ @@ -81,54 +93,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,12 +150,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py index c72a7a31149f..393a098581bd 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -126,34 +135,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -167,34 +179,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - *, - json: Optional[_models.SBQueue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class QueuesOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,119 @@ def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +708,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +727,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -661,31 +749,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +788,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -715,8 +809,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -729,31 +824,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -761,18 +863,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,15 +881,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +903,38 @@ def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +942,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +960,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +979,130 @@ def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1113,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1132,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1151,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBQueueListResult]: + ) -> Iterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1169,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1228,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1246,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1382,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1401,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1475,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> _models.SBQueue: + def get(self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1537,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py index 0b08d466999a..21c7c4f386de 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_subscriptions_request( resource_group_name: str, namespace_name: str, @@ -41,38 +55,39 @@ def build_list_by_subscriptions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -82,48 +97,44 @@ def build_create_or_update_request( subscription_name: str, rule_name: str, subscription_id: str, - *, - json: Optional[_models.Rule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -138,35 +149,36 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -181,35 +193,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class RulesOperations: """ @@ -230,7 +244,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -241,16 +254,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.RuleListResult]: + ) -> Iterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -260,57 +273,60 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -318,16 +334,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -338,13 +352,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -353,40 +367,127 @@ def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -398,18 +499,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -417,15 +518,16 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -439,33 +541,37 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -474,18 +580,17 @@ def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -496,8 +601,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def get( @@ -511,33 +617,37 @@ def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -546,18 +656,17 @@ def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,12 +674,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py index 92a358c44679..9b743bb62c23 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_topic_request( resource_group_name: str, namespace_name: str, @@ -40,37 +54,38 @@ def build_list_by_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -79,47 +94,43 @@ def build_create_or_update_request( topic_name: str, subscription_name: str, subscription_id: str, - *, - json: Optional[_models.SBSubscription] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -133,34 +144,35 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -174,34 +186,36 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class SubscriptionsOperations: """ @@ -222,7 +236,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -232,14 +245,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBSubscriptionListResult]: + ) -> Iterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -249,56 +265,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -306,16 +326,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -326,13 +344,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -340,38 +358,128 @@ def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -382,18 +490,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,52 +509,55 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -454,18 +565,17 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -476,45 +586,48 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -522,18 +635,17 @@ def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,12 +653,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py index 8791f787584f..82f8067c25ca 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -126,34 +135,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -167,34 +179,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - *, - json: Optional[_models.SBTopic] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class TopicsOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,128 @@ def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +717,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +736,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -661,31 +758,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +797,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,15 +815,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -733,31 +837,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -765,18 +876,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -787,8 +897,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +912,38 @@ def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +951,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +969,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +988,130 @@ def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1122,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1141,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1160,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBTopicListResult]: + ) -> Iterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1178,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1237,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1255,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1391,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1410,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1484,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> _models.SBTopic: + def get(self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1546,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/__init__.py index 221541a00fb6..2e171d69863b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_configuration.py index 91585e68502c..a9f6a74af235 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version: Literal["2021-06-01-preview"] = kwargs.pop("api_version", "2021-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,23 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_metadata.json index d5209a713f9d..f01f6d6d7ce0 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_metadata.json +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -108,4 +116,4 @@ "rules": "RulesOperations", "subscriptions": "SubscriptionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_service_bus_management_client.py index e7ba0ba9ea96..d4e83d857e65 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -50,10 +61,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2021_06_01_preview.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,50 +82,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -123,7 +119,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -136,15 +132,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient + def __enter__(self) -> "ServiceBusManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_vendor.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/__init__.py index e7dd87df1f93..530b8638dfd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_configuration.py index 6b3e32290dc5..40d264d090e4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version: Literal["2021-06-01-preview"] = kwargs.pop("api_version", "2021-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,22 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_service_bus_management_client.py index e1e25354debf..b67659e970fe 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -51,10 +62,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2021_06_01_preview.aio.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -72,50 +83,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -124,7 +120,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -144,5 +140,5 @@ async def __aenter__(self) -> "ServiceBusManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py index d30d714bf426..ad11439a9169 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._disaster_recovery_configs_operations import build_break_pairing_request, build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_fail_over_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request -T = TypeVar('T') +from ...operations._disaster_recovery_configs_operations import ( + build_break_pairing_request, + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_fail_over_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class DisasterRecoveryConfigsOperations: """ .. warning:: @@ -43,41 +69,109 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -86,18 +180,18 @@ async def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,74 +199,79 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -180,16 +279,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -200,49 +297,126 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -252,18 +426,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -273,67 +447,67 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,60 +518,60 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,68 +579,68 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,50 +651,127 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - - @distributed_trace_async + @overload async def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -530,18 +781,18 @@ async def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -552,72 +803,78 @@ async def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -625,16 +882,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -645,48 +900,50 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -694,18 +951,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -713,52 +969,55 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -766,18 +1025,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -785,12 +1043,13 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_migration_configs_operations.py index 5c0cde0e9ca2..75458bdfec9c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_migration_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,23 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._migration_configs_operations import build_complete_migration_request, build_create_and_start_migration_request_initial, build_delete_request, build_get_request, build_list_request, build_revert_request -T = TypeVar('T') +from ...operations._migration_configs_operations import ( + build_complete_migration_request, + build_create_and_start_migration_request, + build_delete_request, + build_get_request, + build_list_request, + build_revert_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MigrationConfigsOperations: """ .. warning:: @@ -45,65 +67,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +137,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,35 +155,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } async def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -167,57 +202,146 @@ async def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> AsyncLROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -230,114 +354,114 @@ async def begin_create_and_start_migration( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_and_start_migration_initial( # type: ignore + raw_result = await self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -348,61 +472,65 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,70 +538,74 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,61 +616,65 @@ async def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace_async async def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -549,5 +685,6 @@ async def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_namespaces_operations.py index dcf31ed61eff..3b59cab56d39 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_namespaces_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._namespaces_operations import build_check_name_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_network_rule_set_request, build_create_or_update_request_initial, build_delete_authorization_rule_request, build_delete_request_initial, build_get_authorization_rule_request, build_get_network_rule_set_request, build_get_request, build_list_authorization_rules_request, build_list_by_resource_group_request, build_list_keys_request, build_list_network_rule_sets_request, build_list_request, build_regenerate_keys_request, build_update_request -T = TypeVar('T') +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_network_rule_set_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_network_rule_set_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_keys_request, + build_list_network_rule_sets_request, + build_list_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class NamespacesOperations: """ .. warning:: @@ -45,55 +77,63 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -101,16 +141,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -121,65 +159,70 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -187,16 +230,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,90 +248,182 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } async def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -303,121 +436,118 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -429,103 +559,101 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -533,51 +661,124 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -586,18 +787,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -607,53 +808,123 @@ async def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -662,18 +933,18 @@ async def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,63 +952,64 @@ async def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace_async async def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -745,74 +1017,79 @@ async def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -820,16 +1097,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -840,70 +1115,77 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -911,16 +1193,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -931,49 +1211,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -983,18 +1347,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1002,67 +1366,70 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1073,60 +1440,63 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1134,67 +1504,70 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1202,54 +1575,140 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1259,18 +1718,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1278,62 +1737,110 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1341,12 +1848,13 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_operations.py index abe0a4cf460c..6f4a7a7fb286 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,52 +57,59 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -95,16 +117,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,8 +135,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py index c02180611329..05adb75e0a42 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -45,65 +65,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +138,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,71 +156,157 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -204,83 +315,84 @@ async def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -292,108 +404,107 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,12 +512,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py index aa5401e310a1..f693fee3bb0a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py @@ -6,9 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +27,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,54 +55,56 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,12 +112,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_queues_operations.py index d97a7cbc3044..2aaa89a8ed32 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_queues_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queues_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class QueuesOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,119 @@ async def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +299,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +318,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -230,31 +340,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +379,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -284,8 +400,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -298,31 +415,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -330,18 +454,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,15 +472,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +494,38 @@ async def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +533,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +551,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +570,130 @@ async def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +704,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +723,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +742,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBQueueListResult]: + ) -> AsyncIterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +760,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :return: An iterator like instance of either SBQueue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +820,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +838,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +974,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +993,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1067,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1131,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_rules_operations.py index 50be288b6037..f232be979b92 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_rules_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscriptions_request -T = TypeVar('T') +from ...operations._rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscriptions_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RulesOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -54,16 +73,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.RuleListResult]: + ) -> AsyncIterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -73,57 +92,61 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) + :return: An iterator like instance of either Rule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,16 +154,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,13 +172,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -166,40 +187,127 @@ async def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -211,18 +319,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,15 +338,16 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -252,33 +361,37 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -287,18 +400,17 @@ async def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -309,8 +421,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def get( @@ -324,33 +437,37 @@ async def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -359,18 +476,17 @@ async def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,12 +494,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_subscriptions_operations.py index 7c336657b705..a1566d53e4d3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_subscriptions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_topic_request -T = TypeVar('T') +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_topic_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SubscriptionsOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -53,14 +72,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBSubscriptionListResult]: + ) -> AsyncIterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -70,56 +92,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,16 +153,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,13 +171,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -161,38 +185,128 @@ async def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -203,18 +317,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -222,52 +336,55 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -275,18 +392,17 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -297,45 +413,48 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -343,18 +462,17 @@ async def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -362,12 +480,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_topics_operations.py index c55bd895d94e..7ba0b6d38fd8 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/aio/operations/_topics_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._topics_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopicsOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,128 @@ async def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +308,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +327,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -230,31 +349,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +388,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,15 +406,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -302,31 +428,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -334,18 +467,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -356,8 +488,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +503,38 @@ async def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +542,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +560,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +579,130 @@ async def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +713,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +732,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +751,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBTopicListResult]: + ) -> AsyncIterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +769,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :return: An iterator like instance of either SBTopic or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +829,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +847,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +983,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +1002,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1076,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1140,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/__init__.py index 0c388e2dc7f2..6cef0d97b01f 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/__init__.py @@ -62,102 +62,100 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserAssignedIdentityProperties - -from ._service_bus_management_client_enums import ( - AccessRights, - CreatedByType, - DefaultAction, - EndPointProvisioningState, - EntityStatus, - FilterType, - KeyType, - ManagedServiceIdentityType, - MigrationConfigurationName, - NetworkRuleIPAction, - PrivateLinkConnectionStatus, - ProvisioningStateDR, - PublicNetworkAccessFlag, - RoleDisasterRecovery, - SkuName, - SkuTier, - UnavailableReason, -) +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import CreatedByType +from ._service_bus_management_client_enums import DefaultAction +from ._service_bus_management_client_enums import EndPointProvisioningState +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import FilterType +from ._service_bus_management_client_enums import KeyType +from ._service_bus_management_client_enums import ManagedServiceIdentityType +from ._service_bus_management_client_enums import MigrationConfigurationName +from ._service_bus_management_client_enums import NetworkRuleIPAction +from ._service_bus_management_client_enums import PrivateLinkConnectionStatus +from ._service_bus_management_client_enums import ProvisioningStateDR +from ._service_bus_management_client_enums import PublicNetworkAccessFlag +from ._service_bus_management_client_enums import RoleDisasterRecovery +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import UnavailableReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccessKeys', - 'Action', - 'ArmDisasterRecovery', - 'ArmDisasterRecoveryListResult', - 'CheckNameAvailability', - 'CheckNameAvailabilityResult', - 'ConnectionState', - 'CorrelationFilter', - 'Encryption', - 'ErrorAdditionalInfo', - 'ErrorResponse', - 'ErrorResponseError', - 'FailoverProperties', - 'Identity', - 'KeyVaultProperties', - 'MessageCountDetails', - 'MigrationConfigListResult', - 'MigrationConfigProperties', - 'NWRuleSetIpRules', - 'NWRuleSetVirtualNetworkRules', - 'NetworkRuleSet', - 'NetworkRuleSetListResult', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'RegenerateAccessKeyParameters', - 'Resource', - 'ResourceNamespacePatch', - 'Rule', - 'RuleListResult', - 'SBAuthorizationRule', - 'SBAuthorizationRuleListResult', - 'SBClientAffineProperties', - 'SBNamespace', - 'SBNamespaceListResult', - 'SBNamespaceUpdateParameters', - 'SBQueue', - 'SBQueueListResult', - 'SBSku', - 'SBSubscription', - 'SBSubscriptionListResult', - 'SBTopic', - 'SBTopicListResult', - 'SqlFilter', - 'SqlRuleAction', - 'Subnet', - 'SystemData', - 'TrackedResource', - 'UserAssignedIdentity', - 'UserAssignedIdentityProperties', - 'AccessRights', - 'CreatedByType', - 'DefaultAction', - 'EndPointProvisioningState', - 'EntityStatus', - 'FilterType', - 'KeyType', - 'ManagedServiceIdentityType', - 'MigrationConfigurationName', - 'NetworkRuleIPAction', - 'PrivateLinkConnectionStatus', - 'ProvisioningStateDR', - 'PublicNetworkAccessFlag', - 'RoleDisasterRecovery', - 'SkuName', - 'SkuTier', - 'UnavailableReason', + "AccessKeys", + "Action", + "ArmDisasterRecovery", + "ArmDisasterRecoveryListResult", + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "ConnectionState", + "CorrelationFilter", + "Encryption", + "ErrorAdditionalInfo", + "ErrorResponse", + "ErrorResponseError", + "FailoverProperties", + "Identity", + "KeyVaultProperties", + "MessageCountDetails", + "MigrationConfigListResult", + "MigrationConfigProperties", + "NWRuleSetIpRules", + "NWRuleSetVirtualNetworkRules", + "NetworkRuleSet", + "NetworkRuleSetListResult", + "Operation", + "OperationDisplay", + "OperationListResult", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "RegenerateAccessKeyParameters", + "Resource", + "ResourceNamespacePatch", + "Rule", + "RuleListResult", + "SBAuthorizationRule", + "SBAuthorizationRuleListResult", + "SBClientAffineProperties", + "SBNamespace", + "SBNamespaceListResult", + "SBNamespaceUpdateParameters", + "SBQueue", + "SBQueueListResult", + "SBSku", + "SBSubscription", + "SBSubscriptionListResult", + "SBTopic", + "SBTopicListResult", + "SqlFilter", + "SqlRuleAction", + "Subnet", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "UserAssignedIdentityProperties", + "AccessRights", + "CreatedByType", + "DefaultAction", + "EndPointProvisioningState", + "EntityStatus", + "FilterType", + "KeyType", + "ManagedServiceIdentityType", + "MigrationConfigurationName", + "NetworkRuleIPAction", + "PrivateLinkConnectionStatus", + "ProvisioningStateDR", + "PublicNetworkAccessFlag", + "RoleDisasterRecovery", + "SkuName", + "SkuTier", + "UnavailableReason", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_models_py3.py index 9e3cdc61ff72..c431eeb0ca75 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,22 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class AccessKeys(msrest.serialization.Model): +class AccessKeys(_serialization.Model): """Namespace/ServiceBus Connection String. Variables are only populated by the server, and will be ignored when sending a request. @@ -45,32 +51,28 @@ class AccessKeys(msrest.serialization.Model): """ _validation = { - 'primary_connection_string': {'readonly': True}, - 'secondary_connection_string': {'readonly': True}, - 'alias_primary_connection_string': {'readonly': True}, - 'alias_secondary_connection_string': {'readonly': True}, - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - 'key_name': {'readonly': True}, + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + "alias_primary_connection_string": {"readonly": True}, + "alias_secondary_connection_string": {"readonly": True}, + "primary_key": {"readonly": True}, + "secondary_key": {"readonly": True}, + "key_name": {"readonly": True}, } _attribute_map = { - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, - 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AccessKeys, self).__init__(**kwargs) + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "alias_primary_connection_string": {"key": "aliasPrimaryConnectionString", "type": "str"}, + "alias_secondary_connection_string": {"key": "aliasSecondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.primary_connection_string = None self.secondary_connection_string = None self.alias_primary_connection_string = None @@ -80,8 +82,9 @@ def __init__( self.key_name = None -class Action(msrest.serialization.Model): - """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. +class Action(_serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have + been matched by a filter expression. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -94,9 +97,9 @@ class Action(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -104,9 +107,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -117,13 +120,13 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource definition for other than namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -137,24 +140,20 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -175,11 +174,11 @@ class ArmDisasterRecovery(Resource): :vartype system_data: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SystemData :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Known values are: "Accepted", - "Succeeded", "Failed". + "Succeeded", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. :vartype partner_namespace: str @@ -187,39 +186,35 @@ class ArmDisasterRecovery(Resource): pairing. :vartype alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' - or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", "Secondary". + or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", and "Secondary". :vartype role: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.RoleDisasterRecovery """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'role': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "role": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "partner_namespace": {"key": "properties.partnerNamespace", "type": "str"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "role": {"key": "properties.role", "type": "str"}, } def __init__( - self, - *, - partner_namespace: Optional[str] = None, - alternate_name: Optional[str] = None, - **kwargs - ): + self, *, partner_namespace: Optional[str] = None, alternate_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. @@ -228,7 +223,7 @@ def __init__( pairing. :paramtype alternate_name: str """ - super(ArmDisasterRecovery, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -237,7 +232,7 @@ def __init__( self.role = None -class ArmDisasterRecoveryListResult(msrest.serialization.Model): +class ArmDisasterRecoveryListResult(_serialization.Model): """The result of the List Alias(Disaster Recovery configuration) operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -250,65 +245,55 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ArmDisasterRecovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ArmDisasterRecovery"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ArmDisasterRecovery"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Alias(Disaster Recovery configurations). :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery] """ - super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CheckNameAvailability(msrest.serialization.Model): +class CheckNameAvailability(_serialization.Model): """Description of a Check Name availability request properties. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The Name to check the namespace name availability and The namespace name - can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it - must end with a letter or number. + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The Name to check the namespace name availability and The namespace - name can contain only letters, numbers, and hyphens. The namespace must start with a letter, - and it must end with a letter or number. + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :paramtype name: str """ - super(CheckNameAvailability, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(msrest.serialization.Model): +class CheckNameAvailabilityResult(_serialization.Model): """Description of a Check Name availability request properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -319,19 +304,19 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): available; otherwise, false. :vartype name_available: bool :ivar reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :vartype reason: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.UnavailableReason """ _validation = { - 'message': {'readonly': True}, + "message": {"readonly": True}, } _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "message": {"key": "message", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, } def __init__( @@ -339,28 +324,28 @@ def __init__( *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.UnavailableReason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Value indicating namespace is availability, true if the namespace is available; otherwise, false. :paramtype name_available: bool :keyword reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :paramtype reason: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.UnavailableReason """ - super(CheckNameAvailabilityResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.message = None self.name_available = name_available self.reason = reason -class ConnectionState(msrest.serialization.Model): +class ConnectionState(_serialization.Model): """ConnectionState information. :ivar status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :vartype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateLinkConnectionStatus :ivar description: Description of the connection state. @@ -368,8 +353,8 @@ class ConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -377,22 +362,22 @@ def __init__( *, status: Optional[Union[str, "_models.PrivateLinkConnectionStatus"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :paramtype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateLinkConnectionStatus :keyword description: Description of the connection state. :paramtype description: str """ - super(ConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class CorrelationFilter(msrest.serialization.Model): +class CorrelationFilter(_serialization.Model): """Represents the correlation filter expression. :ivar properties: dictionary object for custom filters. @@ -419,16 +404,16 @@ class CorrelationFilter(msrest.serialization.Model): """ _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'message_id': {'key': 'messageId', 'type': 'str'}, - 'to': {'key': 'to', 'type': 'str'}, - 'reply_to': {'key': 'replyTo', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "properties": {"key": "properties", "type": "{str}"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "message_id": {"key": "messageId", "type": "str"}, + "to": {"key": "to", "type": "str"}, + "reply_to": {"key": "replyTo", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "session_id": {"key": "sessionId", "type": "str"}, + "reply_to_session_id": {"key": "replyToSessionId", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -443,9 +428,9 @@ def __init__( session_id: Optional[str] = None, reply_to_session_id: Optional[str] = None, content_type: Optional[str] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword properties: dictionary object for custom filters. :paramtype properties: dict[str, str] @@ -469,7 +454,7 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(CorrelationFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties self.correlation_id = correlation_id self.message_id = message_id @@ -482,14 +467,13 @@ def __init__( self.requires_preprocessing = requires_preprocessing -class Encryption(msrest.serialization.Model): +class Encryption(_serialization.Model): """Properties to configure Encryption. :ivar key_vault_properties: Properties of KeyVault. :vartype key_vault_properties: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.KeyVaultProperties] - :ivar key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value is "Microsoft.KeyVault". :vartype key_source: str :ivar require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). @@ -497,38 +481,37 @@ class Encryption(msrest.serialization.Model): """ _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "[KeyVaultProperties]"}, + "key_source": {"key": "keySource", "type": "str"}, + "require_infrastructure_encryption": {"key": "requireInfrastructureEncryption", "type": "bool"}, } def __init__( self, *, key_vault_properties: Optional[List["_models.KeyVaultProperties"]] = None, - key_source: Optional[str] = "Microsoft.KeyVault", + key_source: Literal["Microsoft.KeyVault"] = "Microsoft.KeyVault", require_infrastructure_encryption: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Properties of KeyVault. :paramtype key_vault_properties: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.KeyVaultProperties] - :keyword key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is - "Microsoft.KeyVault". + :keyword key_source: Enumerates the possible value of keySource for Encryption. Default value + is "Microsoft.KeyVault". :paramtype key_source: str :keyword require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). :paramtype require_infrastructure_encryption: bool """ - super(Encryption, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_vault_properties = key_vault_properties self.key_source = key_source self.require_infrastructure_encryption = require_infrastructure_encryption -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -536,31 +519,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -568,24 +547,19 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + "error": {"key": "error", "type": "ErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ErrorResponseError """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ErrorResponseError(msrest.serialization.Model): +class ErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -604,28 +578,24 @@ class ErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -633,8 +603,9 @@ def __init__( self.additional_info = None -class FailoverProperties(msrest.serialization.Model): - """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. +class FailoverProperties(_serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before + switching to the secondary. :ivar is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. @@ -642,25 +613,20 @@ class FailoverProperties(msrest.serialization.Model): """ _attribute_map = { - 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + "is_safe_failover": {"key": "properties.IsSafeFailover", "type": "bool"}, } - def __init__( - self, - *, - is_safe_failover: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, is_safe_failover: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. :paramtype is_safe_failover: bool """ - super(FailoverProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_safe_failover = is_safe_failover -class Identity(msrest.serialization.Model): +class Identity(_serialization.Model): """Properties to configure User Assigned Identities for Bring your Own Keys. Variables are only populated by the server, and will be ignored when sending a request. @@ -670,7 +636,7 @@ class Identity(msrest.serialization.Model): :ivar tenant_id: TenantId from the KeyVault. :vartype tenant_id: str :ivar type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :vartype type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.ManagedServiceIdentityType :ivar user_assigned_identities: Properties for User Assigned Identities. @@ -679,15 +645,15 @@ class Identity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } def __init__( @@ -695,25 +661,25 @@ def __init__( *, type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.ManagedServiceIdentityType :keyword user_assigned_identities: Properties for User Assigned Identities. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.servicebus.v2021_06_01_preview.models.UserAssignedIdentity] """ - super(Identity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class KeyVaultProperties(msrest.serialization.Model): +class KeyVaultProperties(_serialization.Model): """Properties to configure keyVault Properties. :ivar key_name: Name of the Key from KeyVault. @@ -728,10 +694,10 @@ class KeyVaultProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + "key_name": {"key": "keyName", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "key_version": {"key": "keyVersion", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentityProperties"}, } def __init__( @@ -741,8 +707,8 @@ def __init__( key_vault_uri: Optional[str] = None, key_version: Optional[str] = None, identity: Optional["_models.UserAssignedIdentityProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: Name of the Key from KeyVault. :paramtype key_name: str @@ -754,54 +720,50 @@ def __init__( :paramtype identity: ~azure.mgmt.servicebus.v2021_06_01_preview.models.UserAssignedIdentityProperties """ - super(KeyVaultProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name self.key_vault_uri = key_vault_uri self.key_version = key_version self.identity = identity -class MessageCountDetails(msrest.serialization.Model): +class MessageCountDetails(_serialization.Model): """Message Count Details. Variables are only populated by the server, and will be ignored when sending a request. :ivar active_message_count: Number of active messages in the queue, topic, or subscription. - :vartype active_message_count: long + :vartype active_message_count: int :ivar dead_letter_message_count: Number of messages that are dead lettered. - :vartype dead_letter_message_count: long + :vartype dead_letter_message_count: int :ivar scheduled_message_count: Number of scheduled messages. - :vartype scheduled_message_count: long + :vartype scheduled_message_count: int :ivar transfer_message_count: Number of messages transferred to another queue, topic, or subscription. - :vartype transfer_message_count: long + :vartype transfer_message_count: int :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. - :vartype transfer_dead_letter_message_count: long + :vartype transfer_dead_letter_message_count: int """ _validation = { - 'active_message_count': {'readonly': True}, - 'dead_letter_message_count': {'readonly': True}, - 'scheduled_message_count': {'readonly': True}, - 'transfer_message_count': {'readonly': True}, - 'transfer_dead_letter_message_count': {'readonly': True}, + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, } _attribute_map = { - 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, - 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, - 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, - 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, - 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MessageCountDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.active_message_count = None self.dead_letter_message_count = None self.scheduled_message_count = None @@ -809,7 +771,7 @@ def __init__( self.transfer_dead_letter_message_count = None -class MigrationConfigListResult(msrest.serialization.Model): +class MigrationConfigListResult(_serialization.Model): """The result of the List migrationConfigurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -823,26 +785,21 @@ class MigrationConfigListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationConfigProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MigrationConfigProperties"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MigrationConfigProperties"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Migration Configs. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] """ - super(MigrationConfigListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None @@ -863,7 +820,7 @@ class MigrationConfigProperties(Resource): :ivar provisioning_state: Provisioning state of Migration Configuration. :vartype provisioning_state: str :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. :vartype target_namespace: str @@ -875,34 +832,30 @@ class MigrationConfigProperties(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'migration_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "migration_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, - 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, - 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "target_namespace": {"key": "properties.targetNamespace", "type": "str"}, + "post_migration_name": {"key": "properties.postMigrationName", "type": "str"}, + "migration_state": {"key": "properties.migrationState", "type": "str"}, } def __init__( - self, - *, - target_namespace: Optional[str] = None, - post_migration_name: Optional[str] = None, - **kwargs - ): + self, *, target_namespace: Optional[str] = None, post_migration_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. @@ -910,7 +863,7 @@ def __init__( :keyword post_migration_name: Name to access Standard Namespace after migration. :paramtype post_migration_name: str """ - super(MigrationConfigProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -935,7 +888,8 @@ class NetworkRuleSet(Resource): :ivar trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. :vartype trusted_service_access_enabled: bool - :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow", "Deny". + :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". :vartype default_action: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.DefaultAction :ivar virtual_network_rules: List VirtualNetwork Rules. :vartype virtual_network_rules: @@ -943,28 +897,28 @@ class NetworkRuleSet(Resource): :ivar ip_rules: List of IpRules. :vartype ip_rules: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.NWRuleSetIpRules] :ivar public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled". Default value: "Enabled". + default it is enabled. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.PublicNetworkAccessFlag """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'trusted_service_access_enabled': {'key': 'properties.trustedServiceAccessEnabled', 'type': 'bool'}, - 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "trusted_service_access_enabled": {"key": "properties.trustedServiceAccessEnabled", "type": "bool"}, + "default_action": {"key": "properties.defaultAction", "type": "str"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[NWRuleSetVirtualNetworkRules]"}, + "ip_rules": {"key": "properties.ipRules", "type": "[NWRuleSetIpRules]"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, } def __init__( @@ -974,14 +928,14 @@ def __init__( default_action: Optional[Union[str, "_models.DefaultAction"]] = None, virtual_network_rules: Optional[List["_models.NWRuleSetVirtualNetworkRules"]] = None, ip_rules: Optional[List["_models.NWRuleSetIpRules"]] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccessFlag"]] = "Enabled", - **kwargs - ): + public_network_access: Union[str, "_models.PublicNetworkAccessFlag"] = "Enabled", + **kwargs: Any + ) -> None: """ :keyword trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. :paramtype trusted_service_access_enabled: bool - :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow", + :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow" and "Deny". :paramtype default_action: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.DefaultAction @@ -991,11 +945,11 @@ def __init__( :keyword ip_rules: List of IpRules. :paramtype ip_rules: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.NWRuleSetIpRules] :keyword public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled". Default value: "Enabled". + default it is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.PublicNetworkAccessFlag """ - super(NetworkRuleSet, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.trusted_service_access_enabled = trusted_service_access_enabled self.default_action = default_action @@ -1004,7 +958,7 @@ def __init__( self.public_network_access = public_network_access -class NetworkRuleSetListResult(msrest.serialization.Model): +class NetworkRuleSetListResult(_serialization.Model): """The response of the List NetworkRuleSet operation. :ivar value: Result of the List NetworkRuleSet operation. @@ -1015,17 +969,13 @@ class NetworkRuleSetListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NetworkRuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.NetworkRuleSet"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.NetworkRuleSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List NetworkRuleSet operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet] @@ -1033,44 +983,44 @@ def __init__( list of NetworkRuleSet. :paramtype next_link: str """ - super(NetworkRuleSetListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class NWRuleSetIpRules(msrest.serialization.Model): +class NWRuleSetIpRules(_serialization.Model): """Description of NetWorkRuleSet - IpRules resource. :ivar ip_mask: IP Mask. :vartype ip_mask: str - :ivar action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :ivar action: The IP Filter Action. "Allow" :vartype action: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleIPAction """ _attribute_map = { - 'ip_mask': {'key': 'ipMask', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, + "ip_mask": {"key": "ipMask", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "_models.NetworkRuleIPAction"]] = "Allow", - **kwargs - ): + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword ip_mask: IP Mask. :paramtype ip_mask: str - :keyword action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :keyword action: The IP Filter Action. "Allow" :paramtype action: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleIPAction """ - super(NWRuleSetIpRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_mask = ip_mask self.action = action -class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): +class NWRuleSetVirtualNetworkRules(_serialization.Model): """Description of VirtualNetworkRules - NetworkRules resource. :ivar subnet: Subnet properties. @@ -1081,8 +1031,8 @@ class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): """ _attribute_map = { - 'subnet': {'key': 'subnet', 'type': 'Subnet'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + "subnet": {"key": "subnet", "type": "Subnet"}, + "ignore_missing_vnet_service_endpoint": {"key": "ignoreMissingVnetServiceEndpoint", "type": "bool"}, } def __init__( @@ -1090,8 +1040,8 @@ def __init__( *, subnet: Optional["_models.Subnet"] = None, ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet: Subnet properties. :paramtype subnet: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Subnet @@ -1099,12 +1049,12 @@ def __init__( VNet Service Endpoint. :paramtype ignore_missing_vnet_service_endpoint: bool """ - super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.subnet = subnet self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """A ServiceBus REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1116,30 +1066,25 @@ class Operation(msrest.serialization.Model): """ _validation = { - 'name': {'readonly': True}, + "name": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__( - self, - *, - display: Optional["_models.OperationDisplay"] = None, - **kwargs - ): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.servicebus.v2021_06_01_preview.models.OperationDisplay """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.display = display -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """The object that represents the operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1153,31 +1098,28 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None -class OperationListResult(msrest.serialization.Model): - """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1189,27 +1131,23 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """PrivateEndpoint information. :ivar id: The ARM identifier for Private Endpoint. @@ -1217,20 +1155,15 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The ARM identifier for Private Endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id @@ -1253,26 +1186,29 @@ class PrivateEndpointConnection(Resource): :vartype private_link_service_connection_state: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ConnectionState :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Known values - are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EndPointProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "ConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( @@ -1281,8 +1217,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.ConnectionState"] = None, provisioning_state: Optional[Union[str, "_models.EndPointProvisioningState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The Private Endpoint resource for this Connection. :paramtype private_endpoint: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpoint @@ -1290,18 +1226,18 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ConnectionState :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :paramtype provisioning_state: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EndPointProvisioningState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """Result of the list of all private endpoint connections operation. :ivar value: A collection of private endpoint connection resources. @@ -1312,8 +1248,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1321,8 +1257,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private endpoint connection resources. :paramtype value: @@ -1330,12 +1266,12 @@ def __init__( :keyword next_link: A link for the next page of private endpoint connection resources. :paramtype next_link: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """Information of the private link resource. :ivar id: Fully qualified identifier of the resource. @@ -1353,25 +1289,25 @@ class PrivateLinkResource(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the resource. :paramtype id: str @@ -1386,7 +1322,7 @@ def __init__( :keyword required_zone_names: Required Zone Names. :paramtype required_zone_names: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -1395,7 +1331,7 @@ def __init__( self.required_zone_names = required_zone_names -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """Result of the List private link resources operation. :ivar value: A collection of private link resources. @@ -1405,8 +1341,8 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1414,25 +1350,26 @@ def __init__( *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private link resources. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateLinkResource] :keyword next_link: A link for the next page of private link resources. :paramtype next_link: str """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RegenerateAccessKeyParameters(msrest.serialization.Model): - """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. +class RegenerateAccessKeyParameters(_serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs + to be reset. All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :ivar key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :vartype key_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.KeyType :ivar key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key @@ -1441,30 +1378,24 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): """ _validation = { - 'key_type': {'required': True}, + "key_type": {"required": True}, } _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, + "key_type": {"key": "keyType", "type": "str"}, + "key": {"key": "key", "type": "str"}, } - def __init__( - self, - *, - key_type: Union[str, "_models.KeyType"], - key: Optional[str] = None, - **kwargs - ): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :keyword key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :paramtype key_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.KeyType :keyword key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :paramtype key: str """ - super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_type = key_type self.key = key @@ -1482,38 +1413,32 @@ class ResourceNamespacePatch(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(ResourceNamespacePatch, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags @@ -1535,7 +1460,7 @@ class Rule(Resource): message that have been matched by a filter expression. :vartype action: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Action :ivar filter_type: Filter type that is evaluated against a BrokeredMessage. Known values are: - "SqlFilter", "CorrelationFilter". + "SqlFilter" and "CorrelationFilter". :vartype filter_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.FilterType :ivar sql_filter: Properties of sqlFilter. :vartype sql_filter: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SqlFilter @@ -1545,21 +1470,21 @@ class Rule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'action': {'key': 'properties.action', 'type': 'Action'}, - 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, - 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, - 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "action": {"key": "properties.action", "type": "Action"}, + "filter_type": {"key": "properties.filterType", "type": "str"}, + "sql_filter": {"key": "properties.sqlFilter", "type": "SqlFilter"}, + "correlation_filter": {"key": "properties.correlationFilter", "type": "CorrelationFilter"}, } def __init__( @@ -1569,14 +1494,14 @@ def __init__( filter_type: Optional[Union[str, "_models.FilterType"]] = None, sql_filter: Optional["_models.SqlFilter"] = None, correlation_filter: Optional["_models.CorrelationFilter"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. :paramtype action: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Action :keyword filter_type: Filter type that is evaluated against a BrokeredMessage. Known values - are: "SqlFilter", "CorrelationFilter". + are: "SqlFilter" and "CorrelationFilter". :paramtype filter_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.FilterType :keyword sql_filter: Properties of sqlFilter. :paramtype sql_filter: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SqlFilter @@ -1584,7 +1509,7 @@ def __init__( :paramtype correlation_filter: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CorrelationFilter """ - super(Rule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.action = action self.filter_type = filter_type @@ -1592,7 +1517,7 @@ def __init__( self.correlation_filter = correlation_filter -class RuleListResult(msrest.serialization.Model): +class RuleListResult(_serialization.Model): """The response of the List rule operation. :ivar value: Result of the List Rules operation. @@ -1603,17 +1528,13 @@ class RuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.Rule"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Rule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule] @@ -1621,7 +1542,7 @@ def __init__( list of rules. :paramtype next_link: str """ - super(RuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1644,36 +1565,31 @@ class SBAuthorizationRule(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } - def __init__( - self, - *, - rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + def __init__(self, *, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, **kwargs: Any) -> None: """ :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessRights] """ - super(SBAuthorizationRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.rights = rights -class SBAuthorizationRuleListResult(msrest.serialization.Model): +class SBAuthorizationRuleListResult(_serialization.Model): """The response to the List Namespace operation. :ivar value: Result of the List Authorization Rules operation. @@ -1684,8 +1600,8 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBAuthorizationRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1693,8 +1609,8 @@ def __init__( *, value: Optional[List["_models.SBAuthorizationRule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Authorization Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] @@ -1702,12 +1618,12 @@ def __init__( list of Authorization Rules. :paramtype next_link: str """ - super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBClientAffineProperties(msrest.serialization.Model): +class SBClientAffineProperties(_serialization.Model): """Properties specific to client affine subscriptions. :ivar client_id: Indicates the Client ID of the application that created the client-affine @@ -1722,9 +1638,9 @@ class SBClientAffineProperties(msrest.serialization.Model): """ _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'is_durable': {'key': 'isDurable', 'type': 'bool'}, - 'is_shared': {'key': 'isShared', 'type': 'bool'}, + "client_id": {"key": "clientId", "type": "str"}, + "is_durable": {"key": "isDurable", "type": "bool"}, + "is_shared": {"key": "isShared", "type": "bool"}, } def __init__( @@ -1733,8 +1649,8 @@ def __init__( client_id: Optional[str] = None, is_durable: Optional[bool] = None, is_shared: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: Indicates the Client ID of the application that created the client-affine subscription. @@ -1746,7 +1662,7 @@ def __init__( subscription is shared or not. :paramtype is_shared: bool """ - super(SBClientAffineProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.is_durable = is_durable self.is_shared = is_shared @@ -1765,46 +1681,40 @@ class TrackedResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags -class SBNamespace(TrackedResource): +class SBNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1817,9 +1727,9 @@ class SBNamespace(TrackedResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSku @@ -1853,38 +1763,41 @@ class SBNamespace(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, } def __init__( @@ -1898,12 +1811,12 @@ def __init__( encryption: Optional["_models.Encryption"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, disable_local_auth: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSku @@ -1921,7 +1834,7 @@ def __init__( namespace. :paramtype disable_local_auth: bool """ - super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.system_data = None @@ -1937,7 +1850,7 @@ def __init__( self.disable_local_auth = disable_local_auth -class SBNamespaceListResult(msrest.serialization.Model): +class SBNamespaceListResult(_serialization.Model): """The response of the List Namespace operation. :ivar value: Result of the List Namespace operation. @@ -1948,17 +1861,13 @@ class SBNamespaceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBNamespace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBNamespace]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBNamespace"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBNamespace"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Namespace operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] @@ -1966,12 +1875,12 @@ def __init__( list of Namespaces. :paramtype next_link: str """ - super(SBNamespaceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBNamespaceUpdateParameters(ResourceNamespacePatch): +class SBNamespaceUpdateParameters(ResourceNamespacePatch): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1984,7 +1893,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSku @@ -2016,35 +1925,38 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, } def __init__( @@ -2058,12 +1970,12 @@ def __init__( encryption: Optional["_models.Encryption"] = None, private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, disable_local_auth: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSku @@ -2081,7 +1993,7 @@ def __init__( namespace. :paramtype disable_local_auth: bool """ - super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.provisioning_state = None @@ -2096,7 +2008,7 @@ def __init__( self.disable_local_auth = disable_local_auth -class SBQueue(Resource): +class SBQueue(Resource): # pylint: disable=too-many-instance-attributes """Description of queue Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2119,9 +2031,9 @@ class SBQueue(Resource): to this queue. :vartype accessed_at: ~datetime.datetime :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. @@ -2131,7 +2043,7 @@ class SBQueue(Resource): :vartype max_size_in_megabytes: int :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. - :vartype max_message_size_in_kilobytes: long + :vartype max_message_size_in_kilobytes: int :ivar requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :vartype requires_duplicate_detection: bool @@ -2153,7 +2065,7 @@ class SBQueue(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2174,48 +2086,51 @@ class SBQueue(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'message_count': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "message_count": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'max_message_size_in_kilobytes': {'key': 'properties.maxMessageSizeInKilobytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2234,8 +2149,8 @@ def __init__( enable_express: Optional[bool] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 @@ -2246,7 +2161,7 @@ def __init__( :paramtype max_size_in_megabytes: int :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. - :paramtype max_message_size_in_kilobytes: long + :paramtype max_message_size_in_kilobytes: int :keyword requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -2268,7 +2183,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2288,7 +2203,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBQueue, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.count_details = None self.created_at = None @@ -2314,7 +2229,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBQueueListResult(msrest.serialization.Model): +class SBQueueListResult(_serialization.Model): """The response to the List Queues operation. :ivar value: Result of the List Queues operation. @@ -2325,17 +2240,13 @@ class SBQueueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBQueue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBQueue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBQueue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Queues operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue] @@ -2343,19 +2254,19 @@ def __init__( list of queues. :paramtype next_link: str """ - super(SBQueueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBSku(msrest.serialization.Model): +class SBSku(_serialization.Model): """SKU of the namespace. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :ivar name: Name of this SKU. Required. Known values are: "Basic", "Standard", and "Premium". :vartype name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.SkuName - :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", + :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", and "Premium". :vartype tier: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.SkuTier :ivar capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 @@ -2364,13 +2275,13 @@ class SBSku(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( @@ -2379,25 +2290,26 @@ def __init__( name: Union[str, "_models.SkuName"], tier: Optional[Union[str, "_models.SkuTier"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :keyword name: Name of this SKU. Required. Known values are: "Basic", "Standard", and + "Premium". :paramtype name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.SkuName :keyword tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", - "Premium". + and "Premium". :paramtype tier: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.SkuTier :keyword capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :paramtype capacity: int """ - super(SBSku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SBSubscription(Resource): +class SBSubscription(Resource): # pylint: disable=too-many-instance-attributes """Description of subscription resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2411,7 +2323,7 @@ class SBSubscription(Resource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SystemData :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar accessed_at: Last time there was a receive request to this subscription. @@ -2442,7 +2354,7 @@ class SBSubscription(Resource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2463,41 +2375,47 @@ class SBSubscription(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'message_count': {'readonly': True}, - 'created_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "message_count": {"readonly": True}, + "created_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - 'is_client_affine': {'key': 'properties.isClientAffine', 'type': 'bool'}, - 'client_affine_properties': {'key': 'properties.clientAffineProperties', 'type': 'SBClientAffineProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + "is_client_affine": {"key": "properties.isClientAffine", "type": "bool"}, + "client_affine_properties": {"key": "properties.clientAffineProperties", "type": "SBClientAffineProperties"}, } def __init__( @@ -2517,8 +2435,8 @@ def __init__( forward_dead_lettered_messages_to: Optional[str] = None, is_client_affine: Optional[bool] = None, client_affine_properties: Optional["_models.SBClientAffineProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. @@ -2542,7 +2460,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2562,7 +2480,7 @@ def __init__( :paramtype client_affine_properties: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBClientAffineProperties """ - super(SBSubscription, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.message_count = None self.created_at = None @@ -2585,7 +2503,7 @@ def __init__( self.client_affine_properties = client_affine_properties -class SBSubscriptionListResult(msrest.serialization.Model): +class SBSubscriptionListResult(_serialization.Model): """The response to the List Subscriptions operation. :ivar value: Result of the List Subscriptions operation. @@ -2596,17 +2514,13 @@ class SBSubscriptionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBSubscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBSubscription"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBSubscription"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Subscriptions operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription] @@ -2614,12 +2528,12 @@ def __init__( list of subscriptions. :paramtype next_link: str """ - super(SBSubscriptionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBTopic(Resource): +class SBTopic(Resource): # pylint: disable=too-many-instance-attributes """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2633,7 +2547,7 @@ class SBTopic(Resource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SystemData :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2653,7 +2567,7 @@ class SBTopic(Resource): :vartype max_size_in_megabytes: int :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today and default is 1024. - :vartype max_message_size_in_kilobytes: long + :vartype max_message_size_in_kilobytes: int :ivar requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :vartype requires_duplicate_detection: bool @@ -2665,7 +2579,7 @@ class SBTopic(Resource): :vartype enable_batched_operations: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EntityStatus :ivar support_ordering: Value that indicates whether the topic supports ordering. :vartype support_ordering: bool @@ -2681,40 +2595,43 @@ class SBTopic(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "subscription_count": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'max_message_size_in_kilobytes': {'key': 'properties.maxMessageSizeInKilobytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, } def __init__( @@ -2731,8 +2648,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, enable_partitioning: Optional[bool] = None, enable_express: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -2743,7 +2660,7 @@ def __init__( :paramtype max_size_in_megabytes: int :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today and default is 1024. - :paramtype max_message_size_in_kilobytes: long + :paramtype max_message_size_in_kilobytes: int :keyword requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -2755,7 +2672,7 @@ def __init__( :paramtype enable_batched_operations: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool @@ -2769,7 +2686,7 @@ def __init__( topic holds a message in memory temporarily before writing it to persistent storage. :paramtype enable_express: bool """ - super(SBTopic, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.size_in_bytes = None self.created_at = None @@ -2790,7 +2707,7 @@ def __init__( self.enable_express = enable_express -class SBTopicListResult(msrest.serialization.Model): +class SBTopicListResult(_serialization.Model): """The response to the List Topics operation. :ivar value: Result of the List Topics operation. @@ -2801,17 +2718,13 @@ class SBTopicListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBTopic]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBTopic"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBTopic"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Topics operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic] @@ -2819,13 +2732,14 @@ def __init__( list of topics. :paramtype next_link: str """ - super(SBTopicListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SqlFilter(msrest.serialization.Model): - """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. +class SqlFilter(_serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in + the pub/sub pipeline. :ivar sql_expression: The SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2838,9 +2752,9 @@ class SqlFilter(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -2848,9 +2762,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: The SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -2861,14 +2775,15 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing class SqlRuleAction(Action): - """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + """Represents set of actions written in SQL language-based syntax that is performed against a + ServiceBus.Messaging.BrokeredMessage. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2881,9 +2796,9 @@ class SqlRuleAction(Action): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -2891,9 +2806,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -2904,47 +2819,47 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + super().__init__( + sql_expression=sql_expression, + compatibility_level=compatibility_level, + requires_preprocessing=requires_preprocessing, + **kwargs + ) -class Subnet(msrest.serialization.Model): +class Subnet(_serialization.Model): """Properties supplied for Subnet. All required parameters must be populated in order to send to Azure. - :ivar id: Required. Resource ID of Virtual Network Subnet. + :ivar id: Resource ID of Virtual Network Subnet. Required. :vartype id: str """ _validation = { - 'id': {'required': True}, + "id": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: str, - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Required. Resource ID of Virtual Network Subnet. + :keyword id: Resource ID of Virtual Network Subnet. Required. :paramtype id: str """ - super(Subnet, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -2952,7 +2867,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -2960,12 +2875,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -2977,13 +2892,13 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -2991,13 +2906,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -3006,7 +2921,7 @@ def __init__( self.last_modified_at = last_modified_at -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Recognized Dictionary value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3018,27 +2933,23 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(UserAssignedIdentity, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentityProperties(msrest.serialization.Model): +class UserAssignedIdentityProperties(_serialization.Model): """UserAssignedIdentityProperties. :ivar user_assigned_identity: ARM ID of user Identity selected for encryption. @@ -3046,18 +2957,13 @@ class UserAssignedIdentityProperties(msrest.serialization.Model): """ _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: ARM ID of user Identity selected for encryption. :paramtype user_assigned_identity: str """ - super(UserAssignedIdentityProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.user_assigned_identity = user_assigned_identity diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_service_bus_management_client_enums.py index 33112c2ab17d..ce716a014719 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/models/_service_bus_management_client_enums.py @@ -11,30 +11,31 @@ class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class DefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Default Action for Network Rule Set - """ + """Default Action for Network Rule Set.""" ALLOW = "Allow" DENY = "Deny" + class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Private Endpoint Connection. - """ + """Provisioning state of the Private Endpoint Connection.""" CREATING = "Creating" UPDATING = "Updating" @@ -43,9 +44,9 @@ class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" FAILED = "Failed" + class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity status. - """ + """Entity status.""" ACTIVE = "Active" DISABLED = "Disabled" @@ -57,92 +58,96 @@ class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENAMING = "Renaming" UNKNOWN = "Unknown" + class FilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Rule filter types - """ + """Rule filter types.""" SQL_FILTER = "SqlFilter" CORRELATION_FILTER = "CorrelationFilter" + class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The access key to regenerate. - """ + """The access key to regenerate.""" PRIMARY_KEY = "PrimaryKey" SECONDARY_KEY = "SecondaryKey" + class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity. - """ + """Type of managed service identity.""" SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" + class MigrationConfigurationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationConfigurationName.""" _DEFAULT = "$default" + class NetworkRuleIPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP Filter Action - """ + """The IP Filter Action.""" ALLOW = "Allow" + class PrivateLinkConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the connection. - """ + """Status of the connection.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ProvisioningStateDR(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' - or 'Succeeded' or 'Failed' + or 'Succeeded' or 'Failed'. """ ACCEPTED = "Accepted" SUCCEEDED = "Succeeded" FAILED = "Failed" + class PublicNetworkAccessFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This determines if traffic is allowed over public network. By default it is enabled. - """ + """This determines if traffic is allowed over public network. By default it is enabled.""" ENABLED = "Enabled" DISABLED = "Disabled" + class RoleDisasterRecovery(str, Enum, metaclass=CaseInsensitiveEnumMeta): """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or - 'Secondary' + 'Secondary'. """ PRIMARY = "Primary" PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" SECONDARY = "Secondary" + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of this SKU. - """ + """Name of this SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The billing tier of this particular SKU. - """ + """The billing tier of this particular SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the reason for the unavailability of the service. - """ + """Specifies the reason for the unavailability of the service.""" NONE = "None" INVALID_NAME = "InvalidName" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_disaster_recovery_configs_operations.py index b76be6f453d7..8825f6082b6a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_disaster_recovery_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,343 +27,313 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_check_name_availability_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.ArmDisasterRecovery] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_break_pairing_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_fail_over_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.FailoverProperties] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -370,34 +347,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -411,34 +391,38 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class DisasterRecoveryConfigsOperations: """ @@ -459,41 +443,109 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace + @overload def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -502,18 +554,18 @@ def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,74 +573,79 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -596,16 +653,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -616,49 +671,126 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -668,18 +800,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -689,67 +821,67 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -760,60 +892,60 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -821,68 +953,68 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -893,50 +1025,127 @@ def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - @distributed_trace + @overload def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -946,18 +1155,18 @@ def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -968,72 +1177,78 @@ def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1041,16 +1256,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1061,48 +1274,50 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1110,18 +1325,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1129,52 +1343,55 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1182,18 +1399,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1201,12 +1417,13 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_migration_configs_operations.py index 319439294e12..9ee0bbc7dbdf 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_migration_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,251 +29,257 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_and_start_migration_request_initial( +def build_create_and_start_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, - *, - json: Optional[_models.MigrationConfigProperties] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_complete_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_revert_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class MigrationConfigsOperations: """ @@ -287,65 +300,69 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,16 +370,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -373,35 +388,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -409,57 +435,146 @@ def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> LROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -472,114 +587,114 @@ def begin_create_and_start_migration( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_and_start_migration_initial( # type: ignore + raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -590,61 +705,65 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,70 +771,74 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,61 +849,65 @@ def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_06_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -791,5 +918,6 @@ def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_namespaces_operations.py index 8157c9b729a3..7db0ad4c81d8 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_namespaces_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,651 +29,593 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespace] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NetworkRuleSet] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_network_rule_sets_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class NamespacesOperations: """ @@ -687,55 +636,63 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -743,16 +700,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -763,65 +718,70 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -829,16 +789,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -849,90 +807,107 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -945,121 +920,193 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1071,103 +1118,101 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1175,51 +1220,124 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1228,18 +1346,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1249,53 +1367,123 @@ def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -1304,18 +1492,18 @@ def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1323,63 +1511,64 @@ def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1387,74 +1576,79 @@ def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1462,16 +1656,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1482,70 +1674,77 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1553,16 +1752,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1573,49 +1770,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -1625,18 +1906,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1644,67 +1925,70 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1715,60 +1999,63 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1776,67 +2063,70 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1844,54 +2134,140 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1901,18 +2277,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1920,62 +2296,110 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1983,12 +2407,13 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_operations.py index 638354888069..c2aa9e48d981 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +27,40 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class Operations: """ @@ -72,52 +81,59 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,16 +141,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,8 +159,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py index 4ed15ed51fa4..a9d555772ad0 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,134 +29,140 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, namespace_name: str, - subscription_id: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -162,33 +175,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateEndpointConnectionsOperations: """ @@ -209,65 +226,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -275,16 +299,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,71 +317,157 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -368,83 +476,84 @@ def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -456,108 +565,107 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,12 +673,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_link_resources_operations.py index 572b3efe134c..89f8aed809a8 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_private_link_resources_operations.py @@ -6,11 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +25,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateLinkResourcesOperations: """ @@ -81,54 +93,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,12 +150,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_queues_operations.py index a25f0af9205b..bbc8d6de5490 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_queues_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -126,34 +135,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -167,34 +179,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - *, - json: Optional[_models.SBQueue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class QueuesOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,119 @@ def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +708,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +727,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -661,31 +749,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +788,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -715,8 +809,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -729,31 +824,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -761,18 +863,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,15 +881,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +903,38 @@ def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +942,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +960,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +979,130 @@ def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1113,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1132,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1151,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBQueueListResult]: + ) -> Iterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1169,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1228,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1246,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1382,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1401,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1475,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> _models.SBQueue: + def get(self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1537,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_rules_operations.py index c468fa9d4ef7..e2240c0bbe2d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_rules_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_subscriptions_request( resource_group_name: str, namespace_name: str, @@ -41,38 +55,39 @@ def build_list_by_subscriptions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -82,48 +97,44 @@ def build_create_or_update_request( subscription_name: str, rule_name: str, subscription_id: str, - *, - json: Optional[_models.Rule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -138,35 +149,36 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -181,35 +193,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class RulesOperations: """ @@ -230,7 +244,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -241,16 +254,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.RuleListResult]: + ) -> Iterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -260,57 +273,60 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -318,16 +334,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -338,13 +352,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -353,40 +367,127 @@ def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -398,18 +499,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -417,15 +518,16 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -439,33 +541,37 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -474,18 +580,17 @@ def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -496,8 +601,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def get( @@ -511,33 +617,37 @@ def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -546,18 +656,17 @@ def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,12 +674,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_subscriptions_operations.py index 239045d04608..6e785ef19f71 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_subscriptions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_topic_request( resource_group_name: str, namespace_name: str, @@ -40,37 +54,38 @@ def build_list_by_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -79,47 +94,43 @@ def build_create_or_update_request( topic_name: str, subscription_name: str, subscription_id: str, - *, - json: Optional[_models.SBSubscription] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -133,34 +144,35 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -174,34 +186,36 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class SubscriptionsOperations: """ @@ -222,7 +236,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -232,14 +245,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBSubscriptionListResult]: + ) -> Iterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -249,56 +265,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -306,16 +326,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -326,13 +344,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -340,38 +358,128 @@ def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -382,18 +490,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,52 +509,55 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -454,18 +565,17 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -476,45 +586,48 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -522,18 +635,17 @@ def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,12 +653,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_topics_operations.py index ff59f799cffb..3cf9713205af 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_06_01_preview/operations/_topics_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -126,34 +135,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -167,34 +179,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - *, - json: Optional[_models.SBTopic] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class TopicsOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,128 @@ def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +717,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +736,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -661,31 +758,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +797,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,15 +815,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -733,31 +837,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -765,18 +876,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -787,8 +897,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +912,38 @@ def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +951,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +969,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +988,130 @@ def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2021_06_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1122,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1141,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1160,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBTopicListResult]: + ) -> Iterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1178,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1237,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1255,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1391,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1410,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1484,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> _models.SBTopic: + def get(self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_06_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1546,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/__init__.py index 221541a00fb6..2e171d69863b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_configuration.py index ab694134b482..fe6357ea4314 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-01") # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", "2021-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,23 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_metadata.json index 50b90d818445..e3bfd560eb07 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_metadata.json +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -108,4 +116,4 @@ "rules": "RulesOperations", "subscriptions": "SubscriptionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_service_bus_management_client.py index c02b067a6f3b..253d7aee5d4b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -49,10 +60,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :vartype rules: azure.mgmt.servicebus.v2021_11_01.operations.RulesOperations :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2021_11_01.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -70,50 +81,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -122,7 +118,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -135,15 +131,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient + def __enter__(self) -> "ServiceBusManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_vendor.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/__init__.py index e7dd87df1f93..530b8638dfd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_configuration.py index b2b6c2baf561..094169594ff1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-01") # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", "2021-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,22 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_service_bus_management_client.py index ec9ebf8c6e76..f5b6dbedc08a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -50,10 +61,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2021_11_01.aio.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,50 +82,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -123,7 +119,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -143,5 +139,5 @@ async def __aenter__(self) -> "ServiceBusManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py index 1b72791221cd..7005f68a75e1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._disaster_recovery_configs_operations import build_break_pairing_request, build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_fail_over_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request -T = TypeVar('T') +from ...operations._disaster_recovery_configs_operations import ( + build_break_pairing_request, + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_fail_over_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class DisasterRecoveryConfigsOperations: """ .. warning:: @@ -43,65 +69,66 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -109,16 +136,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -129,49 +154,124 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -181,18 +281,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -202,67 +302,65 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -273,60 +371,58 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,68 +430,66 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -406,50 +500,125 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - - @distributed_trace_async + @overload async def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -459,18 +628,18 @@ async def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -481,72 +650,76 @@ async def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -554,16 +727,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -574,48 +745,48 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -623,18 +794,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -642,52 +812,53 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -695,18 +866,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -714,50 +884,118 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -766,18 +1004,18 @@ async def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -785,12 +1023,13 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_migration_configs_operations.py index 10db2092c99f..1194fcf2b439 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_migration_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,23 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._migration_configs_operations import build_complete_migration_request, build_create_and_start_migration_request_initial, build_delete_request, build_get_request, build_list_request, build_revert_request -T = TypeVar('T') +from ...operations._migration_configs_operations import ( + build_complete_migration_request, + build_create_and_start_migration_request, + build_delete_request, + build_get_request, + build_list_request, + build_revert_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MigrationConfigsOperations: """ .. warning:: @@ -45,65 +67,67 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +135,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,35 +153,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } async def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'MigrationConfigProperties') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") - request = build_create_and_start_migration_request_initial( + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -167,56 +198,142 @@ async def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } - - @distributed_trace_async + @overload async def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -229,113 +346,109 @@ async def begin_create_and_start_migration( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_and_start_migration_initial( # type: ignore + raw_result = await self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -346,60 +459,62 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,69 +522,71 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -480,60 +597,62 @@ async def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace_async async def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -544,5 +663,6 @@ async def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_namespaces_operations.py index e50611106812..01082caffec6 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_namespaces_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._namespaces_operations import build_check_name_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_network_rule_set_request, build_create_or_update_request_initial, build_delete_authorization_rule_request, build_delete_request_initial, build_get_authorization_rule_request, build_get_network_rule_set_request, build_get_request, build_list_authorization_rules_request, build_list_by_resource_group_request, build_list_keys_request, build_list_network_rule_sets_request, build_list_request, build_regenerate_keys_request, build_update_request -T = TypeVar('T') +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_network_rule_set_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_network_rule_set_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_keys_request, + build_list_network_rule_sets_request, + build_list_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class NamespacesOperations: """ .. warning:: @@ -45,55 +77,61 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -101,16 +139,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -121,65 +157,68 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -187,16 +226,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,90 +244,180 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } async def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespace') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -303,121 +430,114 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -429,103 +549,97 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -533,51 +647,121 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -586,18 +770,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -607,53 +791,121 @@ async def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -662,18 +914,18 @@ async def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,63 +933,62 @@ async def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace_async async def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -745,74 +996,77 @@ async def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -820,16 +1074,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -840,70 +1092,75 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -911,16 +1168,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -931,49 +1186,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -983,18 +1320,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1002,67 +1339,68 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1073,60 +1411,61 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1134,67 +1473,68 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1202,53 +1542,136 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1258,18 +1681,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1277,62 +1700,108 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1340,12 +1809,13 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_operations.py index fdc33b7967a6..b9e1b3d10492 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,52 +57,57 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -95,16 +115,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,8 +133,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py index df8a2914a8d2..a320df25edb9 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -45,65 +65,70 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +136,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,71 +154,154 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -204,86 +310,85 @@ async def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -295,108 +400,103 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -404,12 +504,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_link_resources_operations.py index ad4b657278b9..93fbc191948b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_private_link_resources_operations.py @@ -6,9 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +27,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,54 +55,54 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,12 +110,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_queues_operations.py index 483fd0d85122..311f9d25742c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_queues_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queues_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class QueuesOperations: """ .. warning:: @@ -43,70 +69,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +142,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +160,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +174,117 @@ async def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +295,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +314,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -230,31 +336,36 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +373,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -284,8 +394,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -298,31 +409,36 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -330,18 +446,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,15 +464,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +486,36 @@ async def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +523,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +541,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,38 +560,126 @@ async def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -481,18 +690,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -500,15 +709,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -518,12 +728,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBQueueListResult]: + ) -> AsyncIterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -533,53 +746,57 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :return: An iterator like instance of either SBQueue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -587,16 +804,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -607,49 +822,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -659,18 +956,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -678,67 +975,68 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -749,60 +1047,61 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -810,12 +1109,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_rules_operations.py index a0a5ee36616d..1b57f46d0947 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_rules_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscriptions_request -T = TypeVar('T') +from ...operations._rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscriptions_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RulesOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -54,16 +73,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.RuleListResult]: + ) -> AsyncIterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -73,57 +92,58 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,16 +151,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,13 +169,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -166,40 +184,125 @@ async def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -211,18 +314,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,15 +333,16 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -252,33 +356,35 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -287,18 +393,17 @@ async def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -309,8 +414,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def get( @@ -324,33 +430,35 @@ async def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -359,18 +467,17 @@ async def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,12 +485,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_subscriptions_operations.py index 608bc9c2ced5..d12d9c48200b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_subscriptions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_topic_request -T = TypeVar('T') +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_topic_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SubscriptionsOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -53,14 +72,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBSubscriptionListResult]: + ) -> AsyncIterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -70,56 +92,58 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,16 +151,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,13 +169,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -161,38 +183,126 @@ async def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -203,18 +313,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -222,52 +332,53 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -275,18 +386,17 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -297,45 +407,46 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -343,18 +454,17 @@ async def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -362,12 +472,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_topics_operations.py index 5bc983be15ea..0db3c137bb47 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/aio/operations/_topics_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._topics_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopicsOperations: """ .. warning:: @@ -43,70 +69,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +142,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +160,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +174,126 @@ async def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +304,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +323,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -230,31 +345,36 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +382,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,15 +400,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -302,31 +422,36 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -334,18 +459,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -356,8 +480,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +495,36 @@ async def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +532,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +550,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,38 +569,126 @@ async def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -481,18 +699,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -500,15 +718,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -518,12 +737,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBTopicListResult]: + ) -> AsyncIterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -533,53 +755,57 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :return: An iterator like instance of either SBTopic or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -587,16 +813,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -607,49 +831,131 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -659,18 +965,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -678,67 +984,68 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -749,60 +1056,61 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -810,12 +1118,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/__init__.py index 078e68dd0be7..86173dc24c8d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/__init__.py @@ -63,103 +63,101 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserAssignedIdentityProperties - -from ._service_bus_management_client_enums import ( - AccessRights, - CreatedByType, - DefaultAction, - EndPointProvisioningState, - EntityStatus, - FilterType, - KeyType, - ManagedServiceIdentityType, - MigrationConfigurationName, - NetworkRuleIPAction, - PrivateLinkConnectionStatus, - ProvisioningStateDR, - PublicNetworkAccessFlag, - RoleDisasterRecovery, - SkuName, - SkuTier, - UnavailableReason, -) +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import CreatedByType +from ._service_bus_management_client_enums import DefaultAction +from ._service_bus_management_client_enums import EndPointProvisioningState +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import FilterType +from ._service_bus_management_client_enums import KeyType +from ._service_bus_management_client_enums import ManagedServiceIdentityType +from ._service_bus_management_client_enums import MigrationConfigurationName +from ._service_bus_management_client_enums import NetworkRuleIPAction +from ._service_bus_management_client_enums import PrivateLinkConnectionStatus +from ._service_bus_management_client_enums import ProvisioningStateDR +from ._service_bus_management_client_enums import PublicNetworkAccessFlag +from ._service_bus_management_client_enums import RoleDisasterRecovery +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import UnavailableReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccessKeys', - 'Action', - 'ArmDisasterRecovery', - 'ArmDisasterRecoveryListResult', - 'CheckNameAvailability', - 'CheckNameAvailabilityResult', - 'ConnectionState', - 'CorrelationFilter', - 'Encryption', - 'ErrorAdditionalInfo', - 'ErrorResponse', - 'ErrorResponseError', - 'FailoverProperties', - 'Identity', - 'KeyVaultProperties', - 'MessageCountDetails', - 'MigrationConfigListResult', - 'MigrationConfigProperties', - 'NWRuleSetIpRules', - 'NWRuleSetVirtualNetworkRules', - 'NetworkRuleSet', - 'NetworkRuleSetListResult', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'ProxyResource', - 'RegenerateAccessKeyParameters', - 'Resource', - 'ResourceNamespacePatch', - 'Rule', - 'RuleListResult', - 'SBAuthorizationRule', - 'SBAuthorizationRuleListResult', - 'SBClientAffineProperties', - 'SBNamespace', - 'SBNamespaceListResult', - 'SBNamespaceUpdateParameters', - 'SBQueue', - 'SBQueueListResult', - 'SBSku', - 'SBSubscription', - 'SBSubscriptionListResult', - 'SBTopic', - 'SBTopicListResult', - 'SqlFilter', - 'SqlRuleAction', - 'Subnet', - 'SystemData', - 'TrackedResource', - 'UserAssignedIdentity', - 'UserAssignedIdentityProperties', - 'AccessRights', - 'CreatedByType', - 'DefaultAction', - 'EndPointProvisioningState', - 'EntityStatus', - 'FilterType', - 'KeyType', - 'ManagedServiceIdentityType', - 'MigrationConfigurationName', - 'NetworkRuleIPAction', - 'PrivateLinkConnectionStatus', - 'ProvisioningStateDR', - 'PublicNetworkAccessFlag', - 'RoleDisasterRecovery', - 'SkuName', - 'SkuTier', - 'UnavailableReason', + "AccessKeys", + "Action", + "ArmDisasterRecovery", + "ArmDisasterRecoveryListResult", + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "ConnectionState", + "CorrelationFilter", + "Encryption", + "ErrorAdditionalInfo", + "ErrorResponse", + "ErrorResponseError", + "FailoverProperties", + "Identity", + "KeyVaultProperties", + "MessageCountDetails", + "MigrationConfigListResult", + "MigrationConfigProperties", + "NWRuleSetIpRules", + "NWRuleSetVirtualNetworkRules", + "NetworkRuleSet", + "NetworkRuleSetListResult", + "Operation", + "OperationDisplay", + "OperationListResult", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "ProxyResource", + "RegenerateAccessKeyParameters", + "Resource", + "ResourceNamespacePatch", + "Rule", + "RuleListResult", + "SBAuthorizationRule", + "SBAuthorizationRuleListResult", + "SBClientAffineProperties", + "SBNamespace", + "SBNamespaceListResult", + "SBNamespaceUpdateParameters", + "SBQueue", + "SBQueueListResult", + "SBSku", + "SBSubscription", + "SBSubscriptionListResult", + "SBTopic", + "SBTopicListResult", + "SqlFilter", + "SqlRuleAction", + "Subnet", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "UserAssignedIdentityProperties", + "AccessRights", + "CreatedByType", + "DefaultAction", + "EndPointProvisioningState", + "EntityStatus", + "FilterType", + "KeyType", + "ManagedServiceIdentityType", + "MigrationConfigurationName", + "NetworkRuleIPAction", + "PrivateLinkConnectionStatus", + "ProvisioningStateDR", + "PublicNetworkAccessFlag", + "RoleDisasterRecovery", + "SkuName", + "SkuTier", + "UnavailableReason", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_models_py3.py index 9149f29eb3f1..063b6569086b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,27 @@ # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -class AccessKeys(msrest.serialization.Model): +class AccessKeys(_serialization.Model): """Namespace/ServiceBus Connection String. Variables are only populated by the server, and will be ignored when sending a request. @@ -45,32 +56,28 @@ class AccessKeys(msrest.serialization.Model): """ _validation = { - 'primary_connection_string': {'readonly': True}, - 'secondary_connection_string': {'readonly': True}, - 'alias_primary_connection_string': {'readonly': True}, - 'alias_secondary_connection_string': {'readonly': True}, - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - 'key_name': {'readonly': True}, + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + "alias_primary_connection_string": {"readonly": True}, + "alias_secondary_connection_string": {"readonly": True}, + "primary_key": {"readonly": True}, + "secondary_key": {"readonly": True}, + "key_name": {"readonly": True}, } _attribute_map = { - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, - 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AccessKeys, self).__init__(**kwargs) + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "alias_primary_connection_string": {"key": "aliasPrimaryConnectionString", "type": "str"}, + "alias_secondary_connection_string": {"key": "aliasSecondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.primary_connection_string = None self.secondary_connection_string = None self.alias_primary_connection_string = None @@ -80,8 +87,9 @@ def __init__( self.key_name = None -class Action(msrest.serialization.Model): - """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. +class Action(_serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have + been matched by a filter expression. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -94,9 +102,9 @@ class Action(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -104,9 +112,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -117,13 +125,13 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing -class ProxyResource(msrest.serialization.Model): +class ProxyResource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. @@ -141,26 +149,22 @@ class ProxyResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ProxyResource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -186,11 +190,11 @@ class ArmDisasterRecovery(ProxyResource): :vartype system_data: ~azure.mgmt.servicebus.v2021_11_01.models.SystemData :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Known values are: "Accepted", - "Succeeded", "Failed". + "Succeeded", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2021_11_01.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. :vartype partner_namespace: str @@ -198,41 +202,37 @@ class ArmDisasterRecovery(ProxyResource): pairing. :vartype alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' - or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", "Secondary". + or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", and "Secondary". :vartype role: str or ~azure.mgmt.servicebus.v2021_11_01.models.RoleDisasterRecovery """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'role': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "role": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "partner_namespace": {"key": "properties.partnerNamespace", "type": "str"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "role": {"key": "properties.role", "type": "str"}, } def __init__( - self, - *, - partner_namespace: Optional[str] = None, - alternate_name: Optional[str] = None, - **kwargs - ): + self, *, partner_namespace: Optional[str] = None, alternate_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. @@ -241,7 +241,7 @@ def __init__( pairing. :paramtype alternate_name: str """ - super(ArmDisasterRecovery, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -250,7 +250,7 @@ def __init__( self.role = None -class ArmDisasterRecoveryListResult(msrest.serialization.Model): +class ArmDisasterRecoveryListResult(_serialization.Model): """The result of the List Alias(Disaster Recovery configuration) operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -263,65 +263,55 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ArmDisasterRecovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ArmDisasterRecovery"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ArmDisasterRecovery"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Alias(Disaster Recovery configurations). :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery] """ - super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CheckNameAvailability(msrest.serialization.Model): +class CheckNameAvailability(_serialization.Model): """Description of a Check Name availability request properties. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The Name to check the namespace name availability and The namespace name - can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it - must end with a letter or number. + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The Name to check the namespace name availability and The namespace - name can contain only letters, numbers, and hyphens. The namespace must start with a letter, - and it must end with a letter or number. + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :paramtype name: str """ - super(CheckNameAvailability, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(msrest.serialization.Model): +class CheckNameAvailabilityResult(_serialization.Model): """Description of a Check Name availability request properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -332,19 +322,19 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): available; otherwise, false. :vartype name_available: bool :ivar reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :vartype reason: str or ~azure.mgmt.servicebus.v2021_11_01.models.UnavailableReason """ _validation = { - 'message': {'readonly': True}, + "message": {"readonly": True}, } _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "message": {"key": "message", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, } def __init__( @@ -352,36 +342,36 @@ def __init__( *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.UnavailableReason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Value indicating namespace is availability, true if the namespace is available; otherwise, false. :paramtype name_available: bool :keyword reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :paramtype reason: str or ~azure.mgmt.servicebus.v2021_11_01.models.UnavailableReason """ - super(CheckNameAvailabilityResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.message = None self.name_available = name_available self.reason = reason -class ConnectionState(msrest.serialization.Model): +class ConnectionState(_serialization.Model): """ConnectionState information. :ivar status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :vartype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.PrivateLinkConnectionStatus :ivar description: Description of the connection state. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -389,21 +379,21 @@ def __init__( *, status: Optional[Union[str, "_models.PrivateLinkConnectionStatus"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :paramtype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.PrivateLinkConnectionStatus :keyword description: Description of the connection state. :paramtype description: str """ - super(ConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class CorrelationFilter(msrest.serialization.Model): +class CorrelationFilter(_serialization.Model): """Represents the correlation filter expression. :ivar properties: dictionary object for custom filters. @@ -430,16 +420,16 @@ class CorrelationFilter(msrest.serialization.Model): """ _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'message_id': {'key': 'messageId', 'type': 'str'}, - 'to': {'key': 'to', 'type': 'str'}, - 'reply_to': {'key': 'replyTo', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "properties": {"key": "properties", "type": "{str}"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "message_id": {"key": "messageId", "type": "str"}, + "to": {"key": "to", "type": "str"}, + "reply_to": {"key": "replyTo", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "session_id": {"key": "sessionId", "type": "str"}, + "reply_to_session_id": {"key": "replyToSessionId", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -454,9 +444,9 @@ def __init__( session_id: Optional[str] = None, reply_to_session_id: Optional[str] = None, content_type: Optional[str] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword properties: dictionary object for custom filters. :paramtype properties: dict[str, str] @@ -480,7 +470,7 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(CorrelationFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties self.correlation_id = correlation_id self.message_id = message_id @@ -493,14 +483,13 @@ def __init__( self.requires_preprocessing = requires_preprocessing -class Encryption(msrest.serialization.Model): +class Encryption(_serialization.Model): """Properties to configure Encryption. :ivar key_vault_properties: Properties of KeyVault. :vartype key_vault_properties: list[~azure.mgmt.servicebus.v2021_11_01.models.KeyVaultProperties] - :ivar key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value is "Microsoft.KeyVault". :vartype key_source: str :ivar require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). @@ -508,38 +497,37 @@ class Encryption(msrest.serialization.Model): """ _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "[KeyVaultProperties]"}, + "key_source": {"key": "keySource", "type": "str"}, + "require_infrastructure_encryption": {"key": "requireInfrastructureEncryption", "type": "bool"}, } def __init__( self, *, key_vault_properties: Optional[List["_models.KeyVaultProperties"]] = None, - key_source: Optional[str] = "Microsoft.KeyVault", + key_source: Literal["Microsoft.KeyVault"] = "Microsoft.KeyVault", require_infrastructure_encryption: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Properties of KeyVault. :paramtype key_vault_properties: list[~azure.mgmt.servicebus.v2021_11_01.models.KeyVaultProperties] - :keyword key_source: Enumerates the possible value of keySource for Encryption. The only - acceptable values to pass in are None and "Microsoft.KeyVault". The default value is - "Microsoft.KeyVault". + :keyword key_source: Enumerates the possible value of keySource for Encryption. Default value + is "Microsoft.KeyVault". :paramtype key_source: str :keyword require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). :paramtype require_infrastructure_encryption: bool """ - super(Encryption, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_vault_properties = key_vault_properties self.key_source = key_source self.require_infrastructure_encryption = require_infrastructure_encryption -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -547,31 +535,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -579,24 +563,19 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + "error": {"key": "error", "type": "ErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicebus.v2021_11_01.models.ErrorResponseError """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ErrorResponseError(msrest.serialization.Model): +class ErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -614,28 +593,24 @@ class ErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -643,8 +618,9 @@ def __init__( self.additional_info = None -class FailoverProperties(msrest.serialization.Model): - """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. +class FailoverProperties(_serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before + switching to the secondary. :ivar is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. @@ -652,25 +628,20 @@ class FailoverProperties(msrest.serialization.Model): """ _attribute_map = { - 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + "is_safe_failover": {"key": "properties.IsSafeFailover", "type": "bool"}, } - def __init__( - self, - *, - is_safe_failover: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, is_safe_failover: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. :paramtype is_safe_failover: bool """ - super(FailoverProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_safe_failover = is_safe_failover -class Identity(msrest.serialization.Model): +class Identity(_serialization.Model): """Properties to configure User Assigned Identities for Bring your Own Keys. Variables are only populated by the server, and will be ignored when sending a request. @@ -680,7 +651,7 @@ class Identity(msrest.serialization.Model): :ivar tenant_id: TenantId from the KeyVault. :vartype tenant_id: str :ivar type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :vartype type: str or ~azure.mgmt.servicebus.v2021_11_01.models.ManagedServiceIdentityType :ivar user_assigned_identities: Properties for User Assigned Identities. :vartype user_assigned_identities: dict[str, @@ -688,15 +659,15 @@ class Identity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } def __init__( @@ -704,24 +675,24 @@ def __init__( *, type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.servicebus.v2021_11_01.models.ManagedServiceIdentityType :keyword user_assigned_identities: Properties for User Assigned Identities. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.servicebus.v2021_11_01.models.UserAssignedIdentity] """ - super(Identity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class KeyVaultProperties(msrest.serialization.Model): +class KeyVaultProperties(_serialization.Model): """Properties to configure keyVault Properties. :ivar key_name: Name of the Key from KeyVault. @@ -735,10 +706,10 @@ class KeyVaultProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + "key_name": {"key": "keyName", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "key_version": {"key": "keyVersion", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentityProperties"}, } def __init__( @@ -748,8 +719,8 @@ def __init__( key_vault_uri: Optional[str] = None, key_version: Optional[str] = None, identity: Optional["_models.UserAssignedIdentityProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: Name of the Key from KeyVault. :paramtype key_name: str @@ -760,54 +731,50 @@ def __init__( :keyword identity: :paramtype identity: ~azure.mgmt.servicebus.v2021_11_01.models.UserAssignedIdentityProperties """ - super(KeyVaultProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name self.key_vault_uri = key_vault_uri self.key_version = key_version self.identity = identity -class MessageCountDetails(msrest.serialization.Model): +class MessageCountDetails(_serialization.Model): """Message Count Details. Variables are only populated by the server, and will be ignored when sending a request. :ivar active_message_count: Number of active messages in the queue, topic, or subscription. - :vartype active_message_count: long + :vartype active_message_count: int :ivar dead_letter_message_count: Number of messages that are dead lettered. - :vartype dead_letter_message_count: long + :vartype dead_letter_message_count: int :ivar scheduled_message_count: Number of scheduled messages. - :vartype scheduled_message_count: long + :vartype scheduled_message_count: int :ivar transfer_message_count: Number of messages transferred to another queue, topic, or subscription. - :vartype transfer_message_count: long + :vartype transfer_message_count: int :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. - :vartype transfer_dead_letter_message_count: long + :vartype transfer_dead_letter_message_count: int """ _validation = { - 'active_message_count': {'readonly': True}, - 'dead_letter_message_count': {'readonly': True}, - 'scheduled_message_count': {'readonly': True}, - 'transfer_message_count': {'readonly': True}, - 'transfer_dead_letter_message_count': {'readonly': True}, + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, } _attribute_map = { - 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, - 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, - 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, - 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, - 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MessageCountDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.active_message_count = None self.dead_letter_message_count = None self.scheduled_message_count = None @@ -815,7 +782,7 @@ def __init__( self.transfer_dead_letter_message_count = None -class MigrationConfigListResult(msrest.serialization.Model): +class MigrationConfigListResult(_serialization.Model): """The result of the List migrationConfigurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -828,25 +795,20 @@ class MigrationConfigListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationConfigProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MigrationConfigProperties"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MigrationConfigProperties"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Migration Configs. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] """ - super(MigrationConfigListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None @@ -871,7 +833,7 @@ class MigrationConfigProperties(ProxyResource): :ivar provisioning_state: Provisioning state of Migration Configuration. :vartype provisioning_state: str :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. :vartype target_namespace: str @@ -883,36 +845,32 @@ class MigrationConfigProperties(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'migration_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "migration_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, - 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, - 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "target_namespace": {"key": "properties.targetNamespace", "type": "str"}, + "post_migration_name": {"key": "properties.postMigrationName", "type": "str"}, + "migration_state": {"key": "properties.migrationState", "type": "str"}, } def __init__( - self, - *, - target_namespace: Optional[str] = None, - post_migration_name: Optional[str] = None, - **kwargs - ): + self, *, target_namespace: Optional[str] = None, post_migration_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. @@ -920,7 +878,7 @@ def __init__( :keyword post_migration_name: Name to access Standard Namespace after migration. :paramtype post_migration_name: str """ - super(MigrationConfigProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -949,7 +907,8 @@ class NetworkRuleSet(ProxyResource): :ivar trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. :vartype trusted_service_access_enabled: bool - :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow", "Deny". + :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". :vartype default_action: str or ~azure.mgmt.servicebus.v2021_11_01.models.DefaultAction :ivar virtual_network_rules: List VirtualNetwork Rules. :vartype virtual_network_rules: @@ -957,30 +916,30 @@ class NetworkRuleSet(ProxyResource): :ivar ip_rules: List of IpRules. :vartype ip_rules: list[~azure.mgmt.servicebus.v2021_11_01.models.NWRuleSetIpRules] :ivar public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled". Default value: "Enabled". + default it is enabled. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.servicebus.v2021_11_01.models.PublicNetworkAccessFlag """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'trusted_service_access_enabled': {'key': 'properties.trustedServiceAccessEnabled', 'type': 'bool'}, - 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "trusted_service_access_enabled": {"key": "properties.trustedServiceAccessEnabled", "type": "bool"}, + "default_action": {"key": "properties.defaultAction", "type": "str"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[NWRuleSetVirtualNetworkRules]"}, + "ip_rules": {"key": "properties.ipRules", "type": "[NWRuleSetIpRules]"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, } def __init__( @@ -990,14 +949,14 @@ def __init__( default_action: Optional[Union[str, "_models.DefaultAction"]] = None, virtual_network_rules: Optional[List["_models.NWRuleSetVirtualNetworkRules"]] = None, ip_rules: Optional[List["_models.NWRuleSetIpRules"]] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccessFlag"]] = "Enabled", - **kwargs - ): + public_network_access: Union[str, "_models.PublicNetworkAccessFlag"] = "Enabled", + **kwargs: Any + ) -> None: """ :keyword trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. :paramtype trusted_service_access_enabled: bool - :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow", + :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow" and "Deny". :paramtype default_action: str or ~azure.mgmt.servicebus.v2021_11_01.models.DefaultAction :keyword virtual_network_rules: List VirtualNetwork Rules. @@ -1006,11 +965,11 @@ def __init__( :keyword ip_rules: List of IpRules. :paramtype ip_rules: list[~azure.mgmt.servicebus.v2021_11_01.models.NWRuleSetIpRules] :keyword public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled". Default value: "Enabled". + default it is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.servicebus.v2021_11_01.models.PublicNetworkAccessFlag """ - super(NetworkRuleSet, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.trusted_service_access_enabled = trusted_service_access_enabled self.default_action = default_action @@ -1019,7 +978,7 @@ def __init__( self.public_network_access = public_network_access -class NetworkRuleSetListResult(msrest.serialization.Model): +class NetworkRuleSetListResult(_serialization.Model): """The response of the List NetworkRuleSet operation. :ivar value: Result of the List NetworkRuleSet operation. @@ -1030,17 +989,13 @@ class NetworkRuleSetListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NetworkRuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.NetworkRuleSet"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.NetworkRuleSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List NetworkRuleSet operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet] @@ -1048,44 +1003,44 @@ def __init__( list of NetworkRuleSet. :paramtype next_link: str """ - super(NetworkRuleSetListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class NWRuleSetIpRules(msrest.serialization.Model): +class NWRuleSetIpRules(_serialization.Model): """Description of NetWorkRuleSet - IpRules resource. :ivar ip_mask: IP Mask. :vartype ip_mask: str - :ivar action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :ivar action: The IP Filter Action. "Allow" :vartype action: str or ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleIPAction """ _attribute_map = { - 'ip_mask': {'key': 'ipMask', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, + "ip_mask": {"key": "ipMask", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "_models.NetworkRuleIPAction"]] = "Allow", - **kwargs - ): + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword ip_mask: IP Mask. :paramtype ip_mask: str - :keyword action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :keyword action: The IP Filter Action. "Allow" :paramtype action: str or ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleIPAction """ - super(NWRuleSetIpRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_mask = ip_mask self.action = action -class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): +class NWRuleSetVirtualNetworkRules(_serialization.Model): """Description of VirtualNetworkRules - NetworkRules resource. :ivar subnet: Subnet properties. @@ -1096,8 +1051,8 @@ class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): """ _attribute_map = { - 'subnet': {'key': 'subnet', 'type': 'Subnet'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + "subnet": {"key": "subnet", "type": "Subnet"}, + "ignore_missing_vnet_service_endpoint": {"key": "ignoreMissingVnetServiceEndpoint", "type": "bool"}, } def __init__( @@ -1105,8 +1060,8 @@ def __init__( *, subnet: Optional["_models.Subnet"] = None, ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet: Subnet properties. :paramtype subnet: ~azure.mgmt.servicebus.v2021_11_01.models.Subnet @@ -1114,12 +1069,12 @@ def __init__( VNet Service Endpoint. :paramtype ignore_missing_vnet_service_endpoint: bool """ - super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.subnet = subnet self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """A Service Bus REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1133,19 +1088,19 @@ class Operation(msrest.serialization.Model): :ivar origin: Origin of the operation. :vartype origin: str :ivar properties: Properties of the operation. - :vartype properties: any + :vartype properties: JSON """ _validation = { - 'name': {'readonly': True}, + "name": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, } def __init__( @@ -1154,9 +1109,9 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - properties: Optional[Any] = None, - **kwargs - ): + properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: """ :keyword is_data_action: Indicates whether the operation is a data action. :paramtype is_data_action: bool @@ -1165,9 +1120,9 @@ def __init__( :keyword origin: Origin of the operation. :paramtype origin: str :keyword properties: Properties of the operation. - :paramtype properties: any + :paramtype properties: JSON """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.is_data_action = is_data_action self.display = display @@ -1175,7 +1130,7 @@ def __init__( self.properties = properties -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """Operation display payload. Variables are only populated by the server, and will be ignored when sending a request. @@ -1191,34 +1146,31 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None self.description = None -class OperationListResult(msrest.serialization.Model): - """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1230,27 +1182,23 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """PrivateEndpoint information. :ivar id: The ARM identifier for Private Endpoint. @@ -1258,20 +1206,15 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The ARM identifier for Private Endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id @@ -1298,28 +1241,31 @@ class PrivateEndpointConnection(ProxyResource): :vartype private_link_service_connection_state: ~azure.mgmt.servicebus.v2021_11_01.models.ConnectionState :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Known values - are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2021_11_01.models.EndPointProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "ConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( @@ -1328,8 +1274,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.ConnectionState"] = None, provisioning_state: Optional[Union[str, "_models.EndPointProvisioningState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The Private Endpoint resource for this Connection. :paramtype private_endpoint: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpoint @@ -1337,18 +1283,18 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.servicebus.v2021_11_01.models.ConnectionState :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :paramtype provisioning_state: str or ~azure.mgmt.servicebus.v2021_11_01.models.EndPointProvisioningState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """Result of the list of all private endpoint connections operation. :ivar value: A collection of private endpoint connection resources. @@ -1358,8 +1304,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1367,20 +1313,20 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private endpoint connection resources. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection] :keyword next_link: A link for the next page of private endpoint connection resources. :paramtype next_link: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """Information of the private link resource. :ivar id: Fully qualified identifier of the resource. @@ -1398,25 +1344,25 @@ class PrivateLinkResource(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the resource. :paramtype id: str @@ -1431,7 +1377,7 @@ def __init__( :keyword required_zone_names: Required Zone Names. :paramtype required_zone_names: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -1440,7 +1386,7 @@ def __init__( self.required_zone_names = required_zone_names -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """Result of the List private link resources operation. :ivar value: A collection of private link resources. @@ -1450,8 +1396,8 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1459,25 +1405,26 @@ def __init__( *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private link resources. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.PrivateLinkResource] :keyword next_link: A link for the next page of private link resources. :paramtype next_link: str """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RegenerateAccessKeyParameters(msrest.serialization.Model): - """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. +class RegenerateAccessKeyParameters(_serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs + to be reset. All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :ivar key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :vartype key_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.KeyType :ivar key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key @@ -1486,35 +1433,29 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): """ _validation = { - 'key_type': {'required': True}, + "key_type": {"required": True}, } _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, + "key_type": {"key": "keyType", "type": "str"}, + "key": {"key": "key", "type": "str"}, } - def __init__( - self, - *, - key_type: Union[str, "_models.KeyType"], - key: Optional[str] = None, - **kwargs - ): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :keyword key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :paramtype key_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.KeyType :keyword key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :paramtype key: str """ - super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_type = key_type self.key = key -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource definition for other than namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -1528,24 +1469,20 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1564,38 +1501,32 @@ class ResourceNamespacePatch(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(ResourceNamespacePatch, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags @@ -1621,7 +1552,7 @@ class Rule(ProxyResource): message that have been matched by a filter expression. :vartype action: ~azure.mgmt.servicebus.v2021_11_01.models.Action :ivar filter_type: Filter type that is evaluated against a BrokeredMessage. Known values are: - "SqlFilter", "CorrelationFilter". + "SqlFilter" and "CorrelationFilter". :vartype filter_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.FilterType :ivar sql_filter: Properties of sqlFilter. :vartype sql_filter: ~azure.mgmt.servicebus.v2021_11_01.models.SqlFilter @@ -1630,23 +1561,23 @@ class Rule(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'action': {'key': 'properties.action', 'type': 'Action'}, - 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, - 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, - 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "action": {"key": "properties.action", "type": "Action"}, + "filter_type": {"key": "properties.filterType", "type": "str"}, + "sql_filter": {"key": "properties.sqlFilter", "type": "SqlFilter"}, + "correlation_filter": {"key": "properties.correlationFilter", "type": "CorrelationFilter"}, } def __init__( @@ -1656,21 +1587,21 @@ def __init__( filter_type: Optional[Union[str, "_models.FilterType"]] = None, sql_filter: Optional["_models.SqlFilter"] = None, correlation_filter: Optional["_models.CorrelationFilter"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. :paramtype action: ~azure.mgmt.servicebus.v2021_11_01.models.Action :keyword filter_type: Filter type that is evaluated against a BrokeredMessage. Known values - are: "SqlFilter", "CorrelationFilter". + are: "SqlFilter" and "CorrelationFilter". :paramtype filter_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.FilterType :keyword sql_filter: Properties of sqlFilter. :paramtype sql_filter: ~azure.mgmt.servicebus.v2021_11_01.models.SqlFilter :keyword correlation_filter: Properties of correlationFilter. :paramtype correlation_filter: ~azure.mgmt.servicebus.v2021_11_01.models.CorrelationFilter """ - super(Rule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.action = action self.filter_type = filter_type @@ -1678,7 +1609,7 @@ def __init__( self.correlation_filter = correlation_filter -class RuleListResult(msrest.serialization.Model): +class RuleListResult(_serialization.Model): """The response of the List rule operation. :ivar value: Result of the List Rules operation. @@ -1689,17 +1620,13 @@ class RuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.Rule"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Rule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.Rule] @@ -1707,7 +1634,7 @@ def __init__( list of rules. :paramtype next_link: str """ - super(RuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1734,38 +1661,33 @@ class SBAuthorizationRule(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } - def __init__( - self, - *, - rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + def __init__(self, *, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, **kwargs: Any) -> None: """ :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2021_11_01.models.AccessRights] """ - super(SBAuthorizationRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.rights = rights -class SBAuthorizationRuleListResult(msrest.serialization.Model): +class SBAuthorizationRuleListResult(_serialization.Model): """The response to the List Namespace operation. :ivar value: Result of the List Authorization Rules operation. @@ -1776,8 +1698,8 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBAuthorizationRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1785,8 +1707,8 @@ def __init__( *, value: Optional[List["_models.SBAuthorizationRule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Authorization Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] @@ -1794,12 +1716,12 @@ def __init__( list of Authorization Rules. :paramtype next_link: str """ - super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBClientAffineProperties(msrest.serialization.Model): +class SBClientAffineProperties(_serialization.Model): """Properties specific to client affine subscriptions. :ivar client_id: Indicates the Client ID of the application that created the client-affine @@ -1814,9 +1736,9 @@ class SBClientAffineProperties(msrest.serialization.Model): """ _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'is_durable': {'key': 'isDurable', 'type': 'bool'}, - 'is_shared': {'key': 'isShared', 'type': 'bool'}, + "client_id": {"key": "clientId", "type": "str"}, + "is_durable": {"key": "isDurable", "type": "bool"}, + "is_shared": {"key": "isShared", "type": "bool"}, } def __init__( @@ -1825,8 +1747,8 @@ def __init__( client_id: Optional[str] = None, is_durable: Optional[bool] = None, is_shared: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: Indicates the Client ID of the application that created the client-affine subscription. @@ -1838,7 +1760,7 @@ def __init__( subscription is shared or not. :paramtype is_shared: bool """ - super(SBClientAffineProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.is_durable = is_durable self.is_shared = is_shared @@ -1857,46 +1779,40 @@ class TrackedResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags -class SBNamespace(TrackedResource): +class SBNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1909,9 +1825,9 @@ class SBNamespace(TrackedResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2021_11_01.models.SBSku @@ -1947,39 +1863,42 @@ class SBNamespace(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, } def __init__( @@ -1994,12 +1913,12 @@ def __init__( private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, disable_local_auth: Optional[bool] = None, alternate_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2021_11_01.models.SBSku @@ -2019,7 +1938,7 @@ def __init__( :keyword alternate_name: Alternate name for namespace. :paramtype alternate_name: str """ - super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.system_data = None @@ -2036,7 +1955,7 @@ def __init__( self.alternate_name = alternate_name -class SBNamespaceListResult(msrest.serialization.Model): +class SBNamespaceListResult(_serialization.Model): """The response of the List Namespace operation. :ivar value: Result of the List Namespace operation. @@ -2047,17 +1966,13 @@ class SBNamespaceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBNamespace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBNamespace]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBNamespace"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBNamespace"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Namespace operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] @@ -2065,12 +1980,12 @@ def __init__( list of Namespaces. :paramtype next_link: str """ - super(SBNamespaceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBNamespaceUpdateParameters(ResourceNamespacePatch): +class SBNamespaceUpdateParameters(ResourceNamespacePatch): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2083,7 +1998,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2021_11_01.models.SBSku @@ -2114,35 +2029,38 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, } def __init__( @@ -2156,12 +2074,12 @@ def __init__( private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, disable_local_auth: Optional[bool] = None, alternate_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2021_11_01.models.SBSku @@ -2178,7 +2096,7 @@ def __init__( :keyword alternate_name: Alternate name for namespace. :paramtype alternate_name: str """ - super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.provisioning_state = None @@ -2193,7 +2111,7 @@ def __init__( self.alternate_name = alternate_name -class SBQueue(ProxyResource): +class SBQueue(ProxyResource): # pylint: disable=too-many-instance-attributes """Description of queue Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2220,9 +2138,9 @@ class SBQueue(ProxyResource): to this queue. :vartype accessed_at: ~datetime.datetime :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. @@ -2232,7 +2150,7 @@ class SBQueue(ProxyResource): :vartype max_size_in_megabytes: int :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. - :vartype max_message_size_in_kilobytes: long + :vartype max_message_size_in_kilobytes: int :ivar requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :vartype requires_duplicate_detection: bool @@ -2254,7 +2172,7 @@ class SBQueue(ProxyResource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2275,50 +2193,53 @@ class SBQueue(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'message_count': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "message_count": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'max_message_size_in_kilobytes': {'key': 'properties.maxMessageSizeInKilobytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2337,8 +2258,8 @@ def __init__( enable_express: Optional[bool] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 @@ -2349,7 +2270,7 @@ def __init__( :paramtype max_size_in_megabytes: int :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. - :paramtype max_message_size_in_kilobytes: long + :paramtype max_message_size_in_kilobytes: int :keyword requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -2371,7 +2292,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2391,7 +2312,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBQueue, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.count_details = None self.created_at = None @@ -2417,7 +2338,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBQueueListResult(msrest.serialization.Model): +class SBQueueListResult(_serialization.Model): """The response to the List Queues operation. :ivar value: Result of the List Queues operation. @@ -2428,17 +2349,13 @@ class SBQueueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBQueue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBQueue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBQueue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Queues operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.SBQueue] @@ -2446,19 +2363,19 @@ def __init__( list of queues. :paramtype next_link: str """ - super(SBQueueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBSku(msrest.serialization.Model): +class SBSku(_serialization.Model): """SKU of the namespace. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :ivar name: Name of this SKU. Required. Known values are: "Basic", "Standard", and "Premium". :vartype name: str or ~azure.mgmt.servicebus.v2021_11_01.models.SkuName - :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", + :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", and "Premium". :vartype tier: str or ~azure.mgmt.servicebus.v2021_11_01.models.SkuTier :ivar capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 @@ -2467,13 +2384,13 @@ class SBSku(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( @@ -2482,25 +2399,26 @@ def __init__( name: Union[str, "_models.SkuName"], tier: Optional[Union[str, "_models.SkuTier"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :keyword name: Name of this SKU. Required. Known values are: "Basic", "Standard", and + "Premium". :paramtype name: str or ~azure.mgmt.servicebus.v2021_11_01.models.SkuName :keyword tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", - "Premium". + and "Premium". :paramtype tier: str or ~azure.mgmt.servicebus.v2021_11_01.models.SkuTier :keyword capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :paramtype capacity: int """ - super(SBSku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SBSubscription(ProxyResource): +class SBSubscription(ProxyResource): # pylint: disable=too-many-instance-attributes """Description of subscription resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2518,7 +2436,7 @@ class SBSubscription(ProxyResource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2021_11_01.models.SystemData :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar accessed_at: Last time there was a receive request to this subscription. @@ -2549,7 +2467,7 @@ class SBSubscription(ProxyResource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2570,46 +2488,52 @@ class SBSubscription(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'message_count': {'readonly': True}, - 'created_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "message_count": {"readonly": True}, + "created_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - 'is_client_affine': {'key': 'properties.isClientAffine', 'type': 'bool'}, - 'client_affine_properties': {'key': 'properties.clientAffineProperties', 'type': 'SBClientAffineProperties'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + "is_client_affine": {"key": "properties.isClientAffine", "type": "bool"}, + "client_affine_properties": {"key": "properties.clientAffineProperties", "type": "SBClientAffineProperties"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2626,8 +2550,8 @@ def __init__( forward_dead_lettered_messages_to: Optional[str] = None, is_client_affine: Optional[bool] = None, client_affine_properties: Optional["_models.SBClientAffineProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. @@ -2651,7 +2575,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2671,7 +2595,7 @@ def __init__( :paramtype client_affine_properties: ~azure.mgmt.servicebus.v2021_11_01.models.SBClientAffineProperties """ - super(SBSubscription, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.message_count = None self.created_at = None @@ -2694,7 +2618,7 @@ def __init__( self.client_affine_properties = client_affine_properties -class SBSubscriptionListResult(msrest.serialization.Model): +class SBSubscriptionListResult(_serialization.Model): """The response to the List Subscriptions operation. :ivar value: Result of the List Subscriptions operation. @@ -2705,17 +2629,13 @@ class SBSubscriptionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBSubscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBSubscription"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBSubscription"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Subscriptions operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription] @@ -2723,12 +2643,12 @@ def __init__( list of subscriptions. :paramtype next_link: str """ - super(SBSubscriptionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBTopic(ProxyResource): +class SBTopic(ProxyResource): # pylint: disable=too-many-instance-attributes """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2746,7 +2666,7 @@ class SBTopic(ProxyResource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2021_11_01.models.SystemData :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2766,7 +2686,7 @@ class SBTopic(ProxyResource): :vartype max_size_in_megabytes: int :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today and default is 1024. - :vartype max_message_size_in_kilobytes: long + :vartype max_message_size_in_kilobytes: int :ivar requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :vartype requires_duplicate_detection: bool @@ -2778,7 +2698,7 @@ class SBTopic(ProxyResource): :vartype enable_batched_operations: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.EntityStatus :ivar support_ordering: Value that indicates whether the topic supports ordering. :vartype support_ordering: bool @@ -2794,42 +2714,45 @@ class SBTopic(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "subscription_count": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'max_message_size_in_kilobytes': {'key': 'properties.maxMessageSizeInKilobytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, } def __init__( @@ -2846,8 +2769,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, enable_partitioning: Optional[bool] = None, enable_express: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -2858,7 +2781,7 @@ def __init__( :paramtype max_size_in_megabytes: int :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today and default is 1024. - :paramtype max_message_size_in_kilobytes: long + :paramtype max_message_size_in_kilobytes: int :keyword requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -2870,7 +2793,7 @@ def __init__( :paramtype enable_batched_operations: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2021_11_01.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool @@ -2884,7 +2807,7 @@ def __init__( topic holds a message in memory temporarily before writing it to persistent storage. :paramtype enable_express: bool """ - super(SBTopic, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.size_in_bytes = None self.created_at = None @@ -2905,7 +2828,7 @@ def __init__( self.enable_express = enable_express -class SBTopicListResult(msrest.serialization.Model): +class SBTopicListResult(_serialization.Model): """The response to the List Topics operation. :ivar value: Result of the List Topics operation. @@ -2916,17 +2839,13 @@ class SBTopicListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBTopic]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBTopic"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBTopic"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Topics operation. :paramtype value: list[~azure.mgmt.servicebus.v2021_11_01.models.SBTopic] @@ -2934,13 +2853,14 @@ def __init__( list of topics. :paramtype next_link: str """ - super(SBTopicListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SqlFilter(msrest.serialization.Model): - """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. +class SqlFilter(_serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in + the pub/sub pipeline. :ivar sql_expression: The SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2953,9 +2873,9 @@ class SqlFilter(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -2963,9 +2883,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: The SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -2976,14 +2896,15 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing class SqlRuleAction(Action): - """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + """Represents set of actions written in SQL language-based syntax that is performed against a + ServiceBus.Messaging.BrokeredMessage. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2996,9 +2917,9 @@ class SqlRuleAction(Action): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -3006,9 +2927,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -3019,66 +2940,66 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + super().__init__( + sql_expression=sql_expression, + compatibility_level=compatibility_level, + requires_preprocessing=requires_preprocessing, + **kwargs + ) -class Subnet(msrest.serialization.Model): +class Subnet(_serialization.Model): """Properties supplied for Subnet. All required parameters must be populated in order to send to Azure. - :ivar id: Required. Resource ID of Virtual Network Subnet. + :ivar id: Resource ID of Virtual Network Subnet. Required. :vartype id: str """ _validation = { - 'id': {'required': True}, + "id": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: str, - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Required. Resource ID of Virtual Network Subnet. + :keyword id: Resource ID of Virtual Network Subnet. Required. :paramtype id: str """ - super(Subnet, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -3090,26 +3011,26 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.servicebus.v2021_11_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -3118,7 +3039,7 @@ def __init__( self.last_modified_at = last_modified_at -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Recognized Dictionary value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3130,27 +3051,23 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(UserAssignedIdentity, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentityProperties(msrest.serialization.Model): +class UserAssignedIdentityProperties(_serialization.Model): """UserAssignedIdentityProperties. :ivar user_assigned_identity: ARM ID of user Identity selected for encryption. @@ -3158,18 +3075,13 @@ class UserAssignedIdentityProperties(msrest.serialization.Model): """ _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: ARM ID of user Identity selected for encryption. :paramtype user_assigned_identity: str """ - super(UserAssignedIdentityProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.user_assigned_identity = user_assigned_identity diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_service_bus_management_client_enums.py index 33112c2ab17d..ce716a014719 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/models/_service_bus_management_client_enums.py @@ -11,30 +11,31 @@ class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class DefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Default Action for Network Rule Set - """ + """Default Action for Network Rule Set.""" ALLOW = "Allow" DENY = "Deny" + class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Private Endpoint Connection. - """ + """Provisioning state of the Private Endpoint Connection.""" CREATING = "Creating" UPDATING = "Updating" @@ -43,9 +44,9 @@ class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" FAILED = "Failed" + class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity status. - """ + """Entity status.""" ACTIVE = "Active" DISABLED = "Disabled" @@ -57,92 +58,96 @@ class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENAMING = "Renaming" UNKNOWN = "Unknown" + class FilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Rule filter types - """ + """Rule filter types.""" SQL_FILTER = "SqlFilter" CORRELATION_FILTER = "CorrelationFilter" + class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The access key to regenerate. - """ + """The access key to regenerate.""" PRIMARY_KEY = "PrimaryKey" SECONDARY_KEY = "SecondaryKey" + class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity. - """ + """Type of managed service identity.""" SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" + class MigrationConfigurationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationConfigurationName.""" _DEFAULT = "$default" + class NetworkRuleIPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP Filter Action - """ + """The IP Filter Action.""" ALLOW = "Allow" + class PrivateLinkConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the connection. - """ + """Status of the connection.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ProvisioningStateDR(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' - or 'Succeeded' or 'Failed' + or 'Succeeded' or 'Failed'. """ ACCEPTED = "Accepted" SUCCEEDED = "Succeeded" FAILED = "Failed" + class PublicNetworkAccessFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This determines if traffic is allowed over public network. By default it is enabled. - """ + """This determines if traffic is allowed over public network. By default it is enabled.""" ENABLED = "Enabled" DISABLED = "Disabled" + class RoleDisasterRecovery(str, Enum, metaclass=CaseInsensitiveEnumMeta): """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or - 'Secondary' + 'Secondary'. """ PRIMARY = "Primary" PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" SECONDARY = "Secondary" + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of this SKU. - """ + """Name of this SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The billing tier of this particular SKU. - """ + """The billing tier of this particular SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the reason for the unavailability of the service. - """ + """Specifies the reason for the unavailability of the service.""" NONE = "None" INVALID_NAME = "InvalidName" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_disaster_recovery_configs_operations.py index a669afa805d6..9dd1038fc8f5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_disaster_recovery_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,298 +27,261 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.ArmDisasterRecovery] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_break_pairing_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_fail_over_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.FailoverProperties] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -325,34 +295,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -366,79 +337,72 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_check_name_availability_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class DisasterRecoveryConfigsOperations: """ @@ -459,65 +423,66 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -525,16 +490,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -545,49 +508,124 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -597,18 +635,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -618,67 +656,65 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -689,60 +725,58 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -750,68 +784,66 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -822,50 +854,125 @@ def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - @distributed_trace + @overload def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -875,18 +982,18 @@ def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -897,72 +1004,76 @@ def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -970,16 +1081,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -990,48 +1099,48 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1039,18 +1148,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1058,52 +1166,53 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1111,18 +1220,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1130,50 +1238,118 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -1182,18 +1358,18 @@ def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1201,12 +1377,13 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_migration_configs_operations.py index fed06161b0b7..f2e4e4019694 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_migration_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,251 +29,245 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_and_start_migration_request_initial( +def build_create_and_start_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, - *, - json: Optional[_models.MigrationConfigProperties] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_complete_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_revert_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MigrationConfigsOperations: """ @@ -287,65 +288,67 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,16 +356,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -373,35 +374,44 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'MigrationConfigProperties') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") - request = build_create_and_start_migration_request_initial( + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -409,56 +419,63 @@ def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } - @distributed_trace + @overload def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -471,113 +488,188 @@ def begin_create_and_start_migration( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_and_start_migration_initial( # type: ignore + raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -588,60 +680,62 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -649,69 +743,71 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -722,60 +818,62 @@ def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2021_11_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -786,5 +884,6 @@ def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_namespaces_operations.py index d6af66a8d3c8..73ccd276406b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_namespaces_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,651 +29,561 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespace] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NetworkRuleSet] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_network_rule_sets_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class NamespacesOperations: """ @@ -687,55 +604,60 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -743,16 +665,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -763,65 +683,67 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -829,16 +751,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -849,90 +769,105 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespace') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -944,121 +879,187 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1070,103 +1071,97 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1174,51 +1169,121 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespaceUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1227,18 +1292,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1248,53 +1313,121 @@ def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -1303,18 +1436,18 @@ def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1322,63 +1455,62 @@ def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1386,74 +1518,76 @@ def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1461,16 +1595,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1481,70 +1613,75 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1552,16 +1689,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1572,49 +1707,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -1624,18 +1841,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1643,67 +1860,68 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1714,60 +1932,61 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1775,67 +1994,68 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1843,53 +2063,136 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1899,18 +2202,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1918,62 +2221,108 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1981,12 +2330,13 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_operations.py index b9ddcd40a230..e3ec087b2c16 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +27,38 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,52 +79,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,16 +136,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,8 +154,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_endpoint_connections_operations.py index 5c24300d7918..c01d019f616e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,134 +29,134 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, namespace_name: str, - subscription_id: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -162,33 +169,35 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -209,65 +218,70 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -275,16 +289,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,71 +307,154 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -368,86 +463,85 @@ def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -459,108 +553,103 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -568,12 +657,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_link_resources_operations.py index 4b6c38cbe1ba..2241eaf24ebe 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_private_link_resources_operations.py @@ -6,11 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +25,52 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,54 +91,54 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,12 +146,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_queues_operations.py index 2396e8424900..28586ac2ccf0 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_queues_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,52 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +81,43 @@ def build_create_or_update_authorization_rule_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -126,34 +131,35 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -167,34 +173,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +215,35 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +252,43 @@ def build_regenerate_keys_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +303,141 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - *, - json: Optional[_models.SBQueue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class QueuesOperations: """ @@ -474,70 +458,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +531,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +549,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +563,117 @@ def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +684,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +703,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -661,31 +725,36 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +762,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -715,8 +783,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -729,31 +798,36 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -761,18 +835,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,15 +853,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +875,36 @@ def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +912,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +930,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,38 +949,126 @@ def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -912,18 +1079,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -931,15 +1098,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -949,12 +1117,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBQueueListResult]: + ) -> Iterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -964,53 +1135,56 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1018,16 +1192,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1038,49 +1210,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1090,18 +1344,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1109,67 +1363,68 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1180,60 +1435,59 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> _models.SBQueue: + def get(self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1241,12 +1495,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_rules_operations.py index be66a582ba18..0383b46136be 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_rules_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_subscriptions_request( resource_group_name: str, namespace_name: str, @@ -41,38 +55,37 @@ def build_list_by_subscriptions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -82,48 +95,42 @@ def build_create_or_update_request( subscription_name: str, rule_name: str, subscription_id: str, - *, - json: Optional[_models.Rule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -138,35 +145,34 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -181,35 +187,35 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class RulesOperations: """ @@ -230,7 +236,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -241,16 +246,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.RuleListResult]: + ) -> Iterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -260,56 +265,58 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -317,16 +324,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -337,13 +342,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -352,40 +357,125 @@ def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -397,18 +487,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -416,15 +506,16 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -438,33 +529,35 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -473,18 +566,17 @@ def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -495,8 +587,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def get( @@ -510,33 +603,35 @@ def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -545,18 +640,17 @@ def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -564,12 +658,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_subscriptions_operations.py index 9ded268e4caa..5e12840f0999 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_subscriptions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_topic_request( resource_group_name: str, namespace_name: str, @@ -40,37 +54,36 @@ def build_list_by_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -79,47 +92,41 @@ def build_create_or_update_request( topic_name: str, subscription_name: str, subscription_id: str, - *, - json: Optional[_models.SBSubscription] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -133,34 +140,33 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -174,34 +180,34 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SubscriptionsOperations: """ @@ -222,7 +228,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -232,14 +237,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBSubscriptionListResult]: + ) -> Iterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -249,56 +257,57 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBSubscription or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -306,16 +315,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -326,13 +333,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -340,38 +347,126 @@ def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -382,18 +477,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,52 +496,53 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -454,18 +550,17 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -476,45 +571,46 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -522,18 +618,17 @@ def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,12 +636,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_topics_operations.py index ba568af6a301..2f6565532e4d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_11_01/operations/_topics_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,52 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +81,43 @@ def build_create_or_update_authorization_rule_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -126,34 +131,35 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -167,34 +173,35 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +215,35 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +252,43 @@ def build_regenerate_keys_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +303,141 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - *, - json: Optional[_models.SBTopic] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TopicsOperations: """ @@ -474,70 +458,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +531,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +549,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +563,126 @@ def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +693,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +712,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -661,31 +734,36 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +771,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,15 +789,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -733,31 +811,36 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -765,18 +848,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -787,8 +869,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +884,36 @@ def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +921,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +939,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,38 +958,126 @@ def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -912,18 +1088,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -931,15 +1107,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -949,12 +1126,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBTopicListResult]: + ) -> Iterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -964,53 +1144,56 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_11_01.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1018,16 +1201,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1038,49 +1219,131 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1090,18 +1353,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1109,67 +1372,68 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1180,60 +1444,59 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> _models.SBTopic: + def get(self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2021_11_01.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1241,12 +1504,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/__init__.py index 221541a00fb6..2e171d69863b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/__init__.py @@ -13,11 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_configuration.py index 783200eb0f9c..b212f444418d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,23 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_metadata.json index b470bf08107e..e95dc46a10d1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_metadata.json +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_metadata.json @@ -10,34 +10,36 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -108,4 +116,4 @@ "rules": "RulesOperations", "subscriptions": "SubscriptionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_service_bus_management_client.py index fa1bf25ce31a..68460f4ebe2d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models +from .._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -50,10 +61,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2022_01_01_preview.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,50 +82,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -123,7 +119,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -136,15 +132,12 @@ def _send_request( request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient + def __enter__(self) -> "ServiceBusManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_vendor.py index 138f663c53a4..bd0df84f5319 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_vendor.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_vendor.py @@ -5,8 +5,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,14 +17,14 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_version.py index 920456322fa1..d5f3055d6eb4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0" +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/__init__.py index e7dd87df1f93..530b8638dfd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/__init__.py @@ -10,11 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ServiceBusManagementClient'] + +__all__ = [ + "ServiceBusManagementClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_configuration.py index 3dab941141f1..0ba04e765063 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -25,24 +31,19 @@ class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,22 +53,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_service_bus_management_client.py index 13c1abe32866..7186549293da 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/_service_bus_management_client.py @@ -9,20 +9,31 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models +from ..._serialization import Deserializer, Serializer from ._configuration import ServiceBusManagementClientConfiguration -from .operations import DisasterRecoveryConfigsOperations, MigrationConfigsOperations, NamespacesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueuesOperations, RulesOperations, SubscriptionsOperations, TopicsOperations +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceBusManagementClient: # pylint: disable=too-many-instance-attributes + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Service Bus client for managing Namespace. :ivar namespaces: NamespacesOperations operations @@ -51,10 +62,10 @@ class ServiceBusManagementClient: # pylint: disable=too-many-instance-attribu :ivar subscriptions: SubscriptionsOperations operations :vartype subscriptions: azure.mgmt.servicebus.v2022_01_01_preview.aio.operations.SubscriptionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -72,50 +83,35 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ServiceBusManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) self.migration_configs = MigrationConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -124,7 +120,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest @@ -144,5 +140,5 @@ async def __aenter__(self) -> "ServiceBusManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py index f67e9b774890..5c0fe216ac8d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._disaster_recovery_configs_operations import build_break_pairing_request, build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_fail_over_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request -T = TypeVar('T') +from ...operations._disaster_recovery_configs_operations import ( + build_break_pairing_request, + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_fail_over_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class DisasterRecoveryConfigsOperations: """ .. warning:: @@ -43,65 +69,68 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -109,16 +138,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -129,49 +156,126 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -181,18 +285,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -202,67 +306,67 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -273,60 +377,60 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,68 +438,68 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace_async async def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -406,50 +510,127 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - @distributed_trace_async + @overload async def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -459,18 +640,18 @@ async def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -481,72 +662,78 @@ async def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -554,16 +741,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -574,48 +759,50 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -623,18 +810,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -642,52 +828,55 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -695,18 +884,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -714,50 +902,120 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -766,18 +1024,18 @@ async def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -785,12 +1043,13 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_migration_configs_operations.py index 0cb763195c64..1321b97bd65c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_migration_configs_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,23 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._migration_configs_operations import build_complete_migration_request, build_create_and_start_migration_request_initial, build_delete_request, build_get_request, build_list_request, build_revert_request -T = TypeVar('T') +from ...operations._migration_configs_operations import ( + build_complete_migration_request, + build_create_and_start_migration_request, + build_delete_request, + build_get_request, + build_list_request, + build_revert_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MigrationConfigsOperations: """ .. warning:: @@ -45,65 +67,69 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +137,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,35 +155,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } async def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -167,57 +202,146 @@ async def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> AsyncLROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -230,114 +354,114 @@ async def begin_create_and_start_migration( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_and_start_migration_initial( # type: ignore + raw_result = await self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -348,61 +472,65 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,70 +538,74 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace_async async def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,61 +616,65 @@ async def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace_async async def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -549,5 +685,6 @@ async def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_namespaces_operations.py index a2767c6538bc..52cc3af5e053 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_namespaces_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._namespaces_operations import build_check_name_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_network_rule_set_request, build_create_or_update_request_initial, build_delete_authorization_rule_request, build_delete_request_initial, build_get_authorization_rule_request, build_get_network_rule_set_request, build_get_request, build_list_authorization_rules_request, build_list_by_resource_group_request, build_list_keys_request, build_list_network_rule_sets_request, build_list_request, build_regenerate_keys_request, build_update_request -T = TypeVar('T') +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_network_rule_set_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_network_rule_set_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_keys_request, + build_list_network_rule_sets_request, + build_list_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class NamespacesOperations: """ .. warning:: @@ -45,55 +77,63 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -101,16 +141,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -121,65 +159,70 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -187,16 +230,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,90 +248,182 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } async def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -303,121 +436,118 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -429,103 +559,101 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace_async - async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -533,51 +661,124 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -586,18 +787,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -607,53 +808,123 @@ async def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace_async + @overload async def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -662,18 +933,18 @@ async def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,63 +952,64 @@ async def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace_async async def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -745,74 +1017,79 @@ async def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -820,16 +1097,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -840,70 +1115,77 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -911,16 +1193,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -931,49 +1211,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -983,18 +1347,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1002,67 +1366,70 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1073,60 +1440,63 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1134,67 +1504,70 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1202,54 +1575,140 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1259,18 +1718,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1278,62 +1737,110 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1341,12 +1848,13 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_operations.py index 6691d1b4ee72..c6d5a8996c24 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,52 +57,59 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -95,16 +117,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,8 +135,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_endpoint_connections_operations.py index 17fc571750fa..ea61bb406607 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +31,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -45,65 +65,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,16 +138,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,71 +156,157 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -204,86 +315,87 @@ async def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -295,108 +407,107 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -404,12 +515,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_link_resources_operations.py index 9ae4e692ece3..8861d4e12df9 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_private_link_resources_operations.py @@ -6,9 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +27,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,54 +55,56 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,12 +112,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_queues_operations.py index 7f7e1f04ab7a..7f312b39f63f 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_queues_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queues_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class QueuesOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,119 @@ async def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +299,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +318,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -230,31 +340,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +379,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -284,8 +400,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -298,31 +415,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -330,18 +454,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,15 +472,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +494,38 @@ async def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +533,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +551,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +570,130 @@ async def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +704,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +723,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +742,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBQueueListResult]: + ) -> AsyncIterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +760,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :return: An iterator like instance of either SBQueue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +820,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +838,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +974,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +993,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1067,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1131,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_rules_operations.py index 3fe195decf17..383a11e1b8b1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_rules_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscriptions_request -T = TypeVar('T') +from ...operations._rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscriptions_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RulesOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -54,16 +73,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.RuleListResult]: + ) -> AsyncIterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -73,57 +92,61 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) + :return: An iterator like instance of either Rule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,16 +154,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,13 +172,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -166,40 +187,127 @@ async def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -211,18 +319,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,15 +338,16 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -252,33 +361,37 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -287,18 +400,17 @@ async def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -309,8 +421,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace_async async def get( @@ -324,33 +437,37 @@ async def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -359,18 +476,17 @@ async def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,12 +494,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_subscriptions_operations.py index b4a603ce4f1d..a45a7ee9a429 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_subscriptions_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_topic_request -T = TypeVar('T') +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_topic_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SubscriptionsOperations: """ .. warning:: @@ -43,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -53,14 +72,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBSubscriptionListResult]: + ) -> AsyncIterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -70,56 +92,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,16 +153,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,13 +171,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, @@ -161,38 +185,128 @@ async def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -203,18 +317,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -222,52 +336,55 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -275,18 +392,17 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -297,45 +413,48 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -343,18 +462,17 @@ async def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -362,12 +480,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_topics_operations.py index 02c0592da674..fc8dc8d89276 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/aio/operations/_topics_operations.py @@ -6,10 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._topics_operations import build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_request, build_list_authorization_rules_request, build_list_by_namespace_request, build_list_keys_request, build_regenerate_keys_request -T = TypeVar('T') +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopicsOperations: """ .. warning:: @@ -43,70 +69,74 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,16 +144,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,13 +162,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace_async + @overload async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -148,38 +176,128 @@ async def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -190,18 +308,18 @@ async def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,15 +327,16 @@ async def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def get_authorization_rule( @@ -230,31 +349,38 @@ async def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -262,18 +388,17 @@ async def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,15 +406,16 @@ async def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -302,31 +428,38 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -334,18 +467,17 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -356,8 +488,9 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace_async async def list_keys( @@ -370,31 +503,38 @@ async def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -402,18 +542,17 @@ async def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,17 +560,18 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - - @distributed_trace_async + @overload async def regenerate_keys( self, resource_group_name: str, @@ -439,39 +579,130 @@ async def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -482,18 +713,18 @@ async def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,15 +732,16 @@ async def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -519,12 +751,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable[_models.SBTopicListResult]: + ) -> AsyncIterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -534,53 +769,59 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :return: An iterator like instance of either SBTopic or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -588,16 +829,14 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -608,49 +847,133 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -660,18 +983,18 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,67 +1002,70 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,60 +1076,63 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace_async async def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -811,12 +1140,13 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/__init__.py index 21d9474c1ea6..f766e5ccef14 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/__init__.py @@ -63,109 +63,107 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserAssignedIdentityProperties - -from ._service_bus_management_client_enums import ( - AccessRights, - CreatedByType, - DefaultAction, - EndPointProvisioningState, - EntityStatus, - FilterType, - KeySource, - KeyType, - ManagedServiceIdentityType, - MigrationConfigurationName, - NetworkRuleIPAction, - PrivateLinkConnectionStatus, - ProvisioningStateDR, - PublicNetworkAccess, - PublicNetworkAccessFlag, - RoleDisasterRecovery, - SkuName, - SkuTier, - TlsVersion, - UnavailableReason, -) +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import CreatedByType +from ._service_bus_management_client_enums import DefaultAction +from ._service_bus_management_client_enums import EndPointProvisioningState +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import FilterType +from ._service_bus_management_client_enums import KeySource +from ._service_bus_management_client_enums import KeyType +from ._service_bus_management_client_enums import ManagedServiceIdentityType +from ._service_bus_management_client_enums import MigrationConfigurationName +from ._service_bus_management_client_enums import NetworkRuleIPAction +from ._service_bus_management_client_enums import PrivateLinkConnectionStatus +from ._service_bus_management_client_enums import ProvisioningStateDR +from ._service_bus_management_client_enums import PublicNetworkAccess +from ._service_bus_management_client_enums import PublicNetworkAccessFlag +from ._service_bus_management_client_enums import RoleDisasterRecovery +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import TlsVersion +from ._service_bus_management_client_enums import UnavailableReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AccessKeys', - 'Action', - 'ArmDisasterRecovery', - 'ArmDisasterRecoveryListResult', - 'CheckNameAvailability', - 'CheckNameAvailabilityResult', - 'ConnectionState', - 'CorrelationFilter', - 'Encryption', - 'ErrorAdditionalInfo', - 'ErrorResponse', - 'ErrorResponseError', - 'FailoverProperties', - 'Identity', - 'KeyVaultProperties', - 'MessageCountDetails', - 'MigrationConfigListResult', - 'MigrationConfigProperties', - 'NWRuleSetIpRules', - 'NWRuleSetVirtualNetworkRules', - 'NetworkRuleSet', - 'NetworkRuleSetListResult', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'ProxyResource', - 'RegenerateAccessKeyParameters', - 'Resource', - 'ResourceNamespacePatch', - 'Rule', - 'RuleListResult', - 'SBAuthorizationRule', - 'SBAuthorizationRuleListResult', - 'SBClientAffineProperties', - 'SBNamespace', - 'SBNamespaceListResult', - 'SBNamespaceUpdateParameters', - 'SBQueue', - 'SBQueueListResult', - 'SBSku', - 'SBSubscription', - 'SBSubscriptionListResult', - 'SBTopic', - 'SBTopicListResult', - 'SqlFilter', - 'SqlRuleAction', - 'Subnet', - 'SystemData', - 'TrackedResource', - 'UserAssignedIdentity', - 'UserAssignedIdentityProperties', - 'AccessRights', - 'CreatedByType', - 'DefaultAction', - 'EndPointProvisioningState', - 'EntityStatus', - 'FilterType', - 'KeySource', - 'KeyType', - 'ManagedServiceIdentityType', - 'MigrationConfigurationName', - 'NetworkRuleIPAction', - 'PrivateLinkConnectionStatus', - 'ProvisioningStateDR', - 'PublicNetworkAccess', - 'PublicNetworkAccessFlag', - 'RoleDisasterRecovery', - 'SkuName', - 'SkuTier', - 'TlsVersion', - 'UnavailableReason', + "AccessKeys", + "Action", + "ArmDisasterRecovery", + "ArmDisasterRecoveryListResult", + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "ConnectionState", + "CorrelationFilter", + "Encryption", + "ErrorAdditionalInfo", + "ErrorResponse", + "ErrorResponseError", + "FailoverProperties", + "Identity", + "KeyVaultProperties", + "MessageCountDetails", + "MigrationConfigListResult", + "MigrationConfigProperties", + "NWRuleSetIpRules", + "NWRuleSetVirtualNetworkRules", + "NetworkRuleSet", + "NetworkRuleSetListResult", + "Operation", + "OperationDisplay", + "OperationListResult", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "ProxyResource", + "RegenerateAccessKeyParameters", + "Resource", + "ResourceNamespacePatch", + "Rule", + "RuleListResult", + "SBAuthorizationRule", + "SBAuthorizationRuleListResult", + "SBClientAffineProperties", + "SBNamespace", + "SBNamespaceListResult", + "SBNamespaceUpdateParameters", + "SBQueue", + "SBQueueListResult", + "SBSku", + "SBSubscription", + "SBSubscriptionListResult", + "SBTopic", + "SBTopicListResult", + "SqlFilter", + "SqlRuleAction", + "Subnet", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "UserAssignedIdentityProperties", + "AccessRights", + "CreatedByType", + "DefaultAction", + "EndPointProvisioningState", + "EntityStatus", + "FilterType", + "KeySource", + "KeyType", + "ManagedServiceIdentityType", + "MigrationConfigurationName", + "NetworkRuleIPAction", + "PrivateLinkConnectionStatus", + "ProvisioningStateDR", + "PublicNetworkAccess", + "PublicNetworkAccessFlag", + "RoleDisasterRecovery", + "SkuName", + "SkuTier", + "TlsVersion", + "UnavailableReason", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_models_py3.py index eee47e184d16..50a28115bba5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,17 +8,23 @@ # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -class AccessKeys(msrest.serialization.Model): +class AccessKeys(_serialization.Model): """Namespace/ServiceBus Connection String. Variables are only populated by the server, and will be ignored when sending a request. @@ -45,32 +52,28 @@ class AccessKeys(msrest.serialization.Model): """ _validation = { - 'primary_connection_string': {'readonly': True}, - 'secondary_connection_string': {'readonly': True}, - 'alias_primary_connection_string': {'readonly': True}, - 'alias_secondary_connection_string': {'readonly': True}, - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - 'key_name': {'readonly': True}, + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + "alias_primary_connection_string": {"readonly": True}, + "alias_secondary_connection_string": {"readonly": True}, + "primary_key": {"readonly": True}, + "secondary_key": {"readonly": True}, + "key_name": {"readonly": True}, } _attribute_map = { - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, - 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AccessKeys, self).__init__(**kwargs) + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "alias_primary_connection_string": {"key": "aliasPrimaryConnectionString", "type": "str"}, + "alias_secondary_connection_string": {"key": "aliasSecondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.primary_connection_string = None self.secondary_connection_string = None self.alias_primary_connection_string = None @@ -80,8 +83,9 @@ def __init__( self.key_name = None -class Action(msrest.serialization.Model): - """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. +class Action(_serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have + been matched by a filter expression. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -94,9 +98,9 @@ class Action(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -104,9 +108,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -117,13 +121,13 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing -class ProxyResource(msrest.serialization.Model): +class ProxyResource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. @@ -141,26 +145,22 @@ class ProxyResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ProxyResource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -186,11 +186,11 @@ class ArmDisasterRecovery(ProxyResource): :vartype system_data: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SystemData :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Known values are: "Accepted", - "Succeeded", "Failed". + "Succeeded", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. :vartype partner_namespace: str @@ -198,41 +198,37 @@ class ArmDisasterRecovery(ProxyResource): pairing. :vartype alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' - or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", "Secondary". + or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", and "Secondary". :vartype role: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.RoleDisasterRecovery """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'role': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "role": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "partner_namespace": {"key": "properties.partnerNamespace", "type": "str"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "role": {"key": "properties.role", "type": "str"}, } def __init__( - self, - *, - partner_namespace: Optional[str] = None, - alternate_name: Optional[str] = None, - **kwargs - ): + self, *, partner_namespace: Optional[str] = None, alternate_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. @@ -241,7 +237,7 @@ def __init__( pairing. :paramtype alternate_name: str """ - super(ArmDisasterRecovery, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -250,7 +246,7 @@ def __init__( self.role = None -class ArmDisasterRecoveryListResult(msrest.serialization.Model): +class ArmDisasterRecoveryListResult(_serialization.Model): """The result of the List Alias(Disaster Recovery configuration) operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -263,65 +259,55 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ArmDisasterRecovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ArmDisasterRecovery"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ArmDisasterRecovery"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Alias(Disaster Recovery configurations). :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery] """ - super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CheckNameAvailability(msrest.serialization.Model): +class CheckNameAvailability(_serialization.Model): """Description of a Check Name availability request properties. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The Name to check the namespace name availability and The namespace name - can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it - must end with a letter or number. + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :vartype name: str """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: str, - **kwargs - ): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ - :keyword name: Required. The Name to check the namespace name availability and The namespace - name can contain only letters, numbers, and hyphens. The namespace must start with a letter, - and it must end with a letter or number. + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. :paramtype name: str """ - super(CheckNameAvailability, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(msrest.serialization.Model): +class CheckNameAvailabilityResult(_serialization.Model): """Description of a Check Name availability request properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -332,19 +318,19 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): available; otherwise, false. :vartype name_available: bool :ivar reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :vartype reason: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.UnavailableReason """ _validation = { - 'message': {'readonly': True}, + "message": {"readonly": True}, } _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, + "message": {"key": "message", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, } def __init__( @@ -352,28 +338,28 @@ def __init__( *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.UnavailableReason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Value indicating namespace is availability, true if the namespace is available; otherwise, false. :paramtype name_available: bool :keyword reason: The reason for unavailability of a namespace. Known values are: "None", - "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and "TooManyNamespaceInCurrentSubscription". :paramtype reason: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.UnavailableReason """ - super(CheckNameAvailabilityResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.message = None self.name_available = name_available self.reason = reason -class ConnectionState(msrest.serialization.Model): +class ConnectionState(_serialization.Model): """ConnectionState information. :ivar status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :vartype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateLinkConnectionStatus :ivar description: Description of the connection state. @@ -381,8 +367,8 @@ class ConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -390,22 +376,22 @@ def __init__( *, status: Optional[Union[str, "_models.PrivateLinkConnectionStatus"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :paramtype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateLinkConnectionStatus :keyword description: Description of the connection state. :paramtype description: str """ - super(ConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class CorrelationFilter(msrest.serialization.Model): +class CorrelationFilter(_serialization.Model): """Represents the correlation filter expression. :ivar properties: dictionary object for custom filters. @@ -432,16 +418,16 @@ class CorrelationFilter(msrest.serialization.Model): """ _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'message_id': {'key': 'messageId', 'type': 'str'}, - 'to': {'key': 'to', 'type': 'str'}, - 'reply_to': {'key': 'replyTo', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "properties": {"key": "properties", "type": "{str}"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "message_id": {"key": "messageId", "type": "str"}, + "to": {"key": "to", "type": "str"}, + "reply_to": {"key": "replyTo", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "session_id": {"key": "sessionId", "type": "str"}, + "reply_to_session_id": {"key": "replyToSessionId", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -456,9 +442,9 @@ def __init__( session_id: Optional[str] = None, reply_to_session_id: Optional[str] = None, content_type: Optional[str] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword properties: dictionary object for custom filters. :paramtype properties: dict[str, str] @@ -482,7 +468,7 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(CorrelationFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties self.correlation_id = correlation_id self.message_id = message_id @@ -495,51 +481,51 @@ def __init__( self.requires_preprocessing = requires_preprocessing -class Encryption(msrest.serialization.Model): +class Encryption(_serialization.Model): """Properties to configure Encryption. :ivar key_vault_properties: Properties of KeyVault. :vartype key_vault_properties: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.KeyVaultProperties] - :ivar key_source: Enumerates the possible value of keySource for Encryption. Known values are: - "Microsoft.KeyVault". Default value: "Microsoft.KeyVault". + :ivar key_source: Enumerates the possible value of keySource for Encryption. + "Microsoft.KeyVault" :vartype key_source: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.KeySource :ivar require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). :vartype require_infrastructure_encryption: bool """ _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "[KeyVaultProperties]"}, + "key_source": {"key": "keySource", "type": "str"}, + "require_infrastructure_encryption": {"key": "requireInfrastructureEncryption", "type": "bool"}, } def __init__( self, *, key_vault_properties: Optional[List["_models.KeyVaultProperties"]] = None, - key_source: Optional[Union[str, "_models.KeySource"]] = "Microsoft.KeyVault", + key_source: Union[str, "_models.KeySource"] = "Microsoft.KeyVault", require_infrastructure_encryption: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Properties of KeyVault. :paramtype key_vault_properties: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.KeyVaultProperties] - :keyword key_source: Enumerates the possible value of keySource for Encryption. Known values - are: "Microsoft.KeyVault". Default value: "Microsoft.KeyVault". + :keyword key_source: Enumerates the possible value of keySource for Encryption. + "Microsoft.KeyVault" :paramtype key_source: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.KeySource :keyword require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). :paramtype require_infrastructure_encryption: bool """ - super(Encryption, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_vault_properties = key_vault_properties self.key_source = key_source self.require_infrastructure_encryption = require_infrastructure_encryption -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -547,31 +533,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -579,24 +561,19 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + "error": {"key": "error", "type": "ErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ErrorResponseError """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ErrorResponseError(msrest.serialization.Model): +class ErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -615,28 +592,24 @@ class ErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -644,8 +617,9 @@ def __init__( self.additional_info = None -class FailoverProperties(msrest.serialization.Model): - """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. +class FailoverProperties(_serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before + switching to the secondary. :ivar is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. @@ -653,25 +627,20 @@ class FailoverProperties(msrest.serialization.Model): """ _attribute_map = { - 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + "is_safe_failover": {"key": "properties.IsSafeFailover", "type": "bool"}, } - def __init__( - self, - *, - is_safe_failover: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, is_safe_failover: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_safe_failover: Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. :paramtype is_safe_failover: bool """ - super(FailoverProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_safe_failover = is_safe_failover -class Identity(msrest.serialization.Model): +class Identity(_serialization.Model): """Properties to configure User Assigned Identities for Bring your Own Keys. Variables are only populated by the server, and will be ignored when sending a request. @@ -681,7 +650,7 @@ class Identity(msrest.serialization.Model): :ivar tenant_id: TenantId from the KeyVault. :vartype tenant_id: str :ivar type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :vartype type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.ManagedServiceIdentityType :ivar user_assigned_identities: Properties for User Assigned Identities. @@ -690,15 +659,15 @@ class Identity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } def __init__( @@ -706,25 +675,25 @@ def __init__( *, type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of managed service identity. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned, UserAssigned", "None". + "UserAssigned", "SystemAssigned, UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.ManagedServiceIdentityType :keyword user_assigned_identities: Properties for User Assigned Identities. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.servicebus.v2022_01_01_preview.models.UserAssignedIdentity] """ - super(Identity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class KeyVaultProperties(msrest.serialization.Model): +class KeyVaultProperties(_serialization.Model): """Properties to configure keyVault Properties. :ivar key_name: Name of the Key from KeyVault. @@ -739,10 +708,10 @@ class KeyVaultProperties(msrest.serialization.Model): """ _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + "key_name": {"key": "keyName", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "key_version": {"key": "keyVersion", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentityProperties"}, } def __init__( @@ -752,8 +721,8 @@ def __init__( key_vault_uri: Optional[str] = None, key_version: Optional[str] = None, identity: Optional["_models.UserAssignedIdentityProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_name: Name of the Key from KeyVault. :paramtype key_name: str @@ -765,54 +734,50 @@ def __init__( :paramtype identity: ~azure.mgmt.servicebus.v2022_01_01_preview.models.UserAssignedIdentityProperties """ - super(KeyVaultProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name self.key_vault_uri = key_vault_uri self.key_version = key_version self.identity = identity -class MessageCountDetails(msrest.serialization.Model): +class MessageCountDetails(_serialization.Model): """Message Count Details. Variables are only populated by the server, and will be ignored when sending a request. :ivar active_message_count: Number of active messages in the queue, topic, or subscription. - :vartype active_message_count: long + :vartype active_message_count: int :ivar dead_letter_message_count: Number of messages that are dead lettered. - :vartype dead_letter_message_count: long + :vartype dead_letter_message_count: int :ivar scheduled_message_count: Number of scheduled messages. - :vartype scheduled_message_count: long + :vartype scheduled_message_count: int :ivar transfer_message_count: Number of messages transferred to another queue, topic, or subscription. - :vartype transfer_message_count: long + :vartype transfer_message_count: int :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. - :vartype transfer_dead_letter_message_count: long + :vartype transfer_dead_letter_message_count: int """ _validation = { - 'active_message_count': {'readonly': True}, - 'dead_letter_message_count': {'readonly': True}, - 'scheduled_message_count': {'readonly': True}, - 'transfer_message_count': {'readonly': True}, - 'transfer_dead_letter_message_count': {'readonly': True}, + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, } _attribute_map = { - 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, - 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, - 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, - 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, - 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MessageCountDetails, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.active_message_count = None self.dead_letter_message_count = None self.scheduled_message_count = None @@ -820,7 +785,7 @@ def __init__( self.transfer_dead_letter_message_count = None -class MigrationConfigListResult(msrest.serialization.Model): +class MigrationConfigListResult(_serialization.Model): """The result of the List migrationConfigurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -834,26 +799,21 @@ class MigrationConfigListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationConfigProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MigrationConfigProperties"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MigrationConfigProperties"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Migration Configs. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] """ - super(MigrationConfigListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None @@ -878,7 +838,7 @@ class MigrationConfigProperties(ProxyResource): :ivar provisioning_state: Provisioning state of Migration Configuration. :vartype provisioning_state: str :ivar pending_replication_operations_count: Number of entities pending to be replicated. - :vartype pending_replication_operations_count: long + :vartype pending_replication_operations_count: int :ivar target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. :vartype target_namespace: str @@ -890,36 +850,32 @@ class MigrationConfigProperties(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pending_replication_operations_count': {'readonly': True}, - 'migration_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "migration_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, - 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, - 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, - 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "target_namespace": {"key": "properties.targetNamespace", "type": "str"}, + "post_migration_name": {"key": "properties.postMigrationName", "type": "str"}, + "migration_state": {"key": "properties.migrationState", "type": "str"}, } def __init__( - self, - *, - target_namespace: Optional[str] = None, - post_migration_name: Optional[str] = None, - **kwargs - ): + self, *, target_namespace: Optional[str] = None, post_migration_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration. @@ -927,7 +883,7 @@ def __init__( :keyword post_migration_name: Name to access Standard Namespace after migration. :paramtype post_migration_name: str """ - super(MigrationConfigProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.provisioning_state = None self.pending_replication_operations_count = None @@ -956,7 +912,8 @@ class NetworkRuleSet(ProxyResource): :ivar trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. :vartype trusted_service_access_enabled: bool - :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow", "Deny". + :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". :vartype default_action: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.DefaultAction :ivar virtual_network_rules: List VirtualNetwork Rules. :vartype virtual_network_rules: @@ -964,30 +921,30 @@ class NetworkRuleSet(ProxyResource): :ivar ip_rules: List of IpRules. :vartype ip_rules: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.NWRuleSetIpRules] :ivar public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled". Default value: "Enabled". + default it is enabled. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.PublicNetworkAccessFlag """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'trusted_service_access_enabled': {'key': 'properties.trustedServiceAccessEnabled', 'type': 'bool'}, - 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, - 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "trusted_service_access_enabled": {"key": "properties.trustedServiceAccessEnabled", "type": "bool"}, + "default_action": {"key": "properties.defaultAction", "type": "str"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[NWRuleSetVirtualNetworkRules]"}, + "ip_rules": {"key": "properties.ipRules", "type": "[NWRuleSetIpRules]"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, } def __init__( @@ -997,14 +954,14 @@ def __init__( default_action: Optional[Union[str, "_models.DefaultAction"]] = None, virtual_network_rules: Optional[List["_models.NWRuleSetVirtualNetworkRules"]] = None, ip_rules: Optional[List["_models.NWRuleSetIpRules"]] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccessFlag"]] = "Enabled", - **kwargs - ): + public_network_access: Union[str, "_models.PublicNetworkAccessFlag"] = "Enabled", + **kwargs: Any + ) -> None: """ :keyword trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. :paramtype trusted_service_access_enabled: bool - :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow", + :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow" and "Deny". :paramtype default_action: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.DefaultAction @@ -1014,11 +971,11 @@ def __init__( :keyword ip_rules: List of IpRules. :paramtype ip_rules: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.NWRuleSetIpRules] :keyword public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled". Default value: "Enabled". + default it is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.PublicNetworkAccessFlag """ - super(NetworkRuleSet, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.trusted_service_access_enabled = trusted_service_access_enabled self.default_action = default_action @@ -1027,7 +984,7 @@ def __init__( self.public_network_access = public_network_access -class NetworkRuleSetListResult(msrest.serialization.Model): +class NetworkRuleSetListResult(_serialization.Model): """The response of the List NetworkRuleSet operation. :ivar value: Result of the List NetworkRuleSet operation. @@ -1038,17 +995,13 @@ class NetworkRuleSetListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NetworkRuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.NetworkRuleSet"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.NetworkRuleSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List NetworkRuleSet operation. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet] @@ -1056,44 +1009,44 @@ def __init__( list of NetworkRuleSet. :paramtype next_link: str """ - super(NetworkRuleSetListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class NWRuleSetIpRules(msrest.serialization.Model): +class NWRuleSetIpRules(_serialization.Model): """Description of NetWorkRuleSet - IpRules resource. :ivar ip_mask: IP Mask. :vartype ip_mask: str - :ivar action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :ivar action: The IP Filter Action. "Allow" :vartype action: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleIPAction """ _attribute_map = { - 'ip_mask': {'key': 'ipMask', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, + "ip_mask": {"key": "ipMask", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "_models.NetworkRuleIPAction"]] = "Allow", - **kwargs - ): + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: """ :keyword ip_mask: IP Mask. :paramtype ip_mask: str - :keyword action: The IP Filter Action. Known values are: "Allow". Default value: "Allow". + :keyword action: The IP Filter Action. "Allow" :paramtype action: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleIPAction """ - super(NWRuleSetIpRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_mask = ip_mask self.action = action -class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): +class NWRuleSetVirtualNetworkRules(_serialization.Model): """Description of VirtualNetworkRules - NetworkRules resource. :ivar subnet: Subnet properties. @@ -1104,8 +1057,8 @@ class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): """ _attribute_map = { - 'subnet': {'key': 'subnet', 'type': 'Subnet'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + "subnet": {"key": "subnet", "type": "Subnet"}, + "ignore_missing_vnet_service_endpoint": {"key": "ignoreMissingVnetServiceEndpoint", "type": "bool"}, } def __init__( @@ -1113,8 +1066,8 @@ def __init__( *, subnet: Optional["_models.Subnet"] = None, ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet: Subnet properties. :paramtype subnet: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Subnet @@ -1122,12 +1075,12 @@ def __init__( VNet Service Endpoint. :paramtype ignore_missing_vnet_service_endpoint: bool """ - super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + super().__init__(**kwargs) self.subnet = subnet self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """A Service Bus REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1141,19 +1094,19 @@ class Operation(msrest.serialization.Model): :ivar origin: Origin of the operation. :vartype origin: str :ivar properties: Properties of the operation. - :vartype properties: any + :vartype properties: JSON """ _validation = { - 'name': {'readonly': True}, + "name": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, } def __init__( @@ -1162,9 +1115,9 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - properties: Optional[Any] = None, - **kwargs - ): + properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: """ :keyword is_data_action: Indicates whether the operation is a data action. :paramtype is_data_action: bool @@ -1173,9 +1126,9 @@ def __init__( :keyword origin: Origin of the operation. :paramtype origin: str :keyword properties: Properties of the operation. - :paramtype properties: any + :paramtype properties: JSON """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.is_data_action = is_data_action self.display = display @@ -1183,7 +1136,7 @@ def __init__( self.properties = properties -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """Operation display payload. Variables are only populated by the server, and will be ignored when sending a request. @@ -1199,34 +1152,31 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, } _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationDisplay, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None self.description = None -class OperationListResult(msrest.serialization.Model): - """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1238,27 +1188,23 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """PrivateEndpoint information. :ivar id: The ARM identifier for Private Endpoint. @@ -1266,20 +1212,15 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The ARM identifier for Private Endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id @@ -1306,28 +1247,31 @@ class PrivateEndpointConnection(ProxyResource): :vartype private_link_service_connection_state: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ConnectionState :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Known values - are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EndPointProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "ConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( @@ -1336,8 +1280,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.ConnectionState"] = None, provisioning_state: Optional[Union[str, "_models.EndPointProvisioningState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The Private Endpoint resource for this Connection. :paramtype private_endpoint: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpoint @@ -1345,18 +1289,18 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ConnectionState :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :paramtype provisioning_state: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EndPointProvisioningState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """Result of the list of all private endpoint connections operation. :ivar value: A collection of private endpoint connection resources. @@ -1367,8 +1311,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1376,8 +1320,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private endpoint connection resources. :paramtype value: @@ -1385,12 +1329,12 @@ def __init__( :keyword next_link: A link for the next page of private endpoint connection resources. :paramtype next_link: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """Information of the private link resource. :ivar id: Fully qualified identifier of the resource. @@ -1408,25 +1352,25 @@ class PrivateLinkResource(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified identifier of the resource. :paramtype id: str @@ -1441,7 +1385,7 @@ def __init__( :keyword required_zone_names: Required Zone Names. :paramtype required_zone_names: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -1450,7 +1394,7 @@ def __init__( self.required_zone_names = required_zone_names -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """Result of the List private link resources operation. :ivar value: A collection of private link resources. @@ -1460,8 +1404,8 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1469,25 +1413,26 @@ def __init__( *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A collection of private link resources. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateLinkResource] :keyword next_link: A link for the next page of private link resources. :paramtype next_link: str """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RegenerateAccessKeyParameters(msrest.serialization.Model): - """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. +class RegenerateAccessKeyParameters(_serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs + to be reset. All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :ivar key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :vartype key_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.KeyType :ivar key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key @@ -1496,35 +1441,29 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): """ _validation = { - 'key_type': {'required': True}, + "key_type": {"required": True}, } _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, + "key_type": {"key": "keyType", "type": "str"}, + "key": {"key": "key", "type": "str"}, } - def __init__( - self, - *, - key_type: Union[str, "_models.KeyType"], - key: Optional[str] = None, - **kwargs - ): + def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword key_type: Required. The access key to regenerate. Known values are: "PrimaryKey", + :keyword key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and "SecondaryKey". :paramtype key_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.KeyType :keyword key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :paramtype key: str """ - super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_type = key_type self.key = key -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource definition for other than namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -1538,24 +1477,20 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1574,38 +1509,32 @@ class ResourceNamespacePatch(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(ResourceNamespacePatch, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags @@ -1631,7 +1560,7 @@ class Rule(ProxyResource): message that have been matched by a filter expression. :vartype action: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Action :ivar filter_type: Filter type that is evaluated against a BrokeredMessage. Known values are: - "SqlFilter", "CorrelationFilter". + "SqlFilter" and "CorrelationFilter". :vartype filter_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.FilterType :ivar sql_filter: Properties of sqlFilter. :vartype sql_filter: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SqlFilter @@ -1641,23 +1570,23 @@ class Rule(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'action': {'key': 'properties.action', 'type': 'Action'}, - 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, - 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, - 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "action": {"key": "properties.action", "type": "Action"}, + "filter_type": {"key": "properties.filterType", "type": "str"}, + "sql_filter": {"key": "properties.sqlFilter", "type": "SqlFilter"}, + "correlation_filter": {"key": "properties.correlationFilter", "type": "CorrelationFilter"}, } def __init__( @@ -1667,14 +1596,14 @@ def __init__( filter_type: Optional[Union[str, "_models.FilterType"]] = None, sql_filter: Optional["_models.SqlFilter"] = None, correlation_filter: Optional["_models.CorrelationFilter"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. :paramtype action: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Action :keyword filter_type: Filter type that is evaluated against a BrokeredMessage. Known values - are: "SqlFilter", "CorrelationFilter". + are: "SqlFilter" and "CorrelationFilter". :paramtype filter_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.FilterType :keyword sql_filter: Properties of sqlFilter. :paramtype sql_filter: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SqlFilter @@ -1682,7 +1611,7 @@ def __init__( :paramtype correlation_filter: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CorrelationFilter """ - super(Rule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.action = action self.filter_type = filter_type @@ -1690,7 +1619,7 @@ def __init__( self.correlation_filter = correlation_filter -class RuleListResult(msrest.serialization.Model): +class RuleListResult(_serialization.Model): """The response of the List rule operation. :ivar value: Result of the List Rules operation. @@ -1701,17 +1630,13 @@ class RuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.Rule"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Rule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule] @@ -1719,7 +1644,7 @@ def __init__( list of rules. :paramtype next_link: str """ - super(RuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -1746,38 +1671,33 @@ class SBAuthorizationRule(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'rights': {'key': 'properties.rights', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "rights": {"key": "properties.rights", "type": "[str]"}, } - def __init__( - self, - *, - rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, - **kwargs - ): + def __init__(self, *, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, **kwargs: Any) -> None: """ :keyword rights: The rights associated with the rule. :paramtype rights: list[str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessRights] """ - super(SBAuthorizationRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.rights = rights -class SBAuthorizationRuleListResult(msrest.serialization.Model): +class SBAuthorizationRuleListResult(_serialization.Model): """The response to the List Namespace operation. :ivar value: Result of the List Authorization Rules operation. @@ -1788,8 +1708,8 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBAuthorizationRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( @@ -1797,8 +1717,8 @@ def __init__( *, value: Optional[List["_models.SBAuthorizationRule"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Result of the List Authorization Rules operation. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] @@ -1806,12 +1726,12 @@ def __init__( list of Authorization Rules. :paramtype next_link: str """ - super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBClientAffineProperties(msrest.serialization.Model): +class SBClientAffineProperties(_serialization.Model): """Properties specific to client affine subscriptions. :ivar client_id: Indicates the Client ID of the application that created the client-affine @@ -1826,9 +1746,9 @@ class SBClientAffineProperties(msrest.serialization.Model): """ _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'is_durable': {'key': 'isDurable', 'type': 'bool'}, - 'is_shared': {'key': 'isShared', 'type': 'bool'}, + "client_id": {"key": "clientId", "type": "str"}, + "is_durable": {"key": "isDurable", "type": "bool"}, + "is_shared": {"key": "isShared", "type": "bool"}, } def __init__( @@ -1837,8 +1757,8 @@ def __init__( client_id: Optional[str] = None, is_durable: Optional[bool] = None, is_shared: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: Indicates the Client ID of the application that created the client-affine subscription. @@ -1850,7 +1770,7 @@ def __init__( subscription is shared or not. :paramtype is_shared: bool """ - super(SBClientAffineProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.is_durable = is_durable self.is_shared = is_shared @@ -1869,46 +1789,40 @@ class TrackedResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags -class SBNamespace(TrackedResource): +class SBNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1921,9 +1835,9 @@ class SBNamespace(TrackedResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. The Geo-location where the resource lives. + :ivar location: The Geo-location where the resource lives. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSku @@ -1932,7 +1846,7 @@ class SBNamespace(TrackedResource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SystemData :ivar minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. - Known values are: "1.0", "1.1", "1.2". + Known values are: "1.0", "1.1", and "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.TlsVersion :ivar provisioning_state: Provisioning state of the namespace. @@ -1961,48 +1875,50 @@ class SBNamespace(TrackedResource): :ivar alternate_name: Alternate name for namespace. :vartype alternate_name: str :ivar public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled", "SecuredByPerimeter". Default - value: "Enabled". + default it is enabled. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". :vartype public_network_access: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "minimum_tls_version": {"key": "properties.minimumTlsVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, } def __init__( @@ -2018,20 +1934,20 @@ def __init__( private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, disable_local_auth: Optional[bool] = None, alternate_name: Optional[str] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", - **kwargs - ): + public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", + **kwargs: Any + ) -> None: """ - :keyword location: Required. The Geo-location where the resource lives. + :keyword location: The Geo-location where the resource lives. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSku :keyword identity: Properties of BYOK Identity description. :paramtype identity: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Identity :keyword minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. - Known values are: "1.0", "1.1", "1.2". + Known values are: "1.0", "1.1", and "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.TlsVersion :keyword zone_redundant: Enabling this property creates a Premium Service Bus Namespace in @@ -2048,12 +1964,11 @@ def __init__( :keyword alternate_name: Alternate name for namespace. :paramtype alternate_name: str :keyword public_network_access: This determines if traffic is allowed over public network. By - default it is enabled. Known values are: "Enabled", "Disabled", "SecuredByPerimeter". Default - value: "Enabled". + default it is enabled. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". :paramtype public_network_access: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.PublicNetworkAccess """ - super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.system_data = None @@ -2072,7 +1987,7 @@ def __init__( self.public_network_access = public_network_access -class SBNamespaceListResult(msrest.serialization.Model): +class SBNamespaceListResult(_serialization.Model): """The response of the List Namespace operation. :ivar value: Result of the List Namespace operation. @@ -2083,17 +1998,13 @@ class SBNamespaceListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBNamespace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBNamespace]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBNamespace"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBNamespace"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Namespace operation. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] @@ -2101,12 +2012,12 @@ def __init__( list of Namespaces. :paramtype next_link: str """ - super(SBNamespaceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBNamespaceUpdateParameters(ResourceNamespacePatch): +class SBNamespaceUpdateParameters(ResourceNamespacePatch): # pylint: disable=too-many-instance-attributes """Description of a namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2119,7 +2030,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: Properties of SKU. :vartype sku: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSku @@ -2150,35 +2061,38 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'service_bus_endpoint': {'readonly': True}, - 'metric_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SBSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, - 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, } def __init__( @@ -2192,12 +2106,12 @@ def __init__( private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, disable_local_auth: Optional[bool] = None, alternate_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: Properties of SKU. :paramtype sku: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSku @@ -2214,7 +2128,7 @@ def __init__( :keyword alternate_name: Alternate name for namespace. :paramtype alternate_name: str """ - super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity self.provisioning_state = None @@ -2229,7 +2143,7 @@ def __init__( self.alternate_name = alternate_name -class SBQueue(ProxyResource): +class SBQueue(ProxyResource): # pylint: disable=too-many-instance-attributes """Description of queue Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2256,9 +2170,9 @@ class SBQueue(ProxyResource): to this queue. :vartype accessed_at: ~datetime.datetime :ivar size_in_bytes: The size of the queue, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar message_count: The number of messages in the queue. - :vartype message_count: long + :vartype message_count: int :ivar lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. @@ -2268,7 +2182,7 @@ class SBQueue(ProxyResource): :vartype max_size_in_megabytes: int :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. - :vartype max_message_size_in_kilobytes: long + :vartype max_message_size_in_kilobytes: int :ivar requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :vartype requires_duplicate_detection: bool @@ -2290,7 +2204,7 @@ class SBQueue(ProxyResource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2311,50 +2225,53 @@ class SBQueue(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'count_details': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'message_count': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "message_count": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'max_message_size_in_kilobytes': {'key': 'properties.maxMessageSizeInKilobytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2373,8 +2290,8 @@ def __init__( enable_express: Optional[bool] = None, forward_to: Optional[str] = None, forward_dead_lettered_messages_to: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 @@ -2385,7 +2302,7 @@ def __init__( :paramtype max_size_in_megabytes: int :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. - :paramtype max_message_size_in_kilobytes: long + :paramtype max_message_size_in_kilobytes: int :keyword requires_duplicate_detection: A value indicating if this queue requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -2407,7 +2324,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2427,7 +2344,7 @@ def __init__( message. :paramtype forward_dead_lettered_messages_to: str """ - super(SBQueue, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.count_details = None self.created_at = None @@ -2453,7 +2370,7 @@ def __init__( self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to -class SBQueueListResult(msrest.serialization.Model): +class SBQueueListResult(_serialization.Model): """The response to the List Queues operation. :ivar value: Result of the List Queues operation. @@ -2464,17 +2381,13 @@ class SBQueueListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBQueue]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBQueue"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBQueue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Queues operation. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue] @@ -2482,19 +2395,19 @@ def __init__( list of queues. :paramtype next_link: str """ - super(SBQueueListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBSku(msrest.serialization.Model): +class SBSku(_serialization.Model): """SKU of the namespace. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :ivar name: Name of this SKU. Required. Known values are: "Basic", "Standard", and "Premium". :vartype name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.SkuName - :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", + :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", and "Premium". :vartype tier: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.SkuTier :ivar capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 @@ -2503,13 +2416,13 @@ class SBSku(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( @@ -2518,25 +2431,26 @@ def __init__( name: Union[str, "_models.SkuName"], tier: Optional[Union[str, "_models.SkuTier"]] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Required. Name of this SKU. Known values are: "Basic", "Standard", "Premium". + :keyword name: Name of this SKU. Required. Known values are: "Basic", "Standard", and + "Premium". :paramtype name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.SkuName :keyword tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", - "Premium". + and "Premium". :paramtype tier: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.SkuTier :keyword capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :paramtype capacity: int """ - super(SBSku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SBSubscription(ProxyResource): +class SBSubscription(ProxyResource): # pylint: disable=too-many-instance-attributes """Description of subscription resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2554,7 +2468,7 @@ class SBSubscription(ProxyResource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SystemData :ivar message_count: Number of messages. - :vartype message_count: long + :vartype message_count: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar accessed_at: Last time there was a receive request to this subscription. @@ -2585,7 +2499,7 @@ class SBSubscription(ProxyResource): :vartype max_delivery_count: int :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EntityStatus :ivar enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2606,46 +2520,52 @@ class SBSubscription(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'message_count': {'readonly': True}, - 'created_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "message_count": {"readonly": True}, + "created_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, - 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, - 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, - 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, - 'is_client_affine': {'key': 'properties.isClientAffine', 'type': 'bool'}, - 'client_affine_properties': {'key': 'properties.clientAffineProperties', 'type': 'SBClientAffineProperties'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + "is_client_affine": {"key": "properties.isClientAffine", "type": "bool"}, + "client_affine_properties": {"key": "properties.clientAffineProperties", "type": "SBClientAffineProperties"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, lock_duration: Optional[datetime.timedelta] = None, @@ -2662,8 +2582,8 @@ def __init__( forward_dead_lettered_messages_to: Optional[str] = None, is_client_affine: Optional[bool] = None, client_affine_properties: Optional["_models.SBClientAffineProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. @@ -2687,7 +2607,7 @@ def __init__( :paramtype max_delivery_count: int :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EntityStatus :keyword enable_batched_operations: Value that indicates whether server-side batched operations are enabled. @@ -2707,7 +2627,7 @@ def __init__( :paramtype client_affine_properties: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBClientAffineProperties """ - super(SBSubscription, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.message_count = None self.created_at = None @@ -2730,7 +2650,7 @@ def __init__( self.client_affine_properties = client_affine_properties -class SBSubscriptionListResult(msrest.serialization.Model): +class SBSubscriptionListResult(_serialization.Model): """The response to the List Subscriptions operation. :ivar value: Result of the List Subscriptions operation. @@ -2741,17 +2661,13 @@ class SBSubscriptionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBSubscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBSubscription"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBSubscription"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Subscriptions operation. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription] @@ -2759,12 +2675,12 @@ def __init__( list of subscriptions. :paramtype next_link: str """ - super(SBSubscriptionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SBTopic(ProxyResource): +class SBTopic(ProxyResource): # pylint: disable=too-many-instance-attributes """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2782,7 +2698,7 @@ class SBTopic(ProxyResource): :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SystemData :ivar size_in_bytes: Size of the topic, in bytes. - :vartype size_in_bytes: long + :vartype size_in_bytes: int :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2802,7 +2718,7 @@ class SBTopic(ProxyResource): :vartype max_size_in_megabytes: int :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today and default is 1024. - :vartype max_message_size_in_kilobytes: long + :vartype max_message_size_in_kilobytes: int :ivar requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :vartype requires_duplicate_detection: bool @@ -2814,7 +2730,7 @@ class SBTopic(ProxyResource): :vartype enable_batched_operations: bool :ivar status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :vartype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EntityStatus :ivar support_ordering: Value that indicates whether the topic supports ordering. :vartype support_ordering: bool @@ -2830,42 +2746,45 @@ class SBTopic(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'system_data': {'readonly': True}, - 'size_in_bytes': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - 'accessed_at': {'readonly': True}, - 'subscription_count': {'readonly': True}, - 'count_details': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "subscription_count": {"readonly": True}, + "count_details": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, - 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, - 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, - 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, - 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, - 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, - 'max_message_size_in_kilobytes': {'key': 'properties.maxMessageSizeInKilobytes', 'type': 'long'}, - 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, - 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, - 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, - 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, - 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, - 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, } def __init__( @@ -2882,8 +2801,8 @@ def __init__( auto_delete_on_idle: Optional[datetime.timedelta] = None, enable_partitioning: Optional[bool] = None, enable_express: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service @@ -2894,7 +2813,7 @@ def __init__( :paramtype max_size_in_megabytes: int :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today and default is 1024. - :paramtype max_message_size_in_kilobytes: long + :paramtype max_message_size_in_kilobytes: int :keyword requires_duplicate_detection: Value indicating if this topic requires duplicate detection. :paramtype requires_duplicate_detection: bool @@ -2906,7 +2825,7 @@ def __init__( :paramtype enable_batched_operations: bool :keyword status: Enumerates the possible values for the status of a messaging entity. Known values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", - "Deleting", "Renaming", "Unknown". + "Deleting", "Renaming", and "Unknown". :paramtype status: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.EntityStatus :keyword support_ordering: Value that indicates whether the topic supports ordering. :paramtype support_ordering: bool @@ -2920,7 +2839,7 @@ def __init__( topic holds a message in memory temporarily before writing it to persistent storage. :paramtype enable_express: bool """ - super(SBTopic, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.size_in_bytes = None self.created_at = None @@ -2941,7 +2860,7 @@ def __init__( self.enable_express = enable_express -class SBTopicListResult(msrest.serialization.Model): +class SBTopicListResult(_serialization.Model): """The response to the List Topics operation. :ivar value: Result of the List Topics operation. @@ -2952,17 +2871,13 @@ class SBTopicListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SBTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SBTopic]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.SBTopic"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + self, *, value: Optional[List["_models.SBTopic"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Result of the List Topics operation. :paramtype value: list[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic] @@ -2970,13 +2885,14 @@ def __init__( list of topics. :paramtype next_link: str """ - super(SBTopicListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class SqlFilter(msrest.serialization.Model): - """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. +class SqlFilter(_serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in + the pub/sub pipeline. :ivar sql_expression: The SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -2989,9 +2905,9 @@ class SqlFilter(msrest.serialization.Model): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -2999,9 +2915,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: The SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -3012,14 +2928,15 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.sql_expression = sql_expression self.compatibility_level = compatibility_level self.requires_preprocessing = requires_preprocessing class SqlRuleAction(Action): - """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + """Represents set of actions written in SQL language-based syntax that is performed against a + ServiceBus.Messaging.BrokeredMessage. :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. :vartype sql_expression: str @@ -3032,9 +2949,9 @@ class SqlRuleAction(Action): """ _attribute_map = { - 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, - 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, - 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, } def __init__( @@ -3042,9 +2959,9 @@ def __init__( *, sql_expression: Optional[str] = None, compatibility_level: Optional[int] = None, - requires_preprocessing: Optional[bool] = True, - **kwargs - ): + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: """ :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. :paramtype sql_expression: str @@ -3055,47 +2972,47 @@ def __init__( preprocessing. :paramtype requires_preprocessing: bool """ - super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + super().__init__( + sql_expression=sql_expression, + compatibility_level=compatibility_level, + requires_preprocessing=requires_preprocessing, + **kwargs + ) -class Subnet(msrest.serialization.Model): +class Subnet(_serialization.Model): """Properties supplied for Subnet. All required parameters must be populated in order to send to Azure. - :ivar id: Required. Resource ID of Virtual Network Subnet. + :ivar id: Resource ID of Virtual Network Subnet. Required. :vartype id: str """ _validation = { - 'id': {'required': True}, + "id": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: str, - **kwargs - ): + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Required. Resource ID of Virtual Network Subnet. + :keyword id: Resource ID of Virtual Network Subnet. Required. :paramtype id: str """ - super(Subnet, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -3103,7 +3020,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -3111,12 +3028,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -3128,13 +3045,13 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -3142,13 +3059,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -3157,7 +3074,7 @@ def __init__( self.last_modified_at = last_modified_at -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Recognized Dictionary value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3169,27 +3086,23 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(UserAssignedIdentity, self).__init__(**kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentityProperties(msrest.serialization.Model): +class UserAssignedIdentityProperties(_serialization.Model): """UserAssignedIdentityProperties. :ivar user_assigned_identity: ARM ID of user Identity selected for encryption. @@ -3197,18 +3110,13 @@ class UserAssignedIdentityProperties(msrest.serialization.Model): """ _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, } - def __init__( - self, - *, - user_assigned_identity: Optional[str] = None, - **kwargs - ): + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: ARM ID of user Identity selected for encryption. :paramtype user_assigned_identity: str """ - super(UserAssignedIdentityProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.user_assigned_identity = user_assigned_identity diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_service_bus_management_client_enums.py index b2b24765cf9f..3bbabd34856a 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_service_bus_management_client_enums.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/models/_service_bus_management_client_enums.py @@ -11,30 +11,31 @@ class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class DefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Default Action for Network Rule Set - """ + """Default Action for Network Rule Set.""" ALLOW = "Allow" DENY = "Deny" + class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Private Endpoint Connection. - """ + """Provisioning state of the Private Endpoint Connection.""" CREATING = "Creating" UPDATING = "Updating" @@ -43,9 +44,9 @@ class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" FAILED = "Failed" + class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Entity status. - """ + """Entity status.""" ACTIVE = "Active" DISABLED = "Disabled" @@ -57,114 +58,118 @@ class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENAMING = "Renaming" UNKNOWN = "Unknown" + class FilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Rule filter types - """ + """Rule filter types.""" SQL_FILTER = "SqlFilter" CORRELATION_FILTER = "CorrelationFilter" + class KeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enumerates the possible value of keySource for Encryption - """ + """Enumerates the possible value of keySource for Encryption.""" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" + class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The access key to regenerate. - """ + """The access key to regenerate.""" PRIMARY_KEY = "PrimaryKey" SECONDARY_KEY = "SecondaryKey" + class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity. - """ + """Type of managed service identity.""" SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" + class MigrationConfigurationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationConfigurationName.""" _DEFAULT = "$default" + class NetworkRuleIPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP Filter Action - """ + """The IP Filter Action.""" ALLOW = "Allow" + class PrivateLinkConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the connection. - """ + """Status of the connection.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ProvisioningStateDR(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' - or 'Succeeded' or 'Failed' + or 'Succeeded' or 'Failed'. """ ACCEPTED = "Accepted" SUCCEEDED = "Succeeded" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This determines if traffic is allowed over public network. By default it is enabled. - """ + """This determines if traffic is allowed over public network. By default it is enabled.""" ENABLED = "Enabled" DISABLED = "Disabled" SECURED_BY_PERIMETER = "SecuredByPerimeter" + class PublicNetworkAccessFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This determines if traffic is allowed over public network. By default it is enabled. - """ + """This determines if traffic is allowed over public network. By default it is enabled.""" ENABLED = "Enabled" DISABLED = "Disabled" + class RoleDisasterRecovery(str, Enum, metaclass=CaseInsensitiveEnumMeta): """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or - 'Secondary' + 'Secondary'. """ PRIMARY = "Primary" PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" SECONDARY = "Secondary" + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of this SKU. - """ + """Name of this SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The billing tier of this particular SKU. - """ + """The billing tier of this particular SKU.""" BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" + class TlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The minimum TLS version for the cluster to support, e.g. '1.2' - """ + """The minimum TLS version for the cluster to support, e.g. '1.2'.""" ONE0 = "1.0" ONE1 = "1.1" ONE2 = "1.2" + class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the reason for the unavailability of the service. - """ + """Specifies the reason for the unavailability of the service.""" NONE = "None" INVALID_NAME = "InvalidName" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/__init__.py index 5559ccd3746c..e5431803c533 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/__init__.py @@ -18,19 +18,20 @@ from ._subscriptions_operations import SubscriptionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'NamespacesOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'Operations', - 'DisasterRecoveryConfigsOperations', - 'MigrationConfigsOperations', - 'QueuesOperations', - 'TopicsOperations', - 'RulesOperations', - 'SubscriptionsOperations', + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py index 5a2ea424d9b8..90e6e8da5336 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,298 +27,275 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.ArmDisasterRecovery] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_break_pairing_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_fail_over_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - *, - json: Optional[_models.FailoverProperties] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - alias: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -325,34 +309,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -366,79 +353,76 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "alias": _SERIALIZER.url("alias", alias, 'str', max_length=50, min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_check_name_availability_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class DisasterRecoveryConfigsOperations: """ @@ -459,65 +443,68 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.ArmDisasterRecoveryListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.ArmDisasterRecovery"]: """Gets all Alias(Disaster Recovery configurations). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of - cls(response) + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecoveryListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecoveryListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -525,16 +512,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -545,49 +530,126 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, alias: str, parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", **kwargs: Any ) -> Optional[_models.ArmDisasterRecovery]: """Creates or updates a new Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ArmDisasterRecovery]] - - _json = self._serialize.body(parameters, 'ArmDisasterRecovery') + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -597,18 +659,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -618,67 +680,67 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """Deletes an Alias(Disaster Recovery configuration). - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -689,60 +751,60 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> _models.ArmDisasterRecovery: """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmDisasterRecovery, or the result of cls(response) + :return: ArmDisasterRecovery or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.ArmDisasterRecovery - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ArmDisasterRecovery] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -750,68 +812,68 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } @distributed_trace def break_pairing( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any ) -> None: """This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_break_pairing_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.break_pairing.metadata['url'], + template_url=self.break_pairing.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -822,50 +884,127 @@ def break_pairing( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - break_pairing.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing"} # type: ignore - + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } - @distributed_trace + @overload def fail_over( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, alias: str, parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Default value is None. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - - if parameters is not None: - _json = self._serialize.body(parameters, 'FailoverProperties') + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None request = build_fail_over_request( resource_group_name=resource_group_name, @@ -875,18 +1014,18 @@ def fail_over( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.fail_over.metadata['url'], + content=_content, + template_url=self.fail_over.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -897,72 +1036,78 @@ def fail_over( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - fail_over.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover"} # type: ignore - + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, alias=alias, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - alias=alias, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -970,16 +1115,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -990,48 +1133,50 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1039,18 +1184,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1058,52 +1202,55 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - alias: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param alias: The Disaster Recovery configuration name. + :param alias: The Disaster Recovery configuration name. Required. :type alias: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -1111,18 +1258,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1130,50 +1276,120 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def check_name_availability( self, resource_group_name: str, namespace_name: str, parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters to check availability of the given namespace name. + :param parameters: Parameters to check availability of the given namespace name. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] - - _json = self._serialize.body(parameters, 'CheckNameAvailability') + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( resource_group_name=resource_group_name, @@ -1182,18 +1398,18 @@ def check_name_availability( api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1201,12 +1417,13 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_migration_configs_operations.py index 88853ef0f315..33c41fd7f685 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_migration_configs_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,251 +29,257 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_and_start_migration_request_initial( +def build_create_and_start_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, - *, - json: Optional[_models.MigrationConfigProperties] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_complete_migration_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_revert_request( resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class MigrationConfigsOperations: """ @@ -287,65 +300,69 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.MigrationConfigListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationConfigProperties"]: """Gets all migrationConfigurations. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationConfigListResult or the result of + :return: An iterator like instance of either MigrationConfigProperties or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,16 +370,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -373,35 +388,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } def _create_and_start_migration_initial( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> Optional[_models.MigrationConfigProperties]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MigrationConfigProperties]] - - _json = self._serialize.body(parameters, 'MigrationConfigProperties') - - request = build_create_and_start_migration_request_initial( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, @@ -409,57 +435,146 @@ def _create_and_start_migration_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_and_start_migration_initial.metadata['url'], + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_and_start_migration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create_and_start_migration( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], - parameters: _models.MigrationConfigProperties, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any ) -> LROPoller[_models.MigrationConfigProperties]: """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName - :param parameters: Parameters required to create Migration Configuration. + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -472,114 +587,114 @@ def begin_create_and_start_migration( of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_and_start_migration_initial( # type: ignore + raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_and_start_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """Deletes a MigrationConfiguration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -590,61 +705,65 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def get( self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> _models.MigrationConfigProperties: """Retrieves Migration Config. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationConfigProperties, or the result of cls(response) + :return: MigrationConfigProperties or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigProperties - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MigrationConfigProperties] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,70 +771,74 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace def complete_migration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_complete_migration_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.complete_migration.metadata['url'], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,61 +849,65 @@ def complete_migration( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - complete_migration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade"} # type: ignore - + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } @distributed_trace def revert( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, namespace_name: str, - config_name: Union[str, "_models.MigrationConfigurationName"], + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any ) -> None: """This operation reverts Migration. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param config_name: The configuration name. Should always be "$default". + :param config_name: The configuration name. Should always be "$default". "$default" Required. :type config_name: str or ~azure.mgmt.servicebus.v2022_01_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( resource_group_name=resource_group_name, namespace_name=namespace_name, config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata['url'], + template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -791,5 +918,6 @@ def revert( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revert.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert"} # type: ignore - + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_namespaces_operations.py index 5ca6dab57a1b..470410ea3543 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_namespaces_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,651 +29,593 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespace] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.SBNamespaceUpdateParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - *, - json: Optional[_models.NetworkRuleSet] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_network_rule_set_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_network_rule_sets_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_request( - subscription_id: str, - *, - json: Optional[_models.CheckNameAvailability] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class NamespacesOperations: """ @@ -687,55 +636,63 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets all the available namespaces within the subscription, irrespective of the resource groups. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -743,16 +700,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -763,65 +718,70 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SBNamespaceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SBNamespace"]: """Gets the available namespaces within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBNamespaceListResult or the result of - cls(response) + :return: An iterator like instance of either SBNamespace or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespaceListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -829,16 +789,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -849,90 +807,107 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } def _create_or_update_initial( - self, - resource_group_name: str, - namespace_name: str, - parameters: _models.SBNamespace, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] - - _json = self._serialize.body(parameters, 'SBNamespace') - - request = build_create_or_update_request_initial( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, namespace_name: str, parameters: _models.SBNamespace, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SBNamespace]: """Creates or updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to create a namespace resource. + :param parameters: Parameters supplied to create a namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -945,121 +920,193 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing namespace. This operation also removes all associated resources under the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1071,103 +1118,101 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> _models.SBNamespace: + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: """Gets a description for the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBNamespace] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1175,51 +1220,124 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( self, resource_group_name: str, namespace_name: str, - parameters: _models.SBNamespaceUpdateParameters, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.SBNamespace]: """Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: Parameters supplied to update a namespace resource. + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBNamespace, or the result of cls(response) + :return: SBNamespace or None or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBNamespace or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.SBNamespace]] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") request = build_update_request( resource_group_name=resource_group_name, @@ -1228,18 +1346,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -1249,53 +1367,123 @@ def update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SBNamespace', pipeline_response) + deserialized = self._deserialize("SBNamespace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"} # type: ignore - + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } - @distributed_trace + @overload def create_or_update_network_rule_set( self, resource_group_name: str, namespace_name: str, parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.NetworkRuleSet: """Create or update NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param parameters: The Namespace IpFilterRule. + :param parameters: The Namespace IpFilterRule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'NetworkRuleSet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") request = build_create_or_update_network_rule_set_request( resource_group_name=resource_group_name, @@ -1304,18 +1492,18 @@ def create_or_update_network_rule_set( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_network_rule_set.metadata['url'], + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1323,63 +1511,64 @@ def create_or_update_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def get_network_rule_set( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.NetworkRuleSet: """Gets NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) + :return: NetworkRuleSet or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSet] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) - request = build_get_network_rule_set_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_network_rule_set.metadata['url'], + template_url=self.get_network_rule_set.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1387,74 +1576,79 @@ def get_network_rule_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_network_rule_set.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"} # type: ignore - + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } @distributed_trace def list_network_rule_sets( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.NetworkRuleSetListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkRuleSet"]: """Gets list of NetworkRuleSet for a Namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkRuleSetListResult or the result of - cls(response) + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.NetworkRuleSetListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_network_rule_sets_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_network_rule_sets.metadata['url'], + template_url=self.list_network_rule_sets.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_network_rule_sets_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1462,16 +1656,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1482,70 +1674,77 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_network_rule_sets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets"} # type: ignore + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets the authorization rules for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1553,16 +1752,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1573,49 +1770,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates or updates an authorization rule for a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -1625,18 +1906,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1644,67 +1925,70 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> None: """Deletes a namespace authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1715,60 +1999,63 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a namespace by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1776,67 +2063,70 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( - self, - resource_group_name: str, - namespace_name: str, - authorization_rule_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1844,54 +2134,140 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings for the namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -1901,18 +2277,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1920,62 +2296,110 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_name_availability( - self, - parameters: _models.CheckNameAvailability, - **kwargs: Any + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityResult: """Check the give namespace name availability. - :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult, or the result of cls(response) + :return: CheckNameAvailabilityResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.CheckNameAvailabilityResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'CheckNameAvailability') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1983,12 +2407,13 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability"} # type: ignore - + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_operations.py index c63bde8af450..f934a4930031 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +27,40 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class Operations: """ @@ -72,52 +81,59 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,16 +141,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,8 +159,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ServiceBus/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_patch.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_endpoint_connections_operations.py index f7b46b8fcdbf..5688dd1b77f6 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,134 +29,140 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, namespace_name: str, - subscription_id: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -162,33 +175,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateEndpointConnectionsOperations: """ @@ -209,65 +226,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any - ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result - of cls(response) + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -275,16 +299,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,71 +317,157 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to - namespace resource. + namespace resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -368,86 +476,87 @@ def create_or_update( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an existing Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -459,108 +568,107 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -568,12 +676,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_link_resources_operations.py index 890123c2a613..a21d0233d3de 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_private_link_resources_operations.py @@ -6,11 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +25,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - resource_group_name: str, - namespace_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class PrivateLinkResourcesOperations: """ @@ -81,54 +93,56 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets lists of resources that supports Privatelinks. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,12 +150,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_queues_operations.py index 05c04c8b4fc5..4e099a22c87c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_queues_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -126,34 +135,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -167,34 +179,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( queue_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - *, - json: Optional[_models.SBQueue] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - queue_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class QueuesOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets all authorization rules for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - queue_name=queue_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,119 @@ def create_or_update_authorization_rule( queue_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for a queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +708,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +727,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -661,31 +749,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a queue authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +788,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -715,8 +809,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -729,31 +824,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Gets an authorization rule for a queue by rule name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -761,18 +863,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,15 +881,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +903,38 @@ def list_keys( ) -> _models.AccessKeys: """Primary and secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +942,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +960,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +979,130 @@ def regenerate_keys( queue_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates the primary or secondary connection strings to the queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1113,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1132,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1151,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBQueueListResult]: + ) -> Iterable["_models.SBQueue"]: """Gets the queues within a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1169,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueueListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueueListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1228,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBQueueListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1246,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, queue_name: str, parameters: _models.SBQueue, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBQueue: """Creates or updates a Service Bus queue. This operation is idempotent. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str - :param parameters: Parameters supplied to create or update a queue resource. + :param parameters: Parameters supplied to create or update a queue resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBQueue') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1382,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1401,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any ) -> None: """Deletes a queue from the specified namespace in a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1475,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - queue_name: str, - **kwargs: Any - ) -> _models.SBQueue: + def get(self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any) -> _models.SBQueue: """Returns a description for the specified queue. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param queue_name: The queue name. + :param queue_name: The queue name. Required. :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBQueue, or the result of cls(response) + :return: SBQueue or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBQueue - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBQueue] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, queue_name=queue_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1537,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBQueue', pipeline_response) + deserialized = self._deserialize("SBQueue", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_rules_operations.py index 2a90c85ff18e..74a809d2caf5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_rules_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_subscriptions_request( resource_group_name: str, namespace_name: str, @@ -41,38 +55,39 @@ def build_list_by_subscriptions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -82,48 +97,44 @@ def build_create_or_update_request( subscription_name: str, rule_name: str, subscription_id: str, - *, - json: Optional[_models.Rule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -138,35 +149,36 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -181,35 +193,37 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class RulesOperations: """ @@ -230,7 +244,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_subscriptions( self, @@ -241,16 +254,16 @@ def list_by_subscriptions( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.RuleListResult]: + ) -> Iterable["_models.Rule"]: """List all the rules within given topic-subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -260,57 +273,60 @@ def list_by_subscriptions( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscriptions_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_name=subscription_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_subscriptions.metadata['url'], + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_subscriptions_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_name=subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -318,16 +334,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -338,13 +352,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_subscriptions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules"} # type: ignore + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -353,40 +367,127 @@ def create_or_update( subscription_name: str, rule_name: str, parameters: _models.Rule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Rule: """Creates a new rule and updates an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str - :param parameters: Parameters supplied to create a rule. + :param parameters: Parameters supplied to create a rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -398,18 +499,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -417,15 +518,16 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -439,33 +541,37 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes an existing rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -474,18 +580,17 @@ def delete( # pylint: disable=inconsistent-return-statements rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -496,8 +601,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } @distributed_trace def get( @@ -511,33 +617,37 @@ def get( ) -> _models.Rule: """Retrieves the description for the specified rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param rule_name: The rule name. + :param rule_name: The rule name. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Rule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -546,18 +656,17 @@ def get( rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,12 +674,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_subscriptions_operations.py index 36d423236c75..8a54ecc93ac5 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_subscriptions_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +27,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_by_topic_request( resource_group_name: str, namespace_name: str, @@ -40,37 +54,38 @@ def build_list_by_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( @@ -79,47 +94,43 @@ def build_create_or_update_request( topic_name: str, subscription_name: str, subscription_id: str, - *, - json: Optional[_models.SBSubscription] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( @@ -133,34 +144,35 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -174,34 +186,36 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class SubscriptionsOperations: """ @@ -222,7 +236,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_topic( self, @@ -232,14 +245,17 @@ def list_by_topic( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBSubscriptionListResult]: + ) -> Iterable["_models.SBSubscription"]: """List all the subscriptions under a specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -249,56 +265,60 @@ def list_by_topic( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBSubscriptionListResult or the result of - cls(response) + :return: An iterator like instance of either SBSubscription or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscriptionListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_topic_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_topic.metadata['url'], + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_topic_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -306,16 +326,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -326,13 +344,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_topic.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions"} # type: ignore + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, @@ -340,38 +358,128 @@ def create_or_update( topic_name: str, subscription_name: str, parameters: _models.SBSubscription, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBSubscription: """Creates a topic subscription. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str - :param parameters: Parameters supplied to create a subscription resource. + :param parameters: Parameters supplied to create a subscription resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBSubscription') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -382,18 +490,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,52 +509,55 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> None: """Deletes a subscription from the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -454,18 +565,17 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -476,45 +586,48 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } @distributed_trace def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any ) -> _models.SBSubscription: """Returns a subscription description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param subscription_name: The subscription name. + :param subscription_name: The subscription name. Required. :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBSubscription, or the result of cls(response) + :return: SBSubscription or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBSubscription - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBSubscription] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -522,18 +635,17 @@ def get( subscription_name=subscription_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,12 +653,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBSubscription', pipeline_response) + deserialized = self._deserialize("SBSubscription", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_topics_operations.py index b22c057aba16..06b25877529b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_01_01_preview/operations/_topics_operations.py @@ -6,11 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,50 +27,54 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_authorization_rules_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_authorization_rule_request( @@ -72,47 +83,45 @@ def build_create_or_update_authorization_rule_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.SBAuthorizationRule] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_authorization_rule_request( @@ -126,34 +135,37 @@ def build_get_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_authorization_rule_request( @@ -167,34 +179,37 @@ def build_delete_authorization_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( @@ -208,34 +223,37 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_regenerate_keys_request( @@ -244,47 +262,45 @@ def build_regenerate_keys_request( topic_name: str, authorization_rule_name: str, subscription_id: str, - *, - json: Optional[_models.RegenerateAccessKeyParameters] = None, - content: Any = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_namespace_request( @@ -299,161 +315,149 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if skip is not None: - _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', maximum=1000, minimum=0) + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int', maximum=1000, minimum=1) + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - *, - json: Optional[_models.SBTopic] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - namespace_name: str, - topic_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - "topicName": _SERIALIZER.url("topic_name", topic_name, 'str', min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class TopicsOperations: """ @@ -474,70 +478,74 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_authorization_rules( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> Iterable[_models.SBAuthorizationRuleListResult]: + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: """Gets authorization rules for a topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of - cls(response) + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRuleListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_authorization_rules_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_authorization_rules.metadata['url'], + template_url=self.list_authorization_rules.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_authorization_rules_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - topic_name=topic_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -545,16 +553,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,13 +571,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_authorization_rules.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules"} # type: ignore + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } - @distributed_trace + @overload def create_or_update_authorization_rule( self, resource_group_name: str, @@ -579,38 +585,128 @@ def create_or_update_authorization_rule( topic_name: str, authorization_rule_name: str, parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBAuthorizationRule: """Creates an authorization rule for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: The shared access authorization rule. + :param parameters: The shared access authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBAuthorizationRule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") request = build_create_or_update_authorization_rule_request( resource_group_name=resource_group_name, @@ -621,18 +717,18 @@ def create_or_update_authorization_rule( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update_authorization_rule.metadata['url'], + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,15 +736,16 @@ def create_or_update_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def get_authorization_rule( @@ -661,31 +758,38 @@ def get_authorization_rule( ) -> _models.SBAuthorizationRule: """Returns the specified authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBAuthorizationRule, or the result of cls(response) + :return: SBAuthorizationRule or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBAuthorizationRule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBAuthorizationRule] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) - request = build_get_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -693,18 +797,17 @@ def get_authorization_rule( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_authorization_rule.metadata['url'], + template_url=self.get_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,15 +815,16 @@ def get_authorization_rule( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def delete_authorization_rule( # pylint: disable=inconsistent-return-statements @@ -733,31 +837,38 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a topic authorization rule. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_authorization_rule_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -765,18 +876,17 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_authorization_rule.metadata['url'], + template_url=self.delete_authorization_rule.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -787,8 +897,9 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_authorization_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"} # type: ignore - + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } @distributed_trace def list_keys( @@ -801,31 +912,38 @@ def list_keys( ) -> _models.AccessKeys: """Gets the primary and secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( resource_group_name=resource_group_name, namespace_name=namespace_name, @@ -833,18 +951,17 @@ def list_keys( authorization_rule_name=authorization_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata['url'], + template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -852,17 +969,18 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys"} # type: ignore - + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } - @distributed_trace + @overload def regenerate_keys( self, resource_group_name: str, @@ -870,39 +988,130 @@ def regenerate_keys( topic_name: str, authorization_rule_name: str, parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.AccessKeys: """Regenerates primary or secondary connection strings for the topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param authorization_rule_name: The authorization rule name. + :param authorization_rule_name: The authorization rule name. Required. :type authorization_rule_name: str - :param parameters: Parameters supplied to regenerate the authorization rule. + :param parameters: Parameters supplied to regenerate the authorization rule. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccessKeys, or the result of cls(response) + :return: AccessKeys or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_01_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AccessKeys] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") request = build_regenerate_keys_request( resource_group_name=resource_group_name, @@ -913,18 +1122,18 @@ def regenerate_keys( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_keys.metadata['url'], + content=_content, + template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -932,15 +1141,16 @@ def regenerate_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AccessKeys', pipeline_response) + deserialized = self._deserialize("AccessKeys", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys"} # type: ignore - + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } @distributed_trace def list_by_namespace( @@ -950,12 +1160,15 @@ def list_by_namespace( skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable[_models.SBTopicListResult]: + ) -> Iterable["_models.SBTopic"]: """Gets all the topics in a namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str :param skip: Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip @@ -965,53 +1178,58 @@ def list_by_namespace( Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopicListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopicListResult] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_namespace_request( resource_group_name=resource_group_name, namespace_name=namespace_name, subscription_id=self._config.subscription_id, - api_version=api_version, skip=skip, top=top, - template_url=self.list_by_namespace.metadata['url'], + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: - - request = build_list_by_namespace_request( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - top=top, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1019,16 +1237,14 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SBTopicListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1039,49 +1255,133 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_namespace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics"} # type: ignore + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, namespace_name: str, topic_name: str, parameters: _models.SBTopic, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.SBTopic: """Creates a topic in the specified namespace. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str - :param parameters: Parameters supplied to create a topic resource. + :param parameters: Parameters supplied to create a topic resource. Required. :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - _json = self._serialize.body(parameters, 'SBTopic') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -1091,18 +1391,18 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1110,67 +1410,70 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any ) -> None: """Deletes a topic from the specified namespace and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1181,60 +1484,61 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } @distributed_trace - def get( - self, - resource_group_name: str, - namespace_name: str, - topic_name: str, - **kwargs: Any - ) -> _models.SBTopic: + def get(self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any) -> _models.SBTopic: """Returns a description for the specified topic. - :param resource_group_name: Name of the Resource group within the Azure subscription. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param namespace_name: The namespace name. + :param namespace_name: The namespace name. Required. :type namespace_name: str - :param topic_name: The topic name. + :param topic_name: The topic name. Required. :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SBTopic, or the result of cls(response) + :return: SBTopic or the result of cls(response) :rtype: ~azure.mgmt.servicebus.v2022_01_01_preview.models.SBTopic - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SBTopic] + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) - request = build_get_request( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,12 +1546,13 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SBTopic', pipeline_response) + deserialized = self._deserialize("SBTopic", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"} # type: ignore - + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/__init__.py new file mode 100644 index 000000000000..2e171d69863b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ServiceBusManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_configuration.py new file mode 100644 index 000000000000..5c1e9bc57c1a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import sys +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + api_version: Literal["2022-10-01-preview"] = kwargs.pop("api_version", "2022-10-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_metadata.json new file mode 100644 index 000000000000..b5b1a0fc870e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_metadata.json @@ -0,0 +1,119 @@ +{ + "chosen_version": "2022-10-01-preview", + "total_api_version_list": ["2022-10-01-preview"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client for managing Namespace.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "namespaces": "NamespacesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "migration_configs": "MigrationConfigsOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "rules": "RulesOperations", + "subscriptions": "SubscriptionsOperations" + } +} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_service_bus_management_client.py new file mode 100644 index 000000000000..3de7b97f1631 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_service_bus_management_client.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Azure Service Bus client for managing Namespace. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2022_10_01_preview.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.servicebus.v2022_10_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.servicebus.v2022_10_01_preview.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2022_10_01_preview.operations.Operations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: + azure.mgmt.servicebus.v2022_10_01_preview.operations.DisasterRecoveryConfigsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: + azure.mgmt.servicebus.v2022_10_01_preview.operations.MigrationConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2022_10_01_preview.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2022_10_01_preview.operations.TopicsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2022_10_01_preview.operations.RulesOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: + azure.mgmt.servicebus.v2022_10_01_preview.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "ServiceBusManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_vendor.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_vendor.py new file mode 100644 index 000000000000..bd0df84f5319 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_vendor.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import List, cast + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_version.py new file mode 100644 index 000000000000..d5f3055d6eb4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "8.2.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/__init__.py new file mode 100644 index 000000000000..530b8638dfd3 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ServiceBusManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..42689d898ec1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import sys +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ServiceBusManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + api_version: Literal["2022-10-01-preview"] = kwargs.pop("api_version", "2022-10-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-servicebus/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_service_bus_management_client.py new file mode 100644 index 000000000000..c4570cf9ae90 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/_service_bus_management_client.py @@ -0,0 +1,144 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import ( + DisasterRecoveryConfigsOperations, + MigrationConfigsOperations, + NamespacesOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QueuesOperations, + RulesOperations, + SubscriptionsOperations, + TopicsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ServiceBusManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Azure Service Bus client for managing Namespace. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: + azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.Operations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: + azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.DisasterRecoveryConfigsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: + azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.MigrationConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.TopicsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.RulesOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: + azure.mgmt.servicebus.v2022_10_01_preview.aio.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ServiceBusManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.queues = QueuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..e5431803c533 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/__init__.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._rules_operations import RulesOperations +from ._subscriptions_operations import SubscriptionsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..b1f0bf4bceb6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,1055 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._disaster_recovery_configs_operations import ( + build_break_pairing_request, + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_fail_over_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_keys_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DisasterRecoveryConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`disaster_recovery_configs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecovery"]: + """Gets all Alias(Disaster Recovery configurations). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> _models.ArmDisasterRecovery: + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } + + @distributed_trace_async + async def break_pairing( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_break_pairing_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.break_pairing.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } + + @overload + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None + + request = build_fail_over_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.fail_over.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: + """Gets the authorization rules for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } + + @distributed_trace_async + async def get_authorization_rule( + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Gets an authorization rule for a namespace by rule name. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def list_keys( + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.AccessKeys: + """Gets the primary and secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_migration_configs_operations.py new file mode 100644 index 000000000000..615a3c431877 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_migration_configs_operations.py @@ -0,0 +1,690 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._migration_configs_operations import ( + build_complete_migration_request, + build_create_and_start_migration_request, + build_delete_request, + build_get_request, + build_list_request, + build_revert_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MigrationConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`migration_configs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigProperties"]: + """Gets all migrationConfigurations. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigProperties or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" + } + + async def _create_and_start_migration_initial( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], + **kwargs: Any + ) -> Optional[_models.MigrationConfigProperties]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationConfigProperties") + + request = build_create_and_start_migration_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_and_start_migration_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + **kwargs: Any + ) -> None: + """Deletes a MigrationConfiguration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + **kwargs: Any + ) -> _models.MigrationConfigProperties: + """Retrieves Migration Config. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } + + @distributed_trace_async + async def complete_migration( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + **kwargs: Any + ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_complete_migration_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.complete_migration.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" + } + + @distributed_trace_async + async def revert( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + **kwargs: Any + ) -> None: + """This operation reverts Migration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_revert_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.revert.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..9afd7eabe01a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_namespaces_operations.py @@ -0,0 +1,1860 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._namespaces_operations import ( + build_check_name_availability_request, + build_create_or_update_authorization_rule_request, + build_create_or_update_network_rule_set_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_network_rule_set_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_resource_group_request, + build_list_keys_request, + build_list_network_rule_sets_request, + build_list_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NamespacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`namespaces` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SBNamespace"]: + """Gets the available namespaces within a resource group. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } + + async def _create_or_update_initial( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> Optional[_models.SBNamespace]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SBNamespace", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + namespace_name=namespace_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: + """Gets a description for the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") + + request = build_create_or_update_network_rule_set_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } + + @distributed_trace_async + async def get_network_rule_set( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> _models.NetworkRuleSet: + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) + + request = build_get_network_rule_set_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_network_rule_set.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } + + @distributed_trace + def list_network_rule_sets( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSet"]: + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_network_rule_sets_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_network_rule_sets.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: + """Gets the authorization rules for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def get_authorization_rule( + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Gets an authorization rule for a namespace by rule name. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def list_keys( + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.AccessKeys: + """Gets the primary and secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_operations.py similarity index 83% rename from sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_operations.py index e5aa635128f9..0ec9a8c9c049 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_operations.py @@ -28,8 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request -from .._vendor import WorkloadsClientMixinABC +from ...operations._operations import build_list_request if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -39,14 +38,14 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SkusOperations: +class Operations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s - :attr:`skus` attribute. + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`operations` attribute. """ models = _models @@ -59,21 +58,22 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuDefinition"]: - """Lists all the available SKUs under this PR. + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SkuDefinition or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SkuDefinition] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[_models.SkusListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -87,7 +87,6 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -115,7 +114,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("SkusListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -138,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/skus"} + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_private_endpoint_connections_operations.py similarity index 60% rename from sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_private_endpoint_connections_operations.py index 7fc7213fbb3d..c15dddfd42e3 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -31,13 +31,12 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._wordpress_instances_operations import ( +from ...operations._private_endpoint_connections_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) -from .._vendor import WorkloadsClientMixinABC if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -47,14 +46,14 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class WordpressInstancesOperations: +class PrivateEndpointConnectionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s - :attr:`wordpress_instances` attribute. + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models @@ -68,29 +67,31 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list( - self, resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WordpressInstanceResource"]: - """Lists WordPress instance resources under a phpWorkload resource. + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WordpressInstanceResource or the result of + :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.WordpressInstanceResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[_models.WordpressInstanceResourceList] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +106,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata["url"], @@ -134,7 +135,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("WordpressInstanceResourceList", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -158,23 +159,107 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" } + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def get( - self, resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> _models.WordpressInstanceResource: - """Gets the WordPress instance resource. + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: WordpressInstanceResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.WordpressInstanceResource + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -185,20 +270,33 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[_models.WordpressInstanceResource] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + request = build_create_or_update_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -211,29 +309,32 @@ async def get( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } - async def _create_or_update_initial( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: Union[_models.WordpressInstanceResource, IO], - **kwargs: Any - ) -> _models.WordpressInstanceResource: + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -242,32 +343,21 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WordpressInstanceResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(wordpress_instance_resource, (IO, bytes)): - _content = wordpress_instance_resource - else: - _json = self._serialize.body(wordpress_instance_resource, "WordpressInstanceResource") + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_create_or_update_request( + request = build_delete_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -280,121 +370,33 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: _models.WordpressInstanceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.WordpressInstanceResource]: - """Create or updated WordPress instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param wordpress_instance_resource: Resource create or update request payload. Required. - :type wordpress_instance_resource: ~azure.mgmt.workloads.models.WordpressInstanceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WordpressInstanceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.WordpressInstanceResource]: - """Create or updated WordPress instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param wordpress_instance_resource: Resource create or update request payload. Required. - :type wordpress_instance_resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WordpressInstanceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: Union[_models.WordpressInstanceResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.WordpressInstanceResource]: - """Create or updated WordPress instance resource. + async def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Private Endpoint Connection. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param wordpress_instance_resource: Resource create or update request payload. Is either a - model type or a IO type. Required. - :type wordpress_instance_resource: ~azure.mgmt.workloads.models.WordpressInstanceResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -403,30 +405,26 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WordpressInstanceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WordpressInstanceResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - wordpress_instance_resource=wordpress_instance_resource, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -434,17 +432,12 @@ async def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -458,24 +451,28 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> None: - """Delete WordPress instance resource. + async def get( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a description for the specified Private Endpoint Connection. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -489,17 +486,18 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_delete_request( + request = build_get_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -512,14 +510,18 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9a82da14bd81 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,124 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets lists of resources that supports Privatelinks. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateLinkResourcesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_queues_operations.py new file mode 100644 index 000000000000..c34bff91f456 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_queues_operations.py @@ -0,0 +1,1143 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._queues_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`queues` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: + """Gets all authorization rules for a queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Gets an authorization rule for a queue by rule name. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.AccessKeys: + """Primary and secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @distributed_trace + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBQueue"]: + """Gets the queues within a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_namespace_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBQueueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: _models.SBQueue, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBQueue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> _models.SBQueue: + """Returns a description for the specified queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBQueue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_rules_operations.py new file mode 100644 index 000000000000..070833d23c6c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_rules_operations.py @@ -0,0 +1,506 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._rules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscriptions_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`rules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Rule"]: + """List all the rules within given topic-subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscriptions_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: _models.Rule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Rule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> _models.Rule: + """Retrieves the description for the specified rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Rule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..f7a45b441040 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_subscriptions_operations.py @@ -0,0 +1,492 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_topic_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBSubscription"]: + """List all the subscriptions under a specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscription or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_topic_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: _models.SBSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any + ) -> _models.SBSubscription: + """Returns a subscription description for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_topics_operations.py new file mode 100644 index 000000000000..fb672225a8b0 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/aio/operations/_topics_operations.py @@ -0,0 +1,1152 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._topics_operations import ( + build_create_or_update_authorization_rule_request, + build_create_or_update_request, + build_delete_authorization_rule_request, + build_delete_request, + build_get_authorization_rule_request, + build_get_request, + build_list_authorization_rules_request, + build_list_by_namespace_request, + build_list_keys_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class TopicsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.aio.ServiceBusManagementClient`'s + :attr:`topics` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRule"]: + """Gets authorization rules for a topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Returns the specified authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace_async + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.AccessKeys: + """Gets the primary and secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @distributed_trace + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBTopic"]: + """Gets all the topics in a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_namespace_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SBTopicListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: _models.SBTopic, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBTopic", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> _models.SBTopic: + """Returns a description for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBTopic", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/__init__.py new file mode 100644 index 000000000000..7493507b42fe --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/__init__.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import AccessKeys +from ._models_py3 import Action +from ._models_py3 import ArmDisasterRecovery +from ._models_py3 import ArmDisasterRecoveryListResult +from ._models_py3 import CheckNameAvailability +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import ConnectionState +from ._models_py3 import CorrelationFilter +from ._models_py3 import Encryption +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseError +from ._models_py3 import FailoverProperties +from ._models_py3 import Identity +from ._models_py3 import KeyVaultProperties +from ._models_py3 import MessageCountDetails +from ._models_py3 import MigrationConfigListResult +from ._models_py3 import MigrationConfigProperties +from ._models_py3 import NWRuleSetIpRules +from ._models_py3 import NWRuleSetVirtualNetworkRules +from ._models_py3 import NetworkRuleSet +from ._models_py3 import NetworkRuleSetListResult +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourcesListResult +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateAccessKeyParameters +from ._models_py3 import Resource +from ._models_py3 import ResourceNamespacePatch +from ._models_py3 import Rule +from ._models_py3 import RuleListResult +from ._models_py3 import SBAuthorizationRule +from ._models_py3 import SBAuthorizationRuleListResult +from ._models_py3 import SBClientAffineProperties +from ._models_py3 import SBNamespace +from ._models_py3 import SBNamespaceListResult +from ._models_py3 import SBNamespaceUpdateParameters +from ._models_py3 import SBQueue +from ._models_py3 import SBQueueListResult +from ._models_py3 import SBSku +from ._models_py3 import SBSubscription +from ._models_py3 import SBSubscriptionListResult +from ._models_py3 import SBTopic +from ._models_py3 import SBTopicListResult +from ._models_py3 import SqlFilter +from ._models_py3 import SqlRuleAction +from ._models_py3 import Subnet +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedIdentityProperties + +from ._service_bus_management_client_enums import AccessRights +from ._service_bus_management_client_enums import CreatedByType +from ._service_bus_management_client_enums import DefaultAction +from ._service_bus_management_client_enums import EndPointProvisioningState +from ._service_bus_management_client_enums import EntityStatus +from ._service_bus_management_client_enums import FilterType +from ._service_bus_management_client_enums import KeyType +from ._service_bus_management_client_enums import ManagedServiceIdentityType +from ._service_bus_management_client_enums import MigrationConfigurationName +from ._service_bus_management_client_enums import NetworkRuleIPAction +from ._service_bus_management_client_enums import PrivateLinkConnectionStatus +from ._service_bus_management_client_enums import ProvisioningStateDR +from ._service_bus_management_client_enums import PublicNetworkAccess +from ._service_bus_management_client_enums import PublicNetworkAccessFlag +from ._service_bus_management_client_enums import RoleDisasterRecovery +from ._service_bus_management_client_enums import SkuName +from ._service_bus_management_client_enums import SkuTier +from ._service_bus_management_client_enums import TlsVersion +from ._service_bus_management_client_enums import UnavailableReason +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccessKeys", + "Action", + "ArmDisasterRecovery", + "ArmDisasterRecoveryListResult", + "CheckNameAvailability", + "CheckNameAvailabilityResult", + "ConnectionState", + "CorrelationFilter", + "Encryption", + "ErrorAdditionalInfo", + "ErrorResponse", + "ErrorResponseError", + "FailoverProperties", + "Identity", + "KeyVaultProperties", + "MessageCountDetails", + "MigrationConfigListResult", + "MigrationConfigProperties", + "NWRuleSetIpRules", + "NWRuleSetVirtualNetworkRules", + "NetworkRuleSet", + "NetworkRuleSetListResult", + "Operation", + "OperationDisplay", + "OperationListResult", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "ProxyResource", + "RegenerateAccessKeyParameters", + "Resource", + "ResourceNamespacePatch", + "Rule", + "RuleListResult", + "SBAuthorizationRule", + "SBAuthorizationRuleListResult", + "SBClientAffineProperties", + "SBNamespace", + "SBNamespaceListResult", + "SBNamespaceUpdateParameters", + "SBQueue", + "SBQueueListResult", + "SBSku", + "SBSubscription", + "SBSubscriptionListResult", + "SBTopic", + "SBTopicListResult", + "SqlFilter", + "SqlRuleAction", + "Subnet", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "UserAssignedIdentityProperties", + "AccessRights", + "CreatedByType", + "DefaultAction", + "EndPointProvisioningState", + "EntityStatus", + "FilterType", + "KeyType", + "ManagedServiceIdentityType", + "MigrationConfigurationName", + "NetworkRuleIPAction", + "PrivateLinkConnectionStatus", + "ProvisioningStateDR", + "PublicNetworkAccess", + "PublicNetworkAccessFlag", + "RoleDisasterRecovery", + "SkuName", + "SkuTier", + "TlsVersion", + "UnavailableReason", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..3da3b7246689 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_models_py3.py @@ -0,0 +1,3143 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AccessKeys(_serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + "alias_primary_connection_string": {"readonly": True}, + "alias_secondary_connection_string": {"readonly": True}, + "primary_key": {"readonly": True}, + "secondary_key": {"readonly": True}, + "key_name": {"readonly": True}, + } + + _attribute_map = { + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + "alias_primary_connection_string": {"key": "aliasPrimaryConnectionString", "type": "str"}, + "alias_secondary_connection_string": {"key": "aliasSecondaryConnectionString", "type": "str"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(_serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have + been matched by a filter expression. + + :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. + :vartype sql_expression: str + :ivar compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :vartype compatibility_level: int + :ivar requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :vartype requires_preprocessing: bool + """ + + _attribute_map = { + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: + """ + :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. + :paramtype sql_expression: str + :keyword compatibility_level: This property is reserved for future use. An integer value + showing the compatibility level, currently hard-coded to 20. + :paramtype compatibility_level: int + :keyword requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :paramtype requires_preprocessing: bool + """ + super().__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class ProxyResource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + + +class ArmDisasterRecovery(ProxyResource): + """Single item in List or Get Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Known values are: "Accepted", + "Succeeded", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: int + :ivar partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is part + of GEO DR pairing. + :vartype partner_namespace: str + :ivar alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :vartype alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Known values are: "Primary", "PrimaryNotReplicating", and "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.RoleDisasterRecovery + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "role": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "partner_namespace": {"key": "properties.partnerNamespace", "type": "str"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "role": {"key": "properties.role", "type": "str"}, + } + + def __init__( + self, *, partner_namespace: Optional[str] = None, alternate_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :paramtype partner_namespace: str + :keyword alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :paramtype alternate_name: str + """ + super().__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = partner_namespace + self.alternate_name = alternate_name + self.role = None + + +class ArmDisasterRecoveryListResult(_serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of Alias(Disaster Recovery configurations). + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ArmDisasterRecovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ArmDisasterRecovery"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of Alias(Disaster Recovery configurations). + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CheckNameAvailability(_serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. + :vartype name: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: str, **kwargs: Any) -> None: + """ + :keyword name: The Name to check the namespace name availability and The namespace name can + contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must + end with a letter or number. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(_serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :ivar name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :vartype name_available: bool + :ivar reason: The reason for unavailability of a namespace. Known values are: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and + "TooManyNamespaceInCurrentSubscription". + :vartype reason: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.UnavailableReason + """ + + _validation = { + "message": {"readonly": True}, + } + + _attribute_map = { + "message": {"key": "message", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "_models.UnavailableReason"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :paramtype name_available: bool + :keyword reason: The reason for unavailability of a namespace. Known values are: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", and + "TooManyNamespaceInCurrentSubscription". + :paramtype reason: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.UnavailableReason + """ + super().__init__(**kwargs) + self.message = None + self.name_available = name_available + self.reason = reason + + +class ConnectionState(_serialization.Model): + """ConnectionState information. + + :ivar status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", + and "Disconnected". + :vartype status: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateLinkConnectionStatus + :ivar description: Description of the connection state. + :vartype description: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateLinkConnectionStatus"]] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Status of the connection. Known values are: "Pending", "Approved", "Rejected", + and "Disconnected". + :paramtype status: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateLinkConnectionStatus + :keyword description: Description of the connection state. + :paramtype description: str + """ + super().__init__(**kwargs) + self.status = status + self.description = description + + +class CorrelationFilter(_serialization.Model): + """Represents the correlation filter expression. + + :ivar properties: dictionary object for custom filters. + :vartype properties: dict[str, str] + :ivar correlation_id: Identifier of the correlation. + :vartype correlation_id: str + :ivar message_id: Identifier of the message. + :vartype message_id: str + :ivar to: Address to send to. + :vartype to: str + :ivar reply_to: Address of the queue to reply to. + :vartype reply_to: str + :ivar label: Application specific label. + :vartype label: str + :ivar session_id: Session identifier. + :vartype session_id: str + :ivar reply_to_session_id: Session identifier to reply to. + :vartype reply_to_session_id: str + :ivar content_type: Content type of the message. + :vartype content_type: str + :ivar requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :vartype requires_preprocessing: bool + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "{str}"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "message_id": {"key": "messageId", "type": "str"}, + "to": {"key": "to", "type": "str"}, + "reply_to": {"key": "replyTo", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "session_id": {"key": "sessionId", "type": "str"}, + "reply_to_session_id": {"key": "replyToSessionId", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + correlation_id: Optional[str] = None, + message_id: Optional[str] = None, + to: Optional[str] = None, + reply_to: Optional[str] = None, + label: Optional[str] = None, + session_id: Optional[str] = None, + reply_to_session_id: Optional[str] = None, + content_type: Optional[str] = None, + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: + """ + :keyword properties: dictionary object for custom filters. + :paramtype properties: dict[str, str] + :keyword correlation_id: Identifier of the correlation. + :paramtype correlation_id: str + :keyword message_id: Identifier of the message. + :paramtype message_id: str + :keyword to: Address to send to. + :paramtype to: str + :keyword reply_to: Address of the queue to reply to. + :paramtype reply_to: str + :keyword label: Application specific label. + :paramtype label: str + :keyword session_id: Session identifier. + :paramtype session_id: str + :keyword reply_to_session_id: Session identifier to reply to. + :paramtype reply_to_session_id: str + :keyword content_type: Content type of the message. + :paramtype content_type: str + :keyword requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :paramtype requires_preprocessing: bool + """ + super().__init__(**kwargs) + self.properties = properties + self.correlation_id = correlation_id + self.message_id = message_id + self.to = to + self.reply_to = reply_to + self.label = label + self.session_id = session_id + self.reply_to_session_id = reply_to_session_id + self.content_type = content_type + self.requires_preprocessing = requires_preprocessing + + +class Encryption(_serialization.Model): + """Properties to configure Encryption. + + :ivar key_vault_properties: Properties of KeyVault. + :vartype key_vault_properties: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.KeyVaultProperties] + :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value is + "Microsoft.KeyVault". + :vartype key_source: str + :ivar require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). + :vartype require_infrastructure_encryption: bool + """ + + _attribute_map = { + "key_vault_properties": {"key": "keyVaultProperties", "type": "[KeyVaultProperties]"}, + "key_source": {"key": "keySource", "type": "str"}, + "require_infrastructure_encryption": {"key": "requireInfrastructureEncryption", "type": "bool"}, + } + + def __init__( + self, + *, + key_vault_properties: Optional[List["_models.KeyVaultProperties"]] = None, + key_source: Literal["Microsoft.KeyVault"] = "Microsoft.KeyVault", + require_infrastructure_encryption: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword key_vault_properties: Properties of KeyVault. + :paramtype key_vault_properties: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.KeyVaultProperties] + :keyword key_source: Enumerates the possible value of keySource for Encryption. Default value + is "Microsoft.KeyVault". + :paramtype key_source: str + :keyword require_infrastructure_encryption: Enable Infrastructure Encryption (Double + Encryption). + :paramtype require_infrastructure_encryption: bool + """ + super().__init__(**kwargs) + self.key_vault_properties = key_vault_properties + self.key_source = key_source + self.require_infrastructure_encryption = require_infrastructure_encryption + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(_serialization.Model): + """The resource management error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ErrorResponseError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorResponseError"}, + } + + def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ErrorResponseError + """ + super().__init__(**kwargs) + self.error = error + + +class ErrorResponseError(_serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class FailoverProperties(_serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before + switching to the secondary. + + :ivar is_safe_failover: Safe failover is to indicate the service should wait for pending + replication to finish before switching to the secondary. + :vartype is_safe_failover: bool + """ + + _attribute_map = { + "is_safe_failover": {"key": "properties.IsSafeFailover", "type": "bool"}, + } + + def __init__(self, *, is_safe_failover: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword is_safe_failover: Safe failover is to indicate the service should wait for pending + replication to finish before switching to the secondary. + :paramtype is_safe_failover: bool + """ + super().__init__(**kwargs) + self.is_safe_failover = is_safe_failover + + +class Identity(_serialization.Model): + """Properties to configure User Assigned Identities for Bring your Own Keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: ObjectId from the KeyVault. + :vartype principal_id: str + :ivar tenant_id: TenantId from the KeyVault. + :vartype tenant_id: str + :ivar type: Type of managed service identity. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :vartype type: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.ManagedServiceIdentityType + :ivar user_assigned_identities: Properties for User Assigned Identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.servicebus.v2022_10_01_preview.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :paramtype type: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.ManagedServiceIdentityType + :keyword user_assigned_identities: Properties for User Assigned Identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.servicebus.v2022_10_01_preview.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class KeyVaultProperties(_serialization.Model): + """Properties to configure keyVault Properties. + + :ivar key_name: Name of the Key from KeyVault. + :vartype key_name: str + :ivar key_vault_uri: Uri of KeyVault. + :vartype key_vault_uri: str + :ivar key_version: Version of KeyVault. + :vartype key_version: str + :ivar identity: + :vartype identity: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.UserAssignedIdentityProperties + """ + + _attribute_map = { + "key_name": {"key": "keyName", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "key_version": {"key": "keyVersion", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentityProperties"}, + } + + def __init__( + self, + *, + key_name: Optional[str] = None, + key_vault_uri: Optional[str] = None, + key_version: Optional[str] = None, + identity: Optional["_models.UserAssignedIdentityProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword key_name: Name of the Key from KeyVault. + :paramtype key_name: str + :keyword key_vault_uri: Uri of KeyVault. + :paramtype key_vault_uri: str + :keyword key_version: Version of KeyVault. + :paramtype key_version: str + :keyword identity: + :paramtype identity: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.UserAssignedIdentityProperties + """ + super().__init__(**kwargs) + self.key_name = key_name + self.key_vault_uri = key_vault_uri + self.key_version = key_version + self.identity = identity + + +class MessageCountDetails(_serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: int + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: int + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: int + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: int + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: int + """ + + _validation = { + "active_message_count": {"readonly": True}, + "dead_letter_message_count": {"readonly": True}, + "scheduled_message_count": {"readonly": True}, + "transfer_message_count": {"readonly": True}, + "transfer_dead_letter_message_count": {"readonly": True}, + } + + _attribute_map = { + "active_message_count": {"key": "activeMessageCount", "type": "int"}, + "dead_letter_message_count": {"key": "deadLetterMessageCount", "type": "int"}, + "scheduled_message_count": {"key": "scheduledMessageCount", "type": "int"}, + "transfer_message_count": {"key": "transferMessageCount", "type": "int"}, + "transfer_dead_letter_message_count": {"key": "transferDeadLetterMessageCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(_serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of Migration Configs. + :vartype value: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MigrationConfigProperties]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.MigrationConfigProperties"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of Migration Configs. + :paramtype value: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class MigrationConfigProperties(ProxyResource): + """Single item in List or Get Migration Config operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: int + :ivar target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :vartype target_namespace: str + :ivar post_migration_name: Name to access Standard Namespace after migration. + :vartype post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "pending_replication_operations_count": {"readonly": True}, + "migration_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "pending_replication_operations_count": {"key": "properties.pendingReplicationOperationsCount", "type": "int"}, + "target_namespace": {"key": "properties.targetNamespace", "type": "str"}, + "post_migration_name": {"key": "properties.postMigrationName", "type": "str"}, + "migration_state": {"key": "properties.migrationState", "type": "str"}, + } + + def __init__( + self, *, target_namespace: Optional[str] = None, post_migration_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword target_namespace: Existing premium Namespace ARM Id name which has no entities, will + be used for migration. + :paramtype target_namespace: str + :keyword post_migration_name: Name to access Standard Namespace after migration. + :paramtype post_migration_name: str + """ + super().__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = target_namespace + self.post_migration_name = post_migration_name + self.migration_state = None + + +class NetworkRuleSet(ProxyResource): + """Description of NetworkRuleSet resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar trusted_service_access_enabled: Value that indicates whether Trusted Service Access is + Enabled or not. + :vartype trusted_service_access_enabled: bool + :ivar default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". + :vartype default_action: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.DefaultAction + :ivar virtual_network_rules: List VirtualNetwork Rules. + :vartype virtual_network_rules: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.NWRuleSetVirtualNetworkRules] + :ivar ip_rules: List of IpRules. + :vartype ip_rules: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.NWRuleSetIpRules] + :ivar public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.PublicNetworkAccessFlag + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "trusted_service_access_enabled": {"key": "properties.trustedServiceAccessEnabled", "type": "bool"}, + "default_action": {"key": "properties.defaultAction", "type": "str"}, + "virtual_network_rules": {"key": "properties.virtualNetworkRules", "type": "[NWRuleSetVirtualNetworkRules]"}, + "ip_rules": {"key": "properties.ipRules", "type": "[NWRuleSetIpRules]"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( + self, + *, + trusted_service_access_enabled: Optional[bool] = None, + default_action: Optional[Union[str, "_models.DefaultAction"]] = None, + virtual_network_rules: Optional[List["_models.NWRuleSetVirtualNetworkRules"]] = None, + ip_rules: Optional[List["_models.NWRuleSetIpRules"]] = None, + public_network_access: Union[str, "_models.PublicNetworkAccessFlag"] = "Enabled", + **kwargs: Any + ) -> None: + """ + :keyword trusted_service_access_enabled: Value that indicates whether Trusted Service Access is + Enabled or not. + :paramtype trusted_service_access_enabled: bool + :keyword default_action: Default Action for Network Rule Set. Known values are: "Allow" and + "Deny". + :paramtype default_action: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.DefaultAction + :keyword virtual_network_rules: List VirtualNetwork Rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.NWRuleSetVirtualNetworkRules] + :keyword ip_rules: List of IpRules. + :paramtype ip_rules: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.NWRuleSetIpRules] + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.PublicNetworkAccessFlag + """ + super().__init__(**kwargs) + self.system_data = None + self.trusted_service_access_enabled = trusted_service_access_enabled + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + self.public_network_access = public_network_access + + +class NetworkRuleSetListResult(_serialization.Model): + """The response of the List NetworkRuleSet operation. + + :ivar value: Result of the List NetworkRuleSet operation. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkRuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkRuleSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Result of the List NetworkRuleSet operation. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of NetworkRuleSet. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NWRuleSetIpRules(_serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :ivar ip_mask: IP Mask. + :vartype ip_mask: str + :ivar action: The IP Filter Action. "Allow" + :vartype action: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleIPAction + """ + + _attribute_map = { + "ip_mask": {"key": "ipMask", "type": "str"}, + "action": {"key": "action", "type": "str"}, + } + + def __init__( + self, + *, + ip_mask: Optional[str] = None, + action: Union[str, "_models.NetworkRuleIPAction"] = "Allow", + **kwargs: Any + ) -> None: + """ + :keyword ip_mask: IP Mask. + :paramtype ip_mask: str + :keyword action: The IP Filter Action. "Allow" + :paramtype action: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleIPAction + """ + super().__init__(**kwargs) + self.ip_mask = ip_mask + self.action = action + + +class NWRuleSetVirtualNetworkRules(_serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :ivar subnet: Subnet properties. + :vartype subnet: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Subnet + :ivar ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing VNet + Service Endpoint. + :vartype ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + "subnet": {"key": "subnet", "type": "Subnet"}, + "ignore_missing_vnet_service_endpoint": {"key": "ignoreMissingVnetServiceEndpoint", "type": "bool"}, + } + + def __init__( + self, + *, + subnet: Optional["_models.Subnet"] = None, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword subnet: Subnet properties. + :paramtype subnet: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Subnet + :keyword ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :paramtype ignore_missing_vnet_service_endpoint: bool + """ + super().__init__(**kwargs) + self.subnet = subnet + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint + + +class Operation(_serialization.Model): + """A Service Bus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.servicebus.v2022_10_01_preview.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: JSON + """ + + _validation = { + "name": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + } + + def __init__( + self, + *, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.servicebus.v2022_10_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.properties = properties + + +class OperationDisplay(_serialization.Model): + """Operation display payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _validation = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(_serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL + link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(_serialization.Model): + """PrivateEndpoint information. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The ARM identifier for Private Endpoint. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(ProxyResource): + """Properties of the PrivateEndpointConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar private_endpoint: The Private Endpoint resource for this Connection. + :vartype private_endpoint: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: Details about the state of the connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.ConnectionState + :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Known values + are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.EndPointProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "ConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.ConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.EndPointProvisioningState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword private_endpoint: The Private Endpoint resource for this Connection. + :paramtype private_endpoint: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: Details about the state of the connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.ConnectionState + :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.EndPointProvisioningState + """ + super().__init__(**kwargs) + self.system_data = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionListResult(_serialization.Model): + """Result of the list of all private endpoint connections operation. + + :ivar value: A collection of private endpoint connection resources. + :vartype value: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] + :ivar next_link: A link for the next page of private endpoint connection resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A collection of private endpoint connection resources. + :paramtype value: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] + :keyword next_link: A link for the next page of private endpoint connection resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(_serialization.Model): + """Information of the private link resource. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar type: Type of the resource. + :vartype type: str + :ivar group_id: + :vartype group_id: str + :ivar required_members: Required Members. + :vartype required_members: list[str] + :ivar required_zone_names: Required Zone Names. + :vartype required_zone_names: list[str] + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified identifier of the resource. + :paramtype id: str + :keyword name: Name of the resource. + :paramtype name: str + :keyword type: Type of the resource. + :paramtype type: str + :keyword group_id: + :paramtype group_id: str + :keyword required_members: Required Members. + :paramtype required_members: list[str] + :keyword required_zone_names: Required Zone Names. + :paramtype required_zone_names: list[str] + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class PrivateLinkResourcesListResult(_serialization.Model): + """Result of the List private link resources operation. + + :ivar value: A collection of private link resources. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateLinkResource] + :ivar next_link: A link for the next page of private link resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A collection of private link resources. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateLinkResource] + :keyword next_link: A link for the next page of private link resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RegenerateAccessKeyParameters(_serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs + to be reset. + + All required parameters must be populated in order to send to Azure. + + :ivar key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and + "SecondaryKey". + :vartype key_type: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.KeyType + :ivar key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :vartype key: str + """ + + _validation = { + "key_type": {"required": True}, + } + + _attribute_map = { + "key_type": {"key": "keyType", "type": "str"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key_type: The access key to regenerate. Required. Known values are: "PrimaryKey" and + "SecondaryKey". + :paramtype key_type: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.KeyType + :keyword key: Optional, if the key value provided, is reset for KeyType value or autogenerate + Key value set for keyType. + :paramtype key: str + """ + super().__init__(**kwargs) + self.key_type = key_type + self.key = key + + +class Resource(_serialization.Model): + """The Resource definition for other than namespace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + + +class Rule(ProxyResource): + """Description of Rule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :vartype action: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Action + :ivar filter_type: Filter type that is evaluated against a BrokeredMessage. Known values are: + "SqlFilter" and "CorrelationFilter". + :vartype filter_type: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.FilterType + :ivar sql_filter: Properties of sqlFilter. + :vartype sql_filter: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SqlFilter + :ivar correlation_filter: Properties of correlationFilter. + :vartype correlation_filter: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.CorrelationFilter + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "action": {"key": "properties.action", "type": "Action"}, + "filter_type": {"key": "properties.filterType", "type": "str"}, + "sql_filter": {"key": "properties.sqlFilter", "type": "SqlFilter"}, + "correlation_filter": {"key": "properties.correlationFilter", "type": "CorrelationFilter"}, + } + + def __init__( + self, + *, + action: Optional["_models.Action"] = None, + filter_type: Optional[Union[str, "_models.FilterType"]] = None, + sql_filter: Optional["_models.SqlFilter"] = None, + correlation_filter: Optional["_models.CorrelationFilter"] = None, + **kwargs: Any + ) -> None: + """ + :keyword action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :paramtype action: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Action + :keyword filter_type: Filter type that is evaluated against a BrokeredMessage. Known values + are: "SqlFilter" and "CorrelationFilter". + :paramtype filter_type: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.FilterType + :keyword sql_filter: Properties of sqlFilter. + :paramtype sql_filter: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SqlFilter + :keyword correlation_filter: Properties of correlationFilter. + :paramtype correlation_filter: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.CorrelationFilter + """ + super().__init__(**kwargs) + self.system_data = None + self.action = action + self.filter_type = filter_type + self.sql_filter = sql_filter + self.correlation_filter = correlation_filter + + +class RuleListResult(_serialization.Model): + """The response of the List rule operation. + + :ivar value: Result of the List Rules operation. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Rule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Result of the List Rules operation. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of rules. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBAuthorizationRule(ProxyResource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar rights: The rights associated with the rule. + :vartype rights: list[str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessRights] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "rights": {"key": "properties.rights", "type": "[str]"}, + } + + def __init__(self, *, rights: Optional[List[Union[str, "_models.AccessRights"]]] = None, **kwargs: Any) -> None: + """ + :keyword rights: The rights associated with the rule. + :paramtype rights: list[str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessRights] + """ + super().__init__(**kwargs) + self.system_data = None + self.rights = rights + + +class SBAuthorizationRuleListResult(_serialization.Model): + """The response to the List Namespace operation. + + :ivar value: Result of the List Authorization Rules operation. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SBAuthorizationRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SBAuthorizationRule"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Result of the List Authorization Rules operation. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of Authorization Rules. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBClientAffineProperties(_serialization.Model): + """Properties specific to client affine subscriptions. + + :ivar client_id: Indicates the Client ID of the application that created the client-affine + subscription. + :vartype client_id: str + :ivar is_durable: For client-affine subscriptions, this value indicates whether the + subscription is durable or not. + :vartype is_durable: bool + :ivar is_shared: For client-affine subscriptions, this value indicates whether the subscription + is shared or not. + :vartype is_shared: bool + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "is_durable": {"key": "isDurable", "type": "bool"}, + "is_shared": {"key": "isShared", "type": "bool"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + is_durable: Optional[bool] = None, + is_shared: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword client_id: Indicates the Client ID of the application that created the client-affine + subscription. + :paramtype client_id: str + :keyword is_durable: For client-affine subscriptions, this value indicates whether the + subscription is durable or not. + :paramtype is_durable: bool + :keyword is_shared: For client-affine subscriptions, this value indicates whether the + subscription is shared or not. + :paramtype is_shared: bool + """ + super().__init__(**kwargs) + self.client_id = client_id + self.is_durable = is_durable + self.is_shared = is_shared + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: The Geo-location where the resource lives. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: The Geo-location where the resource lives. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + + +class SBNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: The Geo-location where the resource lives. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Properties of SKU. + :vartype sku: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSku + :ivar identity: Properties of BYOK Identity description. + :vartype identity: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Identity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. + Known values are: "1.0", "1.1", and "1.2". + :vartype minimum_tls_version: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.TlsVersion + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :ivar zone_redundant: Enabling this property creates a Premium Service Bus Namespace in regions + supported availability zones. + :vartype zone_redundant: bool + :ivar encryption: Properties of BYOK Encryption description. + :vartype encryption: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Encryption + :ivar private_endpoint_connections: List of private endpoint connections. + :vartype private_endpoint_connections: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] + :ivar disable_local_auth: This property disables SAS authentication for the Service Bus + namespace. + :vartype disable_local_auth: bool + :ivar alternate_name: Alternate name for namespace. + :vartype alternate_name: str + :ivar public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.PublicNetworkAccess + :ivar premium_messaging_partitions: The number of partitions of a Service Bus namespace. This + property is only applicable to Premium SKU namespaces. The default value is 1 and possible + values are 1, 2 and 4. + :vartype premium_messaging_partitions: int + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "minimum_tls_version": {"key": "properties.minimumTlsVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "premium_messaging_partitions": {"key": "properties.premiumMessagingPartitions", "type": "int"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.SBSku"] = None, + identity: Optional["_models.Identity"] = None, + minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, + zone_redundant: Optional[bool] = None, + encryption: Optional["_models.Encryption"] = None, + private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, + disable_local_auth: Optional[bool] = None, + alternate_name: Optional[str] = None, + public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", + premium_messaging_partitions: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The Geo-location where the resource lives. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Properties of SKU. + :paramtype sku: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSku + :keyword identity: Properties of BYOK Identity description. + :paramtype identity: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Identity + :keyword minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. + Known values are: "1.0", "1.1", and "1.2". + :paramtype minimum_tls_version: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.TlsVersion + :keyword zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :paramtype zone_redundant: bool + :keyword encryption: Properties of BYOK Encryption description. + :paramtype encryption: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Encryption + :keyword private_endpoint_connections: List of private endpoint connections. + :paramtype private_endpoint_connections: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] + :keyword disable_local_auth: This property disables SAS authentication for the Service Bus + namespace. + :paramtype disable_local_auth: bool + :keyword alternate_name: Alternate name for namespace. + :paramtype alternate_name: str + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + :paramtype public_network_access: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.PublicNetworkAccess + :keyword premium_messaging_partitions: The number of partitions of a Service Bus namespace. + This property is only applicable to Premium SKU namespaces. The default value is 1 and possible + values are 1, 2 and 4. + :paramtype premium_messaging_partitions: int + """ + super().__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.system_data = None + self.minimum_tls_version = minimum_tls_version + self.provisioning_state = None + self.status = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = zone_redundant + self.encryption = encryption + self.private_endpoint_connections = private_endpoint_connections + self.disable_local_auth = disable_local_auth + self.alternate_name = alternate_name + self.public_network_access = public_network_access + self.premium_messaging_partitions = premium_messaging_partitions + + +class SBNamespaceListResult(_serialization.Model): + """The response of the List Namespace operation. + + :ivar value: Result of the List Namespace operation. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SBNamespace]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SBNamespace"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Result of the List Namespace operation. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of Namespaces. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): # pylint: disable=too-many-instance-attributes + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Properties of SKU. + :vartype sku: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSku + :ivar identity: Properties of BYOK Identity description. + :vartype identity: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Identity + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :ivar encryption: Properties of BYOK Encryption description. + :vartype encryption: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Encryption + :ivar private_endpoint_connections: List of private endpoint connections. + :vartype private_endpoint_connections: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] + :ivar disable_local_auth: This property disables SAS authentication for the Service Bus + namespace. + :vartype disable_local_auth: bool + :ivar alternate_name: Alternate name for namespace. + :vartype alternate_name: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "service_bus_endpoint": {"readonly": True}, + "metric_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "SBSku"}, + "identity": {"key": "identity", "type": "Identity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "service_bus_endpoint": {"key": "properties.serviceBusEndpoint", "type": "str"}, + "metric_id": {"key": "properties.metricId", "type": "str"}, + "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "alternate_name": {"key": "properties.alternateName", "type": "str"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.SBSku"] = None, + identity: Optional["_models.Identity"] = None, + encryption: Optional["_models.Encryption"] = None, + private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, + disable_local_auth: Optional[bool] = None, + alternate_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Properties of SKU. + :paramtype sku: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSku + :keyword identity: Properties of BYOK Identity description. + :paramtype identity: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Identity + :keyword encryption: Properties of BYOK Encryption description. + :paramtype encryption: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Encryption + :keyword private_endpoint_connections: List of private endpoint connections. + :paramtype private_endpoint_connections: + list[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] + :keyword disable_local_auth: This property disables SAS authentication for the Service Bus + namespace. + :paramtype disable_local_auth: bool + :keyword alternate_name: Alternate name for namespace. + :paramtype alternate_name: str + """ + super().__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.provisioning_state = None + self.status = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.encryption = encryption + self.private_endpoint_connections = private_endpoint_connections + self.disable_local_auth = disable_local_auth + self.alternate_name = alternate_name + + +class SBQueue(ProxyResource): # pylint: disable=too-many-instance-attributes + """Description of queue Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: int + :ivar message_count: The number of messages in the queue. + :vartype message_count: int + :ivar lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :vartype lock_duration: ~datetime.timedelta + :ivar max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :vartype max_size_in_megabytes: int + :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be + accepted by the queue. This property is only used in Premium today and default is 1024. + :vartype max_message_size_in_kilobytes: int + :ivar requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :vartype requires_duplicate_detection: bool + :ivar requires_session: A value that indicates whether the queue supports the concept of + sessions. + :vartype requires_session: bool + :ivar default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :vartype default_message_time_to_live: ~datetime.timedelta + :ivar dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :vartype dead_lettering_on_message_expiration: bool + :ivar duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :vartype duplicate_detection_history_time_window: ~datetime.timedelta + :ivar max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :vartype max_delivery_count: int + :ivar status: Enumerates the possible values for the status of a messaging entity. Known values + are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", and "Unknown". + :vartype status: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.EntityStatus + :ivar enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :vartype enable_batched_operations: bool + :ivar auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :vartype auto_delete_on_idle: ~datetime.timedelta + :ivar enable_partitioning: A value that indicates whether the queue is to be partitioned across + multiple message brokers. + :vartype enable_partitioning: bool + :ivar enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :vartype enable_express: bool + :ivar forward_to: Queue/Topic name to forward the messages. + :vartype forward_to: str + :ivar forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :vartype forward_dead_lettered_messages_to: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "count_details": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "message_count": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + max_message_size_in_kilobytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "_models.EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :paramtype lock_duration: ~datetime.timedelta + :keyword max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size + of memory allocated for the queue. Default is 1024. + :paramtype max_size_in_megabytes: int + :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be + accepted by the queue. This property is only used in Premium today and default is 1024. + :paramtype max_message_size_in_kilobytes: int + :keyword requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :paramtype requires_duplicate_detection: bool + :keyword requires_session: A value that indicates whether the queue supports the concept of + sessions. + :paramtype requires_session: bool + :keyword default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :paramtype default_message_time_to_live: ~datetime.timedelta + :keyword dead_lettering_on_message_expiration: A value that indicates whether this queue has + dead letter support when a message expires. + :paramtype dead_lettering_on_message_expiration: bool + :keyword duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :paramtype duplicate_detection_history_time_window: ~datetime.timedelta + :keyword max_delivery_count: The maximum delivery count. A message is automatically + deadlettered after this number of deliveries. default value is 10. + :paramtype max_delivery_count: int + :keyword status: Enumerates the possible values for the status of a messaging entity. Known + values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", and "Unknown". + :paramtype status: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.EntityStatus + :keyword enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :paramtype enable_batched_operations: bool + :keyword auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :paramtype auto_delete_on_idle: ~datetime.timedelta + :keyword enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :paramtype enable_partitioning: bool + :keyword enable_express: A value that indicates whether Express Entities are enabled. An + express queue holds a message in memory temporarily before writing it to persistent storage. + :paramtype enable_express: bool + :keyword forward_to: Queue/Topic name to forward the messages. + :paramtype forward_to: str + :keyword forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter + message. + :paramtype forward_dead_lettered_messages_to: str + """ + super().__init__(**kwargs) + self.system_data = None + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = lock_duration + self.max_size_in_megabytes = max_size_in_megabytes + self.max_message_size_in_kilobytes = max_message_size_in_kilobytes + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBQueueListResult(_serialization.Model): + """The response to the List Queues operation. + + :ivar value: Result of the List Queues operation. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SBQueue]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SBQueue"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Result of the List Queues operation. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of queues. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBSku(_serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of this SKU. Required. Known values are: "Basic", "Standard", and "Premium". + :vartype name: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.SkuName + :ivar tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", and + "Premium". + :vartype tier: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.SkuTier + :ivar capacity: Messaging units for your service bus premium namespace. Valid capacities are + {1, 2, 4, 8, 16} multiples of your properties.premiumMessagingPartitions setting. For example, + If properties.premiumMessagingPartitions is 1 then possible capacity values are 1, 2, 4, 8, and + 16. If properties.premiumMessagingPartitions is 4 then possible capacity values are 4, 8, 16, + 32 and 64. + :vartype capacity: int + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + tier: Optional[Union[str, "_models.SkuTier"]] = None, + capacity: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of this SKU. Required. Known values are: "Basic", "Standard", and + "Premium". + :paramtype name: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.SkuName + :keyword tier: The billing tier of this particular SKU. Known values are: "Basic", "Standard", + and "Premium". + :paramtype tier: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.SkuTier + :keyword capacity: Messaging units for your service bus premium namespace. Valid capacities are + {1, 2, 4, 8, 16} multiples of your properties.premiumMessagingPartitions setting. For example, + If properties.premiumMessagingPartitions is 1 then possible capacity values are 1, 2, 4, 8, and + 16. If properties.premiumMessagingPartitions is 4 then possible capacity values are 4, 8, 16, + 32 and 64. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SBSubscription(ProxyResource): # pylint: disable=too-many-instance-attributes + """Description of subscription resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar message_count: Number of messages. + :vartype message_count: int + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MessageCountDetails + :ivar lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is + 1 minute. + :vartype lock_duration: ~datetime.timedelta + :ivar requires_session: Value indicating if a subscription supports the concept of sessions. + :vartype requires_session: bool + :ivar default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :vartype default_message_time_to_live: ~datetime.timedelta + :ivar dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :vartype dead_lettering_on_filter_evaluation_exceptions: bool + :ivar dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :vartype dead_lettering_on_message_expiration: bool + :ivar duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :vartype duplicate_detection_history_time_window: ~datetime.timedelta + :ivar max_delivery_count: Number of maximum deliveries. + :vartype max_delivery_count: int + :ivar status: Enumerates the possible values for the status of a messaging entity. Known values + are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", and "Unknown". + :vartype status: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.EntityStatus + :ivar enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :vartype enable_batched_operations: bool + :ivar auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :vartype auto_delete_on_idle: ~datetime.timedelta + :ivar forward_to: Queue/Topic name to forward the messages. + :vartype forward_to: str + :ivar forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :vartype forward_dead_lettered_messages_to: str + :ivar is_client_affine: Value that indicates whether the subscription has an affinity to the + client id. + :vartype is_client_affine: bool + :ivar client_affine_properties: Properties specific to client affine subscriptions. + :vartype client_affine_properties: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBClientAffineProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "message_count": {"readonly": True}, + "created_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "count_details": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "message_count": {"key": "properties.messageCount", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "lock_duration": {"key": "properties.lockDuration", "type": "duration"}, + "requires_session": {"key": "properties.requiresSession", "type": "bool"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "dead_lettering_on_filter_evaluation_exceptions": { + "key": "properties.deadLetteringOnFilterEvaluationExceptions", + "type": "bool", + }, + "dead_lettering_on_message_expiration": {"key": "properties.deadLetteringOnMessageExpiration", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "max_delivery_count": {"key": "properties.maxDeliveryCount", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "forward_to": {"key": "properties.forwardTo", "type": "str"}, + "forward_dead_lettered_messages_to": {"key": "properties.forwardDeadLetteredMessagesTo", "type": "str"}, + "is_client_affine": {"key": "properties.isClientAffine", "type": "bool"}, + "client_affine_properties": {"key": "properties.clientAffineProperties", "type": "SBClientAffineProperties"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "_models.EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + is_client_affine: Optional[bool] = None, + client_affine_properties: Optional["_models.SBClientAffineProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :paramtype lock_duration: ~datetime.timedelta + :keyword requires_session: Value indicating if a subscription supports the concept of sessions. + :paramtype requires_session: bool + :keyword default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :paramtype default_message_time_to_live: ~datetime.timedelta + :keyword dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :paramtype dead_lettering_on_filter_evaluation_exceptions: bool + :keyword dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :paramtype dead_lettering_on_message_expiration: bool + :keyword duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :paramtype duplicate_detection_history_time_window: ~datetime.timedelta + :keyword max_delivery_count: Number of maximum deliveries. + :paramtype max_delivery_count: int + :keyword status: Enumerates the possible values for the status of a messaging entity. Known + values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", and "Unknown". + :paramtype status: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.EntityStatus + :keyword enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :paramtype enable_batched_operations: bool + :keyword auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :paramtype auto_delete_on_idle: ~datetime.timedelta + :keyword forward_to: Queue/Topic name to forward the messages. + :paramtype forward_to: str + :keyword forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter + message. + :paramtype forward_dead_lettered_messages_to: str + :keyword is_client_affine: Value that indicates whether the subscription has an affinity to the + client id. + :paramtype is_client_affine: bool + :keyword client_affine_properties: Properties specific to client affine subscriptions. + :paramtype client_affine_properties: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBClientAffineProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = lock_duration + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + self.is_client_affine = is_client_affine + self.client_affine_properties = client_affine_properties + + +class SBSubscriptionListResult(_serialization.Model): + """The response to the List Subscriptions operation. + + :ivar value: Result of the List Subscriptions operation. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SBSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SBSubscription"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Result of the List Subscriptions operation. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of subscriptions. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBTopic(ProxyResource): # pylint: disable=too-many-instance-attributes + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SystemData + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: int + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MessageCountDetails + :ivar default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :vartype default_message_time_to_live: ~datetime.timedelta + :ivar max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :vartype max_size_in_megabytes: int + :ivar max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be + accepted by the topic. This property is only used in Premium today and default is 1024. + :vartype max_message_size_in_kilobytes: int + :ivar requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :vartype requires_duplicate_detection: bool + :ivar duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :vartype duplicate_detection_history_time_window: ~datetime.timedelta + :ivar enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :vartype enable_batched_operations: bool + :ivar status: Enumerates the possible values for the status of a messaging entity. Known values + are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", and "Unknown". + :vartype status: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.EntityStatus + :ivar support_ordering: Value that indicates whether the topic supports ordering. + :vartype support_ordering: bool + :ivar auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :vartype auto_delete_on_idle: ~datetime.timedelta + :ivar enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :vartype enable_partitioning: bool + :ivar enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :vartype enable_express: bool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "system_data": {"readonly": True}, + "size_in_bytes": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + "accessed_at": {"readonly": True}, + "subscription_count": {"readonly": True}, + "count_details": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "created_at": {"key": "properties.createdAt", "type": "iso-8601"}, + "updated_at": {"key": "properties.updatedAt", "type": "iso-8601"}, + "accessed_at": {"key": "properties.accessedAt", "type": "iso-8601"}, + "subscription_count": {"key": "properties.subscriptionCount", "type": "int"}, + "count_details": {"key": "properties.countDetails", "type": "MessageCountDetails"}, + "default_message_time_to_live": {"key": "properties.defaultMessageTimeToLive", "type": "duration"}, + "max_size_in_megabytes": {"key": "properties.maxSizeInMegabytes", "type": "int"}, + "max_message_size_in_kilobytes": {"key": "properties.maxMessageSizeInKilobytes", "type": "int"}, + "requires_duplicate_detection": {"key": "properties.requiresDuplicateDetection", "type": "bool"}, + "duplicate_detection_history_time_window": { + "key": "properties.duplicateDetectionHistoryTimeWindow", + "type": "duration", + }, + "enable_batched_operations": {"key": "properties.enableBatchedOperations", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "support_ordering": {"key": "properties.supportOrdering", "type": "bool"}, + "auto_delete_on_idle": {"key": "properties.autoDeleteOnIdle", "type": "duration"}, + "enable_partitioning": {"key": "properties.enablePartitioning", "type": "bool"}, + "enable_express": {"key": "properties.enableExpress", "type": "bool"}, + } + + def __init__( + self, + *, + default_message_time_to_live: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + max_message_size_in_kilobytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + enable_batched_operations: Optional[bool] = None, + status: Optional[Union[str, "_models.EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :paramtype default_message_time_to_live: ~datetime.timedelta + :keyword max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of + the memory allocated for the topic. Default is 1024. + :paramtype max_size_in_megabytes: int + :keyword max_message_size_in_kilobytes: Maximum size (in KB) of the message payload that can be + accepted by the topic. This property is only used in Premium today and default is 1024. + :paramtype max_message_size_in_kilobytes: int + :keyword requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :paramtype requires_duplicate_detection: bool + :keyword duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :paramtype duplicate_detection_history_time_window: ~datetime.timedelta + :keyword enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :paramtype enable_batched_operations: bool + :keyword status: Enumerates the possible values for the status of a messaging entity. Known + values are: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", and "Unknown". + :paramtype status: str or ~azure.mgmt.servicebus.v2022_10_01_preview.models.EntityStatus + :keyword support_ordering: Value that indicates whether the topic supports ordering. + :paramtype support_ordering: bool + :keyword auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :paramtype auto_delete_on_idle: ~datetime.timedelta + :keyword enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :paramtype enable_partitioning: bool + :keyword enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :paramtype enable_express: bool + """ + super().__init__(**kwargs) + self.system_data = None + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.max_size_in_megabytes = max_size_in_megabytes + self.max_message_size_in_kilobytes = max_message_size_in_kilobytes + self.requires_duplicate_detection = requires_duplicate_detection + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.status = status + self.support_ordering = support_ordering + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + + +class SBTopicListResult(_serialization.Model): + """The response to the List Topics operation. + + :ivar value: Result of the List Topics operation. + :vartype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SBTopic]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SBTopic"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Result of the List Topics operation. + :paramtype value: list[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of topics. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SqlFilter(_serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in + the pub/sub pipeline. + + :ivar sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :vartype sql_expression: str + :ivar compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :vartype compatibility_level: int + :ivar requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :vartype requires_preprocessing: bool + """ + + _attribute_map = { + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: + """ + :keyword sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :paramtype sql_expression: str + :keyword compatibility_level: This property is reserved for future use. An integer value + showing the compatibility level, currently hard-coded to 20. + :paramtype compatibility_level: int + :keyword requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :paramtype requires_preprocessing: bool + """ + super().__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a + ServiceBus.Messaging.BrokeredMessage. + + :ivar sql_expression: SQL expression. e.g. MyProperty='ABC'. + :vartype sql_expression: str + :ivar compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :vartype compatibility_level: int + :ivar requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :vartype requires_preprocessing: bool + """ + + _attribute_map = { + "sql_expression": {"key": "sqlExpression", "type": "str"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "requires_preprocessing": {"key": "requiresPreprocessing", "type": "bool"}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: bool = True, + **kwargs: Any + ) -> None: + """ + :keyword sql_expression: SQL expression. e.g. MyProperty='ABC'. + :paramtype sql_expression: str + :keyword compatibility_level: This property is reserved for future use. An integer value + showing the compatibility level, currently hard-coded to 20. + :paramtype compatibility_level: int + :keyword requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :paramtype requires_preprocessing: bool + """ + super().__init__( + sql_expression=sql_expression, + compatibility_level=compatibility_level, + requires_preprocessing=requires_preprocessing, + **kwargs + ) + + +class Subnet(_serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID of Virtual Network Subnet. Required. + :vartype id: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID of Virtual Network Subnet. Required. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(_serialization.Model): + """Recognized Dictionary value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserAssignedIdentityProperties(_serialization.Model): + """UserAssignedIdentityProperties. + + :ivar user_assigned_identity: ARM ID of user Identity selected for encryption. + :vartype user_assigned_identity: str + """ + + _attribute_map = { + "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, + } + + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword user_assigned_identity: ARM ID of user Identity selected for encryption. + :paramtype user_assigned_identity: str + """ + super().__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_service_bus_management_client_enums.py new file mode 100644 index 000000000000..c133c2caad54 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/models/_service_bus_management_client_enums.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AccessRights(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessRights.""" + + MANAGE = "Manage" + SEND = "Send" + LISTEN = "Listen" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class DefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default Action for Network Rule Set.""" + + ALLOW = "Allow" + DENY = "Deny" + + +class EndPointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Private Endpoint Connection.""" + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + +class EntityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Entity status.""" + + ACTIVE = "Active" + DISABLED = "Disabled" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + RECEIVE_DISABLED = "ReceiveDisabled" + CREATING = "Creating" + DELETING = "Deleting" + RENAMING = "Renaming" + UNKNOWN = "Unknown" + + +class FilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Rule filter types.""" + + SQL_FILTER = "SqlFilter" + CORRELATION_FILTER = "CorrelationFilter" + + +class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The access key to regenerate.""" + + PRIMARY_KEY = "PrimaryKey" + SECONDARY_KEY = "SecondaryKey" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity.""" + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + + +class MigrationConfigurationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationConfigurationName.""" + + _DEFAULT = "$default" + + +class NetworkRuleIPAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IP Filter Action.""" + + ALLOW = "Allow" + + +class PrivateLinkConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the connection.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + + +class ProvisioningStateDR(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' + or 'Succeeded' or 'Failed'. + """ + + ACCEPTED = "Accepted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This determines if traffic is allowed over public network. By default it is enabled.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + SECURED_BY_PERIMETER = "SecuredByPerimeter" + + +class PublicNetworkAccessFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This determines if traffic is allowed over public network. By default it is enabled.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class RoleDisasterRecovery(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or + 'Secondary'. + """ + + PRIMARY = "Primary" + PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" + SECONDARY = "Secondary" + + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of this SKU.""" + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + + +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The billing tier of this particular SKU.""" + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + + +class TlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The minimum TLS version for the cluster to support, e.g. '1.2'.""" + + ONE0 = "1.0" + ONE1 = "1.1" + ONE2 = "1.2" + + +class UnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the reason for the unavailability of the service.""" + + NONE = "None" + INVALID_NAME = "InvalidName" + SUBSCRIPTION_IS_DISABLED = "SubscriptionIsDisabled" + NAME_IN_USE = "NameInUse" + NAME_IN_LOCKDOWN = "NameInLockdown" + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = "TooManyNamespaceInCurrentSubscription" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/__init__.py new file mode 100644 index 000000000000..e5431803c533 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/__init__.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._rules_operations import RulesOperations +from ._subscriptions_operations import SubscriptionsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NamespacesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "Operations", + "DisasterRecoveryConfigsOperations", + "MigrationConfigsOperations", + "QueuesOperations", + "TopicsOperations", + "RulesOperations", + "SubscriptionsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..f1fadb62ec57 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,1429 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_break_pairing_request( + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fail_over_request( + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_authorization_rules_request( + resource_group_name: str, namespace_name: str, alias: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_authorization_rule_request( + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_keys_request( + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "alias": _SERIALIZER.url("alias", alias, "str", max_length=50, min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_check_name_availability_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DisasterRecoveryConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`disaster_recovery_configs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.ArmDisasterRecovery"]: + """Gets all Alias(Disaster Recovery configurations). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecovery or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ArmDisasterRecoveryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: _models.ArmDisasterRecovery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Union[_models.ArmDisasterRecovery, IO], + **kwargs: Any + ) -> Optional[_models.ArmDisasterRecovery]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a ArmDisasterRecovery type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ArmDisasterRecovery]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArmDisasterRecovery") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } + + @distributed_trace + def get( + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> _models.ArmDisasterRecovery: + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.ArmDisasterRecovery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.ArmDisasterRecovery] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}" + } + + @distributed_trace + def break_pairing( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_break_pairing_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.break_pairing.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing" + } + + @overload + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[_models.FailoverProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.FailoverProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def fail_over( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional[Union[_models.FailoverProperties, IO]] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). Is + either a FailoverProperties type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.FailoverProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "FailoverProperties") + else: + _json = None + + request = build_fail_over_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.fail_over.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover" + } + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: + """Gets the authorization rules for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules" + } + + @distributed_trace + def get_authorization_rule( + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Gets an authorization rule for a namespace by rule name. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def list_keys( + self, resource_group_name: str, namespace_name: str, alias: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.AccessKeys: + """Gets the primary and secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. Required. + :type alias: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + alias=alias, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys" + } + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.CheckNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.CheckNameAvailability, IO], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_migration_configs_operations.py similarity index 53% rename from sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_migration_configs_operations.py index 9169bc725e73..b06a3c37b534 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_migration_configs_operations.py @@ -29,8 +29,8 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsClientMixinABC, _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -43,19 +43,28 @@ _SERIALIZER.client_side_validation = False -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/phpWorkloads") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -69,25 +78,34 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_create_and_start_migration_request( + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -96,33 +114,40 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, php_workload_name: str, subscription_id: str, **kwargs: Any +def build_delete_request( + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -133,32 +158,36 @@ def build_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - resource_group_name: str, php_workload_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -167,36 +196,38 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( - resource_group_name: str, php_workload_name: str, subscription_id: str, **kwargs: Any +def build_complete_migration_request( + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -205,63 +236,59 @@ def build_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_revert_request( resource_group_name: str, - php_workload_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], subscription_id: str, - *, - delete_infra: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if delete_infra is not None: - _params["delete-infra"] = _SERIALIZER.query("delete_infra", delete_infra, "str", min_length=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class PhpWorkloadsOperations: +class MigrationConfigsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.workloads.WorkloadsClient`'s - :attr:`php_workloads` attribute. + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`migration_configs` attribute. """ models = _models @@ -274,110 +301,29 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PhpWorkloadResource"]: - """Lists PHP workload resources for a subscription. + def list( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationConfigProperties"]: + """Gets all migrationConfigurations. - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PhpWorkloadResourceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PhpWorkloadResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/phpWorkloads" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.PhpWorkloadResource"]: - """Lists PHP workload resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResource] + :return: An iterator like instance of either MigrationConfigProperties or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[_models.PhpWorkloadResourceList] = kwargs.pop("cls", None) + cls: ClsType[_models.MigrationConfigListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -390,11 +336,12 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, + namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -420,7 +367,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("PhpWorkloadResourceList", pipeline_response) + deserialized = self._deserialize("MigrationConfigListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -443,81 +390,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads" - } - - @distributed_trace - def get(self, resource_group_name: str, php_workload_name: str, **kwargs: Any) -> _models.PhpWorkloadResource: - """Gets the PHP workload resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations" } - def _create_or_update_initial( + def _create_and_start_migration_initial( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: Union[_models.PhpWorkloadResource, IO], + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any - ) -> _models.PhpWorkloadResource: + ) -> Optional[_models.MigrationConfigProperties]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -529,29 +413,30 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.MigrationConfigProperties]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(php_workload_resource, (IO, bytes)): - _content = php_workload_resource + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = self._serialize.body(php_workload_resource, "PhpWorkloadResource") + _json = self._serialize.body(parameters, "MigrationConfigProperties") - request = build_create_or_update_request( + request = build_create_and_start_migration_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], + template_url=self._create_and_start_migration_initial.metadata["url"], headers=_headers, params=_params, ) @@ -569,40 +454,42 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None if response.status_code == 200: - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + _create_and_start_migration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" } @overload - def begin_create_or_update( + def begin_create_and_start_migration( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: _models.PhpWorkloadResource, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: _models.MigrationConfigProperties, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.PhpWorkloadResource]: - """Create or updated PHP workload resource. + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param php_workload_resource: Resource create or update request payload. Required. - :type php_workload_resource: ~azure.mgmt.workloads.models.PhpWorkloadResource + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -614,31 +501,36 @@ def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PhpWorkloadResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_create_and_start_migration( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: IO, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.PhpWorkloadResource]: - """Create or updated PHP workload resource. + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param php_workload_resource: Resource create or update request payload. Required. - :type php_workload_resource: IO + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Required. + :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -650,30 +542,36 @@ def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PhpWorkloadResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_create_and_start_migration( self, resource_group_name: str, - php_workload_name: str, - php_workload_resource: Union[_models.PhpWorkloadResource, IO], + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + parameters: Union[_models.MigrationConfigProperties, IO], **kwargs: Any - ) -> LROPoller[_models.PhpWorkloadResource]: - """Create or updated PHP workload resource. + ) -> LROPoller[_models.MigrationConfigProperties]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param php_workload_resource: Resource create or update request payload. Is either a model type - or a IO type. Required. - :type php_workload_resource: ~azure.mgmt.workloads.models.PhpWorkloadResource or IO + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. Is either a + MigrationConfigProperties type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties + or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -685,27 +583,29 @@ def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PhpWorkloadResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - php_workload_resource=php_workload_resource, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -716,15 +616,13 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -738,90 +636,99 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + begin_create_and_start_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" } - @overload - def update( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - php_workload_name: str, - resource_patch_request_body: _models.PatchResourceRequestBody, - *, - content_type: str = "application/json", + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any - ) -> _models.PhpWorkloadResource: - """Update PHP workload resource. + ) -> None: + """Deletes a MigrationConfiguration. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param resource_patch_request_body: Workload resource update data. Required. - :type resource_patch_request_body: ~azure.mgmt.workloads.models.PatchResourceRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def update( - self, - resource_group_name: str, - php_workload_name: str, - resource_patch_request_body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PhpWorkloadResource: - """Update PHP workload resource. + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param resource_patch_request_body: Workload resource update data. Required. - :type resource_patch_request_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" + } @distributed_trace - def update( + def get( self, resource_group_name: str, - php_workload_name: str, - resource_patch_request_body: Union[_models.PatchResourceRequestBody, IO], + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], **kwargs: Any - ) -> _models.PhpWorkloadResource: - """Update PHP workload resource. + ) -> _models.MigrationConfigProperties: + """Retrieves Migration Config. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param resource_patch_request_body: Workload resource update data. Is either a model type or a - IO type. Required. - :type resource_patch_request_body: ~azure.mgmt.workloads.models.PatchResourceRequestBody or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :return: PhpWorkloadResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource + :return: MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigProperties :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -832,32 +739,21 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PhpWorkloadResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource_patch_request_body, (IO, bytes)): - _content = resource_patch_request_body - else: - _json = self._serialize.body(resource_patch_request_body, "PatchResourceRequestBody") + cls: ClsType[_models.MigrationConfigProperties] = kwargs.pop("cls", None) - request = build_update_request( + request = build_get_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + config_name=config_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -875,20 +771,41 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PhpWorkloadResource", pipeline_response) + deserialized = self._deserialize("MigrationConfigProperties", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}" } - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, php_workload_name: str, delete_infra: Optional[str] = None, **kwargs: Any + @distributed_trace + def complete_migration( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + **kwargs: Any ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -900,18 +817,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + request = build_complete_migration_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + config_name=config_name, subscription_id=self._config.subscription_id, - delete_infra=delete_infra, api_version=api_version, - template_url=self._delete_initial.metadata["url"], + template_url=self.complete_migration.metadata["url"], headers=_headers, params=_params, ) @@ -924,7 +841,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -932,80 +849,75 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + complete_migration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade" } @distributed_trace - def begin_delete( - self, resource_group_name: str, php_workload_name: str, delete_infra: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete PHP workload resource. + def revert( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, _models.MigrationConfigurationName], + **kwargs: Any + ) -> None: + """This operation reverts Migration. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param delete_infra: Whether to delete infra along with workload resource. Default value is - None. - :type delete_infra: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". "$default" Required. + :type config_name: str or + ~azure.mgmt.servicebus.v2022_10_01_preview.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - delete_infra=delete_infra, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) + request = build_revert_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.revert.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}" + revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert" } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_namespaces_operations.py new file mode 100644 index 000000000000..25102dde4037 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_namespaces_operations.py @@ -0,0 +1,2419 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_network_rule_set_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_network_rule_set_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_network_rule_sets_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_authorization_rules_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_authorization_rule_request( + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_authorization_rule_request( + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_authorization_rule_request( + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_keys_request( + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_keys_request( + resource_group_name: str, namespace_name: str, authorization_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NamespacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`namespaces` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.SBNamespace"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SBNamespace"]: + """Gets the available namespaces within a resource group. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespace or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBNamespaceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBNamespaceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces" + } + + def _create_or_update_initial( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> Optional[_models.SBNamespace]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespace") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, namespace_name: str, parameters: Union[_models.SBNamespace, IO], **kwargs: Any + ) -> LROPoller[_models.SBNamespace]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. Is either a SBNamespace + type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SBNamespace", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + namespace_name=namespace_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @distributed_trace + def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _models.SBNamespace: + """Gets a description for the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBNamespace] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.SBNamespaceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespaceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.SBNamespaceUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.SBNamespace]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. Is either a + SBNamespaceUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespaceUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace or None or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBNamespace or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.SBNamespace]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBNamespaceUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SBNamespace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}" + } + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: _models.NetworkRuleSet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: Union[_models.NetworkRuleSet, IO], + **kwargs: Any + ) -> _models.NetworkRuleSet: + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. Is either a NetworkRuleSet type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkRuleSet") + + request = build_create_or_update_network_rule_set_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_network_rule_set.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } + + @distributed_trace + def get_network_rule_set( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> _models.NetworkRuleSet: + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.NetworkRuleSet] = kwargs.pop("cls", None) + + request = build_get_network_rule_set_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_network_rule_set.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRuleSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_network_rule_set.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default" + } + + @distributed_trace + def list_network_rule_sets( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkRuleSet"]: + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSet or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.NetworkRuleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_network_rule_sets_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_network_rule_sets.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRuleSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_network_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets" + } + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: + """Gets the authorization rules for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639376.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules" + } + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates or updates an authorization rule for a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639410.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def delete_authorization_rule( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639417.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def get_authorization_rule( + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Gets an authorization rule for a namespace by rule name. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639392.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def list_keys( + self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any + ) -> _models.AccessKeys: + """Gets the primary and secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639398.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys" + } + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings for the namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt718977.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, parameters: Union[_models.CheckNameAvailability, IO], **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. Is either a + CheckNameAvailability type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailability or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailability") + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_operations.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_operations.py index b336577f78ba..169b12019deb 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_operations.py @@ -27,8 +27,8 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsClientMixinABC, _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import _convert_request if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -41,22 +41,17 @@ _SERIALIZER.client_side_validation = False -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceBus/operations") # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,14 +62,14 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class SkusOperations: +class Operations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.workloads.WorkloadsClient`'s - :attr:`skus` attribute. + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`operations` attribute. """ models = _models @@ -87,21 +82,22 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.SkuDefinition"]: - """Lists all the available SKUs under this PR. + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """Lists all of the available ServiceBus REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SkuDefinition or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SkuDefinition] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[_models.SkusListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +111,6 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -143,7 +138,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("SkusListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -166,4 +161,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/skus"} + list.metadata = {"url": "/providers/Microsoft.ServiceBus/operations"} diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_patch.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_private_endpoint_connections_operations.py similarity index 60% rename from sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_private_endpoint_connections_operations.py index 4fcefaa8dcbe..da4e275599fe 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_private_endpoint_connections_operations.py @@ -29,8 +29,8 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsClientMixinABC, _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -44,27 +44,27 @@ def build_list_request( - resource_group_name: str, php_workload_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -78,28 +78,36 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, php_workload_name: str, subscription_id: str, **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -108,34 +116,42 @@ def build_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - resource_group_name: str, php_workload_name: str, subscription_id: str, **kwargs: Any +def build_delete_request( + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -144,35 +160,40 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, php_workload_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, "str"), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -183,17 +204,17 @@ def build_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class WordpressInstancesOperations: +class PrivateEndpointConnectionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.workloads.WorkloadsClient`'s - :attr:`wordpress_instances` attribute. + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models @@ -207,28 +228,31 @@ def __init__(self, *args, **kwargs): @distributed_trace def list( - self, resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> Iterable["_models.WordpressInstanceResource"]: - """Lists WordPress instance resources under a phpWorkload resource. + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """Gets the available PrivateEndpointConnections within a namespace. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639412.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WordpressInstanceResource or the result of + :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.WordpressInstanceResource] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[_models.WordpressInstanceResourceList] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -243,7 +267,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata["url"], @@ -272,7 +296,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("WordpressInstanceResourceList", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -296,21 +320,107 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections" } + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def get(self, resource_group_name: str, php_workload_name: str, **kwargs: Any) -> _models.WordpressInstanceResource: - """Gets the WordPress instance resource. + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Creates or updates PrivateEndpointConnections of service namespace. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639408.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: WordpressInstanceResource or the result of cls(response) - :rtype: ~azure.mgmt.workloads.models.WordpressInstanceResource + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -321,20 +431,33 @@ def get(self, resource_group_name: str, php_workload_name: str, **kwargs: Any) - } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[_models.WordpressInstanceResource] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + request = build_create_or_update_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -347,29 +470,32 @@ def get(self, resource_group_name: str, php_workload_name: str, **kwargs: Any) - response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } - def _create_or_update_initial( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: Union[_models.WordpressInstanceResource, IO], - **kwargs: Any - ) -> _models.WordpressInstanceResource: + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -378,32 +504,21 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WordpressInstanceResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(wordpress_instance_resource, (IO, bytes)): - _content = wordpress_instance_resource - else: - _json = self._serialize.body(wordpress_instance_resource, "WordpressInstanceResource") + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_create_or_update_request( + request = build_delete_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -416,119 +531,33 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } - @overload - def begin_create_or_update( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: _models.WordpressInstanceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.WordpressInstanceResource]: - """Create or updated WordPress instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param wordpress_instance_resource: Resource create or update request payload. Required. - :type wordpress_instance_resource: ~azure.mgmt.workloads.models.WordpressInstanceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either WordpressInstanceResource or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.WordpressInstanceResource]: - """Create or updated WordPress instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param wordpress_instance_resource: Resource create or update request payload. Required. - :type wordpress_instance_resource: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either WordpressInstanceResource or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - php_workload_name: str, - wordpress_instance_resource: Union[_models.WordpressInstanceResource, IO], - **kwargs: Any - ) -> LROPoller[_models.WordpressInstanceResource]: - """Create or updated WordPress instance resource. + def begin_delete( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Private Endpoint Connection. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639389.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str - :param wordpress_instance_resource: Resource create or update request payload. Is either a - model type or a IO type. Required. - :type wordpress_instance_resource: ~azure.mgmt.workloads.models.WordpressInstanceResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -537,29 +566,26 @@ def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WordpressInstanceResource or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WordpressInstanceResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, - php_workload_name=php_workload_name, - wordpress_instance_resource=wordpress_instance_resource, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -567,16 +593,12 @@ def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WordpressInstanceResource", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -590,24 +612,28 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> None: - """Delete WordPress instance resource. + def get( + self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a description for the specified Private Endpoint Connection. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param php_workload_name: Php workload name. Required. - :type php_workload_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. Required. + :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -621,17 +647,18 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_delete_request( + request = build_get_request( resource_group_name=resource_group_name, - php_workload_name=php_workload_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -644,14 +671,18 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default" + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}" } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..e22a84ada4e8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,162 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, namespace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, namespace_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets lists of resources that supports Privatelinks. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639379.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.PrivateLinkResourcesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_queues_operations.py new file mode 100644 index 000000000000..c50187be3263 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_queues_operations.py @@ -0,0 +1,1549 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_authorization_rules_request( + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_authorization_rule_request( + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_authorization_rule_request( + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_authorization_rule_request( + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_keys_request( + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_keys_request( + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_namespace_request( + resource_group_name: str, + namespace_name: str, + subscription_id: str, + *, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, namespace_name: str, queue_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "queueName": _SERIALIZER.url("queue_name", queue_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class QueuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`queues` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: + """Gets all authorization rules for a queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705607.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules" + } + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def delete_authorization_rule( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705609.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Gets an authorization rule for a queue by rule name. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705611.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.AccessKeys: + """Primary and secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705608.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys" + } + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates the primary or secondary connection strings to the queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt705606.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @distributed_trace + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SBQueue"]: + """Gets the queues within a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639415.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBQueueListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_namespace_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBQueueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: _models.SBQueue, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: Union[_models.SBQueue, IO], + **kwargs: Any + ) -> _models.SBQueue: + """Creates or updates a Service Bus queue. This operation is idempotent. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639395.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. Is either a + SBQueue type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBQueue") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBQueue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639411.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } + + @distributed_trace + def get(self, resource_group_name: str, namespace_name: str, queue_name: str, **kwargs: Any) -> _models.SBQueue: + """Returns a description for the specified queue. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639380.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param queue_name: The queue name. Required. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBQueue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBQueue] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + queue_name=queue_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBQueue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_rules_operations.py new file mode 100644 index 000000000000..ef7f5d8bd46a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_rules_operations.py @@ -0,0 +1,686 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscriptions_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + subscription_id: str, + *, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`rules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.Rule"]: + """List all the rules within given topic-subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscriptions_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_subscriptions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscriptions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: _models.Rule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: Union[_models.Rule, IO], + **kwargs: Any + ) -> _models.Rule: + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. Is either a Rule type or a IO type. + Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Rule") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Rule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> _models.Rule: + """Retrieves the description for the specified rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param rule_name: The rule name. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.Rule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Rule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..8a7847422011 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_subscriptions_operations.py @@ -0,0 +1,665 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_topic_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_id: str, + *, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionName": _SERIALIZER.url("subscription_name", subscription_name, "str", max_length=50, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SBSubscription"]: + """List all the subscriptions under a specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639400.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscription or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBSubscriptionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_topic_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_topic.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBSubscriptionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_topic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: _models.SBSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: Union[_models.SBSubscription, IO], + **kwargs: Any + ) -> _models.SBSubscription: + """Creates a topic subscription. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639385.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. Is either a + SBSubscription type or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBSubscription") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639381.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, namespace_name: str, topic_name: str, subscription_name: str, **kwargs: Any + ) -> _models.SBSubscription: + """Returns a subscription description for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639402.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param subscription_name: The subscription name. Required. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBSubscription] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_name=subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_topics_operations.py new file mode 100644 index 000000000000..c20a032fe894 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/operations/_topics_operations.py @@ -0,0 +1,1558 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_authorization_rules_request( + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_authorization_rule_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_authorization_rule_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_authorization_rule_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_keys_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_keys_request( + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "authorizationRuleName": _SERIALIZER.url( + "authorization_rule_name", authorization_rule_name, "str", max_length=50, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_namespace_request( + resource_group_name: str, + namespace_name: str, + subscription_id: str, + *, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int", maximum=1000, minimum=0) + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, namespace_name: str, topic_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, "str", max_length=50, min_length=6), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class TopicsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicebus.v2022_10_01_preview.ServiceBusManagementClient`'s + :attr:`topics` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_authorization_rules( + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> Iterable["_models.SBAuthorizationRule"]: + """Gets authorization rules for a topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRule or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRuleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_authorization_rules.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBAuthorizationRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_authorization_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules" + } + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: _models.SBAuthorizationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.SBAuthorizationRule, IO], + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Creates an authorization rule for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720678.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. Is either a SBAuthorizationRule type + or a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBAuthorizationRule") + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.SBAuthorizationRule: + """Returns the specified authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720676.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBAuthorizationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBAuthorizationRule] = kwargs.pop("cls", None) + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBAuthorizationRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def delete_authorization_rule( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720681.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete_authorization_rule.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}" + } + + @distributed_trace + def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> _models.AccessKeys: + """Gets the primary and secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720677.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys" + } + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: _models.RegenerateAccessKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: Union[_models.RegenerateAccessKeyParameters, IO], + **kwargs: Any + ) -> _models.AccessKeys: + """Regenerates primary or secondary connection strings for the topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt720679.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. Required. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. Is either a + RegenerateAccessKeyParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicebus.v2022_10_01_preview.models.RegenerateAccessKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.AccessKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RegenerateAccessKeyParameters") + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + } + + @distributed_trace + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SBTopic"]: + """Gets all the topics in a namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639388.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. Default value is None. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBTopicListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_namespace_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list_by_namespace.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SBTopicListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_namespace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: _models.SBTopic, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: Union[_models.SBTopic, IO], + **kwargs: Any + ) -> _models.SBTopic: + """Creates a topic in the specified namespace. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639409.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. Is either a SBTopic type or + a IO type. Required. + :type parameters: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SBTopic") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBTopic", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639404.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } + + @distributed_trace + def get(self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any) -> _models.SBTopic: + """Returns a description for the specified topic. + + .. seealso:: + - https://msdn.microsoft.com/en-us/library/azure/mt639399.aspx + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param namespace_name: The namespace name. Required. + :type namespace_name: str + :param topic_name: The topic name. Required. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2022_10_01_preview.models.SBTopic + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-10-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-10-01-preview") + ) + cls: ClsType[_models.SBTopic] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + topic_name=topic_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SBTopic", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}" + } diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2022_10_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_create.py new file mode 100644 index 000000000000..b20e0882a66e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_create.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python private_end_point_connection_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subID", + ) + + response = client.private_endpoint_connections.create_or_update( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-2924", + private_endpoint_connection_name="privateEndpointConnectionName", + parameters={ + "properties": { + "privateEndpoint": { + "id": "/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-ServiceBus-8396/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-2847" + }, + "privateLinkServiceConnectionState": {"description": "testing", "status": "Rejected"}, + "provisioningState": "Succeeded", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_partition_merge.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_delete.py similarity index 62% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_partition_merge.py rename to sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_delete.py index 01111c9169d8..8429e43d0bc2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_partition_merge.py +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.servicebus import ServiceBusManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-servicebus # USAGE - python cosmos_db_sql_container_partition_merge.py + python private_end_point_connection_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,21 +24,19 @@ def main(): - client = CosmosDBManagementClient( + client = ServiceBusManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", ) - response = client.sql_resources.begin_list_sql_container_partition_merge( - resource_group_name="rgName", - account_name="ddb1", - database_name="databaseName", - container_name="containerName", - merge_parameters={"isDryRun": False}, + response = client.private_endpoint_connections.begin_delete( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-3285", + private_endpoint_connection_name="928c44d5-b7c6-423b-b6fa-811e0c27b3e0", ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBSqlContainerPartitionMerge.json +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_get.py new file mode 100644 index 000000000000..77bf3584d74b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python private_end_point_connection_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subID", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="SDK-ServiceBus-4794", + namespace_name="sdk-Namespace-5828", + private_endpoint_connection_name="privateEndpointConnectionName", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_list.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_list.py new file mode 100644 index 000000000000..52955c81bf88 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_end_point_connection_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python private_end_point_connection_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subID", + ) + + response = client.private_endpoint_connections.list( + resource_group_name="SDK-ServiceBus-4794", + namespace_name="sdk-Namespace-5828", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionList.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_link_resources_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_link_resources_get.py new file mode 100644 index 000000000000..8ff0901e9d81 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/private_link_resources_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python private_link_resources_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subID", + ) + + response = client.private_link_resources.get( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-2924", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/PrivateLinkResourcesGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_create_correlation_filter.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_create_correlation_filter.py new file mode 100644 index 000000000000..5b24f0fd2738 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_create_correlation_filter.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python rule_create_correlation_filter.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.rules.create_or_update( + resource_group_name="resourceGroupName", + namespace_name="sdk-Namespace-1319", + topic_name="sdk-Topics-2081", + subscription_name="sdk-Subscriptions-8691", + rule_name="sdk-Rules-6571", + parameters={ + "properties": { + "correlationFilter": {"properties": {"topicHint": "Crop"}}, + "filterType": "CorrelationFilter", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Rules/RuleCreate_CorrelationFilter.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_create_sql_filter.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_create_sql_filter.py new file mode 100644 index 000000000000..a7a517f9df11 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_create_sql_filter.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python rule_create_sql_filter.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.rules.create_or_update( + resource_group_name="resourceGroupName", + namespace_name="sdk-Namespace-1319", + topic_name="sdk-Topics-2081", + subscription_name="sdk-Subscriptions-8691", + rule_name="sdk-Rules-6571", + parameters={"properties": {"filterType": "SqlFilter", "sqlFilter": {"sqlExpression": "myproperty=test"}}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Rules/RuleCreate_SqlFilter.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_delete.py new file mode 100644 index 000000000000..f3bc5c47eb9b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_delete.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python rule_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.rules.delete( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-1319", + topic_name="sdk-Topics-2081", + subscription_name="sdk-Subscriptions-8691", + rule_name="sdk-Rules-6571", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Rules/RuleDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_get.py new file mode 100644 index 000000000000..308777386174 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python rule_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.rules.get( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-1319", + topic_name="sdk-Topics-2081", + subscription_name="sdk-Subscriptions-8691", + rule_name="sdk-Rules-6571", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Rules/RuleGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_list_by_subscription.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_list_by_subscription.py new file mode 100644 index 000000000000..d41bb82e14d2 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/rule_list_by_subscription.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python rule_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.rules.list_by_subscriptions( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-1319", + topic_name="sdk-Topics-2081", + subscription_name="sdk-Subscriptions-8691", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Rules/RuleListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_get.py new file mode 100644 index 000000000000..30063f039cbd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_authorization_rule_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="exampleSubscriptionId", + ) + + response = client.disaster_recovery_configs.get_authorization_rule( + resource_group_name="exampleResourceGroup", + namespace_name="sdk-Namespace-9080", + alias="sdk-DisasterRecovery-4879", + authorization_rule_name="sdk-Authrules-4879", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasAuthorizationRuleGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_list_all.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_list_all.py new file mode 100644 index 000000000000..955fd0d97fce --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_list_all.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_authorization_rule_list_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="exampleSubscriptionId", + ) + + response = client.disaster_recovery_configs.list_authorization_rules( + resource_group_name="exampleResourceGroup", + namespace_name="sdk-Namespace-9080", + alias="sdk-DisasterRecovery-4047", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasAuthorizationRuleListAll.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_list_key.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_list_key.py new file mode 100644 index 000000000000..86f8ac4483d7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_authorization_rule_list_key.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_authorization_rule_list_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="exampleSubscriptionId", + ) + + response = client.disaster_recovery_configs.list_keys( + resource_group_name="exampleResourceGroup", + namespace_name="sdk-Namespace-2702", + alias="sdk-DisasterRecovery-4047", + authorization_rule_name="sdk-Authrules-1746", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasAuthorizationRuleListKey.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_check_name_availability.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_check_name_availability.py new file mode 100644 index 000000000000..29f275abb093 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_check_name_availability.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_check_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="exampleSubscriptionId", + ) + + response = client.disaster_recovery_configs.check_name_availability( + resource_group_name="exampleResourceGroup", + namespace_name="sdk-Namespace-9080", + parameters={"name": "sdk-DisasterRecovery-9474"}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasCheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_create.py new file mode 100644 index 000000000000..eede415f8ba8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_create.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.disaster_recovery_configs.create_or_update( + resource_group_name="ardsouzatestRG", + namespace_name="sdk-Namespace-8860", + alias="sdk-Namespace-8860", + parameters={ + "properties": {"alternateName": "alternameforAlias-Namespace-8860", "partnerNamespace": "sdk-Namespace-37"} + }, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_delete.py new file mode 100644 index 000000000000..1ebca90e4db9 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.disaster_recovery_configs.delete( + resource_group_name="SouthCentralUS", + namespace_name="sdk-Namespace-8860", + alias="sdk-DisasterRecovery-3814", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_fail_over.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_fail_over.py new file mode 100644 index 000000000000..feb1086aa8c4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_fail_over.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_fail_over.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.disaster_recovery_configs.fail_over( + resource_group_name="ardsouzatestRG", + namespace_name="sdk-Namespace-8860", + alias="sdk-DisasterRecovery-3814", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasFailOver.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_get.py new file mode 100644 index 000000000000..2ce1fbe64f2e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.disaster_recovery_configs.get( + resource_group_name="ardsouzatestRG", + namespace_name="sdk-Namespace-8860", + alias="sdk-DisasterRecovery-3814", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_list.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_list.py new file mode 100644 index 000000000000..d2c17fd286ef --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_alias_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_alias_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.disaster_recovery_configs.list( + resource_group_name="ardsouzatestRG", + namespace_name="sdk-Namespace-8860", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBAliasList.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_complete_migration.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_complete_migration.py new file mode 100644 index 000000000000..7a429b82386e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_complete_migration.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_migrationconfiguration_complete_migration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SubscriptionId", + ) + + response = client.migration_configs.complete_migration( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-41", + config_name="$default", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Migrationconfigurations/SBMigrationconfigurationCompleteMigration.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_create_and_start_migration.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_create_and_start_migration.py new file mode 100644 index 000000000000..43c50982646a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_create_and_start_migration.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_migrationconfiguration_create_and_start_migration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SubscriptionId", + ) + + response = client.migration_configs.begin_create_and_start_migration( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-41", + config_name="$default", + parameters={ + "properties": { + "postMigrationName": "sdk-PostMigration-5919", + "targetNamespace": "/subscriptions/SubscriptionId/resourceGroups/ResourceGroup/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-4028", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Migrationconfigurations/SBMigrationconfigurationCreateAndStartMigration.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_delete.py new file mode 100644 index 000000000000..38a2bf91bc15 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_migrationconfiguration_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SubscriptionId", + ) + + response = client.migration_configs.delete( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-41", + config_name="$default", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Migrationconfigurations/SBMigrationconfigurationDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_get.py new file mode 100644 index 000000000000..4f192da17513 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_migrationconfiguration_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SubscriptionId", + ) + + response = client.migration_configs.get( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-41", + config_name="$default", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Migrationconfigurations/SBMigrationconfigurationGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_list.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_list.py new file mode 100644 index 000000000000..487ead2e4f1d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_migrationconfiguration_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SubscriptionId", + ) + + response = client.migration_configs.list( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-9259", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Migrationconfigurations/SBMigrationconfigurationList.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_revert.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_revert.py new file mode 100644 index 000000000000..7dec86929978 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_migrationconfiguration_revert.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_migrationconfiguration_revert.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SubscriptionId", + ) + + response = client.migration_configs.revert( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-41", + config_name="$default", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Migrationconfigurations/SBMigrationconfigurationRevert.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_create.py new file mode 100644 index 000000000000..c5a61d19212b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_create.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_authorization_rule_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.create_or_update_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-6914", + authorization_rule_name="sdk-AuthRules-1788", + parameters={"properties": {"rights": ["Listen", "Send"]}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceAuthorizationRuleCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_delete.py new file mode 100644 index 000000000000..09b8ec4d1d7d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_authorization_rule_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.delete_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-namespace-6914", + authorization_rule_name="sdk-AuthRules-1788", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceAuthorizationRuleDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_get.py new file mode 100644 index 000000000000..3c713fb3f4c1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_authorization_rule_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.get_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-6914", + authorization_rule_name="sdk-AuthRules-1788", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceAuthorizationRuleGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_list_all.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_list_all.py new file mode 100644 index 000000000000..2891f2b9f035 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_list_all.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_authorization_rule_list_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.list_authorization_rules( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-6914", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceAuthorizationRuleListAll.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_list_key.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_list_key.py new file mode 100644 index 000000000000..714c2942a65c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_list_key.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_authorization_rule_list_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.list_keys( + resource_group_name="ArunMonocle", + namespace_name="sdk-namespace-6914", + authorization_rule_name="sdk-AuthRules-1788", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceAuthorizationRuleListKey.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_regenerate_key.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_regenerate_key.py new file mode 100644 index 000000000000..c5ac0e528291 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_authorization_rule_regenerate_key.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_authorization_rule_regenerate_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.regenerate_keys( + resource_group_name="ArunMonocle", + namespace_name="sdk-namespace-6914", + authorization_rule_name="sdk-AuthRules-1788", + parameters={"keyType": "PrimaryKey"}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceAuthorizationRuleRegenerateKey.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_check_name_availability.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_check_name_availability.py new file mode 100644 index 000000000000..cfd4da4ad12c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_check_name_availability.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_check_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.check_name_availability( + parameters={"name": "sdk-Namespace-2924"}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceCheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_create_update.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_create.py similarity index 60% rename from sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_create_update.py rename to sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_create.py index 600417639f0a..f50459177a79 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_create_update.py +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_create.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.servicebus import ServiceBusManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-cosmosdb + pip install azure-mgmt-servicebus # USAGE - python cosmos_db_graph_create_update.py + python sb_name_space_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,24 +24,23 @@ def main(): - client = CosmosDBManagementClient( + client = ServiceBusManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", ) - response = client.graph_resources.begin_create_update_graph( - resource_group_name="rg1", - account_name="ddb1", - graph_name="graphName", - create_update_graph_parameters={ - "location": "West US", - "properties": {"options": {}, "resource": {"id": "graphName"}}, - "tags": {}, + response = client.namespaces.begin_create_or_update( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace2924", + parameters={ + "location": "South Central US", + "sku": {"name": "Standard", "tier": "Standard"}, + "tags": {"tag1": "value1", "tag2": "value2"}, }, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-08-15-preview/examples/CosmosDBGraphResourceCreateUpdate.json +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceCreate.json if __name__ == "__main__": main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_delete.py new file mode 100644 index 000000000000..d4c3b933ab75 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.begin_delete( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-3285", + ).result() + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_get.py new file mode 100644 index 000000000000..33fd6fcb183c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.get( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-2924", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_list.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_list.py new file mode 100644 index 000000000000..8cbb0cfd02fc --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceList.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_list_by_resource_group.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_list_by_resource_group.py new file mode 100644 index 000000000000..63a57b4a6903 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.list_by_resource_group( + resource_group_name="ArunMonocle", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_update.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_update.py new file mode 100644 index 000000000000..27012d9f33f3 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_name_space_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_name_space_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.namespaces.update( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-3285", + parameters={"location": "South Central US", "tags": {"tag3": "value3", "tag4": "value4"}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/SBNameSpaceUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_create.py new file mode 100644 index 000000000000..5a6121a269eb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_create.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_network_rule_set_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="Subscription", + ) + + response = client.namespaces.create_or_update_network_rule_set( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-6019", + parameters={ + "properties": { + "defaultAction": "Deny", + "ipRules": [ + {"action": "Allow", "ipMask": "1.1.1.1"}, + {"action": "Allow", "ipMask": "1.1.1.2"}, + {"action": "Allow", "ipMask": "1.1.1.3"}, + {"action": "Allow", "ipMask": "1.1.1.4"}, + {"action": "Allow", "ipMask": "1.1.1.5"}, + ], + "virtualNetworkRules": [ + { + "ignoreMissingVnetServiceEndpoint": True, + "subnet": { + "id": "/subscriptions/854d368f-1828-428f-8f3c-f2affa9b2f7d/resourcegroups/alitest/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet2" + }, + }, + { + "ignoreMissingVnetServiceEndpoint": False, + "subnet": { + "id": "/subscriptions/854d368f-1828-428f-8f3c-f2affa9b2f7d/resourcegroups/alitest/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet3" + }, + }, + { + "ignoreMissingVnetServiceEndpoint": False, + "subnet": { + "id": "/subscriptions/854d368f-1828-428f-8f3c-f2affa9b2f7d/resourcegroups/alitest/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet6" + }, + }, + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/VirtualNetworkRule/SBNetworkRuleSetCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_get.py new file mode 100644 index 000000000000..695b73572b29 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_network_rule_set_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="Subscription", + ) + + response = client.namespaces.get_network_rule_set( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-6019", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/VirtualNetworkRule/SBNetworkRuleSetGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_list.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_list.py new file mode 100644 index 000000000000..ea110b8800c7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_network_rule_set_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_network_rule_set_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="Subscription", + ) + + response = client.namespaces.list_network_rule_sets( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-6019", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/NameSpaces/VirtualNetworkRule/SBNetworkRuleSetList.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_operations_list.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_operations_list.py new file mode 100644 index 000000000000..264bc8f0b63f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/SBOperations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_create.py new file mode 100644 index 000000000000..261595ba8f7e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_create.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_authorization_rule_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.create_or_update_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-7982", + queue_name="sdk-Queues-2317", + authorization_rule_name="sdk-AuthRules-5800", + parameters={"properties": {"rights": ["Listen", "Send"]}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueAuthorizationRuleCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_delete.py new file mode 100644 index 000000000000..926892adce78 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_authorization_rule_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.delete_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-namespace-7982", + queue_name="sdk-Queues-2317", + authorization_rule_name="sdk-AuthRules-5800", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueAuthorizationRuleDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_get.py new file mode 100644 index 000000000000..55d0437579be --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_authorization_rule_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.get_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-7982", + queue_name="sdk-Queues-2317", + authorization_rule_name="sdk-AuthRules-5800", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueAuthorizationRuleGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_list_all.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_list_all.py new file mode 100644 index 000000000000..53c93dbd3acf --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_list_all.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_authorization_rule_list_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.list_authorization_rules( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-7982", + queue_name="sdk-Queues-2317", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueAuthorizationRuleListAll.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_list_key.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_list_key.py new file mode 100644 index 000000000000..0f12a31f3775 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_list_key.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_authorization_rule_list_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.list_keys( + resource_group_name="ArunMonocle", + namespace_name="sdk-namespace-7982", + queue_name="sdk-Queues-2317", + authorization_rule_name="sdk-AuthRules-5800", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueAuthorizationRuleListKey.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_regenerate_key.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_regenerate_key.py new file mode 100644 index 000000000000..925fb902ad9f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_authorization_rule_regenerate_key.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_authorization_rule_regenerate_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.regenerate_keys( + resource_group_name="ArunMonocle", + namespace_name="sdk-namespace-7982", + queue_name="sdk-Queues-2317", + authorization_rule_name="sdk-AuthRules-5800", + parameters={"keyType": "PrimaryKey"}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueAuthorizationRuleRegenerateKey.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_create.py new file mode 100644 index 000000000000..4e8cab3f0031 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_create.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.create_or_update( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-3174", + queue_name="sdk-Queues-5647", + parameters={"properties": {"enablePartitioning": True}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_delete.py new file mode 100644 index 000000000000..b6b6cc27c448 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.delete( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-183", + queue_name="sdk-Queues-8708", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_get.py new file mode 100644 index 000000000000..80305861c9ca --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.get( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-3174", + queue_name="sdk-Queues-5647", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_list_by_name_space.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_list_by_name_space.py new file mode 100644 index 000000000000..7b60f279dec4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_queue_list_by_name_space.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_queue_list_by_name_space.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.queues.list_by_namespace( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-3174", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Queues/SBQueueListByNameSpace.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_create.py new file mode 100644 index 000000000000..efbe5a6e19a4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_create.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_subscription_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="Subscriptionid", + ) + + response = client.subscriptions.create_or_update( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-1349", + topic_name="sdk-Topics-8740", + subscription_name="sdk-Subscriptions-2178", + parameters={"properties": {"enableBatchedOperations": True}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Subscriptions/SBSubscriptionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_delete.py new file mode 100644 index 000000000000..aff798a100a4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_subscription_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.subscriptions.delete( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-5882", + topic_name="sdk-Topics-1804", + subscription_name="sdk-Subscriptions-3670", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Subscriptions/SBSubscriptionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_get.py new file mode 100644 index 000000000000..5b757a870900 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_subscription_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="Subscriptionid", + ) + + response = client.subscriptions.get( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-1349", + topic_name="sdk-Topics-8740", + subscription_name="sdk-Subscriptions-2178", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Subscriptions/SBSubscriptionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_list_by_topic.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_list_by_topic.py new file mode 100644 index 000000000000..24671e78ace8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_subscription_list_by_topic.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_subscription_list_by_topic.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5{Subscriptionid}", + ) + + response = client.subscriptions.list_by_topic( + resource_group_name="ResourceGroup", + namespace_name="sdk-Namespace-1349", + topic_name="sdk-Topics-8740", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Subscriptions/SBSubscriptionListByTopic.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_create.py new file mode 100644 index 000000000000..e582bafdc0d1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_create.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_authorization_rule_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.create_or_update_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-6261", + topic_name="sdk-Topics-1984", + authorization_rule_name="sdk-AuthRules-4310", + parameters={"properties": {"rights": ["Listen", "Send"]}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicAuthorizationRuleCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_delete.py new file mode 100644 index 000000000000..7bcedb72deb7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_authorization_rule_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.delete_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-6261", + topic_name="sdk-Topics-1984", + authorization_rule_name="sdk-AuthRules-4310", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicAuthorizationRuleDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_get.py new file mode 100644 index 000000000000..ac9d9795d619 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_authorization_rule_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.get_authorization_rule( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-6261", + topic_name="sdk-Topics-1984", + authorization_rule_name="sdk-AuthRules-4310", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicAuthorizationRuleGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_list_all.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_list_all.py new file mode 100644 index 000000000000..041eaa46ec15 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_list_all.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_authorization_rule_list_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.list_authorization_rules( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-6261", + topic_name="sdk-Topics-1984", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicAuthorizationRuleListAll.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_list_key.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_list_key.py new file mode 100644 index 000000000000..d8de9c93e92f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_list_key.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_authorization_rule_list_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="e2f361f0-3b27-4503-a9cc-21cfba380093", + ) + + response = client.topics.list_keys( + resource_group_name="Default-ServiceBus-WestUS", + namespace_name="sdk-Namespace8408", + topic_name="sdk-Topics2075", + authorization_rule_name="sdk-Authrules5067", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicAuthorizationRuleListKey.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_regenerate_key.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_regenerate_key.py new file mode 100644 index 000000000000..70c28a861670 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_authorization_rule_regenerate_key.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_authorization_rule_regenerate_key.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="e2f361f0-3b27-4503-a9cc-21cfba380093", + ) + + response = client.topics.regenerate_keys( + resource_group_name="Default-ServiceBus-WestUS", + namespace_name="sdk-Namespace8408", + topic_name="sdk-Topics2075", + authorization_rule_name="sdk-Authrules5067", + parameters={"keyType": "PrimaryKey"}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicAuthorizationRuleRegenerateKey.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_create.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_create.py new file mode 100644 index 000000000000..c90dc8a6f2c7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_create.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.create_or_update( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-1617", + topic_name="sdk-Topics-5488", + parameters={"properties": {"enableExpress": True}}, + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_delete.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_delete.py new file mode 100644 index 000000000000..669841fc21c1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.delete( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-1617", + topic_name="sdk-Topics-5488", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_get.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_get.py new file mode 100644 index 000000000000..6808a263214d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.get( + resource_group_name="ArunMonocle", + namespace_name="sdk-Namespace-1617", + topic_name="sdk-Topics-5488", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_list_by_name_space.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_list_by_name_space.py new file mode 100644 index 000000000000..bcd820e448bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sb_topic_list_by_name_space.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sb_topic_list_by_name_space.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.topics.list_by_namespace( + resource_group_name="Default-ServiceBus-WestUS", + namespace_name="sdk-Namespace-1617", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/Topics/SBTopicListByNameSpace.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sbeh_alias_break_pairing.py b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sbeh_alias_break_pairing.py new file mode 100644 index 000000000000..95adcd7d9b31 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/generated_samples/sbeh_alias_break_pairing.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicebus import ServiceBusManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicebus +# USAGE + python sbeh_alias_break_pairing.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceBusManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4", + ) + + response = client.disaster_recovery_configs.break_pairing( + resource_group_name="ardsouzatestRG", + namespace_name="sdk-Namespace-8860", + alias="sdk-DisasterRecovery-3814", + ) + print(response) + + +# x-ms-original-file: specification/servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/examples/disasterRecoveryConfigs/SBEHAliasBreakPairing.json +if __name__ == "__main__": + main() diff --git a/sdk/servicebus/azure-mgmt-servicebus/setup.py b/sdk/servicebus/azure-mgmt-servicebus/setup.py index 3ac11e5d3add..452c2b3ee13d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/setup.py +++ b/sdk/servicebus/azure-mgmt-servicebus/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -69,9 +70,10 @@ 'pytyped': ['py.typed'], }, install_requires=[ - 'msrest>=0.7.1', - 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.2,<2.0.0', + "msrest>=0.7.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", ], python_requires=">=3.7" ) diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.pyTestMgmtServiceBustest_queue.json b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.pyTestMgmtServiceBustest_queue.json index c11f2e6bccf6..399f74df9c88 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.pyTestMgmtServiceBustest_queue.json +++ b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.pyTestMgmtServiceBustest_queue.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:38:37 GMT", + "Date": "Wed, 15 Feb 2023 03:14:46 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13481.9 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -86,7 +86,7 @@ "email" ], "kerberos_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/kerberos", - "tenant_region_scope": "NA", + "tenant_region_scope": "WW", "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:38:37 GMT", + "Date": "Wed, 15 Feb 2023 03:14:46 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13481.9 - WUS2 ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "cc27736b-6479-42c6-af59-789c8bea5526", + "client-request-id": "986c8b49-0233-4d7a-9281-fd92bb6b9ee8", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.18.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "cc27736b-6479-42c6-af59-789c8bea5526", - "Content-Length": "93", + "client-request-id": "986c8b49-0233-4d7a-9281-fd92bb6b9ee8", + "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:38:37 GMT", + "Date": "Wed, 15 Feb 2023 03:14:46 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,13 +201,14 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.13418.10 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { "token_type": "Bearer", - "expires_in": 3599, - "ext_expires_in": 3599, + "expires_in": 86399, + "ext_expires_in": 86399, + "refresh_in": 43199, "access_token": "access_token" } }, @@ -220,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "117", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "eastus", @@ -238,21 +239,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:38:38 GMT", + "Date": "Wed, 15 Feb 2023 03:14:50 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4b083547-2c18-40f1-9e0a-d29794fca99e", + "x-ms-correlation-request-id": "314484df-f91f-417f-ae84-28651ca82262", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "EASTUS2:20220810T073839Z:4b083547-2c18-40f1-9e0a-d29794fca99e" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031450Z:314484df-f91f-417f-ae84-28651ca82262" }, "ResponseBody": { "sku": { @@ -272,8 +273,8 @@ "zoneRedundant": false, "provisioningState": "Created", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx", - "createdAt": "2022-08-10T07:38:38.457Z", - "updatedAt": "2022-08-10T07:38:38.457Z", + "createdAt": "2023-02-15T03:14:50.053Z", + "updatedAt": "2023-02-15T03:14:50.053Z", "serviceBusEndpoint": "https://myNamespacexxyyzzybx.servicebus.windows.net:443/", "status": "Activating" } @@ -286,7 +287,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -294,21 +295,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:08 GMT", + "Date": "Wed, 15 Feb 2023 03:14:50 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b80b9b2a-b9ec-4cb7-82da-915d99bd2794", + "x-ms-correlation-request-id": "7d22da29-60af-4b31-ac61-8d48c044ef47", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "EASTUS2:20220810T073909Z:b80b9b2a-b9ec-4cb7-82da-915d99bd2794" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031451Z:7d22da29-60af-4b31-ac61-8d48c044ef47" }, "ResponseBody": { "sku": { @@ -328,8 +329,8 @@ "zoneRedundant": false, "provisioningState": "Created", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx", - "createdAt": "2022-08-10T07:38:38.457Z", - "updatedAt": "2022-08-10T07:38:38.457Z", + "createdAt": "2023-02-15T03:14:50.053Z", + "updatedAt": "2023-02-15T03:14:50.053Z", "serviceBusEndpoint": "https://myNamespacexxyyzzybx.servicebus.windows.net:443/", "status": "Activating" } @@ -342,7 +343,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -350,21 +351,77 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:39 GMT", + "Date": "Wed, 15 Feb 2023 03:15:20 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "93d16c98-14dc-4d5f-b0b1-cf924e6c8e8c", + "x-ms-correlation-request-id": "c4dd5720-573e-4939-9bab-4aaebfc4efa2", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "EASTUS2:20220810T073939Z:93d16c98-14dc-4d5f-b0b1-cf924e6c8e8c" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031521Z:c4dd5720-573e-4939-9bab-4aaebfc4efa2" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx", + "name": "myNamespacexxyyzzybx", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "East US", + "tags": { + "tag1": "value1", + "tag2": "value2" + }, + "properties": { + "disableLocalAuth": false, + "zoneRedundant": false, + "provisioningState": "Created", + "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx", + "createdAt": "2023-02-15T03:14:50.053Z", + "updatedAt": "2023-02-15T03:14:50.053Z", + "serviceBusEndpoint": "https://myNamespacexxyyzzybx.servicebus.windows.net:443/", + "status": "Activating" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2021-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 03:15:51 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": [ + "Service-Bus-Resource-Provider/CH3", + "Microsoft-HTTPAPI/2.0" + ], + "Server-SB": "Service-Bus-Resource-Provider/CH3", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "18bfe615-2f60-4e1b-bd14-8c2d56bac8e7", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031551Z:18bfe615-2f60-4e1b-bd14-8c2d56bac8e7" }, "ResponseBody": { "sku": { @@ -384,8 +441,8 @@ "zoneRedundant": false, "provisioningState": "Succeeded", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx", - "createdAt": "2022-08-10T07:38:38.457Z", - "updatedAt": "2022-08-10T07:39:22.887Z", + "createdAt": "2023-02-15T03:14:50.053Z", + "updatedAt": "2023-02-15T03:15:33.38Z", "serviceBusEndpoint": "https://myNamespacexxyyzzybx.servicebus.windows.net:443/", "status": "Active" } @@ -400,7 +457,7 @@ "Connection": "keep-alive", "Content-Length": "44", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -412,7 +469,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:41 GMT", + "Date": "Wed, 15 Feb 2023 03:15:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -420,14 +477,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "15ac0e18-be25-46dc-845c-c5c7a9018d6a", + "x-ms-correlation-request-id": "5a1360ae-da59-4ae6-8b7d-d161b4bc6354", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "EASTUS2:20220810T073941Z:15ac0e18-be25-46dc-845c-c5c7a9018d6a" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031553Z:5a1360ae-da59-4ae6-8b7d-d161b4bc6354" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue", "name": "myQueue", - "type": "Microsoft.ServiceBus/Namespaces/Queues", + "type": "Microsoft.ServiceBus/namespaces/queues", "location": "eastus", "properties": { "maxMessageSizeInKilobytes": 256, @@ -453,8 +510,8 @@ "transferMessageCount": 0, "transferDeadLetterMessageCount": 0 }, - "createdAt": "2022-08-10T07:39:41.137Z", - "updatedAt": "2022-08-10T07:39:41.243Z", + "createdAt": "2023-02-15T03:15:52.77Z", + "updatedAt": "2023-02-15T03:15:52.83Z", "accessedAt": "0001-01-01T00:00:00" } } @@ -468,7 +525,7 @@ "Connection": "keep-alive", "Content-Length": "46", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -483,7 +540,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:41 GMT", + "Date": "Wed, 15 Feb 2023 03:15:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -491,14 +548,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c5707e79-db26-4ddc-8c66-c3d3d3f9baa2", + "x-ms-correlation-request-id": "219e47af-d489-4dff-be47-e0959bb44225", "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "EASTUS2:20220810T073941Z:c5707e79-db26-4ddc-8c66-c3d3d3f9baa2" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031554Z:219e47af-d489-4dff-be47-e0959bb44225" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue/authorizationRules/myAuthorizationRule", "name": "myAuthorizationRule", - "type": "Microsoft.ServiceBus/Namespaces/Queues/AuthorizationRules", + "type": "Microsoft.ServiceBus/namespaces/queues/authorizationrules", "properties": { "rights": [ "Listen", @@ -514,7 +571,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -522,7 +579,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:41 GMT", + "Date": "Wed, 15 Feb 2023 03:15:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -530,14 +587,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5e672805-4724-4c9d-b87d-39d962b5f903", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "EASTUS2:20220810T073942Z:5e672805-4724-4c9d-b87d-39d962b5f903" + "x-ms-correlation-request-id": "6be3152c-7cf1-408b-883d-323119bcad0d", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031554Z:6be3152c-7cf1-408b-883d-323119bcad0d" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue/authorizationrules/myAuthorizationRule", "name": "myAuthorizationRule", - "type": "Microsoft.ServiceBus/Namespaces/Queues/AuthorizationRules", + "type": "Microsoft.ServiceBus/namespaces/queues/authorizationrules", "location": "eastus", "properties": { "rights": [ @@ -554,7 +611,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -562,7 +619,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:41 GMT", + "Date": "Wed, 15 Feb 2023 03:15:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -570,14 +627,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "aa5b1208-8810-4c89-b172-a632b58cb92c", - "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "EASTUS2:20220810T073942Z:aa5b1208-8810-4c89-b172-a632b58cb92c" + "x-ms-correlation-request-id": "ffda8ab4-52e9-4939-b7e3-9b3eff44bcab", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031554Z:ffda8ab4-52e9-4939-b7e3-9b3eff44bcab" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue", "name": "myQueue", - "type": "Microsoft.ServiceBus/Namespaces/Queues", + "type": "Microsoft.ServiceBus/namespaces/queues", "location": "eastus", "properties": { "maxMessageSizeInKilobytes": 256, @@ -603,8 +660,8 @@ "transferMessageCount": 0, "transferDeadLetterMessageCount": 0 }, - "createdAt": "2022-08-10T07:39:41.137Z", - "updatedAt": "2022-08-10T07:39:41.91Z", + "createdAt": "2023-02-15T03:15:52.77Z", + "updatedAt": "2023-02-15T03:15:54.06Z", "accessedAt": "0001-01-01T00:00:00Z" } } @@ -618,7 +675,7 @@ "Connection": "keep-alive", "Content-Length": "25", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "keyType": "PrimaryKey" @@ -628,7 +685,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:42 GMT", + "Date": "Wed, 15 Feb 2023 03:15:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -636,9 +693,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c7d9fd25-64f7-4a06-a664-44e5b76686bd", + "x-ms-correlation-request-id": "040cbd69-d5ba-45ae-8997-0c98f2264fa5", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "EASTUS2:20220810T073942Z:c7d9fd25-64f7-4a06-a664-44e5b76686bd" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031555Z:040cbd69-d5ba-45ae-8997-0c98f2264fa5" }, "ResponseBody": { "primaryConnectionString": "Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=SharedAccessKey;EntityPath=myQueue", @@ -656,7 +713,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -664,7 +721,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:39:42 GMT", + "Date": "Wed, 15 Feb 2023 03:15:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -672,9 +729,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8af7cfcc-e372-4350-ae5c-dc167530f44f", + "x-ms-correlation-request-id": "dce39ce1-1f8d-48d9-a6a4-462192b1d826", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "EASTUS2:20220810T073943Z:8af7cfcc-e372-4350-ae5c-dc167530f44f" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031555Z:dce39ce1-1f8d-48d9-a6a4-462192b1d826" }, "ResponseBody": { "primaryConnectionString": "Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=SharedAccessKey;EntityPath=myQueue", @@ -692,22 +749,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:39:42 GMT", + "Date": "Wed, 15 Feb 2023 03:15:55 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7cc6832d-43cb-4fb7-aea2-8b1f750b9b69", + "x-ms-correlation-request-id": "6c232c9e-7873-49ec-a637-3f26c5456962", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "EASTUS2:20220810T073943Z:7cc6832d-43cb-4fb7-aea2-8b1f750b9b69" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031555Z:6c232c9e-7873-49ec-a637-3f26c5456962" }, "ResponseBody": null }, @@ -719,22 +776,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:39:43 GMT", + "Date": "Wed, 15 Feb 2023 03:15:56 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "59634352-71d4-47dd-b269-eb6b72275ac3", + "x-ms-correlation-request-id": "5b11fcd9-d628-4d26-bc47-18812fa301d7", "x-ms-ratelimit-remaining-subscription-deletes": "14998", - "x-ms-routing-request-id": "EASTUS2:20220810T073943Z:59634352-71d4-47dd-b269-eb6b72275ac3" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031556Z:5b11fcd9-d628-4d26-bc47-18812fa301d7" }, "ResponseBody": null }, @@ -746,27 +803,27 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:39:44 GMT", + "Date": "Wed, 15 Feb 2023 03:15:57 GMT", "Expires": "-1", "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2021-11-01", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "35a7ec53-3091-4eac-8e17-8f2493d71a29", + "x-ms-correlation-request-id": "55105daa-a8e8-4897-af2b-b7d15480f92e", "x-ms-ratelimit-remaining-subscription-deletes": "14997", - "x-ms-routing-request-id": "EASTUS2:20220810T073945Z:35a7ec53-3091-4eac-8e17-8f2493d71a29" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031557Z:55105daa-a8e8-4897-af2b-b7d15480f92e" }, "ResponseBody": null }, @@ -777,14 +834,70 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "665", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 03:15:57 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2021-11-01", + "Pragma": "no-cache", + "Retry-After": "43", + "Server": [ + "Service-Bus-Resource-Provider/CH3", + "Microsoft-HTTPAPI/2.0" + ], + "Server-SB": "Service-Bus-Resource-Provider/CH3", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "1042d338-8659-4823-8001-c31afcebf8dc", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031557Z:1042d338-8659-4823-8001-c31afcebf8dc" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx", + "name": "myNamespacexxyyzzybx", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "East US", + "tags": { + "tag1": "value1", + "tag2": "value2" + }, + "properties": { + "disableLocalAuth": false, + "zoneRedundant": false, + "provisioningState": "Succeeded", + "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx", + "createdAt": "2023-02-15T03:14:50.053Z", + "updatedAt": "2023-02-15T03:15:57.143Z", + "serviceBusEndpoint": "https://myNamespacexxyyzzybx.servicebus.windows.net:443/", + "status": "Removing" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2021-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:40:15 GMT", + "Date": "Wed, 15 Feb 2023 03:16:40 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -794,12 +907,12 @@ "Server-SB": "Service-Bus-Resource-Provider/SN1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7fb92471-710d-4873-9005-cc587e8bee73", - "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "EASTUS2:20220810T074015Z:7fb92471-710d-4873-9005-cc587e8bee73" + "x-ms-correlation-request-id": "e6c99969-f680-4f00-a84f-a65e40dde323", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031640Z:e6c99969-f680-4f00-a84f-a65e40dde323" }, "ResponseBody": null } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_subscrpition_and_rule.json b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_subscrpition_and_rule.json index b9ff7ddecafb..02ecdc46a204 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_subscrpition_and_rule.json +++ b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_subscrpition_and_rule.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:40:22 GMT", + "Date": "Wed, 15 Feb 2023 03:16:42 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13418.10 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -86,7 +86,7 @@ "email" ], "kerberos_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/kerberos", - "tenant_region_scope": "NA", + "tenant_region_scope": "WW", "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:40:22 GMT", + "Date": "Wed, 15 Feb 2023 03:16:42 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13418.10 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14601.9 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "019e1cff-9f15-4eae-96e7-cb610617cf34", + "client-request-id": "99451369-319e-40f6-9fb0-f96fc3b94619", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.18.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "019e1cff-9f15-4eae-96e7-cb610617cf34", - "Content-Length": "93", + "client-request-id": "99451369-319e-40f6-9fb0-f96fc3b94619", + "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:40:22 GMT", + "Date": "Wed, 15 Feb 2023 03:16:43 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,13 +201,14 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.13418.10 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { "token_type": "Bearer", - "expires_in": 3599, - "ext_expires_in": 3599, + "expires_in": 86399, + "ext_expires_in": 86399, + "refresh_in": 43199, "access_token": "access_token" } }, @@ -220,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "117", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "eastus", @@ -238,21 +239,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:40:23 GMT", + "Date": "Wed, 15 Feb 2023 03:16:47 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c358e3a7-6138-4d17-988a-6b647e39f1f3", + "x-ms-correlation-request-id": "f5447b9a-dff0-426c-ad86-e30c6f4f3d8a", "x-ms-ratelimit-remaining-subscription-writes": "1196", - "x-ms-routing-request-id": "EASTUS2:20220810T074024Z:c358e3a7-6138-4d17-988a-6b647e39f1f3" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031648Z:f5447b9a-dff0-426c-ad86-e30c6f4f3d8a" }, "ResponseBody": { "sku": { @@ -272,8 +273,8 @@ "zoneRedundant": false, "provisioningState": "Created", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye", - "createdAt": "2022-08-10T07:40:23.5Z", - "updatedAt": "2022-08-10T07:40:23.5Z", + "createdAt": "2023-02-15T03:16:47.397Z", + "updatedAt": "2023-02-15T03:16:47.397Z", "serviceBusEndpoint": "https://myNamespacexxyyzzxyye.servicebus.windows.net:443/", "status": "Activating" } @@ -286,7 +287,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -294,7 +295,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:40:54 GMT", + "Date": "Wed, 15 Feb 2023 03:16:47 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -306,9 +307,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "44d7d325-bd3a-4dd1-bcc8-d923490f98c6", - "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "EASTUS2:20220810T074054Z:44d7d325-bd3a-4dd1-bcc8-d923490f98c6" + "x-ms-correlation-request-id": "cbabdda1-49c0-4de9-866c-5796d24e9630", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031648Z:cbabdda1-49c0-4de9-866c-5796d24e9630" }, "ResponseBody": { "sku": { @@ -328,8 +329,8 @@ "zoneRedundant": false, "provisioningState": "Created", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye", - "createdAt": "2022-08-10T07:40:23.5Z", - "updatedAt": "2022-08-10T07:40:23.5Z", + "createdAt": "2023-02-15T03:16:47.397Z", + "updatedAt": "2023-02-15T03:16:47.397Z", "serviceBusEndpoint": "https://myNamespacexxyyzzxyye.servicebus.windows.net:443/", "status": "Activating" } @@ -342,7 +343,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -350,21 +351,77 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:41:23 GMT", + "Date": "Wed, 15 Feb 2023 03:17:17 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ee06fb19-1297-4e1e-8afd-b9a1362ebe69", - "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "EASTUS2:20220810T074124Z:ee06fb19-1297-4e1e-8afd-b9a1362ebe69" + "x-ms-correlation-request-id": "e2f6e8bf-28ae-4bcb-88b6-f32e3ff96f68", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031718Z:e2f6e8bf-28ae-4bcb-88b6-f32e3ff96f68" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye", + "name": "myNamespacexxyyzzxyye", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "East US", + "tags": { + "tag1": "value1", + "tag2": "value2" + }, + "properties": { + "disableLocalAuth": false, + "zoneRedundant": false, + "provisioningState": "Created", + "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye", + "createdAt": "2023-02-15T03:16:47.397Z", + "updatedAt": "2023-02-15T03:16:47.397Z", + "serviceBusEndpoint": "https://myNamespacexxyyzzxyye.servicebus.windows.net:443/", + "status": "Activating" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2021-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 03:17:48 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": [ + "Service-Bus-Resource-Provider/CH3", + "Microsoft-HTTPAPI/2.0" + ], + "Server-SB": "Service-Bus-Resource-Provider/CH3", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "bf3ea158-09d7-4380-b3f4-7419dcb2f26d", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031748Z:bf3ea158-09d7-4380-b3f4-7419dcb2f26d" }, "ResponseBody": { "sku": { @@ -384,8 +441,8 @@ "zoneRedundant": false, "provisioningState": "Succeeded", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye", - "createdAt": "2022-08-10T07:40:23.5Z", - "updatedAt": "2022-08-10T07:41:07.82Z", + "createdAt": "2023-02-15T03:16:47.397Z", + "updatedAt": "2023-02-15T03:17:31.323Z", "serviceBusEndpoint": "https://myNamespacexxyyzzxyye.servicebus.windows.net:443/", "status": "Active" } @@ -400,7 +457,7 @@ "Connection": "keep-alive", "Content-Length": "39", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -412,7 +469,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:41:25 GMT", + "Date": "Wed, 15 Feb 2023 03:17:50 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -420,14 +477,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "69a4d415-2464-4e94-8f85-f1f76551173e", + "x-ms-correlation-request-id": "22b3a98b-31c6-47b2-8cdc-1dac7d13b59f", "x-ms-ratelimit-remaining-subscription-writes": "1195", - "x-ms-routing-request-id": "EASTUS2:20220810T074126Z:69a4d415-2464-4e94-8f85-f1f76551173e" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031750Z:22b3a98b-31c6-47b2-8cdc-1dac7d13b59f" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic", "name": "myTopic", - "type": "Microsoft.ServiceBus/Namespaces/Topics", + "type": "Microsoft.ServiceBus/namespaces/topics", "location": "eastus", "properties": { "maxMessageSizeInKilobytes": 256, @@ -442,8 +499,8 @@ "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S", "enablePartitioning": false, "enableExpress": true, - "createdAt": "2022-08-10T07:41:25.853Z", - "updatedAt": "2022-08-10T07:41:25.953Z", + "createdAt": "2023-02-15T03:17:50.297Z", + "updatedAt": "2023-02-15T03:17:50.337Z", "accessedAt": "0001-01-01T00:00:00", "subscriptionCount": 0, "countDetails": { @@ -465,7 +522,7 @@ "Connection": "keep-alive", "Content-Length": "49", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -477,7 +534,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:41:27 GMT", + "Date": "Wed, 15 Feb 2023 03:17:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -485,14 +542,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ba48436c-e00f-413b-899e-93bcbe2c55b7", + "x-ms-correlation-request-id": "7ffbb015-55ee-45a4-aa9d-29512940a34c", "x-ms-ratelimit-remaining-subscription-writes": "1194", - "x-ms-routing-request-id": "EASTUS2:20220810T074128Z:ba48436c-e00f-413b-899e-93bcbe2c55b7" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031751Z:7ffbb015-55ee-45a4-aa9d-29512940a34c" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription", "name": "mySubscription", - "type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions", + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", "location": "eastus", "properties": { "isClientAffine": false, @@ -505,8 +562,8 @@ "maxDeliveryCount": 10, "status": "Active", "enableBatchedOperations": true, - "createdAt": "2022-08-10T07:41:27.5024915Z", - "updatedAt": "2022-08-10T07:41:27.5024915Z", + "createdAt": "2023-02-15T03:17:51.8301712Z", + "updatedAt": "2023-02-15T03:17:51.8301712Z", "accessedAt": "0001-01-01T00:00:00", "countDetails": { "activeMessageCount": 0, @@ -528,7 +585,7 @@ "Connection": "keep-alive", "Content-Length": "2", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": {}, "StatusCode": 200, @@ -536,7 +593,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:41:28 GMT", + "Date": "Wed, 15 Feb 2023 03:17:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -544,21 +601,22 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9892fc3e-1a56-48c4-963c-f68947bb8e33", + "x-ms-correlation-request-id": "bbc29f9b-fee7-415e-9efe-d382e8d261b9", "x-ms-ratelimit-remaining-subscription-writes": "1193", - "x-ms-routing-request-id": "EASTUS2:20220810T074129Z:9892fc3e-1a56-48c4-963c-f68947bb8e33" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031753Z:bbc29f9b-fee7-415e-9efe-d382e8d261b9" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription/rules/myRule", "name": "myRule", - "type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules", + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules", "location": "eastus", "properties": { "action": {}, "filterType": "SqlFilter", "sqlFilter": { "sqlExpression": "1=1", - "compatibilityLevel": 20 + "compatibilityLevel": 20, + "parameters": {} } } } @@ -570,7 +628,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -578,7 +636,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:41:28 GMT", + "Date": "Wed, 15 Feb 2023 03:17:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -586,14 +644,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "488fc438-f9c5-46b8-960d-466e9c341cc8", - "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "EASTUS2:20220810T074129Z:488fc438-f9c5-46b8-960d-466e9c341cc8" + "x-ms-correlation-request-id": "4b496682-448b-4703-9790-9a96e59494e5", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031753Z:4b496682-448b-4703-9790-9a96e59494e5" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription", "name": "mySubscription", - "type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions", + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", "location": "eastus", "properties": { "isClientAffine": false, @@ -606,9 +664,9 @@ "maxDeliveryCount": 10, "status": "Active", "enableBatchedOperations": true, - "createdAt": "2022-08-10T07:41:27.5055751Z", - "updatedAt": "2022-08-10T07:41:27.5055751Z", - "accessedAt": "2022-08-10T07:41:27.507Z", + "createdAt": "2023-02-15T03:17:51.8393918Z", + "updatedAt": "2023-02-15T03:17:51.8393918Z", + "accessedAt": "2023-02-15T03:17:51.84Z", "countDetails": { "activeMessageCount": 0, "deadLetterMessageCount": 0, @@ -627,7 +685,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -635,7 +693,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:41:28 GMT", + "Date": "Wed, 15 Feb 2023 03:17:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -643,21 +701,22 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "657eb57c-9af8-4138-9585-eeec1611c158", - "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-routing-request-id": "EASTUS2:20220810T074129Z:657eb57c-9af8-4138-9585-eeec1611c158" + "x-ms-correlation-request-id": "3bdb1396-c961-4101-afb7-064f31b91aaf", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031753Z:3bdb1396-c961-4101-afb7-064f31b91aaf" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription/rules/myRule", "name": "myRule", - "type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules", + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules", "location": "eastus", "properties": { "action": {}, "filterType": "SqlFilter", "sqlFilter": { "sqlExpression": "1=1", - "compatibilityLevel": 20 + "compatibilityLevel": 20, + "parameters": {} } } } @@ -670,22 +729,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:41:29 GMT", + "Date": "Wed, 15 Feb 2023 03:17:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "01f4935b-21d3-4da8-9f4a-a09e8e206f65", + "x-ms-correlation-request-id": "57c20d7a-7005-4d23-9c1e-d3aaf0b7dd72", "x-ms-ratelimit-remaining-subscription-deletes": "14996", - "x-ms-routing-request-id": "EASTUS2:20220810T074129Z:01f4935b-21d3-4da8-9f4a-a09e8e206f65" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031753Z:57c20d7a-7005-4d23-9c1e-d3aaf0b7dd72" }, "ResponseBody": null }, @@ -697,22 +756,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:41:29 GMT", + "Date": "Wed, 15 Feb 2023 03:17:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "489497a8-3cca-4e2b-9d2e-4589361a1966", + "x-ms-correlation-request-id": "6fcdc2ed-d8cc-49d3-a973-b5f5cc267580", "x-ms-ratelimit-remaining-subscription-deletes": "14995", - "x-ms-routing-request-id": "EASTUS2:20220810T074129Z:489497a8-3cca-4e2b-9d2e-4589361a1966" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031753Z:6fcdc2ed-d8cc-49d3-a973-b5f5cc267580" }, "ResponseBody": null }, @@ -724,22 +783,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:41:29 GMT", + "Date": "Wed, 15 Feb 2023 03:17:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ed4493cc-d63a-4beb-9be3-0c1f32f2ca0a", + "x-ms-correlation-request-id": "7e7d5b55-9657-4d35-ad65-19705509abc0", "x-ms-ratelimit-remaining-subscription-deletes": "14994", - "x-ms-routing-request-id": "EASTUS2:20220810T074130Z:ed4493cc-d63a-4beb-9be3-0c1f32f2ca0a" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031754Z:7e7d5b55-9657-4d35-ad65-19705509abc0" }, "ResponseBody": null }, @@ -751,27 +810,27 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:41:30 GMT", + "Date": "Wed, 15 Feb 2023 03:17:55 GMT", "Expires": "-1", "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/operationresults/myNamespacexxyyzzxyye?api-version=2021-11-01", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "138d1d36-3019-4570-b5cb-b25e4a372f6b", + "x-ms-correlation-request-id": "bb3a6629-565e-4eb4-ad0b-86a86f267ade", "x-ms-ratelimit-remaining-subscription-deletes": "14993", - "x-ms-routing-request-id": "EASTUS2:20220810T074131Z:138d1d36-3019-4570-b5cb-b25e4a372f6b" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031755Z:bb3a6629-565e-4eb4-ad0b-86a86f267ade" }, "ResponseBody": null }, @@ -782,29 +841,85 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "668", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 03:17:55 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/operationresults/myNamespacexxyyzzxyye?api-version=2021-11-01", + "Pragma": "no-cache", + "Retry-After": "56", + "Server": [ + "Service-Bus-Resource-Provider/CH3", + "Microsoft-HTTPAPI/2.0" + ], + "Server-SB": "Service-Bus-Resource-Provider/CH3", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0ae01664-3c09-4572-88fa-c25b2feda8c9", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031755Z:0ae01664-3c09-4572-88fa-c25b2feda8c9" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye", + "name": "myNamespacexxyyzzxyye", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "East US", + "tags": { + "tag1": "value1", + "tag2": "value2" + }, + "properties": { + "disableLocalAuth": false, + "zoneRedundant": false, + "provisioningState": "Succeeded", + "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye", + "createdAt": "2023-02-15T03:16:47.397Z", + "updatedAt": "2023-02-15T03:17:55.09Z", + "serviceBusEndpoint": "https://myNamespacexxyyzzxyye.servicebus.windows.net:443/", + "status": "Removing" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/operationresults/myNamespacexxyyzzxyye?api-version=2021-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:42:01 GMT", + "Date": "Wed, 15 Feb 2023 03:18:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "30c3018a-cf51-4cd3-a3ec-da0218b15491", - "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-routing-request-id": "EASTUS2:20220810T074201Z:30c3018a-cf51-4cd3-a3ec-da0218b15491" + "x-ms-correlation-request-id": "9880d346-9b73-4ec8-924b-a6d7819d5f9e", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031851Z:9880d346-9b73-4ec8-924b-a6d7819d5f9e" }, "ResponseBody": null } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_topic.json b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_topic.json index 55afbb06d5f9..2fb5f6deced3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_topic.json +++ b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.pyTestMgmtServiceBustest_topic.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:42:03 GMT", + "Date": "Wed, 15 Feb 2023 03:18:53 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13418.10 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -86,7 +86,7 @@ "email" ], "kerberos_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/kerberos", - "tenant_region_scope": "NA", + "tenant_region_scope": "WW", "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:42:03 GMT", + "Date": "Wed, 15 Feb 2023 03:18:53 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.13418.10 - EUS ProdSlices", + "x-ms-ests-server": "2.1.14601.8 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "2224dd6b-2b52-4724-a69b-e745800a68eb", + "client-request-id": "9c9da611-9fbd-4c3e-a37a-79224af05d4b", "Connection": "keep-alive", "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b4 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.13.0b3 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.18.0", + "x-client-ver": "1.21.0", "x-ms-lib-capability": "retry-after, h429" }, "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "2224dd6b-2b52-4724-a69b-e745800a68eb", - "Content-Length": "93", + "client-request-id": "9c9da611-9fbd-4c3e-a37a-79224af05d4b", + "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:42:03 GMT", + "Date": "Wed, 15 Feb 2023 03:18:54 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,13 +201,14 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.13418.10 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.14649.17 - NCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { "token_type": "Bearer", - "expires_in": 3599, - "ext_expires_in": 3599, + "expires_in": 86399, + "ext_expires_in": 86399, + "refresh_in": 43199, "access_token": "access_token" } }, @@ -220,7 +221,7 @@ "Connection": "keep-alive", "Content-Length": "117", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "eastus", @@ -238,7 +239,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:42:05 GMT", + "Date": "Wed, 15 Feb 2023 03:18:57 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -250,9 +251,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "253165bc-7e46-4a9a-a8f1-1f66e2990d02", + "x-ms-correlation-request-id": "daa15d50-ceac-4331-b5e8-2a9e3185b149", "x-ms-ratelimit-remaining-subscription-writes": "1192", - "x-ms-routing-request-id": "EASTUS2:20220810T074205Z:253165bc-7e46-4a9a-a8f1-1f66e2990d02" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031857Z:daa15d50-ceac-4331-b5e8-2a9e3185b149" }, "ResponseBody": { "sku": { @@ -272,8 +273,8 @@ "zoneRedundant": false, "provisioningState": "Created", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf", - "createdAt": "2022-08-10T07:42:04.623Z", - "updatedAt": "2022-08-10T07:42:04.623Z", + "createdAt": "2023-02-15T03:18:56.81Z", + "updatedAt": "2023-02-15T03:18:56.81Z", "serviceBusEndpoint": "https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/", "status": "Activating" } @@ -286,7 +287,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -294,21 +295,21 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:42:34 GMT", + "Date": "Wed, 15 Feb 2023 03:18:57 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ - "Service-Bus-Resource-Provider/SN1", + "Service-Bus-Resource-Provider/CH3", "Microsoft-HTTPAPI/2.0" ], - "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Server-SB": "Service-Bus-Resource-Provider/CH3", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ed885d22-ca2e-4959-9ada-0a8a3276abfb", - "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-routing-request-id": "EASTUS2:20220810T074235Z:ed885d22-ca2e-4959-9ada-0a8a3276abfb" + "x-ms-correlation-request-id": "1b9e3b75-5e1f-47fc-986b-76af8ea21fc0", + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031858Z:1b9e3b75-5e1f-47fc-986b-76af8ea21fc0" }, "ResponseBody": { "sku": { @@ -328,8 +329,8 @@ "zoneRedundant": false, "provisioningState": "Created", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf", - "createdAt": "2022-08-10T07:42:04.623Z", - "updatedAt": "2022-08-10T07:42:04.623Z", + "createdAt": "2023-02-15T03:18:56.81Z", + "updatedAt": "2023-02-15T03:18:56.81Z", "serviceBusEndpoint": "https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/", "status": "Activating" } @@ -342,7 +343,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -350,7 +351,63 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:43:04 GMT", + "Date": "Wed, 15 Feb 2023 03:19:28 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": [ + "Service-Bus-Resource-Provider/CH3", + "Microsoft-HTTPAPI/2.0" + ], + "Server-SB": "Service-Bus-Resource-Provider/CH3", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "6108dffc-aa94-4ab6-81a3-f0321dbcd572", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031928Z:6108dffc-aa94-4ab6-81a3-f0321dbcd572" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf", + "name": "myNamespacexxyyzzxyyf", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "East US", + "tags": { + "tag1": "value1", + "tag2": "value2" + }, + "properties": { + "disableLocalAuth": false, + "zoneRedundant": false, + "provisioningState": "Created", + "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf", + "createdAt": "2023-02-15T03:18:56.81Z", + "updatedAt": "2023-02-15T03:18:56.81Z", + "serviceBusEndpoint": "https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/", + "status": "Activating" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2021-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 03:19:57 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -362,9 +419,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3669c55f-5edd-47dc-a489-deedd5a64b05", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-routing-request-id": "EASTUS2:20220810T074305Z:3669c55f-5edd-47dc-a489-deedd5a64b05" + "x-ms-correlation-request-id": "63180e59-1f8b-4e86-be78-3e4fd5883dcb", + "x-ms-ratelimit-remaining-subscription-reads": "11983", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T031958Z:63180e59-1f8b-4e86-be78-3e4fd5883dcb" }, "ResponseBody": { "sku": { @@ -384,8 +441,8 @@ "zoneRedundant": false, "provisioningState": "Succeeded", "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf", - "createdAt": "2022-08-10T07:42:04.623Z", - "updatedAt": "2022-08-10T07:42:47.293Z", + "createdAt": "2023-02-15T03:18:56.81Z", + "updatedAt": "2023-02-15T03:19:39.073Z", "serviceBusEndpoint": "https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/", "status": "Active" } @@ -400,7 +457,7 @@ "Connection": "keep-alive", "Content-Length": "39", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -412,7 +469,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:43:06 GMT", + "Date": "Wed, 15 Feb 2023 03:20:00 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -420,14 +477,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "116749ca-8d57-4c70-8c6e-39b1bf658f0b", + "x-ms-correlation-request-id": "0c6d7535-d6db-4239-ad0f-3b7050904078", "x-ms-ratelimit-remaining-subscription-writes": "1191", - "x-ms-routing-request-id": "EASTUS2:20220810T074307Z:116749ca-8d57-4c70-8c6e-39b1bf658f0b" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032000Z:0c6d7535-d6db-4239-ad0f-3b7050904078" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic", "name": "myTopic", - "type": "Microsoft.ServiceBus/Namespaces/Topics", + "type": "Microsoft.ServiceBus/namespaces/topics", "location": "eastus", "properties": { "maxMessageSizeInKilobytes": 256, @@ -442,8 +499,8 @@ "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S", "enablePartitioning": false, "enableExpress": true, - "createdAt": "2022-08-10T07:43:06.987Z", - "updatedAt": "2022-08-10T07:43:07.27Z", + "createdAt": "2023-02-15T03:19:59.97Z", + "updatedAt": "2023-02-15T03:19:59.993Z", "accessedAt": "0001-01-01T00:00:00", "subscriptionCount": 0, "countDetails": { @@ -465,7 +522,7 @@ "Connection": "keep-alive", "Content-Length": "46", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -480,7 +537,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:43:06 GMT", + "Date": "Wed, 15 Feb 2023 03:20:00 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -488,14 +545,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c35b7c50-e460-44e1-ac52-3d49d816860e", + "x-ms-correlation-request-id": "13f2e8d8-c098-4eee-a477-6d20760c7c4e", "x-ms-ratelimit-remaining-subscription-writes": "1190", - "x-ms-routing-request-id": "EASTUS2:20220810T074307Z:c35b7c50-e460-44e1-ac52-3d49d816860e" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032000Z:13f2e8d8-c098-4eee-a477-6d20760c7c4e" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic/authorizationRules/myAuthorizationRule", "name": "myAuthorizationRule", - "type": "Microsoft.ServiceBus/Namespaces/Topics/AuthorizationRules", + "type": "Microsoft.ServiceBus/namespaces/topics/authorizationrules", "properties": { "rights": [ "Listen", @@ -511,7 +568,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -519,7 +576,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:43:07 GMT", + "Date": "Wed, 15 Feb 2023 03:20:00 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -527,14 +584,14 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "2b55d4e5-e34f-4782-b10d-3019572c0612", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-routing-request-id": "EASTUS2:20220810T074307Z:2b55d4e5-e34f-4782-b10d-3019572c0612" + "x-ms-correlation-request-id": "5f6d75e7-2281-49ac-9194-124bdb241810", + "x-ms-ratelimit-remaining-subscription-reads": "11982", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032001Z:5f6d75e7-2281-49ac-9194-124bdb241810" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic/authorizationrules/myAuthorizationRule", "name": "myAuthorizationRule", - "type": "Microsoft.ServiceBus/Namespaces/Topics/AuthorizationRules", + "type": "Microsoft.ServiceBus/namespaces/topics/authorizationrules", "location": "eastus", "properties": { "rights": [ @@ -553,7 +610,7 @@ "Connection": "keep-alive", "Content-Length": "25", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "keyType": "PrimaryKey" @@ -563,7 +620,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:43:07 GMT", + "Date": "Wed, 15 Feb 2023 03:20:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -571,9 +628,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e84631bf-601e-4668-b352-9e4df78e5066", + "x-ms-correlation-request-id": "0979132c-586a-4501-b8ae-ffbc7ef9f113", "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "EASTUS2:20220810T074307Z:e84631bf-601e-4668-b352-9e4df78e5066" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032001Z:0979132c-586a-4501-b8ae-ffbc7ef9f113" }, "ResponseBody": { "primaryConnectionString": "Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=SharedAccessKey;EntityPath=myTopic", @@ -591,7 +648,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -599,7 +656,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 10 Aug 2022 07:43:07 GMT", + "Date": "Wed, 15 Feb 2023 03:20:02 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -607,9 +664,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "9e1eec0d-2146-4903-a820-34a986d6660c", + "x-ms-correlation-request-id": "9dab707d-8b2e-46a6-9cb9-d4d8c053e3d9", "x-ms-ratelimit-remaining-subscription-writes": "1196", - "x-ms-routing-request-id": "EASTUS2:20220810T074308Z:9e1eec0d-2146-4903-a820-34a986d6660c" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032002Z:9dab707d-8b2e-46a6-9cb9-d4d8c053e3d9" }, "ResponseBody": { "primaryConnectionString": "Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=SharedAccessKey;EntityPath=myTopic", @@ -627,22 +684,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:43:07 GMT", + "Date": "Wed, 15 Feb 2023 03:20:02 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "61d6366e-124e-49c1-9264-01eddebdc473", + "x-ms-correlation-request-id": "80f9e433-da2c-4e4f-9c62-8c450a46ab0c", "x-ms-ratelimit-remaining-subscription-deletes": "14992", - "x-ms-routing-request-id": "EASTUS2:20220810T074308Z:61d6366e-124e-49c1-9264-01eddebdc473" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032003Z:80f9e433-da2c-4e4f-9c62-8c450a46ab0c" }, "ResponseBody": null }, @@ -654,22 +711,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:43:08 GMT", + "Date": "Wed, 15 Feb 2023 03:20:03 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "72fdf75f-aa75-4ae5-ba94-4921c3d0a209", + "x-ms-correlation-request-id": "0afa3498-c796-4c66-aafe-e775a827db96", "x-ms-ratelimit-remaining-subscription-deletes": "14991", - "x-ms-routing-request-id": "EASTUS2:20220810T074309Z:72fdf75f-aa75-4ae5-ba94-4921c3d0a209" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032003Z:0afa3498-c796-4c66-aafe-e775a827db96" }, "ResponseBody": null }, @@ -681,14 +738,14 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:43:10 GMT", + "Date": "Wed, 15 Feb 2023 03:20:05 GMT", "Expires": "-1", "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/operationresults/myNamespacexxyyzzxyyf?api-version=2021-11-01", "Pragma": "no-cache", @@ -699,9 +756,9 @@ "Server-SB": "Service-Bus-Resource-Provider/SN1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b8847605-cac1-4894-8c09-6be18f7fade7", + "x-ms-correlation-request-id": "920f806c-d8dc-455a-8326-7bc36cf964a0", "x-ms-ratelimit-remaining-subscription-deletes": "14990", - "x-ms-routing-request-id": "EASTUS2:20220810T074310Z:b8847605-cac1-4894-8c09-6be18f7fade7" + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032005Z:920f806c-d8dc-455a-8326-7bc36cf964a0" }, "ResponseBody": null }, @@ -712,14 +769,70 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "668", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 15 Feb 2023 03:20:05 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/operationresults/myNamespacexxyyzzxyyf?api-version=2021-11-01", + "Pragma": "no-cache", + "Retry-After": "49", + "Server": [ + "Service-Bus-Resource-Provider/SN1", + "Microsoft-HTTPAPI/2.0" + ], + "Server-SB": "Service-Bus-Resource-Provider/SN1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "e03d717f-5883-4eab-8a2d-f8d6155e0ab5", + "x-ms-ratelimit-remaining-subscription-reads": "11981", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032005Z:e03d717f-5883-4eab-8a2d-f8d6155e0ab5" + }, + "ResponseBody": { + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf", + "name": "myNamespacexxyyzzxyyf", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "East US", + "tags": { + "tag1": "value1", + "tag2": "value2" + }, + "properties": { + "disableLocalAuth": false, + "zoneRedundant": false, + "provisioningState": "Succeeded", + "metricId": "00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf", + "createdAt": "2023-02-15T03:18:56.81Z", + "updatedAt": "2023-02-15T03:20:05.183Z", + "serviceBusEndpoint": "https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/", + "status": "Removing" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/operationresults/myNamespacexxyyzzxyyf?api-version=2021-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-azure-mgmt-servicebus/8.2.0 Python/3.8.16 (Linux-5.15.0-1031-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Wed, 10 Aug 2022 07:43:40 GMT", + "Date": "Wed, 15 Feb 2023 03:20:54 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": [ @@ -729,12 +842,12 @@ "Server-SB": "Service-Bus-Resource-Provider/SN1", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e965692f-f188-4283-987d-798ac57facbb", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-routing-request-id": "EASTUS2:20220810T074341Z:e965692f-f188-4283-987d-798ac57facbb" + "x-ms-correlation-request-id": "41df023a-3864-4c37-8de0-959cb74bc1a3", + "x-ms-ratelimit-remaining-subscription-reads": "11980", + "x-ms-routing-request-id": "SOUTHCENTRALUS:20230215T032055Z:41df023a-3864-4c37-8de0-959cb74bc1a3" }, "ResponseBody": null } ], "Variables": {} -} +} \ No newline at end of file diff --git a/sdk/servicebus/azure-servicebus/pyproject.toml b/sdk/servicebus/azure-servicebus/pyproject.toml new file mode 100644 index 000000000000..7e21996d4317 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/pyproject.toml @@ -0,0 +1,4 @@ +[tool.azure-sdk-build] +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/servicefabric/azure-servicefabric/pyproject.toml b/sdk/servicefabric/azure-servicefabric/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/servicefabric/azure-servicefabric/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md b/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md index 2e85c09a148b..b3064493d247 100644 --- a/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md +++ b/sdk/storage/azure-mgmt-storagecache/CHANGELOG.md @@ -1,5 +1,19 @@ # Release History +## 1.4.0 (2023-02-15) + +### Features Added + + - Added operation StorageTargetsOperations.begin_restore_defaults + - Model BlobNfsTarget has a new parameter verification_timer + - Model BlobNfsTarget has a new parameter write_back_timer + - Model Nfs3Target has a new parameter verification_timer + - Model Nfs3Target has a new parameter write_back_timer + +### Breaking Changes + + - Renamed operation CachesOperations.update to CachesOperations.begin_update + ## 1.4.0b1 (2022-12-12) ### Other Changes diff --git a/sdk/storage/azure-mgmt-storagecache/README.md b/sdk/storage/azure-mgmt-storagecache/README.md index 7e61e4aabf48..379f42ee4cb7 100644 --- a/sdk/storage/azure-mgmt-storagecache/README.md +++ b/sdk/storage/azure-mgmt-storagecache/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Storage Cache Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-storagecache +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.storagecache import StorageCacheManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = StorageCacheManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Storage Cache Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/storage/azure-mgmt-storagecache/_meta.json b/sdk/storage/azure-mgmt-storagecache/_meta.json index 558c8a76e778..32090fab3241 100644 --- a/sdk/storage/azure-mgmt-storagecache/_meta.json +++ b/sdk/storage/azure-mgmt-storagecache/_meta.json @@ -1,11 +1,11 @@ { - "commit": "23b62d4e4dab07dccda851cfe50f6c6afb705a3b", + "commit": "3f3b51edf8fd0eb65004df390d6ee98e0e23c53d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/storagecache/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/storagecache/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/storagecache/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py index d7e31a4eec8b..0d9fef5f6484 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py @@ -36,14 +36,14 @@ class StorageCacheManagementClientConfiguration(Configuration): # pylint: disab :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(StorageCacheManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_serialization.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_serialization.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py index 4d21a1a8230a..52358174e52e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_storage_cache_management_client.py @@ -59,7 +59,7 @@ class StorageCacheManagementClient: # pylint: disable=client-accepts-api-versio :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_vendor.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_vendor.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_version.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_version.py index 73ece66be139..b97926d4bc86 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_version.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.4.0b1" +VERSION = "1.4.0" diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_configuration.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_configuration.py index d15bea899ad9..f23c7b838f6a 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_configuration.py @@ -36,14 +36,14 @@ class StorageCacheManagementClientConfiguration(Configuration): # pylint: disab :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(StorageCacheManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py index cc26863cf8ef..cd90c57acdf9 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/_storage_cache_management_client.py @@ -59,7 +59,7 @@ class StorageCacheManagementClient: # pylint: disable=client-accepts-api-versio :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_operations.py index fec27fd0b56f..fdec3d253ac6 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_operations_operations.py @@ -80,7 +80,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AscOperation] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py index 959d58a3750a..8221bda3de04 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py @@ -71,7 +71,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ResourceU _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ResourceUsagesListResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py index e59b97a142e5..60a66cf781aa 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py @@ -89,7 +89,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cache"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CachesListResult] = kwargs.pop("cls", None) @@ -172,7 +172,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CachesListResult] = kwargs.pop("cls", None) @@ -258,7 +258,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -285,8 +285,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" @@ -316,7 +323,7 @@ async def begin_delete(self, resource_group_name: str, cache_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -383,7 +390,7 @@ async def get(self, resource_group_name: str, cache_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Cache] = kwargs.pop("cls", None) @@ -422,7 +429,7 @@ async def get(self, resource_group_name: str, cache_name: str, **kwargs: Any) -> } async def _create_or_update_initial( - self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any + self, resource_group_name: str, cache_name: str, cache: Union[_models.Cache, IO], **kwargs: Any ) -> Optional[_models.Cache]: error_map = { 401: ClientAuthenticationError, @@ -435,7 +442,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -447,10 +454,7 @@ async def _create_or_update_initial( if isinstance(cache, (IO, bytes)): _content = cache else: - if cache is not None: - _json = self._serialize.body(cache, "Cache") - else: - _json = None + _json = self._serialize.body(cache, "Cache") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -498,7 +502,7 @@ async def begin_create_or_update( self, resource_group_name: str, cache_name: str, - cache: Optional[_models.Cache] = None, + cache: _models.Cache, *, content_type: str = "application/json", **kwargs: Any @@ -511,8 +515,7 @@ async def begin_create_or_update( from the [-0-9a-zA-Z_] char class. Required. :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only - properties are included, they must match the existing values of those properties. Default value - is None. + properties are included, they must match the existing values of those properties. Required. :type cache: ~azure.mgmt.storagecache.models.Cache :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -535,7 +538,7 @@ async def begin_create_or_update( self, resource_group_name: str, cache_name: str, - cache: Optional[IO] = None, + cache: IO, *, content_type: str = "application/json", **kwargs: Any @@ -548,8 +551,7 @@ async def begin_create_or_update( from the [-0-9a-zA-Z_] char class. Required. :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only - properties are included, they must match the existing values of those properties. Default value - is None. + properties are included, they must match the existing values of those properties. Required. :type cache: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -569,7 +571,7 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any + self, resource_group_name: str, cache_name: str, cache: Union[_models.Cache, IO], **kwargs: Any ) -> AsyncLROPoller[_models.Cache]: """Create or update a Cache. @@ -580,7 +582,7 @@ async def begin_create_or_update( :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must match the existing values of those properties. Is either a - model type or a IO type. Default value is None. + model type or a IO type. Required. :type cache: ~azure.mgmt.storagecache.models.Cache or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -600,7 +602,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -647,8 +649,84 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" } + async def _update_initial( + self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any + ) -> Optional[_models.Cache]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Cache]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cache, (IO, bytes)): + _content = cache + else: + if cache is not None: + _json = self._serialize.body(cache, "Cache") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Cache", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" + } + @overload - async def update( + async def begin_update( self, resource_group_name: str, cache_name: str, @@ -656,7 +734,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Cache: + ) -> AsyncLROPoller[_models.Cache]: """Update a Cache instance. :param resource_group_name: Target resource group. Required. @@ -672,13 +750,20 @@ async def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cache or the result of cls(response) - :rtype: ~azure.mgmt.storagecache.models.Cache + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cache or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagecache.models.Cache] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_update( self, resource_group_name: str, cache_name: str, @@ -686,7 +771,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Cache: + ) -> AsyncLROPoller[_models.Cache]: """Update a Cache instance. :param resource_group_name: Target resource group. Required. @@ -702,15 +787,22 @@ async def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cache or the result of cls(response) - :rtype: ~azure.mgmt.storagecache.models.Cache + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cache or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagecache.models.Cache] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_update( self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any - ) -> _models.Cache: + ) -> AsyncLROPoller[_models.Cache]: """Update a Cache instance. :param resource_group_name: Target resource group. Required. @@ -726,71 +818,67 @@ async def update( Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cache or the result of cls(response) - :rtype: ~azure.mgmt.storagecache.models.Cache + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cache or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagecache.models.Cache] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cache] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + cache=cache, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cache, (IO, bytes)): - _content = cache - else: - if cache is not None: - _json = self._serialize.body(cache, "Cache") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - cache_name=cache_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Cache", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Cache", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - return deserialized + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - update.metadata = { + begin_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" } @@ -808,7 +896,7 @@ async def _debug_info_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -835,8 +923,15 @@ async def _debug_info_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _debug_info_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo" @@ -866,7 +961,7 @@ async def begin_debug_info(self, resource_group_name: str, cache_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -925,7 +1020,7 @@ async def _flush_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -952,8 +1047,15 @@ async def _flush_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _flush_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush" @@ -984,7 +1086,7 @@ async def begin_flush(self, resource_group_name: str, cache_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1043,7 +1145,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1070,8 +1172,15 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _start_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start" @@ -1101,7 +1210,7 @@ async def begin_start(self, resource_group_name: str, cache_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1160,7 +1269,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1187,8 +1296,15 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _stop_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop" @@ -1218,7 +1334,7 @@ async def begin_stop(self, resource_group_name: str, cache_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1281,7 +1397,7 @@ async def _start_priming_job_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1442,7 +1558,7 @@ async def begin_start_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1508,7 +1624,7 @@ async def _stop_priming_job_initial( # pylint: disable=inconsistent-return-stat _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1670,7 +1786,7 @@ async def begin_stop_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1736,7 +1852,7 @@ async def _pause_priming_job_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1898,7 +2014,7 @@ async def begin_pause_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1964,7 +2080,7 @@ async def _resume_priming_job_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2126,7 +2242,7 @@ async def begin_resume_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2188,7 +2304,7 @@ async def _upgrade_firmware_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2215,8 +2331,15 @@ async def _upgrade_firmware_initial( # pylint: disable=inconsistent-return-stat map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _upgrade_firmware_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade" @@ -2249,7 +2372,7 @@ async def begin_upgrade_firmware( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2312,7 +2435,7 @@ async def _space_allocation_initial( # pylint: disable=inconsistent-return-stat _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2476,7 +2599,7 @@ async def begin_space_allocation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py index 45405ee210ae..d9598e134b60 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiOperation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ApiOperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_operations.py index 73918ebb4f65..3e00474edf26 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_skus_operations.py @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ResourceSkusResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py index 4a54e3d006cd..ffe2ee93a26a 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py @@ -76,7 +76,7 @@ async def _flush_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -104,8 +104,15 @@ async def _flush_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _flush_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush" @@ -141,7 +148,7 @@ async def begin_flush( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -201,7 +208,7 @@ async def _suspend_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -229,8 +236,15 @@ async def _suspend_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _suspend_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend" @@ -264,7 +278,7 @@ async def begin_suspend( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -324,7 +338,7 @@ async def _resume_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -352,8 +366,15 @@ async def _resume_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _resume_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume" @@ -387,7 +408,7 @@ async def begin_resume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -447,7 +468,7 @@ async def _invalidate_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -475,8 +496,15 @@ async def _invalidate_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _invalidate_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate" @@ -511,7 +539,7 @@ async def begin_invalidate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_operations.py index ea98cb077ae2..0133c1d5404b 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_targets_operations.py @@ -37,6 +37,7 @@ build_dns_refresh_request, build_get_request, build_list_by_cache_request, + build_restore_defaults_request, ) if sys.version_info >= (3, 8): @@ -80,7 +81,7 @@ async def _dns_refresh_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -108,8 +109,15 @@ async def _dns_refresh_initial( # pylint: disable=inconsistent-return-statement map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _dns_refresh_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh" @@ -143,7 +151,7 @@ async def begin_dns_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -208,7 +216,7 @@ def list_by_cache( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.StorageTargetsResult] = kwargs.pop("cls", None) @@ -300,7 +308,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -329,8 +337,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}" @@ -376,7 +391,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -449,7 +464,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.StorageTarget] = kwargs.pop("cls", None) @@ -493,7 +508,7 @@ async def _create_or_update_initial( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[Union[_models.StorageTarget, IO]] = None, + storagetarget: Union[_models.StorageTarget, IO], **kwargs: Any ) -> Optional[_models.StorageTarget]: error_map = { @@ -507,7 +522,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -519,10 +534,7 @@ async def _create_or_update_initial( if isinstance(storagetarget, (IO, bytes)): _content = storagetarget else: - if storagetarget is not None: - _json = self._serialize.body(storagetarget, "StorageTarget") - else: - _json = None + _json = self._serialize.body(storagetarget, "StorageTarget") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -572,7 +584,7 @@ async def begin_create_or_update( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[_models.StorageTarget] = None, + storagetarget: _models.StorageTarget, *, content_type: str = "application/json", **kwargs: Any @@ -588,8 +600,7 @@ async def begin_create_or_update( :type cache_name: str :param storage_target_name: Name of Storage Target. Required. :type storage_target_name: str - :param storagetarget: Object containing the definition of a Storage Target. Default value is - None. + :param storagetarget: Object containing the definition of a Storage Target. Required. :type storagetarget: ~azure.mgmt.storagecache.models.StorageTarget :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -614,7 +625,7 @@ async def begin_create_or_update( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[IO] = None, + storagetarget: IO, *, content_type: str = "application/json", **kwargs: Any @@ -630,8 +641,7 @@ async def begin_create_or_update( :type cache_name: str :param storage_target_name: Name of Storage Target. Required. :type storage_target_name: str - :param storagetarget: Object containing the definition of a Storage Target. Default value is - None. + :param storagetarget: Object containing the definition of a Storage Target. Required. :type storagetarget: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -656,7 +666,7 @@ async def begin_create_or_update( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[Union[_models.StorageTarget, IO]] = None, + storagetarget: Union[_models.StorageTarget, IO], **kwargs: Any ) -> AsyncLROPoller[_models.StorageTarget]: """Create or update a Storage Target. This operation is allowed at any time, but if the Cache is @@ -671,7 +681,7 @@ async def begin_create_or_update( :param storage_target_name: Name of Storage Target. Required. :type storage_target_name: str :param storagetarget: Object containing the definition of a Storage Target. Is either a model - type or a IO type. Default value is None. + type or a IO type. Required. :type storagetarget: ~azure.mgmt.storagecache.models.StorageTarget or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -692,7 +702,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -739,3 +749,132 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}" } + + async def _restore_defaults_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cache_name: str, storage_target_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restore_defaults_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restore_defaults_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restore_defaults_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/restoreDefaults" + } + + @distributed_trace_async + async def begin_restore_defaults( + self, resource_group_name: str, cache_name: str, storage_target_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Tells a storage target to restore its settings to their default values. + + :param resource_group_name: Target resource group. Required. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. Required. + :type cache_name: str + :param storage_target_name: Name of Storage Target. Required. + :type storage_target_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restore_defaults_initial( # type: ignore + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restore_defaults.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/restoreDefaults" + } diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py index 0fd51d52a002..e3968effedcc 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.UsageModel"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.UsageModelsResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py index 63c0682a9d23..473eff42885d 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/models/_models_py3.py @@ -25,7 +25,8 @@ class ApiOperation(_serialization.Model): - """REST API operation description: see https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation. + """REST API operation description: see + https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation. :ivar display: The object that represents the operation. :vartype display: ~azure.mgmt.storagecache.models.ApiOperationDisplay @@ -59,8 +60,8 @@ def __init__( is_data_action: Optional[bool] = None, name: Optional[str] = None, service_specification: Optional["_models.ApiOperationPropertiesServiceSpecification"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.storagecache.models.ApiOperationDisplay @@ -110,8 +111,8 @@ def __init__( provider: Optional[str] = None, resource: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operation: Operation type: Read, write, delete, etc. :paramtype operation: str @@ -130,7 +131,8 @@ def __init__( class ApiOperationListResult(_serialization.Model): - """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Resource Provider operations. It contains a list of operations + and a URL link to get the next set of results. :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str @@ -145,8 +147,8 @@ class ApiOperationListResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.ApiOperation"]] = None, **kwargs - ): + self, *, next_link: Optional[str] = None, value: Optional[List["_models.ApiOperation"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str @@ -178,8 +180,8 @@ def __init__( *, metric_specifications: Optional[List["_models.MetricSpecification"]] = None, log_specifications: Optional[List["_models.LogSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric_specifications: Details about operations related to metrics. :paramtype metric_specifications: list[~azure.mgmt.storagecache.models.MetricSpecification] @@ -230,8 +232,8 @@ def __init__( status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, output: Optional[Dict[str, JSON]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The operation Id. :paramtype id: str @@ -265,28 +267,53 @@ class BlobNfsTarget(_serialization.Model): :vartype target: str :ivar usage_model: Identifies the StorageCache usage model to be used for this storage target. :vartype usage_model: str + :ivar verification_timer: Amount of time (in seconds) the cache waits before it checks the + back-end storage for file updates. + :vartype verification_timer: int + :ivar write_back_timer: Amount of time (in seconds) the cache waits after the last file change + before it copies the changed file to back-end storage. + :vartype write_back_timer: int """ _attribute_map = { "target": {"key": "target", "type": "str"}, "usage_model": {"key": "usageModel", "type": "str"}, + "verification_timer": {"key": "verificationTimer", "type": "int"}, + "write_back_timer": {"key": "writeBackTimer", "type": "int"}, } - def __init__(self, *, target: Optional[str] = None, usage_model: Optional[str] = None, **kwargs): + def __init__( + self, + *, + target: Optional[str] = None, + usage_model: Optional[str] = None, + verification_timer: Optional[int] = None, + write_back_timer: Optional[int] = None, + **kwargs: Any + ) -> None: """ :keyword target: Resource ID of the storage container. :paramtype target: str :keyword usage_model: Identifies the StorageCache usage model to be used for this storage target. :paramtype usage_model: str + :keyword verification_timer: Amount of time (in seconds) the cache waits before it checks the + back-end storage for file updates. + :paramtype verification_timer: int + :keyword write_back_timer: Amount of time (in seconds) the cache waits after the last file + change before it copies the changed file to back-end storage. + :paramtype write_back_timer: int """ super().__init__(**kwargs) self.target = target self.usage_model = usage_model + self.verification_timer = verification_timer + self.write_back_timer = write_back_timer class Cache(_serialization.Model): # pylint: disable=too-many-instance-attributes - """A Cache instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md. + """A Cache instance. Follows Azure Resource Manager standards: + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md. Variables are only populated by the server, and will be ignored when sending a request. @@ -396,8 +423,8 @@ def __init__( security_settings: Optional["_models.CacheSecuritySettings"] = None, directory_services_settings: Optional["_models.CacheDirectorySettings"] = None, zones: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -506,8 +533,8 @@ def __init__( cache_net_bios_name: str, secondary_dns_ip_address: Optional[str] = None, credentials: Optional["_models.CacheActiveDirectorySettingsCredentials"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_dns_ip_address: Primary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. Required. @@ -561,7 +588,7 @@ class CacheActiveDirectorySettingsCredentials(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, username: str, password: str, **kwargs): + def __init__(self, *, username: str, password: str, **kwargs: Any) -> None: """ :keyword username: Username of the Active Directory domain administrator. This value is stored encrypted and not returned on response. Required. @@ -596,8 +623,8 @@ def __init__( *, active_directory: Optional["_models.CacheActiveDirectorySettings"] = None, username_download: Optional["_models.CacheUsernameDownloadSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword active_directory: Specifies settings for joining the HPC Cache to an Active Directory domain. @@ -631,8 +658,8 @@ def __init__( *, key_encryption_key: Optional["_models.KeyVaultKeyReference"] = None, rotation_to_latest_key_version_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. :paramtype key_encryption_key: ~azure.mgmt.storagecache.models.KeyVaultKeyReference @@ -646,7 +673,8 @@ def __init__( class CacheHealth(_serialization.Model): - """An indication of Cache health. Gives more information about health than just that related to provisioning. + """An indication of Cache health. Gives more information about health than just that related to + provisioning. Variables are only populated by the server, and will be ignored when sending a request. @@ -675,8 +703,8 @@ def __init__( *, state: Optional[Union[str, "_models.HealthStateType"]] = None, status_description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: List of Cache health states. Known values are: "Unknown", "Healthy", "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing", @@ -726,8 +754,8 @@ def __init__( *, type: Optional[Union[str, "_models.CacheIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentitiesValue"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the cache. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -783,8 +811,8 @@ def __init__( dns_servers: Optional[List[str]] = None, dns_search_domain: Optional[str] = None, ntp_server: str = "time.windows.com", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword mtu: The IPv4 maximum transmission unit configured for the subnet. :paramtype mtu: int @@ -816,7 +844,7 @@ class CacheSecuritySettings(_serialization.Model): "access_policies": {"key": "accessPolicies", "type": "[NfsAccessPolicy]"}, } - def __init__(self, *, access_policies: Optional[List["_models.NfsAccessPolicy"]] = None, **kwargs): + def __init__(self, *, access_policies: Optional[List["_models.NfsAccessPolicy"]] = None, **kwargs: Any) -> None: """ :keyword access_policies: NFS access policies defined for this cache. :paramtype access_policies: list[~azure.mgmt.storagecache.models.NfsAccessPolicy] @@ -836,7 +864,7 @@ class CacheSku(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: SKU name for this Cache. :paramtype name: str @@ -846,7 +874,8 @@ def __init__(self, *, name: Optional[str] = None, **kwargs): class CachesListResult(_serialization.Model): - """Result of the request to list Caches. It contains a list of Caches and a URL link to get the next set of results. + """Result of the request to list Caches. It contains a list of Caches and a URL link to get the + next set of results. :ivar next_link: URL to get the next set of Cache list results, if there are any. :vartype next_link: str @@ -859,7 +888,9 @@ class CachesListResult(_serialization.Model): "value": {"key": "value", "type": "[Cache]"}, } - def __init__(self, *, next_link: Optional[str] = None, value: Optional[List["_models.Cache"]] = None, **kwargs): + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Cache"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: URL to get the next set of Cache list results, if there are any. :paramtype next_link: str @@ -894,8 +925,8 @@ def __init__( *, upgrade_schedule_enabled: Optional[bool] = None, scheduled_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword upgrade_schedule_enabled: True if the user chooses to select an installation time between now and firmwareUpdateDeadline. Else the firmware will automatically be installed after @@ -949,7 +980,7 @@ class CacheUpgradeStatus(_serialization.Model): "pending_firmware_version": {"key": "pendingFirmwareVersion", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.current_firmware_version = None @@ -1030,8 +1061,8 @@ def __init__( auto_download_certificate: Optional[bool] = None, ca_certificate_uri: Optional[str] = None, credentials: Optional["_models.CacheUsernameDownloadSettingsCredentials"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword extended_groups: Whether or not Extended Groups is enabled. :paramtype extended_groups: bool @@ -1094,7 +1125,7 @@ class CacheUsernameDownloadSettingsCredentials(_serialization.Model): "bind_password": {"key": "bindPassword", "type": "str"}, } - def __init__(self, *, bind_dn: Optional[str] = None, bind_password: Optional[str] = None, **kwargs): + def __init__(self, *, bind_dn: Optional[str] = None, bind_password: Optional[str] = None, **kwargs: Any) -> None: """ :keyword bind_dn: The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. @@ -1119,7 +1150,7 @@ class ClfsTarget(_serialization.Model): "target": {"key": "target", "type": "str"}, } - def __init__(self, *, target: Optional[str] = None, **kwargs): + def __init__(self, *, target: Optional[str] = None, **kwargs: Any) -> None: """ :keyword target: Resource ID of storage container. :paramtype target: str @@ -1158,8 +1189,8 @@ def __init__( details: Optional[List["_models.CloudErrorBody"]] = None, message: Optional[str] = None, target: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -1201,7 +1232,7 @@ class Condition(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.timestamp = None @@ -1222,7 +1253,7 @@ class ErrorResponse(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code. :paramtype code: str @@ -1255,7 +1286,7 @@ class KeyVaultKeyReference(_serialization.Model): "source_vault": {"key": "sourceVault", "type": "KeyVaultKeyReferenceSourceVault"}, } - def __init__(self, *, key_url: str, source_vault: "_models.KeyVaultKeyReferenceSourceVault", **kwargs): + def __init__(self, *, key_url: str, source_vault: "_models.KeyVaultKeyReferenceSourceVault", **kwargs: Any) -> None: """ :keyword key_url: The URL referencing a key encryption key in Key Vault. Required. :paramtype key_url: str @@ -1278,7 +1309,7 @@ class KeyVaultKeyReferenceSourceVault(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource Id. :paramtype id: str @@ -1301,7 +1332,7 @@ class LogSpecification(_serialization.Model): "display_name": {"key": "displayName", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, display_name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, display_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the log. :paramtype name: str @@ -1340,8 +1371,8 @@ def __init__( display_name: Optional[str] = None, internal_name: Optional[str] = None, to_be_exported_for_shoebox: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the dimension. :paramtype name: str @@ -1403,8 +1434,8 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "_models.MetricAggregationType"]]] = None, metric_class: Optional[str] = None, dimensions: Optional[List["_models.MetricDimension"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the metric. :paramtype name: str @@ -1462,8 +1493,8 @@ def __init__( target_path: Optional[str] = None, nfs_export: Optional[str] = None, nfs_access_policy: str = "default", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword namespace_path: Namespace path on a Cache for a Storage Target. :paramtype namespace_path: str @@ -1488,6 +1519,12 @@ class Nfs3Target(_serialization.Model): :vartype target: str :ivar usage_model: Identifies the StorageCache usage model to be used for this storage target. :vartype usage_model: str + :ivar verification_timer: Amount of time (in seconds) the cache waits before it checks the + back-end storage for file updates. + :vartype verification_timer: int + :ivar write_back_timer: Amount of time (in seconds) the cache waits after the last file change + before it copies the changed file to back-end storage. + :vartype write_back_timer: int """ _validation = { @@ -1497,19 +1534,37 @@ class Nfs3Target(_serialization.Model): _attribute_map = { "target": {"key": "target", "type": "str"}, "usage_model": {"key": "usageModel", "type": "str"}, + "verification_timer": {"key": "verificationTimer", "type": "int"}, + "write_back_timer": {"key": "writeBackTimer", "type": "int"}, } - def __init__(self, *, target: Optional[str] = None, usage_model: Optional[str] = None, **kwargs): + def __init__( + self, + *, + target: Optional[str] = None, + usage_model: Optional[str] = None, + verification_timer: Optional[int] = None, + write_back_timer: Optional[int] = None, + **kwargs: Any + ) -> None: """ :keyword target: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). :paramtype target: str :keyword usage_model: Identifies the StorageCache usage model to be used for this storage target. :paramtype usage_model: str + :keyword verification_timer: Amount of time (in seconds) the cache waits before it checks the + back-end storage for file updates. + :paramtype verification_timer: int + :keyword write_back_timer: Amount of time (in seconds) the cache waits after the last file + change before it copies the changed file to back-end storage. + :paramtype write_back_timer: int """ super().__init__(**kwargs) self.target = target self.usage_model = usage_model + self.verification_timer = verification_timer + self.write_back_timer = write_back_timer class NfsAccessPolicy(_serialization.Model): @@ -1534,7 +1589,7 @@ class NfsAccessPolicy(_serialization.Model): "access_rules": {"key": "accessRules", "type": "[NfsAccessRule]"}, } - def __init__(self, *, name: str, access_rules: List["_models.NfsAccessRule"], **kwargs): + def __init__(self, *, name: str, access_rules: List["_models.NfsAccessRule"], **kwargs: Any) -> None: """ :keyword name: Name identifying this policy. Access Policy names are not case sensitive. Required. @@ -1607,8 +1662,8 @@ def __init__( root_squash: Optional[bool] = None, anonymous_uid: Optional[str] = None, anonymous_gid: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: Scope for this rule. The scope and filter determine which clients match the rule. Required. Known values are: "default", "network", and "host". @@ -1693,7 +1748,7 @@ class PrimingJob(_serialization.Model): "priming_job_percent_complete": {"key": "primingJobPercentComplete", "type": "float"}, } - def __init__(self, *, priming_job_name: str, priming_manifest_url: str, **kwargs): + def __init__(self, *, priming_job_name: str, priming_manifest_url: str, **kwargs: Any) -> None: """ :keyword priming_job_name: The priming job name. Required. :paramtype priming_job_name: str @@ -1729,7 +1784,7 @@ class PrimingJobIdParameter(_serialization.Model): "priming_job_id": {"key": "primingJobId", "type": "str"}, } - def __init__(self, *, priming_job_id: str, **kwargs): + def __init__(self, *, priming_job_id: str, **kwargs: Any) -> None: """ :keyword priming_job_id: The unique identifier of the priming job. Required. :paramtype priming_job_id: str @@ -1780,8 +1835,8 @@ def __init__( location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, name: Optional[str] = None, restrictions: Optional[List["_models.Restriction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. :paramtype capabilities: list[~azure.mgmt.storagecache.models.ResourceSkuCapabilities] @@ -1816,7 +1871,7 @@ class ResourceSkuCapabilities(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of a capability, such as ops/sec. :paramtype name: str @@ -1842,7 +1897,7 @@ class ResourceSkuLocationInfo(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: Location where this SKU is available. :paramtype location: str @@ -1874,7 +1929,7 @@ class ResourceSkusResult(_serialization.Model): "value": {"key": "value", "type": "[ResourceSku]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The URI to fetch the next page of Cache SKUs. :paramtype next_link: str @@ -1913,7 +1968,7 @@ class ResourceUsage(_serialization.Model): "name": {"key": "name", "type": "ResourceUsageName"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.limit = None @@ -1936,7 +1991,7 @@ class ResourceUsageName(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Canonical name for this resource type. :paramtype value: str @@ -1949,7 +2004,8 @@ def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str class ResourceUsagesListResult(_serialization.Model): - """Result of the request to list resource usages. It contains a list of resource usages & limits and a URL link to get the next set of results. + """Result of the request to list resource usages. It contains a list of resource usages & limits + and a URL link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1970,7 +2026,7 @@ class ResourceUsagesListResult(_serialization.Model): "value": {"key": "value", "type": "[ResourceUsage]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.next_link = None @@ -2006,7 +2062,7 @@ class Restriction(_serialization.Model): "reason_code": {"key": "reasonCode", "type": "str"}, } - def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = None, **kwargs): + def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = None, **kwargs: Any) -> None: """ :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as @@ -2053,7 +2109,7 @@ class StorageTargetResource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -2139,8 +2195,8 @@ def __init__( clfs: Optional["_models.ClfsTarget"] = None, unknown: Optional["_models.UnknownTarget"] = None, blob_nfs: Optional["_models.BlobNfsTarget"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword junctions: List of Cache namespace junctions to target for namespace associations. :paramtype junctions: list[~azure.mgmt.storagecache.models.NamespaceJunction] @@ -2190,7 +2246,9 @@ class StorageTargetSpaceAllocation(_serialization.Model): "allocation_percentage": {"key": "allocationPercentage", "type": "int"}, } - def __init__(self, *, name: Optional[str] = None, allocation_percentage: Optional[int] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, allocation_percentage: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword name: Name of the storage target. :paramtype name: str @@ -2218,8 +2276,8 @@ class StorageTargetsResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.StorageTarget"]] = None, **kwargs - ): + self, *, next_link: Optional[str] = None, value: Optional[List["_models.StorageTarget"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: The URI to fetch the next page of Storage Targets. :paramtype next_link: str @@ -2268,8 +2326,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2307,7 +2365,7 @@ class UnknownTarget(_serialization.Model): "attributes": {"key": "attributes", "type": "{str}"}, } - def __init__(self, *, attributes: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, attributes: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword attributes: Dictionary of string->string pairs containing information about the Storage Target. @@ -2341,8 +2399,8 @@ def __init__( display: Optional["_models.UsageModelDisplay"] = None, model_name: Optional[str] = None, target_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display: Localized information describing this usage model. :paramtype display: ~azure.mgmt.storagecache.models.UsageModelDisplay @@ -2369,7 +2427,7 @@ class UsageModelDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: String to display for this usage model. :paramtype description: str @@ -2393,8 +2451,8 @@ class UsageModelsResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.UsageModel"]] = None, **kwargs - ): + self, *, next_link: Optional[str] = None, value: Optional[List["_models.UsageModel"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: The URI to fetch the next page of Cache usage models. :paramtype next_link: str @@ -2427,7 +2485,7 @@ class UserAssignedIdentitiesValue(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py index e9ebf63fa185..e385397dc1fe 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_operations_operations.py @@ -43,7 +43,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.AscOpe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AscOperation] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py index 94928df22984..4de39fb26338 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py @@ -45,7 +45,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ResourceUsage" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ResourceUsagesListResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py index a2341579c8ed..ebd95ad24f5d 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py @@ -47,7 +47,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_delete_request(resource_group_name: str, cache_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,7 @@ def build_get_request(resource_group_name: str, cache_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +159,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +191,7 @@ def build_update_request(resource_group_name: str, cache_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -225,7 +225,7 @@ def build_debug_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +254,7 @@ def build_flush_request(resource_group_name: str, cache_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -283,7 +283,7 @@ def build_start_request(resource_group_name: str, cache_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,7 +312,7 @@ def build_stop_request(resource_group_name: str, cache_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +343,7 @@ def build_start_priming_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -377,7 +377,7 @@ def build_stop_priming_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -411,7 +411,7 @@ def build_pause_priming_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -445,7 +445,7 @@ def build_resume_priming_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -479,7 +479,7 @@ def build_upgrade_firmware_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +510,7 @@ def build_space_allocation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -569,7 +569,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cache"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CachesListResult] = kwargs.pop("cls", None) @@ -652,7 +652,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CachesListResult] = kwargs.pop("cls", None) @@ -738,7 +738,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -765,8 +765,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" @@ -796,7 +803,7 @@ def begin_delete(self, resource_group_name: str, cache_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -863,7 +870,7 @@ def get(self, resource_group_name: str, cache_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Cache] = kwargs.pop("cls", None) @@ -902,7 +909,7 @@ def get(self, resource_group_name: str, cache_name: str, **kwargs: Any) -> _mode } def _create_or_update_initial( - self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any + self, resource_group_name: str, cache_name: str, cache: Union[_models.Cache, IO], **kwargs: Any ) -> Optional[_models.Cache]: error_map = { 401: ClientAuthenticationError, @@ -915,7 +922,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -927,10 +934,7 @@ def _create_or_update_initial( if isinstance(cache, (IO, bytes)): _content = cache else: - if cache is not None: - _json = self._serialize.body(cache, "Cache") - else: - _json = None + _json = self._serialize.body(cache, "Cache") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -978,7 +982,7 @@ def begin_create_or_update( self, resource_group_name: str, cache_name: str, - cache: Optional[_models.Cache] = None, + cache: _models.Cache, *, content_type: str = "application/json", **kwargs: Any @@ -991,8 +995,7 @@ def begin_create_or_update( from the [-0-9a-zA-Z_] char class. Required. :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only - properties are included, they must match the existing values of those properties. Default value - is None. + properties are included, they must match the existing values of those properties. Required. :type cache: ~azure.mgmt.storagecache.models.Cache :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -1015,7 +1018,7 @@ def begin_create_or_update( self, resource_group_name: str, cache_name: str, - cache: Optional[IO] = None, + cache: IO, *, content_type: str = "application/json", **kwargs: Any @@ -1028,8 +1031,7 @@ def begin_create_or_update( from the [-0-9a-zA-Z_] char class. Required. :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only - properties are included, they must match the existing values of those properties. Default value - is None. + properties are included, they must match the existing values of those properties. Required. :type cache: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -1049,7 +1051,7 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any + self, resource_group_name: str, cache_name: str, cache: Union[_models.Cache, IO], **kwargs: Any ) -> LROPoller[_models.Cache]: """Create or update a Cache. @@ -1060,7 +1062,7 @@ def begin_create_or_update( :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must match the existing values of those properties. Is either a - model type or a IO type. Default value is None. + model type or a IO type. Required. :type cache: ~azure.mgmt.storagecache.models.Cache or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1080,7 +1082,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1127,8 +1129,84 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" } + def _update_initial( + self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any + ) -> Optional[_models.Cache]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Cache]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cache, (IO, bytes)): + _content = cache + else: + if cache is not None: + _json = self._serialize.body(cache, "Cache") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Cache", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" + } + @overload - def update( + def begin_update( self, resource_group_name: str, cache_name: str, @@ -1136,7 +1214,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Cache: + ) -> LROPoller[_models.Cache]: """Update a Cache instance. :param resource_group_name: Target resource group. Required. @@ -1152,13 +1230,20 @@ def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cache or the result of cls(response) - :rtype: ~azure.mgmt.storagecache.models.Cache + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Cache or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagecache.models.Cache] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, cache_name: str, @@ -1166,7 +1251,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Cache: + ) -> LROPoller[_models.Cache]: """Update a Cache instance. :param resource_group_name: Target resource group. Required. @@ -1182,15 +1267,22 @@ def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cache or the result of cls(response) - :rtype: ~azure.mgmt.storagecache.models.Cache + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Cache or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagecache.models.Cache] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_update( self, resource_group_name: str, cache_name: str, cache: Optional[Union[_models.Cache, IO]] = None, **kwargs: Any - ) -> _models.Cache: + ) -> LROPoller[_models.Cache]: """Update a Cache instance. :param resource_group_name: Target resource group. Required. @@ -1206,71 +1298,66 @@ def update( Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cache or the result of cls(response) - :rtype: ~azure.mgmt.storagecache.models.Cache + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Cache or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagecache.models.Cache] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cache] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + cache=cache, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cache, (IO, bytes)): - _content = cache - else: - if cache is not None: - _json = self._serialize.body(cache, "Cache") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - cache_name=cache_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Cache", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Cache", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - return deserialized + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - update.metadata = { + begin_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" } @@ -1288,7 +1375,7 @@ def _debug_info_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1315,8 +1402,15 @@ def _debug_info_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _debug_info_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo" @@ -1346,7 +1440,7 @@ def begin_debug_info(self, resource_group_name: str, cache_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1404,7 +1498,7 @@ def _flush_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1431,8 +1525,15 @@ def _flush_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _flush_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush" @@ -1463,7 +1564,7 @@ def begin_flush(self, resource_group_name: str, cache_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1521,7 +1622,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1548,8 +1649,15 @@ def _start_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _start_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start" @@ -1579,7 +1687,7 @@ def begin_start(self, resource_group_name: str, cache_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1637,7 +1745,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1664,8 +1772,15 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _stop_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop" @@ -1695,7 +1810,7 @@ def begin_stop(self, resource_group_name: str, cache_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1757,7 +1872,7 @@ def _start_priming_job_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1918,7 +2033,7 @@ def begin_start_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1983,7 +2098,7 @@ def _stop_priming_job_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2145,7 +2260,7 @@ def begin_stop_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2210,7 +2325,7 @@ def _pause_priming_job_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2372,7 +2487,7 @@ def begin_pause_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2437,7 +2552,7 @@ def _resume_priming_job_initial( # pylint: disable=inconsistent-return-statemen _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2599,7 +2714,7 @@ def begin_resume_priming_job( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2660,7 +2775,7 @@ def _upgrade_firmware_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2687,8 +2802,15 @@ def _upgrade_firmware_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _upgrade_firmware_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade" @@ -2719,7 +2841,7 @@ def begin_upgrade_firmware(self, resource_group_name: str, cache_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2781,7 +2903,7 @@ def _space_allocation_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -2945,7 +3067,7 @@ def begin_space_allocation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py index 9693d7e7f730..fb160c52c151 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApiOperation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ApiOperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py index b2af2ccc4e5f..87251f6c94a6 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_skus_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ResourceSkusResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py index 27430f082b49..0fd641a66396 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py @@ -47,7 +47,7 @@ def build_flush_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_suspend_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ def build_resume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +149,7 @@ def build_invalidate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +210,7 @@ def _flush_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -238,8 +238,15 @@ def _flush_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _flush_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush" @@ -275,7 +282,7 @@ def begin_flush( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -334,7 +341,7 @@ def _suspend_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -362,8 +369,15 @@ def _suspend_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _suspend_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend" @@ -397,7 +411,7 @@ def begin_suspend( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -456,7 +470,7 @@ def _resume_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -484,8 +498,15 @@ def _resume_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _resume_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume" @@ -519,7 +540,7 @@ def begin_resume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -578,7 +599,7 @@ def _invalidate_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -606,8 +627,15 @@ def _invalidate_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _invalidate_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate" @@ -642,7 +670,7 @@ def begin_invalidate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py index 7000ec4cecef..a8519711f550 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_targets_operations.py @@ -49,7 +49,7 @@ def build_dns_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_list_by_cache_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -221,6 +221,40 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_restore_defaults_request( + resource_group_name: str, cache_name: str, storage_target_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/restoreDefaults", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "cacheName": _SERIALIZER.url("cache_name", cache_name, "str", pattern=r"^[-0-9a-zA-Z_]{1,80}$"), + "storageTargetName": _SERIALIZER.url( + "storage_target_name", storage_target_name, "str", pattern=r"^[-0-9a-zA-Z_]{1,80}$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class StorageTargetsOperations: """ .. warning:: @@ -254,7 +288,7 @@ def _dns_refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -282,8 +316,15 @@ def _dns_refresh_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _dns_refresh_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh" @@ -317,7 +358,7 @@ def begin_dns_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -381,7 +422,7 @@ def list_by_cache( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.StorageTargetsResult] = kwargs.pop("cls", None) @@ -473,7 +514,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -502,8 +543,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}" @@ -549,7 +597,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -622,7 +670,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.StorageTarget] = kwargs.pop("cls", None) @@ -666,7 +714,7 @@ def _create_or_update_initial( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[Union[_models.StorageTarget, IO]] = None, + storagetarget: Union[_models.StorageTarget, IO], **kwargs: Any ) -> Optional[_models.StorageTarget]: error_map = { @@ -680,7 +728,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -692,10 +740,7 @@ def _create_or_update_initial( if isinstance(storagetarget, (IO, bytes)): _content = storagetarget else: - if storagetarget is not None: - _json = self._serialize.body(storagetarget, "StorageTarget") - else: - _json = None + _json = self._serialize.body(storagetarget, "StorageTarget") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -745,7 +790,7 @@ def begin_create_or_update( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[_models.StorageTarget] = None, + storagetarget: _models.StorageTarget, *, content_type: str = "application/json", **kwargs: Any @@ -761,8 +806,7 @@ def begin_create_or_update( :type cache_name: str :param storage_target_name: Name of Storage Target. Required. :type storage_target_name: str - :param storagetarget: Object containing the definition of a Storage Target. Default value is - None. + :param storagetarget: Object containing the definition of a Storage Target. Required. :type storagetarget: ~azure.mgmt.storagecache.models.StorageTarget :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -787,7 +831,7 @@ def begin_create_or_update( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[IO] = None, + storagetarget: IO, *, content_type: str = "application/json", **kwargs: Any @@ -803,8 +847,7 @@ def begin_create_or_update( :type cache_name: str :param storage_target_name: Name of Storage Target. Required. :type storage_target_name: str - :param storagetarget: Object containing the definition of a Storage Target. Default value is - None. + :param storagetarget: Object containing the definition of a Storage Target. Required. :type storagetarget: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -829,7 +872,7 @@ def begin_create_or_update( resource_group_name: str, cache_name: str, storage_target_name: str, - storagetarget: Optional[Union[_models.StorageTarget, IO]] = None, + storagetarget: Union[_models.StorageTarget, IO], **kwargs: Any ) -> LROPoller[_models.StorageTarget]: """Create or update a Storage Target. This operation is allowed at any time, but if the Cache is @@ -844,7 +887,7 @@ def begin_create_or_update( :param storage_target_name: Name of Storage Target. Required. :type storage_target_name: str :param storagetarget: Object containing the definition of a Storage Target. Is either a model - type or a IO type. Default value is None. + type or a IO type. Required. :type storagetarget: ~azure.mgmt.storagecache.models.StorageTarget or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -865,7 +908,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -912,3 +955,132 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}" } + + def _restore_defaults_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cache_name: str, storage_target_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restore_defaults_request( + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restore_defaults_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restore_defaults_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/restoreDefaults" + } + + @distributed_trace + def begin_restore_defaults( + self, resource_group_name: str, cache_name: str, storage_target_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Tells a storage target to restore its settings to their default values. + + :param resource_group_name: Target resource group. Required. + :type resource_group_name: str + :param cache_name: Name of Cache. Length of name must not be greater than 80 and chars must be + from the [-0-9a-zA-Z_] char class. Required. + :type cache_name: str + :param storage_target_name: Name of Storage Target. Required. + :type storage_target_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restore_defaults_initial( # type: ignore + resource_group_name=resource_group_name, + cache_name=cache_name, + storage_target_name=storage_target_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restore_defaults.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/restoreDefaults" + } diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py index c126f8b31400..48f9ebcc8942 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.UsageModel"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01"] = kwargs.pop( + api_version: Literal["2023-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.UsageModelsResult] = kwargs.pop("cls", None) diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_operations_get.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_operations_get.py index 84886a81984a..1fab73e28649 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_operations_get.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_operations_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/AscOperations_Get.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/AscOperations_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_resource_usages_get.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_resource_usages_get.py index 8e7ad3d4249e..ef90d317c469 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_resource_usages_get.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/asc_resource_usages_get.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/AscResourceUsages_Get.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/AscResourceUsages_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update.py index 63f4d36cae97..7f51b06b1517 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update.py @@ -32,10 +32,70 @@ def main(): response = client.caches.begin_create_or_update( resource_group_name="scgroup", cache_name="sc1", + cache={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {} + }, + }, + "location": "westus", + "properties": { + "cacheSizeGB": 3072, + "directoryServicesSettings": { + "activeDirectory": { + "cacheNetBiosName": "contosoSmb", + "credentials": {"password": "", "username": "consotoAdmin"}, + "domainName": "contosoAd.contoso.local", + "domainNetBiosName": "contosoAd", + "primaryDnsIpAddress": "192.0.2.10", + "secondaryDnsIpAddress": "192.0.2.11", + }, + "usernameDownload": { + "credentials": { + "bindDn": "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + "bindPassword": "", + }, + "extendedGroups": True, + "ldapBaseDN": "dc=contosoad,dc=contoso,dc=local", + "ldapServer": "192.0.2.12", + "usernameSource": "LDAP", + }, + }, + "encryptionSettings": { + "keyEncryptionKey": { + "keyUrl": "https://keyvault-cmk.vault.azure.net/keys/key2047/test", + "sourceVault": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk" + }, + } + }, + "securitySettings": { + "accessPolicies": [ + { + "accessRules": [ + { + "access": "rw", + "rootSquash": False, + "scope": "default", + "submountAccess": True, + "suid": False, + } + ], + "name": "default", + } + ] + }, + "subnet": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + "upgradeSettings": {"scheduledTime": "2022-04-26T18:25:43.511Z", "upgradeScheduleEnabled": True}, + }, + "sku": {"name": "Standard_2G"}, + "tags": {"Dept": "Contoso"}, + }, ).result() print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_CreateOrUpdate.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update_ldap_only.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update_ldap_only.py index 18b35b2a3b7e..d1d0cd7f949e 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update_ldap_only.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_create_or_update_ldap_only.py @@ -32,10 +32,56 @@ def main(): response = client.caches.begin_create_or_update( resource_group_name="scgroup", cache_name="sc1", + cache={ + "location": "westus", + "properties": { + "cacheSizeGB": 3072, + "directoryServicesSettings": { + "usernameDownload": { + "credentials": { + "bindDn": "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + "bindPassword": "", + }, + "extendedGroups": True, + "ldapBaseDN": "dc=contosoad,dc=contoso,dc=local", + "ldapServer": "192.0.2.12", + "usernameSource": "LDAP", + } + }, + "encryptionSettings": { + "keyEncryptionKey": { + "keyUrl": "https://keyvault-cmk.vault.azure.net/keys/key2048/test", + "sourceVault": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk" + }, + } + }, + "securitySettings": { + "accessPolicies": [ + { + "accessRules": [ + { + "access": "rw", + "rootSquash": False, + "scope": "default", + "submountAccess": True, + "suid": False, + } + ], + "name": "default", + } + ] + }, + "subnet": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + "upgradeSettings": {"scheduledTime": "2022-04-26T18:25:43.511Z", "upgradeScheduleEnabled": True}, + }, + "sku": {"name": "Standard_2G"}, + "tags": {"Dept": "Contoso"}, + }, ).result() print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_CreateOrUpdate_ldap_only.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_CreateOrUpdate_ldap_only.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_debug_info.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_debug_info.py index eed71b046246..307ad3ac0a3c 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_debug_info.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_debug_info.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_DebugInfo.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_DebugInfo.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_delete.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_delete.py index d9fc5a318699..540dee6b98e1 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_delete.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Delete.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_flush.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_flush.py index 99f8842f1448..7633cfb5935d 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_flush.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_flush.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Flush.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_Flush.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_get.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_get.py index dae0f54922b0..11eaef9412cd 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_get.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Get.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list.py index d449795d790a..40d533485a68 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_List.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_List.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list_by_resource_group.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list_by_resource_group.py index 6fc53d52a609..0179e61d1aeb 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list_by_resource_group.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_ListByResourceGroup.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_start.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_start.py index b68c828eba08..e0535b48549a 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_start.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_start.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Start.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_Start.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_stop.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_stop.py index f1f0a6dafc38..d898fda0f440 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_stop.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_stop.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Stop.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_Stop.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update.py index fe6e34db445b..451c0af7a2a6 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update.py @@ -29,13 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.caches.update( + response = client.caches.begin_update( resource_group_name="scgroup", cache_name="sc1", - ) + ).result() print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Update.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_Update.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update_ldap_only.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update_ldap_only.py index a8b441e52678..c0a213813ec4 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update_ldap_only.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_update_ldap_only.py @@ -29,13 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.caches.update( + response = client.caches.begin_update( resource_group_name="scgroup", cache_name="sc1", - ) + ).result() print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Update_ldap_only.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_Update_ldap_only.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_upgrade_firmware.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_upgrade_firmware.py index 5c81ae2409bb..399f1950eae4 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_upgrade_firmware.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/caches_upgrade_firmware.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_UpgradeFirmware.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Caches_UpgradeFirmware.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/operations_list.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/operations_list.py index 0effaa2fe8c3..0e799322f6e9 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/operations_list.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Operations_List.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/pause_priming_job.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/pause_priming_job.py index d20365a3353b..1cbeeb280d8c 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/pause_priming_job.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/pause_priming_job.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/PausePrimingJob.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/PausePrimingJob.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/resume_priming_job.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/resume_priming_job.py index e2d180e01953..88a30109ef7c 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/resume_priming_job.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/resume_priming_job.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/ResumePrimingJob.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/ResumePrimingJob.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/skus_list.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/skus_list.py index a18b4033a98f..56b457fff552 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/skus_list.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/skus_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Skus_List.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/Skus_List.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/space_allocation_post.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/space_allocation_post.py index 0af412875926..176ea4007e71 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/space_allocation_post.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/space_allocation_post.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/SpaceAllocation_Post.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/SpaceAllocation_Post.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/start_priming_job.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/start_priming_job.py index 20282b16d3fe..8159d834658a 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/start_priming_job.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/start_priming_job.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StartPrimingJob.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StartPrimingJob.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/stop_priming_job.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/stop_priming_job.py index 71b26996b4ab..1bfa25066ead 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/stop_priming_job.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/stop_priming_job.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StopPrimingJob.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StopPrimingJob.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update.py index def536a51326..0c4b6e7d9273 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update.py @@ -33,10 +33,30 @@ def main(): resource_group_name="scgroup", cache_name="sc1", storage_target_name="st1", + storagetarget={ + "properties": { + "junctions": [ + { + "namespacePath": "/path/on/cache", + "nfsAccessPolicy": "default", + "nfsExport": "exp1", + "targetPath": "/path/on/exp1", + }, + { + "namespacePath": "/path2/on/cache", + "nfsAccessPolicy": "rootSquash", + "nfsExport": "exp2", + "targetPath": "/path2/on/exp2", + }, + ], + "nfs3": {"target": "10.0.44.44", "usageModel": "READ_ONLY", "verificationTimer": 30}, + "targetType": "nfs3", + } + }, ).result() print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_CreateOrUpdate.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_blob_nfs.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_blob_nfs.py index 634eea8c1a83..c2a9e01464f6 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_blob_nfs.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_blob_nfs.py @@ -33,10 +33,22 @@ def main(): resource_group_name="scgroup", cache_name="sc1", storage_target_name="st1", + storagetarget={ + "properties": { + "blobNfs": { + "target": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/blofnfs/blobServices/default/containers/blobnfs", + "usageModel": "READ_WRITE", + "verificationTimer": 28800, + "writeBackTimer": 3600, + }, + "junctions": [{"namespacePath": "/blobnfs"}], + "targetType": "blobNfs", + } + }, ).result() print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_CreateOrUpdate_BlobNfs.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_CreateOrUpdate_BlobNfs.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_no_junctions.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_no_junctions.py index 2f711d7be6ae..660453be55d4 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_no_junctions.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_create_or_update_no_junctions.py @@ -33,10 +33,16 @@ def main(): resource_group_name="scgroup", cache_name="sc1", storage_target_name="st1", + storagetarget={ + "properties": { + "nfs3": {"target": "10.0.44.44", "usageModel": "READ_ONLY", "verificationTimer": 30}, + "targetType": "nfs3", + } + }, ).result() print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_CreateOrUpdate_NoJunctions.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_CreateOrUpdate_NoJunctions.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_delete.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_delete.py index c81e5d6da591..838bf4f9abf2 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_delete.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Delete.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_dns_refresh.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_dns_refresh.py index bd6b1215f313..254fb8a0a696 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_dns_refresh.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_dns_refresh.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_DnsRefresh.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_DnsRefresh.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_flush.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_flush.py index 82481ed2474b..0b104b5ba287 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_flush.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_flush.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Flush.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_Flush.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_get.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_get.py index 6419c56856d0..9171ba817c9c 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_get.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Get.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_invalidate.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_invalidate.py index d9941abee579..323c3f99ea96 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_invalidate.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_invalidate.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Invalidate.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_Invalidate.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_list_by_cache.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_list_by_cache.py index 7e6ff35ed73a..109aaef3a872 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_list_by_cache.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_list_by_cache.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_ListByCache.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_ListByCache.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_restore_defaults.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_restore_defaults.py new file mode 100644 index 000000000000..22d48d6c7d9a --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_restore_defaults.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.storagecache import StorageCacheManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storagecache +# USAGE + python storage_targets_restore_defaults.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = StorageCacheManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.storage_targets.begin_restore_defaults( + resource_group_name="scgroup", + cache_name="sc", + storage_target_name="st1", + ).result() + print(response) + + +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_RestoreDefaults.json +if __name__ == "__main__": + main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_resume.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_resume.py index 54e9002566e5..15f6767d6f1c 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_resume.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_resume.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Resume.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_Resume.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_suspend.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_suspend.py index 0c9383787c33..26b85a9a2561 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_suspend.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/storage_targets_suspend.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Suspend.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/StorageTargets_Suspend.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagecache/generated_samples/usage_models_list.py b/sdk/storage/azure-mgmt-storagecache/generated_samples/usage_models_list.py index 08cc79d6fcec..fbdc72ffc005 100644 --- a/sdk/storage/azure-mgmt-storagecache/generated_samples/usage_models_list.py +++ b/sdk/storage/azure-mgmt-storagecache/generated_samples/usage_models_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/UsageModels_List.json +# x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-01-01/examples/UsageModels_List.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-storage-blob-changefeed/pyproject.toml b/sdk/storage/azure-storage-blob-changefeed/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/storage/azure-storage-blob-changefeed/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py index 9d2b2346826c..e7b77526a26b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py @@ -574,10 +574,10 @@ def read(self, size: Optional[int] = -1) -> T: is unspecified or is -1, all bytes will be read. :param size: - The number of bytes to download from the stream. Leave unsepcified + The number of bytes to download from the stream. Leave unspecified or set to -1 to download all bytes. :returns: - The requsted data as bytes or a string if encoding was speicified. If + The requested data as bytes or a string if encoding was specified. If the return value is empty, there is no more data to read. :rtype: T """ @@ -651,7 +651,7 @@ def readall(self) -> T: Read the entire contents of this blob. This operation is blocking until all data is downloaded. - :returns: The requsted data as bytes or a string if encoding was speicified. + :returns: The requested data as bytes or a string if encoding was specified. :rtype: T """ stream = BytesIO() @@ -662,10 +662,12 @@ def readall(self) -> T: return data def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -678,10 +680,12 @@ def content_as_bytes(self, max_concurrency=1): return self.readall() def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this blob, and decode as text. + """DEPRECATED: Download the contents of this blob, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -773,7 +777,9 @@ def readinto(self, stream: IO[T]) -> int: return remaining_size def download_to_stream(self, stream, max_concurrency=1): - """Download the contents of this blob to a stream. + """DEPRECATED: Download the contents of this blob to a stream. + + This method is deprecated, use func:`readinto` instead. :param stream: The stream to download to. This can be an open file-handle, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py index d13da65f19cb..eb3bd645d42d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py @@ -461,10 +461,10 @@ async def read(self, size: Optional[int] = -1) -> T: is unspecified or is -1, all bytes will be read. :param size: - The number of bytes to download from the stream. Leave unsepcified + The number of bytes to download from the stream. Leave unspecified or set to -1 to download all bytes. :returns: - The requsted data as bytes or a string if encoding was speicified. If + The requested data as bytes or a string if encoding was specified. If the return value is empty, there is no more data to read. :rtype: T """ @@ -557,7 +557,7 @@ async def readall(self) -> T: Read the entire contents of this blob. This operation is blocking until all data is downloaded. - :returns: The requsted data as bytes or a string if encoding was speicified. + :returns: The requested data as bytes or a string if encoding was specified. :rtype: T """ stream = BytesIO() @@ -568,10 +568,12 @@ async def readall(self) -> T: return data async def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -584,10 +586,12 @@ async def content_as_bytes(self, max_concurrency=1): return await self.readall() async def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this blob, and decode as text. + """DEPRECATED: Download the contents of this blob, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :param int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -698,7 +702,9 @@ async def readinto(self, stream: IO[T]) -> int: return remaining_size async def download_to_stream(self, stream, max_concurrency=1): - """Download the contents of this blob to a stream. + """DEPRECATED: Download the contents of this blob to a stream. + + This method is deprecated, use func:`readinto` instead. :param stream: The stream to download to. This can be an open file-handle, diff --git a/sdk/storage/azure-storage-blob/perf.yml b/sdk/storage/azure-storage-blob/perf.yml index d9587a36a73f..fd11ce8169f9 100644 --- a/sdk/storage/azure-storage-blob/perf.yml +++ b/sdk/storage/azure-storage-blob/perf.yml @@ -27,8 +27,9 @@ parameters: extends: template: /eng/pipelines/templates/jobs/perf.yml parameters: - ServiceDirectory: storage/azure-storage-blob + TimeoutInMinutes: 720 LanguageVersion: ${{ parameters.LanguageVersion }} + ServiceDirectory: storage/azure-storage-blob PackageVersions: ${{ parameters.PackageVersions }} Tests: ${{ parameters.Tests }} Arguments: ${{ parameters.Arguments }} diff --git a/sdk/storage/azure-storage-blob/pyproject.toml b/sdk/storage/azure-storage-blob/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/storage/azure-storage-blob/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/storage/azure-storage-file-datalake/pyproject.toml b/sdk/storage/azure-storage-file-datalake/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py index 94a0e25ec773..080b8a83ef4e 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py @@ -398,10 +398,12 @@ def readall(self): return data def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -414,10 +416,12 @@ def content_as_bytes(self, max_concurrency=1): return self.readall() def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this file, and decode as text. + """DEPRECATED: Download the contents of this file, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -495,7 +499,9 @@ def readinto(self, stream): return self.size def download_to_stream(self, stream, max_concurrency=1): - """Download the contents of this file to a stream. + """DEPRECATED: Download the contents of this file to a stream. + + This method is deprecated, use func:`readinto` instead. :param stream: The stream to download to. This can be an open file-handle, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py index ffcddb2e7843..9feae5ff9935 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py @@ -350,10 +350,12 @@ async def readall(self): return data async def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -366,10 +368,12 @@ async def content_as_bytes(self, max_concurrency=1): return await self.readall() async def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this file, and decode as text. + """DEPRECATED: Download the contents of this file, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -458,6 +462,8 @@ async def readinto(self, stream): async def download_to_stream(self, stream, max_concurrency=1): """Download the contents of this file to a stream. + This method is deprecated, use func:`readinto` instead. + :param stream: The stream to download to. This can be an open file-handle, or any writable stream. The stream must be seekable if the download diff --git a/sdk/storage/azure-storage-file-share/pyproject.toml b/sdk/storage/azure-storage-file-share/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/storage/azure-storage-queue/pyproject.toml b/sdk/storage/azure-storage-queue/pyproject.toml new file mode 100644 index 000000000000..ff779a518143 --- /dev/null +++ b/sdk/storage/azure-storage-queue/pyproject.toml @@ -0,0 +1,5 @@ +[tool.azure-sdk-build] +mypy = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md b/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md index 17940553a725..8d8a43fec310 100644 --- a/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md +++ b/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.1.0b7 (2023-02-19) + +### Features Added + + - Added operation group GetOperations + ## 2.1.0b6 (2022-11-23) ### Features Added diff --git a/sdk/synapse/azure-mgmt-synapse/README.md b/sdk/synapse/azure-mgmt-synapse/README.md index 4fec5a4b4401..800763819100 100644 --- a/sdk/synapse/azure-mgmt-synapse/README.md +++ b/sdk/synapse/azure-mgmt-synapse/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Synapse Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-synapse +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.synapse import SynapseManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = SynapseManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Synapse Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/synapse/azure-mgmt-synapse/_meta.json b/sdk/synapse/azure-mgmt-synapse/_meta.json index e371f9c5709c..84a228919657 100644 --- a/sdk/synapse/azure-mgmt-synapse/_meta.json +++ b/sdk/synapse/azure-mgmt-synapse/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7a54c1a83d14da431c0ae48c4315cba143084bce", + "commit": "0e20dd2e4e2a40e83840c30cce2efc4847fd9cb9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/synapse/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/synapse/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/synapse/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_serialization.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_serialization.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py index e3f345df2d7b..7efbeace92af 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py @@ -21,6 +21,7 @@ DataMaskingPoliciesOperations, DataMaskingRulesOperations, ExtendedSqlPoolBlobAuditingPoliciesOperations, + GetOperations, IntegrationRuntimeAuthKeysOperations, IntegrationRuntimeConnectionInfosOperations, IntegrationRuntimeCredentialsOperations, @@ -286,6 +287,8 @@ class SynapseManagementClient: # pylint: disable=client-accepts-api-version-key :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations :vartype integration_runtime_status: azure.mgmt.synapse.operations.IntegrationRuntimeStatusOperations + :ivar get: GetOperations operations + :vartype get: azure.mgmt.synapse.operations.GetOperations :ivar spark_configuration: SparkConfigurationOperations operations :vartype spark_configuration: azure.mgmt.synapse.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations @@ -521,6 +524,7 @@ def __init__( self.integration_runtime_status = IntegrationRuntimeStatusOperations( self._client, self._config, self._serialize, self._deserialize ) + self.get = GetOperations(self._client, self._config, self._serialize, self._deserialize) self.spark_configuration = SparkConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py index 966803995c04..58df7fbbdd42 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0b6" +VERSION = "2.1.0b7" diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py index 51d56e465a50..86f595a83a8e 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py @@ -21,6 +21,7 @@ DataMaskingPoliciesOperations, DataMaskingRulesOperations, ExtendedSqlPoolBlobAuditingPoliciesOperations, + GetOperations, IntegrationRuntimeAuthKeysOperations, IntegrationRuntimeConnectionInfosOperations, IntegrationRuntimeCredentialsOperations, @@ -290,6 +291,8 @@ class SynapseManagementClient: # pylint: disable=client-accepts-api-version-key :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations :vartype integration_runtime_status: azure.mgmt.synapse.aio.operations.IntegrationRuntimeStatusOperations + :ivar get: GetOperations operations + :vartype get: azure.mgmt.synapse.aio.operations.GetOperations :ivar spark_configuration: SparkConfigurationOperations operations :vartype spark_configuration: azure.mgmt.synapse.aio.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations @@ -525,6 +528,7 @@ def __init__( self.integration_runtime_status = IntegrationRuntimeStatusOperations( self._client, self._config, self._serialize, self._deserialize ) + self.get = GetOperations(self._client, self._config, self._serialize, self._deserialize) self.spark_configuration = SparkConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/__init__.py index 09104f09bc6d..b1719c4e0458 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/__init__.py @@ -89,6 +89,7 @@ from ._integration_runtime_auth_keys_operations import IntegrationRuntimeAuthKeysOperations from ._integration_runtime_monitoring_data_operations import IntegrationRuntimeMonitoringDataOperations from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations +from ._get_operations import GetOperations from ._spark_configuration_operations import SparkConfigurationOperations from ._spark_configurations_operations import SparkConfigurationsOperations from ._kusto_operations_operations import KustoOperationsOperations @@ -169,6 +170,7 @@ "IntegrationRuntimeAuthKeysOperations", "IntegrationRuntimeMonitoringDataOperations", "IntegrationRuntimeStatusOperations", + "GetOperations", "SparkConfigurationOperations", "SparkConfigurationsOperations", "KustoOperationsOperations", diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_get_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_get_operations.py new file mode 100644 index 000000000000..96984567c02a --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_get_operations.py @@ -0,0 +1,297 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._get_operations import ( + build_integration_runtime_enable_interactivequery_request, + build_integration_runtime_start_request, + build_integration_runtime_stop_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.synapse.aio.SynapseManagementClient`'s + :attr:`get` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def integration_runtime_start( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeOperationStatus: + """Get integration runtime start operation status. + + Get an integration runtime start operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_start_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_start.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start/operationstatuses/{integrationRuntimeOperationId}" + } + + @distributed_trace_async + async def integration_runtime_stop( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeStopOperationStatus: + """Get integration runtime stop operation status. + + Get an integration runtime stop operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeStopOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStopOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeStopOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_stop_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_stop.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeStopOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop/operationstatuses/{integrationRuntimeOperationId}" + } + + @distributed_trace_async + async def integration_runtime_enable_interactivequery( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeEnableinteractivequery: + """Get integration runtime enable interactivequery operation status. + + Get an integration runtime enable interactivequery operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeEnableinteractivequery or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeEnableinteractivequery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeEnableinteractivequery] = kwargs.pop("cls", None) + + request = build_integration_runtime_enable_interactivequery_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_enable_interactivequery.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeEnableinteractivequery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_enable_interactivequery.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableinteractivequery/operationstatuses/{integrationRuntimeOperationId}" + } diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py index 57c76900e66a..953214c1ad2a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py @@ -431,7 +431,7 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.OperationResource]: """Delete a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py index 7747a72fbbfa..da1c54367b79 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py @@ -82,10 +82,12 @@ from ._models_py3 import IntegrationRuntimeCustomSetupScriptProperties from ._models_py3 import IntegrationRuntimeDataFlowProperties from ._models_py3 import IntegrationRuntimeDataProxyProperties +from ._models_py3 import IntegrationRuntimeEnableinteractivequery from ._models_py3 import IntegrationRuntimeListResponse from ._models_py3 import IntegrationRuntimeMonitoringData from ._models_py3 import IntegrationRuntimeNodeIpAddress from ._models_py3 import IntegrationRuntimeNodeMonitoringData +from ._models_py3 import IntegrationRuntimeOperationStatus from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpoint from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails @@ -96,6 +98,7 @@ from ._models_py3 import IntegrationRuntimeSsisProperties from ._models_py3 import IntegrationRuntimeStatus from ._models_py3 import IntegrationRuntimeStatusResponse +from ._models_py3 import IntegrationRuntimeStopOperationStatus from ._models_py3 import IntegrationRuntimeVNetProperties from ._models_py3 import IotHubDataConnection from ._models_py3 import IpFirewallRuleInfo @@ -346,6 +349,7 @@ from ._synapse_management_client_enums import VulnerabilityAssessmentScanState from ._synapse_management_client_enums import VulnerabilityAssessmentScanTriggerType from ._synapse_management_client_enums import WorkspacePublicNetworkAccess +from ._synapse_management_client_enums import WorkspaceStatus from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -427,10 +431,12 @@ "IntegrationRuntimeCustomSetupScriptProperties", "IntegrationRuntimeDataFlowProperties", "IntegrationRuntimeDataProxyProperties", + "IntegrationRuntimeEnableinteractivequery", "IntegrationRuntimeListResponse", "IntegrationRuntimeMonitoringData", "IntegrationRuntimeNodeIpAddress", "IntegrationRuntimeNodeMonitoringData", + "IntegrationRuntimeOperationStatus", "IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint", "IntegrationRuntimeOutboundNetworkDependenciesEndpoint", "IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails", @@ -441,6 +447,7 @@ "IntegrationRuntimeSsisProperties", "IntegrationRuntimeStatus", "IntegrationRuntimeStatusResponse", + "IntegrationRuntimeStopOperationStatus", "IntegrationRuntimeVNetProperties", "IotHubDataConnection", "IpFirewallRuleInfo", @@ -690,6 +697,7 @@ "VulnerabilityAssessmentScanState", "VulnerabilityAssessmentScanTriggerType", "WorkspacePublicNetworkAccess", + "WorkspaceStatus", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py index ae9ddf74f015..d5d582833209 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py @@ -51,7 +51,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -60,7 +60,8 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -86,7 +87,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -163,8 +164,8 @@ def __init__( kusto_pool_resource_id: Optional[str] = None, default_principals_modification_kind: Optional[Union[str, "_models.DefaultPrincipalsModificationKind"]] = None, table_level_sharing_properties: Optional["_models.TableLevelSharingProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -204,7 +205,7 @@ class AttachedDatabaseConfigurationListResult(_serialization.Model): "value": {"key": "value", "type": "[AttachedDatabaseConfiguration]"}, } - def __init__(self, *, value: Optional[List["_models.AttachedDatabaseConfiguration"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AttachedDatabaseConfiguration"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of attached database configurations. :paramtype value: list[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] @@ -228,7 +229,9 @@ class AutoPauseProperties(_serialization.Model): "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, delay_in_minutes: Optional[int] = None, enabled: Optional[bool] = None, **kwargs): + def __init__( + self, *, delay_in_minutes: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword delay_in_minutes: Number of minutes of idle time before the Big Data pool is automatically paused. @@ -264,8 +267,8 @@ def __init__( min_node_count: Optional[int] = None, enabled: Optional[bool] = None, max_node_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword min_node_count: The minimum number of nodes the Big Data pool can support. :paramtype min_node_count: int @@ -314,8 +317,8 @@ def __init__( name: Optional[str] = None, origin: Optional[str] = None, service_specification: Optional["_models.OperationMetaServiceSpecification"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display: Display properties of the operation. :paramtype display: ~azure.mgmt.synapse.models.AvailableRpOperationDisplayInfo @@ -363,8 +366,8 @@ def __init__( resource: Optional[str] = None, provider: Optional[str] = None, operation: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Operation description. :paramtype description: str @@ -421,7 +424,7 @@ class AzureADOnlyAuthentication(ProxyResource): "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, } - def __init__(self, *, azure_ad_only_authentication: Optional[bool] = None, **kwargs): + def __init__(self, *, azure_ad_only_authentication: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword azure_ad_only_authentication: Azure Active Directory only Authentication enabled. :paramtype azure_ad_only_authentication: bool @@ -453,7 +456,7 @@ class AzureADOnlyAuthenticationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -490,8 +493,14 @@ class AzureCapacity(_serialization.Model): } def __init__( - self, *, scale_type: Union[str, "_models.AzureScaleType"], minimum: int, maximum: int, default: int, **kwargs - ): + self, + *, + scale_type: Union[str, "_models.AzureScaleType"], + minimum: int, + maximum: int, + default: int, + **kwargs: Any + ) -> None: """ :keyword scale_type: Scale type. Required. Known values are: "automatic", "manual", and "none". :paramtype scale_type: str or ~azure.mgmt.synapse.models.AzureScaleType @@ -540,7 +549,7 @@ class AzureEntityResource(Resource): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.etag = None @@ -569,8 +578,8 @@ def __init__( resource_type: Optional[str] = None, sku: Optional["_models.AzureSku"] = None, capacity: Optional["_models.AzureCapacity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: Resource Namespace and Type. :paramtype resource_type: str @@ -616,8 +625,8 @@ def __init__( name: Union[str, "_models.SkuName"], size: Union[str, "_models.SkuSize"], capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: SKU name. Required. Known values are: "Compute optimized" and "Storage optimized". @@ -645,7 +654,7 @@ class BigDataPoolPatchInfo(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Updated tags for the Big Data pool. :paramtype tags: dict[str, str] @@ -655,7 +664,8 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -690,7 +700,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -824,8 +834,8 @@ def __init__( # pylint: disable=too-many-locals default_spark_log_folder: Optional[str] = None, node_size: Optional[Union[str, "_models.NodeSize"]] = None, node_size_family: Optional[Union[str, "_models.NodeSizeFamily"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -909,8 +919,8 @@ def __init__( *, next_link: Optional[str] = None, value: Optional[List["_models.BigDataPoolResourceInfo"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: Link to the next page of results. :paramtype next_link: str @@ -936,7 +946,7 @@ class CheckNameAvailabilityRequest(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Workspace name. :paramtype name: str @@ -975,8 +985,8 @@ def __init__( available: Optional[bool] = None, reason: Optional[str] = None, name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword message: Validation message. :paramtype message: str @@ -1023,8 +1033,8 @@ def __init__( name: Optional[str] = None, message: Optional[str] = None, reason: Optional[Union[str, "_models.Reason"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Specifies a Boolean value that indicates if the name is available. :paramtype name_available: bool @@ -1114,8 +1124,8 @@ def __init__( role: Optional[Union[str, "_models.ClusterPrincipalRole"]] = None, tenant_id: Optional[str] = None, principal_type: Optional[Union[str, "_models.PrincipalType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group name. @@ -1166,7 +1176,7 @@ class ClusterPrincipalAssignmentCheckNameRequest(_serialization.Model): type = "Microsoft.Synapse/workspaces/kustoPools/principalAssignments" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Principal Assignment resource name. Required. :paramtype name: str @@ -1186,7 +1196,7 @@ class ClusterPrincipalAssignmentListResult(_serialization.Model): "value": {"key": "value", "type": "[ClusterPrincipalAssignment]"}, } - def __init__(self, *, value: Optional[List["_models.ClusterPrincipalAssignment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ClusterPrincipalAssignment"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto cluster principal assignments. :paramtype value: list[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] @@ -1223,7 +1233,7 @@ class CustomSetupBase(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type: Optional[str] = None @@ -1258,7 +1268,7 @@ class CmdkeySetup(CustomSetupBase): "password": {"key": "typeProperties.password", "type": "SecretBase"}, } - def __init__(self, *, target_name: JSON, user_name: JSON, password: "_models.SecretBase", **kwargs): + def __init__(self, *, target_name: JSON, user_name: JSON, password: "_models.SecretBase", **kwargs: Any) -> None: """ :keyword target_name: The server name of data source access. Required. :paramtype target_name: JSON @@ -1298,7 +1308,9 @@ class ComponentSetup(CustomSetupBase): "license_key": {"key": "typeProperties.licenseKey", "type": "SecretBase"}, } - def __init__(self, *, component_name: str, license_key: Optional["_models.SecretBase"] = None, **kwargs): + def __init__( + self, *, component_name: str, license_key: Optional["_models.SecretBase"] = None, **kwargs: Any + ) -> None: """ :keyword component_name: The name of the 3rd party component. Required. :paramtype component_name: str @@ -1328,7 +1340,7 @@ class CreateSqlPoolRestorePointDefinition(_serialization.Model): "restore_point_label": {"key": "restorePointLabel", "type": "str"}, } - def __init__(self, *, restore_point_label: str, **kwargs): + def __init__(self, *, restore_point_label: str, **kwargs: Any) -> None: """ :keyword restore_point_label: The restore point label to apply. Required. :paramtype restore_point_label: str @@ -1348,7 +1360,7 @@ class CspWorkspaceAdminProperties(_serialization.Model): "initial_workspace_admin_object_id": {"key": "initialWorkspaceAdminObjectId", "type": "str"}, } - def __init__(self, *, initial_workspace_admin_object_id: Optional[str] = None, **kwargs): + def __init__(self, *, initial_workspace_admin_object_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword initial_workspace_admin_object_id: AAD object ID of initial workspace admin. :paramtype initial_workspace_admin_object_id: str @@ -1385,8 +1397,8 @@ def __init__( *, key: Optional["_models.WorkspaceKeyDetails"] = None, kek_identity: Optional["_models.KekIdentityProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key: The key object of the workspace. :paramtype key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails @@ -1446,7 +1458,7 @@ class Database(ProxyResource): _subtype_map = {"kind": {"ReadOnlyFollowing": "ReadOnlyFollowingDatabase", "ReadWrite": "ReadWriteDatabase"}} - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1481,7 +1493,7 @@ class DatabaseCheckNameRequest(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: Union[str, "_models.Type"], **kwargs): + def __init__(self, *, name: str, type: Union[str, "_models.Type"], **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -1507,7 +1519,7 @@ class DatabaseListResult(_serialization.Model): "value": {"key": "value", "type": "[Database]"}, } - def __init__(self, *, value: Optional[List["_models.Database"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Database"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto databases. :paramtype value: list[~azure.mgmt.synapse.models.Database] @@ -1586,8 +1598,8 @@ def __init__( role: Optional[Union[str, "_models.DatabasePrincipalRole"]] = None, tenant_id: Optional[str] = None, principal_type: Optional[Union[str, "_models.PrincipalType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: The principal ID assigned to the database principal. It can be a user email, application ID, or security group name. @@ -1639,7 +1651,7 @@ class DatabasePrincipalAssignmentCheckNameRequest(_serialization.Model): type = "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Principal Assignment resource name. Required. :paramtype name: str @@ -1659,7 +1671,7 @@ class DatabasePrincipalAssignmentListResult(_serialization.Model): "value": {"key": "value", "type": "[DatabasePrincipalAssignment]"}, } - def __init__(self, *, value: Optional[List["_models.DatabasePrincipalAssignment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DatabasePrincipalAssignment"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto database principal assignments. :paramtype value: list[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] @@ -1679,7 +1691,7 @@ class DatabaseStatistics(_serialization.Model): "size": {"key": "size", "type": "float"}, } - def __init__(self, *, size: Optional[float] = None, **kwargs): + def __init__(self, *, size: Optional[float] = None, **kwargs: Any) -> None: """ :keyword size: The database size - the total size of compressed data and index in bytes. :paramtype size: float @@ -1741,7 +1753,7 @@ class DataConnection(ProxyResource): } } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -1779,7 +1791,7 @@ class DataConnectionCheckNameRequest(_serialization.Model): type = "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Data Connection name. Required. :paramtype name: str @@ -1799,7 +1811,7 @@ class DataConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[DataConnection]"}, } - def __init__(self, *, value: Optional[List["_models.DataConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DataConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto data connections. :paramtype value: list[~azure.mgmt.synapse.models.DataConnection] @@ -1827,8 +1839,8 @@ def __init__( *, data_connection_name: Optional[str] = None, properties: Optional["_models.DataConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data_connection_name: The name of the data connection. :paramtype data_connection_name: str @@ -1851,7 +1863,9 @@ class DataConnectionValidationListResult(_serialization.Model): "value": {"key": "value", "type": "[DataConnectionValidationResult]"}, } - def __init__(self, *, value: Optional[List["_models.DataConnectionValidationResult"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.DataConnectionValidationResult"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of Kusto data connection validation errors. :paramtype value: list[~azure.mgmt.synapse.models.DataConnectionValidationResult] @@ -1871,7 +1885,7 @@ class DataConnectionValidationResult(_serialization.Model): "error_message": {"key": "errorMessage", "type": "str"}, } - def __init__(self, *, error_message: Optional[str] = None, **kwargs): + def __init__(self, *, error_message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword error_message: A message which indicates a problem in data connection validation. :paramtype error_message: str @@ -1908,8 +1922,8 @@ def __init__( filesystem: Optional[str] = None, resource_id: Optional[str] = None, create_managed_private_endpoint: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword account_url: Account URL. :paramtype account_url: str @@ -1990,8 +2004,8 @@ def __init__( *, data_masking_state: Optional[Union[str, "_models.DataMaskingState"]] = None, exempt_principals: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data_masking_state: The state of the data masking policy. Known values are: "Disabled" and "Enabled". @@ -2107,8 +2121,8 @@ def __init__( prefix_size: Optional[str] = None, suffix_size: Optional[str] = None, replacement_string: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alias_name: The alias name. This is a legacy parameter and is no longer used. :paramtype alias_name: str @@ -2171,7 +2185,7 @@ class DataMaskingRuleListResult(_serialization.Model): "value": {"key": "value", "type": "[DataMaskingRule]"}, } - def __init__(self, *, value: Optional[List["_models.DataMaskingRule"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DataMaskingRule"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Sql pool data masking rules. :paramtype value: list[~azure.mgmt.synapse.models.DataMaskingRule] @@ -2211,7 +2225,7 @@ class DataWarehouseUserActivities(ProxyResource): "active_queries_count": {"key": "properties.activeQueriesCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.active_queries_count = None @@ -2251,7 +2265,7 @@ class DedicatedSQLminimalTlsSettings(ProxyResource): "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, } - def __init__(self, *, minimal_tls_version: Optional[str] = None, **kwargs): + def __init__(self, *, minimal_tls_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword minimal_tls_version: The minimal tls version of the sql server. :paramtype minimal_tls_version: str @@ -2282,7 +2296,7 @@ class DedicatedSQLminimalTlsSettingsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2300,7 +2314,7 @@ class DedicatedSQLminimalTlsSettingsPatchInfo(_serialization.Model): "minimal_tls_version": {"key": "minimalTlsVersion", "type": "str"}, } - def __init__(self, *, minimal_tls_version: Optional[str] = None, **kwargs): + def __init__(self, *, minimal_tls_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword minimal_tls_version: minimal tls version. :paramtype minimal_tls_version: str @@ -2332,8 +2346,8 @@ def __init__( enabled: Optional[bool] = None, min_executors: Optional[int] = None, max_executors: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Indicates whether Dynamic Executor Allocation is enabled or not. :paramtype enabled: bool @@ -2368,7 +2382,7 @@ class EncryptionDetails(_serialization.Model): "cmk": {"key": "cmk", "type": "CustomerManagedKeyDetails"}, } - def __init__(self, *, cmk: Optional["_models.CustomerManagedKeyDetails"] = None, **kwargs): + def __init__(self, *, cmk: Optional["_models.CustomerManagedKeyDetails"] = None, **kwargs: Any) -> None: """ :keyword cmk: Customer Managed Key Details. :paramtype cmk: ~azure.mgmt.synapse.models.CustomerManagedKeyDetails @@ -2438,8 +2452,8 @@ def __init__( *, server_key_name: Optional[str] = None, server_key_type: Optional[Union[str, "_models.ServerKeyType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword server_key_name: The name of the server key. :paramtype server_key_name: str @@ -2478,7 +2492,7 @@ class EncryptionProtectorListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2505,8 +2519,8 @@ def __init__( *, type: Optional[Union[str, "_models.IntegrationRuntimeEntityReferenceType"]] = None, reference_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of this referenced entity. Known values are: "IntegrationRuntimeReference" and "LinkedServiceReference". @@ -2544,7 +2558,7 @@ class EnvironmentVariableSetup(CustomSetupBase): "variable_value": {"key": "typeProperties.variableValue", "type": "str"}, } - def __init__(self, *, variable_name: str, variable_value: str, **kwargs): + def __init__(self, *, variable_name: str, variable_value: str, **kwargs: Any) -> None: """ :keyword variable_name: The name of the environment variable. Required. :paramtype variable_name: str @@ -2578,7 +2592,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -2618,7 +2632,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -2629,7 +2643,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.synapse.models.ErrorDetail @@ -2639,7 +2654,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.synapse.models.ErrorDetail @@ -2649,7 +2664,8 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): class ErrorResponseAutoGenerated(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -2681,7 +2697,7 @@ class ErrorResponseAutoGenerated(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -2781,8 +2797,8 @@ def __init__( data_format: Optional[Union[str, "_models.EventGridDataFormat"]] = None, ignore_first_record: Optional[bool] = None, blob_storage_event_type: Optional[Union[str, "_models.BlobStorageEventType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -2914,8 +2930,8 @@ def __init__( event_system_properties: Optional[List[str]] = None, compression: Optional[Union[str, "_models.Compression"]] = None, managed_identity_resource_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -3144,8 +3160,8 @@ def __init__( is_azure_monitor_target_enabled: Optional[bool] = None, queue_delay_ms: Optional[int] = None, is_devops_audit_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword predicate_expression: Specifies condition of where clause when creating an audit. :paramtype predicate_expression: str @@ -3320,7 +3336,7 @@ class ExtendedServerBlobAuditingPolicyListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -3497,8 +3513,8 @@ def __init__( is_storage_secondary_key_in_use: Optional[bool] = None, is_azure_monitor_target_enabled: Optional[bool] = None, queue_delay_ms: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword predicate_expression: Specifies condition of where clause when creating an audit. :paramtype predicate_expression: str @@ -3656,7 +3672,7 @@ class ExtendedSqlPoolBlobAuditingPolicyListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -3693,7 +3709,9 @@ class FollowerDatabaseDefinition(_serialization.Model): "database_name": {"key": "databaseName", "type": "str"}, } - def __init__(self, *, kusto_pool_resource_id: str, attached_database_configuration_name: str, **kwargs): + def __init__( + self, *, kusto_pool_resource_id: str, attached_database_configuration_name: str, **kwargs: Any + ) -> None: """ :keyword kusto_pool_resource_id: Resource id of the cluster that follows a database owned by this cluster. Required. @@ -3719,7 +3737,7 @@ class FollowerDatabaseListResult(_serialization.Model): "value": {"key": "value", "type": "[FollowerDatabaseDefinition]"}, } - def __init__(self, *, value: Optional[List["_models.FollowerDatabaseDefinition"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.FollowerDatabaseDefinition"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of follower database result. :paramtype value: list[~azure.mgmt.synapse.models.FollowerDatabaseDefinition] @@ -3774,7 +3792,7 @@ class GeoBackupPolicy(ProxyResource): "storage_type": {"key": "properties.storageType", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.GeoBackupPolicyState"], **kwargs): + def __init__(self, *, state: Union[str, "_models.GeoBackupPolicyState"], **kwargs: Any) -> None: """ :keyword state: The state of the geo backup policy. Required. Known values are: "Disabled" and "Enabled". @@ -3798,7 +3816,7 @@ class GeoBackupPolicyListResult(_serialization.Model): "value": {"key": "value", "type": "[GeoBackupPolicy]"}, } - def __init__(self, *, value: Optional[List["_models.GeoBackupPolicy"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GeoBackupPolicy"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of geo backup policies. :paramtype value: list[~azure.mgmt.synapse.models.GeoBackupPolicy] @@ -3818,7 +3836,7 @@ class GetSsisObjectMetadataRequest(_serialization.Model): "metadata_path": {"key": "metadataPath", "type": "str"}, } - def __init__(self, *, metadata_path: Optional[str] = None, **kwargs): + def __init__(self, *, metadata_path: Optional[str] = None, **kwargs: Any) -> None: """ :keyword metadata_path: Metadata path. :paramtype metadata_path: str @@ -3858,8 +3876,12 @@ class IntegrationRuntime(_serialization.Model): _subtype_map = {"type": {"Managed": "ManagedIntegrationRuntime", "SelfHosted": "SelfHostedIntegrationRuntime"}} def __init__( - self, *, additional_properties: Optional[Dict[str, JSON]] = None, description: Optional[str] = None, **kwargs - ): + self, + *, + additional_properties: Optional[Dict[str, JSON]] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -3887,7 +3909,7 @@ class IntegrationRuntimeAuthKeys(_serialization.Model): "auth_key2": {"key": "authKey2", "type": "str"}, } - def __init__(self, *, auth_key1: Optional[str] = None, auth_key2: Optional[str] = None, **kwargs): + def __init__(self, *, auth_key1: Optional[str] = None, auth_key2: Optional[str] = None, **kwargs: Any) -> None: """ :keyword auth_key1: The primary integration runtime authentication key. :paramtype auth_key1: str @@ -3947,8 +3969,8 @@ def __init__( max_parallel_executions_per_node: Optional[int] = None, data_flow_properties: Optional["_models.IntegrationRuntimeDataFlowProperties"] = None, v_net_properties: Optional["_models.IntegrationRuntimeVNetProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4024,7 +4046,7 @@ class IntegrationRuntimeConnectionInfo(_serialization.Model): "is_identity_cert_exprired": {"key": "isIdentityCertExprired", "type": "bool"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4056,8 +4078,12 @@ class IntegrationRuntimeCustomSetupScriptProperties(_serialization.Model): } def __init__( - self, *, blob_container_uri: Optional[str] = None, sas_token: Optional["_models.SecureString"] = None, **kwargs - ): + self, + *, + blob_container_uri: Optional[str] = None, + sas_token: Optional["_models.SecureString"] = None, + **kwargs: Any + ) -> None: """ :keyword blob_container_uri: The URI of the Azure blob container that contains the custom setup script. @@ -4110,8 +4136,8 @@ def __init__( core_count: Optional[int] = None, time_to_live: Optional[int] = None, cleanup: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4160,8 +4186,8 @@ def __init__( connect_via: Optional["_models.EntityReference"] = None, staging_linked_service: Optional["_models.EntityReference"] = None, path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connect_via: The self-hosted integration runtime reference. :paramtype connect_via: ~azure.mgmt.synapse.models.EntityReference @@ -4176,6 +4202,54 @@ def __init__( self.path = path +class IntegrationRuntimeEnableinteractivequery(_serialization.Model): + """Integration Runtime Operation Status Properties. + + :ivar status: EnableInteractivequery status of Integrationruntimes. Known values are: + "InProgress", "Succeeded", and "Failed". + :vartype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :ivar name: The operation name. + :vartype name: str + :ivar properties: The operation properties. + :vartype properties: JSON + :ivar error: The operation error message. + :vartype error: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + "error": {"key": "error", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.WorkspaceStatus"]] = None, + name: Optional[str] = None, + properties: Optional[JSON] = None, + error: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: EnableInteractivequery status of Integrationruntimes. Known values are: + "InProgress", "Succeeded", and "Failed". + :paramtype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :keyword name: The operation name. + :paramtype name: str + :keyword properties: The operation properties. + :paramtype properties: JSON + :keyword error: The operation error message. + :paramtype error: str + """ + super().__init__(**kwargs) + self.status = status + self.name = name + self.properties = properties + self.error = error + + class IntegrationRuntimeListResponse(_serialization.Model): """A list of integration runtime resources. @@ -4196,7 +4270,9 @@ class IntegrationRuntimeListResponse(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IntegrationRuntimeResource"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.IntegrationRuntimeResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of integration runtimes. Required. :paramtype value: list[~azure.mgmt.synapse.models.IntegrationRuntimeResource] @@ -4227,8 +4303,8 @@ def __init__( *, name: Optional[str] = None, nodes: Optional[List["_models.IntegrationRuntimeNodeMonitoringData"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Integration runtime name. :paramtype name: str @@ -4257,7 +4333,7 @@ class IntegrationRuntimeNodeIpAddress(_serialization.Model): "ip_address": {"key": "ipAddress", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.ip_address = None @@ -4313,7 +4389,7 @@ class IntegrationRuntimeNodeMonitoringData(_serialization.Model): "received_bytes": {"key": "receivedBytes", "type": "float"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4331,6 +4407,54 @@ def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, * self.received_bytes = None +class IntegrationRuntimeOperationStatus(_serialization.Model): + """Integration Runtime Operation Status Properties. + + :ivar status: status of Start Integrationruntimes. Known values are: "InProgress", "Succeeded", + and "Failed". + :vartype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :ivar name: The operation name. + :vartype name: str + :ivar properties: The operation properties. + :vartype properties: JSON + :ivar error: The operation error message. + :vartype error: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + "error": {"key": "error", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.WorkspaceStatus"]] = None, + name: Optional[str] = None, + properties: Optional[JSON] = None, + error: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: status of Start Integrationruntimes. Known values are: "InProgress", + "Succeeded", and "Failed". + :paramtype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :keyword name: The operation name. + :paramtype name: str + :keyword properties: The operation properties. + :paramtype properties: JSON + :keyword error: The operation error message. + :paramtype error: str + """ + super().__init__(**kwargs) + self.status = status + self.name = name + self.properties = properties + self.error = error + + class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(_serialization.Model): """Azure-SSIS integration runtime outbound network dependency endpoints for one category. @@ -4351,8 +4475,8 @@ def __init__( *, category: Optional[str] = None, endpoints: Optional[List["_models.IntegrationRuntimeOutboundNetworkDependenciesEndpoint"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword category: The category of outbound network dependency. :paramtype category: str @@ -4388,8 +4512,8 @@ def __init__( *, domain_name: Optional[str] = None, endpoint_details: Optional[List["_models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain_name: The domain name of endpoint. :paramtype domain_name: str @@ -4413,7 +4537,7 @@ class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(_serializatio "port": {"key": "port", "type": "int"}, } - def __init__(self, *, port: Optional[int] = None, **kwargs): + def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: """ :keyword port: The port of endpoint. :paramtype port: int @@ -4438,8 +4562,8 @@ def __init__( self, *, value: Optional[List["_models.IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The list of outbound network dependency endpoints. :paramtype value: @@ -4461,7 +4585,9 @@ class IntegrationRuntimeRegenerateKeyParameters(_serialization.Model): "key_name": {"key": "keyName", "type": "str"}, } - def __init__(self, *, key_name: Optional[Union[str, "_models.IntegrationRuntimeAuthKeyName"]] = None, **kwargs): + def __init__( + self, *, key_name: Optional[Union[str, "_models.IntegrationRuntimeAuthKeyName"]] = None, **kwargs: Any + ) -> None: """ :keyword key_name: The name of the authentication key to regenerate. Known values are: "authKey1" and "authKey2". @@ -4502,7 +4628,7 @@ class SubResource(AzureEntityResource): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -4548,7 +4674,7 @@ class IntegrationRuntimeResource(SubResource): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: Integration runtime description. :paramtype description: str @@ -4598,8 +4724,8 @@ def __init__( catalog_admin_user_name: Optional[str] = None, catalog_admin_password: Optional["_models.SecureString"] = None, catalog_pricing_tier: Optional[Union[str, "_models.IntegrationRuntimeSsisCatalogPricingTier"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4674,8 +4800,8 @@ def __init__( data_proxy_properties: Optional["_models.IntegrationRuntimeDataProxyProperties"] = None, edition: Optional[Union[str, "_models.IntegrationRuntimeEdition"]] = None, express_custom_setup_properties: Optional[List["_models.CustomSetupBase"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4751,7 +4877,7 @@ class IntegrationRuntimeStatus(_serialization.Model): "type": {"Managed": "ManagedIntegrationRuntimeStatus", "SelfHosted": "SelfHostedIntegrationRuntimeStatus"} } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4798,7 +4924,7 @@ class IntegrationRuntimeStatusResponse(_serialization.Model): "state": {"key": "properties.state", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -4807,6 +4933,54 @@ def __init__(self, **kwargs): self.state = None +class IntegrationRuntimeStopOperationStatus(_serialization.Model): + """Integration Runtime Operation Status Properties. + + :ivar status: status of Start Integrationruntimes. Known values are: "InProgress", "Succeeded", + and "Failed". + :vartype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :ivar name: The operation name. + :vartype name: str + :ivar properties: The operation properties. + :vartype properties: JSON + :ivar error: The operation error message. + :vartype error: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + "error": {"key": "error", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.WorkspaceStatus"]] = None, + name: Optional[str] = None, + properties: Optional[JSON] = None, + error: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: status of Start Integrationruntimes. Known values are: "InProgress", + "Succeeded", and "Failed". + :paramtype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :keyword name: The operation name. + :paramtype name: str + :keyword properties: The operation properties. + :paramtype properties: JSON + :keyword error: The operation error message. + :paramtype error: str + """ + super().__init__(**kwargs) + self.status = status + self.name = name + self.properties = properties + self.error = error + + class IntegrationRuntimeVNetProperties(_serialization.Model): """VNet properties for managed integration runtime. @@ -4840,8 +5014,8 @@ def __init__( subnet: Optional[str] = None, public_i_ps: Optional[List[str]] = None, subnet_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -4949,8 +5123,8 @@ def __init__( data_format: Optional[Union[str, "_models.IotHubDataFormat"]] = None, event_system_properties: Optional[List[str]] = None, shared_access_policy_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -5025,7 +5199,9 @@ class IpFirewallRuleInfo(ProxyResource): "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, } - def __init__(self, *, end_ip_address: Optional[str] = None, start_ip_address: Optional[str] = None, **kwargs): + def __init__( + self, *, end_ip_address: Optional[str] = None, start_ip_address: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. @@ -5054,8 +5230,12 @@ class IpFirewallRuleInfoListResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.IpFirewallRuleInfo"]] = None, **kwargs - ): + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.IpFirewallRuleInfo"]] = None, + **kwargs: Any + ) -> None: """ :keyword next_link: Link to next page of results. :paramtype next_link: str @@ -5092,7 +5272,9 @@ class IpFirewallRuleProperties(_serialization.Model): "start_ip_address": {"key": "startIpAddress", "type": "str"}, } - def __init__(self, *, end_ip_address: Optional[str] = None, start_ip_address: Optional[str] = None, **kwargs): + def __init__( + self, *, end_ip_address: Optional[str] = None, start_ip_address: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. @@ -5126,8 +5308,8 @@ def __init__( *, user_assigned_identity: Optional[str] = None, use_system_assigned_identity: Optional[Any] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_assigned_identity: User assigned identity resource Id. :paramtype user_assigned_identity: str @@ -5173,7 +5355,9 @@ class Key(ProxyResource): "key_vault_url": {"key": "properties.keyVaultUrl", "type": "str"}, } - def __init__(self, *, is_active_cmk: Optional[bool] = None, key_vault_url: Optional[str] = None, **kwargs): + def __init__( + self, *, is_active_cmk: Optional[bool] = None, key_vault_url: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword is_active_cmk: Used to activate the workspace after a customer managed key is provided. @@ -5200,7 +5384,9 @@ class KeyInfoListResult(_serialization.Model): "value": {"key": "value", "type": "[Key]"}, } - def __init__(self, *, next_link: Optional[str] = None, value: Optional[List["_models.Key"]] = None, **kwargs): + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Key"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Link to the next page of results. :paramtype next_link: str @@ -5310,8 +5496,8 @@ def __init__( enable_streaming_ingest: bool = False, enable_purge: bool = False, workspace_uid: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -5371,7 +5557,7 @@ class KustoPoolCheckNameRequest(_serialization.Model): type = "Microsoft.Synapse/workspaces/kustoPools" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Kusto Pool name. Required. :paramtype name: str @@ -5391,7 +5577,7 @@ class KustoPoolListResult(_serialization.Model): "value": {"key": "value", "type": "[KustoPool]"}, } - def __init__(self, *, value: Optional[List["_models.KustoPool"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.KustoPool"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto pools. :paramtype value: list[~azure.mgmt.synapse.models.KustoPool] @@ -5449,7 +5635,7 @@ class KustoPoolPrivateLinkResources(ProxyResource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.system_data = None @@ -5540,8 +5726,8 @@ def __init__( enable_streaming_ingest: bool = False, enable_purge: bool = False, workspace_uid: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -5584,8 +5770,8 @@ class LanguageExtension(_serialization.Model): } def __init__( - self, *, language_extension_name: Optional[Union[str, "_models.LanguageExtensionName"]] = None, **kwargs - ): + self, *, language_extension_name: Optional[Union[str, "_models.LanguageExtensionName"]] = None, **kwargs: Any + ) -> None: """ :keyword language_extension_name: The language extension name. Known values are: "PYTHON" and "R". @@ -5606,7 +5792,7 @@ class LanguageExtensionsList(_serialization.Model): "value": {"key": "value", "type": "[LanguageExtension]"}, } - def __init__(self, *, value: Optional[List["_models.LanguageExtension"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.LanguageExtension"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of language extensions. :paramtype value: list[~azure.mgmt.synapse.models.LanguageExtension] @@ -5659,8 +5845,8 @@ def __init__( container_name: Optional[str] = None, uploaded_timestamp: Optional[datetime.datetime] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the library. :paramtype name: str @@ -5703,7 +5889,9 @@ class LibraryListResponse(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.LibraryResource"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.LibraryResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Library. Required. :paramtype value: list[~azure.mgmt.synapse.models.LibraryResource] @@ -5738,7 +5926,7 @@ class LibraryRequirements(_serialization.Model): "filename": {"key": "filename", "type": "str"}, } - def __init__(self, *, content: Optional[str] = None, filename: Optional[str] = None, **kwargs): + def __init__(self, *, content: Optional[str] = None, filename: Optional[str] = None, **kwargs: Any) -> None: """ :keyword content: The library requirements. :paramtype content: str @@ -5813,8 +6001,8 @@ def __init__( container_name: Optional[str] = None, uploaded_timestamp: Optional[datetime.datetime] = None, type_properties_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_properties_name: Name of the library. :paramtype name_properties_name: str @@ -5872,7 +6060,7 @@ class LinkedIntegrationRuntime(_serialization.Model): "create_time": {"key": "createTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -5909,7 +6097,7 @@ class LinkedIntegrationRuntimeType(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.authorization_type: Optional[str] = None @@ -5936,7 +6124,7 @@ class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): "key": {"key": "key", "type": "SecureString"}, } - def __init__(self, *, key: "_models.SecureString", **kwargs): + def __init__(self, *, key: "_models.SecureString", **kwargs: Any) -> None: """ :keyword key: The key used for authorization. Required. :paramtype key: ~azure.mgmt.synapse.models.SecureString @@ -5967,7 +6155,7 @@ class LinkedIntegrationRuntimeRbacAuthorization(LinkedIntegrationRuntimeType): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, *, resource_id: str, **kwargs): + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: """ :keyword resource_id: The resource identifier of the integration runtime to be shared. Required. @@ -5989,7 +6177,7 @@ class ListResourceSkusResult(_serialization.Model): "value": {"key": "value", "type": "[AzureResourceSku]"}, } - def __init__(self, *, value: Optional[List["_models.AzureResourceSku"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AzureResourceSku"]] = None, **kwargs: Any) -> None: """ :keyword value: The collection of available SKUs for an existing resource. :paramtype value: list[~azure.mgmt.synapse.models.AzureResourceSku] @@ -6019,7 +6207,7 @@ class ListSqlPoolSecurityAlertPolicies(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -6092,8 +6280,8 @@ def __init__( min_cycles: Optional[int] = None, time_granularity_in_minutes: Optional[int] = None, allow_multiple_maintenance_windows_per_cycle: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Whether maintenance windows are enabled for the database. :paramtype is_enabled: bool @@ -6153,7 +6341,9 @@ class MaintenanceWindows(ProxyResource): "time_ranges": {"key": "properties.timeRanges", "type": "[MaintenanceWindowTimeRange]"}, } - def __init__(self, *, time_ranges: Optional[List["_models.MaintenanceWindowTimeRange"]] = None, **kwargs): + def __init__( + self, *, time_ranges: Optional[List["_models.MaintenanceWindowTimeRange"]] = None, **kwargs: Any + ) -> None: """ :keyword time_ranges: :paramtype time_ranges: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] @@ -6186,8 +6376,8 @@ def __init__( day_of_week: Optional[Union[str, "_models.DayOfWeek"]] = None, start_time: Optional[str] = None, duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword day_of_week: Day of maintenance window. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and "Saturday". @@ -6237,8 +6427,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of managed identity for the workspace. Known values are: "None", "SystemAssigned", and "SystemAssigned,UserAssigned". @@ -6294,8 +6484,8 @@ def __init__( grant_sql_control_to_managed_identity: Optional[ "_models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword grant_sql_control_to_managed_identity: Grant sql control to managed identity. :paramtype grant_sql_control_to_managed_identity: @@ -6326,7 +6516,7 @@ class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedId "actual_state": {"key": "actualState", "type": "str"}, } - def __init__(self, *, desired_state: Optional[Union[str, "_models.DesiredState"]] = None, **kwargs): + def __init__(self, *, desired_state: Optional[Union[str, "_models.DesiredState"]] = None, **kwargs: Any) -> None: """ :keyword desired_state: Desired state. Known values are: "Enabled" and "Disabled". :paramtype desired_state: str or ~azure.mgmt.synapse.models.DesiredState @@ -6337,7 +6527,8 @@ def __init__(self, *, desired_state: Optional[Union[str, "_models.DesiredState"] class ManagedIntegrationRuntime(IntegrationRuntime): - """Managed integration runtime, including managed elastic and managed dedicated integration runtimes. + """Managed integration runtime, including managed elastic and managed dedicated integration + runtimes. Variables are only populated by the server, and will be ignored when sending a request. @@ -6397,8 +6588,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin compute_properties: Optional["_models.IntegrationRuntimeComputeProperties"] = None, ssis_properties: Optional["_models.IntegrationRuntimeSsisProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -6459,7 +6650,7 @@ class ManagedIntegrationRuntimeError(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -6507,8 +6698,8 @@ def __init__( *, additional_properties: Optional[Dict[str, JSON]] = None, errors: Optional[List["_models.ManagedIntegrationRuntimeError"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -6564,7 +6755,7 @@ class ManagedIntegrationRuntimeOperationResult(_serialization.Model): "activity_id": {"key": "activityId", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -6630,7 +6821,7 @@ class ManagedIntegrationRuntimeStatus(IntegrationRuntimeStatus): "last_operation": {"key": "typeProperties.lastOperation", "type": "ManagedIntegrationRuntimeOperationResult"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -6667,8 +6858,8 @@ def __init__( prevent_data_exfiltration: Optional[bool] = None, linked_access_check_on_target_resource: Optional[bool] = None, allowed_aad_tenant_ids_for_linking: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword prevent_data_exfiltration: Prevent Data Exfiltration. :paramtype prevent_data_exfiltration: bool @@ -6716,7 +6907,9 @@ class MetadataSyncConfig(ProxyResource): "sync_interval_in_minutes": {"key": "properties.syncIntervalInMinutes", "type": "int"}, } - def __init__(self, *, enabled: Optional[bool] = None, sync_interval_in_minutes: Optional[int] = None, **kwargs): + def __init__( + self, *, enabled: Optional[bool] = None, sync_interval_in_minutes: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword enabled: Indicates whether the metadata sync is enabled or disabled. :paramtype enabled: bool @@ -6755,8 +6948,8 @@ def __init__( display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: This is of the format {provider}/{resource}/{operation}. :paramtype name: str @@ -6801,8 +6994,8 @@ def __init__( operation: Optional[str] = None, resource: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -6821,7 +7014,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + """Result of the request to list REST API operations. It contains a list of operations and a URL + nextLink to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -6840,7 +7034,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.synapse.models.Operation] @@ -6873,8 +7067,8 @@ def __init__( display_name: Optional[str] = None, blob_duration: Optional[str] = None, name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: Log display name. :paramtype display_name: str @@ -6912,8 +7106,8 @@ def __init__( display_name: Optional[str] = None, name: Optional[str] = None, to_be_exported_for_shoebox: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: Dimension display name. :paramtype display_name: str @@ -6984,8 +7178,8 @@ def __init__( dimensions: Optional[List["_models.OperationMetaMetricDimensionSpecification"]] = None, supports_instance_level_aggregation: Optional[bool] = None, metric_filter_pattern: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_mdm_namespace: The source MDM namespace. :paramtype source_mdm_namespace: str @@ -7046,8 +7240,8 @@ def __init__( *, metric_specifications: Optional[List["_models.OperationMetaMetricSpecification"]] = None, log_specifications: Optional[List["_models.OperationMetaLogSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric_specifications: Service metric specifications. :paramtype metric_specifications: @@ -7104,8 +7298,8 @@ def __init__( start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, percent_complete: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Operation ID. :paramtype id: str @@ -7166,7 +7360,7 @@ class OptimizedAutoscale(_serialization.Model): "maximum": {"key": "maximum", "type": "int"}, } - def __init__(self, *, version: int, is_enabled: bool, minimum: int, maximum: int, **kwargs): + def __init__(self, *, version: int, is_enabled: bool, minimum: int, maximum: int, **kwargs: Any) -> None: """ :keyword version: The version of the template defined, for instance 1. Required. :paramtype version: int @@ -7202,7 +7396,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -7255,8 +7449,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint which the connection belongs to. :paramtype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint @@ -7290,8 +7484,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: :paramtype id: str @@ -7330,8 +7524,8 @@ def __init__( properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, name: Optional[str] = None, type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: :paramtype id: str @@ -7384,8 +7578,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint which the connection belongs to. :paramtype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint @@ -7420,8 +7614,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnectionForPrivateLinkHub"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHub] @@ -7454,7 +7648,7 @@ class PrivateEndpointConnectionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -7494,8 +7688,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The private endpoint which the connection belongs to. :paramtype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint @@ -7563,8 +7757,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, provisioning_state: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -7593,8 +7787,8 @@ class PrivateLinkHubInfoListResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.PrivateLinkHub"]] = None, **kwargs - ): + self, *, next_link: Optional[str] = None, value: Optional[List["_models.PrivateLinkHub"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Link to the next page of results. :paramtype next_link: str @@ -7617,7 +7811,7 @@ class PrivateLinkHubPatchInfo(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -7657,7 +7851,7 @@ class PrivateLinkResource(ProxyResource): "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.properties = None @@ -7684,7 +7878,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -7716,7 +7910,7 @@ class PrivateLinkResourceProperties(_serialization.Model): "required_zone_names": {"key": "requiredZoneNames", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.group_id = None @@ -7735,7 +7929,7 @@ class PrivateLinkResources(_serialization.Model): "value": {"key": "value", "type": "[KustoPoolPrivateLinkResources]"}, } - def __init__(self, *, value: Optional[List["_models.KustoPoolPrivateLinkResources"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.KustoPoolPrivateLinkResources"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Kusto Private Link Resources. :paramtype value: list[~azure.mgmt.synapse.models.KustoPoolPrivateLinkResources] @@ -7767,7 +7961,7 @@ class PrivateLinkServiceConnectionState(_serialization.Model): "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword status: The private link service connection status. :paramtype status: str @@ -7791,7 +7985,7 @@ class PurviewConfiguration(_serialization.Model): "purview_resource_id": {"key": "purviewResourceId", "type": "str"}, } - def __init__(self, *, purview_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, purview_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword purview_resource_id: Purview Resource ID. :paramtype purview_resource_id: str @@ -7825,7 +8019,7 @@ class QueryInterval(_serialization.Model): "metrics": {"key": "metrics", "type": "[QueryMetric]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.interval_start_time = None @@ -7862,7 +8056,7 @@ class QueryMetric(_serialization.Model): "value": {"key": "value", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -7892,7 +8086,7 @@ class QueryStatistic(_serialization.Model): "intervals": {"key": "intervals", "type": "[QueryInterval]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.query_id = None @@ -7974,8 +8168,8 @@ class ReadOnlyFollowingDatabase(Database): # pylint: disable=too-many-instance- } def __init__( - self, *, location: Optional[str] = None, hot_cache_period: Optional[datetime.timedelta] = None, **kwargs - ): + self, *, location: Optional[str] = None, hot_cache_period: Optional[datetime.timedelta] = None, **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -8062,8 +8256,8 @@ def __init__( location: Optional[str] = None, soft_delete_period: Optional[datetime.timedelta] = None, hot_cache_period: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. :paramtype location: str @@ -8129,8 +8323,8 @@ def __init__( schema: Optional[str] = None, table: Optional[str] = None, column: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword op: Known values are: "enable" and "disable". :paramtype op: str or ~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdateKind @@ -8159,7 +8353,9 @@ class RecommendedSensitivityLabelUpdateList(_serialization.Model): "operations": {"key": "operations", "type": "[RecommendedSensitivityLabelUpdate]"}, } - def __init__(self, *, operations: Optional[List["_models.RecommendedSensitivityLabelUpdate"]] = None, **kwargs): + def __init__( + self, *, operations: Optional[List["_models.RecommendedSensitivityLabelUpdate"]] = None, **kwargs: Any + ) -> None: """ :keyword operations: :paramtype operations: list[~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdate] @@ -8212,7 +8408,7 @@ class RecoverableSqlPool(ProxyResource): "last_available_backup_date": {"key": "properties.lastAvailableBackupDate", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.edition = None @@ -8242,7 +8438,7 @@ class RecoverableSqlPoolListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -8260,7 +8456,7 @@ class ReplaceAllFirewallRulesOperationResponse(_serialization.Model): "operation_id": {"key": "operationId", "type": "str"}, } - def __init__(self, *, operation_id: Optional[str] = None, **kwargs): + def __init__(self, *, operation_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword operation_id: The operation ID. :paramtype operation_id: str @@ -8280,7 +8476,9 @@ class ReplaceAllIpFirewallRulesRequest(_serialization.Model): "ip_firewall_rules": {"key": "ipFirewallRules", "type": "{IpFirewallRuleProperties}"}, } - def __init__(self, *, ip_firewall_rules: Optional[Dict[str, "_models.IpFirewallRuleProperties"]] = None, **kwargs): + def __init__( + self, *, ip_firewall_rules: Optional[Dict[str, "_models.IpFirewallRuleProperties"]] = None, **kwargs: Any + ) -> None: """ :keyword ip_firewall_rules: IP firewall rule properties. :paramtype ip_firewall_rules: dict[str, ~azure.mgmt.synapse.models.IpFirewallRuleProperties] @@ -8364,7 +8562,7 @@ class ReplicationLink(ProxyResource): # pylint: disable=too-many-instance-attri "replication_state": {"key": "properties.replicationState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -8400,7 +8598,7 @@ class ReplicationLinkListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ReplicationLink"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ReplicationLink"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Sql pool replication links housed in the Sql pool. :paramtype value: list[~azure.mgmt.synapse.models.ReplicationLink] @@ -8427,7 +8625,7 @@ class ResourceMoveDefinition(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The target ID for the resource. Required. :paramtype id: str @@ -8499,7 +8697,7 @@ class RestorableDroppedSqlPool(ProxyResource): # pylint: disable=too-many-insta "earliest_restore_date": {"key": "properties.earliestRestoreDate", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -8530,7 +8728,7 @@ class RestorableDroppedSqlPoolListResult(_serialization.Model): "value": {"key": "value", "type": "[RestorableDroppedSqlPool]"}, } - def __init__(self, *, value: List["_models.RestorableDroppedSqlPool"], **kwargs): + def __init__(self, *, value: List["_models.RestorableDroppedSqlPool"], **kwargs: Any) -> None: """ :keyword value: A list of restorable dropped Sql pools. Required. :paramtype value: list[~azure.mgmt.synapse.models.RestorableDroppedSqlPool] @@ -8587,7 +8785,7 @@ class RestorePoint(ProxyResource): "restore_point_label": {"key": "properties.restorePointLabel", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -8618,7 +8816,7 @@ class RestorePointListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -8647,14 +8845,15 @@ class SecretBase(_serialization.Model): _subtype_map = {"type": {"SecureString": "SecureString"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type: Optional[str] = None class SecureString(SecretBase): - """Azure Synapse secure string definition. The string value will be masked with asterisks '*' during Get or List API calls. + """Azure Synapse secure string definition. The string value will be masked with asterisks '*' + during Get or List API calls. All required parameters must be populated in order to send to Azure. @@ -8674,7 +8873,7 @@ class SecureString(SecretBase): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: str, **kwargs): + def __init__(self, *, value: str, **kwargs: Any) -> None: """ :keyword value: Value of secure string. Required. :paramtype value: str @@ -8718,8 +8917,8 @@ def __init__( additional_properties: Optional[Dict[str, JSON]] = None, description: Optional[str] = None, linked_info: Optional["_models.LinkedIntegrationRuntimeType"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -8828,7 +9027,7 @@ class SelfHostedIntegrationRuntimeNode(_serialization.Model): # pylint: disable "max_concurrent_jobs": {"key": "maxConcurrentJobs", "type": "int"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -8982,8 +9181,8 @@ def __init__( links: Optional[List["_models.LinkedIntegrationRuntime"]] = None, service_region: Optional[str] = None, newer_versions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -9093,8 +9292,8 @@ def __init__( information_type: Optional[str] = None, information_type_id: Optional[str] = None, rank: Optional[Union[str, "_models.SensitivityLabelRank"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword label_name: The label name. :paramtype label_name: str @@ -9141,7 +9340,7 @@ class SensitivityLabelListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -9198,8 +9397,8 @@ def __init__( table: Optional[str] = None, column: Optional[str] = None, sensitivity_label: Optional["_models.SensitivityLabel"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword op: Known values are: "set" and "remove". :paramtype op: str or ~azure.mgmt.synapse.models.SensitivityLabelUpdateKind @@ -9231,7 +9430,7 @@ class SensitivityLabelUpdateList(_serialization.Model): "operations": {"key": "operations", "type": "[SensitivityLabelUpdate]"}, } - def __init__(self, *, operations: Optional[List["_models.SensitivityLabelUpdate"]] = None, **kwargs): + def __init__(self, *, operations: Optional[List["_models.SensitivityLabelUpdate"]] = None, **kwargs: Any) -> None: """ :keyword operations: :paramtype operations: list[~azure.mgmt.synapse.models.SensitivityLabelUpdate] @@ -9424,8 +9623,8 @@ def __init__( is_azure_monitor_target_enabled: Optional[bool] = None, queue_delay_ms: Optional[int] = None, is_devops_audit_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled". @@ -9597,7 +9796,7 @@ class ServerBlobAuditingPolicyListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -9672,8 +9871,8 @@ def __init__( storage_endpoint: Optional[str] = None, storage_account_access_key: Optional[str] = None, retention_days: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific server. Known values are: "New", "Enabled", and @@ -9729,7 +9928,7 @@ class ServerSecurityAlertPolicyListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -9777,7 +9976,7 @@ class ServerUsage(_serialization.Model): "next_reset_time": {"key": "nextResetTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -9812,7 +10011,7 @@ class ServerUsageListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ServerUsage"], **kwargs): + def __init__(self, *, value: List["_models.ServerUsage"], **kwargs: Any) -> None: """ :keyword value: The list of server metrics for the server. Required. :paramtype value: list[~azure.mgmt.synapse.models.ServerUsage] @@ -9877,8 +10076,8 @@ def __init__( storage_container_sas_key: Optional[str] = None, storage_account_access_key: Optional[str] = None, recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword storage_container_path: A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). @@ -9923,7 +10122,7 @@ class ServerVulnerabilityAssessmentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -9949,8 +10148,8 @@ class Sku(_serialization.Model): } def __init__( - self, *, tier: Optional[str] = None, name: Optional[str] = None, capacity: Optional[int] = None, **kwargs - ): + self, *, tier: Optional[str] = None, name: Optional[str] = None, capacity: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword tier: The service tier. :paramtype tier: str @@ -10003,7 +10202,7 @@ class SkuDescription(_serialization.Model): "restrictions": {"key": "restrictions", "type": "[object]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_type = None @@ -10031,7 +10230,7 @@ class SkuDescriptionList(_serialization.Model): "value": {"key": "value", "type": "[SkuDescription]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10057,7 +10256,7 @@ class SkuLocationInfoItem(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, location: str, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, location: str, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword location: The available location of the SKU. Required. :paramtype location: str @@ -10102,8 +10301,8 @@ def __init__( content: Optional[str] = None, filename: Optional[str] = None, configuration_type: Optional[Union[str, "_models.ConfigurationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword content: The spark config properties. :paramtype content: str @@ -10140,7 +10339,9 @@ class SparkConfigurationListResponse(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SparkConfigurationResource"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.SparkConfigurationResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of SparkConfiguration. Required. :paramtype value: list[~azure.mgmt.synapse.models.SparkConfigurationResource] @@ -10217,8 +10418,8 @@ def __init__( created_by: Optional[str] = None, created: Optional[datetime.datetime] = None, config_merge_rule: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Description about the SparkConfiguration. :paramtype description: str @@ -10349,8 +10550,8 @@ def __init__( create_mode: Optional[Union[str, "_models.CreateMode"]] = None, storage_account_type: Union[str, "_models.StorageAccountType"] = "GRS", source_database_deletion_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -10560,8 +10761,8 @@ def __init__( storage_account_subscription_id: Optional[str] = None, is_storage_secondary_key_in_use: Optional[bool] = None, is_azure_monitor_target_enabled: bool = False, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled". @@ -10701,7 +10902,7 @@ class SqlPoolBlobAuditingPolicyListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10729,7 +10930,7 @@ class SqlPoolBlobAuditingPolicySqlPoolOperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10774,7 +10975,7 @@ class SqlPoolColumn(ProxyResource): "is_computed": {"key": "properties.isComputed", "type": "bool"}, } - def __init__(self, *, column_type: Optional[Union[str, "_models.ColumnDataType"]] = None, **kwargs): + def __init__(self, *, column_type: Optional[Union[str, "_models.ColumnDataType"]] = None, **kwargs: Any) -> None: """ :keyword column_type: The column data type. Known values are: "image", "text", "uniqueidentifier", "date", "time", "datetime2", "datetimeoffset", "tinyint", "smallint", @@ -10810,7 +11011,7 @@ class SqlPoolColumnListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -10883,8 +11084,8 @@ def __init__( use_server_default: Optional[str] = None, redirection_state: Optional[str] = None, state: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword security_enabled_access: The state of security access. :paramtype security_enabled_access: str @@ -10927,7 +11128,9 @@ class SqlPoolInfoListResult(_serialization.Model): "value": {"key": "value", "type": "[SqlPool]"}, } - def __init__(self, *, next_link: Optional[str] = None, value: Optional[List["_models.SqlPool"]] = None, **kwargs): + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.SqlPool"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Link to the next page of results. :paramtype next_link: str @@ -11023,7 +11226,7 @@ class SqlPoolOperation(ProxyResource): # pylint: disable=too-many-instance-attr "is_cancellable": {"key": "properties.isCancellable", "type": "bool"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.database_name = None @@ -11129,8 +11332,8 @@ def __init__( create_mode: Optional[Union[str, "_models.CreateMode"]] = None, storage_account_type: Union[str, "_models.StorageAccountType"] = "GRS", source_database_deletion_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -11216,7 +11419,7 @@ class SqlPoolSchema(ProxyResource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -11242,7 +11445,7 @@ class SqlPoolSchemaListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11317,8 +11520,8 @@ def __init__( storage_endpoint: Optional[str] = None, storage_account_access_key: Optional[str] = None, retention_days: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific Sql pool. Known values are: "New", "Enabled", @@ -11380,7 +11583,7 @@ class SqlPoolTable(ProxyResource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -11406,7 +11609,7 @@ class SqlPoolTableListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11454,7 +11657,7 @@ class SqlPoolUsage(_serialization.Model): "next_reset_time": {"key": "nextResetTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -11489,7 +11692,7 @@ class SqlPoolUsageListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SqlPoolUsage"], **kwargs): + def __init__(self, *, value: List["_models.SqlPoolUsage"], **kwargs: Any) -> None: """ :keyword value: The list of usages for the Sql pool. Required. :paramtype value: list[~azure.mgmt.synapse.models.SqlPoolUsage] @@ -11555,8 +11758,8 @@ def __init__( storage_container_sas_key: Optional[str] = None, storage_account_access_key: Optional[str] = None, recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword storage_container_path: A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level @@ -11602,7 +11805,7 @@ class SqlPoolVulnerabilityAssessmentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -11647,8 +11850,8 @@ def __init__( self, *, baseline_results: Optional[List["_models.SqlPoolVulnerabilityAssessmentRuleBaselineItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword baseline_results: The rule baseline result. :paramtype baseline_results: @@ -11675,7 +11878,7 @@ class SqlPoolVulnerabilityAssessmentRuleBaselineItem(_serialization.Model): "result": {"key": "result", "type": "[str]"}, } - def __init__(self, *, result: List[str], **kwargs): + def __init__(self, *, result: List[str], **kwargs: Any) -> None: """ :keyword result: The rule baseline result. Required. :paramtype result: list[str] @@ -11716,7 +11919,7 @@ class SqlPoolVulnerabilityAssessmentScansExport(ProxyResource): "exported_report_location": {"key": "properties.exportedReportLocation", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.exported_report_location = None @@ -11767,8 +11970,8 @@ def __init__( id: Optional[int] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Metadata id. :paramtype id: int @@ -11825,8 +12028,8 @@ def __init__( description: Optional[str] = None, folder_id: Optional[int] = None, variables: Optional[List["_models.SsisVariable"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Metadata id. :paramtype id: int @@ -11872,8 +12075,8 @@ def __init__( environment_folder_name: Optional[str] = None, environment_name: Optional[str] = None, reference_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Environment reference id. :paramtype id: int @@ -11924,8 +12127,8 @@ def __init__( id: Optional[int] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Metadata id. :paramtype id: int @@ -11953,8 +12156,12 @@ class SsisObjectMetadataListResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SsisObjectMetadata"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.SsisObjectMetadata"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: List of SSIS object metadata. :paramtype value: list[~azure.mgmt.synapse.models.SsisObjectMetadata] @@ -11993,8 +12200,8 @@ def __init__( name: Optional[str] = None, properties: Optional[str] = None, error: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of the operation. :paramtype status: str @@ -12061,8 +12268,8 @@ def __init__( project_version: Optional[int] = None, project_id: Optional[int] = None, parameters: Optional[List["_models.SsisParameter"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Metadata id. :paramtype id: int @@ -12146,8 +12353,8 @@ def __init__( value_type: Optional[str] = None, value_set: Optional[bool] = None, variable: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Parameter id. :paramtype id: int @@ -12238,8 +12445,8 @@ def __init__( version: Optional[int] = None, environment_refs: Optional[List["_models.SsisEnvironmentReference"]] = None, parameters: Optional[List["_models.SsisParameter"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Metadata id. :paramtype id: int @@ -12303,8 +12510,8 @@ def __init__( sensitive: Optional[bool] = None, value: Optional[str] = None, sensitive_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Variable id. :paramtype id: int @@ -12368,8 +12575,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -12432,8 +12639,8 @@ def __init__( external_tables_to_exclude: Optional[List[str]] = None, materialized_views_to_include: Optional[List[str]] = None, materialized_views_to_exclude: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tables_to_include: List of tables to include in the follower database. :paramtype tables_to_include: list[str] @@ -12509,7 +12716,7 @@ class TopQueries(_serialization.Model): "queries": {"key": "queries", "type": "[QueryStatistic]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.aggregation_function = None @@ -12539,7 +12746,7 @@ class TopQueriesListResult(_serialization.Model): "value": {"key": "value", "type": "[TopQueries]"}, } - def __init__(self, *, value: List["_models.TopQueries"], **kwargs): + def __init__(self, *, value: List["_models.TopQueries"], **kwargs: Any) -> None: """ :keyword value: The list of top queries. Required. :paramtype value: list[~azure.mgmt.synapse.models.TopQueries] @@ -12583,7 +12790,9 @@ class TransparentDataEncryption(ProxyResource): "status": {"key": "properties.status", "type": "str"}, } - def __init__(self, *, status: Optional[Union[str, "_models.TransparentDataEncryptionStatus"]] = None, **kwargs): + def __init__( + self, *, status: Optional[Union[str, "_models.TransparentDataEncryptionStatus"]] = None, **kwargs: Any + ) -> None: """ :keyword status: The status of the database transparent data encryption. Known values are: "Enabled" and "Disabled". @@ -12615,7 +12824,7 @@ class TransparentDataEncryptionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -12638,7 +12847,7 @@ class UpdateIntegrationRuntimeNodeRequest(_serialization.Model): "concurrent_jobs_limit": {"key": "concurrentJobsLimit", "type": "int"}, } - def __init__(self, *, concurrent_jobs_limit: Optional[int] = None, **kwargs): + def __init__(self, *, concurrent_jobs_limit: Optional[int] = None, **kwargs: Any) -> None: """ :keyword concurrent_jobs_limit: The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. @@ -12669,8 +12878,8 @@ def __init__( *, auto_update: Optional[Union[str, "_models.IntegrationRuntimeAutoUpdate"]] = None, update_delay_offset: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword auto_update: Enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Known values are: "On" @@ -12706,7 +12915,7 @@ class UserAssignedManagedIdentity(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.client_id = None @@ -12724,7 +12933,7 @@ class VirtualNetworkProfile(_serialization.Model): "compute_subnet_id": {"key": "computeSubnetId", "type": "str"}, } - def __init__(self, *, compute_subnet_id: Optional[str] = None, **kwargs): + def __init__(self, *, compute_subnet_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword compute_subnet_id: Subnet ID used for computes in workspace. :paramtype compute_subnet_id: str @@ -12757,8 +12966,8 @@ def __init__( is_enabled: Optional[bool] = None, email_subscription_admins: bool = True, emails: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Recurring scans state. :paramtype is_enabled: bool @@ -12795,7 +13004,7 @@ class VulnerabilityAssessmentScanError(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -12862,7 +13071,7 @@ class VulnerabilityAssessmentScanRecord(ProxyResource): # pylint: disable=too-m "number_of_failed_security_checks": {"key": "properties.numberOfFailedSecurityChecks", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.scan_id = None @@ -12896,7 +13105,7 @@ class VulnerabilityAssessmentScanRecordListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -12957,8 +13166,8 @@ def __init__( start_time: Optional[str] = None, end_time: Optional[str] = None, importance: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword member_name: The workload classifier member name. :paramtype member_name: str @@ -13003,7 +13212,7 @@ class WorkloadClassifierListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -13064,8 +13273,8 @@ def __init__( max_resource_percent_per_request: Optional[float] = None, importance: Optional[str] = None, query_execution_timeout: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword min_resource_percent: The workload group minimum percentage resource. :paramtype min_resource_percent: int @@ -13110,7 +13319,7 @@ class WorkloadGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -13271,8 +13480,8 @@ def __init__( # pylint: disable=too-many-locals csp_workspace_admin_properties: Optional["_models.CspWorkspaceAdminProperties"] = None, azure_ad_only_authentication: Optional[bool] = None, trusted_service_bypass_enabled: bool = False, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -13396,8 +13605,8 @@ def __init__( login: Optional[str] = None, administrator_type: Optional[str] = None, sid: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tenant_id: Tenant ID of the workspace active directory administrator. :paramtype tenant_id: str @@ -13429,7 +13638,9 @@ class WorkspaceInfoListResult(_serialization.Model): "value": {"key": "value", "type": "[Workspace]"}, } - def __init__(self, *, next_link: Optional[str] = None, value: Optional[List["_models.Workspace"]] = None, **kwargs): + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Workspace"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Link to the next page of results. :paramtype next_link: str @@ -13455,7 +13666,7 @@ class WorkspaceKeyDetails(_serialization.Model): "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Workspace Key sub-resource name. :paramtype name: str @@ -13528,8 +13739,8 @@ def __init__( purview_configuration: Optional["_models.PurviewConfiguration"] = None, encryption: Optional["_models.EncryptionDetails"] = None, public_network_access: Optional[Union[str, "_models.WorkspacePublicNetworkAccess"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -13612,8 +13823,8 @@ def __init__( root_folder: Optional[str] = None, last_commit_id: Optional[str] = None, tenant_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration. diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py index 0f549cb33d61..7377b4791d10 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py @@ -779,3 +779,11 @@ class WorkspacePublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta) ENABLED = "Enabled" DISABLED = "Disabled" + + +class WorkspaceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """status of Start Integrationruntimes.""" + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py index 09104f09bc6d..b1719c4e0458 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py @@ -89,6 +89,7 @@ from ._integration_runtime_auth_keys_operations import IntegrationRuntimeAuthKeysOperations from ._integration_runtime_monitoring_data_operations import IntegrationRuntimeMonitoringDataOperations from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations +from ._get_operations import GetOperations from ._spark_configuration_operations import SparkConfigurationOperations from ._spark_configurations_operations import SparkConfigurationsOperations from ._kusto_operations_operations import KustoOperationsOperations @@ -169,6 +170,7 @@ "IntegrationRuntimeAuthKeysOperations", "IntegrationRuntimeMonitoringDataOperations", "IntegrationRuntimeStatusOperations", + "GetOperations", "SparkConfigurationOperations", "SparkConfigurationsOperations", "KustoOperationsOperations", diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_get_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_get_operations.py new file mode 100644 index 000000000000..cc40b5537e06 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_get_operations.py @@ -0,0 +1,428 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_integration_runtime_start_request( + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start/operationstatuses/{integrationRuntimeOperationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, "str"), + "integrationRuntimeOperationId": _SERIALIZER.url( + "integration_runtime_operation_id", integration_runtime_operation_id, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_integration_runtime_stop_request( + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop/operationstatuses/{integrationRuntimeOperationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, "str"), + "integrationRuntimeOperationId": _SERIALIZER.url( + "integration_runtime_operation_id", integration_runtime_operation_id, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_integration_runtime_enable_interactivequery_request( + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableinteractivequery/operationstatuses/{integrationRuntimeOperationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, "str"), + "integrationRuntimeOperationId": _SERIALIZER.url( + "integration_runtime_operation_id", integration_runtime_operation_id, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.synapse.SynapseManagementClient`'s + :attr:`get` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def integration_runtime_start( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeOperationStatus: + """Get integration runtime start operation status. + + Get an integration runtime start operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_start_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_start.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start/operationstatuses/{integrationRuntimeOperationId}" + } + + @distributed_trace + def integration_runtime_stop( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeStopOperationStatus: + """Get integration runtime stop operation status. + + Get an integration runtime stop operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeStopOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStopOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeStopOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_stop_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_stop.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeStopOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop/operationstatuses/{integrationRuntimeOperationId}" + } + + @distributed_trace + def integration_runtime_enable_interactivequery( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeEnableinteractivequery: + """Get integration runtime enable interactivequery operation status. + + Get an integration runtime enable interactivequery operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeEnableinteractivequery or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeEnableinteractivequery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeEnableinteractivequery] = kwargs.pop("cls", None) + + request = build_integration_runtime_enable_interactivequery_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_enable_interactivequery.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeEnableinteractivequery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_enable_interactivequery.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableinteractivequery/operationstatuses/{integrationRuntimeOperationId}" + } diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py index 02c6b70bf6bf..965a0805fec6 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py @@ -580,7 +580,7 @@ def _delete_initial( @distributed_trace def begin_delete( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.OperationResource]: """Delete a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. diff --git a/sdk/synapse/azure-mgmt-synapse/generated_samples/enable_interactivequery_integration_runtimes.py b/sdk/synapse/azure-mgmt-synapse/generated_samples/enable_interactivequery_integration_runtimes.py new file mode 100644 index 000000000000..f26dddb8322d --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/generated_samples/enable_interactivequery_integration_runtimes.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.synapse import SynapseManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-synapse +# USAGE + python enable_interactivequery_integration_runtimes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SynapseManagementClient( + credential=DefaultAzureCredential(), + subscription_id="2d03866b-587b-4e1f-a2fe-0a55958c655e", + ) + + response = client.get.integration_runtime_enable_interactivequery( + resource_group_name="drage-felles-prod-rg", + workspace_name="felles-prod-synapse-workspace", + integration_runtime_name="SSIS-intergrationRuntime-Drage", + integration_runtime_operation_id="5752dcdf918e4aecb941245ddf6ebb83", + ) + print(response) + + +# x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/EnableInteractivequery_IntegrationRuntimes.json +if __name__ == "__main__": + main() diff --git a/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_start_operation_status.py b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_start_operation_status.py new file mode 100644 index 000000000000..251a803300aa --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_start_operation_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.synapse import SynapseManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-synapse +# USAGE + python integration_runtimes_start_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SynapseManagementClient( + credential=DefaultAzureCredential(), + subscription_id="2d03866b-587b-4e1f-a2fe-0a55958c655e", + ) + + response = client.get.integration_runtime_start( + resource_group_name="drage-felles-prod-rg", + workspace_name="felles-prod-synapse-workspace", + integration_runtime_name="SSIS-intergrationRuntime-Drage", + integration_runtime_operation_id="5752dcdf918e4aecb941245ddf6ebb83", + ) + print(response) + + +# x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/IntegrationRuntimes_Start_OperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_stop_operation_status.py b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_stop_operation_status.py new file mode 100644 index 000000000000..940e467ccec7 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_stop_operation_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.synapse import SynapseManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-synapse +# USAGE + python integration_runtimes_stop_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SynapseManagementClient( + credential=DefaultAzureCredential(), + subscription_id="2d03866b-587b-4e1f-a2fe-0a55958c655e", + ) + + response = client.get.integration_runtime_stop( + resource_group_name="drage-felles-prod-rg", + workspace_name="felles-prod-synapse-workspace", + integration_runtime_name="SSIS-intergrationRuntime-Drage", + integration_runtime_operation_id="5752dcdf918e4aecb941245ddf6ebb83", + ) + print(response) + + +# x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/IntegrationRuntimes_Stop_OperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/synapse/azure-synapse-accesscontrol/pyproject.toml b/sdk/synapse/azure-synapse-accesscontrol/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/synapse/azure-synapse-accesscontrol/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/synapse/azure-synapse-artifacts/pyproject.toml b/sdk/synapse/azure-synapse-artifacts/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/synapse/azure-synapse-artifacts/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/synapse/azure-synapse-managedprivateendpoints/pyproject.toml b/sdk/synapse/azure-synapse-managedprivateendpoints/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/synapse/azure-synapse-managedprivateendpoints/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/synapse/azure-synapse-monitoring/pyproject.toml b/sdk/synapse/azure-synapse-monitoring/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/synapse/azure-synapse-monitoring/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/synapse/azure-synapse-spark/pyproject.toml b/sdk/synapse/azure-synapse-spark/pyproject.toml new file mode 100644 index 000000000000..cbb8ff1f8454 --- /dev/null +++ b/sdk/synapse/azure-synapse-spark/pyproject.toml @@ -0,0 +1,6 @@ +[tool.azure-sdk-build] +mypy = false +pylint = false +pyright = false +type_check_samples = false +verifytypes = false diff --git a/sdk/synapse/azure-synapse/pyproject.toml b/sdk/synapse/azure-synapse/pyproject.toml new file mode 100644 index 000000000000..0891ce3392f5 --- /dev/null +++ b/sdk/synapse/azure-synapse/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pylint = false diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py index 0ff2afef945f..d0e58244c93a 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py @@ -3,15 +3,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING - try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse # type: ignore +from azure.core.credentials import TokenCredential from azure.core.exceptions import ClientAuthenticationError +from azure.core.pipeline import PipelineResponse, PipelineRequest from azure.core.pipeline.policies import BearerTokenCredentialPolicy, SansIOHTTPPolicy try: @@ -24,18 +23,8 @@ except ImportError: pass -from ._common_conversion import ( - _sign_string, -) - -from ._error import ( - _wrap_exception, -) - -if TYPE_CHECKING: - from typing import Any - from azure.core.credentials import TokenCredential - from azure.core.pipeline import PipelineResponse, PipelineRequest # pylint: disable=ungrouped-imports +from ._common_conversion import _sign_string +from ._error import _wrap_exception class AzureSigningError(ClientAuthenticationError): @@ -150,11 +139,10 @@ def _add_authorization_header(self, request, string_to_sign): # Doing so will clarify/locate the source of problem raise _wrap_exception(ex, AzureSigningError) - def on_request(self, request): - # type: (PipelineRequest) -> None + def on_request(self, request: PipelineRequest) -> None: self.sign_request(request) - def sign_request(self, request): + def sign_request(self, request: PipelineRequest) -> None: string_to_sign = ( self._get_verb(request.http_request) + self._get_headers( @@ -190,17 +178,17 @@ class BearerTokenChallengePolicy(BearerTokenCredentialPolicy): def __init__( self, - credential: "TokenCredential", + credential: TokenCredential, *scopes: str, discover_tenant: bool = True, discover_scopes: bool = True, - **kwargs: "Any" + **kwargs ) -> None: self._discover_tenant = discover_tenant self._discover_scopes = discover_scopes super().__init__(credential, *scopes, **kwargs) - def on_challenge(self, request: "PipelineRequest", response: "PipelineResponse") -> bool: + def on_challenge(self, request: PipelineRequest, response: PipelineResponse) -> bool: """Authorize request according to an authentication challenge This method is called when the resource provider responds 401 with a WWW-Authenticate header. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py index 37bf3e54c005..1e2bfb8f905c 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py @@ -4,15 +4,16 @@ # license information. # -------------------------------------------------------------------------- import os -from typing import Dict, Optional, Any, List, Mapping, Union, TYPE_CHECKING + from uuid import uuid4 +from typing import Any, Dict, List, Optional, Mapping, Union try: from urllib.parse import parse_qs, quote, urlparse except ImportError: from urlparse import parse_qs, urlparse # type: ignore from urllib2 import quote # type: ignore -from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential +from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential, TokenCredential from azure.core.utils import parse_connection_string from azure.core.pipeline.transport import ( HttpTransport, @@ -55,17 +56,12 @@ ) from ._sdk_moniker import SDK_MONIKER -if TYPE_CHECKING: - from azure.core.credentials import TokenCredential - from typing import Literal - _SUPPORTED_API_VERSIONS = ["2019-02-02", "2019-07-07", "2020-12-06"] # cspell:disable-next-line _DEV_CONN_STRING = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1" # pylint: disable=line-too-long -def get_api_version(kwargs, default): - # type: (Dict[str, Any], Literal["2019-02-02"]) -> Literal["2019-02-02"] +def get_api_version(kwargs: Dict[str, Any], default: str) -> str: api_version = kwargs.pop("api_version", None) if api_version and api_version not in _SUPPORTED_API_VERSIONS: versions = "\n".join(_SUPPORTED_API_VERSIONS) @@ -80,11 +76,10 @@ def get_api_version(kwargs, default): class AccountHostsMixin(object): # pylint: disable=too-many-instance-attributes def __init__( self, - account_url, # type: Any - credential=None, # type: Optional[Union[AzureNamedKeyCredential, AzureSasCredential, "TokenCredential"]] - **kwargs # type: Any - ): - # type: (...) -> None + account_url: str, + credential: Optional[Union[AzureNamedKeyCredential, AzureSasCredential, TokenCredential]] = None, + **kwargs + ) -> None: try: if not account_url.lower().startswith("http"): account_url = "https://" + account_url @@ -226,20 +221,20 @@ class TablesBaseClient(AccountHostsMixin): :paramtype api_version: str """ - def __init__( # pylint: disable=missing-client-constructor-parameter-credential + def __init__( # pylint: disable=missing-client-constructor-parameter-credential self, - endpoint, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - credential = kwargs.pop('credential', None) - super(TablesBaseClient, self).__init__(endpoint, credential=credential, **kwargs) + endpoint: str, + *, + credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, TokenCredential]] = None, + **kwargs + ) -> None: + super(TablesBaseClient, self).__init__(endpoint, credential=credential, **kwargs) # type: ignore self._client = AzureTable( self.url, policies=kwargs.pop('policies', self._policies), **kwargs ) - self._client._config.version = get_api_version(kwargs, self._client._config.version) # pylint: disable=protected-access + self._client._config.version = get_api_version(kwargs, self._client._config.version) # type: ignore # pylint: disable=protected-access def __enter__(self): self._client.__enter__() @@ -265,23 +260,23 @@ def _configure_policies(self, **kwargs): HttpLoggingPolicy(**kwargs), ] - def _configure_credential(self, credential): - # type: (Any) -> None + def _configure_credential( + self, credential: Optional[Union[AzureNamedKeyCredential, AzureSasCredential, TokenCredential]] + ) -> None: if hasattr(credential, "get_token"): - self._credential_policy = BearerTokenChallengePolicy( # type: ignore - credential, STORAGE_OAUTH_SCOPE + self._credential_policy = BearerTokenChallengePolicy( + credential, STORAGE_OAUTH_SCOPE # type: ignore ) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential # type: ignore elif isinstance(credential, AzureSasCredential): - self._credential_policy = AzureSasCredentialPolicy(credential) # type: ignore + self._credential_policy = AzureSasCredentialPolicy(credential) # type: ignore elif isinstance(credential, AzureNamedKeyCredential): - self._credential_policy = SharedKeyCredentialPolicy(credential) # type: ignore + self._credential_policy = SharedKeyCredentialPolicy(credential) # type: ignore elif credential is not None: raise TypeError("Unsupported credential: {}".format(credential)) - def _batch_send(self, table_name, *reqs, **kwargs): - # type: (str, List[HttpRequest], Any) -> List[Mapping[str, Any]] + def _batch_send(self, table_name: str, *reqs: HttpRequest, **kwargs) -> List[Mapping[str, Any]]: """Given a series of request, do a Storage batch call.""" # Pop it here, so requests doesn't feel bad about additional kwarg policies = [StorageHeadersPolicy()] @@ -334,8 +329,7 @@ def _batch_send(self, table_name, *reqs, **kwargs): raise decoded return [extract_batch_part_metadata(p) for p in parts] - def close(self): - # type: () -> None + def close(self) -> None: """This method is to close the sockets opened by the client. It need not be used when using with a context manager. """ diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py index f1cfcae8eee9..c57a023daae2 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py @@ -46,18 +46,15 @@ def get_enum_value(value): return value -def _from_entity_binary(value): - # type: (str) -> EntityProperty +def _from_entity_binary(value: str) -> bytes: return _decode_base64_to_bytes(value) -def _from_entity_int32(value): - # type: (str) -> int +def _from_entity_int32(value: str) -> int: return int(value) -def _from_entity_int64(value): - # type: (str) -> EntityProperty +def _from_entity_int64(value: str) -> EntityProperty: return EntityProperty(int(value), EdmType.INT64) @@ -101,8 +98,7 @@ def _from_entity_guid(value): return UUID(value) -def _from_entity_str(value): - # type: (Union[str, bytes]) -> str +def _from_entity_str(value: Union[str, bytes]) -> str: if isinstance(value, six.binary_type): return value.decode('utf-8') return value @@ -229,7 +225,7 @@ def _extract_etag(response): def _extract_continuation_token(continuation_token): """Extract list entity continuation headers from token. - :param dict(str,str) continuation_token: The listing continuation token. + :param Dict(str,str) continuation_token: The listing continuation token. :returns: The next partition key and next row key in a tuple :rtype: (str,str) """ @@ -262,8 +258,7 @@ def _return_context_and_deserialized( return response.context['location_mode'], deserialized, response_headers -def _trim_service_metadata(metadata, content=None): - # type: (Dict[str, str], Optional[Dict[str, Any]]) -> Dict[str, Any] +def _trim_service_metadata(metadata: Dict[str, str], content: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: result = { "date": metadata.pop("date", None), "etag": metadata.pop("etag", None), diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_entity.py b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py index c188ad9488fb..b38bd533758b 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_entity.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py @@ -16,8 +16,7 @@ class TableEntity(dict): _metadata = {} # type: Dict[str, Any] @property - def metadata(self): - # type: () -> Dict[str, Any] + def metadata(self) -> Dict[str, Any]: """Resets metadata to be a part of the entity :return Dict of entity metadata :rtype: Dict[str, Any] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/_models.py index 41482fb04678..70109ba5df88 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -4,15 +4,14 @@ # license information. # -------------------------------------------------------------------------- from enum import Enum -from typing import TYPE_CHECKING, Any, Dict, List +from typing import Any, Dict, List from azure.core import CaseInsensitiveEnumMeta from azure.core.exceptions import HttpResponseError from azure.core.paging import PageIterator -# from azure.core import CaseInsensitiveEnumMeta -# from six import with_metaclass - +from ._generated.models import TableQueryResponse from ._generated.models import TableServiceStats as GenTableServiceStats +from ._generated.models import TableServiceProperties as GenTableServiceProperties from ._generated.models import AccessPolicy as GenAccessPolicy from ._generated.models import Logging as GeneratedLogging from ._generated.models import Metrics as GeneratedMetrics @@ -26,10 +25,6 @@ from ._error import _process_table_error from ._constants import NEXT_PARTITION_KEY, NEXT_ROW_KEY, NEXT_TABLE_NAME -if TYPE_CHECKING: - from ._generated.models import TableQueryResponse - from ._generated.models import TableServiceProperties as GenTableServiceProperties - class TableAccessPolicy(GenAccessPolicy): """Access Policy class used by the set and get access policy methods. @@ -78,8 +73,7 @@ def __init__(self, **kwargs): # pylint: disable=super-init-not-called self.expiry = kwargs.get('expiry') self.permission = kwargs.get('permission') - def __repr__(self): - # type: () -> str + def __repr__(self) -> str: return "TableAccessPolicy(start={}, expiry={}, permission={})".format( self.start, self.expiry, self.permission )[1024:] @@ -98,8 +92,7 @@ class TableAnalyticsLogging(GeneratedLogging): The retention policy for the metrics. """ - def __init__(self, **kwargs): # pylint: disable=super-init-not-called - # type: (Any)-> None + def __init__(self, **kwargs) -> None: # pylint: disable=super-init-not-called self.version = kwargs.get("version", u"1.0") self.delete = kwargs.get("delete", False) self.read = kwargs.get("read", False) @@ -120,8 +113,7 @@ def _from_generated(cls, generated): ) ) - def __repr__(self): - # type: () -> str + def __repr__(self) -> str: return "TableAnalyticsLogging(version={}, delete={}, read={}, write={}, retention_policy={})".format( self.version, self.delete, self.read, self.write, self.retention_policy )[1024:] @@ -140,16 +132,14 @@ class TableMetrics(GeneratedMetrics): The retention policy for the metrics. """ - def __init__(self, **kwargs): # pylint: disable=super-init-not-called - # type: (Any) -> None + def __init__(self, **kwargs) -> None: # pylint: disable=super-init-not-called self.version = kwargs.get("version", u"1.0") self.enabled = kwargs.get("enabled", False) self.include_apis = kwargs.get("include_apis") self.retention_policy = kwargs.get("retention_policy") or TableRetentionPolicy() @classmethod - def _from_generated(cls, generated): - # type: (...) -> TableMetrics + def _from_generated(cls, generated) -> 'TableMetrics': """A summary of request statistics grouped by API in hour or minute aggregates. :param TableMetrics generated: generated Metrics @@ -165,16 +155,14 @@ def _from_generated(cls, generated): ) ) - def __repr__(self): - # type: () -> str + def __repr__(self) -> str: return "TableMetrics(version={}, enabled={}, include_apis={}, retention_policy={})".format( self.version, self.enabled, self.include_apis, self.retention_policy )[1024:] class TableRetentionPolicy(GeneratedRetentionPolicy): - def __init__(self, **kwargs): # pylint: disable=super-init-not-called - # type: (Any) -> None + def __init__(self, **kwargs) -> None: # pylint: disable=super-init-not-called """The retention policy which determines how long the associated data should persist. @@ -192,8 +180,7 @@ def __init__(self, **kwargs): # pylint: disable=super-init-not-called raise ValueError("If policy is enabled, 'days' must be specified.") @classmethod - def _from_generated(cls, generated, **kwargs): # pylint: disable=unused-argument - # type: (GeneratedRetentionPolicy, Dict[str, Any]) -> TableRetentionPolicy + def _from_generated(cls, generated: GeneratedRetentionPolicy) -> 'TableRetentionPolicy': """The retention policy which determines how long the associated data should persist. @@ -208,8 +195,7 @@ def _from_generated(cls, generated, **kwargs): # pylint: disable=unused-argumen enabled=generated.enabled, days=generated.days, ) - def __repr__(self): - # type: () -> str + def __repr__(self) -> str: return "TableRetentionPolicy(enabled={}, days={})".format(self.enabled, self.days)[1024:] @@ -222,34 +208,28 @@ class TableCorsRule(object): All required parameters must be populated in order to send to Azure. - :param list[str] allowed_origins: + :param List[str] allowed_origins: A list of origin domains that will be allowed via CORS, or "*" to allow all domains. The list of must contain at least one entry. Limited to 64 origin domains. Each allowed origin can have up to 256 characters. - :param list[str] allowed_methods: + :param List[str] allowed_methods: A list of HTTP methods that are allowed to be executed by the origin. The list of must contain at least one entry. For Azure Storage, permitted methods are DELETE, GET, HEAD, MERGE, POST, OPTIONS or PUT. :keyword int max_age_in_seconds: The number of seconds that the client/browser should cache a pre-flight response. - :keyword list[str] exposed_headers: + :keyword List[str] exposed_headers: Defaults to an empty list. A list of response headers to expose to CORS clients. Limited to 64 defined headers and two prefixed headers. Each header can be up to 256 characters. - :keyword list[str] allowed_headers: + :keyword List[str] allowed_headers: Defaults to an empty list. A list of headers allowed to be part of the cross-origin request. Limited to 64 defined headers and 2 prefixed headers. Each header can be up to 256 characters. """ - def __init__( - self, - allowed_origins, # type: List[str] - allowed_methods, # type: List[str] - **kwargs # type: Any - ): - # type: (...)-> None + def __init__(self, allowed_origins: List[str], allowed_methods: List[str], **kwargs) -> None: self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods self.allowed_headers = kwargs.get("allowed_headers", []) @@ -277,8 +257,7 @@ def _from_generated(cls, generated): max_age_in_seconds=generated.max_age_in_seconds, ) - def __repr__(self): - # type: () -> str + def __repr__(self) -> str: return "TableCorsRules(allowed_origins={}, allowed_methods={}, allowed_headers={}, exposed_headers={}, max_age_in_seconds={})".format( # pylint: disable=line-too-long self.allowed_origins, self.allowed_methods, self.allowed_headers, self.exposed_headers, self.max_age_in_seconds # pylint: disable=line-too-long )[1024:] @@ -383,8 +362,7 @@ def _extract_data_cb(self, get_next_return): class TableSasPermissions(object): - def __init__(self, **kwargs): - # type: (Any) -> None + def __init__(self, **kwargs) -> None: """ :keyword bool read: Get entities and query entities. @@ -395,30 +373,27 @@ def __init__(self, **kwargs): :keyword bool delete: Delete entities. """ - _str = kwargs.pop('_str', "") or "" - self.read = kwargs.pop("read", False) or ("r" in _str) - self.add = kwargs.pop("add", False) or ("a" in _str) - self.update = kwargs.pop("update", False) or ("u" in _str) - self.delete = kwargs.pop("delete", False) or ("d" in _str) - - def __or__(self, other): - # type: (TableSasPermissions) -> TableSasPermissions + self._str = kwargs.pop('_str', "") or "" + self.read = kwargs.pop("read", False) or ("r" in self._str) + self.add = kwargs.pop("add", False) or ("a" in self._str) + self.update = kwargs.pop("update", False) or ("u" in self._str) + self.delete = kwargs.pop("delete", False) or ("d" in self._str) + + def __or__(self, other: 'TableSasPermissions') -> 'TableSasPermissions': """ :param other: :type other: :class:`~azure.data.tables.TableSasPermissions` """ return TableSasPermissions(_str=str(self) + str(other)) - def __add__(self, other): - # type: (TableSasPermissions) -> TableSasPermissions + def __add__(self, other: 'TableSasPermissions') -> 'TableSasPermissions': """ :param other: :type other: :class:`~azure.data.tables.TableSasPermissions` """ return TableSasPermissions(_str=str(self) + str(other)) - def __str__(self): - # type: () -> str + def __str__(self) -> str: return ( ("r" if self.read else "") + ("a" if self.add else "") @@ -426,20 +401,14 @@ def __str__(self): + ("d" if self.delete else "") ) - def __repr__(self): - # type: () -> str + def __repr__(self) -> str: return "TableSasPermissions(read={}, add={}, update={}, delete={})".format( self.read, self.add, self.update, self.delete )[1024:] @classmethod - def from_string( - cls, - permission, - **kwargs - ): - # Type: (str, Dict[str, Any]) -> AccountSasPermissions - """Create AccountSasPermissions from a string. + def from_string(cls, permission: str, **kwargs) -> 'TableSasPermissions': + """Create TableSasPermissions from a string. To specify read, write, delete, etc. permissions you need only to include the first letter of the word in the string. E.g. for read and write @@ -447,9 +416,8 @@ def from_string( :param str permission: Specify permissions in the string with the first letter of the word. - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An AccountSasPermissions object - :rtype: :class:`~azure.data.tables.AccountSasPermissions` + :return: An TableSasPermissions object + :rtype: :class:`~azure.data.tables.TableSasPermissions` """ p_read = "r" in permission p_add = "a" in permission @@ -463,8 +431,7 @@ def from_string( return parsed -def service_stats_deserialize(generated): - # type: (GenTableServiceStats) -> Dict[str, Any] +def service_stats_deserialize(generated: GenTableServiceStats) -> Dict[str, Any]: """Deserialize a ServiceStats objects into a dict.""" return { "geo_replication": { @@ -474,8 +441,7 @@ def service_stats_deserialize(generated): } -def service_properties_deserialize(generated): - # type: (GenTableServiceProperties) -> Dict[str, Any] +def service_properties_deserialize(generated: GenTableServiceProperties) -> Dict[str, Any]: """Deserialize a ServiceProperties objects into a dict.""" return { "analytics_logging": TableAnalyticsLogging._from_generated(generated.logging), # pylint: disable=protected-access @@ -500,8 +466,7 @@ class TableItem(object): :ivar str name: The name of the table. """ - def __init__(self, name): - # type: (str) -> None + def __init__(self, name: str) -> None: """ :param str name: Name of the Table """ @@ -509,12 +474,10 @@ def __init__(self, name): # TODO: TableQueryResponse is not the correct type @classmethod - def _from_generated(cls, generated, **kwargs): # pylint: disable=unused-argument - # type: (TableQueryResponse, Any) -> TableItem + def _from_generated(cls, generated: TableQueryResponse, **kwargs) -> 'TableItem': # pylint: disable=unused-argument return cls(generated.table_name) # type: ignore - def __repr__(self): - # type: () -> str + def __repr__(self) -> str: return "TableItem(name={})".format(self.name)[1024:] @@ -575,8 +538,7 @@ class ResourceTypes(object): Access to object-level APIs for tables (e.g. Get/Create/Query Entity etc.) """ - def __init__(self, **kwargs): - # type: (Any) -> None + def __init__(self, **kwargs) -> None: self.service = kwargs.get('service', False) self.object = kwargs.get('object', False) self._str = ("s" if self.service else "") + ("o" if self.object else "") @@ -585,8 +547,7 @@ def __str__(self): return self._str @classmethod - def from_string(cls, string): - # type: (str) -> ResourceTypes + def from_string(cls, string: str) -> 'ResourceTypes': """Create a ResourceTypes from a string. To specify service, container, or object you need only to @@ -656,8 +617,7 @@ def __str__(self): return self._str @classmethod - def from_string(cls, permission, **kwargs): - # type: (str, Dict[str, Any]) -> AccountSasPermissions + def from_string(cls, permission: str, **kwargs) -> 'AccountSasPermissions': """Create AccountSasPermissions from a string. To specify read, write, delete, etc. permissions you need only to diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py index 54d083928682..ac457d0c2d1a 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- import time -from typing import Any, TYPE_CHECKING, Dict +from typing import Any, Dict from wsgiref.handlers import format_date_time try: from urllib.parse import urlparse @@ -17,17 +17,14 @@ SansIOHTTPPolicy, RetryPolicy, ) +from azure.core.pipeline import PipelineRequest from azure.core.exceptions import AzureError, ServiceRequestError, ClientAuthenticationError from ._common_conversion import _transform_patch_to_cosmos_post from ._models import LocationMode -if TYPE_CHECKING: - from azure.core.pipeline import PipelineRequest - -def set_next_host_location(settings, request): - # type: (Dict[str, Any], PipelineRequest) -> None +def set_next_host_location(settings: Dict[str, Any], request: PipelineRequest) -> None: """ A function which sets the next host location on the request, if applicable. """ @@ -49,8 +46,7 @@ def set_next_host_location(settings, request): class StorageHeadersPolicy(HeadersPolicy): - def on_request(self, request): - # type: (PipelineRequest) -> None + def on_request(self, request: PipelineRequest) -> None: super(StorageHeadersPolicy, self).on_request(request) # Add required date headers @@ -64,8 +60,7 @@ def __init__(self, hosts=None, **kwargs): # pylint: disable=unused-argument self.hosts = hosts super(StorageHosts, self).__init__() - def on_request(self, request): - # type: (PipelineRequest) -> None + def on_request(self, request: PipelineRequest) -> None: request.context.options["hosts"] = self.hosts parsed_url = urlparse(request.http_request.url) @@ -151,7 +146,7 @@ def configure_retries(self, options): :param options: keyword arguments from context. :return: A dict containing settings and history for retries. - :rtype: dict + :rtype: Dict """ config = super(TablesRetryPolicy, self).configure_retries(options) config["retry_secondary"] = options.pop("retry_to_secondary", self.retry_to_secondary) @@ -165,7 +160,7 @@ def update_context(self, context, retry_settings): :param context: The pipeline context. :type context: ~azure.core.pipeline.PipelineContext :param retry_settings: The retry settings. - :type retry_settings: dict + :type retry_settings: Dict """ super(TablesRetryPolicy, self).update_context(context, retry_settings) context['location_mode'] = retry_settings['mode'] @@ -174,7 +169,7 @@ def update_request(self, request, retry_settings): # pylint:disable=no-self-use """Updates the pipeline request before attempting to retry. :param PipelineRequest request: The outgoing request. - :param dict(str, Any) retry_settings: The current retry context settings. + :param Dict(str, Any) retry_settings: The current retry context settings. """ set_next_host_location(retry_settings, request) @@ -235,7 +230,6 @@ def send(self, request): class CosmosPatchTransformPolicy(SansIOHTTPPolicy): """Policy to transform PATCH requests into POST requests with the "X-HTTP-Method":"MERGE" header set.""" - def on_request(self, request): - # type: (PipelineRequest) -> None + def on_request(self, request: PipelineRequest) -> None: if request.http_request.method == "PATCH": _transform_patch_to_cosmos_post(request.http_request) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py index 96d6d2ebea74..cc123e3a4230 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py @@ -39,8 +39,7 @@ def _prepare_key(keyvalue): raise TypeError('PartitionKey or RowKey must be of type string.') -def _parameter_filter_substitution(parameters, query_filter): - # type: (Dict[str, str], str) -> str +def _parameter_filter_substitution(parameters: Dict[str, str], query_filter: str) -> str: """Replace user defined parameter in filter :param parameters: User defined parameters :param str query_filter: Filter for querying diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py index dea674439082..e59a738a4f37 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py @@ -3,22 +3,17 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from datetime import date -from typing import Optional, Union, TYPE_CHECKING +from datetime import date, datetime +from typing import Optional, Union from ._deserialize import url_quote - - +from ._models import AccountSasPermissions, ResourceTypes, SASProtocol from ._common_conversion import ( _sign_string, _to_str, ) from ._constants import DEFAULT_X_MS_VERSION -if TYPE_CHECKING: - from datetime import datetime # pylint: disable=ungrouped-imports - from ._models import AccountSasPermissions, ResourceTypes, SASProtocol - def _to_utc_datetime(value): # This is for SAS where milliseconds are not supported @@ -46,15 +41,14 @@ def __init__(self, credential, x_ms_version=DEFAULT_X_MS_VERSION): def generate_account( self, - services, # type: str - resource_types, # type: ResourceTypes - permission, # type: Union[AccountSasPermissions, str] - expiry, # type: Union[datetime, str] - start=None, # type: Optional[Union[datetime, str]] - ip_address_or_range=None, # type: Optional[str] - protocol=None, # type: Optional[Union[str, SASProtocol]] - ): - # type: (...) -> str + services: str, + resource_types: ResourceTypes, + permission: Union[AccountSasPermissions, str], + expiry: Union[datetime, str], + start: Optional[Union[datetime, str]] = None, + ip_address_or_range: Optional[str] = None, + protocol: Optional[Union[str, SASProtocol]] = None, + ) -> str: """ Generates a shared access signature for the account. Use the returned signature with the sas_token parameter of the service @@ -248,8 +242,7 @@ def get_value_to_append(query): _sign_string(account_key, string_to_sign), ) - def add_account_signature(self, account_name, account_key): - # type: (str, str) -> None + def add_account_signature(self, account_name: str, account_key: str) -> None: def get_value_to_append(query): return_value = self.query_dict.get(query) or "" return return_value + "\n" @@ -272,8 +265,7 @@ def get_value_to_append(query): _sign_string(account_key, string_to_sign), ) - def get_token(self): - # type: () -> str + def get_token(self) -> str: return "&".join( [ "{0}={1}".format(n, url_quote(v)) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py index d8d3b781a573..8c47fee40166 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py @@ -4,7 +4,6 @@ # license information. # -------------------------------------------------------------------------- from typing import ( - TYPE_CHECKING, Union, Any, Dict, @@ -15,18 +14,15 @@ ) from azure.core import MatchConditions +from azure.core.pipeline.transport import HttpRequest from ._common_conversion import _transform_patch_to_cosmos_post from ._models import UpdateMode, TransactionOperation from ._serialize import _get_match_headers, _add_entity_properties, _prepare_key from ._entity import TableEntity - -if TYPE_CHECKING: - from azure.core.pipeline.transport import HttpRequest - from ._generated import models, AzureTable - from ._generated._configuration import AzureTableConfiguration - from ._generated._serialization import Serializer - from ._generated._serialization import Deserializer +from ._generated import models, AzureTable +from ._generated._configuration import AzureTableConfiguration +from ._generated._serialization import Serializer, Deserializer EntityType = Union[TableEntity, Mapping[str, Any]] @@ -48,13 +44,13 @@ class TableBatchOperations(object): def __init__( self, - client, # type: AzureTable - serializer, # type: Serializer - deserializer, # type: Deserializer - config, # type: AzureTableConfiguration - table_name, # type: str - is_cosmos_endpoint=False, # type: bool - **kwargs # type: Dict[str, Any] + client: AzureTable, + serializer: Serializer, + deserializer: Deserializer, + config: AzureTableConfiguration, + table_name: str, + is_cosmos_endpoint: bool = False, + **kwargs ): """Create TableClient from a Credential. @@ -86,17 +82,13 @@ def __init__( def __len__(self): return len(self.requests) - def _verify_partition_key( - self, entity # type: EntityType - ): - # (...) -> None + def _verify_partition_key(self, entity: EntityType) -> None: if self._partition_key is None: self._partition_key = entity["PartitionKey"] elif entity["PartitionKey"] != self._partition_key: raise ValueError("Partition Keys must all be the same") - def add_operation(self, operation): - # type: (TransactionOperationType) -> None + def add_operation(self, operation: TransactionOperationType) -> None: """Add a single operation to a batch.""" try: operation_type, entity, kwargs = operation # type: ignore @@ -107,12 +99,7 @@ def add_operation(self, operation): except AttributeError: raise ValueError("Unrecognized operation: {}".format(operation)) - def create( - self, - entity, # type: EntityType - **kwargs # type: Any - ): - # type: (...) -> None + def create(self, entity: EntityType, **kwargs) -> None: """Adds an insert operation to the current batch. :param entity: The properties for the table entity. @@ -141,15 +128,14 @@ def create( def _batch_create_entity( self, - table, # type: str - entity, # type: EntityType - timeout=None, # type: Optional[int] - request_id_parameter=None, # type: Optional[str] - response_preference="return-no-content", # type: Optional[Union[str, "models.ResponseFormat"]] - format=None, # type: Optional[Union[str, "models.OdataMetadataFormat"]] # pylint: disable=redefined-builtin - **kwargs # type: Any - ): - # (...) -> None + table: str, + entity: EntityType, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + response_preference: Optional[Union[str, models.ResponseFormat]] = "return-no-content", + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin + **kwargs + ) -> None: """ Adds an insert operation to the batch. See :func:`azure.data.tables.TableClient.insert_entity` for more information @@ -163,7 +149,7 @@ def _batch_create_entity( :param: entity: The entity to insert. Can be a dict or an entity object Must contain a PartitionKey and a RowKey. - :type: entity: dict or :class:`~azure.data.tables.models.Entity` + :type: entity: Dict or :class:`~azure.data.tables.models.Entity` :param timeout: The timeout parameter is expressed in seconds. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -237,14 +223,7 @@ def _batch_create_entity( _batch_create_entity.metadata = {"url": "/{table}"} # type: ignore - def update( - self, - entity, # type: EntityType - mode=UpdateMode.MERGE, # type: Union[str, UpdateMode] - **kwargs # type: Any - ): - # (...) -> None - + def update(self, entity: EntityType, mode: Union[str, UpdateMode] = UpdateMode.MERGE, **kwargs) -> None: """Adds an update operation to the current batch. :param entity: The properties for the table entity. @@ -309,17 +288,16 @@ def update( def _batch_update_entity( self, - table, # type: str - partition_key, # type: str - row_key, # type: str - timeout=None, # type: Optional[int] - request_id_parameter=None, # type: Optional[str] - if_match=None, # type: Optional[str] - table_entity_properties=None, # type: Optional[EntityType] - format=None, # type: Optional[Union[str, "models.OdataMetadataFormat"]] # pylint: disable=redefined-builtin - **kwargs # type: Any - ): - # type: (...) -> None + table: str, + partition_key: str, + row_key: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + if_match: Optional[str] = None, + table_entity_properties: Optional[EntityType] = None, + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin + **kwargs + ) -> None: """Update entity in a table. :param table: The name of the table. @@ -339,7 +317,7 @@ def _batch_update_entity( is found to update and a replace will be performed if an existing entity is found. :type if_match: str :param table_entity_properties: The properties for the table entity. - :type table_entity_properties: dict[str, object] + :type table_entity_properties: Dict[str, object] :param format: Specifies the media type for the response. Known values are: "application/json;odata=nometadata", "application/json;odata=minimalmetadata", and "application/json;odata=fullmetadata". @@ -414,17 +392,16 @@ def _batch_update_entity( def _batch_merge_entity( self, - table, # type: str - partition_key, # type: str - row_key, # type: str - timeout=None, # type: Optional[int] - request_id_parameter=None, # type: Optional[str] - if_match=None, # type: Optional[str] - table_entity_properties=None, # type: Optional[EntityType] - format=None, # type: Optional[Union[str, "models.OdataMetadataFormat"]] # pylint: disable=redefined-builtin - **kwargs # type: Any - ): - # type: (...) -> None + table: str, + partition_key: str, + row_key: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + if_match: Optional[str] = None, + table_entity_properties: Optional[EntityType] = None, + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin + **kwargs + ) -> None: """Merge entity in a table. :param table: The name of the table. @@ -444,7 +421,7 @@ def _batch_merge_entity( is found to update and a merge will be performed if an existing entity is found. :type if_match: str :param table_entity_properties: The properties for the table entity. - :type table_entity_properties: dict[str, object] + :type table_entity_properties: Dict[str, object] :param format: Specifies the media type for the response. Known values are: "application/json;odata=nometadata", "application/json;odata=minimalmetadata", and "application/json;odata=fullmetadata". @@ -518,12 +495,7 @@ def _batch_merge_entity( "url": "/{table}(PartitionKey='{partitionKey}',RowKey='{rowKey}')" } - def delete( - self, - entity, # type: EntityType - **kwargs # type: Any - ): - # type: (...) -> None + def delete(self, entity: EntityType, **kwargs) -> None: """Adds a delete operation to the current branch. :param partition_key: The partition key of the entity. @@ -571,15 +543,14 @@ def delete( def _batch_delete_entity( self, - table, # type: str - partition_key, # type: str - row_key, # type: str - if_match, # type: str - timeout=None, # type: Optional[int] - request_id_parameter=None, # type: Optional[str] - format=None, # type: Optional[Union[str, "models.OdataMetadataFormat"]] # pylint: disable=redefined-builtin - ): - # type: (...) -> None + table: str, + partition_key: str, + row_key: str, + if_match: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin + ) -> None: """Deletes the specified entity in a table. :param table: The name of the table. @@ -658,13 +629,7 @@ def _batch_delete_entity( "url": "/{table}(PartitionKey='{partitionKey}',RowKey='{rowKey}')" } - def upsert( - self, - entity, # type: EntityType - mode=UpdateMode.MERGE, # type: Union[str, UpdateMode] - **kwargs # type: Any - ): - # type: (...) -> None + def upsert(self, entity: EntityType, mode: Union[str, UpdateMode] = UpdateMode.MERGE, **kwargs) -> None: """Adds an upsert (update/merge) operation to the batch. :param entity: The properties for the table entity. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index 5b76029da6fb..d9ad268883aa 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -5,7 +5,8 @@ # -------------------------------------------------------------------------- import functools -from typing import Optional, Any, TYPE_CHECKING, Union, List, Dict, Mapping, Iterable, overload, cast +from typing import Optional, Any, Union, List, Dict, Mapping, Iterable, overload, cast + try: from urllib.parse import urlparse, unquote except ImportError: @@ -13,37 +14,21 @@ from urllib2 import unquote # type: ignore from azure.core import MatchConditions +from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential, TokenCredential from azure.core.exceptions import HttpResponseError from azure.core.paging import ItemPaged from azure.core.tracing.decorator import distributed_trace -from ._deserialize import _convert_to_entity, _trim_service_metadata +from ._base_client import parse_connection_str, TablesBaseClient from ._entity import TableEntity -from ._error import ( - _decode_error, - _process_table_error, - _reprocess_error, - _reraise_error, - _validate_tablename_error -) -from ._generated.models import ( - SignedIdentifier, - TableProperties +from ._error import _decode_error, _process_table_error, _reprocess_error, _reraise_error, _validate_tablename_error +from ._generated.models import SignedIdentifier, TableProperties +from ._serialize import( + serialize_iso, _parameter_filter_substitution, _get_match_headers, _add_entity_properties, _prepare_key ) -from ._serialize import _get_match_headers, _add_entity_properties, _prepare_key -from ._base_client import parse_connection_str, TablesBaseClient -from ._serialize import serialize_iso, _parameter_filter_substitution -from ._deserialize import deserialize_iso, _return_headers_and_deserialized +from ._deserialize import deserialize_iso, _return_headers_and_deserialized, _convert_to_entity, _trim_service_metadata from ._table_batch import TableBatchOperations, EntityType, TransactionOperationType -from ._models import ( - TableEntityPropertiesPaged, - UpdateMode, - TableAccessPolicy, - TableItem -) - -if TYPE_CHECKING: - from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential +from ._models import TableEntityPropertiesPaged, UpdateMode, TableAccessPolicy, TableItem class TableClient(TablesBaseClient): @@ -54,13 +39,14 @@ class TableClient(TablesBaseClient): :ivar str url: The full URL to the Tables account. """ - def __init__( # pylint: disable=missing-client-constructor-parameter-credential + def __init__( # pylint: disable=missing-client-constructor-parameter-credential self, - endpoint, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + endpoint: str, + table_name: str, + *, + credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, TokenCredential]] = None, + **kwargs + ) -> None: """Create TableClient from a Credential. :param str endpoint: A URL to an Azure Tables account. @@ -82,7 +68,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential if not table_name: raise ValueError("Please specify a table name.") self.table_name = table_name - super(TableClient, self).__init__(endpoint, **kwargs) + super(TableClient, self).__init__(endpoint, credential=credential, **kwargs) def _format_url(self, hostname): """Format the endpoint URL according to the current location @@ -91,13 +77,7 @@ def _format_url(self, hostname): return "{}://{}{}".format(self.scheme, hostname, self._query_str) @classmethod - def from_connection_string( - cls, - conn_str, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> TableClient + def from_connection_string(cls, conn_str: str, table_name: str, **kwargs) -> "TableClient": """Create TableClient from a Connection String. :param str conn_str: A connection string to an Azure Tables account. @@ -114,14 +94,17 @@ def from_connection_string( :dedent: 8 :caption: Authenticating a TableServiceClient from a connection_string """ - endpoint, credential = parse_connection_str( - conn_str=conn_str, credential=None, keyword_args=kwargs - ) + endpoint, credential = parse_connection_str(conn_str=conn_str, credential=None, keyword_args=kwargs) return cls(endpoint, table_name=table_name, credential=credential, **kwargs) @classmethod - def from_table_url(cls, table_url, **kwargs): - # type: (str, Any) -> TableClient + def from_table_url( + cls, + table_url: str, + *, + credential: Optional[Union[AzureNamedKeyCredential, AzureSasCredential]] = None, + **kwargs + ) -> "TableClient": """A client to interact with a specific Table. :param str table_url: The full URI to the table, including SAS token if used. @@ -159,16 +142,11 @@ def from_table_url(cls, table_url, **kwargs): if table_name.lower().startswith("tables('"): table_name = table_name[8:-2] if not table_name: - raise ValueError( - "Invalid URL. Please provide a URL with a valid table name" - ) - return cls(endpoint, table_name=table_name, **kwargs) + raise ValueError("Invalid URL. Please provide a URL with a valid table name") + return cls(endpoint, table_name=table_name, credential=credential, **kwargs) @distributed_trace - def get_table_access_policy( - self, **kwargs # type: Any - ): - # type: (...) -> Dict[str, Optional[TableAccessPolicy]] + def get_table_access_policy(self, **kwargs) -> Dict[str, Optional[TableAccessPolicy]]: """Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures. @@ -192,7 +170,7 @@ def get_table_access_policy( output[identifier.id] = TableAccessPolicy( start=deserialize_iso(identifier.access_policy.start), expiry=deserialize_iso(identifier.access_policy.expiry), - permission=identifier.access_policy.permission + permission=identifier.access_policy.permission, ) else: output[identifier.id] = None @@ -200,11 +178,8 @@ def get_table_access_policy( @distributed_trace def set_table_access_policy( - self, - signed_identifiers, # type: Dict[str, Optional[TableAccessPolicy]] - **kwargs - ): - # type: (...) -> None + self, signed_identifiers: Dict[str, Optional[TableAccessPolicy]], **kwargs + ) -> None: """Sets stored access policies for the table that may be used with Shared Access Signatures. :param signed_identifiers: Access policies to set for the table @@ -218,9 +193,7 @@ def set_table_access_policy( payload = None if value: payload = TableAccessPolicy( - start=serialize_iso(value.start), - expiry=serialize_iso(value.expiry), - permission=value.permission + start=serialize_iso(value.start), expiry=serialize_iso(value.expiry), permission=value.permission ) identifiers.append(SignedIdentifier(id=key, access_policy=payload)) try: @@ -235,10 +208,7 @@ def set_table_access_policy( raise @distributed_trace - def create_table( - self, **kwargs # type: Any - ): - # type: (...) -> TableItem + def create_table(self, **kwargs) -> TableItem: """Creates a new table under the current account. :return: A TableItem representing the created table. @@ -266,10 +236,7 @@ def create_table( return TableItem(name=result.table_name) # type: ignore @distributed_trace - def delete_table( - self, **kwargs # type: Any - ): - # type: (...) -> None + def delete_table(self, **kwargs) -> None: """Deletes the table under the current account. No error will be raised if the table does not exist @@ -298,18 +265,15 @@ def delete_table( raise @overload - def delete_entity(self, partition_key, row_key, **kwargs): - # type: (str, str, Any) -> None + def delete_entity(self, partition_key: str, row_key: str, **kwargs) -> None: pass @overload - def delete_entity(self, entity, **kwargs): - # type: (Union[TableEntity, Mapping[str, Any]], Any) -> None + def delete_entity(self, entity: Union[TableEntity, Mapping[str, Any]], **kwargs) -> None: pass @distributed_trace - def delete_entity(self, *args, **kwargs): - # type: (Union[TableEntity, str], Any) -> None + def delete_entity(self, *args: Union[TableEntity, str], **kwargs) -> None: """Deletes the specified entity in a table. No error will be raised if the entity or PartitionKey-RowKey pairing is not found. @@ -336,11 +300,11 @@ def delete_entity(self, *args, **kwargs): :caption: Deleting an entity of a Table """ try: - entity = kwargs.pop('entity', None) + entity = kwargs.pop("entity", None) if not entity: entity = args[0] - partition_key = entity['PartitionKey'] - row_key = entity['RowKey'] + partition_key = entity["PartitionKey"] + row_key = entity["RowKey"] except (TypeError, IndexError): partition_key = kwargs.pop('partition_key', None) if partition_key is None: @@ -375,12 +339,7 @@ def delete_entity(self, *args, **kwargs): _process_table_error(error, table_name=self.table_name) @distributed_trace - def create_entity( - self, - entity, # type: EntityType - **kwargs # type: Any - ): - # type: (...) -> Dict[str,str] + def create_entity(self, entity: EntityType, **kwargs) -> Dict[str, str]: """Insert entity in a table. :param entity: The properties for the table entity. @@ -418,13 +377,7 @@ def create_entity( return _trim_service_metadata(metadata, content=content) # type: ignore @distributed_trace - def update_entity( - self, - entity, # type: EntityType - mode=UpdateMode.MERGE, # type: UpdateMode - **kwargs # type: Any - ): - # type: (...) -> Dict[str,str] + def update_entity(self, entity: EntityType, mode: UpdateMode = UpdateMode.MERGE, **kwargs) -> Dict[str, str]: """Update entity in a table. :param entity: The properties for the table entity. @@ -493,10 +446,7 @@ def update_entity( return _trim_service_metadata(metadata, content=content) # type: ignore @distributed_trace - def list_entities( - self, **kwargs # type: Any - ): - # type: (...) -> ItemPaged[TableEntity] + def list_entities(self, **kwargs) -> ItemPaged[TableEntity]: """Lists entities in a table. :keyword int results_per_page: Number of entities returned per service request. @@ -530,12 +480,8 @@ def list_entities( ) @distributed_trace - def query_entities( # pylint: disable=line-too-long - self, - query_filter, - **kwargs - ): - # type: (str, Dict[str, Any]) -> ItemPaged[TableEntity] + def query_entities(self, query_filter: str, **kwargs) -> ItemPaged[TableEntity]: + # pylint: disable=line-too-long """Lists entities in a table. :param str query_filter: Specify a filter to return certain entities. For more information @@ -559,9 +505,7 @@ def query_entities( # pylint: disable=line-too-long :caption: Query entities held within a table """ parameters = kwargs.pop("parameters", None) - query_filter = _parameter_filter_substitution( - parameters, query_filter # type: ignore - ) + query_filter = _parameter_filter_substitution(parameters, query_filter) # type: ignore top = kwargs.pop("results_per_page", None) user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): @@ -578,13 +522,7 @@ def query_entities( # pylint: disable=line-too-long ) @distributed_trace - def get_entity( - self, - partition_key, # type: str - row_key, # type: str - **kwargs # type: Any - ): - # type: (...) -> TableEntity + def get_entity(self, partition_key: str, row_key: str, **kwargs) -> TableEntity: """Get a single entity in a table. :param partition_key: The partition key of the entity. @@ -622,13 +560,7 @@ def get_entity( return _convert_to_entity(entity) @distributed_trace - def upsert_entity( - self, - entity, # type: EntityType - mode=UpdateMode.MERGE, # type: UpdateMode - **kwargs # type: Any - ): - # type: (...) -> Dict[str,str] + def upsert_entity(self, entity: EntityType, mode: UpdateMode = UpdateMode.MERGE, **kwargs) -> Dict[str, str]: """Update/Merge or Insert entity into table. :param entity: The properties for the table entity. @@ -684,11 +616,8 @@ def upsert_entity( return _trim_service_metadata(metadata, content=content) # type: ignore def submit_transaction( - self, - operations, # type: Iterable[TransactionOperationType] - **kwargs # type: Any - ): - # type: (...) -> List[Mapping[str, Any]] + self, operations: Iterable[TransactionOperationType], **kwargs + ) -> List[Mapping[str, Any]]: """Commit a list of operations as a single transaction. If any one of these operations fails, the entire transaction will be rejected. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py index 29c1ad5bc108..fad8b47b0a09 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- import functools -from typing import Any, Dict, TYPE_CHECKING +from typing import Dict from azure.core.exceptions import HttpResponseError, ResourceExistsError from azure.core.paging import ItemPaged from azure.core.tracing.decorator import distributed_trace @@ -24,9 +24,6 @@ from ._table_client import TableClient from ._serialize import _parameter_filter_substitution -if TYPE_CHECKING: - from ._models import TableCorsRule, TableMetrics, TableAnalyticsLogging - class TableServiceClient(TablesBaseClient): """A client to interact with the Table Service at the account level. @@ -71,16 +68,14 @@ class TableServiceClient(TablesBaseClient): :caption: Authenticating a TableServiceClient from a Shared Account Key """ - def _format_url(self, hostname): - # type: (str) -> str + def _format_url(self, hostname: str) -> str: """Format the endpoint URL according to the current location mode hostname. """ return "{}://{}{}".format(self.scheme, hostname, self._query_str) @classmethod - def from_connection_string(cls, conn_str, **kwargs): - # type: (str, Any) -> TableServiceClient + def from_connection_string(cls, conn_str: str, **kwargs) -> 'TableServiceClient': """Create TableServiceClient from a connection string. :param str conn_str: A connection string to an Azure Storage or Cosmos account. @@ -102,8 +97,7 @@ def from_connection_string(cls, conn_str, **kwargs): return cls(endpoint, credential=credential, **kwargs) @distributed_trace - def get_service_stats(self, **kwargs): - # type: (Any) -> Dict[str, object] + def get_service_stats(self, **kwargs) -> Dict[str, object]: """Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account. @@ -121,8 +115,7 @@ def get_service_stats(self, **kwargs): return service_stats_deserialize(stats) @distributed_trace - def get_service_properties(self, **kwargs): - # type: (Any) -> Dict[str, object] + def get_service_properties(self, **kwargs) -> Dict[str, object]: """Gets the properties of an account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -142,8 +135,7 @@ def get_service_properties(self, **kwargs): return service_properties_deserialize(service_props) @distributed_trace - def set_service_properties(self, **kwargs): - # type: (Any) -> None + def set_service_properties(self, **kwargs) -> None: """Sets properties for an account's Table service endpoint, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -178,8 +170,7 @@ def set_service_properties(self, **kwargs): raise @distributed_trace - def create_table(self, table_name, **kwargs): - # type: (str, Any) -> TableClient + def create_table(self, table_name: str, **kwargs) -> TableClient: """Creates a new table under the current account. :param table_name: The Table name. @@ -202,8 +193,7 @@ def create_table(self, table_name, **kwargs): return table @distributed_trace - def create_table_if_not_exists(self, table_name, **kwargs): - # type: (str, Any) -> TableClient + def create_table_if_not_exists(self, table_name: str, **kwargs) -> TableClient: """Creates a new table if it does not currently exist. If the table currently exists, the current table is returned. @@ -231,8 +221,7 @@ def create_table_if_not_exists(self, table_name, **kwargs): return table @distributed_trace - def delete_table(self, table_name, **kwargs): - # type: (str, Any) -> None + def delete_table(self, table_name: str, **kwargs) -> None: """Deletes the table under the current account. No error will be raised if the given table is not found. @@ -255,8 +244,7 @@ def delete_table(self, table_name, **kwargs): table.delete_table(**kwargs) @distributed_trace - def query_tables(self, query_filter, **kwargs): - # type: (str, Any) -> ItemPaged[TableItem] + def query_tables(self, query_filter: str, **kwargs) -> ItemPaged[TableItem]: """Queries tables under the given account. :param str query_filter: Specify a filter to return certain tables. @@ -291,8 +279,7 @@ def query_tables(self, query_filter, **kwargs): ) @distributed_trace - def list_tables(self, **kwargs): - # type: (Any) -> ItemPaged[TableItem] + def list_tables(self, **kwargs) -> ItemPaged[TableItem]: """Queries tables under the given account. :keyword int results_per_page: Number of tables per page in returned ItemPaged @@ -318,8 +305,7 @@ def list_tables(self, **kwargs): page_iterator_class=TablePropertiesPaged, ) - def get_table_client(self, table_name, **kwargs): - # type: (str, Any) -> TableClient + def get_table_client(self, table_name: str, **kwargs) -> TableClient: """Get a client to interact with the specified table. The table need not already exist. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py index e948754c4250..5de2962c1ca2 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py @@ -3,9 +3,11 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from typing import Union, Any, TYPE_CHECKING +from datetime import datetime +from typing import Union +from azure.core.credentials import AzureNamedKeyCredential -from ._models import AccountSasPermissions +from ._models import AccountSasPermissions, ResourceTypes from ._common_conversion import _sign_string from ._error import _validate_not_none from ._constants import X_MS_VERSION @@ -15,20 +17,14 @@ QueryStringConstants, ) -if TYPE_CHECKING: - from datetime import datetime - from azure.core.credentials import AzureNamedKeyCredential - from ._models import ResourceTypes - def generate_account_sas( - credential, # type: AzureNamedKeyCredential - resource_types, # type: ResourceTypes - permission, # type: Union[str, AccountSasPermissions] - expiry, # type: Union[datetime, str] - **kwargs # type: Any -): - # type: (...) -> str + credential: AzureNamedKeyCredential, + resource_types: ResourceTypes, + permission: Union[str, AccountSasPermissions], + expiry: Union[datetime, str], + **kwargs +) -> str: """ Generates a shared access signature for the table service. Use the returned signature with the sas_token parameter of TableService. @@ -88,8 +84,7 @@ def generate_account_sas( ) -def generate_table_sas(credential, table_name, **kwargs): - # type: (AzureNamedKeyCredential, str, **Any) -> str +def generate_table_sas(credential: AzureNamedKeyCredential, table_name: str, **kwargs) -> str: """ Generates a shared access signature for the table service. Use the returned signature with the sas_token parameter of TableService. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_authentication_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_authentication_async.py index a47bd9d2583a..79d7532a86f9 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_authentication_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_authentication_async.py @@ -3,18 +3,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +from typing import Any -from typing import TYPE_CHECKING - +from azure.core.credentials_async import AsyncTokenCredential +from azure.core.pipeline import PipelineResponse, PipelineRequest from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy from .._authentication import _HttpChallenge -if TYPE_CHECKING: - from typing import Any - from azure.core.credentials_async import AsyncTokenCredential - from azure.core.pipeline import PipelineResponse, PipelineRequest # pylint: disable=ungrouped-imports - class AsyncBearerTokenChallengePolicy(AsyncBearerTokenCredentialPolicy): """Adds a bearer token Authorization header to requests, for the tenant provided in authentication challenges. @@ -23,7 +19,7 @@ class AsyncBearerTokenChallengePolicy(AsyncBearerTokenCredentialPolicy): authentication challenges. :param credential: The credential. - :type credential: ~azure.core.TokenCredential + :type credential: ~azure.core.AsyncTokenCredential :param str scopes: Lets you specify the type of access needed. :keyword bool discover_tenant: Determines if tenant discovery should be enabled. Defaults to True. :keyword bool discover_scopes: Determines if scopes from authentication challenges should be provided to token @@ -33,17 +29,17 @@ class AsyncBearerTokenChallengePolicy(AsyncBearerTokenCredentialPolicy): def __init__( self, - credential: "AsyncTokenCredential", + credential: AsyncTokenCredential, *scopes: str, discover_tenant: bool = True, discover_scopes: bool = True, - **kwargs: "Any" + **kwargs ) -> None: self._discover_tenant = discover_tenant self._discover_scopes = discover_scopes super().__init__(credential, *scopes, **kwargs) - async def on_challenge(self, request: "PipelineRequest", response: "PipelineResponse") -> bool: + async def on_challenge(self, request: PipelineRequest, response: PipelineResponse) -> bool: """Authorize request according to an authentication challenge This method is called when the resource provider responds 401 with a WWW-Authenticate header. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py index c8c28e38c182..fc3d3158b08e 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py @@ -3,11 +3,11 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - -from typing import Any, List, Mapping, Optional, Union, TYPE_CHECKING +from typing import Any, List, Mapping, Optional, Union from uuid import uuid4 from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential +from azure.core.credentials_async import AsyncTokenCredential from azure.core.pipeline.policies import ( ContentDecodePolicy, AsyncRedirectPolicy, @@ -34,15 +34,12 @@ RequestTooLargeError, TableTransactionError, _decode_error, - _validate_tablename_error + _validate_tablename_error, ) from .._policies import StorageHosts, StorageHeadersPolicy from .._sdk_moniker import SDK_MONIKER from ._policies_async import AsyncTablesRetryPolicy -if TYPE_CHECKING: - from azure.core.credentials_async import AsyncTokenCredential - class AsyncTablesBaseClient(AccountHostsMixin): """Base class for TableClient @@ -51,22 +48,22 @@ class AsyncTablesBaseClient(AccountHostsMixin): :keyword credential: The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), - AzureSasCredential (azure-core), or TokenCredentials from azure-identity. + AzureSasCredential (azure-core), or AsyncTokenCredential from azure-identity. :paramtype credential: :class:`~azure.core.credentials.AzureNamedKeyCredential` or :class:`~azure.core.credentials.AzureSasCredential` or - :class:`~azure.core.credentials.TokenCredential` + :class:`~azure.core.credentials.AsyncTokenCredential` :keyword api_version: Specifies the version of the operation to use for this request. Default value is "2019-02-02". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( # pylint: disable=missing-client-constructor-parameter-credential + def __init__( # pylint: disable=missing-client-constructor-parameter-credential self, endpoint: str, *, - credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, "AsyncTokenCredential"]] = None, - **kwargs: Any + credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, AsyncTokenCredential]] = None, + **kwargs ) -> None: super(AsyncTablesBaseClient, self).__init__(endpoint, credential=credential, **kwargs) # type: ignore self._client = AzureTable( @@ -74,8 +71,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential policies=kwargs.pop('policies', self._policies), **kwargs ) - self._client._config.version = get_api_version(kwargs, self._client._config.version) # pylint: disable=protected-access - + self._client._config.version = get_api_version(kwargs, self._client._config.version) # type: ignore # pylint: disable=protected-access async def __aenter__(self): await self._client.__aenter__() @@ -90,18 +86,19 @@ async def close(self) -> None: """ await self._client.close() - def _configure_credential(self, credential): - # type: (Any) -> None + def _configure_credential( + self, credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, AsyncTokenCredential]] + ) -> None: if hasattr(credential, "get_token"): - self._credential_policy = AsyncBearerTokenChallengePolicy( # type: ignore - credential, STORAGE_OAUTH_SCOPE + self._credential_policy = AsyncBearerTokenChallengePolicy( + credential, STORAGE_OAUTH_SCOPE # type: ignore ) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential # type: ignore elif isinstance(credential, AzureSasCredential): - self._credential_policy = AzureSasCredentialPolicy(credential) # type: ignore + self._credential_policy = AzureSasCredentialPolicy(credential) # type: ignore elif isinstance(credential, AzureNamedKeyCredential): - self._credential_policy = SharedKeyCredentialPolicy(credential) # type: ignore + self._credential_policy = SharedKeyCredentialPolicy(credential) # type: ignore elif credential is not None: raise TypeError("Unsupported credential: {}".format(credential)) @@ -122,7 +119,7 @@ def _configure_policies(self, **kwargs): HttpLoggingPolicy(**kwargs), ] - async def _batch_send(self, table_name: str, *reqs: "HttpRequest", **kwargs) -> List[Mapping[str, Any]]: + async def _batch_send(self, table_name: str, *reqs: HttpRequest, **kwargs) -> List[Mapping[str, Any]]: """Given a series of request, do a Storage batch call.""" # Pop it here, so requests doesn't feel bad about additional kwarg policies = [StorageHeadersPolicy()] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py index 62011bd72d8e..e87654abe528 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py @@ -74,7 +74,7 @@ def configure_retries(self, options): :param options: keyword arguments from context. :return: A dict containing settings and history for retries. - :rtype: dict + :rtype: Dict """ config = super(AsyncTablesRetryPolicy, self).configure_retries(options) config["retry_secondary"] = options.pop("retry_to_secondary", self.retry_to_secondary) @@ -88,7 +88,7 @@ def update_context(self, context, retry_settings): :param context: The pipeline context. :type context: ~azure.core.pipeline.PipelineContext :param retry_settings: The retry settings. - :type retry_settings: dict + :type retry_settings: Dict """ super(AsyncTablesRetryPolicy, self).update_context(context, retry_settings) context['location_mode'] = retry_settings['mode'] @@ -97,7 +97,7 @@ def update_request(self, request, retry_settings): # pylint: disable=no-self-us """Updates the pipeline request before attempting to retry. :param PipelineRequest request: The outgoing request. - :param dict(str, Any) retry_settings: The current retry context settings. + :param Dict(str, Any) retry_settings: The current retry context settings. """ set_next_host_location(retry_settings, request) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py index deec321fee5e..ca44f52b0a18 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from typing import Dict, Any, Optional, Union, TYPE_CHECKING +from typing import Dict, Any, Optional, Union from azure.core import MatchConditions @@ -15,13 +15,11 @@ _get_match_headers, _add_entity_properties, ) +from .._generated import models from .._generated.aio import AzureTable from .._generated.aio._configuration import AzureTableConfiguration from .._generated._serialization import Serializer, Deserializer -if TYPE_CHECKING: - from .._generated import models - class TableBatchOperations(object): """ @@ -43,7 +41,7 @@ def __init__( config: AzureTableConfiguration, table_name: str, is_cosmos_endpoint: bool = False, - **kwargs: Dict[str, Any] + **kwargs ) -> None: self._client = client self._serialize = serializer @@ -114,9 +112,9 @@ def _batch_create_entity( entity: EntityType, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - response_preference: Optional[Union[str, "models.ResponseFormat"]] = "return-no-content", - format: Optional[Union[str, "models.OdataMetadataFormat"]] = None, # pylint: disable=redefined-builtin - **kwargs: Any + response_preference: Optional[Union[str, models.ResponseFormat]] = "return-no-content", + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin + **kwargs ) -> None: """ Adds an insert operation to the batch. See @@ -131,7 +129,7 @@ def _batch_create_entity( :param: entity: The entity to insert. Can be a dict or an entity object Must contain a PartitionKey and a RowKey. - :type: entity: dict or :class:`~azure.data.tables.models.Entity` + :type: entity: Dict or :class:`~azure.data.tables.models.Entity` :param timeout: The timeout parameter is expressed in seconds. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -209,7 +207,7 @@ def update( self, entity: EntityType, mode: Union[str, UpdateMode] = UpdateMode.MERGE, - **kwargs: Any + **kwargs ) -> None: """Adds an update operation to the current batch. @@ -281,8 +279,8 @@ def _batch_update_entity( request_id_parameter: Optional[str] = None, if_match: Optional[str] = None, table_entity_properties: Optional[EntityType] = None, - format: Optional[Union[str, "models.OdataMetadataFormat"]] = None, # pylint: disable=redefined-builtin - **kwargs: Any + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin + **kwargs ) -> None: """Update entity in a table. @@ -303,7 +301,7 @@ def _batch_update_entity( is found to update and a replace will be performed if an existing entity is found. :type if_match: str :param table_entity_properties: The properties for the table entity. - :type table_entity_properties: dict[str, object] + :type table_entity_properties: Dict[str, object] :param format: Specifies the media type for the response. Known values are: "application/json;odata=nometadata", "application/json;odata=minimalmetadata", and "application/json;odata=fullmetadata". @@ -383,7 +381,7 @@ def _batch_merge_entity( request_id_parameter: Optional[str] = None, if_match: Optional[str] = None, table_entity_properties: Optional[EntityType] = None, - format: Optional[Union[str, "models.OdataMetadataFormat"]] = None, # pylint: disable=redefined-builtin + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin **kwargs ) -> None: """Merge entity in a table. @@ -405,7 +403,7 @@ def _batch_merge_entity( is found to update and a merge will be performed if an existing entity is found. :type if_match: str :param table_entity_properties: The properties for the table entity. - :type table_entity_properties: dict[str, object] + :type table_entity_properties: Dict[str, object] :param format: Specifies the media type for the response. Known values are: "application/json;odata=nometadata", "application/json;odata=minimalmetadata", and "application/json;odata=fullmetadata". @@ -535,7 +533,7 @@ def _batch_delete_entity( if_match: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - format: Optional[Union[str, "models.OdataMetadataFormat"]] = None, # pylint: disable=redefined-builtin + format: Optional[Union[str, models.OdataMetadataFormat]] = None, # pylint: disable=redefined-builtin ) -> None: """Deletes the specified entity in a table. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py index 7f9655df4e13..ed2cc2f5f173 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import functools -from typing import AsyncIterable, List, Union, Any, Optional, Mapping, Iterable, Dict, overload, cast, TYPE_CHECKING +from typing import AsyncIterable, List, Union, Any, Optional, Mapping, Iterable, Dict, overload, cast try: from urllib.parse import urlparse, unquote except ImportError: @@ -13,6 +13,7 @@ from azure.core import MatchConditions from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential +from azure.core.credentials_async import AsyncTokenCredential from azure.core.async_paging import AsyncItemPaged from azure.core.exceptions import HttpResponseError from azure.core.tracing.decorator import distributed_trace @@ -21,9 +22,13 @@ from .._base_client import parse_connection_str from .._entity import TableEntity from .._generated.models import SignedIdentifier, TableProperties -from .._models import TableAccessPolicy, TableItem -from .._serialize import serialize_iso, _parameter_filter_substitution, _prepare_key -from .._deserialize import deserialize_iso, _return_headers_and_deserialized +from .._models import TableAccessPolicy, TableItem, UpdateMode +from .._serialize import( + serialize_iso, _parameter_filter_substitution, _prepare_key, _add_entity_properties, _get_match_headers +) +from .._deserialize import( + deserialize_iso, _return_headers_and_deserialized, _convert_to_entity, _trim_service_metadata +) from .._error import ( _decode_error, _process_table_error, @@ -31,17 +36,11 @@ _reraise_error, _validate_tablename_error ) -from .._models import UpdateMode -from .._deserialize import _convert_to_entity, _trim_service_metadata -from .._serialize import _add_entity_properties, _get_match_headers from .._table_client import EntityType, TransactionOperationType from ._base_client_async import AsyncTablesBaseClient from ._models import TableEntityPropertiesPaged from ._table_batch_async import TableBatchOperations -if TYPE_CHECKING: - from azure.core.credentials_async import AsyncTokenCredential - class TableClient(AsyncTablesBaseClient): """A client to interact with a specific Table in an Azure Tables account. @@ -51,12 +50,12 @@ class TableClient(AsyncTablesBaseClient): :ivar str url: The full URL to the Tables account. """ - def __init__( # pylint: disable=missing-client-constructor-parameter-credential + def __init__( # pylint: disable=missing-client-constructor-parameter-credential self, endpoint: str, table_name: str, *, - credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, "AsyncTokenCredential"]] = None, + credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, AsyncTokenCredential]] = None, **kwargs ) -> None: """Create TableClient from a Credential. @@ -66,11 +65,11 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential :keyword credential: The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), - AzureSasCredential (azure-core), or TokenCredentials from azure-identity. + AzureSasCredential (azure-core), or AsyncTokenCredential from azure-identity. :paramtype credential: :class:`~azure.core.credentials.AzureNamedKeyCredential` or :class:`~azure.core.credentials.AzureSasCredential` or - :class:`~azure.core.credentials.TokenCredential` + :class:`~azure.core.credentials.AsyncTokenCredential` :keyword api_version: Specifies the version of the operation to use for this request. Default value is "2019-02-02". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -111,17 +110,17 @@ def from_connection_string( :dedent: 8 :caption: Creating the TableClient from a connection string. """ - endpoint, credential = parse_connection_str( - conn_str=conn_str, credential=None, keyword_args=kwargs - ) + endpoint, credential = parse_connection_str(conn_str=conn_str, credential=None, keyword_args=kwargs) return cls(endpoint, table_name=table_name, credential=credential, **kwargs) @classmethod def from_table_url( cls, table_url: str, + *, + credential: Optional[Union[AzureNamedKeyCredential, AzureSasCredential]] = None, **kwargs - ) -> 'TableClient': + ) -> "TableClient": """A client to interact with a specific Table. :param str table_url: The full URI to the table, including SAS token if used. @@ -162,7 +161,7 @@ def from_table_url( raise ValueError( "Invalid URL. Please provide a URL with a valid table name" ) - return cls(endpoint, table_name=table_name, **kwargs) + return cls(endpoint, table_name=table_name, credential=credential, **kwargs) @distributed_trace_async async def get_table_access_policy(self, **kwargs) -> Mapping[str, Optional[TableAccessPolicy]]: @@ -289,15 +288,15 @@ async def delete_table(self, **kwargs) -> None: raise @overload - async def delete_entity(self, partition_key: str, row_key: str, **kwargs: Any) -> None: + async def delete_entity(self, partition_key: str, row_key: str, **kwargs) -> None: ... @overload - async def delete_entity(self, entity: Union[TableEntity, Mapping[str, Any]], **kwargs: Any) -> None: + async def delete_entity(self, entity: Union[TableEntity, Mapping[str, Any]], **kwargs) -> None: ... @distributed_trace_async - async def delete_entity(self, *args: Union[TableEntity, str], **kwargs: Any) -> None: + async def delete_entity(self, *args: Union[TableEntity, str], **kwargs) -> None: """Deletes the specified entity in a table. No error will be raised if the entity or PartitionKey-RowKey pairing is not found. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py index 77c12d0f4789..fbd7df3b7434 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py @@ -4,12 +4,7 @@ # license information. # -------------------------------------------------------------------------- import functools -from typing import ( - Optional, - Dict, - List, - TYPE_CHECKING -) +from typing import Optional, Dict, List from azure.core.async_paging import AsyncItemPaged from azure.core.exceptions import HttpResponseError, ResourceExistsError @@ -21,15 +16,12 @@ from .._generated.models import TableServiceProperties from .._models import service_stats_deserialize, service_properties_deserialize from .._error import _process_table_error, _reprocess_error -from .._models import TableItem, LocationMode +from .._models import TableItem, LocationMode, TableCorsRule, TableMetrics, TableAnalyticsLogging from .._serialize import _parameter_filter_substitution from ._table_client_async import TableClient from ._base_client_async import AsyncTablesBaseClient, AsyncTransportWrapper from ._models import TablePropertiesPaged -if TYPE_CHECKING: - from .._models import TableCorsRule, TableMetrics, TableAnalyticsLogging - class TableServiceClient(AsyncTablesBaseClient): """A client to interact with the Table Service at the account level. @@ -48,11 +40,11 @@ class TableServiceClient(AsyncTablesBaseClient): :keyword credential: The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), - AzureSasCredential (azure-core), or TokenCredentials from azure-identity. + AzureSasCredential (azure-core), or AsyncTokenCredential from azure-identity. :paramtype credential: :class:`~azure.core.credentials.AzureNamedKeyCredential` or :class:`~azure.core.credentials.AzureSasCredential` or - :class:`~azure.core.credentials.TokenCredential` + :class:`~azure.core.credentials.AsyncTokenCredential` :keyword str api_version: The Storage API version to use for requests. Default value is '2019-02-02'. Setting to an older version may result in reduced feature compatibility. @@ -146,10 +138,10 @@ async def get_service_properties(self, **kwargs) -> Dict[str, object]: async def set_service_properties( self, *, - analytics_logging: Optional['TableAnalyticsLogging'] = None, - hour_metrics: Optional['TableMetrics'] = None, - minute_metrics: Optional['TableMetrics'] = None, - cors: Optional[List['TableCorsRule']] = None, + analytics_logging: Optional[TableAnalyticsLogging] = None, + hour_metrics: Optional[TableMetrics] = None, + minute_metrics: Optional[TableMetrics] = None, + cors: Optional[List[TableCorsRule]] = None, **kwargs ) -> None: """Sets properties for an account's Table service endpoint, diff --git a/sdk/tables/azure-data-tables/pyproject.toml b/sdk/tables/azure-data-tables/pyproject.toml new file mode 100644 index 000000000000..381c0d9346e5 --- /dev/null +++ b/sdk/tables/azure-data-tables/pyproject.toml @@ -0,0 +1,3 @@ +[tool.azure-sdk-build] +pyright = false +verifytypes = false diff --git a/sdk/template/azure-template/pyproject.toml b/sdk/template/azure-template/pyproject.toml index d355965d8637..9416a0ed3849 100644 --- a/sdk/template/azure-template/pyproject.toml +++ b/sdk/template/azure-template/pyproject.toml @@ -1,2 +1,3 @@ [tool.azure-sdk-build] +pylint=false verifytypes = false diff --git a/sdk/textanalytics/azure-ai-textanalytics/pyproject.toml b/sdk/textanalytics/azure-ai-textanalytics/pyproject.toml new file mode 100644 index 000000000000..e00361912969 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +pyright = false diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_abstractive_summary_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_abstractive_summary_async.py index c7c962220b36..77e01e71f23f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_abstractive_summary_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_abstractive_summary_async.py @@ -25,13 +25,12 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ - -import os import asyncio async def sample_abstractive_summarization_async() -> None: # [START abstractive_summary_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_alternative_document_input_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_alternative_document_input_async.py index 15ec0fc13cef..3fcfb15be7be 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_alternative_document_input_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_alternative_document_input_async.py @@ -19,11 +19,11 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio async def sample_alternative_document_input() -> None: + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_actions_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_actions_async.py index 9c19a907dc95..c55084edeab2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_actions_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_actions_async.py @@ -21,13 +21,12 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ - -import os import asyncio async def sample_analyze_async() -> None: # [START analyze_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient from azure.ai.textanalytics import ( diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_action_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_action_async.py index fa25d18df5ef..6f70033e5d18 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_action_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_action_async.py @@ -21,12 +21,11 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ - -import os import asyncio async def sample_analyze_healthcare_action() -> None: + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient from azure.ai.textanalytics import ( diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_async.py index b511621901e5..d1504d8b3d1b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_async.py @@ -22,7 +22,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -from __future__ import annotations import asyncio @@ -38,6 +37,7 @@ async def sample_analyze_healthcare_entities_async() -> None: # [START analyze_healthcare_entities_async] import os + import typing from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import HealthcareEntityRelation from azure.ai.textanalytics.aio import TextAnalyticsClient @@ -106,7 +106,7 @@ async def sample_analyze_healthcare_entities_async() -> None: import re from collections import defaultdict - medication_to_dosage: dict[str, int] = defaultdict(int) + medication_to_dosage: typing.Dict[str, int] = defaultdict(int) for relation in dosage_of_medication_relations: # The DosageOfMedication relation should only contain the dosage and medication roles diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_with_cancellation_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_with_cancellation_async.py index 74d9fbdd4082..3164a7a30910 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_with_cancellation_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_with_cancellation_async.py @@ -18,14 +18,13 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ - -import os import asyncio -from azure.core.exceptions import HttpResponseError async def sample_analyze_healthcare_entities_with_cancellation_async() -> None: # [START analyze_healthcare_entities_with_cancellation_async] + import os + from azure.core.exceptions import HttpResponseError from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_async.py index a198c5181c2a..3fc813635d45 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_async.py @@ -23,7 +23,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio @@ -37,6 +36,7 @@ async def sample_analyze_sentiment_async() -> None: "positive, so we can display them on our website and get even more customers!" ) # [START analyze_sentiment_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_with_opinion_mining_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_with_opinion_mining_async.py index 24cef2044ab7..def16d04e933 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_with_opinion_mining_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_with_opinion_mining_async.py @@ -42,13 +42,12 @@ Looking at the breakdown, I can see what aspects of my hotel need improvement, and based off of both the number and content of the complaints users have made about my toilets, I need to get that fixed ASAP. """ -from __future__ import annotations -import os import asyncio -import typing async def sample_analyze_sentiment_with_opinion_mining() -> None: + import os + import typing from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient @@ -104,7 +103,7 @@ async def sample_analyze_sentiment_with_opinion_mining() -> None: "\nIn order to do that, I'm going to extract the targets of a negative sentiment. " "I'm going to map each of these targets to the mined opinion object we get back to aggregate the reviews by target. " ) - target_to_complaints: dict[str, typing.Any] = {} + target_to_complaints: typing.Dict[str, typing.Any] = {} for document in doc_result: for sentence in document.sentences: diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py index d312a136341a..5fd0a7252b2d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py @@ -28,13 +28,13 @@ 5) AZURE_CLIENT_SECRET - the secret of your active directory application. """ -import os import asyncio async def sample_authentication_with_api_key_credential_async() -> None: print("\n.. authentication_with_api_key_credential_async") # [START create_ta_client_with_key_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"] @@ -62,6 +62,7 @@ async def sample_authentication_with_azure_active_directory_async() -> None: """ print("\n.. authentication_with_azure_active_directory_async") # [START create_ta_client_with_aad_async] + import os from azure.ai.textanalytics.aio import TextAnalyticsClient from azure.identity.aio import DefaultAzureCredential diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_detect_language_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_detect_language_async.py index 5241e5ed0a94..3d741a00f42d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_detect_language_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_detect_language_async.py @@ -23,7 +23,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio @@ -34,6 +33,7 @@ async def sample_detect_language_async() -> None: "they are in for more accurate translation. This is the step we will be covering in this sample\n" ) # [START detect_language_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_dynamic_classification_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_dynamic_classification_async.py index 282f0eb5cbf1..87f7fa5a91f0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_dynamic_classification_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_dynamic_classification_async.py @@ -22,14 +22,12 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ - -from cgitb import text -import os import asyncio async def sample_dynamic_classification_async() -> None: # [START dynamic_classification_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_key_phrases_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_key_phrases_async.py index bed3a7f07b7f..79c1917257bc 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_key_phrases_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_key_phrases_async.py @@ -21,7 +21,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio @@ -29,8 +28,9 @@ async def sample_extract_key_phrases_async() -> None: print( "In this sample, we want to find the articles that mention Microsoft to read." ) - articles_that_mention_microsoft = [] + # [START extract_key_phrases_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient @@ -57,6 +57,7 @@ async def sample_extract_key_phrases_async() -> None: async with text_analytics_client: result = await text_analytics_client.extract_key_phrases(articles) + articles_that_mention_microsoft = [] for idx, doc in enumerate(result): if not doc.is_error: print("Key phrases in article #{}: {}".format( diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_summary_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_summary_async.py index a838ba0b102b..35788ef40274 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_summary_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_summary_async.py @@ -19,13 +19,12 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ - -import os import asyncio async def sample_extractive_summarization_async(): # [START extract_summary_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_get_detailed_diagnostics_information_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_get_detailed_diagnostics_information_async.py index 535fdc3ff44a..b520283fb7b1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_get_detailed_diagnostics_information_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_get_detailed_diagnostics_information_async.py @@ -19,17 +19,16 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio -import logging -import json - -_LOGGER = logging.getLogger(__name__) async def sample_get_detailed_diagnostics_information_async() -> None: + import os + import logging + import json from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient + _LOGGER = logging.getLogger(__name__) endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"] key = os.environ["AZURE_LANGUAGE_KEY"] diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_model_version_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_model_version_async.py index 999b0ccd38c3..7370d2430e91 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_model_version_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_model_version_async.py @@ -24,12 +24,12 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio async def sample_model_version_async() -> None: print("--------------Choosing model_version sample--------------") + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient from azure.ai.textanalytics import RecognizeEntitiesAction diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_multi_label_classify_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_multi_label_classify_async.py index 27dada2a4387..67cc72cc399f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_multi_label_classify_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_multi_label_classify_async.py @@ -26,13 +26,12 @@ 4) MULTI_LABEL_CLASSIFY_DEPLOYMENT_NAME - your Language Studio deployment name """ - -import os import asyncio async def sample_classify_document_multi_label_async() -> None: # [START multi_label_classify_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_custom_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_custom_entities_async.py index 7ca621a295e8..4e708b1d2df9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_custom_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_custom_entities_async.py @@ -24,13 +24,12 @@ 4) CUSTOM_ENTITIES_DEPLOYMENT_NAME - your Language deployed model name """ - -import os import asyncio async def sample_recognize_custom_entities_async() -> None: # [START recognize_custom_entities_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_entities_async.py index 820425ad2de0..ba7c87cabf6b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_entities_async.py @@ -20,8 +20,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -from __future__ import annotations -import os import asyncio @@ -30,8 +28,10 @@ async def sample_recognize_entities_async() -> None: "In this sample, we are a catering business, and we're looking to sort the reviews " "for our organization based off of the organization that hired us for catering" ) - organization_to_reviews: dict[str, list[str]] = {} + # [START recognize_entities_async] + import os + import typing from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient @@ -52,11 +52,12 @@ async def sample_recognize_entities_async() -> None: result = await text_analytics_client.recognize_entities(reviews) result = [review for review in result if not review.is_error] + organization_to_reviews: typing.Dict[str, list[str]] = {} for idx, review in enumerate(result): for entity in review.entities: print(f"Entity '{entity.text}' has category '{entity.category}'") - # [END recognize_entities_async] + if entity.category == 'Organization': organization_to_reviews.setdefault(entity.text, []) organization_to_reviews[entity.text].append(reviews[idx]) @@ -67,6 +68,7 @@ async def sample_recognize_entities_async() -> None: organization, "\n\n".join(reviews) ) ) + # [END recognize_entities_async] async def main(): diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_linked_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_linked_entities_async.py index f4d8f2b4d332..5c36a947e841 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_linked_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_linked_entities_async.py @@ -24,7 +24,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio @@ -35,6 +34,7 @@ async def sample_recognize_linked_entities_async() -> None: "all of the necessary information for research purposes." ) # [START recognize_linked_entities_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_pii_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_pii_entities_async.py index afd671ed796c..cb443ad66733 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_pii_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_pii_entities_async.py @@ -24,7 +24,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os import asyncio @@ -36,6 +35,7 @@ async def sample_recognize_pii_entities_async() -> None: "our customers" ) # [START recognize_pii_entities_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_single_label_classify_async.py b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_single_label_classify_async.py index e367b5709244..5975e77308b0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_single_label_classify_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_single_label_classify_async.py @@ -26,13 +26,12 @@ 4) SINGLE_LABEL_CLASSIFY_DEPLOYMENT_NAME - your Language Studio deployment name """ - -import os import asyncio async def sample_classify_document_single_label_async() -> None: # [START single_label_classify_async] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics.aio import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_abstractive_summary.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_abstractive_summary.py index 26f54498404b..7e623ec3b888 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_abstractive_summary.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_abstractive_summary.py @@ -26,11 +26,9 @@ """ -import os - - def sample_abstractive_summarization() -> None: # [START abstractive_summary] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_alternative_document_input.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_alternative_document_input.py index 7f62550cd7f5..03bfe1c56ca9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_alternative_document_input.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_alternative_document_input.py @@ -19,10 +19,9 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os - def sample_alternative_document_input() -> None: + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_actions.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_actions.py index ed37b67fcc38..727e18aaa673 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_actions.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_actions.py @@ -22,11 +22,9 @@ """ -import os - - def sample_analyze_actions() -> None: # [START analyze] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import ( TextAnalyticsClient, diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_action.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_action.py index 1ea87dd493d5..319485346b87 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_action.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_action.py @@ -22,10 +22,8 @@ """ -import os - - def sample_analyze_healthcare_action() -> None: + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import ( TextAnalyticsClient, diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities.py index a9422f356f77..949f193de044 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities.py @@ -22,8 +22,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -from __future__ import annotations - def sample_analyze_healthcare_entities() -> None: @@ -37,6 +35,7 @@ def sample_analyze_healthcare_entities() -> None: # [START analyze_healthcare_entities] import os + import typing from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient, HealthcareEntityRelation @@ -104,7 +103,7 @@ def sample_analyze_healthcare_entities() -> None: import re from collections import defaultdict - medication_to_dosage: dict[str, int] = defaultdict(int) + medication_to_dosage: typing.Dict[str, int] = defaultdict(int) for relation in dosage_of_medication_relations: # The DosageOfMedication relation should only contain the dosage and medication roles diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities_with_cancellation.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities_with_cancellation.py index 8e1127ebd7e3..443cf0e2e3e8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities_with_cancellation.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities_with_cancellation.py @@ -19,12 +19,10 @@ """ -import os -from azure.core.exceptions import HttpResponseError - - def sample_analyze_healthcare_entities_with_cancellation() -> None: # [START analyze_healthcare_entities_with_cancellation] + import os + from azure.core.exceptions import HttpResponseError from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment.py index ec6fb5dd23f8..e3503d5e34b1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment.py @@ -23,8 +23,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os - def sample_analyze_sentiment() -> None: print( @@ -37,6 +35,7 @@ def sample_analyze_sentiment() -> None: ) # [START analyze_sentiment] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment_with_opinion_mining.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment_with_opinion_mining.py index b6c11f094cd0..310de7b68f4c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment_with_opinion_mining.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment_with_opinion_mining.py @@ -42,12 +42,10 @@ Looking at the breakdown, I can see what aspects of my hotel need improvement, and based off of both the number and content of the complaints users have made about my toilets, I need to get that fixed ASAP. """ -from __future__ import annotations -import os -import typing - def sample_analyze_sentiment_with_opinion_mining() -> None: + import os + import typing from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient @@ -102,7 +100,7 @@ def sample_analyze_sentiment_with_opinion_mining() -> None: "\nIn order to do that, I'm going to extract targets of a negative sentiment. " "I'm going to map each of these targets to the mined opinion object we get back to aggregate the reviews by target. " ) - target_to_complaints: dict[str, typing.Any] = {} + target_to_complaints: typing.Dict[str, typing.Any] = {} for document in doc_result: for sentence in document.sentences: diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_authentication.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_authentication.py index 6fe057ffc574..7f91c8106fc9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_authentication.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_authentication.py @@ -28,12 +28,11 @@ 5) AZURE_CLIENT_SECRET - the secret of your active directory application. """ -import os - def sample_authentication_with_api_key_credential() -> None: print("\n.. authentication_with_api_key_credential") # [START create_ta_client_with_key] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"] @@ -59,6 +58,7 @@ def sample_authentication_with_azure_active_directory() -> None: """ print("\n.. authentication_with_azure_active_directory") # [START create_ta_client_with_aad] + import os from azure.ai.textanalytics import TextAnalyticsClient from azure.identity import DefaultAzureCredential diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_detect_language.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_detect_language.py index 20bb26a96476..b812b6414cc7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_detect_language.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_detect_language.py @@ -23,8 +23,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os - def sample_detect_language() -> None: print( @@ -33,6 +31,7 @@ def sample_detect_language() -> None: "they are in for more accurate translation. This is the step we will be covering in this sample\n" ) # [START detect_language] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_dynamic_classification.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_dynamic_classification.py index f2e11c54f648..427b32fdaf7a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_dynamic_classification.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_dynamic_classification.py @@ -23,11 +23,9 @@ """ -import os - - def sample_dynamic_classification() -> None: # [START dynamic_classification] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_key_phrases.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_key_phrases.py index 7d0be86ace15..5a05294afd9b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_key_phrases.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_key_phrases.py @@ -21,8 +21,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os - def sample_extract_key_phrases() -> None: print( @@ -30,6 +28,7 @@ def sample_extract_key_phrases() -> None: ) articles_that_mention_microsoft = [] # [START extract_key_phrases] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_summary.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_summary.py index a8f718a1a157..e73c9738f567 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_summary.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_summary.py @@ -20,11 +20,9 @@ """ -import os - - def sample_extractive_summarization(): # [START extract_summary] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_get_detailed_diagnostics_information.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_get_detailed_diagnostics_information.py index a9c072bbf673..f61846887e64 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_get_detailed_diagnostics_information.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_get_detailed_diagnostics_information.py @@ -19,16 +19,14 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os -import logging -import json - -_LOGGER = logging.getLogger(__name__) - def sample_get_detailed_diagnostics_information() -> None: + import os + import logging + import json from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient + _LOGGER = logging.getLogger(__name__) endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"] key = os.environ["AZURE_LANGUAGE_KEY"] diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_model_version.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_model_version.py index 86ee30b4d30c..65bc2fb39ab7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_model_version.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_model_version.py @@ -24,11 +24,10 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os - def sample_model_version() -> None: print("--------------Choosing model_version sample--------------") + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient, RecognizeEntitiesAction diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_multi_label_classify.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_multi_label_classify.py index 591c1edc6bb4..7ac98fbfc719 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_multi_label_classify.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_multi_label_classify.py @@ -27,11 +27,9 @@ """ -import os - - def sample_classify_document_multi_label() -> None: # [START multi_label_classify] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_custom_entities.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_custom_entities.py index 33706ccd8377..2b2367103d0f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_custom_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_custom_entities.py @@ -25,11 +25,9 @@ """ -import os - - def sample_recognize_custom_entities() -> None: # [START recognize_custom_entities] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_entities.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_entities.py index 7ed7b35aa056..b0016e66847d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_entities.py @@ -20,17 +20,16 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -from __future__ import annotations -import os - def sample_recognize_entities() -> None: print( "In this sample, we are a catering business, and we're looking to sort the reviews " "for our organization based off of the organization that hired us for catering" ) - organization_to_reviews: dict[str, list[str]] = {} + # [START recognize_entities] + import os + import typing from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient @@ -49,11 +48,11 @@ def sample_recognize_entities() -> None: result = text_analytics_client.recognize_entities(reviews) result = [review for review in result if not review.is_error] + organization_to_reviews: typing.Dict[str, list[str]] = {} for idx, review in enumerate(result): for entity in review.entities: print(f"Entity '{entity.text}' has category '{entity.category}'") - # [END recognize_entities] if entity.category == 'Organization': organization_to_reviews.setdefault(entity.text, []) organization_to_reviews[entity.text].append(reviews[idx]) @@ -64,6 +63,7 @@ def sample_recognize_entities() -> None: organization, "\n\n".join(reviews) ) ) + # [END recognize_entities] if __name__ == '__main__': diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_linked_entities.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_linked_entities.py index f1645d998342..877b132e25d9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_linked_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_linked_entities.py @@ -24,8 +24,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os - def sample_recognize_linked_entities() -> None: print( @@ -34,6 +32,7 @@ def sample_recognize_linked_entities() -> None: "all of the necessary information for research purposes." ) # [START recognize_linked_entities] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_pii_entities.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_pii_entities.py index d2122b833b81..9fc335ac53a5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_pii_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_pii_entities.py @@ -24,8 +24,6 @@ 2) AZURE_LANGUAGE_KEY - your Language subscription key """ -import os - def sample_recognize_pii_entities() -> None: print( @@ -35,6 +33,7 @@ def sample_recognize_pii_entities() -> None: "our customers" ) # [START recognize_pii_entities] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_single_label_classify.py b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_single_label_classify.py index 134f5984b7b0..394f5450e01c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/samples/sample_single_label_classify.py +++ b/sdk/textanalytics/azure-ai-textanalytics/samples/sample_single_label_classify.py @@ -27,11 +27,9 @@ """ -import os - - def sample_classify_document_single_label() -> None: # [START single_label_classify] + import os from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient diff --git a/sdk/workloads/azure-mgmt-workloads/CHANGELOG.md b/sdk/workloads/azure-mgmt-workloads/CHANGELOG.md index 5d1e7402a4e9..a593f37c59da 100644 --- a/sdk/workloads/azure-mgmt-workloads/CHANGELOG.md +++ b/sdk/workloads/azure-mgmt-workloads/CHANGELOG.md @@ -1,5 +1,53 @@ # Release History +## 1.0.0b3 (2023-02-15) + +### Features Added + + - Added operation SAPApplicationServerInstancesOperations.begin_start_instance + - Added operation SAPApplicationServerInstancesOperations.begin_stop_instance + - Added operation SAPCentralInstancesOperations.begin_start_instance + - Added operation SAPCentralInstancesOperations.begin_stop_instance + - Added operation SAPDatabaseInstancesOperations.begin_start_instance + - Added operation SAPDatabaseInstancesOperations.begin_stop_instance + - Added operation group SapLandscapeMonitorOperations + - Model CentralServerVmDetails has a new parameter storage_details + - Model DatabaseConfiguration has a new parameter disk_configuration + - Model DatabaseVmDetails has a new parameter storage_details + - Model DiscoveryConfiguration has a new parameter managed_rg_storage_account_name + - Model HanaDbProviderInstanceProperties has a new parameter sap_sid + - Model PrometheusOSProviderInstanceProperties has a new parameter sap_sid + - Model SAPApplicationServerInstance has a new parameter load_balancer_details + - Model SAPApplicationServerInstance has a new parameter vm_details + - Model SAPCentralServerInstance has a new parameter load_balancer_details + - Model SAPDatabaseInstance has a new parameter load_balancer_details + - Model SAPDiskConfiguration has a new parameter recommended_configuration + - Model SAPDiskConfiguration has a new parameter supported_configurations + - Model SAPDiskConfigurationsResult has a new parameter volume_configurations + - Model SingleServerConfiguration has a new parameter custom_resource_names + - Model SingleServerConfiguration has a new parameter db_disk_configuration + - Model StopRequest has a new parameter soft_stop_timeout_seconds + - Model ThreeTierConfiguration has a new parameter custom_resource_names + - Model ThreeTierConfiguration has a new parameter storage_configuration + +### Breaking Changes + + - Model HanaDbProviderInstanceProperties no longer has parameter db_ssl_certificate_uri + - Model SAPApplicationServerInstance no longer has parameter virtual_machine_id + - Model SAPDiskConfiguration no longer has parameter disk_count + - Model SAPDiskConfiguration no longer has parameter disk_iops_read_write + - Model SAPDiskConfiguration no longer has parameter disk_m_bps_read_write + - Model SAPDiskConfiguration no longer has parameter disk_size_gb + - Model SAPDiskConfiguration no longer has parameter disk_storage_type + - Model SAPDiskConfiguration no longer has parameter disk_type + - Model SAPDiskConfiguration no longer has parameter volume + - Model SAPDiskConfigurationsResult no longer has parameter disk_configurations + - Model SapNetWeaverProviderInstanceProperties no longer has parameter sap_ssl_certificate_uri + - Model StopRequest no longer has parameter hard_stop + - Removed operation group PhpWorkloadsOperations + - Removed operation group SkusOperations + - Removed operation group WordpressInstancesOperations + ## 1.0.0b2 (2022-11-30) ### Features Added diff --git a/sdk/workloads/azure-mgmt-workloads/README.md b/sdk/workloads/azure-mgmt-workloads/README.md index 22894df446f2..82532ac12249 100644 --- a/sdk/workloads/azure-mgmt-workloads/README.md +++ b/sdk/workloads/azure-mgmt-workloads/README.md @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Workloads Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-workloads +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = WorkloadsClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + + +Code samples for this package can be found at [Workloads Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/workloads/azure-mgmt-workloads/_meta.json b/sdk/workloads/azure-mgmt-workloads/_meta.json index 089d2088cf05..0d67db350625 100644 --- a/sdk/workloads/azure-mgmt-workloads/_meta.json +++ b/sdk/workloads/azure-mgmt-workloads/_meta.json @@ -1,11 +1,11 @@ { - "commit": "2f2e48923cebd95f7d184608a29bcd06d9cb3653", + "commit": "630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/workloads/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/workloads/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/workloads/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py index 44cdf0057074..8f78801309d5 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py @@ -35,14 +35,14 @@ class WorkloadsClientConfiguration(Configuration): # pylint: disable=too-many-i :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(WorkloadsClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-12-01-preview"] = kwargs.pop("api_version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop("api_version", "2022-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py index 2eb4e11d58b3..4e7adcab424f 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py index dfa6ee022f15..20971492f129 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b3" diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py index 3a45b2b43848..ac2e1f2a3f29 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py @@ -18,14 +18,12 @@ from .operations import ( MonitorsOperations, Operations, - PhpWorkloadsOperations, ProviderInstancesOperations, SAPApplicationServerInstancesOperations, SAPCentralInstancesOperations, SAPDatabaseInstancesOperations, SAPVirtualInstancesOperations, - SkusOperations, - WordpressInstancesOperations, + SapLandscapeMonitorOperations, WorkloadsClientOperationsMixin, ) @@ -39,10 +37,6 @@ class WorkloadsClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Workloads client provides access to various workload operations. - :ivar php_workloads: PhpWorkloadsOperations operations - :vartype php_workloads: azure.mgmt.workloads.operations.PhpWorkloadsOperations - :ivar wordpress_instances: WordpressInstancesOperations operations - :vartype wordpress_instances: azure.mgmt.workloads.operations.WordpressInstancesOperations :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations :vartype sap_virtual_instances: azure.mgmt.workloads.operations.SAPVirtualInstancesOperations :ivar sap_central_instances: SAPCentralInstancesOperations operations @@ -52,21 +46,21 @@ class WorkloadsClient( :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations :vartype sap_application_server_instances: azure.mgmt.workloads.operations.SAPApplicationServerInstancesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.workloads.operations.Operations :ivar monitors: MonitorsOperations operations :vartype monitors: azure.mgmt.workloads.operations.MonitorsOperations :ivar provider_instances: ProviderInstancesOperations operations :vartype provider_instances: azure.mgmt.workloads.operations.ProviderInstancesOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.workloads.operations.SkusOperations + :ivar sap_landscape_monitor: SapLandscapeMonitorOperations operations + :vartype sap_landscape_monitor: azure.mgmt.workloads.operations.SapLandscapeMonitorOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloads.operations.Operations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -87,10 +81,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.php_workloads = PhpWorkloadsOperations(self._client, self._config, self._serialize, self._deserialize) - self.wordpress_instances = WordpressInstancesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.sap_virtual_instances = SAPVirtualInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -103,12 +93,14 @@ def __init__( self.sap_application_server_instances = SAPApplicationServerInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) self.provider_instances = ProviderInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_landscape_monitor = SapLandscapeMonitorOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py index 29b3a12ee9e0..9d13abb0e47e 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py @@ -35,14 +35,14 @@ class WorkloadsClientConfiguration(Configuration): # pylint: disable=too-many-i :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(WorkloadsClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-12-01-preview"] = kwargs.pop("api_version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop("api_version", "2022-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py index d86a9e5ec713..969131e9b16d 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py @@ -18,14 +18,12 @@ from .operations import ( MonitorsOperations, Operations, - PhpWorkloadsOperations, ProviderInstancesOperations, SAPApplicationServerInstancesOperations, SAPCentralInstancesOperations, SAPDatabaseInstancesOperations, SAPVirtualInstancesOperations, - SkusOperations, - WordpressInstancesOperations, + SapLandscapeMonitorOperations, WorkloadsClientOperationsMixin, ) @@ -39,10 +37,6 @@ class WorkloadsClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Workloads client provides access to various workload operations. - :ivar php_workloads: PhpWorkloadsOperations operations - :vartype php_workloads: azure.mgmt.workloads.aio.operations.PhpWorkloadsOperations - :ivar wordpress_instances: WordpressInstancesOperations operations - :vartype wordpress_instances: azure.mgmt.workloads.aio.operations.WordpressInstancesOperations :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations :vartype sap_virtual_instances: azure.mgmt.workloads.aio.operations.SAPVirtualInstancesOperations @@ -55,21 +49,22 @@ class WorkloadsClient( :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations :vartype sap_application_server_instances: azure.mgmt.workloads.aio.operations.SAPApplicationServerInstancesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.workloads.aio.operations.Operations :ivar monitors: MonitorsOperations operations :vartype monitors: azure.mgmt.workloads.aio.operations.MonitorsOperations :ivar provider_instances: ProviderInstancesOperations operations :vartype provider_instances: azure.mgmt.workloads.aio.operations.ProviderInstancesOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.workloads.aio.operations.SkusOperations + :ivar sap_landscape_monitor: SapLandscapeMonitorOperations operations + :vartype sap_landscape_monitor: + azure.mgmt.workloads.aio.operations.SapLandscapeMonitorOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloads.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -90,10 +85,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.php_workloads = PhpWorkloadsOperations(self._client, self._config, self._serialize, self._deserialize) - self.wordpress_instances = WordpressInstancesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.sap_virtual_instances = SAPVirtualInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -106,12 +97,14 @@ def __init__( self.sap_application_server_instances = SAPApplicationServerInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) self.provider_instances = ProviderInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_landscape_monitor = SapLandscapeMonitorOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py index 9ec296484c8e..fe951707c6a1 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py @@ -6,34 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._php_workloads_operations import PhpWorkloadsOperations -from ._wordpress_instances_operations import WordpressInstancesOperations from ._workloads_client_operations import WorkloadsClientOperationsMixin from ._sap_virtual_instances_operations import SAPVirtualInstancesOperations from ._sap_central_instances_operations import SAPCentralInstancesOperations from ._sap_database_instances_operations import SAPDatabaseInstancesOperations from ._sap_application_server_instances_operations import SAPApplicationServerInstancesOperations -from ._operations import Operations from ._monitors_operations import MonitorsOperations from ._provider_instances_operations import ProviderInstancesOperations -from ._skus_operations import SkusOperations +from ._sap_landscape_monitor_operations import SapLandscapeMonitorOperations +from ._operations import Operations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PhpWorkloadsOperations", - "WordpressInstancesOperations", "WorkloadsClientOperationsMixin", "SAPVirtualInstancesOperations", "SAPCentralInstancesOperations", "SAPDatabaseInstancesOperations", "SAPApplicationServerInstancesOperations", - "Operations", "MonitorsOperations", "ProviderInstancesOperations", - "SkusOperations", + "SapLandscapeMonitorOperations", + "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py index 55603e3df385..87cf5cb34bde 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py @@ -83,7 +83,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Monitor"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None) @@ -170,7 +170,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None) @@ -271,7 +271,7 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Monitor] = kwargs.pop("cls", None) @@ -324,7 +324,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -490,7 +490,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -554,7 +554,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -624,7 +624,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -769,7 +769,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py index f7be96927c12..7908e8d9556f 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py @@ -70,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py index 95e116c8ffb3..44afb424fac7 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py @@ -88,7 +88,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ProviderInstanceListResult] = kwargs.pop("cls", None) @@ -194,7 +194,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ProviderInstance] = kwargs.pop("cls", None) @@ -253,7 +253,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -436,7 +436,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -501,7 +501,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -575,7 +575,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py index 2eca6e10fb8e..95d5a70a1c5c 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py @@ -36,6 +36,8 @@ build_delete_request, build_get_request, build_list_request, + build_start_instance_request, + build_stop_instance_request, build_update_request, ) from .._vendor import WorkloadsClientMixinABC @@ -99,7 +101,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) @@ -158,7 +160,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -347,7 +349,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -417,7 +419,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -603,7 +605,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -668,7 +670,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -742,7 +744,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -813,7 +815,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPApplicationServerInstanceList] = kwargs.pop("cls", None) @@ -886,3 +888,389 @@ async def get_next(next_link=None): list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances" } + + async def _start_instance_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + @distributed_trace_async + async def begin_start_instance( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + async def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Is either a model type or a IO + type. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py index 72e03de48430..e4fbc3b91764 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py @@ -36,6 +36,8 @@ build_delete_request, build_get_request, build_list_request, + build_start_instance_request, + build_stop_instance_request, build_update_request, ) from .._vendor import WorkloadsClientMixinABC @@ -98,7 +100,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) @@ -157,7 +159,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -346,7 +348,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -416,7 +418,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -605,7 +607,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -670,7 +672,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -746,7 +748,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -817,7 +819,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPCentralInstanceList] = kwargs.pop("cls", None) @@ -890,3 +892,389 @@ async def get_next(next_link=None): list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances" } + + async def _start_instance_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + @distributed_trace_async + async def begin_start_instance( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + async def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Is either a model type or a IO + type. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py index d2f55a6e9445..d03d684f5fb4 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py @@ -36,6 +36,8 @@ build_delete_request, build_get_request, build_list_request, + build_start_instance_request, + build_stop_instance_request, build_update_request, ) from .._vendor import WorkloadsClientMixinABC @@ -98,7 +100,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) @@ -157,7 +159,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -346,7 +348,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -416,7 +418,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -599,7 +601,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -664,7 +666,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -739,7 +741,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -808,7 +810,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPDatabaseInstanceList] = kwargs.pop("cls", None) @@ -881,3 +883,389 @@ async def get_next(next_link=None): list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances" } + + async def _start_instance_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + @distributed_trace_async + async def begin_start_instance( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + async def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Is either a model type + or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_landscape_monitor_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_landscape_monitor_operations.py new file mode 100644 index 000000000000..60ada0d3b98c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_landscape_monitor_operations.py @@ -0,0 +1,578 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_landscape_monitor_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._vendor import WorkloadsClientMixinABC + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SapLandscapeMonitorOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`sap_landscape_monitor` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.SapLandscapeMonitor: + """Gets configuration values for Single Pane Of Glass for SAP monitor. + + Gets configuration values for Single Pane Of Glass for SAP monitor for the specified + subscription, resource group, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @overload + async def create( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: _models.SapLandscapeMonitor, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Creates a SAP Landscape Monitor Dashboard. + + Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Creates a SAP Landscape Monitor Dashboard. + + Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO], + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Creates a SAP Landscape Monitor Dashboard. + + Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Is either a model type or a IO type. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_landscape_monitor_parameter, (IO, bytes)): + _content = sap_landscape_monitor_parameter + else: + _json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor") + + request = build_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> None: + """Deletes a SAP Landscape Monitor Dashboard. + + Deletes a SAP Landscape Monitor Dashboard with the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @overload + async def update( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: _models.SapLandscapeMonitor, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Patches the SAP Landscape Monitor Dashboard. + + Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Patches the SAP Landscape Monitor Dashboard. + + Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO], + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Patches the SAP Landscape Monitor Dashboard. + + Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Is either a model type or a IO type. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_landscape_monitor_parameter, (IO, bytes)): + _content = sap_landscape_monitor_parameter + else: + _json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor") + + request = build_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @distributed_trace_async + async def list( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> _models.SapLandscapeMonitorListResult: + """Gets configuration values for Single Pane Of Glass for SAP monitor. + + Gets configuration values for Single Pane Of Glass for SAP monitor for the specified + subscription, resource group, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitorListResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitorListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SapLandscapeMonitorListResult] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SapLandscapeMonitorListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py index 5b0ee6269fb9..830d02e508f8 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py @@ -88,7 +88,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -258,7 +258,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -336,7 +336,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) @@ -473,7 +473,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -541,7 +541,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -611,7 +611,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -676,7 +676,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) @@ -762,7 +762,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SAPVirtu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) @@ -848,7 +848,7 @@ async def _start_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -918,7 +918,7 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -983,7 +983,7 @@ async def _stop_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1156,7 +1156,7 @@ async def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py index 54e3af577e04..95e5bf1bfa65 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py @@ -130,7 +130,7 @@ async def sap_sizing_recommendations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -264,7 +264,7 @@ async def sap_supported_sku( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -398,7 +398,7 @@ async def sap_disk_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -536,7 +536,7 @@ async def sap_availability_zone_details( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py index 031cfb2bdb82..c4af3e6e5f02 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py @@ -7,19 +7,24 @@ # -------------------------------------------------------------------------- from ._models_py3 import ApplicationServerConfiguration -from ._models_py3 import BackupProfile -from ._models_py3 import CacheProfile +from ._models_py3 import ApplicationServerFullResourceNames +from ._models_py3 import ApplicationServerVmDetails from ._models_py3 import CentralServerConfiguration +from ._models_py3 import CentralServerFullResourceNames from ._models_py3 import CentralServerVmDetails +from ._models_py3 import CreateAndMountFileShareConfiguration from ._models_py3 import DB2ProviderInstanceProperties from ._models_py3 import DatabaseConfiguration -from ._models_py3 import DatabaseProfile +from ._models_py3 import DatabaseServerFullResourceNames from ._models_py3 import DatabaseVmDetails from ._models_py3 import DeployerVmPackages from ._models_py3 import DeploymentConfiguration from ._models_py3 import DeploymentWithOSConfiguration from ._models_py3 import DiscoveryConfiguration -from ._models_py3 import DiskInfo +from ._models_py3 import DiskConfiguration +from ._models_py3 import DiskDetails +from ._models_py3 import DiskSku +from ._models_py3 import DiskVolumeConfiguration from ._models_py3 import EnqueueReplicationServerProperties from ._models_py3 import EnqueueServerProperties from ._models_py3 import Error @@ -29,7 +34,7 @@ from ._models_py3 import ErrorInnerError from ._models_py3 import ErrorResponse from ._models_py3 import ExternalInstallationSoftwareConfiguration -from ._models_py3 import FileshareProfile +from ._models_py3 import FileShareConfiguration from ._models_py3 import GatewayServerProperties from ._models_py3 import HanaDbProviderInstanceProperties from ._models_py3 import HighAvailabilityConfiguration @@ -37,15 +42,17 @@ from ._models_py3 import ImageReference from ._models_py3 import InfrastructureConfiguration from ._models_py3 import LinuxConfiguration +from ._models_py3 import LoadBalancerDetails +from ._models_py3 import LoadBalancerResourceNames from ._models_py3 import ManagedRGConfiguration from ._models_py3 import MessageServerProperties from ._models_py3 import Monitor from ._models_py3 import MonitorListResult from ._models_py3 import MonitorPropertiesErrors +from ._models_py3 import MountFileShareConfiguration from ._models_py3 import MsSqlServerProviderInstanceProperties from ._models_py3 import NetworkConfiguration -from ._models_py3 import NetworkProfile -from ._models_py3 import NodeProfile +from ._models_py3 import NetworkInterfaceResourceNames from ._models_py3 import OSConfiguration from ._models_py3 import OSProfile from ._models_py3 import Operation @@ -57,14 +64,7 @@ from ._models_py3 import OperationsDefinitionArrayResponseWithContinuation from ._models_py3 import OperationsDefinitionDisplay from ._models_py3 import OperationsDisplayDefinition -from ._models_py3 import OsImageProfile from ._models_py3 import OsSapConfiguration -from ._models_py3 import PatchResourceRequestBody -from ._models_py3 import PatchResourceRequestBodyIdentity -from ._models_py3 import PhpProfile -from ._models_py3 import PhpWorkloadResource -from ._models_py3 import PhpWorkloadResourceIdentity -from ._models_py3 import PhpWorkloadResourceList from ._models_py3 import PrometheusHaClusterProviderInstanceProperties from ._models_py3 import PrometheusOSProviderInstanceProperties from ._models_py3 import ProviderInstance @@ -73,7 +73,6 @@ from ._models_py3 import ProviderSpecificProperties from ._models_py3 import ProxyResource from ._models_py3 import Resource -from ._models_py3 import RestrictionInfo from ._models_py3 import SAPApplicationServerInstance from ._models_py3 import SAPApplicationServerInstanceList from ._models_py3 import SAPAvailabilityZoneDetailsRequest @@ -96,29 +95,31 @@ from ._models_py3 import SAPVirtualInstance from ._models_py3 import SAPVirtualInstanceError from ._models_py3 import SAPVirtualInstanceList +from ._models_py3 import SapLandscapeMonitor +from ._models_py3 import SapLandscapeMonitorListResult +from ._models_py3 import SapLandscapeMonitorMetricThresholds +from ._models_py3 import SapLandscapeMonitorPropertiesGrouping +from ._models_py3 import SapLandscapeMonitorSidMapping from ._models_py3 import SapNetWeaverProviderInstanceProperties -from ._models_py3 import SearchProfile from ._models_py3 import ServiceInitiatedSoftwareConfiguration +from ._models_py3 import SharedStorageResourceNames from ._models_py3 import SingleServerConfiguration +from ._models_py3 import SingleServerCustomResourceNames +from ._models_py3 import SingleServerFullResourceNames from ._models_py3 import SingleServerRecommendationResult -from ._models_py3 import SiteProfile -from ._models_py3 import Sku -from ._models_py3 import SkuCapability -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuCost -from ._models_py3 import SkuDefinition -from ._models_py3 import SkuLocationAndZones -from ._models_py3 import SkuRestriction -from ._models_py3 import SkuZoneDetail -from ._models_py3 import SkusListResult +from ._models_py3 import SkipFileShareConfiguration from ._models_py3 import SoftwareConfiguration from ._models_py3 import SshConfiguration from ._models_py3 import SshKeyPair from ._models_py3 import SshPublicKey from ._models_py3 import StopRequest +from ._models_py3 import StorageConfiguration +from ._models_py3 import StorageInformation from ._models_py3 import SystemData from ._models_py3 import Tags from ._models_py3 import ThreeTierConfiguration +from ._models_py3 import ThreeTierCustomResourceNames +from ._models_py3 import ThreeTierFullResourceNames from ._models_py3 import ThreeTierRecommendationResult from ._models_py3 import TrackedResource from ._models_py3 import UpdateMonitorRequest @@ -128,40 +129,22 @@ from ._models_py3 import UpdateSAPVirtualInstanceRequest from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserAssignedServiceIdentity -from ._models_py3 import UserProfile from ._models_py3 import VirtualMachineConfiguration -from ._models_py3 import VmssNodesProfile +from ._models_py3 import VirtualMachineResourceNames from ._models_py3 import WindowsConfiguration -from ._models_py3 import WordpressInstanceResource -from ._models_py3 import WordpressInstanceResourceList from ._workloads_client_enums import ActionType -from ._workloads_client_enums import ApplicationProvisioningState -from ._workloads_client_enums import AzureFrontDoorEnabled +from ._workloads_client_enums import ApplicationServerVirtualMachineType from ._workloads_client_enums import CentralServerVirtualMachineType +from ._workloads_client_enums import ConfigurationType from ._workloads_client_enums import CreatedByType -from ._workloads_client_enums import DatabaseTier -from ._workloads_client_enums import DatabaseType -from ._workloads_client_enums import DiskStorageType -from ._workloads_client_enums import EnableBackup -from ._workloads_client_enums import EnableSslEnforcement +from ._workloads_client_enums import DiskSkuName from ._workloads_client_enums import EnqueueReplicationServerType -from ._workloads_client_enums import FileShareStorageType -from ._workloads_client_enums import FileShareType -from ._workloads_client_enums import HAEnabled -from ._workloads_client_enums import LoadBalancerType -from ._workloads_client_enums import LocationType from ._workloads_client_enums import ManagedServiceIdentityType -from ._workloads_client_enums import OSImageOffer -from ._workloads_client_enums import OSImagePublisher -from ._workloads_client_enums import OSImageSku -from ._workloads_client_enums import OSImageVersion +from ._workloads_client_enums import NamingPatternType from ._workloads_client_enums import OSType from ._workloads_client_enums import OperationProperties from ._workloads_client_enums import Origin -from ._workloads_client_enums import PHPVersion -from ._workloads_client_enums import PhpWorkloadProvisioningState -from ._workloads_client_enums import RedisCacheFamily from ._workloads_client_enums import RoutingPreference from ._workloads_client_enums import SAPConfigurationType from ._workloads_client_enums import SAPDatabaseScaleMethod @@ -174,15 +157,9 @@ from ._workloads_client_enums import SAPSoftwareInstallationType from ._workloads_client_enums import SAPVirtualInstanceState from ._workloads_client_enums import SAPVirtualInstanceStatus +from ._workloads_client_enums import SapLandscapeMonitorProvisioningState from ._workloads_client_enums import SapVirtualInstanceProvisioningState -from ._workloads_client_enums import SearchType -from ._workloads_client_enums import SkuRestrictionReasonCode -from ._workloads_client_enums import SkuRestrictionType -from ._workloads_client_enums import SkuScaleType -from ._workloads_client_enums import SkuTier from ._workloads_client_enums import SslPreference -from ._workloads_client_enums import WordpressVersions -from ._workloads_client_enums import WorkloadKind from ._workloads_client_enums import WorkloadMonitorActionType from ._workloads_client_enums import WorkloadMonitorProvisioningState from ._patch import __all__ as _patch_all @@ -191,19 +168,24 @@ __all__ = [ "ApplicationServerConfiguration", - "BackupProfile", - "CacheProfile", + "ApplicationServerFullResourceNames", + "ApplicationServerVmDetails", "CentralServerConfiguration", + "CentralServerFullResourceNames", "CentralServerVmDetails", + "CreateAndMountFileShareConfiguration", "DB2ProviderInstanceProperties", "DatabaseConfiguration", - "DatabaseProfile", + "DatabaseServerFullResourceNames", "DatabaseVmDetails", "DeployerVmPackages", "DeploymentConfiguration", "DeploymentWithOSConfiguration", "DiscoveryConfiguration", - "DiskInfo", + "DiskConfiguration", + "DiskDetails", + "DiskSku", + "DiskVolumeConfiguration", "EnqueueReplicationServerProperties", "EnqueueServerProperties", "Error", @@ -213,7 +195,7 @@ "ErrorInnerError", "ErrorResponse", "ExternalInstallationSoftwareConfiguration", - "FileshareProfile", + "FileShareConfiguration", "GatewayServerProperties", "HanaDbProviderInstanceProperties", "HighAvailabilityConfiguration", @@ -221,15 +203,17 @@ "ImageReference", "InfrastructureConfiguration", "LinuxConfiguration", + "LoadBalancerDetails", + "LoadBalancerResourceNames", "ManagedRGConfiguration", "MessageServerProperties", "Monitor", "MonitorListResult", "MonitorPropertiesErrors", + "MountFileShareConfiguration", "MsSqlServerProviderInstanceProperties", "NetworkConfiguration", - "NetworkProfile", - "NodeProfile", + "NetworkInterfaceResourceNames", "OSConfiguration", "OSProfile", "Operation", @@ -241,14 +225,7 @@ "OperationsDefinitionArrayResponseWithContinuation", "OperationsDefinitionDisplay", "OperationsDisplayDefinition", - "OsImageProfile", "OsSapConfiguration", - "PatchResourceRequestBody", - "PatchResourceRequestBodyIdentity", - "PhpProfile", - "PhpWorkloadResource", - "PhpWorkloadResourceIdentity", - "PhpWorkloadResourceList", "PrometheusHaClusterProviderInstanceProperties", "PrometheusOSProviderInstanceProperties", "ProviderInstance", @@ -257,7 +234,6 @@ "ProviderSpecificProperties", "ProxyResource", "Resource", - "RestrictionInfo", "SAPApplicationServerInstance", "SAPApplicationServerInstanceList", "SAPAvailabilityZoneDetailsRequest", @@ -280,29 +256,31 @@ "SAPVirtualInstance", "SAPVirtualInstanceError", "SAPVirtualInstanceList", + "SapLandscapeMonitor", + "SapLandscapeMonitorListResult", + "SapLandscapeMonitorMetricThresholds", + "SapLandscapeMonitorPropertiesGrouping", + "SapLandscapeMonitorSidMapping", "SapNetWeaverProviderInstanceProperties", - "SearchProfile", "ServiceInitiatedSoftwareConfiguration", + "SharedStorageResourceNames", "SingleServerConfiguration", + "SingleServerCustomResourceNames", + "SingleServerFullResourceNames", "SingleServerRecommendationResult", - "SiteProfile", - "Sku", - "SkuCapability", - "SkuCapacity", - "SkuCost", - "SkuDefinition", - "SkuLocationAndZones", - "SkuRestriction", - "SkuZoneDetail", - "SkusListResult", + "SkipFileShareConfiguration", "SoftwareConfiguration", "SshConfiguration", "SshKeyPair", "SshPublicKey", "StopRequest", + "StorageConfiguration", + "StorageInformation", "SystemData", "Tags", "ThreeTierConfiguration", + "ThreeTierCustomResourceNames", + "ThreeTierFullResourceNames", "ThreeTierRecommendationResult", "TrackedResource", "UpdateMonitorRequest", @@ -312,39 +290,21 @@ "UpdateSAPVirtualInstanceRequest", "UserAssignedIdentity", "UserAssignedServiceIdentity", - "UserProfile", "VirtualMachineConfiguration", - "VmssNodesProfile", + "VirtualMachineResourceNames", "WindowsConfiguration", - "WordpressInstanceResource", - "WordpressInstanceResourceList", "ActionType", - "ApplicationProvisioningState", - "AzureFrontDoorEnabled", + "ApplicationServerVirtualMachineType", "CentralServerVirtualMachineType", + "ConfigurationType", "CreatedByType", - "DatabaseTier", - "DatabaseType", - "DiskStorageType", - "EnableBackup", - "EnableSslEnforcement", + "DiskSkuName", "EnqueueReplicationServerType", - "FileShareStorageType", - "FileShareType", - "HAEnabled", - "LoadBalancerType", - "LocationType", "ManagedServiceIdentityType", - "OSImageOffer", - "OSImagePublisher", - "OSImageSku", - "OSImageVersion", + "NamingPatternType", "OSType", "OperationProperties", "Origin", - "PHPVersion", - "PhpWorkloadProvisioningState", - "RedisCacheFamily", "RoutingPreference", "SAPConfigurationType", "SAPDatabaseScaleMethod", @@ -357,15 +317,9 @@ "SAPSoftwareInstallationType", "SAPVirtualInstanceState", "SAPVirtualInstanceStatus", + "SapLandscapeMonitorProvisioningState", "SapVirtualInstanceProvisioningState", - "SearchType", - "SkuRestrictionReasonCode", - "SkuRestrictionType", - "SkuScaleType", - "SkuTier", "SslPreference", - "WordpressVersions", - "WorkloadKind", "WorkloadMonitorActionType", "WorkloadMonitorProvisioningState", ] diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py index 5d21fad549a2..de1b391c40e5 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py @@ -8,20 +8,13 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class ApplicationServerConfiguration(_serialization.Model): @@ -56,8 +49,8 @@ def __init__( subnet_id: str, virtual_machine_configuration: "_models.VirtualMachineConfiguration", instance_count: int, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet_id: The subnet id. Required. :paramtype subnet_id: str @@ -74,100 +67,74 @@ def __init__( self.instance_count = instance_count -class BackupProfile(_serialization.Model): - """Backup profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. +class ApplicationServerFullResourceNames(_serialization.Model): + """The full resource names object for application layer resources. The number of entries in this + list should be equal to the number VMs to be created for application layer. - :ivar backup_enabled: Whether to enable Azure backup for the workload. Required. Known values - are: "Enabled" and "Disabled". - :vartype backup_enabled: str or ~azure.mgmt.workloads.models.EnableBackup - :ivar vault_resource_id: Backup vault resource Id. - :vartype vault_resource_id: str + :ivar virtual_machines: The list of virtual machine naming details. + :vartype virtual_machines: list[~azure.mgmt.workloads.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-App-AvSet. + :vartype availability_set_name: str """ - _validation = { - "backup_enabled": {"required": True}, - "vault_resource_id": {"readonly": True}, - } - _attribute_map = { - "backup_enabled": {"key": "backupEnabled", "type": "str"}, - "vault_resource_id": {"key": "vaultResourceId", "type": "str"}, + "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, + "availability_set_name": {"key": "availabilitySetName", "type": "str"}, } - def __init__(self, *, backup_enabled: Union[str, "_models.EnableBackup"], **kwargs): + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword backup_enabled: Whether to enable Azure backup for the workload. Required. Known - values are: "Enabled" and "Disabled". - :paramtype backup_enabled: str or ~azure.mgmt.workloads.models.EnableBackup + :keyword virtual_machines: The list of virtual machine naming details. + :paramtype virtual_machines: list[~azure.mgmt.workloads.models.VirtualMachineResourceNames] + :keyword availability_set_name: The full name for availability set. In case name is not + provided, it will be defaulted to {SID}-App-AvSet. + :paramtype availability_set_name: str """ super().__init__(**kwargs) - self.backup_enabled = backup_enabled - self.vault_resource_id = None + self.virtual_machines = virtual_machines + self.availability_set_name = availability_set_name -class CacheProfile(_serialization.Model): - """Cache profile. +class ApplicationServerVmDetails(_serialization.Model): + """The Application Server VM Details. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar name: Cache name. - :vartype name: str - :ivar sku_name: Cache SKU name. Required. - :vartype sku_name: str - :ivar family: Cache family. Required. Known values are: "C" and "P". - :vartype family: str or ~azure.mgmt.workloads.models.RedisCacheFamily - :ivar capacity: Cache capacity. Required. - :vartype capacity: int - :ivar cache_resource_id: Cache resource Id. - :vartype cache_resource_id: str + :ivar type: Defines the type of application server VM. Known values are: "Active", "Standby", + and "Unknown". + :vartype type: str or ~azure.mgmt.workloads.models.ApplicationServerVirtualMachineType + :ivar virtual_machine_id: + :vartype virtual_machine_id: str + :ivar storage_details: Storage details of all the Storage Accounts attached to the App Virtual + Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: list[~azure.mgmt.workloads.models.StorageInformation] """ _validation = { - "sku_name": {"required": True}, - "family": {"required": True}, - "capacity": {"required": True}, - "cache_resource_id": {"readonly": True}, + "type": {"readonly": True}, + "virtual_machine_id": {"readonly": True}, + "storage_details": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "sku_name": {"key": "skuName", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - "cache_resource_id": {"key": "cacheResourceId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, } - def __init__( - self, - *, - sku_name: str, - family: Union[str, "_models.RedisCacheFamily"], - capacity: int, - name: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Cache name. - :paramtype name: str - :keyword sku_name: Cache SKU name. Required. - :paramtype sku_name: str - :keyword family: Cache family. Required. Known values are: "C" and "P". - :paramtype family: str or ~azure.mgmt.workloads.models.RedisCacheFamily - :keyword capacity: Cache capacity. Required. - :paramtype capacity: int - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name - self.sku_name = sku_name - self.family = family - self.capacity = capacity - self.cache_resource_id = None + self.type = None + self.virtual_machine_id = None + self.storage_details = None class CentralServerConfiguration(_serialization.Model): @@ -202,8 +169,8 @@ def __init__( subnet_id: str, virtual_machine_configuration: "_models.VirtualMachineConfiguration", instance_count: int, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subnet_id: The subnet id. Required. :paramtype subnet_id: str @@ -220,6 +187,55 @@ def __init__( self.instance_count = instance_count +class CentralServerFullResourceNames(_serialization.Model): + """The full resource names object for central server layer resources. + + :ivar virtual_machines: The list of names for all ASCS virtual machines to be deployed. The + number of entries in this list should be equal to the number VMs to be created for ASCS layer. + At maximum, there can be two virtual machines at this layer: ASCS and ERS. + :vartype virtual_machines: list[~azure.mgmt.workloads.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-ASCS-AvSet. + :vartype availability_set_name: str + :ivar load_balancer: The resource names object for load balancer and related resources. + :vartype load_balancer: ~azure.mgmt.workloads.models.LoadBalancerResourceNames + """ + + _validation = { + "virtual_machines": {"max_items": 2, "min_items": 0}, + } + + _attribute_map = { + "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, + "availability_set_name": {"key": "availabilitySetName", "type": "str"}, + "load_balancer": {"key": "loadBalancer", "type": "LoadBalancerResourceNames"}, + } + + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword virtual_machines: The list of names for all ASCS virtual machines to be deployed. The + number of entries in this list should be equal to the number VMs to be created for ASCS layer. + At maximum, there can be two virtual machines at this layer: ASCS and ERS. + :paramtype virtual_machines: list[~azure.mgmt.workloads.models.VirtualMachineResourceNames] + :keyword availability_set_name: The full name for availability set. In case name is not + provided, it will be defaulted to {SID}-ASCS-AvSet. + :paramtype availability_set_name: str + :keyword load_balancer: The resource names object for load balancer and related resources. + :paramtype load_balancer: ~azure.mgmt.workloads.models.LoadBalancerResourceNames + """ + super().__init__(**kwargs) + self.virtual_machines = virtual_machines + self.availability_set_name = availability_set_name + self.load_balancer = load_balancer + + class CentralServerVmDetails(_serialization.Model): """The SAP Central Services Instance VM details. @@ -230,23 +246,108 @@ class CentralServerVmDetails(_serialization.Model): :vartype type: str or ~azure.mgmt.workloads.models.CentralServerVirtualMachineType :ivar virtual_machine_id: :vartype virtual_machine_id: str + :ivar storage_details: Storage details of all the Storage Accounts attached to the ASCS Virtual + Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: list[~azure.mgmt.workloads.models.StorageInformation] """ _validation = { "type": {"readonly": True}, "virtual_machine_id": {"readonly": True}, + "storage_details": {"readonly": True}, } _attribute_map = { "type": {"key": "type", "type": "str"}, "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None self.virtual_machine_id = None + self.storage_details = None + + +class FileShareConfiguration(_serialization.Model): + """File Share configuration details, populated with information on storage configuration mounted + on the VIS. The createAndMount option is selected in case of missing input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CreateAndMountFileShareConfiguration, MountFileShareConfiguration, SkipFileShareConfiguration + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.ConfigurationType + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + } + + _subtype_map = { + "configuration_type": { + "CreateAndMount": "CreateAndMountFileShareConfiguration", + "Mount": "MountFileShareConfiguration", + "Skip": "SkipFileShareConfiguration", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.configuration_type: Optional[str] = None + + +class CreateAndMountFileShareConfiguration(FileShareConfiguration): + """Gets or sets the file share configuration for file share created with the VIS case. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.ConfigurationType + :ivar resource_group: The name of file share resource group. The app rg is used in case of + missing input. + :vartype resource_group: str + :ivar storage_account_name: The name of file share storage account name . A custom name is used + in case of missing input. + :vartype storage_account_name: str + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + } + + def __init__( + self, *, resource_group: Optional[str] = None, storage_account_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_group: The name of file share resource group. The app rg is used in case of + missing input. + :paramtype resource_group: str + :keyword storage_account_name: The name of file share storage account name . A custom name is + used in case of missing input. + :paramtype storage_account_name: str + """ + super().__init__(**kwargs) + self.configuration_type: str = "CreateAndMount" + self.resource_group = resource_group + self.storage_account_name = storage_account_name class DatabaseConfiguration(_serialization.Model): @@ -263,6 +364,8 @@ class DatabaseConfiguration(_serialization.Model): ~azure.mgmt.workloads.models.VirtualMachineConfiguration :ivar instance_count: The number of database VMs. Required. :vartype instance_count: int + :ivar disk_configuration: Gets or sets the disk configuration. + :vartype disk_configuration: ~azure.mgmt.workloads.models.DiskConfiguration """ _validation = { @@ -276,6 +379,7 @@ class DatabaseConfiguration(_serialization.Model): "subnet_id": {"key": "subnetId", "type": "str"}, "virtual_machine_configuration": {"key": "virtualMachineConfiguration", "type": "VirtualMachineConfiguration"}, "instance_count": {"key": "instanceCount", "type": "int"}, + "disk_configuration": {"key": "diskConfiguration", "type": "DiskConfiguration"}, } def __init__( @@ -285,8 +389,9 @@ def __init__( virtual_machine_configuration: "_models.VirtualMachineConfiguration", instance_count: int, database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, - **kwargs - ): + disk_configuration: Optional["_models.DiskConfiguration"] = None, + **kwargs: Any + ) -> None: """ :keyword database_type: The database type. Known values are: "HANA" and "DB2". :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType @@ -298,129 +403,61 @@ def __init__( ~azure.mgmt.workloads.models.VirtualMachineConfiguration :keyword instance_count: The number of database VMs. Required. :paramtype instance_count: int + :keyword disk_configuration: Gets or sets the disk configuration. + :paramtype disk_configuration: ~azure.mgmt.workloads.models.DiskConfiguration """ super().__init__(**kwargs) self.database_type = database_type self.subnet_id = subnet_id self.virtual_machine_configuration = virtual_machine_configuration self.instance_count = instance_count + self.disk_configuration = disk_configuration -class DatabaseProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Workload database profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. +class DatabaseServerFullResourceNames(_serialization.Model): + """The full resource names object for database layer resources. The number of entries in this list + should be equal to the number VMs to be created for database layer. - :ivar type: Database type. Required. "MySql" - :vartype type: str or ~azure.mgmt.workloads.models.DatabaseType - :ivar server_name: Database server name. - :vartype server_name: str - :ivar version: Database version. - :vartype version: str - :ivar sku: The name of the server SKU, e.g. Standard_D32s_v4. Required. - :vartype sku: str - :ivar tier: Tier of the server SKU. Required. Known values are: "Burstable", "GeneralPurpose", - and "MemoryOptimized". - :vartype tier: str or ~azure.mgmt.workloads.models.DatabaseTier - :ivar ha_enabled: Whether to enable HA for the server. Known values are: "Enabled" and - "Disabled". - :vartype ha_enabled: str or ~azure.mgmt.workloads.models.HAEnabled - :ivar storage_sku: SKU name for database storage. - :vartype storage_sku: str - :ivar storage_in_gb: Database storage size in GB. - :vartype storage_in_gb: int - :ivar storage_iops: Storage IOPS for the server. - :vartype storage_iops: int - :ivar backup_retention_days: Backup retention days for the server. - :vartype backup_retention_days: int - :ivar ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Known values - are: "Enabled" and "Disabled". - :vartype ssl_enforcement_enabled: str or ~azure.mgmt.workloads.models.EnableSslEnforcement - :ivar server_resource_id: Azure Database Server resource Id. - :vartype server_resource_id: str + :ivar virtual_machines: The list of virtual machine naming details. + :vartype virtual_machines: list[~azure.mgmt.workloads.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-DB-AvSet. + :vartype availability_set_name: str + :ivar load_balancer: The resource names object for load balancer and related resources. + :vartype load_balancer: ~azure.mgmt.workloads.models.LoadBalancerResourceNames """ _validation = { - "type": {"required": True}, - "sku": {"required": True}, - "tier": {"required": True}, - "storage_in_gb": {"minimum": 1}, - "server_resource_id": {"readonly": True}, + "virtual_machines": {"max_items": 2, "min_items": 0}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server_name": {"key": "serverName", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "ha_enabled": {"key": "haEnabled", "type": "str"}, - "storage_sku": {"key": "storageSku", "type": "str"}, - "storage_in_gb": {"key": "storageInGB", "type": "int"}, - "storage_iops": {"key": "storageIops", "type": "int"}, - "backup_retention_days": {"key": "backupRetentionDays", "type": "int"}, - "ssl_enforcement_enabled": {"key": "sslEnforcementEnabled", "type": "str"}, - "server_resource_id": {"key": "serverResourceId", "type": "str"}, + "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, + "availability_set_name": {"key": "availabilitySetName", "type": "str"}, + "load_balancer": {"key": "loadBalancer", "type": "LoadBalancerResourceNames"}, } def __init__( self, *, - type: Union[str, "_models.DatabaseType"], - sku: str, - tier: Union[str, "_models.DatabaseTier"], - server_name: Optional[str] = None, - version: Optional[str] = None, - ha_enabled: Optional[Union[str, "_models.HAEnabled"]] = None, - storage_sku: Optional[str] = None, - storage_in_gb: Optional[int] = None, - storage_iops: Optional[int] = None, - backup_retention_days: Optional[int] = None, - ssl_enforcement_enabled: Optional[Union[str, "_models.EnableSslEnforcement"]] = None, - **kwargs - ): - """ - :keyword type: Database type. Required. "MySql" - :paramtype type: str or ~azure.mgmt.workloads.models.DatabaseType - :keyword server_name: Database server name. - :paramtype server_name: str - :keyword version: Database version. - :paramtype version: str - :keyword sku: The name of the server SKU, e.g. Standard_D32s_v4. Required. - :paramtype sku: str - :keyword tier: Tier of the server SKU. Required. Known values are: "Burstable", - "GeneralPurpose", and "MemoryOptimized". - :paramtype tier: str or ~azure.mgmt.workloads.models.DatabaseTier - :keyword ha_enabled: Whether to enable HA for the server. Known values are: "Enabled" and - "Disabled". - :paramtype ha_enabled: str or ~azure.mgmt.workloads.models.HAEnabled - :keyword storage_sku: SKU name for database storage. - :paramtype storage_sku: str - :keyword storage_in_gb: Database storage size in GB. - :paramtype storage_in_gb: int - :keyword storage_iops: Storage IOPS for the server. - :paramtype storage_iops: int - :keyword backup_retention_days: Backup retention days for the server. - :paramtype backup_retention_days: int - :keyword ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Known - values are: "Enabled" and "Disabled". - :paramtype ssl_enforcement_enabled: str or ~azure.mgmt.workloads.models.EnableSslEnforcement + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword virtual_machines: The list of virtual machine naming details. + :paramtype virtual_machines: list[~azure.mgmt.workloads.models.VirtualMachineResourceNames] + :keyword availability_set_name: The full name for availability set. In case name is not + provided, it will be defaulted to {SID}-DB-AvSet. + :paramtype availability_set_name: str + :keyword load_balancer: The resource names object for load balancer and related resources. + :paramtype load_balancer: ~azure.mgmt.workloads.models.LoadBalancerResourceNames """ super().__init__(**kwargs) - self.type = type - self.server_name = server_name - self.version = version - self.sku = sku - self.tier = tier - self.ha_enabled = ha_enabled - self.storage_sku = storage_sku - self.storage_in_gb = storage_in_gb - self.storage_iops = storage_iops - self.backup_retention_days = backup_retention_days - self.ssl_enforcement_enabled = ssl_enforcement_enabled - self.server_resource_id = None + self.virtual_machines = virtual_machines + self.availability_set_name = availability_set_name + self.load_balancer = load_balancer class DatabaseVmDetails(_serialization.Model): @@ -431,25 +468,31 @@ class DatabaseVmDetails(_serialization.Model): :ivar virtual_machine_id: :vartype virtual_machine_id: str :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", and "Unavailable". + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus + :ivar storage_details: Storage details of all the Storage Accounts attached to the Database + Virtual Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: list[~azure.mgmt.workloads.models.StorageInformation] """ _validation = { "virtual_machine_id": {"readonly": True}, "status": {"readonly": True}, + "storage_details": {"readonly": True}, } _attribute_map = { "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, "status": {"key": "status", "type": "str"}, + "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.virtual_machine_id = None self.status = None + self.storage_details = None class ProviderSpecificProperties(_serialization.Model): @@ -485,7 +528,7 @@ class ProviderSpecificProperties(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider_type: Optional[str] = None @@ -548,8 +591,8 @@ def __init__( sap_sid: Optional[str] = None, ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, ssl_certificate_uri: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword hostname: Gets or sets the target virtual machine name. :paramtype hostname: str @@ -599,7 +642,7 @@ class DeployerVmPackages(_serialization.Model): "storage_account_id": {"key": "storageAccountId", "type": "str"}, } - def __init__(self, *, url: Optional[str] = None, storage_account_id: Optional[str] = None, **kwargs): + def __init__(self, *, url: Optional[str] = None, storage_account_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword url: The URL to the deployer VM packages file. :paramtype url: str @@ -640,7 +683,7 @@ class SAPConfiguration(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.configuration_type: Optional[str] = None @@ -679,8 +722,8 @@ def __init__( app_location: Optional[str] = None, infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, software_configuration: Optional["_models.SoftwareConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword app_location: The geo-location where the SAP system is to be created. :paramtype app_location: str @@ -734,8 +777,8 @@ def __init__( infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, software_configuration: Optional["_models.SoftwareConfiguration"] = None, os_sap_configuration: Optional["_models.OsSapConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword app_location: The geo-location where the SAP system is to be created. :paramtype app_location: str @@ -767,66 +810,210 @@ class DiscoveryConfiguration(SAPConfiguration): :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType :ivar central_server_vm_id: The virtual machine ID of the Central Server. :vartype central_server_vm_id: str + :ivar managed_rg_storage_account_name: The custom storage account name for the storage account + created by the service in the managed resource group created as part of VIS + deployment.:code:`
`:code:`
`Refer to the storage account naming rules `here + `_.:code:`
`:code:`
`If + not provided, the service will create the storage account with a random name. + :vartype managed_rg_storage_account_name: str :ivar app_location: The geo-location where the SAP system exists. :vartype app_location: str """ _validation = { "configuration_type": {"required": True}, + "managed_rg_storage_account_name": {"max_length": 24, "min_length": 3}, "app_location": {"readonly": True}, } _attribute_map = { "configuration_type": {"key": "configurationType", "type": "str"}, "central_server_vm_id": {"key": "centralServerVmId", "type": "str"}, + "managed_rg_storage_account_name": {"key": "managedRgStorageAccountName", "type": "str"}, "app_location": {"key": "appLocation", "type": "str"}, } - def __init__(self, *, central_server_vm_id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + central_server_vm_id: Optional[str] = None, + managed_rg_storage_account_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword central_server_vm_id: The virtual machine ID of the Central Server. :paramtype central_server_vm_id: str + :keyword managed_rg_storage_account_name: The custom storage account name for the storage + account created by the service in the managed resource group created as part of VIS + deployment.:code:`
`:code:`
`Refer to the storage account naming rules `here + `_.:code:`
`:code:`
`If + not provided, the service will create the storage account with a random name. + :paramtype managed_rg_storage_account_name: str """ super().__init__(**kwargs) self.configuration_type: str = "Discovery" self.central_server_vm_id = central_server_vm_id + self.managed_rg_storage_account_name = managed_rg_storage_account_name self.app_location = None -class DiskInfo(_serialization.Model): - """Disk resource creation details. - - All required parameters must be populated in order to send to Azure. +class DiskConfiguration(_serialization.Model): + """The Disk Configuration Details. - :ivar storage_type: Storage type. Required. Known values are: "Premium_LRS", "Standard_LRS", - and "StandardSSD_LRS". - :vartype storage_type: str or ~azure.mgmt.workloads.models.DiskStorageType - :ivar size_in_gb: Disk size in GB. - :vartype size_in_gb: int + :ivar disk_volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :vartype disk_volume_configurations: dict[str, + ~azure.mgmt.workloads.models.DiskVolumeConfiguration] """ - _validation = { - "storage_type": {"required": True}, + _attribute_map = { + "disk_volume_configurations": {"key": "diskVolumeConfigurations", "type": "{DiskVolumeConfiguration}"}, } + def __init__( + self, + *, + disk_volume_configurations: Optional[Dict[str, "_models.DiskVolumeConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword disk_volume_configurations: The disk configuration for the db volume. For HANA, + Required volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume + : ['backup']. + :paramtype disk_volume_configurations: dict[str, + ~azure.mgmt.workloads.models.DiskVolumeConfiguration] + """ + super().__init__(**kwargs) + self.disk_volume_configurations = disk_volume_configurations + + +class DiskDetails(_serialization.Model): + """The supported disk size details for a disk type. + + :ivar sku: The disk sku. + :vartype sku: ~azure.mgmt.workloads.models.DiskSku + :ivar size_gb: The disk size in GB. + :vartype size_gb: int + :ivar minimum_supported_disk_count: The minimum supported disk count. + :vartype minimum_supported_disk_count: int + :ivar maximum_supported_disk_count: The maximum supported disk count. + :vartype maximum_supported_disk_count: int + :ivar iops_read_write: The disk Iops. + :vartype iops_read_write: int + :ivar mbps_read_write: The disk provisioned throughput in MBps. + :vartype mbps_read_write: int + :ivar disk_tier: The disk tier, e.g. P10, E10. + :vartype disk_tier: str + """ + _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - "size_in_gb": {"key": "sizeInGB", "type": "int"}, + "sku": {"key": "sku", "type": "DiskSku"}, + "size_gb": {"key": "sizeGB", "type": "int"}, + "minimum_supported_disk_count": {"key": "minimumSupportedDiskCount", "type": "int"}, + "maximum_supported_disk_count": {"key": "maximumSupportedDiskCount", "type": "int"}, + "iops_read_write": {"key": "iopsReadWrite", "type": "int"}, + "mbps_read_write": {"key": "mbpsReadWrite", "type": "int"}, + "disk_tier": {"key": "diskTier", "type": "str"}, } def __init__( - self, *, storage_type: Union[str, "_models.DiskStorageType"], size_in_gb: Optional[int] = None, **kwargs - ): + self, + *, + sku: Optional["_models.DiskSku"] = None, + size_gb: Optional[int] = None, + minimum_supported_disk_count: Optional[int] = None, + maximum_supported_disk_count: Optional[int] = None, + iops_read_write: Optional[int] = None, + mbps_read_write: Optional[int] = None, + disk_tier: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: The disk sku. + :paramtype sku: ~azure.mgmt.workloads.models.DiskSku + :keyword size_gb: The disk size in GB. + :paramtype size_gb: int + :keyword minimum_supported_disk_count: The minimum supported disk count. + :paramtype minimum_supported_disk_count: int + :keyword maximum_supported_disk_count: The maximum supported disk count. + :paramtype maximum_supported_disk_count: int + :keyword iops_read_write: The disk Iops. + :paramtype iops_read_write: int + :keyword mbps_read_write: The disk provisioned throughput in MBps. + :paramtype mbps_read_write: int + :keyword disk_tier: The disk tier, e.g. P10, E10. + :paramtype disk_tier: str """ - :keyword storage_type: Storage type. Required. Known values are: "Premium_LRS", "Standard_LRS", - and "StandardSSD_LRS". - :paramtype storage_type: str or ~azure.mgmt.workloads.models.DiskStorageType - :keyword size_in_gb: Disk size in GB. - :paramtype size_in_gb: int + super().__init__(**kwargs) + self.sku = sku + self.size_gb = size_gb + self.minimum_supported_disk_count = minimum_supported_disk_count + self.maximum_supported_disk_count = maximum_supported_disk_count + self.iops_read_write = iops_read_write + self.mbps_read_write = mbps_read_write + self.disk_tier = disk_tier + + +class DiskSku(_serialization.Model): + """The disk sku. + + :ivar name: Defines the disk sku name. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype name: str or ~azure.mgmt.workloads.models.DiskSkuName + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[Union[str, "_models.DiskSkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword name: Defines the disk sku name. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". + :paramtype name: str or ~azure.mgmt.workloads.models.DiskSkuName + """ + super().__init__(**kwargs) + self.name = name + + +class DiskVolumeConfiguration(_serialization.Model): + """The disk configuration required for the selected volume. + + :ivar count: The total number of disks required for the concerned volume. + :vartype count: int + :ivar size_gb: The disk size in GB. + :vartype size_gb: int + :ivar sku: The disk SKU details. + :vartype sku: ~azure.mgmt.workloads.models.DiskSku + """ + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "size_gb": {"key": "sizeGB", "type": "int"}, + "sku": {"key": "sku", "type": "DiskSku"}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + size_gb: Optional[int] = None, + sku: Optional["_models.DiskSku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword count: The total number of disks required for the concerned volume. + :paramtype count: int + :keyword size_gb: The disk size in GB. + :paramtype size_gb: int + :keyword sku: The disk SKU details. + :paramtype sku: ~azure.mgmt.workloads.models.DiskSku """ super().__init__(**kwargs) - self.storage_type = storage_type - self.size_in_gb = size_in_gb + self.count = count + self.size_gb = size_gb + self.sku = sku class EnqueueReplicationServerProperties(_serialization.Model): @@ -872,7 +1059,7 @@ class EnqueueReplicationServerProperties(_serialization.Model): "health": {"key": "health", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.ers_version = None @@ -914,7 +1101,7 @@ class EnqueueServerProperties(_serialization.Model): "health": {"key": "health", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.hostname = None @@ -957,7 +1144,7 @@ class Error(_serialization.Model): "inner_error": {"key": "innerError", "type": "ErrorInnerError"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -988,7 +1175,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1020,7 +1207,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1061,7 +1248,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1082,7 +1269,7 @@ class ErrorInnerError(_serialization.Model): "inner_error": {"key": "innerError", "type": "Error"}, } - def __init__(self, *, inner_error: Optional["_models.Error"] = None, **kwargs): + def __init__(self, *, inner_error: Optional["_models.Error"] = None, **kwargs: Any) -> None: """ :keyword inner_error: Standard error object. :paramtype inner_error: ~azure.mgmt.workloads.models.Error @@ -1092,7 +1279,8 @@ def __init__(self, *, inner_error: Optional["_models.Error"] = None, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.workloads.models.ErrorDetail @@ -1102,7 +1290,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.workloads.models.ErrorDetail @@ -1142,14 +1330,15 @@ class SoftwareConfiguration(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.software_installation_type: Optional[str] = None class ExternalInstallationSoftwareConfiguration(SoftwareConfiguration): - """The SAP Software configuration Input when the software is installed externally outside the service. + """The SAP Software configuration Input when the software is installed externally outside the + service. All required parameters must be populated in order to send to Azure. @@ -1171,7 +1360,7 @@ class ExternalInstallationSoftwareConfiguration(SoftwareConfiguration): "central_server_vm_id": {"key": "centralServerVmId", "type": "str"}, } - def __init__(self, *, central_server_vm_id: Optional[str] = None, **kwargs): + def __init__(self, *, central_server_vm_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword central_server_vm_id: The resource ID of the virtual machine containing the central server instance. @@ -1182,68 +1371,6 @@ def __init__(self, *, central_server_vm_id: Optional[str] = None, **kwargs): self.central_server_vm_id = central_server_vm_id -class FileshareProfile(_serialization.Model): - """File share profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar share_type: Share type. Required. Known values are: "NfsOnController" and "AzureFiles". - :vartype share_type: str or ~azure.mgmt.workloads.models.FileShareType - :ivar storage_type: File share backing storage type. Required. Known values are: - "Standard_LRS", "Standard_GRS", "Standard_ZRS", and "Premium_LRS". - :vartype storage_type: str or ~azure.mgmt.workloads.models.FileShareStorageType - :ivar share_size_in_gb: File share size in GB. - :vartype share_size_in_gb: int - :ivar storage_resource_id: File share storage resource id. - :vartype storage_resource_id: str - :ivar share_name: File share name. - :vartype share_name: str - """ - - _validation = { - "share_type": {"required": True}, - "storage_type": {"required": True}, - "share_size_in_gb": {"minimum": 1}, - "storage_resource_id": {"readonly": True}, - "share_name": {"readonly": True}, - } - - _attribute_map = { - "share_type": {"key": "shareType", "type": "str"}, - "storage_type": {"key": "storageType", "type": "str"}, - "share_size_in_gb": {"key": "shareSizeInGB", "type": "int"}, - "storage_resource_id": {"key": "storageResourceId", "type": "str"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - share_type: Union[str, "_models.FileShareType"], - storage_type: Union[str, "_models.FileShareStorageType"], - share_size_in_gb: Optional[int] = None, - **kwargs - ): - """ - :keyword share_type: Share type. Required. Known values are: "NfsOnController" and - "AzureFiles". - :paramtype share_type: str or ~azure.mgmt.workloads.models.FileShareType - :keyword storage_type: File share backing storage type. Required. Known values are: - "Standard_LRS", "Standard_GRS", "Standard_ZRS", and "Premium_LRS". - :paramtype storage_type: str or ~azure.mgmt.workloads.models.FileShareStorageType - :keyword share_size_in_gb: File share size in GB. - :paramtype share_size_in_gb: int - """ - super().__init__(**kwargs) - self.share_type = share_type - self.storage_type = storage_type - self.share_size_in_gb = share_size_in_gb - self.storage_resource_id = None - self.share_name = None - - class GatewayServerProperties(_serialization.Model): """Defines the SAP Gateway Server properties. @@ -1266,7 +1393,7 @@ class GatewayServerProperties(_serialization.Model): "health": {"key": "health", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.port = None @@ -1294,8 +1421,6 @@ class HanaDbProviderInstanceProperties(ProviderSpecificProperties): # pylint: d :vartype db_password: str :ivar db_password_uri: Gets or sets the key vault URI to secret with the database password. :vartype db_password_uri: str - :ivar db_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the DB. - :vartype db_ssl_certificate_uri: str :ivar ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the DB. :vartype ssl_certificate_uri: str :ivar ssl_host_name_in_certificate: Gets or sets the hostname(s) in the SSL certificate. @@ -1303,6 +1428,8 @@ class HanaDbProviderInstanceProperties(ProviderSpecificProperties): # pylint: d :ivar ssl_preference: Gets or sets certificate preference if secure communication is enabled. Known values are: "Disabled", "RootCertificate", and "ServerCertificate". :vartype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference + :ivar sap_sid: Gets or sets the SAP System Identifier. + :vartype sap_sid: str """ _validation = { @@ -1318,10 +1445,10 @@ class HanaDbProviderInstanceProperties(ProviderSpecificProperties): # pylint: d "db_username": {"key": "dbUsername", "type": "str"}, "db_password": {"key": "dbPassword", "type": "str"}, "db_password_uri": {"key": "dbPasswordUri", "type": "str"}, - "db_ssl_certificate_uri": {"key": "dbSslCertificateUri", "type": "str"}, "ssl_certificate_uri": {"key": "sslCertificateUri", "type": "str"}, "ssl_host_name_in_certificate": {"key": "sslHostNameInCertificate", "type": "str"}, "ssl_preference": {"key": "sslPreference", "type": "str"}, + "sap_sid": {"key": "sapSid", "type": "str"}, } def __init__( @@ -1334,12 +1461,12 @@ def __init__( db_username: Optional[str] = None, db_password: Optional[str] = None, db_password_uri: Optional[str] = None, - db_ssl_certificate_uri: Optional[str] = None, ssl_certificate_uri: Optional[str] = None, ssl_host_name_in_certificate: Optional[str] = None, ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, - **kwargs - ): + sap_sid: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword hostname: Gets or sets the target virtual machine size. :paramtype hostname: str @@ -1355,8 +1482,6 @@ def __init__( :paramtype db_password: str :keyword db_password_uri: Gets or sets the key vault URI to secret with the database password. :paramtype db_password_uri: str - :keyword db_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the DB. - :paramtype db_ssl_certificate_uri: str :keyword ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the DB. :paramtype ssl_certificate_uri: str :keyword ssl_host_name_in_certificate: Gets or sets the hostname(s) in the SSL certificate. @@ -1364,6 +1489,8 @@ def __init__( :keyword ssl_preference: Gets or sets certificate preference if secure communication is enabled. Known values are: "Disabled", "RootCertificate", and "ServerCertificate". :paramtype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference + :keyword sap_sid: Gets or sets the SAP System Identifier. + :paramtype sap_sid: str """ super().__init__(**kwargs) self.provider_type: str = "SapHana" @@ -1374,10 +1501,10 @@ def __init__( self.db_username = db_username self.db_password = db_password self.db_password_uri = db_password_uri - self.db_ssl_certificate_uri = db_ssl_certificate_uri self.ssl_certificate_uri = ssl_certificate_uri self.ssl_host_name_in_certificate = ssl_host_name_in_certificate self.ssl_preference = ssl_preference + self.sap_sid = sap_sid class HighAvailabilityConfiguration(_serialization.Model): @@ -1398,7 +1525,7 @@ class HighAvailabilityConfiguration(_serialization.Model): "high_availability_type": {"key": "highAvailabilityType", "type": "str"}, } - def __init__(self, *, high_availability_type: Union[str, "_models.SAPHighAvailabilityType"], **kwargs): + def __init__(self, *, high_availability_type: Union[str, "_models.SAPHighAvailabilityType"], **kwargs: Any) -> None: """ :keyword high_availability_type: The high availability type. Required. Known values are: "AvailabilitySet" and "AvailabilityZone". @@ -1430,7 +1557,7 @@ class HighAvailabilitySoftwareConfiguration(_serialization.Model): "fencing_client_password": {"key": "fencingClientPassword", "type": "str"}, } - def __init__(self, *, fencing_client_id: str, fencing_client_password: str, **kwargs): + def __init__(self, *, fencing_client_id: str, fencing_client_password: str, **kwargs: Any) -> None: """ :keyword fencing_client_id: The fencing client id. Required. :paramtype fencing_client_id: str @@ -1444,7 +1571,11 @@ def __init__(self, *, fencing_client_id: str, fencing_client_password: str, **kw class ImageReference(_serialization.Model): - """Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. + """Specifies information about the image to use. You can specify information about platform + images, marketplace images, or virtual machine images. This element is required when you want + to use a platform image, marketplace image, or virtual machine image, but is not used in other + creation operations. NOTE: Image reference publisher and offer can only be set when you create + the scale set. Variables are only populated by the server, and will be ignored when sending a request. @@ -1491,8 +1622,8 @@ def __init__( sku: Optional[str] = None, version: Optional[str] = None, shared_gallery_image_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: The image publisher. :paramtype publisher: str @@ -1550,7 +1681,7 @@ class InfrastructureConfiguration(_serialization.Model): "deployment_type": {"SingleServer": "SingleServerConfiguration", "ThreeTier": "ThreeTierConfiguration"} } - def __init__(self, *, app_resource_group: str, **kwargs): + def __init__(self, *, app_resource_group: str, **kwargs: Any) -> None: """ :keyword app_resource_group: The application resource group where SAP system resources will be deployed. Required. @@ -1583,14 +1714,17 @@ class OSConfiguration(_serialization.Model): _subtype_map = {"os_type": {"Linux": "LinuxConfiguration", "Windows": "WindowsConfiguration"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.os_type: Optional[str] = None class LinuxConfiguration(OSConfiguration): - """Specifies the Linux operating system settings on the virtual machine. :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions `_. + """Specifies the Linux operating system settings on the virtual machine. + :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions + `_. All required parameters must be populated in order to send to Azure. @@ -1623,8 +1757,8 @@ def __init__( disable_password_authentication: Optional[bool] = None, ssh: Optional["_models.SshConfiguration"] = None, ssh_key_pair: Optional["_models.SshKeyPair"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword disable_password_authentication: Specifies whether password authentication should be disabled. @@ -1642,6 +1776,90 @@ def __init__( self.ssh_key_pair = ssh_key_pair +class LoadBalancerDetails(_serialization.Model): + """The Load Balancer details such as Load Balancer ID. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class LoadBalancerResourceNames(_serialization.Model): + """The resource names object for load balancer and related resources. + + :ivar load_balancer_name: The full resource name for load balancer. If this value is not + provided, load balancer will be name as {ASCS/DB}-loadBalancer. + :vartype load_balancer_name: str + :ivar frontend_ip_configuration_names: The list of frontend IP configuration names. If provided + as input, size of this list should be 2 for cs layer and should be 1 for database layer. + :vartype frontend_ip_configuration_names: list[str] + :ivar backend_pool_names: The list of backend pool names. Currently, ACSS deploys only one + backend pool and hence, size of this list should be 1. + :vartype backend_pool_names: list[str] + :ivar health_probe_names: The list of health probe names. If provided as input, size of this + list should be 2 for cs layer and should be 1 for database layer. + :vartype health_probe_names: list[str] + """ + + _validation = { + "frontend_ip_configuration_names": {"max_items": 2, "min_items": 0}, + "backend_pool_names": {"max_items": 1, "min_items": 0}, + "health_probe_names": {"max_items": 2, "min_items": 0}, + } + + _attribute_map = { + "load_balancer_name": {"key": "loadBalancerName", "type": "str"}, + "frontend_ip_configuration_names": {"key": "frontendIpConfigurationNames", "type": "[str]"}, + "backend_pool_names": {"key": "backendPoolNames", "type": "[str]"}, + "health_probe_names": {"key": "healthProbeNames", "type": "[str]"}, + } + + def __init__( + self, + *, + load_balancer_name: Optional[str] = None, + frontend_ip_configuration_names: Optional[List[str]] = None, + backend_pool_names: Optional[List[str]] = None, + health_probe_names: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword load_balancer_name: The full resource name for load balancer. If this value is not + provided, load balancer will be name as {ASCS/DB}-loadBalancer. + :paramtype load_balancer_name: str + :keyword frontend_ip_configuration_names: The list of frontend IP configuration names. If + provided as input, size of this list should be 2 for cs layer and should be 1 for database + layer. + :paramtype frontend_ip_configuration_names: list[str] + :keyword backend_pool_names: The list of backend pool names. Currently, ACSS deploys only one + backend pool and hence, size of this list should be 1. + :paramtype backend_pool_names: list[str] + :keyword health_probe_names: The list of health probe names. If provided as input, size of this + list should be 2 for cs layer and should be 1 for database layer. + :paramtype health_probe_names: list[str] + """ + super().__init__(**kwargs) + self.load_balancer_name = load_balancer_name + self.frontend_ip_configuration_names = frontend_ip_configuration_names + self.backend_pool_names = backend_pool_names + self.health_probe_names = health_probe_names + + class ManagedRGConfiguration(_serialization.Model): """Managed resource group configuration. @@ -1653,7 +1871,7 @@ class ManagedRGConfiguration(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Managed resource group name. :paramtype name: str @@ -1704,7 +1922,7 @@ class MessageServerProperties(_serialization.Model): "health": {"key": "health", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.ms_port = None @@ -1748,7 +1966,7 @@ class Resource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1758,7 +1976,8 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -1798,7 +2017,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1910,8 +2129,8 @@ def __init__( managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, log_analytics_workspace_arm_id: Optional[str] = None, monitor_subnet: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1966,7 +2185,9 @@ class MonitorListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Monitor"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Monitor"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of SAP monitors. :paramtype value: list[~azure.mgmt.workloads.models.Monitor] @@ -2012,11 +2233,52 @@ class MonitorPropertiesErrors(Error): "inner_error": {"key": "innerError", "type": "ErrorInnerError"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) +class MountFileShareConfiguration(FileShareConfiguration): + """Gets or sets the file share configuration for externally mounted cases. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.ConfigurationType + :ivar id: The fileshare resource ID. Required. + :vartype id: str + :ivar private_endpoint_id: The private endpoint resource ID. Required. + :vartype private_endpoint_id: str + """ + + _validation = { + "configuration_type": {"required": True}, + "id": {"required": True}, + "private_endpoint_id": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "private_endpoint_id": {"key": "privateEndpointId", "type": "str"}, + } + + def __init__( + self, *, id: str, private_endpoint_id: str, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: + """ + :keyword id: The fileshare resource ID. Required. + :paramtype id: str + :keyword private_endpoint_id: The private endpoint resource ID. Required. + :paramtype private_endpoint_id: str + """ + super().__init__(**kwargs) + self.configuration_type: str = "Mount" + self.id = id + self.private_endpoint_id = private_endpoint_id + + class MsSqlServerProviderInstanceProperties(ProviderSpecificProperties): """Gets or sets the SQL server provider properties. @@ -2070,8 +2332,8 @@ def __init__( sap_sid: Optional[str] = None, ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, ssl_certificate_uri: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword hostname: Gets or sets the SQL server host name. :paramtype hostname: str @@ -2116,7 +2378,7 @@ class NetworkConfiguration(_serialization.Model): "is_secondary_ip_enabled": {"key": "isSecondaryIpEnabled", "type": "bool"}, } - def __init__(self, *, is_secondary_ip_enabled: bool = False, **kwargs): + def __init__(self, *, is_secondary_ip_enabled: bool = False, **kwargs: Any) -> None: """ :keyword is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to the network interface on all VMs of the SAP system being deployed. @@ -2126,166 +2388,38 @@ def __init__(self, *, is_secondary_ip_enabled: bool = False, **kwargs): self.is_secondary_ip_enabled = is_secondary_ip_enabled -class NetworkProfile(_serialization.Model): - """Network profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. +class NetworkInterfaceResourceNames(_serialization.Model): + """The resource names object for network interface and related resources. - :ivar load_balancer_type: Load balancer type. Required. Known values are: "ApplicationGateway" - and "LoadBalancer". - :vartype load_balancer_type: str or ~azure.mgmt.workloads.models.LoadBalancerType - :ivar load_balancer_sku: Load balancer SKU. - :vartype load_balancer_sku: str - :ivar load_balancer_tier: Load balancer tier. - :vartype load_balancer_tier: str - :ivar capacity: Capacity, applicable only for Application Gateway. - :vartype capacity: int - :ivar azure_front_door_enabled: Whether to enable Azure front door. Known values are: "Enabled" - and "Disabled". - :vartype azure_front_door_enabled: str or ~azure.mgmt.workloads.models.AzureFrontDoorEnabled - :ivar v_net_resource_id: Virtual network resource Id. - :vartype v_net_resource_id: str - :ivar load_balancer_resource_id: Azure Loadbalancer or ApplicationGateway resource Id. - :vartype load_balancer_resource_id: str - :ivar azure_front_door_resource_id: Azure front door resource id. - :vartype azure_front_door_resource_id: str - :ivar front_end_public_ip_resource_id: Loadbalancer front-end IP address resource Id. - :vartype front_end_public_ip_resource_id: str - :ivar outbound_public_ip_resource_ids: List of outbound public IP resource IDs. - :vartype outbound_public_ip_resource_ids: list[str] + :ivar network_interface_name: The full name for network interface. If name is not provided, + service uses a default name based on the deployment type. For SingleServer, default name is + {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + with an incrementor at the end in case of more than 1 instance per layer. For distributed and + HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end + in case of more than 1 instance per layer. + :vartype network_interface_name: str """ - _validation = { - "load_balancer_type": {"required": True}, - "v_net_resource_id": {"readonly": True}, - "load_balancer_resource_id": {"readonly": True}, - "azure_front_door_resource_id": {"readonly": True}, - "front_end_public_ip_resource_id": {"readonly": True}, - "outbound_public_ip_resource_ids": {"readonly": True}, - } - _attribute_map = { - "load_balancer_type": {"key": "loadBalancerType", "type": "str"}, - "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, - "load_balancer_tier": {"key": "loadBalancerTier", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - "azure_front_door_enabled": {"key": "azureFrontDoorEnabled", "type": "str"}, - "v_net_resource_id": {"key": "vNetResourceId", "type": "str"}, - "load_balancer_resource_id": {"key": "loadBalancerResourceId", "type": "str"}, - "azure_front_door_resource_id": {"key": "azureFrontDoorResourceId", "type": "str"}, - "front_end_public_ip_resource_id": {"key": "frontEndPublicIpResourceId", "type": "str"}, - "outbound_public_ip_resource_ids": {"key": "outboundPublicIpResourceIds", "type": "[str]"}, + "network_interface_name": {"key": "networkInterfaceName", "type": "str"}, } - def __init__( - self, - *, - load_balancer_type: Union[str, "_models.LoadBalancerType"], - load_balancer_sku: Optional[str] = None, - load_balancer_tier: Optional[str] = None, - capacity: Optional[int] = None, - azure_front_door_enabled: Optional[Union[str, "_models.AzureFrontDoorEnabled"]] = None, - **kwargs - ): - """ - :keyword load_balancer_type: Load balancer type. Required. Known values are: - "ApplicationGateway" and "LoadBalancer". - :paramtype load_balancer_type: str or ~azure.mgmt.workloads.models.LoadBalancerType - :keyword load_balancer_sku: Load balancer SKU. - :paramtype load_balancer_sku: str - :keyword load_balancer_tier: Load balancer tier. - :paramtype load_balancer_tier: str - :keyword capacity: Capacity, applicable only for Application Gateway. - :paramtype capacity: int - :keyword azure_front_door_enabled: Whether to enable Azure front door. Known values are: - "Enabled" and "Disabled". - :paramtype azure_front_door_enabled: str or ~azure.mgmt.workloads.models.AzureFrontDoorEnabled + def __init__(self, *, network_interface_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword network_interface_name: The full name for network interface. If name is not provided, + service uses a default name based on the deployment type. For SingleServer, default name is + {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + with an incrementor at the end in case of more than 1 instance per layer. For distributed and + HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end + in case of more than 1 instance per layer. + :paramtype network_interface_name: str """ super().__init__(**kwargs) - self.load_balancer_type = load_balancer_type - self.load_balancer_sku = load_balancer_sku - self.load_balancer_tier = load_balancer_tier - self.capacity = capacity - self.azure_front_door_enabled = azure_front_door_enabled - self.v_net_resource_id = None - self.load_balancer_resource_id = None - self.azure_front_door_resource_id = None - self.front_end_public_ip_resource_id = None - self.outbound_public_ip_resource_ids = None + self.network_interface_name = network_interface_name -class NodeProfile(_serialization.Model): - """VM or VMSS node profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: VM or VMSS name. - :vartype name: str - :ivar node_sku: VM SKU for node(s). Required. - :vartype node_sku: str - :ivar os_image: OS image used for creating the nodes. Required. - :vartype os_image: ~azure.mgmt.workloads.models.OsImageProfile - :ivar os_disk: OS disk details. Required. - :vartype os_disk: ~azure.mgmt.workloads.models.DiskInfo - :ivar data_disks: Data disks details. This property is not in use right now. - :vartype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] - :ivar node_resource_ids: VM/VMSS resource ARM Ids. - :vartype node_resource_ids: list[str] - """ - - _validation = { - "node_sku": {"required": True}, - "os_image": {"required": True}, - "os_disk": {"required": True}, - "node_resource_ids": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "node_sku": {"key": "nodeSku", "type": "str"}, - "os_image": {"key": "osImage", "type": "OsImageProfile"}, - "os_disk": {"key": "osDisk", "type": "DiskInfo"}, - "data_disks": {"key": "dataDisks", "type": "[DiskInfo]"}, - "node_resource_ids": {"key": "nodeResourceIds", "type": "[str]"}, - } - - def __init__( - self, - *, - node_sku: str, - os_image: "_models.OsImageProfile", - os_disk: "_models.DiskInfo", - name: Optional[str] = None, - data_disks: Optional[List["_models.DiskInfo"]] = None, - **kwargs - ): - """ - :keyword name: VM or VMSS name. - :paramtype name: str - :keyword node_sku: VM SKU for node(s). Required. - :paramtype node_sku: str - :keyword os_image: OS image used for creating the nodes. Required. - :paramtype os_image: ~azure.mgmt.workloads.models.OsImageProfile - :keyword os_disk: OS disk details. Required. - :paramtype os_disk: ~azure.mgmt.workloads.models.DiskInfo - :keyword data_disks: Data disks details. This property is not in use right now. - :paramtype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] - """ - super().__init__(**kwargs) - self.name = name - self.node_sku = node_sku - self.os_image = os_image - self.os_disk = os_disk - self.data_disks = data_disks - self.node_resource_ids = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. Variables are only populated by the server, and will be ignored when sending a request. @@ -2321,7 +2455,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.workloads.models.OperationDisplay @@ -2367,7 +2501,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2377,7 +2511,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -2397,7 +2532,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2465,8 +2600,8 @@ def __init__( display: Optional["_models.OperationsDefinitionDisplay"] = None, action_type: Optional[Union[str, "_models.WorkloadMonitorActionType"]] = None, properties: Optional[Any] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_properties_name: Name of the operation. :paramtype name_properties_name: str @@ -2536,8 +2671,8 @@ def __init__( origin: Optional[Union[str, "_models.OperationProperties"]] = None, action_type: Optional[Union[str, "_models.WorkloadMonitorActionType"]] = None, properties: Optional[Any] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. Required. :paramtype name: str @@ -2578,8 +2713,12 @@ class OperationsDefinitionArrayResponseWithContinuation(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OperationsDefinition"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.OperationsDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Defines the workload operation definition response properties. :paramtype value: list[~azure.mgmt.workloads.models.OperationsDefinition] @@ -2620,7 +2759,7 @@ class OperationsDisplayDefinition(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs): + def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs: Any) -> None: """ :keyword provider: Defines the workload provider. Required. :paramtype provider: str @@ -2667,7 +2806,7 @@ class OperationsDefinitionDisplay(OperationsDisplayDefinition): "description": {"key": "description", "type": "str"}, } - def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs): + def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs: Any) -> None: """ :keyword provider: Defines the workload provider. Required. :paramtype provider: str @@ -2731,8 +2870,8 @@ def __init__( end_time: Optional[datetime.datetime] = None, operations: Optional[List["_models.OperationStatusResult"]] = None, error: Optional["_models.ErrorDetail"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified ID for the async operation. :paramtype id: str @@ -2762,54 +2901,9 @@ def __init__( self.error = error -class OsImageProfile(_serialization.Model): - """OS image profile. - - :ivar publisher: OS image publisher. "Canonical" - :vartype publisher: str or ~azure.mgmt.workloads.models.OSImagePublisher - :ivar offer: OS image offer. "UbuntuServer" - :vartype offer: str or ~azure.mgmt.workloads.models.OSImageOffer - :ivar sku: OS image sku. Known values are: "18.04-LTS" and "16.04-LTS". - :vartype sku: str or ~azure.mgmt.workloads.models.OSImageSku - :ivar version: OS image version. "latest" - :vartype version: str or ~azure.mgmt.workloads.models.OSImageVersion - """ - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "offer": {"key": "offer", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - publisher: Optional[Union[str, "_models.OSImagePublisher"]] = None, - offer: Optional[Union[str, "_models.OSImageOffer"]] = None, - sku: Optional[Union[str, "_models.OSImageSku"]] = None, - version: Optional[Union[str, "_models.OSImageVersion"]] = None, - **kwargs - ): - """ - :keyword publisher: OS image publisher. "Canonical" - :paramtype publisher: str or ~azure.mgmt.workloads.models.OSImagePublisher - :keyword offer: OS image offer. "UbuntuServer" - :paramtype offer: str or ~azure.mgmt.workloads.models.OSImageOffer - :keyword sku: OS image sku. Known values are: "18.04-LTS" and "16.04-LTS". - :paramtype sku: str or ~azure.mgmt.workloads.models.OSImageSku - :keyword version: OS image version. "latest" - :paramtype version: str or ~azure.mgmt.workloads.models.OSImageVersion - """ - super().__init__(**kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku - self.version = version - - class OSProfile(_serialization.Model): - """Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned. + """Specifies the operating system settings for the virtual machine. Some of the settings cannot be + changed once VM is provisioned. :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` This property cannot be updated after the VM is created. :code:`
`:code:`
` @@ -2852,8 +2946,8 @@ def __init__( admin_username: Optional[str] = None, admin_password: Optional[str] = None, os_configuration: Optional["_models.OSConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` This property cannot be updated after the VM is created. @@ -2910,8 +3004,8 @@ def __init__( *, deployer_vm_packages: Optional["_models.DeployerVmPackages"] = None, sap_fqdn: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword deployer_vm_packages: The url and storage account ID where deployer VM packages are uploaded. @@ -2924,147 +3018,183 @@ def __init__( self.sap_fqdn = sap_fqdn -class PatchResourceRequestBody(_serialization.Model): - """Resource patch request body. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: - :vartype identity: ~azure.mgmt.workloads.models.PatchResourceRequestBodyIdentity - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "PatchResourceRequestBodyIdentity"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.PatchResourceRequestBodyIdentity"] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: - :paramtype identity: ~azure.mgmt.workloads.models.PatchResourceRequestBodyIdentity - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - - -class UserAssignedServiceIdentity(_serialization.Model): - """Managed service identity (user assigned identities). +class PrometheusHaClusterProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the PrometheusHaCluster provider properties. All required parameters must be populated in order to send to Azure. - :ivar type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType - :ivar user_assigned_identities: User assigned identities dictionary. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] + :ivar provider_type: The provider type. For example, the value can be SapHana. Required. + :vartype provider_type: str + :ivar prometheus_url: URL of the Node Exporter endpoint. + :vartype prometheus_url: str + :ivar hostname: Gets or sets the target machine name. + :vartype hostname: str + :ivar sid: Gets or sets the cluster sid. + :vartype sid: str + :ivar cluster_name: Gets or sets the clusterName. + :vartype cluster_name: str + :ivar ssl_preference: Gets or sets certificate preference if secure communication is enabled. + Known values are: "Disabled", "RootCertificate", and "ServerCertificate". + :vartype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference + :ivar ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the HA cluster + exporter. + :vartype ssl_certificate_uri: str """ _validation = { - "type": {"required": True}, + "provider_type": {"required": True}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + "provider_type": {"key": "providerType", "type": "str"}, + "prometheus_url": {"key": "prometheusUrl", "type": "str"}, + "hostname": {"key": "hostname", "type": "str"}, + "sid": {"key": "sid", "type": "str"}, + "cluster_name": {"key": "clusterName", "type": "str"}, + "ssl_preference": {"key": "sslPreference", "type": "str"}, + "ssl_certificate_uri": {"key": "sslCertificateUri", "type": "str"}, } def __init__( self, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + prometheus_url: Optional[str] = None, + hostname: Optional[str] = None, + sid: Optional[str] = None, + cluster_name: Optional[str] = None, + ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, + ssl_certificate_uri: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType - :keyword user_assigned_identities: User assigned identities dictionary. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.workloads.models.UserAssignedIdentity] + :keyword prometheus_url: URL of the Node Exporter endpoint. + :paramtype prometheus_url: str + :keyword hostname: Gets or sets the target machine name. + :paramtype hostname: str + :keyword sid: Gets or sets the cluster sid. + :paramtype sid: str + :keyword cluster_name: Gets or sets the clusterName. + :paramtype cluster_name: str + :keyword ssl_preference: Gets or sets certificate preference if secure communication is + enabled. Known values are: "Disabled", "RootCertificate", and "ServerCertificate". + :paramtype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference + :keyword ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the HA cluster + exporter. + :paramtype ssl_certificate_uri: str """ super().__init__(**kwargs) - self.type = type - self.user_assigned_identities = user_assigned_identities + self.provider_type: str = "PrometheusHaCluster" + self.prometheus_url = prometheus_url + self.hostname = hostname + self.sid = sid + self.cluster_name = cluster_name + self.ssl_preference = ssl_preference + self.ssl_certificate_uri = ssl_certificate_uri -class PatchResourceRequestBodyIdentity(UserAssignedServiceIdentity): - """PatchResourceRequestBodyIdentity. +class PrometheusOSProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the PrometheusOS provider properties. All required parameters must be populated in order to send to Azure. - :ivar type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType - :ivar user_assigned_identities: User assigned identities dictionary. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] + :ivar provider_type: The provider type. For example, the value can be SapHana. Required. + :vartype provider_type: str + :ivar prometheus_url: URL of the Node Exporter endpoint. + :vartype prometheus_url: str + :ivar ssl_preference: Gets or sets certificate preference if secure communication is enabled. + Known values are: "Disabled", "RootCertificate", and "ServerCertificate". + :vartype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference + :ivar ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the prometheus node + exporter. + :vartype ssl_certificate_uri: str + :ivar sap_sid: Gets or sets the SAP System Identifier. + :vartype sap_sid: str """ _validation = { - "type": {"required": True}, + "provider_type": {"required": True}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + "provider_type": {"key": "providerType", "type": "str"}, + "prometheus_url": {"key": "prometheusUrl", "type": "str"}, + "ssl_preference": {"key": "sslPreference", "type": "str"}, + "ssl_certificate_uri": {"key": "sslCertificateUri", "type": "str"}, + "sap_sid": {"key": "sapSid", "type": "str"}, } def __init__( self, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + prometheus_url: Optional[str] = None, + ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, + ssl_certificate_uri: Optional[str] = None, + sap_sid: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType - :keyword user_assigned_identities: User assigned identities dictionary. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.workloads.models.UserAssignedIdentity] + :keyword prometheus_url: URL of the Node Exporter endpoint. + :paramtype prometheus_url: str + :keyword ssl_preference: Gets or sets certificate preference if secure communication is + enabled. Known values are: "Disabled", "RootCertificate", and "ServerCertificate". + :paramtype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference + :keyword ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the prometheus + node exporter. + :paramtype ssl_certificate_uri: str + :keyword sap_sid: Gets or sets the SAP System Identifier. + :paramtype sap_sid: str """ - super().__init__(type=type, user_assigned_identities=user_assigned_identities, **kwargs) + super().__init__(**kwargs) + self.provider_type: str = "PrometheusOS" + self.prometheus_url = prometheus_url + self.ssl_preference = ssl_preference + self.ssl_certificate_uri = ssl_certificate_uri + self.sap_sid = sap_sid -class PhpProfile(_serialization.Model): - """PHP profile. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: PHP version. Required. Known values are: "7.2", "7.3", and "7.4". - :vartype version: str or ~azure.mgmt.workloads.models.PHPVersion + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData """ _validation = { - "version": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "version": {"key": "version", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, version: Union[str, "_models.PHPVersion"], **kwargs): - """ - :keyword version: PHP version. Required. Known values are: "7.2", "7.3", and "7.4". - :paramtype version: str or ~azure.mgmt.workloads.models.PHPVersion - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.version = version -class PhpWorkloadResource(TrackedResource): # pylint: disable=too-many-instance-attributes - """Php workload resource. +class ProviderInstance(ProxyResource): + """A provider instance associated with SAP monitor. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -3076,49 +3206,16 @@ class PhpWorkloadResource(TrackedResource): # pylint: disable=too-many-instance :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.workloads.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar kind: Indicates which kind of php workload this resource represent e.g WordPress. - Required. "WordPress" - :vartype kind: str or ~azure.mgmt.workloads.models.WorkloadKind - :ivar sku: Php workloads SKU. - :vartype sku: ~azure.mgmt.workloads.models.Sku - :ivar identity: Identity for the resource. Currently not supported. - :vartype identity: ~azure.mgmt.workloads.models.PhpWorkloadResourceIdentity - :ivar app_location: The infra resources for PHP workload will be created in this location. - :vartype app_location: str - :ivar managed_resource_group_configuration: Managed resource group configuration of the - workload. - :vartype managed_resource_group_configuration: - ~azure.mgmt.workloads.models.ManagedRGConfiguration - :ivar admin_user_profile: Admin user profile used for VM and VMSS. - :vartype admin_user_profile: ~azure.mgmt.workloads.models.UserProfile - :ivar web_nodes_profile: VMSS web nodes profile. - :vartype web_nodes_profile: ~azure.mgmt.workloads.models.VmssNodesProfile - :ivar controller_profile: Controller VM profile. - :vartype controller_profile: ~azure.mgmt.workloads.models.NodeProfile - :ivar network_profile: Network profile. - :vartype network_profile: ~azure.mgmt.workloads.models.NetworkProfile - :ivar database_profile: Database profile. - :vartype database_profile: ~azure.mgmt.workloads.models.DatabaseProfile - :ivar site_profile: Site profile. - :vartype site_profile: ~azure.mgmt.workloads.models.SiteProfile - :ivar fileshare_profile: File share profile. - :vartype fileshare_profile: ~azure.mgmt.workloads.models.FileshareProfile - :ivar php_profile: PHP profile. - :vartype php_profile: ~azure.mgmt.workloads.models.PhpProfile - :ivar search_profile: Search profile. - :vartype search_profile: ~azure.mgmt.workloads.models.SearchProfile - :ivar cache_profile: Cache profile. - :vartype cache_profile: ~azure.mgmt.workloads.models.CacheProfile - :ivar backup_profile: Backup profile. - :vartype backup_profile: ~azure.mgmt.workloads.models.BackupProfile - :ivar provisioning_state: Php workload resource provisioning state. Known values are: - "NotSpecified", "Accepted", "Created", "Succeeded", "Failed", "Canceled", "Provisioning", and - "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.workloads.models.PhpWorkloadProvisioningState + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + :ivar provisioning_state: State of provisioning of the provider instance. Known values are: + "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.WorkloadMonitorProvisioningState + :ivar errors: Defines the provider instance errors. + :vartype errors: ~azure.mgmt.workloads.models.ProviderInstancePropertiesErrors + :ivar provider_settings: Defines the provider instance errors. + :vartype provider_settings: ~azure.mgmt.workloads.models.ProviderSpecificProperties """ _validation = { @@ -3126,9 +3223,8 @@ class PhpWorkloadResource(TrackedResource): # pylint: disable=too-many-instance "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "kind": {"required": True}, "provisioning_state": {"readonly": True}, + "errors": {"readonly": True}, } _attribute_map = { @@ -3136,386 +3232,7 @@ class PhpWorkloadResource(TrackedResource): # pylint: disable=too-many-instance "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "sku": {"key": "sku", "type": "Sku"}, - "identity": {"key": "identity", "type": "PhpWorkloadResourceIdentity"}, - "app_location": {"key": "properties.appLocation", "type": "str"}, - "managed_resource_group_configuration": { - "key": "properties.managedResourceGroupConfiguration", - "type": "ManagedRGConfiguration", - }, - "admin_user_profile": {"key": "properties.adminUserProfile", "type": "UserProfile"}, - "web_nodes_profile": {"key": "properties.webNodesProfile", "type": "VmssNodesProfile"}, - "controller_profile": {"key": "properties.controllerProfile", "type": "NodeProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "database_profile": {"key": "properties.databaseProfile", "type": "DatabaseProfile"}, - "site_profile": {"key": "properties.siteProfile", "type": "SiteProfile"}, - "fileshare_profile": {"key": "properties.fileshareProfile", "type": "FileshareProfile"}, - "php_profile": {"key": "properties.phpProfile", "type": "PhpProfile"}, - "search_profile": {"key": "properties.searchProfile", "type": "SearchProfile"}, - "cache_profile": {"key": "properties.cacheProfile", "type": "CacheProfile"}, - "backup_profile": {"key": "properties.backupProfile", "type": "BackupProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - kind: Union[str, "_models.WorkloadKind"], - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - identity: Optional["_models.PhpWorkloadResourceIdentity"] = None, - app_location: Optional[str] = None, - managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, - admin_user_profile: Optional["_models.UserProfile"] = None, - web_nodes_profile: Optional["_models.VmssNodesProfile"] = None, - controller_profile: Optional["_models.NodeProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - database_profile: Optional["_models.DatabaseProfile"] = None, - site_profile: Optional["_models.SiteProfile"] = None, - fileshare_profile: Optional["_models.FileshareProfile"] = None, - php_profile: Optional["_models.PhpProfile"] = None, - search_profile: Optional["_models.SearchProfile"] = None, - cache_profile: Optional["_models.CacheProfile"] = None, - backup_profile: Optional["_models.BackupProfile"] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword kind: Indicates which kind of php workload this resource represent e.g WordPress. - Required. "WordPress" - :paramtype kind: str or ~azure.mgmt.workloads.models.WorkloadKind - :keyword sku: Php workloads SKU. - :paramtype sku: ~azure.mgmt.workloads.models.Sku - :keyword identity: Identity for the resource. Currently not supported. - :paramtype identity: ~azure.mgmt.workloads.models.PhpWorkloadResourceIdentity - :keyword app_location: The infra resources for PHP workload will be created in this location. - :paramtype app_location: str - :keyword managed_resource_group_configuration: Managed resource group configuration of the - workload. - :paramtype managed_resource_group_configuration: - ~azure.mgmt.workloads.models.ManagedRGConfiguration - :keyword admin_user_profile: Admin user profile used for VM and VMSS. - :paramtype admin_user_profile: ~azure.mgmt.workloads.models.UserProfile - :keyword web_nodes_profile: VMSS web nodes profile. - :paramtype web_nodes_profile: ~azure.mgmt.workloads.models.VmssNodesProfile - :keyword controller_profile: Controller VM profile. - :paramtype controller_profile: ~azure.mgmt.workloads.models.NodeProfile - :keyword network_profile: Network profile. - :paramtype network_profile: ~azure.mgmt.workloads.models.NetworkProfile - :keyword database_profile: Database profile. - :paramtype database_profile: ~azure.mgmt.workloads.models.DatabaseProfile - :keyword site_profile: Site profile. - :paramtype site_profile: ~azure.mgmt.workloads.models.SiteProfile - :keyword fileshare_profile: File share profile. - :paramtype fileshare_profile: ~azure.mgmt.workloads.models.FileshareProfile - :keyword php_profile: PHP profile. - :paramtype php_profile: ~azure.mgmt.workloads.models.PhpProfile - :keyword search_profile: Search profile. - :paramtype search_profile: ~azure.mgmt.workloads.models.SearchProfile - :keyword cache_profile: Cache profile. - :paramtype cache_profile: ~azure.mgmt.workloads.models.CacheProfile - :keyword backup_profile: Backup profile. - :paramtype backup_profile: ~azure.mgmt.workloads.models.BackupProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.kind = kind - self.sku = sku - self.identity = identity - self.app_location = app_location - self.managed_resource_group_configuration = managed_resource_group_configuration - self.admin_user_profile = admin_user_profile - self.web_nodes_profile = web_nodes_profile - self.controller_profile = controller_profile - self.network_profile = network_profile - self.database_profile = database_profile - self.site_profile = site_profile - self.fileshare_profile = fileshare_profile - self.php_profile = php_profile - self.search_profile = search_profile - self.cache_profile = cache_profile - self.backup_profile = backup_profile - self.provisioning_state = None - - -class PhpWorkloadResourceIdentity(UserAssignedServiceIdentity): - """Identity for the resource. Currently not supported. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType - :ivar user_assigned_identities: User assigned identities dictionary. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): - """ - :keyword type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType - :keyword user_assigned_identities: User assigned identities dictionary. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.workloads.models.UserAssignedIdentity] - """ - super().__init__(type=type, user_assigned_identities=user_assigned_identities, **kwargs) - - -class PhpWorkloadResourceList(_serialization.Model): - """Php workload resource list. - - :ivar value: List of resources in current page. - :vartype value: list[~azure.mgmt.workloads.models.PhpWorkloadResource] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PhpWorkloadResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.PhpWorkloadResource"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: List of resources in current page. - :paramtype value: list[~azure.mgmt.workloads.models.PhpWorkloadResource] - :keyword next_link: Link to next page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrometheusHaClusterProviderInstanceProperties(ProviderSpecificProperties): - """Gets or sets the PrometheusHaCluster provider properties. - - All required parameters must be populated in order to send to Azure. - - :ivar provider_type: The provider type. For example, the value can be SapHana. Required. - :vartype provider_type: str - :ivar prometheus_url: URL of the Node Exporter endpoint. - :vartype prometheus_url: str - :ivar hostname: Gets or sets the target machine name. - :vartype hostname: str - :ivar sid: Gets or sets the cluster sid. - :vartype sid: str - :ivar cluster_name: Gets or sets the clusterName. - :vartype cluster_name: str - :ivar ssl_preference: Gets or sets certificate preference if secure communication is enabled. - Known values are: "Disabled", "RootCertificate", and "ServerCertificate". - :vartype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference - :ivar ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the HA cluster - exporter. - :vartype ssl_certificate_uri: str - """ - - _validation = { - "provider_type": {"required": True}, - } - - _attribute_map = { - "provider_type": {"key": "providerType", "type": "str"}, - "prometheus_url": {"key": "prometheusUrl", "type": "str"}, - "hostname": {"key": "hostname", "type": "str"}, - "sid": {"key": "sid", "type": "str"}, - "cluster_name": {"key": "clusterName", "type": "str"}, - "ssl_preference": {"key": "sslPreference", "type": "str"}, - "ssl_certificate_uri": {"key": "sslCertificateUri", "type": "str"}, - } - - def __init__( - self, - *, - prometheus_url: Optional[str] = None, - hostname: Optional[str] = None, - sid: Optional[str] = None, - cluster_name: Optional[str] = None, - ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, - ssl_certificate_uri: Optional[str] = None, - **kwargs - ): - """ - :keyword prometheus_url: URL of the Node Exporter endpoint. - :paramtype prometheus_url: str - :keyword hostname: Gets or sets the target machine name. - :paramtype hostname: str - :keyword sid: Gets or sets the cluster sid. - :paramtype sid: str - :keyword cluster_name: Gets or sets the clusterName. - :paramtype cluster_name: str - :keyword ssl_preference: Gets or sets certificate preference if secure communication is - enabled. Known values are: "Disabled", "RootCertificate", and "ServerCertificate". - :paramtype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference - :keyword ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the HA cluster - exporter. - :paramtype ssl_certificate_uri: str - """ - super().__init__(**kwargs) - self.provider_type: str = "PrometheusHaCluster" - self.prometheus_url = prometheus_url - self.hostname = hostname - self.sid = sid - self.cluster_name = cluster_name - self.ssl_preference = ssl_preference - self.ssl_certificate_uri = ssl_certificate_uri - - -class PrometheusOSProviderInstanceProperties(ProviderSpecificProperties): - """Gets or sets the PrometheusOS provider properties. - - All required parameters must be populated in order to send to Azure. - - :ivar provider_type: The provider type. For example, the value can be SapHana. Required. - :vartype provider_type: str - :ivar prometheus_url: URL of the Node Exporter endpoint. - :vartype prometheus_url: str - :ivar ssl_preference: Gets or sets certificate preference if secure communication is enabled. - Known values are: "Disabled", "RootCertificate", and "ServerCertificate". - :vartype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference - :ivar ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the prometheus node - exporter. - :vartype ssl_certificate_uri: str - """ - - _validation = { - "provider_type": {"required": True}, - } - - _attribute_map = { - "provider_type": {"key": "providerType", "type": "str"}, - "prometheus_url": {"key": "prometheusUrl", "type": "str"}, - "ssl_preference": {"key": "sslPreference", "type": "str"}, - "ssl_certificate_uri": {"key": "sslCertificateUri", "type": "str"}, - } - - def __init__( - self, - *, - prometheus_url: Optional[str] = None, - ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, - ssl_certificate_uri: Optional[str] = None, - **kwargs - ): - """ - :keyword prometheus_url: URL of the Node Exporter endpoint. - :paramtype prometheus_url: str - :keyword ssl_preference: Gets or sets certificate preference if secure communication is - enabled. Known values are: "Disabled", "RootCertificate", and "ServerCertificate". - :paramtype ssl_preference: str or ~azure.mgmt.workloads.models.SslPreference - :keyword ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the prometheus - node exporter. - :paramtype ssl_certificate_uri: str - """ - super().__init__(**kwargs) - self.provider_type: str = "PrometheusOS" - self.prometheus_url = prometheus_url - self.ssl_preference = ssl_preference - self.ssl_certificate_uri = ssl_certificate_uri - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.workloads.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - - -class ProviderInstance(ProxyResource): - """A provider instance associated with SAP monitor. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.workloads.models.SystemData - :ivar identity: Managed service identity (user assigned identities). - :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity - :ivar provisioning_state: State of provisioning of the provider instance. Known values are: - "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". - :vartype provisioning_state: str or - ~azure.mgmt.workloads.models.WorkloadMonitorProvisioningState - :ivar errors: Defines the provider instance errors. - :vartype errors: ~azure.mgmt.workloads.models.ProviderInstancePropertiesErrors - :ivar provider_settings: Defines the provider instance errors. - :vartype provider_settings: ~azure.mgmt.workloads.models.ProviderSpecificProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "errors": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "UserAssignedServiceIdentity"}, + "identity": {"key": "identity", "type": "UserAssignedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "errors": {"key": "properties.errors", "type": "ProviderInstancePropertiesErrors"}, "provider_settings": {"key": "properties.providerSettings", "type": "ProviderSpecificProperties"}, @@ -3526,8 +3243,8 @@ def __init__( *, identity: Optional["_models.UserAssignedServiceIdentity"] = None, provider_settings: Optional["_models.ProviderSpecificProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: Managed service identity (user assigned identities). :paramtype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity @@ -3556,8 +3273,12 @@ class ProviderInstanceListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ProviderInstance"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ProviderInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of provider instances. :paramtype value: list[~azure.mgmt.workloads.models.ProviderInstance] @@ -3600,38 +3321,12 @@ class ProviderInstancePropertiesErrors(Error): "message": {"key": "message", "type": "str"}, "target": {"key": "target", "type": "str"}, "details": {"key": "details", "type": "[Error]"}, - "inner_error": {"key": "innerError", "type": "ErrorInnerError"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - - -class RestrictionInfo(_serialization.Model): - """The SKU restriction information. - - :ivar locations: The restriction locations. - :vartype locations: list[str] - :ivar zones: The restriction zones. - :vartype zones: list[str] - """ - - _attribute_map = { - "locations": {"key": "locations", "type": "[str]"}, - "zones": {"key": "zones", "type": "[str]"}, + "inner_error": {"key": "innerError", "type": "ErrorInnerError"}, } - def __init__(self, *, locations: Optional[List[str]] = None, zones: Optional[List[str]] = None, **kwargs): - """ - :keyword locations: The restriction locations. - :paramtype locations: list[str] - :keyword zones: The restriction zones. - :paramtype zones: list[str] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.locations = locations - self.zones = zones class SAPApplicationServerInstance(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -3674,10 +3369,13 @@ class SAPApplicationServerInstance(TrackedResource): # pylint: disable=too-many :vartype icm_http_port: int :ivar icm_https_port: Application server instance ICM HTTPS Port. :vartype icm_https_port: int - :ivar virtual_machine_id: The virtual machine. - :vartype virtual_machine_id: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to + Application Server Virtual Machines. + :vartype load_balancer_details: ~azure.mgmt.workloads.models.LoadBalancerDetails + :ivar vm_details: The list of virtual machines. + :vartype vm_details: list[~azure.mgmt.workloads.models.ApplicationServerVmDetails] :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", and "Unavailable". + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", "Unhealthy", and "Degraded". @@ -3705,7 +3403,8 @@ class SAPApplicationServerInstance(TrackedResource): # pylint: disable=too-many "gateway_port": {"readonly": True}, "icm_http_port": {"readonly": True}, "icm_https_port": {"readonly": True}, - "virtual_machine_id": {"readonly": True}, + "load_balancer_details": {"readonly": True}, + "vm_details": {"readonly": True}, "status": {"readonly": True}, "health": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -3728,14 +3427,15 @@ class SAPApplicationServerInstance(TrackedResource): # pylint: disable=too-many "gateway_port": {"key": "properties.gatewayPort", "type": "int"}, "icm_http_port": {"key": "properties.icmHttpPort", "type": "int"}, "icm_https_port": {"key": "properties.icmHttpsPort", "type": "int"}, - "virtual_machine_id": {"key": "properties.virtualMachineId", "type": "str"}, + "load_balancer_details": {"key": "properties.loadBalancerDetails", "type": "LoadBalancerDetails"}, + "vm_details": {"key": "properties.vmDetails", "type": "[ApplicationServerVmDetails]"}, "status": {"key": "properties.status", "type": "str"}, "health": {"key": "properties.health", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "errors": {"key": "properties.errors", "type": "SAPVirtualInstanceError"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3752,7 +3452,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.gateway_port = None self.icm_http_port = None self.icm_https_port = None - self.virtual_machine_id = None + self.load_balancer_details = None + self.vm_details = None self.status = None self.health = None self.provisioning_state = None @@ -3778,8 +3479,8 @@ def __init__( *, value: Optional[List["_models.SAPApplicationServerInstance"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets the list of SAP Application Server instance resources. :paramtype value: list[~azure.mgmt.workloads.models.SAPApplicationServerInstance] @@ -3824,8 +3525,8 @@ def __init__( app_location: str, sap_product: Union[str, "_models.SAPProductType"], database_type: Union[str, "_models.SAPDatabaseType"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword app_location: The geo-location where the SAP resources will be created. Required. :paramtype app_location: str @@ -3853,7 +3554,9 @@ class SAPAvailabilityZoneDetailsResult(_serialization.Model): "availability_zone_pairs": {"key": "availabilityZonePairs", "type": "[SAPAvailabilityZonePair]"}, } - def __init__(self, *, availability_zone_pairs: Optional[List["_models.SAPAvailabilityZonePair"]] = None, **kwargs): + def __init__( + self, *, availability_zone_pairs: Optional[List["_models.SAPAvailabilityZonePair"]] = None, **kwargs: Any + ) -> None: """ :keyword availability_zone_pairs: Gets the list of availability zone pairs. :paramtype availability_zone_pairs: list[~azure.mgmt.workloads.models.SAPAvailabilityZonePair] @@ -3876,7 +3579,7 @@ class SAPAvailabilityZonePair(_serialization.Model): "zone_b": {"key": "zoneB", "type": "int"}, } - def __init__(self, *, zone_a: Optional[int] = None, zone_b: Optional[int] = None, **kwargs): + def __init__(self, *, zone_a: Optional[int] = None, zone_b: Optional[int] = None, **kwargs: Any) -> None: """ :keyword zone_a: The zone A. :paramtype zone_a: int @@ -3907,8 +3610,8 @@ def __init__( *, value: Optional[List["_models.SAPCentralServerInstance"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets the list of SAP central services instance resources. :paramtype value: list[~azure.mgmt.workloads.models.SAPCentralServerInstance] @@ -3960,10 +3663,13 @@ class SAPCentralServerInstance(TrackedResource): # pylint: disable=too-many-ins :vartype kernel_version: str :ivar kernel_patch: The central services instance Kernel Patch level. :vartype kernel_patch: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to ASCS + Virtual Machines. + :vartype load_balancer_details: ~azure.mgmt.workloads.models.LoadBalancerDetails :ivar vm_details: The list of virtual machines corresponding to the Central Services instance. :vartype vm_details: list[~azure.mgmt.workloads.models.CentralServerVmDetails] :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", and "Unavailable". + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", "Unhealthy", and "Degraded". @@ -3986,6 +3692,7 @@ class SAPCentralServerInstance(TrackedResource): # pylint: disable=too-many-ins "subnet": {"readonly": True}, "kernel_version": {"readonly": True}, "kernel_patch": {"readonly": True}, + "load_balancer_details": {"readonly": True}, "vm_details": {"readonly": True}, "status": {"readonly": True}, "health": {"readonly": True}, @@ -4011,6 +3718,7 @@ class SAPCentralServerInstance(TrackedResource): # pylint: disable=too-many-ins }, "kernel_version": {"key": "properties.kernelVersion", "type": "str"}, "kernel_patch": {"key": "properties.kernelPatch", "type": "str"}, + "load_balancer_details": {"key": "properties.loadBalancerDetails", "type": "LoadBalancerDetails"}, "vm_details": {"key": "properties.vmDetails", "type": "[CentralServerVmDetails]"}, "status": {"key": "properties.status", "type": "str"}, "health": {"key": "properties.health", "type": "str"}, @@ -4027,8 +3735,8 @@ def __init__( enqueue_server_properties: Optional["_models.EnqueueServerProperties"] = None, gateway_server_properties: Optional["_models.GatewayServerProperties"] = None, enqueue_replication_server_properties: Optional["_models.EnqueueReplicationServerProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -4054,6 +3762,7 @@ def __init__( self.enqueue_replication_server_properties = enqueue_replication_server_properties self.kernel_version = None self.kernel_patch = None + self.load_balancer_details = None self.vm_details = None self.status = None self.health = None @@ -4092,10 +3801,13 @@ class SAPDatabaseInstance(TrackedResource): # pylint: disable=too-many-instance :vartype database_type: str :ivar ip_address: Database IP Address. :vartype ip_address: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to + Database Virtual Machines. + :vartype load_balancer_details: ~azure.mgmt.workloads.models.LoadBalancerDetails :ivar vm_details: The list of virtual machines corresponding to the Database resource. :vartype vm_details: list[~azure.mgmt.workloads.models.DatabaseVmDetails] :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", and "Unavailable". + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", "Updating", "Creating", "Failed", and "Deleting". @@ -4115,6 +3827,7 @@ class SAPDatabaseInstance(TrackedResource): # pylint: disable=too-many-instance "database_sid": {"readonly": True}, "database_type": {"readonly": True}, "ip_address": {"readonly": True}, + "load_balancer_details": {"readonly": True}, "vm_details": {"readonly": True}, "status": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -4132,13 +3845,14 @@ class SAPDatabaseInstance(TrackedResource): # pylint: disable=too-many-instance "database_sid": {"key": "properties.databaseSid", "type": "str"}, "database_type": {"key": "properties.databaseType", "type": "str"}, "ip_address": {"key": "properties.ipAddress", "type": "str"}, + "load_balancer_details": {"key": "properties.loadBalancerDetails", "type": "LoadBalancerDetails"}, "vm_details": {"key": "properties.vmDetails", "type": "[DatabaseVmDetails]"}, "status": {"key": "properties.status", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "errors": {"key": "properties.errors", "type": "SAPVirtualInstanceError"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -4150,6 +3864,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.database_sid = None self.database_type = None self.ip_address = None + self.load_balancer_details = None self.vm_details = None self.status = None self.provisioning_state = None @@ -4171,8 +3886,12 @@ class SAPDatabaseInstanceList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SAPDatabaseInstance"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.SAPDatabaseInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets the list of SAP Database instances. :paramtype value: list[~azure.mgmt.workloads.models.SAPDatabaseInstance] @@ -4185,70 +3904,36 @@ def __init__( class SAPDiskConfiguration(_serialization.Model): - """The SAP Disk Configuration. - - :ivar volume: The volume name. - :vartype volume: str - :ivar disk_type: The disk type. - :vartype disk_type: str - :ivar disk_count: The disk count. - :vartype disk_count: int - :ivar disk_size_gb: The disk size in GB. - :vartype disk_size_gb: int - :ivar disk_iops_read_write: The disk Iops. - :vartype disk_iops_read_write: int - :ivar disk_m_bps_read_write: The disk provisioned throughput in MBps. - :vartype disk_m_bps_read_write: int - :ivar disk_storage_type: The disk storage type. - :vartype disk_storage_type: str + """The SAP Disk Configuration contains 'recommended disk' details and list of supported disks + detail for a volume type. + + :ivar recommended_configuration: The recommended disk details for a given VM Sku. + :vartype recommended_configuration: ~azure.mgmt.workloads.models.DiskVolumeConfiguration + :ivar supported_configurations: The list of supported disks for a given VM Sku. + :vartype supported_configurations: list[~azure.mgmt.workloads.models.DiskDetails] """ _attribute_map = { - "volume": {"key": "volume", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_count": {"key": "diskCount", "type": "int"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "disk_iops_read_write": {"key": "diskIopsReadWrite", "type": "int"}, - "disk_m_bps_read_write": {"key": "diskMBpsReadWrite", "type": "int"}, - "disk_storage_type": {"key": "diskStorageType", "type": "str"}, + "recommended_configuration": {"key": "recommendedConfiguration", "type": "DiskVolumeConfiguration"}, + "supported_configurations": {"key": "supportedConfigurations", "type": "[DiskDetails]"}, } def __init__( self, *, - volume: Optional[str] = None, - disk_type: Optional[str] = None, - disk_count: Optional[int] = None, - disk_size_gb: Optional[int] = None, - disk_iops_read_write: Optional[int] = None, - disk_m_bps_read_write: Optional[int] = None, - disk_storage_type: Optional[str] = None, - **kwargs - ): - """ - :keyword volume: The volume name. - :paramtype volume: str - :keyword disk_type: The disk type. - :paramtype disk_type: str - :keyword disk_count: The disk count. - :paramtype disk_count: int - :keyword disk_size_gb: The disk size in GB. - :paramtype disk_size_gb: int - :keyword disk_iops_read_write: The disk Iops. - :paramtype disk_iops_read_write: int - :keyword disk_m_bps_read_write: The disk provisioned throughput in MBps. - :paramtype disk_m_bps_read_write: int - :keyword disk_storage_type: The disk storage type. - :paramtype disk_storage_type: str + recommended_configuration: Optional["_models.DiskVolumeConfiguration"] = None, + supported_configurations: Optional[List["_models.DiskDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword recommended_configuration: The recommended disk details for a given VM Sku. + :paramtype recommended_configuration: ~azure.mgmt.workloads.models.DiskVolumeConfiguration + :keyword supported_configurations: The list of supported disks for a given VM Sku. + :paramtype supported_configurations: list[~azure.mgmt.workloads.models.DiskDetails] """ super().__init__(**kwargs) - self.volume = volume - self.disk_type = disk_type - self.disk_count = disk_count - self.disk_size_gb = disk_size_gb - self.disk_iops_read_write = disk_iops_read_write - self.disk_m_bps_read_write = disk_m_bps_read_write - self.disk_storage_type = disk_storage_type + self.recommended_configuration = recommended_configuration + self.supported_configurations = supported_configurations class SAPDiskConfigurationsRequest(_serialization.Model): @@ -4301,8 +3986,8 @@ def __init__( database_type: Union[str, "_models.SAPDatabaseType"], deployment_type: Union[str, "_models.SAPDeploymentType"], db_vm_sku: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword app_location: The geo-location where the SAP resources will be created. Required. :paramtype app_location: str @@ -4333,25 +4018,32 @@ def __init__( class SAPDiskConfigurationsResult(_serialization.Model): """The list of disk configuration for vmSku which are part of SAP deployment. - :ivar disk_configurations: Gets the list of Disk Configurations. - :vartype disk_configurations: list[~azure.mgmt.workloads.models.SAPDiskConfiguration] + :ivar volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :vartype volume_configurations: dict[str, ~azure.mgmt.workloads.models.SAPDiskConfiguration] """ _attribute_map = { - "disk_configurations": {"key": "diskConfigurations", "type": "[SAPDiskConfiguration]"}, + "volume_configurations": {"key": "volumeConfigurations", "type": "{SAPDiskConfiguration}"}, } - def __init__(self, *, disk_configurations: Optional[List["_models.SAPDiskConfiguration"]] = None, **kwargs): + def __init__( + self, *, volume_configurations: Optional[Dict[str, "_models.SAPDiskConfiguration"]] = None, **kwargs: Any + ) -> None: """ - :keyword disk_configurations: Gets the list of Disk Configurations. - :paramtype disk_configurations: list[~azure.mgmt.workloads.models.SAPDiskConfiguration] + :keyword volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :paramtype volume_configurations: dict[str, ~azure.mgmt.workloads.models.SAPDiskConfiguration] """ super().__init__(**kwargs) - self.disk_configurations = disk_configurations + self.volume_configurations = volume_configurations class SAPInstallWithoutOSConfigSoftwareConfiguration(SoftwareConfiguration): - """The SAP Software configuration Input when the software is to be installed by service without OS Configurations. + """The SAP Software configuration Input when the software is to be installed by service without OS + Configurations. All required parameters must be populated in order to send to Azure. @@ -4395,8 +4087,8 @@ def __init__( sap_bits_storage_account_id: str, software_version: str, high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword bom_url: The URL to the SAP Build of Materials(BOM) file. Required. :paramtype bom_url: str @@ -4416,6 +4108,212 @@ def __init__( self.high_availability_software_configuration = high_availability_software_configuration +class SapLandscapeMonitor(ProxyResource): + """configuration associated with SAP Landscape Monitor Dashboard. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar provisioning_state: State of provisioning of the SAP monitor. Known values are: + "Accepted", "Created", "Failed", "Succeeded", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.SapLandscapeMonitorProvisioningState + :ivar grouping: Gets or sets the SID groupings by landscape and Environment. + :vartype grouping: ~azure.mgmt.workloads.models.SapLandscapeMonitorPropertiesGrouping + :ivar top_metrics_thresholds: Gets or sets the list Top Metric Thresholds for SAP Landscape + Monitor Dashboard. + :vartype top_metrics_thresholds: + list[~azure.mgmt.workloads.models.SapLandscapeMonitorMetricThresholds] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "grouping": {"key": "properties.grouping", "type": "SapLandscapeMonitorPropertiesGrouping"}, + "top_metrics_thresholds": { + "key": "properties.topMetricsThresholds", + "type": "[SapLandscapeMonitorMetricThresholds]", + }, + } + + def __init__( + self, + *, + grouping: Optional["_models.SapLandscapeMonitorPropertiesGrouping"] = None, + top_metrics_thresholds: Optional[List["_models.SapLandscapeMonitorMetricThresholds"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword grouping: Gets or sets the SID groupings by landscape and Environment. + :paramtype grouping: ~azure.mgmt.workloads.models.SapLandscapeMonitorPropertiesGrouping + :keyword top_metrics_thresholds: Gets or sets the list Top Metric Thresholds for SAP Landscape + Monitor Dashboard. + :paramtype top_metrics_thresholds: + list[~azure.mgmt.workloads.models.SapLandscapeMonitorMetricThresholds] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.grouping = grouping + self.top_metrics_thresholds = top_metrics_thresholds + + +class SapLandscapeMonitorListResult(_serialization.Model): + """The response from the List SAP Landscape Monitor Dashboard operation. + + :ivar value: The list of Sap Landscape Monitor configuration. + :vartype value: list[~azure.mgmt.workloads.models.SapLandscapeMonitor] + :ivar next_link: The URL to get the next set of SAP Landscape Monitor Dashboard. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SapLandscapeMonitor]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SapLandscapeMonitor"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of Sap Landscape Monitor configuration. + :paramtype value: list[~azure.mgmt.workloads.models.SapLandscapeMonitor] + :keyword next_link: The URL to get the next set of SAP Landscape Monitor Dashboard. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SapLandscapeMonitorMetricThresholds(_serialization.Model): + """Gets or sets the Threshold Values for Top Metrics Health. + + :ivar name: Gets or sets the name of the threshold. + :vartype name: str + :ivar green: Gets or sets the threshold value for Green. + :vartype green: float + :ivar yellow: Gets or sets the threshold value for Yellow. + :vartype yellow: float + :ivar red: Gets or sets the threshold value for Red. + :vartype red: float + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "green": {"key": "green", "type": "float"}, + "yellow": {"key": "yellow", "type": "float"}, + "red": {"key": "red", "type": "float"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + green: Optional[float] = None, + yellow: Optional[float] = None, + red: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Gets or sets the name of the threshold. + :paramtype name: str + :keyword green: Gets or sets the threshold value for Green. + :paramtype green: float + :keyword yellow: Gets or sets the threshold value for Yellow. + :paramtype yellow: float + :keyword red: Gets or sets the threshold value for Red. + :paramtype red: float + """ + super().__init__(**kwargs) + self.name = name + self.green = green + self.yellow = yellow + self.red = red + + +class SapLandscapeMonitorPropertiesGrouping(_serialization.Model): + """Gets or sets the SID groupings by landscape and Environment. + + :ivar landscape: Gets or sets the list of landscape to SID mappings. + :vartype landscape: list[~azure.mgmt.workloads.models.SapLandscapeMonitorSidMapping] + :ivar sap_application: Gets or sets the list of Sap Applications to SID mappings. + :vartype sap_application: list[~azure.mgmt.workloads.models.SapLandscapeMonitorSidMapping] + """ + + _attribute_map = { + "landscape": {"key": "landscape", "type": "[SapLandscapeMonitorSidMapping]"}, + "sap_application": {"key": "sapApplication", "type": "[SapLandscapeMonitorSidMapping]"}, + } + + def __init__( + self, + *, + landscape: Optional[List["_models.SapLandscapeMonitorSidMapping"]] = None, + sap_application: Optional[List["_models.SapLandscapeMonitorSidMapping"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword landscape: Gets or sets the list of landscape to SID mappings. + :paramtype landscape: list[~azure.mgmt.workloads.models.SapLandscapeMonitorSidMapping] + :keyword sap_application: Gets or sets the list of Sap Applications to SID mappings. + :paramtype sap_application: list[~azure.mgmt.workloads.models.SapLandscapeMonitorSidMapping] + """ + super().__init__(**kwargs) + self.landscape = landscape + self.sap_application = sap_application + + +class SapLandscapeMonitorSidMapping(_serialization.Model): + """Gets or sets the mapping for SID to Environment/Applications. + + :ivar name: Gets or sets the name of the grouping. + :vartype name: str + :ivar top_sid: Gets or sets the list of SID's. + :vartype top_sid: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "top_sid": {"key": "topSid", "type": "[str]"}, + } + + def __init__(self, *, name: Optional[str] = None, top_sid: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword name: Gets or sets the name of the grouping. + :paramtype name: str + :keyword top_sid: Gets or sets the list of SID's. + :paramtype top_sid: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.top_sid = top_sid + + class SapNetWeaverProviderInstanceProperties( ProviderSpecificProperties ): # pylint: disable=too-many-instance-attributes @@ -4443,8 +4341,6 @@ class SapNetWeaverProviderInstanceProperties( :vartype sap_client_id: str :ivar sap_port_number: Gets or sets the SAP HTTP port number. :vartype sap_port_number: str - :ivar sap_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the SAP system. - :vartype sap_ssl_certificate_uri: str :ivar ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the SAP system. :vartype ssl_certificate_uri: str :ivar ssl_preference: Gets or sets certificate preference if secure communication is enabled. @@ -4467,7 +4363,6 @@ class SapNetWeaverProviderInstanceProperties( "sap_password_uri": {"key": "sapPasswordUri", "type": "str"}, "sap_client_id": {"key": "sapClientId", "type": "str"}, "sap_port_number": {"key": "sapPortNumber", "type": "str"}, - "sap_ssl_certificate_uri": {"key": "sapSslCertificateUri", "type": "str"}, "ssl_certificate_uri": {"key": "sslCertificateUri", "type": "str"}, "ssl_preference": {"key": "sslPreference", "type": "str"}, } @@ -4484,11 +4379,10 @@ def __init__( sap_password_uri: Optional[str] = None, sap_client_id: Optional[str] = None, sap_port_number: Optional[str] = None, - sap_ssl_certificate_uri: Optional[str] = None, ssl_certificate_uri: Optional[str] = None, ssl_preference: Optional[Union[str, "_models.SslPreference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sap_sid: Gets or sets the SAP System Identifier. :paramtype sap_sid: str @@ -4508,9 +4402,6 @@ def __init__( :paramtype sap_client_id: str :keyword sap_port_number: Gets or sets the SAP HTTP port number. :paramtype sap_port_number: str - :keyword sap_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the SAP - system. - :paramtype sap_ssl_certificate_uri: str :keyword ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the SAP system. :paramtype ssl_certificate_uri: str :keyword ssl_preference: Gets or sets certificate preference if secure communication is @@ -4528,7 +4419,6 @@ def __init__( self.sap_password_uri = sap_password_uri self.sap_client_id = sap_client_id self.sap_port_number = sap_port_number - self.sap_ssl_certificate_uri = sap_ssl_certificate_uri self.ssl_certificate_uri = ssl_certificate_uri self.ssl_preference = ssl_preference @@ -4596,8 +4486,8 @@ def __init__( database_type: Union[str, "_models.SAPDatabaseType"], db_scale_method: Optional[Union[str, "_models.SAPDatabaseScaleMethod"]] = None, high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword app_location: The geo-location where the resource is to be created. Required. :paramtype app_location: str @@ -4662,7 +4552,7 @@ class SAPSizingRecommendationResult(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.deployment_type: Optional[str] = None @@ -4679,7 +4569,7 @@ class SAPSupportedResourceSkusResult(_serialization.Model): "supported_skus": {"key": "supportedSkus", "type": "[SAPSupportedSku]"}, } - def __init__(self, *, supported_skus: Optional[List["_models.SAPSupportedSku"]] = None, **kwargs): + def __init__(self, *, supported_skus: Optional[List["_models.SAPSupportedSku"]] = None, **kwargs: Any) -> None: """ :keyword supported_skus: Gets the list of SAP supported SKUs. :paramtype supported_skus: list[~azure.mgmt.workloads.models.SAPSupportedSku] @@ -4712,8 +4602,8 @@ def __init__( vm_sku: Optional[str] = None, is_app_server_certified: Optional[bool] = None, is_database_certified: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword vm_sku: The VM Sku. :paramtype vm_sku: str @@ -4780,8 +4670,8 @@ def __init__( deployment_type: Union[str, "_models.SAPDeploymentType"], database_type: Union[str, "_models.SAPDatabaseType"], high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword app_location: The geo-location where the resource is to be created. Required. :paramtype app_location: str @@ -4847,7 +4737,7 @@ class SAPVirtualInstance(TrackedResource): # pylint: disable=too-many-instance- :vartype managed_resource_group_configuration: ~azure.mgmt.workloads.models.ManagedRGConfiguration :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", and "Unavailable". + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", "Unhealthy", and "Degraded". @@ -4915,8 +4805,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, identity: Optional["_models.UserAssignedServiceIdentity"] = None, managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -4961,7 +4851,7 @@ class SAPVirtualInstanceError(_serialization.Model): "properties": {"key": "properties", "type": "ErrorDefinition"}, } - def __init__(self, *, properties: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword properties: The Virtual Instance for SAP error body. :paramtype properties: ~azure.mgmt.workloads.models.ErrorDefinition @@ -4985,8 +4875,12 @@ class SAPVirtualInstanceList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SAPVirtualInstance"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.SAPVirtualInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets the list of Virtual Instances for SAP solutions resources. :paramtype value: list[~azure.mgmt.workloads.models.SAPVirtualInstance] @@ -4998,78 +4892,6 @@ def __init__( self.next_link = next_link -class SearchProfile(NodeProfile): - """Search profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: VM or VMSS name. - :vartype name: str - :ivar node_sku: VM SKU for node(s). Required. - :vartype node_sku: str - :ivar os_image: OS image used for creating the nodes. Required. - :vartype os_image: ~azure.mgmt.workloads.models.OsImageProfile - :ivar os_disk: OS disk details. Required. - :vartype os_disk: ~azure.mgmt.workloads.models.DiskInfo - :ivar data_disks: Data disks details. This property is not in use right now. - :vartype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] - :ivar node_resource_ids: VM/VMSS resource ARM Ids. - :vartype node_resource_ids: list[str] - :ivar search_type: Search type. Required. "Elastic" - :vartype search_type: str or ~azure.mgmt.workloads.models.SearchType - """ - - _validation = { - "node_sku": {"required": True}, - "os_image": {"required": True}, - "os_disk": {"required": True}, - "node_resource_ids": {"readonly": True}, - "search_type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "node_sku": {"key": "nodeSku", "type": "str"}, - "os_image": {"key": "osImage", "type": "OsImageProfile"}, - "os_disk": {"key": "osDisk", "type": "DiskInfo"}, - "data_disks": {"key": "dataDisks", "type": "[DiskInfo]"}, - "node_resource_ids": {"key": "nodeResourceIds", "type": "[str]"}, - "search_type": {"key": "searchType", "type": "str"}, - } - - def __init__( - self, - *, - node_sku: str, - os_image: "_models.OsImageProfile", - os_disk: "_models.DiskInfo", - search_type: Union[str, "_models.SearchType"], - name: Optional[str] = None, - data_disks: Optional[List["_models.DiskInfo"]] = None, - **kwargs - ): - """ - :keyword name: VM or VMSS name. - :paramtype name: str - :keyword node_sku: VM SKU for node(s). Required. - :paramtype node_sku: str - :keyword os_image: OS image used for creating the nodes. Required. - :paramtype os_image: ~azure.mgmt.workloads.models.OsImageProfile - :keyword os_disk: OS disk details. Required. - :paramtype os_disk: ~azure.mgmt.workloads.models.DiskInfo - :keyword data_disks: Data disks details. This property is not in use right now. - :paramtype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] - :keyword search_type: Search type. Required. "Elastic" - :paramtype search_type: str or ~azure.mgmt.workloads.models.SearchType - """ - super().__init__( - name=name, node_sku=node_sku, os_image=os_image, os_disk=os_disk, data_disks=data_disks, **kwargs - ) - self.search_type = search_type - - class ServiceInitiatedSoftwareConfiguration(SoftwareConfiguration): """The SAP Software configuration Input when the software is to be installed by service. @@ -5125,8 +4947,8 @@ def __init__( sap_fqdn: str, ssh_private_key: str, high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword bom_url: The URL to the SAP Build of Materials(BOM) file. Required. :paramtype bom_url: str @@ -5152,6 +4974,46 @@ def __init__( self.high_availability_software_configuration = high_availability_software_configuration +class SharedStorageResourceNames(_serialization.Model): + """The resource names object for shared storage. + + :ivar shared_storage_account_name: The full name of the shared storage account. If it is not + provided, it will be defaulted to {SID}nfs{guid of 15 chars}. + :vartype shared_storage_account_name: str + :ivar shared_storage_account_private_end_point_name: The full name of private end point for the + shared storage account. If it is not provided, it will be defaulted to {storageAccountName}_pe. + :vartype shared_storage_account_private_end_point_name: str + """ + + _attribute_map = { + "shared_storage_account_name": {"key": "sharedStorageAccountName", "type": "str"}, + "shared_storage_account_private_end_point_name": { + "key": "sharedStorageAccountPrivateEndPointName", + "type": "str", + }, + } + + def __init__( + self, + *, + shared_storage_account_name: Optional[str] = None, + shared_storage_account_private_end_point_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword shared_storage_account_name: The full name of the shared storage account. If it is not + provided, it will be defaulted to {SID}nfs{guid of 15 chars}. + :paramtype shared_storage_account_name: str + :keyword shared_storage_account_private_end_point_name: The full name of private end point for + the shared storage account. If it is not provided, it will be defaulted to + {storageAccountName}_pe. + :paramtype shared_storage_account_private_end_point_name: str + """ + super().__init__(**kwargs) + self.shared_storage_account_name = shared_storage_account_name + self.shared_storage_account_private_end_point_name = shared_storage_account_private_end_point_name + + class SingleServerConfiguration(InfrastructureConfiguration): """Gets or sets the single server configuration. @@ -5172,6 +5034,11 @@ class SingleServerConfiguration(InfrastructureConfiguration): :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. :vartype virtual_machine_configuration: ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :ivar db_disk_configuration: Gets or sets the disk configuration. + :vartype db_disk_configuration: ~azure.mgmt.workloads.models.DiskConfiguration + :ivar custom_resource_names: The set of custom names to be used for underlying azure resources + that are part of the SAP system. + :vartype custom_resource_names: ~azure.mgmt.workloads.models.SingleServerCustomResourceNames """ _validation = { @@ -5188,6 +5055,8 @@ class SingleServerConfiguration(InfrastructureConfiguration): "database_type": {"key": "databaseType", "type": "str"}, "subnet_id": {"key": "subnetId", "type": "str"}, "virtual_machine_configuration": {"key": "virtualMachineConfiguration", "type": "VirtualMachineConfiguration"}, + "db_disk_configuration": {"key": "dbDiskConfiguration", "type": "DiskConfiguration"}, + "custom_resource_names": {"key": "customResourceNames", "type": "SingleServerCustomResourceNames"}, } def __init__( @@ -5198,8 +5067,10 @@ def __init__( virtual_machine_configuration: "_models.VirtualMachineConfiguration", network_configuration: Optional["_models.NetworkConfiguration"] = None, database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, - **kwargs - ): + db_disk_configuration: Optional["_models.DiskConfiguration"] = None, + custom_resource_names: Optional["_models.SingleServerCustomResourceNames"] = None, + **kwargs: Any + ) -> None: """ :keyword app_resource_group: The application resource group where SAP system resources will be deployed. Required. @@ -5214,526 +5085,139 @@ def __init__( Required. :paramtype virtual_machine_configuration: ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :keyword db_disk_configuration: Gets or sets the disk configuration. + :paramtype db_disk_configuration: ~azure.mgmt.workloads.models.DiskConfiguration + :keyword custom_resource_names: The set of custom names to be used for underlying azure + resources that are part of the SAP system. + :paramtype custom_resource_names: ~azure.mgmt.workloads.models.SingleServerCustomResourceNames """ super().__init__(app_resource_group=app_resource_group, **kwargs) self.deployment_type: str = "SingleServer" self.network_configuration = network_configuration - self.database_type = database_type - self.subnet_id = subnet_id - self.virtual_machine_configuration = virtual_machine_configuration - - -class SingleServerRecommendationResult(SAPSizingRecommendationResult): - """The recommended configuration for a single server SAP system. - - All required parameters must be populated in order to send to Azure. - - :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known - values are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType - :ivar vm_sku: The recommended VM SKU for single server. - :vartype vm_sku: str - """ - - _validation = { - "deployment_type": {"required": True}, - } - - _attribute_map = { - "deployment_type": {"key": "deploymentType", "type": "str"}, - "vm_sku": {"key": "vmSku", "type": "str"}, - } - - def __init__(self, *, vm_sku: Optional[str] = None, **kwargs): - """ - :keyword vm_sku: The recommended VM SKU for single server. - :paramtype vm_sku: str - """ - super().__init__(**kwargs) - self.deployment_type: str = "SingleServer" - self.vm_sku = vm_sku - - -class SiteProfile(_serialization.Model): - """Workload website profile. - - :ivar domain_name: Domain name for the application site URL. - :vartype domain_name: str - """ - - _attribute_map = { - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, *, domain_name: Optional[str] = None, **kwargs): - """ - :keyword domain_name: Domain name for the application site URL. - :paramtype domain_name: str - """ - super().__init__(**kwargs) - self.domain_name = domain_name - - -class Sku(_serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :vartype name: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.workloads.models.SkuTier - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs - ): - """ - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :paramtype name: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.workloads.models.SkuTier - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int - """ - super().__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - - -class SkuCapability(_serialization.Model): - """The SKU capability definition. - - :ivar name: The capability name. - :vartype name: str - :ivar value: The capability value. - :vartype value: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): - """ - :keyword name: The capability name. - :paramtype name: str - :keyword value: The capability value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - :ivar minimum: Minimum capacity value. - :vartype minimum: int - :ivar maximum: Maximum capacity value. - :vartype maximum: int - :ivar default: Default capacity value. - :vartype default: int - :ivar scale_type: Scale type of the SKU capacity. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.workloads.models.SkuScaleType - """ + self.database_type = database_type + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.db_disk_configuration = db_disk_configuration + self.custom_resource_names = custom_resource_names - _attribute_map = { - "minimum": {"key": "minimum", "type": "int"}, - "maximum": {"key": "maximum", "type": "int"}, - "default": {"key": "default", "type": "int"}, - "scale_type": {"key": "scaleType", "type": "str"}, - } - def __init__( - self, - *, - minimum: Optional[int] = None, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs - ): - """ - :keyword minimum: Minimum capacity value. - :paramtype minimum: int - :keyword maximum: Maximum capacity value. - :paramtype maximum: int - :keyword default: Default capacity value. - :paramtype default: int - :keyword scale_type: Scale type of the SKU capacity. Known values are: "None", "Manual", and - "Automatic". - :paramtype scale_type: str or ~azure.mgmt.workloads.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type +class SingleServerCustomResourceNames(_serialization.Model): + """The resource-names input to specify custom names for underlying azure resources that are part + of a single server SAP system. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SingleServerFullResourceNames -class SkuCost(_serialization.Model): - """The SKU cost definition. + All required parameters must be populated in order to send to Azure. - :ivar meter_id: Billing meter id. - :vartype meter_id: str - :ivar quantity: The quantity. - :vartype quantity: int - :ivar extended_unit: The extended unit. - :vartype extended_unit: str + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or ~azure.mgmt.workloads.models.NamingPatternType """ + _validation = { + "naming_pattern_type": {"required": True}, + } + _attribute_map = { - "meter_id": {"key": "meterId", "type": "str"}, - "quantity": {"key": "quantity", "type": "int"}, - "extended_unit": {"key": "extendedUnit", "type": "str"}, + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, } - def __init__( - self, - *, - meter_id: Optional[str] = None, - quantity: Optional[int] = None, - extended_unit: Optional[str] = None, - **kwargs - ): - """ - :keyword meter_id: Billing meter id. - :paramtype meter_id: str - :keyword quantity: The quantity. - :paramtype quantity: int - :keyword extended_unit: The extended unit. - :paramtype extended_unit: str - """ + _subtype_map = {"naming_pattern_type": {"FullResourceName": "SingleServerFullResourceNames"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.meter_id = meter_id - self.quantity = quantity - self.extended_unit = extended_unit + self.naming_pattern_type: Optional[str] = None -class SkuDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The SKU definition. +class SingleServerFullResourceNames(SingleServerCustomResourceNames): + """The resource name object where the specified values will be full resource names of the + corresponding resources in a single server SAP system. All required parameters must be populated in order to send to Azure. - :ivar name: The name of the SKU. Required. - :vartype name: str - :ivar resource_type: Resource type the SKU applicable for. - :vartype resource_type: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. - :vartype tier: str - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar kind: If the service has different kinds of hardware, for the same SKU, then that can be - captured here. - :vartype kind: str - :ivar locations: List of locations where this SKU is available. - :vartype locations: list[str] - :ivar location_info: List of locations where this SKU is available. - :vartype location_info: list[~azure.mgmt.workloads.models.SkuLocationAndZones] - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: JSON - :ivar costs: The SKU costs. - :vartype costs: list[~azure.mgmt.workloads.models.SkuCost] - :ivar capabilities: The SKU capabilities. - :vartype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] - :ivar restrictions: The SKU restrictions. - :vartype restrictions: list[~azure.mgmt.workloads.models.SkuRestriction] + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or ~azure.mgmt.workloads.models.NamingPatternType + :ivar virtual_machine: The resource names object for virtual machine and related resources. + :vartype virtual_machine: ~azure.mgmt.workloads.models.VirtualMachineResourceNames """ _validation = { - "name": {"required": True}, + "naming_pattern_type": {"required": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "locations": {"key": "locations", "type": "[str]"}, - "location_info": {"key": "locationInfo", "type": "[SkuLocationAndZones]"}, - "capacity": {"key": "capacity", "type": "object"}, - "costs": {"key": "costs", "type": "[SkuCost]"}, - "capabilities": {"key": "capabilities", "type": "[SkuCapability]"}, - "restrictions": {"key": "restrictions", "type": "[SkuRestriction]"}, + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, + "virtual_machine": {"key": "virtualMachine", "type": "VirtualMachineResourceNames"}, } def __init__( - self, - *, - name: str, - resource_type: Optional[str] = None, - tier: Optional[str] = None, - size: Optional[str] = None, - family: Optional[str] = None, - kind: Optional[str] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.SkuLocationAndZones"]] = None, - capacity: Optional[JSON] = None, - costs: Optional[List["_models.SkuCost"]] = None, - capabilities: Optional[List["_models.SkuCapability"]] = None, - restrictions: Optional[List["_models.SkuRestriction"]] = None, - **kwargs - ): - """ - :keyword name: The name of the SKU. Required. - :paramtype name: str - :keyword resource_type: Resource type the SKU applicable for. - :paramtype resource_type: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. - :paramtype tier: str - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword kind: If the service has different kinds of hardware, for the same SKU, then that can - be captured here. - :paramtype kind: str - :keyword locations: List of locations where this SKU is available. - :paramtype locations: list[str] - :keyword location_info: List of locations where this SKU is available. - :paramtype location_info: list[~azure.mgmt.workloads.models.SkuLocationAndZones] - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: JSON - :keyword costs: The SKU costs. - :paramtype costs: list[~azure.mgmt.workloads.models.SkuCost] - :keyword capabilities: The SKU capabilities. - :paramtype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] - :keyword restrictions: The SKU restrictions. - :paramtype restrictions: list[~azure.mgmt.workloads.models.SkuRestriction] + self, *, virtual_machine: Optional["_models.VirtualMachineResourceNames"] = None, **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.name = name - self.resource_type = resource_type - self.tier = tier - self.size = size - self.family = family - self.kind = kind - self.locations = locations - self.location_info = location_info - self.capacity = capacity - self.costs = costs - self.capabilities = capabilities - self.restrictions = restrictions - - -class SkuLocationAndZones(_serialization.Model): - """The SKU location and zone. - - :ivar location: The location of the SKU. - :vartype location: str - :ivar zones: The availability zones of SKU location. - :vartype zones: list[str] - :ivar zone_details: The availability zone details of the SKU location. - :vartype zone_details: list[~azure.mgmt.workloads.models.SkuZoneDetail] - :ivar extended_locations: The extended locations of SKU. - :vartype extended_locations: list[str] - :ivar type: Type of the extended location. Known values are: "Region" and "EdgeZone". - :vartype type: str or ~azure.mgmt.workloads.models.LocationType - """ - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "zones": {"key": "zones", "type": "[str]"}, - "zone_details": {"key": "zoneDetails", "type": "[SkuZoneDetail]"}, - "extended_locations": {"key": "extendedLocations", "type": "[str]"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.SkuZoneDetail"]] = None, - extended_locations: Optional[List[str]] = None, - type: Optional[Union[str, "_models.LocationType"]] = None, - **kwargs - ): - """ - :keyword location: The location of the SKU. - :paramtype location: str - :keyword zones: The availability zones of SKU location. - :paramtype zones: list[str] - :keyword zone_details: The availability zone details of the SKU location. - :paramtype zone_details: list[~azure.mgmt.workloads.models.SkuZoneDetail] - :keyword extended_locations: The extended locations of SKU. - :paramtype extended_locations: list[str] - :keyword type: Type of the extended location. Known values are: "Region" and "EdgeZone". - :paramtype type: str or ~azure.mgmt.workloads.models.LocationType + :keyword virtual_machine: The resource names object for virtual machine and related resources. + :paramtype virtual_machine: ~azure.mgmt.workloads.models.VirtualMachineResourceNames """ super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - self.extended_locations = extended_locations - self.type = type + self.naming_pattern_type: str = "FullResourceName" + self.virtual_machine = virtual_machine -class SkuRestriction(_serialization.Model): - """The SKU restriction definition. +class SingleServerRecommendationResult(SAPSizingRecommendationResult): + """The recommended configuration for a single server SAP system. + + All required parameters must be populated in order to send to Azure. - :ivar type: The SKU restriction type. Known values are: "NotSpecified", "Location", and "Zone". - :vartype type: str or ~azure.mgmt.workloads.models.SkuRestrictionType - :ivar values: Restriction values. - :vartype values: list[str] - :ivar restriction_info: The restriction information. - :vartype restriction_info: JSON - :ivar reason_code: The SKU restriction reason code. Known values are: "NotSpecified", - "QuotaId", and "NotAvailableForSubscription". - :vartype reason_code: str or ~azure.mgmt.workloads.models.SkuRestrictionReasonCode + :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar vm_sku: The recommended VM SKU for single server. + :vartype vm_sku: str """ + _validation = { + "deployment_type": {"required": True}, + } + _attribute_map = { - "type": {"key": "type", "type": "str"}, - "values": {"key": "values", "type": "[str]"}, - "restriction_info": {"key": "restrictionInfo", "type": "object"}, - "reason_code": {"key": "reasonCode", "type": "str"}, + "deployment_type": {"key": "deploymentType", "type": "str"}, + "vm_sku": {"key": "vmSku", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.SkuRestrictionType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional[JSON] = None, - reason_code: Optional[Union[str, "_models.SkuRestrictionReasonCode"]] = None, - **kwargs - ): - """ - :keyword type: The SKU restriction type. Known values are: "NotSpecified", "Location", and - "Zone". - :paramtype type: str or ~azure.mgmt.workloads.models.SkuRestrictionType - :keyword values: Restriction values. - :paramtype values: list[str] - :keyword restriction_info: The restriction information. - :paramtype restriction_info: JSON - :keyword reason_code: The SKU restriction reason code. Known values are: "NotSpecified", - "QuotaId", and "NotAvailableForSubscription". - :paramtype reason_code: str or ~azure.mgmt.workloads.models.SkuRestrictionReasonCode + def __init__(self, *, vm_sku: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword vm_sku: The recommended VM SKU for single server. + :paramtype vm_sku: str """ super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code + self.deployment_type: str = "SingleServer" + self.vm_sku = vm_sku -class SkusListResult(_serialization.Model): - """A list of SKUs supported by an Azure Resource Provider. +class SkipFileShareConfiguration(FileShareConfiguration): + """Gets or sets the skip file share configuration. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar value: List of SKUs supported by the resource provider. - :vartype value: list[~azure.mgmt.workloads.models.SkuDefinition] - :ivar next_link: URL to get the next set of SKU list results (if there are any). - :vartype next_link: str + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.ConfigurationType """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "configuration_type": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SkuDefinition]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "configuration_type": {"key": "configurationType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkuZoneDetail(_serialization.Model): - """The SKU zone details. - - :ivar zones: The physical zones. - :vartype zones: list[str] - :ivar capabilities: The capabilities. - :vartype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] - """ - - _attribute_map = { - "zones": {"key": "zones", "type": "[str]"}, - "capabilities": {"key": "capabilities", "type": "[SkuCapability]"}, - } - - def __init__( - self, - *, - zones: Optional[List[str]] = None, - capabilities: Optional[List["_models.SkuCapability"]] = None, - **kwargs - ): - """ - :keyword zones: The physical zones. - :paramtype zones: list[str] - :keyword capabilities: The capabilities. - :paramtype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] - """ - super().__init__(**kwargs) - self.zones = zones - self.capabilities = capabilities + self.configuration_type: str = "Skip" class SshConfiguration(_serialization.Model): @@ -5747,7 +5231,7 @@ class SshConfiguration(_serialization.Model): "public_keys": {"key": "publicKeys", "type": "[SshPublicKey]"}, } - def __init__(self, *, public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs): + def __init__(self, *, public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs: Any) -> None: """ :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. :paramtype public_keys: list[~azure.mgmt.workloads.models.SshPublicKey] @@ -5757,7 +5241,10 @@ def __init__(self, *, public_keys: Optional[List["_models.SshPublicKey"]] = None class SshKeyPair(_serialization.Model): - """The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure `_. + """The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in + ssh-rsa format. :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux + and Mac for Linux VMs in Azure + `_. :ivar public_key: SSH public key. :vartype public_key: str @@ -5770,7 +5257,7 @@ class SshKeyPair(_serialization.Model): "private_key": {"key": "privateKey", "type": "str"}, } - def __init__(self, *, public_key: Optional[str] = None, private_key: Optional[str] = None, **kwargs): + def __init__(self, *, public_key: Optional[str] = None, private_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword public_key: SSH public key. :paramtype public_key: str @@ -5783,7 +5270,8 @@ def __init__(self, *, public_key: Optional[str] = None, private_key: Optional[st class SshPublicKey(_serialization.Model): - """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + """Contains information about SSH certificate public key and the path on the Linux VM where the + public key is placed. :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating @@ -5796,7 +5284,7 @@ class SshPublicKey(_serialization.Model): "key_data": {"key": "keyData", "type": "str"}, } - def __init__(self, *, key_data: Optional[str] = None, **kwargs): + def __init__(self, *, key_data: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating @@ -5809,23 +5297,84 @@ def __init__(self, *, key_data: Optional[str] = None, **kwargs): class StopRequest(_serialization.Model): - """Stop SAP Request. + """Stop SAP instance(s) request body. + + :ivar soft_stop_timeout_seconds: This parameter defines how long (in seconds) the soft shutdown + waits until the RFC/HTTP clients no longer consider the server for calls with load balancing. + Value 0 means that the kernel does not wait, but goes directly into the next shutdown state, + i.e. hard stop. + :vartype soft_stop_timeout_seconds: int + """ + + _attribute_map = { + "soft_stop_timeout_seconds": {"key": "softStopTimeoutSeconds", "type": "int"}, + } + + def __init__(self, *, soft_stop_timeout_seconds: int = 0, **kwargs: Any) -> None: + """ + :keyword soft_stop_timeout_seconds: This parameter defines how long (in seconds) the soft + shutdown waits until the RFC/HTTP clients no longer consider the server for calls with load + balancing. Value 0 means that the kernel does not wait, but goes directly into the next + shutdown state, i.e. hard stop. + :paramtype soft_stop_timeout_seconds: int + """ + super().__init__(**kwargs) + self.soft_stop_timeout_seconds = soft_stop_timeout_seconds + + +class StorageConfiguration(_serialization.Model): + """Gets or sets the storage configuration. - :ivar hard_stop: A boolean to specify if the SAP system should be hard-stopped. - :vartype hard_stop: bool + :ivar transport_file_share_configuration: The properties of the transport directory attached to + the VIS. The default for transportFileShareConfiguration is the createAndMount flow if storage + configuration is missing. + :vartype transport_file_share_configuration: + ~azure.mgmt.workloads.models.FileShareConfiguration """ _attribute_map = { - "hard_stop": {"key": "hardStop", "type": "bool"}, + "transport_file_share_configuration": { + "key": "transportFileShareConfiguration", + "type": "FileShareConfiguration", + }, } - def __init__(self, *, hard_stop: bool = False, **kwargs): + def __init__( + self, *, transport_file_share_configuration: Optional["_models.FileShareConfiguration"] = None, **kwargs: Any + ) -> None: """ - :keyword hard_stop: A boolean to specify if the SAP system should be hard-stopped. - :paramtype hard_stop: bool + :keyword transport_file_share_configuration: The properties of the transport directory attached + to the VIS. The default for transportFileShareConfiguration is the createAndMount flow if + storage configuration is missing. + :paramtype transport_file_share_configuration: + ~azure.mgmt.workloads.models.FileShareConfiguration """ super().__init__(**kwargs) - self.hard_stop = hard_stop + self.transport_file_share_configuration = transport_file_share_configuration + + +class StorageInformation(_serialization.Model): + """Storage details of all the Storage accounts attached to the VM. For e.g. NFS on AFS Shared + Storage. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None class SystemData(_serialization.Model): @@ -5865,8 +5414,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -5903,7 +5452,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Tags field of the resource. :paramtype tags: dict[str, str] @@ -5933,6 +5482,11 @@ class ThreeTierConfiguration(InfrastructureConfiguration): :vartype database_server: ~azure.mgmt.workloads.models.DatabaseConfiguration :ivar high_availability_config: The high availability configuration. :vartype high_availability_config: ~azure.mgmt.workloads.models.HighAvailabilityConfiguration + :ivar storage_configuration: The storage configuration. + :vartype storage_configuration: ~azure.mgmt.workloads.models.StorageConfiguration + :ivar custom_resource_names: The set of custom names to be used for underlying azure resources + that are part of the SAP system. + :vartype custom_resource_names: ~azure.mgmt.workloads.models.ThreeTierCustomResourceNames """ _validation = { @@ -5951,6 +5505,8 @@ class ThreeTierConfiguration(InfrastructureConfiguration): "application_server": {"key": "applicationServer", "type": "ApplicationServerConfiguration"}, "database_server": {"key": "databaseServer", "type": "DatabaseConfiguration"}, "high_availability_config": {"key": "highAvailabilityConfig", "type": "HighAvailabilityConfiguration"}, + "storage_configuration": {"key": "storageConfiguration", "type": "StorageConfiguration"}, + "custom_resource_names": {"key": "customResourceNames", "type": "ThreeTierCustomResourceNames"}, } def __init__( @@ -5962,8 +5518,10 @@ def __init__( database_server: "_models.DatabaseConfiguration", network_configuration: Optional["_models.NetworkConfiguration"] = None, high_availability_config: Optional["_models.HighAvailabilityConfiguration"] = None, - **kwargs - ): + storage_configuration: Optional["_models.StorageConfiguration"] = None, + custom_resource_names: Optional["_models.ThreeTierCustomResourceNames"] = None, + **kwargs: Any + ) -> None: """ :keyword app_resource_group: The application resource group where SAP system resources will be deployed. Required. @@ -5978,6 +5536,11 @@ def __init__( :paramtype database_server: ~azure.mgmt.workloads.models.DatabaseConfiguration :keyword high_availability_config: The high availability configuration. :paramtype high_availability_config: ~azure.mgmt.workloads.models.HighAvailabilityConfiguration + :keyword storage_configuration: The storage configuration. + :paramtype storage_configuration: ~azure.mgmt.workloads.models.StorageConfiguration + :keyword custom_resource_names: The set of custom names to be used for underlying azure + resources that are part of the SAP system. + :paramtype custom_resource_names: ~azure.mgmt.workloads.models.ThreeTierCustomResourceNames """ super().__init__(app_resource_group=app_resource_group, **kwargs) self.deployment_type: str = "ThreeTier" @@ -5986,6 +5549,103 @@ def __init__( self.application_server = application_server self.database_server = database_server self.high_availability_config = high_availability_config + self.storage_configuration = storage_configuration + self.custom_resource_names = custom_resource_names + + +class ThreeTierCustomResourceNames(_serialization.Model): + """The resource-names input to specify custom names for underlying azure resources that are part + of a three tier SAP system. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ThreeTierFullResourceNames + + All required parameters must be populated in order to send to Azure. + + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or ~azure.mgmt.workloads.models.NamingPatternType + """ + + _validation = { + "naming_pattern_type": {"required": True}, + } + + _attribute_map = { + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, + } + + _subtype_map = {"naming_pattern_type": {"FullResourceName": "ThreeTierFullResourceNames"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.naming_pattern_type: Optional[str] = None + + +class ThreeTierFullResourceNames(ThreeTierCustomResourceNames): + """The resource name object where the specified values will be full resource names of the + corresponding resources in a three tier SAP system. + + All required parameters must be populated in order to send to Azure. + + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or ~azure.mgmt.workloads.models.NamingPatternType + :ivar central_server: The full resource names object for central server layer resources. + :vartype central_server: ~azure.mgmt.workloads.models.CentralServerFullResourceNames + :ivar application_server: The full resource names object for application layer resources. The + number of entries in this list should be equal to the number VMs to be created for application + layer. + :vartype application_server: ~azure.mgmt.workloads.models.ApplicationServerFullResourceNames + :ivar database_server: The full resource names object for database layer resources. The number + of entries in this list should be equal to the number VMs to be created for database layer. + :vartype database_server: ~azure.mgmt.workloads.models.DatabaseServerFullResourceNames + :ivar shared_storage: The resource names object for shared storage. + :vartype shared_storage: ~azure.mgmt.workloads.models.SharedStorageResourceNames + """ + + _validation = { + "naming_pattern_type": {"required": True}, + } + + _attribute_map = { + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, + "central_server": {"key": "centralServer", "type": "CentralServerFullResourceNames"}, + "application_server": {"key": "applicationServer", "type": "ApplicationServerFullResourceNames"}, + "database_server": {"key": "databaseServer", "type": "DatabaseServerFullResourceNames"}, + "shared_storage": {"key": "sharedStorage", "type": "SharedStorageResourceNames"}, + } + + def __init__( + self, + *, + central_server: Optional["_models.CentralServerFullResourceNames"] = None, + application_server: Optional["_models.ApplicationServerFullResourceNames"] = None, + database_server: Optional["_models.DatabaseServerFullResourceNames"] = None, + shared_storage: Optional["_models.SharedStorageResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword central_server: The full resource names object for central server layer resources. + :paramtype central_server: ~azure.mgmt.workloads.models.CentralServerFullResourceNames + :keyword application_server: The full resource names object for application layer resources. + The number of entries in this list should be equal to the number VMs to be created for + application layer. + :paramtype application_server: ~azure.mgmt.workloads.models.ApplicationServerFullResourceNames + :keyword database_server: The full resource names object for database layer resources. The + number of entries in this list should be equal to the number VMs to be created for database + layer. + :paramtype database_server: ~azure.mgmt.workloads.models.DatabaseServerFullResourceNames + :keyword shared_storage: The resource names object for shared storage. + :paramtype shared_storage: ~azure.mgmt.workloads.models.SharedStorageResourceNames + """ + super().__init__(**kwargs) + self.naming_pattern_type: str = "FullResourceName" + self.central_server = central_server + self.application_server = application_server + self.database_server = database_server + self.shared_storage = shared_storage class ThreeTierRecommendationResult(SAPSizingRecommendationResult): @@ -6033,8 +5693,8 @@ def __init__( central_server_instance_count: Optional[int] = None, application_server_vm_sku: Optional[str] = None, application_server_instance_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword db_vm_sku: The database VM SKU. :paramtype db_vm_sku: str @@ -6078,8 +5738,8 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.UserAssignedServiceIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Gets or sets the Resource tags. :paramtype tags: dict[str, str] @@ -6102,7 +5762,7 @@ class UpdateSAPApplicationInstanceRequest(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Gets or sets the Resource tags. :paramtype tags: dict[str, str] @@ -6122,7 +5782,7 @@ class UpdateSAPCentralInstanceRequest(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Gets or sets the Resource tags. :paramtype tags: dict[str, str] @@ -6142,7 +5802,7 @@ class UpdateSAPDatabaseInstanceRequest(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Gets or sets the Resource tags. :paramtype tags: dict[str, str] @@ -6170,8 +5830,8 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.UserAssignedServiceIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Gets or sets the Resource tags. :paramtype tags: dict[str, str] @@ -6204,44 +5864,50 @@ class UserAssignedIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserProfile(_serialization.Model): - """User profile to configure on a compute resources such as VM, VMSS. +class UserAssignedServiceIdentity(_serialization.Model): + """Managed service identity (user assigned identities). All required parameters must be populated in order to send to Azure. - :ivar user_name: User name. Required. - :vartype user_name: str - :ivar ssh_public_key: SSH public key data. Required. - :vartype ssh_public_key: str + :ivar type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". + :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :ivar user_assigned_identities: User assigned identities dictionary. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] """ _validation = { - "user_name": {"required": True}, - "ssh_public_key": {"required": True}, + "type": {"required": True}, } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - "ssh_public_key": {"key": "sshPublicKey", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } - def __init__(self, *, user_name: str, ssh_public_key: str, **kwargs): + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: """ - :keyword user_name: User name. Required. - :paramtype user_name: str - :keyword ssh_public_key: SSH public key data. Required. - :paramtype ssh_public_key: str + :keyword type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". + :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :keyword user_assigned_identities: User assigned identities dictionary. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.workloads.models.UserAssignedIdentity] """ super().__init__(**kwargs) - self.user_name = user_name - self.ssh_public_key = ssh_public_key + self.type = type + self.user_assigned_identities = user_assigned_identities class VirtualMachineConfiguration(_serialization.Model): @@ -6270,8 +5936,8 @@ class VirtualMachineConfiguration(_serialization.Model): } def __init__( - self, *, vm_size: str, image_reference: "_models.ImageReference", os_profile: "_models.OSProfile", **kwargs - ): + self, *, vm_size: str, image_reference: "_models.ImageReference", os_profile: "_models.OSProfile", **kwargs: Any + ) -> None: """ :keyword vm_size: The virtual machine size. Required. :paramtype vm_size: str @@ -6286,84 +5952,87 @@ def __init__( self.os_profile = os_profile -class VmssNodesProfile(NodeProfile): - """VMSS profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: VM or VMSS name. - :vartype name: str - :ivar node_sku: VM SKU for node(s). Required. - :vartype node_sku: str - :ivar os_image: OS image used for creating the nodes. Required. - :vartype os_image: ~azure.mgmt.workloads.models.OsImageProfile - :ivar os_disk: OS disk details. Required. - :vartype os_disk: ~azure.mgmt.workloads.models.DiskInfo - :ivar data_disks: Data disks details. This property is not in use right now. - :vartype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] - :ivar node_resource_ids: VM/VMSS resource ARM Ids. - :vartype node_resource_ids: list[str] - :ivar auto_scale_min_count: Minimum number of nodes for autoscale. - :vartype auto_scale_min_count: int - :ivar auto_scale_max_count: Maximum number of nodes for autoscale. - :vartype auto_scale_max_count: int +class VirtualMachineResourceNames(_serialization.Model): + """The resource names object for virtual machine and related resources. + + :ivar vm_name: The full name for virtual machine. The length of this field can be upto 64 + characters. If name is not provided, service uses a default name based on the deployment type. + For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be + {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. + For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an + incrementor at the end in case of more than 1 vm per layer. + :vartype vm_name: str + :ivar host_name: The full name for virtual-machine's host (computer name). Currently, ACSS only + supports host names which are less than or equal to 13 characters long. If this value is not + provided, vmName will be used as host name. + :vartype host_name: str + :ivar network_interfaces: The list of network interface name objects for the selected virtual + machine. Currently, only one network interface is supported per virtual machine. + :vartype network_interfaces: list[~azure.mgmt.workloads.models.NetworkInterfaceResourceNames] + :ivar os_disk_name: The full name for OS disk attached to the VM. If this value is not + provided, it will be named by ARM as per its default naming standards (prefixed with vm name). + There is only one OS disk attached per Virtual Machine. + :vartype os_disk_name: str + :ivar data_disk_names: The full resource names for virtual machine data disks. This is a + dictionary containing list of names of data disks per volume. Currently supported volumes for + database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For + application and cs layers, only 'default' volume is supported. + :vartype data_disk_names: dict[str, list[str]] """ _validation = { - "node_sku": {"required": True}, - "os_image": {"required": True}, - "os_disk": {"required": True}, - "node_resource_ids": {"readonly": True}, - "auto_scale_min_count": {"minimum": 1}, - "auto_scale_max_count": {"minimum": 1}, + "network_interfaces": {"max_items": 1, "min_items": 0}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "node_sku": {"key": "nodeSku", "type": "str"}, - "os_image": {"key": "osImage", "type": "OsImageProfile"}, - "os_disk": {"key": "osDisk", "type": "DiskInfo"}, - "data_disks": {"key": "dataDisks", "type": "[DiskInfo]"}, - "node_resource_ids": {"key": "nodeResourceIds", "type": "[str]"}, - "auto_scale_min_count": {"key": "autoScaleMinCount", "type": "int"}, - "auto_scale_max_count": {"key": "autoScaleMaxCount", "type": "int"}, + "vm_name": {"key": "vmName", "type": "str"}, + "host_name": {"key": "hostName", "type": "str"}, + "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaceResourceNames]"}, + "os_disk_name": {"key": "osDiskName", "type": "str"}, + "data_disk_names": {"key": "dataDiskNames", "type": "{[str]}"}, } def __init__( self, *, - node_sku: str, - os_image: "_models.OsImageProfile", - os_disk: "_models.DiskInfo", - name: Optional[str] = None, - data_disks: Optional[List["_models.DiskInfo"]] = None, - auto_scale_min_count: Optional[int] = None, - auto_scale_max_count: Optional[int] = None, - **kwargs - ): + vm_name: Optional[str] = None, + host_name: Optional[str] = None, + network_interfaces: Optional[List["_models.NetworkInterfaceResourceNames"]] = None, + os_disk_name: Optional[str] = None, + data_disk_names: Optional[Dict[str, List[str]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword vm_name: The full name for virtual machine. The length of this field can be upto 64 + characters. If name is not provided, service uses a default name based on the deployment type. + For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be + {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. + For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an + incrementor at the end in case of more than 1 vm per layer. + :paramtype vm_name: str + :keyword host_name: The full name for virtual-machine's host (computer name). Currently, ACSS + only supports host names which are less than or equal to 13 characters long. If this value is + not provided, vmName will be used as host name. + :paramtype host_name: str + :keyword network_interfaces: The list of network interface name objects for the selected + virtual machine. Currently, only one network interface is supported per virtual machine. + :paramtype network_interfaces: list[~azure.mgmt.workloads.models.NetworkInterfaceResourceNames] + :keyword os_disk_name: The full name for OS disk attached to the VM. If this value is not + provided, it will be named by ARM as per its default naming standards (prefixed with vm name). + There is only one OS disk attached per Virtual Machine. + :paramtype os_disk_name: str + :keyword data_disk_names: The full resource names for virtual machine data disks. This is a + dictionary containing list of names of data disks per volume. Currently supported volumes for + database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For + application and cs layers, only 'default' volume is supported. + :paramtype data_disk_names: dict[str, list[str]] """ - :keyword name: VM or VMSS name. - :paramtype name: str - :keyword node_sku: VM SKU for node(s). Required. - :paramtype node_sku: str - :keyword os_image: OS image used for creating the nodes. Required. - :paramtype os_image: ~azure.mgmt.workloads.models.OsImageProfile - :keyword os_disk: OS disk details. Required. - :paramtype os_disk: ~azure.mgmt.workloads.models.DiskInfo - :keyword data_disks: Data disks details. This property is not in use right now. - :paramtype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] - :keyword auto_scale_min_count: Minimum number of nodes for autoscale. - :paramtype auto_scale_min_count: int - :keyword auto_scale_max_count: Maximum number of nodes for autoscale. - :paramtype auto_scale_max_count: int - """ - super().__init__( - name=name, node_sku=node_sku, os_image=os_image, os_disk=os_disk, data_disks=data_disks, **kwargs - ) - self.auto_scale_min_count = auto_scale_min_count - self.auto_scale_max_count = auto_scale_max_count + super().__init__(**kwargs) + self.vm_name = vm_name + self.host_name = host_name + self.network_interfaces = network_interfaces + self.os_disk_name = os_disk_name + self.data_disk_names = data_disk_names class WindowsConfiguration(OSConfiguration): @@ -6383,113 +6052,7 @@ class WindowsConfiguration(OSConfiguration): "os_type": {"key": "osType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.os_type: str = "Windows" - - -class WordpressInstanceResource(ProxyResource): - """WordPress instance resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.workloads.models.SystemData - :ivar version: Application version. Known values are: "5.4.3", "5.4.2", "5.4.1", and "5.4". - :vartype version: str or ~azure.mgmt.workloads.models.WordpressVersions - :ivar database_name: Database name used by the application. - :vartype database_name: str - :ivar database_user: User name used by the application to connect to database. - :vartype database_user: str - :ivar site_url: Site Url to access the WordPress application. - :vartype site_url: str - :ivar provisioning_state: WordPress instance provisioning state. Known values are: - "NotSpecified", "Accepted", "Created", "Succeeded", "Failed", "Canceled", and "Installing". - :vartype provisioning_state: str or ~azure.mgmt.workloads.models.ApplicationProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "site_url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "version": {"key": "properties.version", "type": "str"}, - "database_name": {"key": "properties.databaseName", "type": "str"}, - "database_user": {"key": "properties.databaseUser", "type": "str"}, - "site_url": {"key": "properties.siteUrl", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[Union[str, "_models.WordpressVersions"]] = None, - database_name: Optional[str] = None, - database_user: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Application version. Known values are: "5.4.3", "5.4.2", "5.4.1", and "5.4". - :paramtype version: str or ~azure.mgmt.workloads.models.WordpressVersions - :keyword database_name: Database name used by the application. - :paramtype database_name: str - :keyword database_user: User name used by the application to connect to database. - :paramtype database_user: str - """ - super().__init__(**kwargs) - self.version = version - self.database_name = database_name - self.database_user = database_user - self.site_url = None - self.provisioning_state = None - - -class WordpressInstanceResourceList(_serialization.Model): - """WordPress instance resource list. - - :ivar value: List of resources in current page. - :vartype value: list[~azure.mgmt.workloads.models.WordpressInstanceResource] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[WordpressInstanceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.WordpressInstanceResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: List of resources in current page. - :paramtype value: list[~azure.mgmt.workloads.models.WordpressInstanceResource] - :keyword next_link: Link to next page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py index 3673c7b9e582..200b2a8996f7 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py @@ -16,23 +16,12 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" -class ApplicationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """WordPress instance provisioning state.""" +class ApplicationServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the type of application server VM.""" - NOT_SPECIFIED = "NotSpecified" - ACCEPTED = "Accepted" - CREATED = "Created" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - INSTALLING = "Installing" - - -class AzureFrontDoorEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable Azure front door.""" - - ENABLED = "Enabled" - DISABLED = "Disabled" + ACTIVE = "Active" + STANDBY = "Standby" + UNKNOWN = "Unknown" class CentralServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -47,6 +36,14 @@ class CentralServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMe STANDBY = "Standby" +class ConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of file share config.""" + + SKIP = "Skip" + CREATE_AND_MOUNT = "CreateAndMount" + MOUNT = "Mount" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -56,40 +53,16 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" -class DatabaseTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of the server SKU.""" +class DiskSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the disk sku name.""" - BURSTABLE = "Burstable" - GENERAL_PURPOSE = "GeneralPurpose" - MEMORY_OPTIMIZED = "MemoryOptimized" - - -class DatabaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Database type.""" - - MY_SQL = "MySql" - - -class DiskStorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Storage type.""" - - PREMIUM_LRS = "Premium_LRS" STANDARD_LRS = "Standard_LRS" + PREMIUM_LRS = "Premium_LRS" STANDARD_SSD_LRS = "StandardSSD_LRS" - - -class EnableBackup(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable Azure backup for the workload.""" - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class EnableSslEnforcement(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable SSL enforcement on the database.""" - - ENABLED = "Enabled" - DISABLED = "Disabled" + ULTRA_SSD_LRS = "UltraSSD_LRS" + PREMIUM_ZRS = "Premium_ZRS" + STANDARD_SSD_ZRS = "StandardSSD_ZRS" + PREMIUM_V2_LRS = "PremiumV2_LRS" class EnqueueReplicationServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -99,43 +72,6 @@ class EnqueueReplicationServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta) ENQUEUE_REPLICATOR2 = "EnqueueReplicator2" -class FileShareStorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """File share backing storage type.""" - - STANDARD_LRS = "Standard_LRS" - STANDARD_GRS = "Standard_GRS" - STANDARD_ZRS = "Standard_ZRS" - PREMIUM_LRS = "Premium_LRS" - - -class FileShareType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Share type.""" - - NFS_ON_CONTROLLER = "NfsOnController" - AZURE_FILES = "AzureFiles" - - -class HAEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable HA for the server.""" - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Load balancer type.""" - - APPLICATION_GATEWAY = "ApplicationGateway" - LOAD_BALANCER = "LoadBalancer" - - -class LocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the extended location.""" - - REGION = "Region" - EDGE_ZONE = "EdgeZone" - - class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of managed service identity (only None, UserAssigned types are allowed).""" @@ -143,6 +79,12 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" +class NamingPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The pattern type to be used for resource naming.""" + + FULL_RESOURCE_NAME = "FullResourceName" + + class OperationProperties(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the workload operation origin.""" @@ -161,31 +103,6 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" -class OSImageOffer(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OS image offer.""" - - UBUNTU_SERVER = "UbuntuServer" - - -class OSImagePublisher(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OS image publisher.""" - - CANONICAL = "Canonical" - - -class OSImageSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OS image sku.""" - - EIGHTEEN04_LTS = "18.04-LTS" - SIXTEEN04_LTS = "16.04-LTS" - - -class OSImageVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OS image version.""" - - LATEST = "latest" - - class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The OS Type.""" @@ -193,34 +110,6 @@ class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): WINDOWS = "Windows" -class PHPVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """PHP version.""" - - SEVEN2 = "7.2" - SEVEN3 = "7.3" - SEVEN4 = "7.4" - - -class PhpWorkloadProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Php workload resource provisioning state.""" - - NOT_SPECIFIED = "NotSpecified" - ACCEPTED = "Accepted" - CREATED = "Created" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - PROVISIONING = "Provisioning" - DELETING = "Deleting" - - -class RedisCacheFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Cache family.""" - - C = "C" - P = "P" - - class RoutingPreference(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sets the routing preference of the SAP monitor. By default only RFC1918 traffic is routed to the customer VNET. @@ -283,6 +172,16 @@ class SAPHighAvailabilityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AVAILABILITY_ZONE = "AvailabilityZone" +class SapLandscapeMonitorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of provisioning of the SAP monitor.""" + + ACCEPTED = "Accepted" + CREATED = "Created" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + + class SAPProductType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the SAP Product type.""" @@ -335,47 +234,7 @@ class SAPVirtualInstanceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): OFFLINE = "Offline" PARTIALLY_RUNNING = "PartiallyRunning" UNAVAILABLE = "Unavailable" - - -class SearchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Search type.""" - - ELASTIC = "Elastic" - - -class SkuRestrictionReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The SKU restriction reason code.""" - - NOT_SPECIFIED = "NotSpecified" - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class SkuRestrictionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The SKU restriction type.""" - - NOT_SPECIFIED = "NotSpecified" - LOCATION = "Location" - ZONE = "Zone" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scale type of the SKU capacity.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This field is required to be implemented by the Resource Provider if the service has more than - one tier, but is not required on a PUT. - """ - - FREE = "Free" - BASIC = "Basic" - STANDARD = "Standard" - PREMIUM = "Premium" + SOFT_SHUTDOWN = "SoftShutdown" class SslPreference(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -386,21 +245,6 @@ class SslPreference(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVER_CERTIFICATE = "ServerCertificate" -class WordpressVersions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Application version.""" - - FIVE4_3 = "5.4.3" - FIVE4_2 = "5.4.2" - FIVE4_1 = "5.4.1" - FIVE4 = "5.4" - - -class WorkloadKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates which kind of php workload this resource represent e.g WordPress.""" - - WORD_PRESS = "WordPress" - - class WorkloadMonitorActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the action type of workload operation.""" diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py index 9ec296484c8e..fe951707c6a1 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py @@ -6,34 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._php_workloads_operations import PhpWorkloadsOperations -from ._wordpress_instances_operations import WordpressInstancesOperations from ._workloads_client_operations import WorkloadsClientOperationsMixin from ._sap_virtual_instances_operations import SAPVirtualInstancesOperations from ._sap_central_instances_operations import SAPCentralInstancesOperations from ._sap_database_instances_operations import SAPDatabaseInstancesOperations from ._sap_application_server_instances_operations import SAPApplicationServerInstancesOperations -from ._operations import Operations from ._monitors_operations import MonitorsOperations from ._provider_instances_operations import ProviderInstancesOperations -from ._skus_operations import SkusOperations +from ._sap_landscape_monitor_operations import SapLandscapeMonitorOperations +from ._operations import Operations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PhpWorkloadsOperations", - "WordpressInstancesOperations", "WorkloadsClientOperationsMixin", "SAPVirtualInstancesOperations", "SAPCentralInstancesOperations", "SAPDatabaseInstancesOperations", "SAPApplicationServerInstancesOperations", - "Operations", "MonitorsOperations", "ProviderInstancesOperations", - "SkusOperations", + "SapLandscapeMonitorOperations", + "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py index eb00d2a8bd85..0730f289605c 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py @@ -47,8 +47,8 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -73,8 +73,8 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -105,8 +105,8 @@ def build_get_request(resource_group_name: str, monitor_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -140,8 +140,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -178,8 +178,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -213,8 +213,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -279,7 +279,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Monitor"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None) @@ -366,7 +366,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None) @@ -467,7 +467,7 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Monitor] = kwargs.pop("cls", None) @@ -520,7 +520,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -683,7 +683,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -746,7 +746,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -816,7 +816,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -960,7 +960,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py index 821f5aee0b9c..76351375256f 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py @@ -45,8 +45,8 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -93,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py index 27bee9349468..d5f64a29df29 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py @@ -47,8 +47,8 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -82,8 +82,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -118,8 +118,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -157,8 +157,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -226,7 +226,7 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ProviderInstanceListResult] = kwargs.pop("cls", None) @@ -332,7 +332,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ProviderInstance] = kwargs.pop("cls", None) @@ -391,7 +391,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -574,7 +574,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -638,7 +638,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -712,7 +712,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py index 47e043be7d78..e4cea6f2df5c 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py @@ -53,8 +53,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -93,8 +93,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,8 +136,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -179,8 +179,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -215,8 +215,8 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -244,6 +244,89 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_start_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class SAPApplicationServerInstancesOperations: """ .. warning:: @@ -295,7 +378,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) @@ -354,7 +437,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -543,7 +626,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -612,7 +695,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -798,7 +881,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -862,7 +945,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -936,7 +1019,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -1005,7 +1088,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPApplicationServerInstanceList] = kwargs.pop("cls", None) @@ -1078,3 +1161,387 @@ def get_next(next_link=None): list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances" } + + def _start_instance_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + @distributed_trace + def begin_start_instance( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Is either a model type or a IO + type. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py index 4f5d77e0c9d3..d968c49d7ee3 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py @@ -53,8 +53,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -93,8 +93,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,8 +136,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -179,8 +179,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -215,8 +215,8 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -244,6 +244,89 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_start_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class SAPCentralInstancesOperations: """ .. warning:: @@ -294,7 +377,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) @@ -353,7 +436,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -539,7 +622,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -608,7 +691,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -794,7 +877,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -858,7 +941,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -934,7 +1017,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -1003,7 +1086,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPCentralInstanceList] = kwargs.pop("cls", None) @@ -1076,3 +1159,387 @@ def get_next(next_link=None): list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances" } + + def _start_instance_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + @distributed_trace + def begin_start_instance( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Is either a model type or a IO + type. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py index 97252fcb1c25..314123bfee4b 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py @@ -53,8 +53,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -93,8 +93,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,8 +136,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -179,8 +179,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -215,8 +215,8 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -244,6 +244,89 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_start_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class SAPDatabaseInstancesOperations: """ .. warning:: @@ -294,7 +377,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) @@ -353,7 +436,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -542,7 +625,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -611,7 +694,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -794,7 +877,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -858,7 +941,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -933,7 +1016,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -1000,7 +1083,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPDatabaseInstanceList] = kwargs.pop("cls", None) @@ -1073,3 +1156,387 @@ def get_next(next_link=None): list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances" } + + def _start_instance_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + @distributed_trace + def begin_start_instance( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Is either a model type + or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_landscape_monitor_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_landscape_monitor_operations.py new file mode 100644 index 000000000000..0dd370d3fd21 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_landscape_monitor_operations.py @@ -0,0 +1,749 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import WorkloadsClientMixinABC, _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SapLandscapeMonitorOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`sap_landscape_monitor` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.SapLandscapeMonitor: + """Gets configuration values for Single Pane Of Glass for SAP monitor. + + Gets configuration values for Single Pane Of Glass for SAP monitor for the specified + subscription, resource group, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @overload + def create( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: _models.SapLandscapeMonitor, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Creates a SAP Landscape Monitor Dashboard. + + Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Creates a SAP Landscape Monitor Dashboard. + + Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO], + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Creates a SAP Landscape Monitor Dashboard. + + Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Is either a model type or a IO type. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_landscape_monitor_parameter, (IO, bytes)): + _content = sap_landscape_monitor_parameter + else: + _json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor") + + request = build_create_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> None: + """Deletes a SAP Landscape Monitor Dashboard. + + Deletes a SAP Landscape Monitor Dashboard with the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @overload + def update( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: _models.SapLandscapeMonitor, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Patches the SAP Landscape Monitor Dashboard. + + Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Patches the SAP Landscape Monitor Dashboard. + + Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Required. + :type sap_landscape_monitor_parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + monitor_name: str, + sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO], + **kwargs: Any + ) -> _models.SapLandscapeMonitor: + """Patches the SAP Landscape Monitor Dashboard. + + Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :param sap_landscape_monitor_parameter: Request body representing a configuration for Sap + Landscape Monitor Dashboard. Is either a model type or a IO type. Required. + :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitor or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_landscape_monitor_parameter, (IO, bytes)): + _content = sap_landscape_monitor_parameter + else: + _json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor") + + request = build_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + } + + @distributed_trace + def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.SapLandscapeMonitorListResult: + """Gets configuration values for Single Pane Of Glass for SAP monitor. + + Gets configuration values for Single Pane Of Glass for SAP monitor for the specified + subscription, resource group, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SapLandscapeMonitorListResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitorListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SapLandscapeMonitorListResult] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SapLandscapeMonitorListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor" + } diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py index 51ccaa31c3ec..c3e300a68ce2 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py @@ -49,8 +49,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -87,8 +87,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -122,8 +122,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -160,8 +160,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -193,8 +193,8 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -225,8 +225,8 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -255,8 +255,8 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -290,8 +290,8 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -359,7 +359,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -529,7 +529,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -606,7 +606,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) @@ -743,7 +743,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -811,7 +811,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -881,7 +881,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -942,7 +942,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) @@ -1027,7 +1027,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SAPVirtualIns _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) @@ -1113,7 +1113,7 @@ def _start_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) @@ -1183,7 +1183,7 @@ def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) @@ -1247,7 +1247,7 @@ def _stop_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1420,7 +1420,7 @@ def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py index 949fe008b422..94c2f60fa02a 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py @@ -43,8 +43,8 @@ def build_sap_sizing_recommendations_request(location: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -76,8 +76,8 @@ def build_sap_supported_sku_request(location: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,8 +109,8 @@ def build_sap_disk_configurations_request(location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,8 +142,8 @@ def build_sap_availability_zone_details_request(location: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-12-01-preview") + api_version: Literal["2022-11-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -259,7 +259,7 @@ def sap_sizing_recommendations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -393,7 +393,7 @@ def sap_supported_sku( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -527,7 +527,7 @@ def sap_disk_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -665,7 +665,7 @@ def sap_availability_zone_details( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01-preview"] = kwargs.pop( + api_version: Literal["2022-11-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create.py index 0f74e71f9b50..c34407109636 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/Db2ProviderInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/Db2ProviderInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create_root_certificate.py index 572337e35bfd..d12965eb1fc1 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create_root_certificate.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create_root_certificate.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/Db2ProviderInstances_Create_Root_Certificate.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/Db2ProviderInstances_Create_Root_Certificate.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_get.py index efc8e0fad64e..e9eef3ff6598 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/Db2ProviderInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/Db2ProviderInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_delete.py index 41cc5bc10d7a..75229d453aa5 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/monitors_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_get.py index 9a6437cccf5b..d19a763b9a2c 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/monitors_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list.py index 5b819a2c9ecb..43ebf5ed1c6f 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_List.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/monitors_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list_by_rg.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list_by_rg.py index f3227bc61d6f..82a4b28f5b98 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list_by_rg.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list_by_rg.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_ListByRG.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/monitors_ListByRG.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags.py index b2c13114e391..169a26d455ab 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_PatchTags.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/monitors_PatchTags.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags_delete.py index b8eb2aef12a4..f3fa16c4c492 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_PatchTags_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/monitors_PatchTags_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create.py index 647ffd5a4b19..644e7dd082f7 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create_root_certificate.py index 27516e9c2602..06ea2f54f6ba 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create_root_certificate.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create_root_certificate.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Create_Root_Certificate.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Create_Root_Certificate.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_get.py index 78ac93963e22..4aa0287c8f56 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create.py index 6d116380370a..5c3e83df3997 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create.py @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create_root_certificate.py index 6ad1c46da699..635b656bd5fb 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create_root_certificate.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create_root_certificate.py @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Create_Root_Certificate.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Create_Root_Certificate.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_get.py index b595173374aa..2d3593340ff5 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py index 7440c1a129f2..0657077d4729 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_create_or_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_create_or_update.py deleted file mode 100644 index c5a807368ba8..000000000000 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_create_or_update.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloads import WorkloadsClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloads -# USAGE - python php_workloads_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.php_workloads.begin_create_or_update( - resource_group_name="test-rg", - php_workload_name="wp39", - php_workload_resource={ - "kind": "WordPress", - "location": "eastus2", - "properties": { - "adminUserProfile": {"sshPublicKey": "===SSH=PUBLIC=KEY===", "userName": "wpadmin"}, - "appLocation": "eastus", - "backupProfile": {"backupEnabled": "Disabled"}, - "cacheProfile": {"capacity": 0, "family": "C", "name": "wp-cache", "skuName": "Basic"}, - "controllerProfile": { - "dataDisks": [{"sizeInGB": 100, "storageType": "Premium_LRS"}], - "name": "contoller-vm", - "nodeSku": "Standard_DS2_v2", - "osDisk": {"storageType": "Premium_LRS"}, - "osImage": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "18.0-LTS", - "version": "latest", - }, - }, - "databaseProfile": { - "backupRetentionDays": 7, - "haEnabled": "Disabled", - "serverName": "wp-db-server", - "sku": "Standard_D32s_v4", - "sslEnforcementEnabled": "Enabled", - "storageInGB": 128, - "storageIops": 200, - "storageSku": "Premium_LRS", - "tier": "GeneralPurpose", - "type": "MySql", - "version": "5.7", - }, - "fileshareProfile": {"shareSizeInGB": 100, "shareType": "AzureFiles", "storageType": "Premium_LRS"}, - "managedResourceGroupConfiguration": {"name": "php-mrg-wp39"}, - "networkProfile": { - "azureFrontDoorEnabled": "Enabled", - "loadBalancerSku": "Standard", - "loadBalancerType": "LoadBalancer", - }, - "phpProfile": {"version": "7.3"}, - "searchProfile": { - "nodeSku": "Standard_DS2_v2", - "osDisk": {"storageType": "Premium_LRS"}, - "osImage": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "18.0-LTS", - "version": "latest", - }, - "searchType": "Elastic", - }, - "siteProfile": {"domainName": "www.example.com"}, - "webNodesProfile": { - "autoScaleMaxCount": 1, - "autoScaleMinCount": 1, - "name": "web-server", - "nodeSku": "Standard_DS2_v2", - "osDisk": {"storageType": "Premium_LRS"}, - "osImage": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "18.0-LTS", - "version": "latest", - }, - }, - }, - "sku": {"name": "Large"}, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/PhpWorkloads_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create.py index 95cf781e3c48..1fe6a23be33c 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create_root_certificate.py index 65f6ca37464b..243489623b50 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create_root_certificate.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create_root_certificate.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create_Root_Certificate.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create_Root_Certificate.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_get.py index a2e8f71335d9..f1fad5ec0c08 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create.py index 9e987faa23f0..1d5376578dd9 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create.py @@ -38,6 +38,7 @@ def main(): "providerSettings": { "prometheusUrl": "http://192.168.0.0:9090/metrics", "providerType": "PrometheusOS", + "sapSid": "SID", "sslCertificateUri": "https://storageaccount.blob.core.windows.net/containername/filename", "sslPreference": "ServerCertificate", } @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create_root_certificate.py index e3f0edd11577..ad3d9c03d1a0 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create_root_certificate.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create_root_certificate.py @@ -38,6 +38,7 @@ def main(): "providerSettings": { "prometheusUrl": "http://192.168.0.0:9090/metrics", "providerType": "PrometheusOS", + "sapSid": "SID", "sslPreference": "RootCertificate", } } @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Create_Root_Certificate.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Create_Root_Certificate.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_get.py index f230d350892a..ddd59a5822b1 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create.py index a0519faa0bfa..db4fd49e73ca 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create.py @@ -43,6 +43,7 @@ def main(): "hostname": "name", "instanceNumber": "00", "providerType": "SapHana", + "sapSid": "SID", "sqlPort": "0000", "sslCertificateUri": "https://storageaccount.blob.core.windows.net/containername/filename", "sslHostNameInCertificate": "xyz.domain.com", @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/ProviderInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create_root_certificate.py index 594a96e92c2b..96b287ee7627 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create_root_certificate.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create_root_certificate.py @@ -43,6 +43,7 @@ def main(): "hostname": "name", "instanceNumber": "00", "providerType": "SapHana", + "sapSid": "SID", "sqlPort": "0000", "sslHostNameInCertificate": "xyz.domain.com", "sslPreference": "RootCertificate", @@ -53,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Create_Root_Certificate.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/ProviderInstances_Create_Root_Certificate.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_delete.py index 17cc646b22f0..856bf83c6041 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/ProviderInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_get.py index 60c01da622f1..8460b827a7ad 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/ProviderInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_list.py index cff282efc35e..421c0230a671 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_list.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_List.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/ProviderInstances_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create.py index ebf680b7aab9..f8b4addd1668 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create_ha_av_set.py new file mode 100644 index 000000000000..e748038a516e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create_ha_av_set.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_application_server_instances_create_ha_av_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_application_server_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Create_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_delete.py index 456d14959ba2..385273fdbbd6 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_get.py index bd5f6393b759..03379711e02a 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_list.py index dad88556390e..18c19059e751 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_list.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_List.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_start_instance.py new file mode 100644 index 000000000000..27d28ffe301a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_start_instance.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_application_server_instances_start_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_application_server_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_StartInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_stop_instance.py new file mode 100644 index 000000000000..a28648cdc30f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_stop_instance.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_application_server_instances_stop_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_application_server_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_StopInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_update.py index 46270ab2298b..1049da1f858b 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Update.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPApplicationServerInstances_Update.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_eastus.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_eastus.py index 131c96c30eab..7810daf2b4ed 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_eastus.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_eastus.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_eastus.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_eastus.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_northeurope.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_northeurope.py index 3b18f535756e..177fb9e336cb 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_northeurope.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_northeurope.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_northeurope.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_northeurope.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create.py index 524241615232..43134b3c1808 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create_ha_av_set.py new file mode 100644 index 000000000000..eb74a1a295cf --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create_ha_av_set.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_central_instances_create_ha_av_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_central_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Create_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_delete.py index 20d13349c92d..f1f47e83be79 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_get.py index 0543b8a215cd..dbe64e7f2f2b 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_list.py index 0cd9d3bc4c17..463ca63ad3e0 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_list.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPCentralInstances_List.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_start_instance.py new file mode 100644 index 000000000000..ff13a214c7ee --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_start_instance.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_central_instances_start_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_central_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_StartInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_stop_instance.py new file mode 100644 index 000000000000..64fd7a6e0488 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_stop_instance.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_central_instances_stop_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_central_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_StopInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_update.py index 006cbe58fbc0..bc8b958b6a2b 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Update.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPCentralInstances_Update.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create.py index 66909457ec27..264b48183303 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Create.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create_ha_av_set.py new file mode 100644 index 000000000000..a4bd785df19c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create_ha_av_set.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_database_instances_create_ha_av_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_database_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="databaseServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Create_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_delete.py index 115f1c28c309..e2da40b1464c 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_get.py index d37dc3ca4f90..aca9820052e4 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_list.py index 1e9b35810b79..1b15962ebf43 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_list.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_List.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_start_instance.py new file mode 100644 index 000000000000..cf8297349c8a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_start_instance.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_database_instances_start_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_database_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_StartInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_stop_instance.py new file mode 100644 index 000000000000..b5461858b431 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_stop_instance.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_database_instances_stop_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_database_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_StopInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_update.py index dd8b70b797b3..a6990dc07b3c 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Update.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDatabaseInstances_Update.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_non_prod.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_non_prod.py index 1bb38627feb7..4348bf7dd8f4 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_non_prod.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_non_prod.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_NonProd.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_NonProd.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_prod.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_prod.py index 36b3fb59117c..a5935405288e 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_prod.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_prod.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_Prod.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_Prod.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_create_or_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_create.py similarity index 62% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_create_or_update.py rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_create.py index 5d138ca3eefc..0b9b155213ce 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_create_or_update.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-workloads # USAGE - python wordpress_instances_create_or_update.py + python sap_landscape_monitor_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,19 +26,25 @@ def main(): client = WorkloadsClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.wordpress_instances.begin_create_or_update( - resource_group_name="test-rg", - php_workload_name="wp39", - wordpress_instance_resource={ - "properties": {"databaseName": "wpdb", "databaseUser": "wpuser", "version": "5.4.2"} + response = client.sap_landscape_monitor.create( + resource_group_name="myResourceGroup", + monitor_name="mySapMonitor", + sap_landscape_monitor_parameter={ + "properties": { + "grouping": { + "landscape": [{"name": "Prod", "topSid": ["SID1", "SID2"]}], + "sapApplication": [{"name": "ERP1", "topSid": ["SID1", "SID2"]}], + }, + "topMetricsThresholds": [{"green": 90, "name": "Instance Availability", "red": 50, "yellow": 75}], + } }, - ).result() + ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/WordpressInstances_CreateOrUpdate.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/SapLandscapeMonitor_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_delete.py new file mode 100644 index 000000000000..fc006a833dba --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_landscape_monitor_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sap_landscape_monitor.delete( + resource_group_name="myResourceGroup", + monitor_name="mySapMonitor", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/SapLandscapeMonitor_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_get.py new file mode 100644 index 000000000000..2718fdbec531 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_landscape_monitor_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sap_landscape_monitor.get( + resource_group_name="myResourceGroup", + monitor_name="mySapMonitor", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/SapLandscapeMonitor_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_list.py new file mode 100644 index 000000000000..b8e550fcae76 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_list.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_landscape_monitor_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sap_landscape_monitor.list( + resource_group_name="myResourceGroup", + monitor_name="mySapMonitor", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/SapLandscapeMonitor_List.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_update.py new file mode 100644 index 000000000000..42ef1a0c8cc3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_update.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_landscape_monitor_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sap_landscape_monitor.update( + resource_group_name="myResourceGroup", + monitor_name="mySapMonitor", + sap_landscape_monitor_parameter={ + "properties": { + "grouping": { + "landscape": [{"name": "Prod", "topSid": ["SID1", "SID2"]}], + "sapApplication": [{"name": "ERP1", "topSid": ["SID1", "SID2"]}], + }, + "topMetricsThresholds": [{"green": 90, "name": "Instance Availability", "red": 50, "yellow": 75}], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/workloadmonitor/SapLandscapeMonitor_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_distributed.py index 25e02449b542..b6d97d8fd3a7 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_distributed.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_distributed.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_Distributed.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_set.py index 7ba744a080c1..a3c6535d6133 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_set.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvSet.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvSet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_zone.py index 7e7ce36677f5..2b6d9385459f 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_zone.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_zone.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvZone.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvZone.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_single_server.py index 0e0e6dfa461f..fcb20c35aab9 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_single_server.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_single_server.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_SingleServer.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_SingleServer.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed.py index 0f77bb216f4f..b544f8492df0 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_Distributed.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_set.py index aa95ea0eea13..0d18b9ce1eca 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_set.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvSet.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvSet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_zone.py index 240bfc16a0d0..2a7f049504b8 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_zone.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_zone.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvZone.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvZone.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_single_server.py index 39c3beeaaf24..a4fb928d8646 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_single_server.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_single_server.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_SingleServer.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_SingleServer.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_distributed.py new file mode 100644 index 000000000000..35f0e4df2aec --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_distributed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_distributed.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py new file mode 100644 index 000000000000..b245cdc447ca --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py new file mode 100644 index 000000000000..9e7764a0f64a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_single_server.py new file mode 100644 index 000000000000..41347a7a8c4c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_single_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover.py index c39878c9ddd7..efb637681569 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py new file mode 100644 index 000000000000..7fd2a599020b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_distributed.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_delete.py rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_distributed.py index 6404f2fc5b4c..a3b9c792416a 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_distributed.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-workloads # USAGE - python wordpress_instances_delete.py + python sap_virtual_instances_create_disk_details_distributed.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,13 @@ def main(): subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", ) - response = client.wordpress_instances.delete( + response = client.sap_virtual_instances.begin_create( resource_group_name="test-rg", - php_workload_name="wp39", - ) + sap_virtual_instance_name="X00", + ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/WordpressInstances_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_set.py similarity index 82% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_delete.py rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_set.py index 4026df0e4d95..03928e9b0ea0 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_set.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-workloads # USAGE - python php_workloads_delete.py + python sap_virtual_instances_create_disk_details_ha_av_set.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,13 @@ def main(): subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", ) - response = client.php_workloads.begin_delete( + response = client.sap_virtual_instances.begin_create( resource_group_name="test-rg", - php_workload_name="wp39", + sap_virtual_instance_name="X00", ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/PhpWorkloads_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_zone.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_get.py rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_zone.py index 4d9fa0d5e14b..21f4ba9206a9 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/php_workloads_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_zone.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-workloads # USAGE - python php_workloads_get.py + python sap_virtual_instances_create_disk_details_ha_av_zone.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,13 @@ def main(): subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", ) - response = client.php_workloads.get( + response = client.sap_virtual_instances.begin_create( resource_group_name="test-rg", - php_workload_name="wp39", - ) + sap_virtual_instance_name="X00", + ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/PhpWorkloads_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_single_server.py new file mode 100644 index 000000000000..37850e84111e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_disk_details_single_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed.py index a23d53ece112..38da31525170 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_create_trans.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_create_trans.py new file mode 100644 index 000000000000..02c76681f5df --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_create_trans.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_distributed_create_trans.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTrans.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_mount_trans.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_get.py rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_mount_trans.py index 95c869318892..bc58db421892 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/wordpress_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_mount_trans.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-workloads # USAGE - python wordpress_instances_get.py + python sap_virtual_instances_create_distributed_mount_trans.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,13 @@ def main(): subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", ) - response = client.wordpress_instances.get( + response = client.sap_virtual_instances.begin_create( resource_group_name="test-rg", - php_workload_name="wp39", - ) + sap_virtual_instance_name="X00", + ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/phpworkloads/WordpressInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTrans.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_skip_trans_mount.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_skip_trans_mount.py new file mode 100644 index 000000000000..3bd6579ba15e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_skip_trans_mount.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads +# USAGE + python sap_virtual_instances_create_distributed_skip_trans_mount.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransMount.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_set.py index ba0cd9973a25..b6e1b8080eb5 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_set.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_zone.py index 9c16a5ad61f7..bc763bdb7037 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_zone.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_zone.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_single_server.py index 9ae62e09c61b..78b4f2f583e3 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_single_server.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_single_server.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_distributed.py index a44d64aa9bf8..527b50e53160 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_distributed.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_distributed.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_set.py index ef49bbfd083a..863c1a5f554b 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_set.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_zone.py index 0c0b5e3ba874..7217670fe525 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_zone.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_zone.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_single_server.py index b3fba554c78b..ad931b081741 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_single_server.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_single_server.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_delete.py index 1a541c693bc4..90f6aa0d4133 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_distributed.py index d5ff27081cca..472956b6c380 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_distributed.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_distributed.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_set.py index 7ec97e9cd623..c24eeb11bd88 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_set.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_zone.py index bcb3039739d7..9478f64a8856 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_zone.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_zone.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_single_server.py index d35f8eb72324..fd407118156b 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_single_server.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_single_server.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_get.py index ae49c19da633..421850dfdd16 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_distributed.py index 8a2ca605dc39..4336982a2234 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_distributed.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_distributed.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_single_server.py index 3c040a39c1cb..3f72bb4a9500 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_single_server.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_single_server.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_resource_group.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_resource_group.py index 7c5a2792fcd7..bf40f6ca06ee 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_resource_group.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListByResourceGroup.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_subscription.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_subscription.py index d9b14667ec0c..ee70f824c6fb 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_subscription.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListBySubscription.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_start.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_start.py index 2a8bde724127..618437299aa6 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_start.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_start.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_stop.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_stop.py index 5a7edc38ad15..3885e89e10fc 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_stop.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_stop.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_update.py index 6ff47e40ead8..fa28b953f35b 100644 --- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Update.json +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2022-11-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Update.json if __name__ == "__main__": main() diff --git a/shared_requirements.txt b/shared_requirements.txt index 7c9609af2bc1..c4be7f86472b 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -184,6 +184,7 @@ yarl<2.0,>=1.0 #override azure-mgmt-powerbidedicated msrest>=0.7.1 #override azure-mgmt-eventhub typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-nginx typing-extensions>=4.3.0; python_version<'3.8.0' +#override azure-mgmt-datalake-store typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-portal msrest>=0.7.1 #override azure-search-documents azure-core<2.0.0,>=1.24.0 #override azure-mgmt-managementgroups typing-extensions>=4.3.0; python_version<'3.8.0' @@ -246,7 +247,8 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-eventhub-checkpointstoretable azure-core<2.0.0,>=1.14.0 #override azure-appconfiguration azure-core<2.0.0,>=1.24.0 #override azure-mgmt-maintenance msrest>=0.7.1 -#override azure-appconfiguration-provider azure-appconfiguration<2.0.0,>=1.3.0 +#override azure-appconfiguration-provider azure-core<2.0.0,>=1.24.0 +#override azure-appconfiguration-provider azure-appconfiguration<2.0.0,>=1.4.0 #override azure-appconfiguration-provider azure-keyvault-secrets<5.0.0,>=4.3.0 #override azure-mgmt-datamigration typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-purview typing-extensions>=4.3.0; python_version<'3.8.0' @@ -343,6 +345,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-messaging-webpubsubservice azure-core<2.0.0,>=1.24.0 #override azure-mgmt-dynatrace typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-messaging-webpubsubservice pyjwt>=1.7.1 +#override azure-mgmt-iothub typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-networkfunction typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-security azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mixedreality-authentication azure-core<2.0.0,>=1.4.0 @@ -469,6 +472,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-webpubsub msrest>=0.7.1 #override azure-mgmt-mobilenetwork msrest>=0.7.1 #override azure-mgmt-kusto msrest>=0.7.1 +#override azure-mgmt-appconfiguration typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-servicelinker msrest>=0.7.1 #override azure-mgmt-loganalytics typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-servicelinker azure-mgmt-core>=1.3.2,<2.0.0 @@ -548,6 +552,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-kubernetesconfiguration azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-subscription typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-healthcareapis msrest>=0.7.1 +#override azure-mgmt-authorization typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-healthcareapis azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-media msrest>=0.7.1 #override azure-mgmt-media azure-mgmt-core>=1.3.2,<2.0.0 @@ -680,8 +685,8 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-advisor msrest>=0.7.1 #override azure-mgmt-advisor azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-privatedns azure-mgmt-core>=1.3.2,<2.0.0 -#override azure-mgmt-servicebus msrest>=0.6.21 -#override azure-mgmt-servicebus azure-mgmt-core>=1.3.1,<2.0.0 +#override azure-mgmt-servicebus msrest>=0.7.1 +#override azure-mgmt-servicebus azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-relay msrest>=0.7.1 #override azure-mgmt-policyinsights typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-mixedreality azure-mgmt-core>=1.3.2,<2.0.0 @@ -708,6 +713,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-authorization msrest>=0.7.1 #override azure-mgmt-authorization azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-iothub azure-mgmt-core>=1.3.2,<2.0.0 +#override azure-mgmt-servicebus typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-devtestlabs msrest>=0.7.1 #override azure-mgmt-devtestlabs azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-quantum typing-extensions>=4.3.0; python_version<'3.8.0' @@ -783,6 +789,8 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-developer-loadtesting azure-core<2.0.0,>=1.24.0 #override azure-developer-loadtesting isodate<1.0.0,>=0.6.1 #override azure-developer-loadtesting typing-extensions>=4.3.0 +#override azure-developer-loadtesting msrest>=0.7.1 +#override azure-developer-loadtesting azure-mgmt-core<2.0.0,>=1.3.2 #override azure-mgmt-datalake-analytics msrest>=0.7.1 #override azure-mgmt-iothubprovisioningservices typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-datalake-analytics azure-mgmt-core>=1.3.2,<2.0.0 @@ -805,6 +813,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-redis azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-resourcegraph azure-mgmt-core>=1.3.2,<2.0.0 #override azure-mgmt-desktopvirtualization azure-mgmt-core>=1.3.2,<2.0.0 +#override azure-mgmt-netapp typing-extensions>=4.3.0; python_version<'3.8.0' #override azure-mgmt-resourcegraph msrest>=0.7.1 #override azure-core-experimental azure-core<2.0.0,>=1.25.0 #override azure-developer-devcenter isodate<1.0.0,>=0.6.1 diff --git a/tools/azure-devtools/src/azure_devtools/scenario_tests/preparers.py b/tools/azure-devtools/src/azure_devtools/scenario_tests/preparers.py index ee2a4ca0db03..f88795a2fa40 100644 --- a/tools/azure-devtools/src/azure_devtools/scenario_tests/preparers.py +++ b/tools/azure-devtools/src/azure_devtools/scenario_tests/preparers.py @@ -121,7 +121,9 @@ def _preparer_wrapper(test_class_instance, **kwargs): if self._use_cache and aggregate_cache_key in AbstractPreparer._resource_cache: _logger.debug("Using cached resource for %s", self.__class__.__name__) with self._cache_lock: + new_kwargs = kwargs resource_name, kwargs, _ = AbstractPreparer._resource_cache[aggregate_cache_key] + kwargs.update(new_kwargs) else: resource_name, kwargs = self._prepare_create_resource(test_class_instance, **kwargs) diff --git a/tools/azure-sdk-tools/ci_tools/environment_exclusions.py b/tools/azure-sdk-tools/ci_tools/environment_exclusions.py index 671082653fa1..001cd29dc380 100644 --- a/tools/azure-sdk-tools/ci_tools/environment_exclusions.py +++ b/tools/azure-sdk-tools/ci_tools/environment_exclusions.py @@ -7,317 +7,6 @@ from ci_tools.functions import get_config_setting import os -PYLINT_OPT_OUT = [ - "azure-applicationinsights", - "azure-batch", - "azure-cognitiveservices-anomalydetector", - "azure-cognitiveservices-formrecognizer", - "azure-cognitiveservices-knowledge-nspkg", - "azure-cognitiveservices-knowledge-qnamaker", - "azure-cognitiveservices-language-luis", - "azure-cognitiveservices-language-nspkg", - "azure-cognitiveservices-language-spellcheck", - "azure-cognitiveservices-language-textanalytics", - "azure-cognitiveservices-nspkg", - "azure-cognitiveservices-personalizer", - "azure-cognitiveservices-search-autosuggest", - "azure-cognitiveservices-search-customimagesearch", - "azure-cognitiveservices-search-customsearch", - "azure-cognitiveservices-search-entitysearch", - "azure-cognitiveservices-search-imagesearch", - "azure-cognitiveservices-search-newssearch", - "azure-cognitiveservices-search-nspkg", - "azure-cognitiveservices-search-videosearch", - "azure-cognitiveservices-search-visualsearch", - "azure-cognitiveservices-search-websearch", - "azure-cognitiveservices-vision-computervision", - "azure-cognitiveservices-vision-contentmoderator", - "azure-cognitiveservices-vision-customvision", - "azure-cognitiveservices-vision-face", - "azure-cognitiveservices-vision-nspkg", - "azure-common", - "azure-nspkg", - "azure-servicemanagement-legacy", - "azure-graphrbac", - "azure-loganalytics", - "azure-servicefabric", - "azure-template", - "azure-keyvault", - "azure-synapse", - "azure-synapse-artifacts", - "azure-synapse-spark", - "azure-synapse-accesscontrol", - "azure-synapse-monitoring", - "azure-synapse-managedprivateendpoints", - "azure-synapse-nspkg", - "azure-ai-anomalydetector", - "azure-security-attestation", - "azure-iot-deviceupdate", - "azure-purview-nspkg", - "azure-purview-scanning", - "azure-purview-catalog", - "azure-purview-account", - "azure-purview-administration", - "azure-messaging-nspkg", - "azure-agrifood-farming", - "azure-developer-loadtesting", - "azure-developer-devcenter", - "azure-messaging-webpubsubservice", -] - -# omit package from running mypy checks -MYPY_OPT_OUT = [ - "azure-agrifood-farming", - "azure-ai-anomalydetector", - "azure-appconfiguration-provider", - "azure-security-attestation", - "azure-batch", - "azure-communication-chat", - "azure-communication-email", - "azure-communication-identity", - "azure-communication-jobrouter", - "azure-communication-networktraversal", - "azure-communication-phonenumbers", - "azure-communication-rooms", - "azure-communication-sms", - "azure-cosmos", - "azure-confidentialledger", - "azure-mgmt-core", - "azure-iot-deviceupdate", - "azure-digitaltwins-core", - "azure-eventhub-checkpointstoreblob", - "azure-eventhub-checkpointstoreblob-aio", - "azure-eventhub-checkpointstoretable", - "azure-developer-loadtesting", - "azure-maps-geolocation", - "azure-maps-render", - "azure-maps-route", - "azure-maps-search", - "azure-mixedreality-authentication", - "azure-ai-ml", - "azure-iot-modelsrepository", - "azure-monitor-opentelemetry-exporter", - "azure-purview-administration", - "azure-purview-catalog", - "azure-purview-scanning", - "azure-schemaregistry", - "azure-schemaregistry-avroencoder", - "azure-search-documents", - "azure-storage-blob", - "azure-storage-blob-changefeed", - "azure-storage-file-datalake", - "azure-storage-file-share", - "azure-storage-queue", - "azure-synapse-accesscontrol", - "azure-synapse-artifacts", - "azure-synapse-managedprivateendpoints", - "azure-synapse-monitoring", - "azure-synapse-spark", - "azure-messaging-webpubsubservice", -] - -# omit package from running pyright checks -PYRIGHT_OPT_OUT = [ - "azure-agrifood-farming", - "azure-ai-anomalydetector", - "azure-appconfiguration", - "azure-appconfiguration-provider", - "azure-security-attestation", - "azure-batch", - "azure-communication-chat", - "azure-communication-email", - "azure-communication-identity", - "azure-communication-jobrouter", - "azure-communication-networktraversal", - "azure-communication-phonenumbers", - "azure-communication-rooms", - "azure-communication-sms", - "azure-confidentialledger", - "azure-containerregistry", - "azure-cosmos", - "azure-developer-devcenter", - "azure-iot-deviceupdate", - "azure-digitaltwins-core", - "azure-eventgrid", - "azure-eventhub", - "azure-eventhub-checkpointstoreblob", - "azure-eventhub-checkpointstoreblob-aio", - "azure-eventhub-checkpointstoretable", - "azure-ai-formrecognizer", - "azure-identity", - "azure-keyvault-administration", - "azure-keyvault-certificates", - "azure-keyvault-keys", - "azure-keyvault-secrets", - "azure-developer-loadtesting", - "azure-maps-geolocation", - "azure-maps-render", - "azure-maps-route", - "azure-maps-search", - "azure-ai-metricsadvisor", - "azure-mixedreality-authentication", - "azure-ai-ml", - "azure-iot-modelsrepository", - "azure-monitor-opentelemetry-exporter", - "azure-ai-personalizer", - "azure-purview-administration", - "azure-purview-catalog", - "azure-purview-scanning", - "azure-mixedreality-remoterendering", - "azure-schemaregistry", - "azure-schemaregistry-avroencoder", - "azure-search-documents", - "azure-servicebus", - "azure-storage-blob", - "azure-storage-blob-changefeed", - "azure-storage-file-datalake", - "azure-storage-file-share", - "azure-storage-queue", - "azure-synapse-accesscontrol", - "azure-synapse-artifacts", - "azure-synapse-managedprivateendpoints", - "azure-synapse-monitoring", - "azure-synapse-spark", - "azure-data-tables", - "azure-ai-textanalytics", - "azure-messaging-webpubsubservice", -] - -# omit package from running verifytypes checks -VERIFYTYPES_OPT_OUT = [ - "azure-agrifood-farming", - "azure-ai-anomalydetector", - "azure-appconfiguration", - "azure-appconfiguration-provider", - "azure-security-attestation", - "azure-batch", - "azure-communication-chat", - "azure-communication-email", - "azure-communication-identity", - "azure-communication-jobrouter", - "azure-communication-networktraversal", - "azure-communication-phonenumbers", - "azure-communication-rooms", - "azure-communication-sms", - "azure-confidentialledger", - "azure-containerregistry", - # If you want to remove azure-core, check to see if azure-identity can also be removed - "azure-core", - "azure-mgmt-core", - "azure-core-experimental", - "azure-core-tracing-opencensus", - "azure-core-tracing-opentelemetry", - "azure-cosmos", - "azure-developer-devcenter", - # Remove azure-identity once azure-core (AccessToken) typing is completed - "azure-identity", - "azure-iot-deviceupdate", - "azure-digitaltwins-core", - "azure-eventgrid", - "azure-eventhub", - "azure-eventhub-checkpointstoreblob", - "azure-eventhub-checkpointstoreblob-aio", - "azure-eventhub-checkpointstoretable", - "azure-keyvault-administration", - "azure-keyvault-certificates", - "azure-keyvault-keys", - "azure-keyvault-secrets", - "azure-developer-loadtesting", - "azure-maps-geolocation", - "azure-maps-render", - "azure-maps-route", - "azure-maps-search", - "azure-ai-metricsadvisor", - "azure-mixedreality-authentication", - "azure-ai-ml", - "azure-iot-modelsrepository", - "azure-monitor-opentelemetry-exporter", - "azure-ai-personalizer", - "azure-purview-administration", - "azure-purview-catalog", - "azure-purview-scanning", - "azure-mixedreality-remoterendering", - "azure-schemaregistry", - "azure-schemaregistry-avroencoder", - "azure-servicebus", - "azure-storage-blob", - "azure-storage-blob-changefeed", - "azure-storage-file-datalake", - "azure-storage-file-share", - "azure-storage-queue", - "azure-synapse-accesscontrol", - "azure-synapse-artifacts", - "azure-synapse-managedprivateendpoints", - "azure-synapse-monitoring", - "azure-synapse-spark", - "azure-data-tables", - "azure-messaging-webpubsubservice", -] - -# omit package from running type checkers on samples -# note: if removed from this list, you must enable one or both of mypy or pyright checks. -TYPE_CHECK_SAMPLES_OPT_OUT = [ - "azure-ai-metricsadvisor", - "azure-ai-personalizer", - "azure-agrifood-farming", - "azure-ai-anomalydetector", - "azure-ai-formrecognizer", - "azure-appconfiguration-provider", - "azure-security-attestation", - "azure-batch", - "azure-communication-chat", - "azure-communication-email", - "azure-communication-identity", - "azure-communication-jobrouter", - "azure-communication-networktraversal", - "azure-communication-phonenumbers", - "azure-communication-rooms", - "azure-communication-sms", - "azure-confidentialledger", - "azure-containerregistry", - "azure-cosmos", - "azure-developer-devcenter", - "azure-iot-deviceupdate", - "azure-digitaltwins-core", - "azure-eventgrid", - "azure-eventhub", - "azure-eventhub-checkpointstoreblob", - "azure-eventhub-checkpointstoreblob-aio", - "azure-eventhub-checkpointstoretable", - "azure-keyvault-administration", - "azure-keyvault-certificates", - "azure-keyvault-keys", - "azure-keyvault-secrets", - "azure-developer-loadtesting", - "azure-maps-geolocation", - "azure-maps-render", - "azure-maps-route", - "azure-maps-search", - "azure-mixedreality-authentication", - "azure-ai-ml", - "azure-iot-modelsrepository", - "azure-monitor-opentelemetry-exporter", - "azure-monitor-query", - "azure-purview-administration", - "azure-purview-catalog", - "azure-purview-scanning", - "azure-mixedreality-remoterendering", - "azure-schemaregistry", - "azure-schemaregistry-avroencoder", - "azure-servicebus", - "azure-storage-blob", - "azure-storage-blob-changefeed", - "azure-storage-file-datalake", - "azure-storage-file-share", - "azure-storage-queue", - "azure-synapse-accesscontrol", - "azure-synapse-artifacts", - "azure-synapse-managedprivateendpoints", - "azure-synapse-monitoring", - "azure-synapse-spark", - "azure-messaging-webpubsubservice", -] - # -------------------------------------------------------------------------------------------------------------------- # DO NOT add packages to the below lists. They are used to omit packages that will never run type checking. # @@ -363,16 +52,6 @@ def is_check_enabled(package_path: str, check: str, default: bool = True) -> boo enabled = default package_name = os.path.basename(package_path) - # check the original exclusion lists for the package name - exclusions_for_env = [] - try: - exclusions_for_env = globals()[f"{check.strip().upper()}_OPT_OUT"] - except Exception as e: - pass - - if package_name in exclusions_for_env: - enabled = False - # now pull the new pyproject.toml configuration config = get_config_setting(package_path, check.strip().lower(), True)